diff options
author | Anton Khirnov <anton@khirnov.net> | 2015-10-11 11:08:24 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2015-12-12 21:26:48 +0100 |
commit | 09ae7b81ea2051eec2be9964296bd6ef492c6622 (patch) | |
tree | 091240d092e9e41f0e46f1cc72d2d9111ee34eec /libavformat | |
parent | de9e199a039473ebe4b1b87382e3064d0ea2cf02 (diff) | |
download | ffmpeg-09ae7b81ea2051eec2be9964296bd6ef492c6622.tar.gz |
flvdec: do not create any streams in read_header()
The current muxer behaviour is to create streams in read_header() based
on the audio/video presence flags, but fill in the stream parameters
later when we actually get some packets for them. This is rather shady,
since other demuxers set the stream parameters immediately when the
stream is created and do not touch the stream codec context after that.
Change the flv demuxer to behave in the same way as other similar
demuxers -- create the streams only when we get a packet for them.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/flvdec.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 2375eb1a1f..96504e704d 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -558,20 +558,13 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) static int flv_read_header(AVFormatContext *s) { - int offset, flags; + int offset; avio_skip(s->pb, 4); - flags = avio_r8(s->pb); + avio_r8(s->pb); // flags s->ctx_flags |= AVFMTCTX_NOHEADER; - if (flags & FLV_HEADER_FLAG_HASVIDEO) - if (!create_stream(s, AVMEDIA_TYPE_VIDEO)) - return AVERROR(ENOMEM); - if (flags & FLV_HEADER_FLAG_HASAUDIO) - if (!create_stream(s, AVMEDIA_TYPE_AUDIO)) - return AVERROR(ENOMEM); - offset = avio_rb32(s->pb); avio_seek(s->pb, offset, SEEK_SET); avio_skip(s->pb, 4); |