From patchwork Wed Oct 9 10:16:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul B Mahol X-Patchwork-Id: 15614 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 78B58448B76 for ; Wed, 9 Oct 2019 13:17:16 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5A3B36881A1; Wed, 9 Oct 2019 13:17:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 26C2E6880C2 for ; Wed, 9 Oct 2019 13:17:15 +0300 (EEST) Received: by mail-wm1-f65.google.com with SMTP id f22so1907555wmc.2 for ; Wed, 09 Oct 2019 03:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=/HpZnS6PDe6ZDZHPd1CAhn6cSVQUOTcqDJAJsgfYCzo=; b=G2nPkjtjA+pbvjNEbPrISys5nF0ZUyqqwasLXrJaNKg1jstoqRMvmuFZODxiph+7Oh DrljD+QvfOwQhNGH03T27RC6XpghYVgcC+Gq7lLmJQnd66C3Ybs6ZCW43+zgeCZ/wfxg 4Q/V++ZBuA6hir2ywTwo6JHod27P5sV5P973lXBmDHZSCsQ7DpVptQzYe5/yOTUgTkBs ELOl2CHEA0bWYDu5Uj8tGs0X8unPRZLqAKghNKHSazB9c/v+rsdi5ZuMygfVpvb2o4Oa 4dp8lZOLwvM1y2hr1AmafeEJOwmLRUrpLIJgyVfBqb0/s3CojJd9NQR+NqNcDHFFn1k5 JKBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=/HpZnS6PDe6ZDZHPd1CAhn6cSVQUOTcqDJAJsgfYCzo=; b=S0zRfA7Sq2eRnhGO3q/YDV23K7QdJHJu7y5Nj/EzvbL2FvJodnz/2DPvWPlSw2DQBe WW4YaoQ9Tgf2WRBBMZpDuuthMHCH5K5HNEfjLDiVPr+Y4Bjbu4gCytVHpviMnK9Isq36 IO1DJh6dajPTKAcNsTdPhalMicL4gtA0uwQDV8GoUQ6V0oNNyxkr5O7KUs4W51BflQ/o kp0hlZH4zHSwXHUlJg0NXL4BuEkXS88vOQVYdTUww5SmpyEFgqV4Zw4Wvl6txjew/dZ/ HLKf4q8cSQk1pC9XQV1F22NTO0dO2BbLPooqCKfC/XfTFNOgms7mBW6OfVsoJRHoDoUw od5g== X-Gm-Message-State: APjAAAUigVxzktV2//vKYrEnNq87idszk1TQBMGJLBlEc1yNbnSpAem6 QKmbfrZj+5LDvcj676yhKJi5H/wf X-Google-Smtp-Source: APXvYqyId27qUODrPBmPAs8JgS+kr/YbBlm9Mhc4675s/3QF30qvLUmsadpRuQuZzHMWzaWCPUTxCA== X-Received: by 2002:a1c:4c08:: with SMTP id z8mr59761wmf.38.1570616234287; Wed, 09 Oct 2019 03:17:14 -0700 (PDT) Received: from localhost.localdomain ([37.244.241.148]) by smtp.gmail.com with ESMTPSA id z13sm1727117wrq.51.2019.10.09.03.17.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 03:17:13 -0700 (PDT) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Wed, 9 Oct 2019 12:16:53 +0200 Message-Id: <20191009101705.7072-2-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191009101705.7072-1-onemda@gmail.com> References: <20191009101705.7072-1-onemda@gmail.com> Subject: [FFmpeg-devel] [PATCH 02/14] avfilter/avfilter: add ff_filter_process_command() 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" Signed-off-by: Paul B Mahol --- libavfilter/avfilter.c | 13 +++++++++++++ libavfilter/internal.h | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 93e866b79c..4d462d4e0a 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -884,6 +884,19 @@ static int process_options(AVFilterContext *ctx, AVDictionary **options, return count; } +int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, + const char *arg, char *res, int res_len, int flags) +{ + const AVOption *o; + + if (!ctx->filter->priv_class) + return 0; + o = av_opt_find2(ctx->priv, cmd, NULL, AV_OPT_FLAG_COMMAND_PARAM | AV_OPT_FLAG_FILTERING_PARAM, AV_OPT_SEARCH_CHILDREN, NULL); + if (!o) + return AVERROR(ENOSYS); + return av_opt_set(ctx->priv, cmd, arg, 0); +} + int avfilter_init_dict(AVFilterContext *ctx, AVDictionary **options) { int ret = 0; diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 498bd3328d..1d77808082 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -411,6 +411,13 @@ static inline int ff_norm_qscale(int qscale, int type) */ int ff_filter_get_nb_threads(AVFilterContext *ctx); +/** + * Generic processing of user supplied commands that are set + * in the same way as the filter options. + */ +int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, + const char *arg, char *res, int res_len, int flags); + /** * Perform any additional setup required for hardware frames. *