From patchwork Mon Feb 4 20:53:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 11970 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 05E0E448483 for ; Mon, 4 Feb 2019 22:53:34 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E9C9068AB91; Mon, 4 Feb 2019 22:53:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 692A868AB90 for ; Mon, 4 Feb 2019 22:53:28 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 4730CE1309; Mon, 4 Feb 2019 21:53:28 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nszCsaDy1ijf; Mon, 4 Feb 2019 21:53:27 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 506B9E130B; Mon, 4 Feb 2019 21:53:27 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Feb 2019 21:53:17 +0100 Message-Id: <20190204205317.8978-3-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190204205317.8978-1-cus@passwd.hu> References: <20190204205317.8978-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 3/3] ffplay: add support for setting the number of filter threads 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 Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Marton Balint --- doc/ffplay.texi | 6 ++++++ fftools/ffplay.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/doc/ffplay.texi b/doc/ffplay.texi index 99e1d7468a..c305465078 100644 --- a/doc/ffplay.texi +++ b/doc/ffplay.texi @@ -195,6 +195,12 @@ input as soon as possible. Enabled by default for realtime streams, where data may be dropped if not read in time. Use this option to enable infinite buffers for all inputs, use @option{-noinfbuf} to disable it. +@item -filter_threads @var{nb_threads} +Defines how many threads are used to process a filter pipeline. Each pipeline +will produce a thread pool with this many threads available for parallel +processing. The default is 0 which means that the thread count will be +determined by the number of available CPUs. + @end table @section While playing diff --git a/fftools/ffplay.c b/fftools/ffplay.c index f84052a89b..8f050e16e6 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -353,6 +353,7 @@ static char *afilters = NULL; #endif static int autorotate = 1; static int find_stream_info = 1; +static int filter_nbthreads = 0; /* current context */ static int is_full_screen; @@ -1954,6 +1955,7 @@ static int configure_audio_filters(VideoState *is, const char *afilters, int for avfilter_graph_free(&is->agraph); if (!(is->agraph = avfilter_graph_alloc())) return AVERROR(ENOMEM); + is->agraph->nb_threads = filter_nbthreads; while ((e = av_dict_get(swr_opts, "", e, AV_DICT_IGNORE_SUFFIX))) av_strlcatf(aresample_swr_opts, sizeof(aresample_swr_opts), "%s=%s:", e->key, e->value); @@ -2162,6 +2164,7 @@ static int video_thread(void *arg) ret = AVERROR(ENOMEM); goto the_end; } + graph->nb_threads = filter_nbthreads; if ((ret = configure_video_filters(graph, is, vfilters_list ? vfilters_list[is->vfilter_idx] : NULL, frame)) < 0) { SDL_Event event; event.type = FF_QUIT_EVENT; @@ -3611,6 +3614,7 @@ static const OptionDef options[] = { { "autorotate", OPT_BOOL, { &autorotate }, "automatically rotate video", "" }, { "find_stream_info", OPT_BOOL | OPT_INPUT | OPT_EXPERT, { &find_stream_info }, "read and decode the streams to fill missing information with heuristics" }, + { "filter_threads", HAS_ARG | OPT_INT | OPT_EXPERT, { &filter_nbthreads }, "number of filter threads per graph" }, { NULL, }, };