Commit 150ddbc1 authored by Mans Rullgard's avatar Mans Rullgard

Do not memcpy raw video frames when using null muxer

Commit 035af998 made avconv always call an encoder when using the
null muxer.  While useful for 2-pass encodes, it inadvertently
caused an extra memcpy of raw frames when decoding only.

This hack restores the old behaviour when only decoding while
allowing use of the null muxer with encoded streams as well.
Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent 5a2e2516
......@@ -1207,7 +1207,8 @@ static void do_video_out(AVFormatContext *s,
av_init_packet(&pkt);
pkt.stream_index= ost->index;
if (s->oformat->flags & AVFMT_RAWPICTURE) {
if (s->oformat->flags & AVFMT_RAWPICTURE &&
enc->codec->id == CODEC_ID_RAWVIDEO) {
/* raw pictures are written as AVPicture structure to
avoid any copies. We support temporarily the older
method. */
......@@ -1459,7 +1460,7 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams)
if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <=1)
continue;
if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE))
if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == CODEC_ID_RAWVIDEO)
continue;
for(;;) {
......
......@@ -32,5 +32,5 @@ AVOutputFormat ff_null_muxer = {
.audio_codec = AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE),
.video_codec = CODEC_ID_RAWVIDEO,
.write_packet = null_write_packet,
.flags = AVFMT_NOFILE | AVFMT_NOTIMESTAMPS,
.flags = AVFMT_NOFILE | AVFMT_NOTIMESTAMPS | AVFMT_RAWPICTURE,
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment