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
d00a8fd4
Commit
d00a8fd4
authored
Oct 09, 2015
by
Luca Barbato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
yuv4mpeg: Use the wrapped avframe pseudo-encoder
parent
00332e0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
12 deletions
+11
-12
yuv4mpegenc.c
libavformat/yuv4mpegenc.c
+11
-12
No files found.
libavformat/yuv4mpegenc.c
View file @
d00a8fd4
...
...
@@ -88,7 +88,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVStream
*
st
=
s
->
streams
[
pkt
->
stream_index
];
AVIOContext
*
pb
=
s
->
pb
;
AV
Picture
*
pictur
e
;
AV
Frame
*
fram
e
;
int
*
first_pkt
=
s
->
priv_data
;
int
width
,
height
,
h_chroma_shift
,
v_chroma_shift
;
int
i
;
...
...
@@ -96,7 +96,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
char
buf1
[
20
];
uint8_t
*
ptr
,
*
ptr1
,
*
ptr2
;
picture
=
(
AVPictur
e
*
)
pkt
->
data
;
frame
=
(
AVFram
e
*
)
pkt
->
data
;
/* for the first packet we have to output the header as well */
if
(
*
first_pkt
)
{
...
...
@@ -118,10 +118,10 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
width
=
st
->
codec
->
width
;
height
=
st
->
codec
->
height
;
ptr
=
pictur
e
->
data
[
0
];
ptr
=
fram
e
->
data
[
0
];
for
(
i
=
0
;
i
<
height
;
i
++
)
{
avio_write
(
pb
,
ptr
,
width
);
ptr
+=
pictur
e
->
linesize
[
0
];
ptr
+=
fram
e
->
linesize
[
0
];
}
if
(
st
->
codec
->
pix_fmt
!=
AV_PIX_FMT_GRAY8
)
{
...
...
@@ -132,15 +132,15 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
width
=
-
(
-
width
>>
h_chroma_shift
);
height
=
-
(
-
height
>>
v_chroma_shift
);
ptr1
=
pictur
e
->
data
[
1
];
ptr2
=
pictur
e
->
data
[
2
];
ptr1
=
fram
e
->
data
[
1
];
ptr2
=
fram
e
->
data
[
2
];
for
(
i
=
0
;
i
<
height
;
i
++
)
{
/* Cb */
avio_write
(
pb
,
ptr1
,
width
);
ptr1
+=
pictur
e
->
linesize
[
1
];
ptr1
+=
fram
e
->
linesize
[
1
];
}
for
(
i
=
0
;
i
<
height
;
i
++
)
{
/* Cr */
avio_write
(
pb
,
ptr2
,
width
);
ptr2
+=
pictur
e
->
linesize
[
2
];
ptr2
+=
fram
e
->
linesize
[
2
];
}
}
return
0
;
...
...
@@ -153,8 +153,8 @@ static int yuv4_write_header(AVFormatContext *s)
if
(
s
->
nb_streams
!=
1
)
return
AVERROR
(
EIO
);
if
(
s
->
streams
[
0
]
->
codec
->
codec_id
!=
AV_CODEC_ID_
RAWVIDEO
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"ERROR:
Only rawvideo
supported.
\n
"
);
if
(
s
->
streams
[
0
]
->
codec
->
codec_id
!=
AV_CODEC_ID_
WRAPPED_AVFRAME
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"ERROR:
Codec not
supported.
\n
"
);
return
AVERROR_INVALIDDATA
;
}
...
...
@@ -182,8 +182,7 @@ AVOutputFormat ff_yuv4mpegpipe_muxer = {
.
extensions
=
"y4m"
,
.
priv_data_size
=
sizeof
(
int
),
.
audio_codec
=
AV_CODEC_ID_NONE
,
.
video_codec
=
AV_CODEC_ID_
RAWVIDEO
,
.
video_codec
=
AV_CODEC_ID_
WRAPPED_AVFRAME
,
.
write_header
=
yuv4_write_header
,
.
write_packet
=
yuv4_write_packet
,
.
flags
=
AVFMT_RAWPICTURE
,
};
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