[FFmpeg-devel] [PATCH]Accept 0 as codec_tag in ffmpeg.c if it matches the codec_id

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Dec 7 13:15:21 CET 2012


Hi!

Attached patch fixes ticket #1953 for me.

I suspect the actual problem is that av_codec_get_tag() returns 0 both in case 
of failure and success, but that seems difficult to fix without breaking API.

Please review, Carl Eugen
-------------- next part --------------
diff --git a/ffmpeg.c b/ffmpeg.c
index 4b278a2..5d5b034 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2035,7 +2035,8 @@ static int transcode_init(void)
             if (!codec->codec_tag) {
                 if (!oc->oformat->codec_tag ||
                      av_codec_get_id (oc->oformat->codec_tag, icodec->codec_tag) == codec->codec_id ||
-                     av_codec_get_tag(oc->oformat->codec_tag, icodec->codec_id) <= 0)
+                     av_codec_get_tag(oc->oformat->codec_tag, icodec->codec_id) == 0 &&
+                     av_codec_get_id (oc->oformat->codec_tag, 0) != codec->codec_id)
                     codec->codec_tag = icodec->codec_tag;
             }
 


More information about the ffmpeg-devel mailing list