diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-07 09:56:49 +0300 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-05-10 08:49:15 +0300 |
commit | fc2fc98c7535b2984010155292efbe634b267485 (patch) | |
tree | 60bf05d68ac105c5fea03e6e83d440343a01e4bb /libavformat/avformat.c | |
parent | fd8a6f78c5b1c7d5553af58e275db9bef33915a9 (diff) |
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>
Diffstat (limited to 'libavformat/avformat.c')
-rw-r--r-- | libavformat/avformat.c | 20 |
1 files changed, 20 insertions, 0 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); |