diff options
author | Pascal Massimino <pascal.massimino@gmail.com> | 2008-03-20 11:02:40 +0000 |
---|---|---|
committer | Pascal Massimino <pascal.massimino@gmail.com> | 2008-03-20 11:02:40 +0000 |
commit | c04c52d3a8bb323d71436512495c8ecf58be69ee (patch) | |
tree | d72538ef859380265a35d279ac4fb1ca00cb84fc /libavformat/flvdec.c | |
parent | 6122b733e957b5d3e623fdd83d9908a5dea67299 (diff) | |
download | ffmpeg-c04c52d3a8bb323d71436512495c8ecf58be69ee.tar.gz |
Additional checks for strange num_val in FLV metadata
Avoids some "Unsupported audio codec (6)" message in FLVs, e.g.
Example of such problematic bitstream is 'bad_codec6.flv'
in ftp's /incoming directory.
Originally committed as revision 12510 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/flvdec.c')
-rw-r--r-- | libavformat/flvdec.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index f21f35296e..804a217858 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -175,9 +175,11 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE; // else if(!strcmp(key, "width") && vcodec && num_val > 0) vcodec->width = num_val; // else if(!strcmp(key, "height") && vcodec && num_val > 0) vcodec->height = num_val; - else if(!strcmp(key, "audiocodecid") && acodec) flv_set_audio_codec(s, astream, (int)num_val << FLV_AUDIO_CODECID_OFFSET); - else if(!strcmp(key, "videocodecid") && vcodec) flv_set_video_codec(s, vstream, (int)num_val); - else if(!strcmp(key, "audiosamplesize") && acodec && num_val >= 0) { + else if(!strcmp(key, "audiocodecid") && acodec && 0 <= (int)num_val) + flv_set_audio_codec(s, astream, (int)num_val << FLV_AUDIO_CODECID_OFFSET); + else if(!strcmp(key, "videocodecid") && vcodec && 0 <= (int)num_val) + flv_set_video_codec(s, vstream, (int)num_val); + else if(!strcmp(key, "audiosamplesize") && acodec && 0 < (int)num_val) { acodec->bits_per_sample = num_val; //we may have to rewrite a previously read codecid because FLV only marks PCM endianness. if(num_val == 8 && (acodec->codec_id == CODEC_ID_PCM_S16BE || acodec->codec_id == CODEC_ID_PCM_S16LE)) |