From patchwork Tue Oct 8 11:28:37 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: 15566 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 3B9F544A445 for ; Tue, 8 Oct 2019 14:29:03 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1C136688000; Tue, 8 Oct 2019 14:29:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DBCB0680310 for ; Tue, 8 Oct 2019 14:28:56 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id j11so13175100wrp.1 for ; Tue, 08 Oct 2019 04:28:56 -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=M1EoyG8upo6KrGrMPVJY+3Svyz465mMGRn6Gp5NPKAPrgLIm+bGKRw+D2zgRtqJmQ2 mcT5+7kGs5h/UF4ZlRf5DXB4alvpjrGzByOR1spRvAFNtlLdj9U6gF5q2OWavEETaQGH HyyyJcNTeRF9vUyws4oFAw+2cA/CqqVqjnb5gyoejIV0gIuFSPF9Fi7KjSFTtqIrSN9m nu9KCCpUspnYM7mNjhwIJk0TSC9RGZEVLRMX80XFVfiHta9npmYeRe+/7bHAcMDugfQh g6ju4EBqHaCu2JDOQiNGTin9MbHbsuCxr7DkBACsaO4NNy7I5wfLdt0c0FElKU6bmRmp WGEQ== 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=rpTQQxDtg+uuDdvqaXM0qK3Fzor2TGkppDkOnmAFAlOrVXa17OAWEA44nJSjCT/AAR 47/d6m+v/X0wJ1DD8amOBUjOILzf1Hf0WTH4RQ2MogaplViJ2SL4iXo6s/c0gaOInUBv ugO8v/rmA42gOH7CSEymR+7d5JRE4unoKvHVz/Lv4EHvcowJy4Oxuu2VNWJrG9p/xiuG heUbJ9O4qwsT3azHkRONuzDULHotldhPjD3ZQ7ycSZIVSuwTMfClHDZoPvqJUsuLXW4v EDonocETW0jX0OewVaf5lIKjxIrKcAX8SYO9Z+sKYNYoaZ+t7hQim/TerP5noZjLckkg RccA== X-Gm-Message-State: APjAAAVymcILjE67Kt3DucbwBPFAZvaBsCyKuMTCxmqMolpgn1lP4SPd HUUsomhryU9ftoIG64YCBrVIkd19 X-Google-Smtp-Source: APXvYqw/l7NYXBZ2MGKBZinJ6OFJdk+bRQTLiv5HWyWU2qQ9NtjU7ndQUPae2sDPqhfuwLIeRIABCQ== X-Received: by 2002:a5d:40cf:: with SMTP id b15mr27586740wrq.141.1570534136167; Tue, 08 Oct 2019 04:28:56 -0700 (PDT) Received: from localhost.localdomain ([109.227.61.240]) by smtp.gmail.com with ESMTPSA id r2sm17198024wrm.3.2019.10.08.04.28.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 04:28:55 -0700 (PDT) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Tue, 8 Oct 2019 13:28:37 +0200 Message-Id: <20191008112843.6875-2-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008112843.6875-1-onemda@gmail.com> References: <20191008112843.6875-1-onemda@gmail.com> Subject: [FFmpeg-devel] [PATCH 2/8] 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. *