diff mbox series

[FFmpeg-devel,06/13] avformat/mux_utils: Don't report that AV_CODEC_ID_NONE can be muxed

Message ID AS8P250MB0744531EFDB0DF12489C8DA78F332@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit a48e839a221d8470071a367b6a7be1bc022ba6e7
Headers show
Series [FFmpeg-devel,01/13] avformat/mp3enc: Improve query_codec | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt March 20, 2024, 2:12 a.m. UTC
If AVOutputFormat.video_codec, audio_codec or subtitle_codec
is AV_CODEC_ID_NONE, it means that there is no default codec
for this format and not that it is supported to mux AV_CODEC_ID_NONE.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/mux_utils.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/mux_utils.c b/libavformat/mux_utils.c
index 9d811c14e2..841a19a3a2 100644
--- a/libavformat/mux_utils.c
+++ b/libavformat/mux_utils.c
@@ -39,9 +39,10 @@  int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id,
             return ffofmt(ofmt)->query_codec(codec_id, std_compliance);
         else if (ofmt->codec_tag)
             return !!av_codec_get_tag2(ofmt->codec_tag, codec_id, &codec_tag);
-        else if (codec_id == ofmt->video_codec ||
-                 codec_id == ofmt->audio_codec ||
-                 codec_id == ofmt->subtitle_codec)
+        else if (codec_id != AV_CODEC_ID_NONE &&
+                 (codec_id == ofmt->video_codec ||
+                  codec_id == ofmt->audio_codec ||
+                  codec_id == ofmt->subtitle_codec))
             return 1;
     }
     return AVERROR_PATCHWELCOME;