diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-23 21:47:15 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-24 00:13:54 +0100 |
commit | b0bc0eb9789df9c8fc75603203b440893d594be5 (patch) | |
tree | b4aca4db78db900cb2dda0be6a8ee935dd5c8646 /libavformat | |
parent | 50a37f9202a86c3dcdd7076ecf8f0d446c542b25 (diff) | |
download | ffmpeg-b0bc0eb9789df9c8fc75603203b440893d594be5.tar.gz |
pmpdec: read index before creating audio streams
This allows more complete checks
Reviewed-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/pmpdec.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libavformat/pmpdec.c b/libavformat/pmpdec.c index 313370787e..358f7b6fa0 100644 --- a/libavformat/pmpdec.c +++ b/libavformat/pmpdec.c @@ -91,16 +91,6 @@ static int pmp_header(AVFormatContext *s) avio_skip(pb, 10); srate = avio_rl32(pb); channels = avio_rl32(pb) + 1; - for (i = 1; i < pmp->num_streams; i++) { - AVStream *ast = avformat_new_stream(s, NULL); - if (!ast) - return AVERROR(ENOMEM); - ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; - ast->codec->codec_id = audio_codec_id; - ast->codec->channels = channels; - ast->codec->sample_rate = srate; - avpriv_set_pts_info(ast, 32, 1, srate); - } pos = avio_tell(pb) + 4*index_cnt; for (i = 0; i < index_cnt; i++) { int size = avio_rl32(pb); @@ -113,6 +103,16 @@ static int pmp_header(AVFormatContext *s) av_add_index_entry(vst, pos, i, size, 0, flags); pos += size; } + for (i = 1; i < pmp->num_streams; i++) { + AVStream *ast = avformat_new_stream(s, NULL); + if (!ast) + return AVERROR(ENOMEM); + ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; + ast->codec->codec_id = audio_codec_id; + ast->codec->channels = channels; + ast->codec->sample_rate = srate; + avpriv_set_pts_info(ast, 32, 1, srate); + } return 0; } |