From patchwork Wed Oct 9 09:56:40 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: 15600 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 C451144696F for ; Wed, 9 Oct 2019 12:57:09 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AA4C36881A6; Wed, 9 Oct 2019 12:57:09 +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 16319687F26 for ; Wed, 9 Oct 2019 12:57:01 +0300 (EEST) Received: by mail-wr1-f65.google.com with SMTP id y19so2064056wrd.3 for ; Wed, 09 Oct 2019 02:57:01 -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=vM9JIJHubRgCIR/9CdwKvtSISwW938LbtyF4EuI2tdj3SD2OL5KHPr1MNLBSADqWcu bq0ias5SNAM/FPBLTXvyGtu34g5xf/jJHvpVL3X6epSt9jUxATLzDOdlJKUbzXoiwyM5 XLUFGxKUSiYSJW6yHJIqNSPdB60Dhs652QuSKSUjEyM+6mlVS5IbQLXeCXKJtAidJ50x hBg/TWgyoWH2aSmQ6gmbWZnNjXtraCI5xuD+Z6s90ImqCCX92sS0YT5Dz0t4lCclDy1v CO8Dkq8Vyy/nbDOt3jUAobQAkA34ZANQKL3crbTo1T1qoTKwzuyYMZJkj6mvOYVYWC6I 6FGg== 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=FojW6dJa/bcioX8NM0XGMuMFmjW0ZdpgG+nq2p2W8NSU6XZTtnBxE0thpK4WJSuMuR n4+pNTACYqueTgypyWVxNOa6zkuTALbCVMOzKDGERrUH5jZlZECSi3sZTDbOrLrOG4zz rG3TTADqDFxKUcKVzZZPNDh8NXllM8xim0B6rXqoTaCwfHYM3FdxAPk1GLzNXM51Kky9 s+OiMkuJIHWKfQ6wYsfJtW1Z2u5CP0UV/YasywBBTBMFETKFkxoWJVkFbCCydTXI82mg Aao0YeZaTs1S6GxuxS7eXQ2NcMCVLf/oc1uOXv8z3MZ5qVk+1vtf3yBVIVgXKVZENNw4 rV+w== X-Gm-Message-State: APjAAAWkhNjRVPHhdnbZY9l48Dpbe8woA5ZGXM0ay4+0mrEvu0z0M4Bf Q/S7BtP8m/wc7R6gUXK+M2vshL0b X-Google-Smtp-Source: APXvYqwV4qwowAr/QtnxpPNmTecSaAE6EThPTybxFhv0eS5KQAzIfVJ1os4TQps+N4USaT2tr3pWrw== X-Received: by 2002:adf:ed04:: with SMTP id a4mr2076894wro.149.1570615020398; Wed, 09 Oct 2019 02:57:00 -0700 (PDT) Received: from localhost.localdomain ([37.244.241.148]) by smtp.gmail.com with ESMTPSA id s9sm1964315wme.36.2019.10.09.02.56.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Oct 2019 02:56:59 -0700 (PDT) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Wed, 9 Oct 2019 11:56:40 +0200 Message-Id: <20191009095651.2928-2-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191009095651.2928-1-onemda@gmail.com> References: <20191009095651.2928-1-onemda@gmail.com> Subject: [FFmpeg-devel] [PATCH 02/13] 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. *