[FFmpeg-devel] [PATCH 41/44] avformat/utils: Move ff_copy_whiteblacklists to avformat.c

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sat May 7 14:28:27 EEST 2022


This is an auxiliary function for AVFormatContexts.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavformat/avformat.c | 20 ++++++++++++++++++++
 libavformat/utils.c    | 21 ---------------------
 2 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/libavformat/avformat.c b/libavformat/avformat.c
index 414224187a..2249f09825 100644
--- a/libavformat/avformat.c
+++ b/libavformat/avformat.c
@@ -681,6 +681,26 @@ const AVCodec *ff_find_decoder(AVFormatContext *s, const AVStream *st,
     return avcodec_find_decoder(codec_id);
 }
 
+int ff_copy_whiteblacklists(AVFormatContext *dst, const AVFormatContext *src)
+{
+    av_assert0(!dst->codec_whitelist &&
+               !dst->format_whitelist &&
+               !dst->protocol_whitelist &&
+               !dst->protocol_blacklist);
+    dst-> codec_whitelist = av_strdup(src->codec_whitelist);
+    dst->format_whitelist = av_strdup(src->format_whitelist);
+    dst->protocol_whitelist = av_strdup(src->protocol_whitelist);
+    dst->protocol_blacklist = av_strdup(src->protocol_blacklist);
+    if (   (src-> codec_whitelist && !dst-> codec_whitelist)
+        || (src->  format_whitelist && !dst->  format_whitelist)
+        || (src->protocol_whitelist && !dst->protocol_whitelist)
+        || (src->protocol_blacklist && !dst->protocol_blacklist)) {
+        av_log(dst, AV_LOG_ERROR, "Failed to duplicate black/whitelist\n");
+        return AVERROR(ENOMEM);
+    }
+    return 0;
+}
+
 int ff_is_intra_only(enum AVCodecID id)
 {
     const AVCodecDescriptor *d = avcodec_descriptor_get(id);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 866b80cffe..26f44ddfa1 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -23,7 +23,6 @@
 
 #include "config.h"
 
-#include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 #include "libavutil/bprint.h"
 #include "libavutil/internal.h"
@@ -56,26 +55,6 @@ int ff_unlock_avformat(void)
     return ff_mutex_unlock(&avformat_mutex) ? -1 : 0;
 }
 
-int ff_copy_whiteblacklists(AVFormatContext *dst, const AVFormatContext *src)
-{
-    av_assert0(!dst->codec_whitelist &&
-               !dst->format_whitelist &&
-               !dst->protocol_whitelist &&
-               !dst->protocol_blacklist);
-    dst-> codec_whitelist = av_strdup(src->codec_whitelist);
-    dst->format_whitelist = av_strdup(src->format_whitelist);
-    dst->protocol_whitelist = av_strdup(src->protocol_whitelist);
-    dst->protocol_blacklist = av_strdup(src->protocol_blacklist);
-    if (   (src-> codec_whitelist && !dst-> codec_whitelist)
-        || (src->  format_whitelist && !dst->  format_whitelist)
-        || (src->protocol_whitelist && !dst->protocol_whitelist)
-        || (src->protocol_blacklist && !dst->protocol_blacklist)) {
-        av_log(dst, AV_LOG_ERROR, "Failed to duplicate black/whitelist\n");
-        return AVERROR(ENOMEM);
-    }
-    return 0;
-}
-
 /* an arbitrarily chosen "sane" max packet size -- 50M */
 #define SANE_CHUNK_SIZE (50000000)
 
-- 
2.32.0



More information about the ffmpeg-devel mailing list