From patchwork Wed Aug 11 19:00:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Witten X-Patchwork-Id: 29425 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:8e8b:0:0:0:0:0 with SMTP id q133csp46834iod; Wed, 11 Aug 2021 12:03:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDKMnr9RlpbDZR2ZO5BI/0nASMlm+Wvl5bfRl6J7ImGvrdcn6pN6dg8uW094y5bLxcwuj3 X-Received: by 2002:a05:6402:39a:: with SMTP id o26mr491086edv.64.1628708593829; Wed, 11 Aug 2021 12:03:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628708593; cv=none; d=google.com; s=arc-20160816; b=WsnSNRliKKL6UK0V5uMBKKMbmpfUUPiPg6EUZxKKk+/sOTJRkY0rGDgQBOWJabxswF zEMqmwJm3tZEWAdwU7k1vruojFrf0j6hMEQsmsCD+tBI0+v87+lF0o7P4kDOTJNYOuPd Tzu4KZAuB/jf9lnyCfOPy8N3eGsv2Hq7x+B0uh+CBe1BJSj0VRTnN8p19Cxs5G1CwglT KJ+6Ik+deO2wb8/ySt/H87unSlux1UhXbdPphWoyT1rHnn3mTdqQL1te5BC60AAVZQNu qgoUQJUGBBrkkObUMHplIt+NcQJBnU3aNm9Rpkh0kGtjZSoSBqyE8H0lgG98RADgbXqW BNpA== 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:references:in-reply-to:message-id:to :from:date:dkim-signature:delivered-to; bh=fa8L/T6O7HydBbMC1zt5AiT/38dypzD4MVrt7kTt9Ss=; b=MtuAU0+qqRcPHe/2HBS0UNyqpHGL25kFzuMDiRCN6yKnyNkCfVIkdBKQgE8yc4uvBu yUG2PzRxIJo6jRDjhdMPWFk6TOoNia3GLR0+xDj4GNMmP88EiO3sksvKHxOKnCiWUeZB yJxaFTtz+vfLXk6QX5NiSqtVm1A2e24HSOanqgVa6cuDJltf6mgdon7F4BIQKHXnRyG/ A7qSPnN1/KwEdZiGa6INm4uTX5RvYo3jb5axpMIb4ufxHDIG9GPfF1QrwxlqZOHcghje EavqAdkYQ06lzZfSwhxGhrsMFmwEP+2HcgwK/Cm7HmNzf/a/hJbPe7MVYuoy43smtmUP 57Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=TAly9SJe; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id kl24si11123644ejc.190.2021.08.11.12.03.13; Wed, 11 Aug 2021 12:03:13 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=TAly9SJe; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1AA7768A633; Wed, 11 Aug 2021 22:01:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 57FAB68A613 for ; Wed, 11 Aug 2021 22:01:56 +0300 (EEST) Received: by mail-lj1-f169.google.com with SMTP id m17so2502238ljp.7 for ; Wed, 11 Aug 2021 12:01:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:date:from:to:message-id:in-reply-to:references; bh=m2u70hX190GE1gYs6ftHkLokuUj827OLMS+0MPaeOgk=; b=TAly9SJeDG8ez+tuvcVG7IOeg8nHP/9SgGT8K06jflLc2p1SxUQp9mk5NPtiADQNgi aSLA77S6cjg9CbfpgP0cp7QGxyYLY3NhwZr6ZU6udhmbI/ioQXiY8gGV5WRUjrkLUEVS ussNU7d+pngCJzbTd3CA4i+jHwL55VON0UIXmmEQOQlddZhFmjy12yy3YUoQ4RJ6fef7 q/yfxN9T2K9oNaFQQrOjg6C+HGTGfy7GJALzgL8Isyma0GM92ij/ewsCkGJ5EwuuSHy8 JEkxkfWoj4UkaoQDWbhlhN8il/4lJ8ynNqEu2ZqHnxobluNub9eg0UpSSyBRjXiaoRCf hhHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:from:to:message-id:in-reply-to :references; bh=m2u70hX190GE1gYs6ftHkLokuUj827OLMS+0MPaeOgk=; b=ADPqx6Nrh64MO+NwM1EU/tjwoVRh88a9IFMtqPjt9wzN5Kyqpm0WImNHKDn55mpKk4 aX3HPYx70aJiML7v85hjb/4oPPg1XnGgsRtPX93vLV3Y9vBFozEQGw0acdFt5dZ31Tzh MOLS44oGLcXpogZ8xfmhoEGV8j07gjg0hVTZcS0aLTG7sclKJzSqO1+Ln9XJVhkMcUog ADKe/xeBg84JLhQk5LT4cSK+O3RuR5Xqk/WH9BfahNZfAEAMV19E2I04J0EvLNwRuibo ZbVlfn0NjBSMSZm0ZDe1XJA6Lw+bkGnev2oMqGLwC6xJb0mB2Ohnz/dBpklKRyaUUbQe qXYQ== X-Gm-Message-State: AOAM531+wLZ7sSZzD4dK5QPqOQo6l+JsltQTHgj4eeMANhCpLIsupw89 kLv231ZBiTqfE1rezMNYfpVl4yX8j20CLhcZKcKZiA== X-Received: by 2002:a2e:93c4:: with SMTP id p4mr132993ljh.38.1628708515201; Wed, 11 Aug 2021 12:01:55 -0700 (PDT) Received: from gmail.com (tor-exit0-readme.dfri.se. [171.25.193.20]) by smtp.gmail.com with ESMTPSA id z8sm21135lfb.30.2021.08.11.12.01.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 12:01:54 -0700 (PDT) Date: Wed, 11 Aug 2021 19:00:17 -0000 From: Michael Witten To: ffmpeg-devel@ffmpeg.org Message-ID: In-Reply-To: References: Subject: [FFmpeg-devel] [PATCH 3/3] libavformat/protocols.c: avio_enum_protocols_{input, output}(): Add functions to the API X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: RUr0Ae3a0JIJ In the repo, there is only one function that enumerates protocols: fftools/cmdutils.c: show_protocols() This commit simply has that function make calls directly to the desired functions, namely: * avio_enum_protocols_for_input() * avio_enum_protocols_for_output() --- fftools/cmdutils.c | 4 ++-- libavformat/avio.h | 22 ++++++++++++++++++++++ libavformat/protocols.c | 2 -- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 64237a4796..87f9be64c3 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -1681,10 +1681,10 @@ int show_protocols(void *optctx, const char *opt, const char *arg) printf("Supported file protocols:\n" "Input:\n"); - while ((name = avio_enum_protocols(&opaque, 0))) + while ((name = avio_enum_protocols_for_input(&opaque))) printf(" %s\n", name); printf("Output:\n"); - while ((name = avio_enum_protocols(&opaque, 1))) + while ((name = avio_enum_protocols_for_output(&opaque))) printf(" %s\n", name); return 0; } diff --git a/libavformat/avio.h b/libavformat/avio.h index 3b92cf742a..455b872260 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -788,6 +788,28 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); */ const char *avio_enum_protocols(void **const opaque, const int output); +/** + * Iterate through names of available output protocols. + * + * @param opaque A private pointer representing current protocol. + * It must be a pointer to NULL on first iteration and will + * be updated by successive calls to avio_enum_protocols_for_output. + * + * @return A static string containing the name of current protocol or NULL + */ +const char *avio_enum_protocols_for_output(void **const opaque); + +/** + * Iterate through names of available input protocols. + * + * @param opaque A private pointer representing current protocol. + * It must be a pointer to NULL on first iteration and will + * be updated by successive calls to avio_enum_protocols_for_input. + * + * @return A static string containing the name of current protocol or NULL + */ +const char *avio_enum_protocols_for_input(void **const opaque); + /** * Get AVClass by names of available protocols. * diff --git a/libavformat/protocols.c b/libavformat/protocols.c index 4cb8ae0b63..ca04ed2eb5 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -102,13 +102,11 @@ const AVClass *ff_urlcontext_child_class_iterate(void **iter) *opaque = NULL; \ return NULL; -static inline const char *avio_enum_protocols_for_output(void **const opaque) { AVIO_ENUM_PROTOCOLS(url_write); } -static inline const char *avio_enum_protocols_for_input(void **const opaque) { AVIO_ENUM_PROTOCOLS(url_read);