diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-03-09 15:12:24 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-03 16:40:12 +0200 |
commit | 0b9dffc67ab506a5d148993b98d8713a76623892 (patch) | |
tree | ac083d211e635b69450a3a8e681c73de90263812 /libavformat/utils.c | |
parent | 24009f3601e883199e6dc232cec7d60e57764b3c (diff) | |
download | ffmpeg-0b9dffc67ab506a5d148993b98d8713a76623892.tar.gz |
Improve codec_tag guessing code.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index c4e57f66d8..87a1bdc89c 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -25,6 +25,7 @@ #include "avio_internal.h" #include "internal.h" #include "libavcodec/internal.h" +#include "libavcodec/raw.h" #include "libavutil/opt.h" #include "metadata.h" #include "id3v2.h" @@ -2428,8 +2429,11 @@ int av_find_stream_info(AVFormatContext *ic) (st->codec_info_nb_frames-2)*(int64_t)st->time_base.den, st->info->codec_info_duration*(int64_t)st->time_base.num, 60000); if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample) - st->codec->codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); + if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample){ + uint32_t tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); + if(ff_find_pix_fmt(ff_raw_pix_fmt_tags, tag) == st->codec->pix_fmt) + st->codec->codec_tag= tag; + } // the check for tb_unreliable() is not completely correct, since this is not about handling // a unreliable/inexact time base, but a time base that is finer than necessary, as e.g. |