Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
2c875651
Commit
2c875651
authored
Nov 06, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
img2enc: support storing alpha planes too in split plane mode
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
db012e16
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
img2enc.c
libavformat/img2enc.c
+9
-5
No files found.
libavformat/img2enc.c
View file @
2c875651
...
...
@@ -68,9 +68,10 @@ static int write_header(AVFormatContext *s)
static
int
write_packet
(
AVFormatContext
*
s
,
AVPacket
*
pkt
)
{
VideoMuxData
*
img
=
s
->
priv_data
;
AVIOContext
*
pb
[
3
];
AVIOContext
*
pb
[
4
];
char
filename
[
1024
];
AVCodecContext
*
codec
=
s
->
streams
[
pkt
->
stream_index
]
->
codec
;
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
codec
->
pix_fmt
);
int
i
;
if
(
!
img
->
is_pipe
)
{
...
...
@@ -81,23 +82,22 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
img
->
img_number
,
img
->
path
);
return
AVERROR
(
EINVAL
);
}
for
(
i
=
0
;
i
<
3
;
i
++
){
for
(
i
=
0
;
i
<
4
;
i
++
){
if
(
avio_open2
(
&
pb
[
i
],
filename
,
AVIO_FLAG_WRITE
,
&
s
->
interrupt_callback
,
NULL
)
<
0
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"Could not open file : %s
\n
"
,
filename
);
return
AVERROR
(
EIO
);
}
if
(
!
img
->
split_planes
)
if
(
!
img
->
split_planes
||
i
+
1
>=
desc
->
nb_components
)
break
;
filename
[
strlen
(
filename
)
-
1
]
=
'U'
+
i
;
filename
[
strlen
(
filename
)
-
1
]
=
((
int
[]){
'U'
,
'V'
,
'A'
,
'x'
})[
i
]
;
}
}
else
{
pb
[
0
]
=
s
->
pb
;
}
if
(
img
->
split_planes
){
const
AVPixFmtDescriptor
*
desc
=
av_pix_fmt_desc_get
(
codec
->
pix_fmt
);
int
ysize
=
codec
->
width
*
codec
->
height
;
int
usize
=
((
-
codec
->
width
)
>>
desc
->
log2_chroma_w
)
*
((
-
codec
->
height
)
>>
desc
->
log2_chroma_h
);
avio_write
(
pb
[
0
],
pkt
->
data
,
ysize
);
...
...
@@ -105,6 +105,10 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
avio_write
(
pb
[
2
],
pkt
->
data
+
ysize
+
usize
,
usize
);
avio_close
(
pb
[
1
]);
avio_close
(
pb
[
2
]);
if
(
desc
->
nb_components
>
3
)
{
avio_write
(
pb
[
3
],
pkt
->
data
+
ysize
+
2
*
usize
,
ysize
);
avio_close
(
pb
[
3
]);
}
}
else
{
if
(
ff_guess_image2_codec
(
s
->
filename
)
==
AV_CODEC_ID_JPEG2000
){
AVStream
*
st
=
s
->
streams
[
0
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment