From patchwork Thu Jun 1 11:44:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 3782 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.10.2 with SMTP id 2csp727029vsk; Thu, 1 Jun 2017 04:45:19 -0700 (PDT) X-Received: by 10.28.14.205 with SMTP id 196mr9367009wmo.13.1496317519510; Thu, 01 Jun 2017 04:45:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496317519; cv=none; d=google.com; s=arc-20160816; b=D3Qvk2DRwB7aGXwuoRVvZDWvvS9n/wgZ5qnaeq58Wg4KQ70DOBnbrMEemsa/iPIhxM AZal6gLHGeDl6wMMkV9j0YUi8gCX+xxbV/iQ1Eg01XlC0eovf50UMNfnS6dymT8T0CfW upG8YKmablTAPEdkzZUrnqIW/qwB/6bv6dHTlrDWmEp+eQdjoPk++Z+2p7OVA3h3DCP8 kBcXfnz2PPSFa60e3aJWSkvJq1TVIIuHl0P+0br2iSrwBe/PoKaV27/0cPqe26YB0k6W fwznPMRhMVbRNecISyVGgd5/xmskgb6VY1XN93xSFitY1tiTnc/2Idi4Gyq4fs0BbCQE 7s5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to :arc-authentication-results; bh=rWxLbFpVDwJehK+KY0LyUvV2RkN7BGHFQYCM5PIL7Ks=; b=fd/IhTHdrP7QUoZ0YEUwdL7wCFLPYoG6sTkk9Ii2C2pYAF9A4EzkfBK4/FaWOJ5+iQ XvSIg0d7Z4pSCFU0dWADApzB9QXzxQOECq2uFKgaMrmii7WefayzbMfoObVUQ/Z/WGGZ ySbRvXOJzRVQrjQ/6XGpbPDhS51jySub+FF8X5J3v++WfuAjnygMXvh8pQ+t1znSCGmb dU1GGWl3mo08KaVWYXg6NoqVHg1qTfrBYJfCZWwjYfG96wQuYDV5+7AD2ROrpfdZ6Xxp xEgAgooxusIpkBI2NOt6ck18as10NvcmbnoaDUe3CqQbankXm++44jlnXTy+ziP1ljbo DONA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w1si2451769wme.103.2017.06.01.04.45.19; Thu, 01 Jun 2017 04:45:19 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1ED93689A11; Thu, 1 Jun 2017 14:45:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe01-2.mx.upcmail.net (vie01a-qmta-pe01-2.mx.upcmail.net [62.179.121.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 35CDF6899DF for ; Thu, 1 Jun 2017 14:44:56 +0300 (EEST) Received: from [172.31.218.39] (helo=vie01a-dmta-pe03-3.mx.upcmail.net) by vie01a-pqmta-pe01.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dGOXF-0004xg-4B for ffmpeg-devel@ffmpeg.org; Thu, 01 Jun 2017 13:45:01 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe03.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1dGOX9-0005ZI-Bo for ffmpeg-devel@ffmpeg.org; Thu, 01 Jun 2017 13:44:55 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id TPkn1v00g0S5wYM01PkoWe; Thu, 01 Jun 2017 13:44:48 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 1 Jun 2017 13:44:44 +0200 Message-Id: <20170601114446.11358-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.13.0 Subject: [FFmpeg-devel] [PATCH 1/3] Consistently use av_match_name() for whitelists X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Also make docs consistent Signed-off-by: Michael Niedermayer --- doc/codecs.texi | 3 ++- doc/formats.texi | 3 ++- libavcodec/utils.c | 2 +- libavformat/avio.c | 2 +- libavformat/utils.c | 4 ++-- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/codecs.texi b/doc/codecs.texi index 40f64fe4c8..48c5e11050 100644 --- a/doc/codecs.texi +++ b/doc/codecs.texi @@ -1264,7 +1264,8 @@ Set to 1 to disable processing alpha (transparency). This works like the instead of alpha. Default is 0. @item codec_whitelist @var{list} (@emph{input}) -"," separated list of allowed decoders. By default all are allowed. +Set a ","-separated list of allowed decoders. "ALL" matches all decoders. Decoders +prefixed by "-" are disabled. By default all are allowed. @item dump_separator @var{string} (@emph{input}) Separator used to separate the fields printed on the command line about the diff --git a/doc/formats.texi b/doc/formats.texi index c51d4086db..cce103149e 100644 --- a/doc/formats.texi +++ b/doc/formats.texi @@ -199,7 +199,8 @@ delayed bt the time duration specified in @var{offset}. Default value is @code{0} (meaning that no offset is applied). @item format_whitelist @var{list} (@emph{input}) -"," separated list of allowed demuxers. By default all are allowed. +Set a ","-separated list of allowed demuxers. "ALL" matches all demuxers. Demuxers +prefixed by "-" are disabled. By default all are allowed. @item dump_separator @var{string} (@emph{input}) Separator used to separate the fields printed on the command line about the diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 1336e921c9..2de6521b34 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -725,7 +725,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) goto free_and_end; - if (avctx->codec_whitelist && av_match_list(codec->name, avctx->codec_whitelist, ',') <= 0) { + if (avctx->codec_whitelist && av_match_name(codec->name, avctx->codec_whitelist) <= 0) { av_log(avctx, AV_LOG_ERROR, "Codec (%s) not on whitelist \'%s\'\n", codec->name, avctx->codec_whitelist); ret = AVERROR(EINVAL); goto free_and_end; diff --git a/libavformat/avio.c b/libavformat/avio.c index 1e79c9dd5c..6b6d7c8e57 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -178,7 +178,7 @@ int ffurl_connect(URLContext *uc, AVDictionary **options) av_assert0(!(e=av_dict_get(*options, "protocol_blacklist", NULL, 0)) || (uc->protocol_blacklist && !strcmp(uc->protocol_blacklist, e->value))); - if (uc->protocol_whitelist && av_match_list(uc->prot->name, uc->protocol_whitelist, ',') <= 0) { + if (uc->protocol_whitelist && av_match_name(uc->prot->name, uc->protocol_whitelist) <= 0) { av_log(uc, AV_LOG_ERROR, "Protocol '%s' not on whitelist '%s'!\n", uc->prot->name, uc->protocol_whitelist); return AVERROR(EINVAL); } diff --git a/libavformat/utils.c b/libavformat/utils.c index fbd8b58ac2..7dd6084f27 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -373,7 +373,7 @@ FF_ENABLE_DEPRECATION_WARNINGS int av_demuxer_open(AVFormatContext *ic) { int err; - if (ic->format_whitelist && av_match_list(ic->iformat->name, ic->format_whitelist, ',') <= 0) { + if (ic->format_whitelist && av_match_name(ic->iformat->name, ic->format_whitelist) <= 0) { av_log(ic, AV_LOG_ERROR, "Format not on whitelist \'%s\'\n", ic->format_whitelist); return AVERROR(EINVAL); } @@ -553,7 +553,7 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, } } - if (s->format_whitelist && av_match_list(s->iformat->name, s->format_whitelist, ',') <= 0) { + if (s->format_whitelist && av_match_name(s->iformat->name, s->format_whitelist) <= 0) { av_log(s, AV_LOG_ERROR, "Format not on whitelist \'%s\'\n", s->format_whitelist); ret = AVERROR(EINVAL); goto fail;