Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ffmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Luma Media Server
ffmpeg
Commits
d00a8fd4
Commit
d00a8fd4
authored
9 years ago
by
Luca Barbato
Browse files
Options
Downloads
Patches
Plain Diff
yuv4mpeg: Use the wrapped avframe pseudo-encoder
parent
00332e0a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavformat/yuv4mpegenc.c
+11
-12
11 additions, 12 deletions
libavformat/yuv4mpegenc.c
with
11 additions
and
12 deletions
libavformat/yuv4mpegenc.c
+
11
−
12
View file @
d00a8fd4
...
@@ -88,7 +88,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -88,7 +88,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
{
{
AVStream
*
st
=
s
->
streams
[
pkt
->
stream_index
];
AVStream
*
st
=
s
->
streams
[
pkt
->
stream_index
];
AVIOContext
*
pb
=
s
->
pb
;
AVIOContext
*
pb
=
s
->
pb
;
AV
Picture
*
pictur
e
;
AV
Frame
*
fram
e
;
int
*
first_pkt
=
s
->
priv_data
;
int
*
first_pkt
=
s
->
priv_data
;
int
width
,
height
,
h_chroma_shift
,
v_chroma_shift
;
int
width
,
height
,
h_chroma_shift
,
v_chroma_shift
;
int
i
;
int
i
;
...
@@ -96,7 +96,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -96,7 +96,7 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
char
buf1
[
20
];
char
buf1
[
20
];
uint8_t
*
ptr
,
*
ptr1
,
*
ptr2
;
uint8_t
*
ptr
,
*
ptr1
,
*
ptr2
;
pictur
e
=
(
AV
Pictur
e
*
)
pkt
->
data
;
fram
e
=
(
AV
Fram
e
*
)
pkt
->
data
;
/* for the first packet we have to output the header as well */
/* for the first packet we have to output the header as well */
if
(
*
first_pkt
)
{
if
(
*
first_pkt
)
{
...
@@ -118,10 +118,10 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -118,10 +118,10 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
width
=
st
->
codec
->
width
;
width
=
st
->
codec
->
width
;
height
=
st
->
codec
->
height
;
height
=
st
->
codec
->
height
;
ptr
=
pictur
e
->
data
[
0
];
ptr
=
fram
e
->
data
[
0
];
for
(
i
=
0
;
i
<
height
;
i
++
)
{
for
(
i
=
0
;
i
<
height
;
i
++
)
{
avio_write
(
pb
,
ptr
,
width
);
avio_write
(
pb
,
ptr
,
width
);
ptr
+=
pictur
e
->
linesize
[
0
];
ptr
+=
fram
e
->
linesize
[
0
];
}
}
if
(
st
->
codec
->
pix_fmt
!=
AV_PIX_FMT_GRAY8
)
{
if
(
st
->
codec
->
pix_fmt
!=
AV_PIX_FMT_GRAY8
)
{
...
@@ -132,15 +132,15 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -132,15 +132,15 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
width
=
-
(
-
width
>>
h_chroma_shift
);
width
=
-
(
-
width
>>
h_chroma_shift
);
height
=
-
(
-
height
>>
v_chroma_shift
);
height
=
-
(
-
height
>>
v_chroma_shift
);
ptr1
=
pictur
e
->
data
[
1
];
ptr1
=
fram
e
->
data
[
1
];
ptr2
=
pictur
e
->
data
[
2
];
ptr2
=
fram
e
->
data
[
2
];
for
(
i
=
0
;
i
<
height
;
i
++
)
{
/* Cb */
for
(
i
=
0
;
i
<
height
;
i
++
)
{
/* Cb */
avio_write
(
pb
,
ptr1
,
width
);
avio_write
(
pb
,
ptr1
,
width
);
ptr1
+=
pictur
e
->
linesize
[
1
];
ptr1
+=
fram
e
->
linesize
[
1
];
}
}
for
(
i
=
0
;
i
<
height
;
i
++
)
{
/* Cr */
for
(
i
=
0
;
i
<
height
;
i
++
)
{
/* Cr */
avio_write
(
pb
,
ptr2
,
width
);
avio_write
(
pb
,
ptr2
,
width
);
ptr2
+=
pictur
e
->
linesize
[
2
];
ptr2
+=
fram
e
->
linesize
[
2
];
}
}
}
}
return
0
;
return
0
;
...
@@ -153,8 +153,8 @@ static int yuv4_write_header(AVFormatContext *s)
...
@@ -153,8 +153,8 @@ static int yuv4_write_header(AVFormatContext *s)
if
(
s
->
nb_streams
!=
1
)
if
(
s
->
nb_streams
!=
1
)
return
AVERROR
(
EIO
);
return
AVERROR
(
EIO
);
if
(
s
->
streams
[
0
]
->
codec
->
codec_id
!=
AV_CODEC_ID_RA
WVIDEO
)
{
if
(
s
->
streams
[
0
]
->
codec
->
codec_id
!=
AV_CODEC_ID_
W
RA
PPED_AVFRAME
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"ERROR:
Only rawvideo
supported.
\n
"
);
av_log
(
s
,
AV_LOG_ERROR
,
"ERROR:
Codec not
supported.
\n
"
);
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
}
}
...
@@ -182,8 +182,7 @@ AVOutputFormat ff_yuv4mpegpipe_muxer = {
...
@@ -182,8 +182,7 @@ AVOutputFormat ff_yuv4mpegpipe_muxer = {
.
extensions
=
"y4m"
,
.
extensions
=
"y4m"
,
.
priv_data_size
=
sizeof
(
int
),
.
priv_data_size
=
sizeof
(
int
),
.
audio_codec
=
AV_CODEC_ID_NONE
,
.
audio_codec
=
AV_CODEC_ID_NONE
,
.
video_codec
=
AV_CODEC_ID_RA
WVIDEO
,
.
video_codec
=
AV_CODEC_ID_
W
RA
PPED_AVFRAME
,
.
write_header
=
yuv4_write_header
,
.
write_header
=
yuv4_write_header
,
.
write_packet
=
yuv4_write_packet
,
.
write_packet
=
yuv4_write_packet
,
.
flags
=
AVFMT_RAWPICTURE
,
};
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment