From patchwork Wed Sep 28 09:21:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 38406 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp78158pzh; Wed, 28 Sep 2022 02:22:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM70MnlR6lLvlcIVmWYpQydGsDMEIsoERsB1N3F2FBMZiwy/I9npjQ1ujkIE1wrOTebZ5F3B X-Received: by 2002:a05:6402:1e8d:b0:454:79a9:201f with SMTP id f13-20020a0564021e8d00b0045479a9201fmr32586578edf.176.1664356969583; Wed, 28 Sep 2022 02:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664356969; cv=none; d=google.com; s=arc-20160816; b=tDfXVNpvwqzfH6i9qobqSPVcY72J4Aw0xszivKpOTPb5j9bDAAe8pfJXEISZUFRvYi 7Vx8LpaamdbWjxNp0Cq0Xj4F3xiFqL+Ot6jOEvSZ/w2F9F+oP8XdqwZocGD4s7XWFeVR ZOIL/Oavl5mkRMLMoL/291IEXxrVEUlXIe81WrorSO9ocLsOYY+exslS+z5CYxQIW5j8 9da//YiJe2zuRSjGQOnBlkbZpJzvS2ZuIx5KAM9jHAk1SLLFl75xJgcoZXCJORy58Sz7 DBcL+r/a/la/Rr/QUf8EEW8NgSPKjUwlbXZrlz0GxJHm2Vg9UF4anBD+tqUO6Y8syEvR 7T6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=jGwZUw1ElXX6kgDJfapBuY7INNwFybliqG8tvQetAT4=; b=Pq7Gvpg0whkcSnFcrNeFTeGOXENOlqlSHwbgiUENpXKumZYbkkuxjVA/lUPOBr5AfN /w8IxTQRfNhASkEIW9G67AynYcui8K/EKjgRVKJb6RKmEW97z8f/MW5umjxbyHABqqWk 44hQ5aUO2En8mNHEM8wn7NS7m+HD33Utpeuan0LpFnV5nVlbKolpZg98IClPG+MaxGYT 85aA5P3Xg6aLLKrsQSfFBiz1JztAeis1QUB31/ghpsm+jwDXWhsutA8RUcO5f0HOwrlG TdZlv6gZkqy/w1ehPqNhTQ3z87gWzTDqGlLT2U8qBkVnzWJ6EkfvzCdh7uVknm/OmDrn JAvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sc6-20020a1709078a0600b00783d5a873dcsi4450270ejc.341.2022.09.28.02.22.49; Wed, 28 Sep 2022 02:22:49 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BB2B068BBBC; Wed, 28 Sep 2022 12:21:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9697368BBBB for ; Wed, 28 Sep 2022 12:21:43 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E73F12405EC for ; Wed, 28 Sep 2022 11:21:40 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id OQXZ1foGW8Kb for ; Wed, 28 Sep 2022 11:21:38 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 1E8B5240591 for ; Wed, 28 Sep 2022 11:21:37 +0200 (CEST) Received: by libav.khirnov.net (Postfix, from userid 1000) id 1A12B3A1767; Wed, 28 Sep 2022 11:21:37 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Wed, 28 Sep 2022 11:21:32 +0200 Message-Id: <20220928092132.31566-8-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220928092132.31566-1-anton@khirnov.net> References: <20220928092132.31566-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 8/8] lavfi/avf_showspatial: add framerate option X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ip8FXbvp+if9 Apparently this option was intended (the context contains a currently-unused frame_rate field), but was never added. This results in the output timebase being unset after config_output(), so the input audio timebase ends up being used for video output, which is clearly wrong. Add an option for setting output video framerate. Also set output frame durations. --- doc/filters.texi | 3 +++ libavfilter/avf_showspatial.c | 4 ++++ libavfilter/version.h | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/filters.texi b/doc/filters.texi index d0f718678c..7e516a43ba 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -29337,6 +29337,9 @@ Default value is @code{hann}. Set ratio of overlap window. Default value is @code{0.5}. When value is @code{1} overlap is set to recommended size for specific window function currently used. + +@item rate, r +Set output framerate. @end table @anchor{showspectrum} diff --git a/libavfilter/avf_showspatial.c b/libavfilter/avf_showspatial.c index 7807628540..3db4db9af0 100644 --- a/libavfilter/avf_showspatial.c +++ b/libavfilter/avf_showspatial.c @@ -62,6 +62,8 @@ static const AVOption showspatial_options[] = { { "win_size", "set window size", OFFSET(win_size), AV_OPT_TYPE_INT, {.i64 = 4096}, 1024, 65536, FLAGS }, WIN_FUNC_OPTION("win_func", OFFSET(win_func), FLAGS, WFUNC_HANNING), { "overlap", "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=0.5}, 0, 1, FLAGS }, + { "rate", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS }, + { "r", "set video rate", OFFSET(frame_rate), AV_OPT_TYPE_VIDEO_RATE, {.str="25"}, 0, INT_MAX, FLAGS }, { NULL } }; @@ -187,6 +189,7 @@ static int config_output(AVFilterLink *outlink) } } + outlink->frame_rate = s->frame_rate; outlink->time_base = av_inv_q(outlink->frame_rate); av_audio_fifo_free(s->fifo); @@ -253,6 +256,7 @@ static int draw_spatial(AVFilterLink *inlink, AVFrame *insamples) } outpicref->pts = av_rescale_q(insamples->pts, inlink->time_base, outlink->time_base); + outpicref->duration = 1; return ff_filter_frame(outlink, outpicref); } diff --git a/libavfilter/version.h b/libavfilter/version.h index 5aac9c513a..4ccbf5641c 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFILTER_VERSION_MINOR 49 -#define LIBAVFILTER_VERSION_MICRO 100 +#define LIBAVFILTER_VERSION_MICRO 101 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \