[FFmpeg-cvslog] avformat/matroskaenc: Only compile functions when needed

Andreas Rheinhardt git at videolan.org
Tue Aug 24 05:57:38 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Fri Aug 20 09:39:04 2021 +0200| [88b3e3156231d9f45c816c26980a2048619e44c4] | committer: Andreas Rheinhardt

avformat/matroskaenc: Only compile functions when needed

Fixes unused function warnings in case e.g. the WebM muxer is disabled.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=88b3e3156231d9f45c816c26980a2048619e44c4
---

 libavformat/matroskaenc.c | 52 +++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 27 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index ad8a4698b8..b1735f3838 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2632,33 +2632,6 @@ after_cues:
     return ret2;
 }
 
-static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance)
-{
-    int i;
-    for (i = 0; ff_mkv_codec_tags[i].id != AV_CODEC_ID_NONE; i++)
-        if (ff_mkv_codec_tags[i].id == codec_id)
-            return 1;
-
-    if (std_compliance < FF_COMPLIANCE_NORMAL) {
-        enum AVMediaType type = avcodec_get_type(codec_id);
-        // mkv theoretically supports any video/audio through VFW/ACM
-        if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)
-            return 1;
-    }
-
-    return 0;
-}
-
-static int webm_query_codec(enum AVCodecID codec_id, int std_compliance)
-{
-    int i;
-    for (i = 0; ff_webm_codec_tags[i].id != AV_CODEC_ID_NONE; i++)
-        if (ff_webm_codec_tags[i].id == codec_id)
-            return 1;
-
-    return 0;
-}
-
 static uint64_t mkv_get_uid(const mkv_track *tracks, int i, AVLFG *c)
 {
     while (1) {
@@ -2833,6 +2806,22 @@ static const AVClass matroska_webm_class = {
 };
 
 #if CONFIG_MATROSKA_MUXER
+static int mkv_query_codec(enum AVCodecID codec_id, int std_compliance)
+{
+    for (int i = 0; ff_mkv_codec_tags[i].id != AV_CODEC_ID_NONE; i++)
+        if (ff_mkv_codec_tags[i].id == codec_id)
+            return 1;
+
+    if (std_compliance < FF_COMPLIANCE_NORMAL) {
+        enum AVMediaType type = avcodec_get_type(codec_id);
+        // mkv theoretically supports any video/audio through VFW/ACM
+        if (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)
+            return 1;
+    }
+
+    return 0;
+}
+
 const AVOutputFormat ff_matroska_muxer = {
     .name              = "matroska",
     .long_name         = NULL_IF_CONFIG_SMALL("Matroska"),
@@ -2862,6 +2851,15 @@ const AVOutputFormat ff_matroska_muxer = {
 #endif
 
 #if CONFIG_WEBM_MUXER
+static int webm_query_codec(enum AVCodecID codec_id, int std_compliance)
+{
+    for (int i = 0; ff_webm_codec_tags[i].id != AV_CODEC_ID_NONE; i++)
+        if (ff_webm_codec_tags[i].id == codec_id)
+            return 1;
+
+    return 0;
+}
+
 const AVOutputFormat ff_webm_muxer = {
     .name              = "webm",
     .long_name         = NULL_IF_CONFIG_SMALL("WebM"),



More information about the ffmpeg-cvslog mailing list