[FFmpeg-devel] [PATCH 5/5] avformat/fifo: unset codec tag if unsupported by underlying muxer

Jan Ekström jeebjp at gmail.com
Mon Dec 7 12:08:45 EET 2020


From: Jan Ekström <jan.ekstrom at 24i.com>

The API client has no visibility into the values provided by the
underlying muxer, so we either do this always, or when an option
is presented.

In this case, we do it unconditionally, as this is probably more
useful.

Signed-off-by: Jan Ekström <jan.ekstrom at 24i.com>
---
 libavformat/fifo.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libavformat/fifo.c b/libavformat/fifo.c
index bc363e458cd..c9b782c2309 100644
--- a/libavformat/fifo.c
+++ b/libavformat/fifo.c
@@ -513,6 +513,18 @@ static int fifo_mux_init(AVFormatContext *avf, ff_const59 AVOutputFormat *oforma
         ret = ff_stream_encode_params_copy(st, avf->streams[i]);
         if (ret < 0)
             return ret;
+
+        if ((st->codecpar->codec_tag && oformat->codec_tag) &&
+            av_codec_get_id(oformat->codec_tag, st->codecpar->codec_tag) != st->codecpar->codec_id) {
+            av_log(avf, AV_LOG_ERROR,
+                   "Codec tag '%s' is unsupported for codec %s in the %s muxer! "
+                   "Unsetting codec tag so that auto-configuration can be "
+                   "attempted.\n",
+                   av_fourcc2str(st->codecpar->codec_tag),
+                   avcodec_get_name(st->codecpar->codec_id),
+                   avf2->oformat->name);
+            st->codecpar->codec_tag = 0;
+        }
     }
 
     return 0;
-- 
2.29.2



More information about the ffmpeg-devel mailing list