From patchwork Thu Oct 10 11:38:39 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: 15675 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 70D3D44932D for ; Thu, 10 Oct 2019 14:39:09 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5E177688253; Thu, 10 Oct 2019 14:39:09 +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 686A5687F26 for ; Thu, 10 Oct 2019 14:39:02 +0300 (EEST) Received: by mail-wm1-f65.google.com with SMTP id i16so6555804wmd.3 for ; Thu, 10 Oct 2019 04:39:02 -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=xBT/iI3zU4NgXDjXPKkixCRsxL3N4mucW4Pco+PjvqM=; b=mkDkqR8SrvSeEgJKWswMVjrJqQ8PLX41fzbyqYP77hiadbI/O0Nc3i9wNYJGux4NdK kGkGxuALLbpEG1rH0bEnZn44Q00D6umkKPguTFDmjLfXpKg5yZi37S22+7l4xVFVlTdC 5YPohvxpjwje7P+LCOg0m7c9lWvn7y+A4gGzqRisLLGkURI6ARBaA1r32EXzmNMQO/Xt BTXUINfKBOWB4jafIqYF3takymmLKmh3tI3mWx/kIJw5k1eNDTezlWZpoZVulAs31KVK q6gv8XjQoAxsA/Dc1C8hjAD7FB1PhMkl/lUAZZoQlVX/gkC7Ue/UYbPWOXVROtmAa5Y4 J8vg== 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=xBT/iI3zU4NgXDjXPKkixCRsxL3N4mucW4Pco+PjvqM=; b=WhuFgQavrm72jOI1wIMKAtSFGOQS5XsfuZaxBJTUKiaMJC9Rqx6cZN5JE/owa7dGgT lLX13rosgpWxBxJRLPG4Sdm87nTal+L552u1N8nBSnyzeO1IDXIHLUwFwUd3THAWw4En F9K+8lF4ln6QcjuNJtzZ+ZlEIabbULzC6nXeFatjLcfk9VB6IOvgCwniE+xV8M6kcLO2 FlEPUPUnzg0dVLLMib+7FqOERartqAC/rs3799WlY74enV8WOx1phI1sSbx0sEY3Xt5i mErkJjkoHyXPPboVN6dCFYj4oqjCrLIOPLH4xkqjsYUvxWsGZ4PkZVYZO35R7moZ3jqO ktpA== X-Gm-Message-State: APjAAAVGXzzhmhxpeuOd9u3ln4Z8GTpi2HkRGWtNMrGCZPsH7xTDR/Q7 +U0RjzC15tIPVouQiHg8aYUcK5go X-Google-Smtp-Source: APXvYqxXRER2dd5/zybECjfUZq/2UscMHwepkvevztFEoKN5nj0XKvhjdRzNNXBcjaGAiyGEZs/iTQ== X-Received: by 2002:a1c:81d7:: with SMTP id c206mr7050385wmd.175.1570707541720; Thu, 10 Oct 2019 04:39:01 -0700 (PDT) Received: from localhost.localdomain ([37.244.241.148]) by smtp.gmail.com with ESMTPSA id w4sm5442214wrv.66.2019.10.10.04.39.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 04:39:01 -0700 (PDT) From: Paul B Mahol To: ffmpeg-devel@ffmpeg.org Date: Thu, 10 Oct 2019 13:38:39 +0200 Message-Id: <20191010113851.27196-2-onemda@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191010113851.27196-1-onemda@gmail.com> References: <20191010113851.27196-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..09f33e0e7c 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_RUNTIME_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. *