diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-07 08:56:49 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-10 07:49:15 +0200 |
commit | fc2fc98c7535b2984010155292efbe634b267485 (patch) | |
tree | 60bf05d68ac105c5fea03e6e83d440343a01e4bb | |
parent | fd8a6f78c5b1c7d5553af58e275db9bef33915a9 (diff) | |
download | ffmpeg-fc2fc98c7535b2984010155292efbe634b267485.tar.gz |
avformat/utils: Move ff_copy_whiteblacklists to avformat.c
This is an auxiliary function for AVFormatContexts.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavformat/avformat.c | 20 | ||||
-rw-r--r-- | 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) |