From patchwork Tue Nov 23 10:29:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 31559 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp8445490iob; Tue, 23 Nov 2021 02:31:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYHEItC9eg5eFdC2R99fOvG9d4VVYQf8rr4vemY5uhLKX1ncpIwpIzlursMFCAqhMjne6P X-Received: by 2002:aa7:dd53:: with SMTP id o19mr7436342edw.369.1637663478035; Tue, 23 Nov 2021 02:31:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637663478; cv=none; d=google.com; s=arc-20160816; b=Ny8aWKhoZ01LCNWIJOo9SEJrgVHjdQ9/pcV3NJkloxMOqWWUtR8V9lrUclvTwMrR3U w9YYDRnCWweaupgE7ZsC8LT2qKRyqBMoiYOrMtX4bHSZtXR7lTJL62E0sJHJCo0NjVT8 jTUJKOxoBqqbAP44pGUYee2iq7ho2D21NSa2EWE462fTO07AMAxmryY/Xj5LAbZKlYxi 2pgCosJ9ttu/IoSjy594ZGNxL3pPVbFpeK4Zle5NVVR9QklRZTs2qSkQ0Zduh6BMUe0w LS+CFWyZeNY+XfVDaRTDunXnm8/JXdKGmVzWLbejvccUMyVoAvDY+sxUmvCli1HRdR5+ nMTQ== 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:message-id:date:to:from :delivered-to; bh=6OzMpM/NCgu7fsqct7sqclmmSA4Pd8BmJT5Q2qZK2cU=; b=DR454+2VE83/wHY/h8DZCs4Ie/kXL/ocL68PPMwC/QrJOkiwN9IyyP8rF1VIDmruh5 xz6AtbYECmCeR8yXrpPQoyvNjwAtO/+qQITyO4H/BMeX/1Uz5bzweKPakeuTuthPfqC6 FwfbHxEhvkfh7FJ9WwCJyecKTWkHIASN6Ozsdyi/M0cG9YERDXkvM+LYjem9xQHfJRD2 TW7kfGSF3XyvYtMWNFdQ2tjy1gpeXyYPVFveBPDZL7WiSd+lCjPpzmyjp1x8/6jkx3hK LxIg5sysBxrc6ETLgxquPlnsDb85zZy7On12q0ubBn+B3LCnW+YVej9qXhs0xkUeVo58 e3Vw== 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 g12si41749727edz.87.2021.11.23.02.31.17; Tue, 23 Nov 2021 02:31:18 -0800 (PST) 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 314B268A96A; Tue, 23 Nov 2021 12:31:13 +0200 (EET) 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 E199568A44C for ; Tue, 23 Nov 2021 12:31:06 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 5AEF72404FE for ; Tue, 23 Nov 2021 11:31:06 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id P89ModAWrPMd for ; Tue, 23 Nov 2021 11:31:05 +0100 (CET) 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 DE3A1240177 for ; Tue, 23 Nov 2021 11:31:05 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id C59F83A0631; Tue, 23 Nov 2021 11:31:05 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Nov 2021 11:29:58 +0100 Message-Id: <20211123103001.12888-1-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4] lavfi/allfilters: move vf_chromaber_vulkan to video section 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: qmeLyicGgJFy --- libavfilter/allfilters.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 29da7ef0d2..8c8a56fd58 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -104,7 +104,6 @@ extern const AVFilter ff_af_bandreject; extern const AVFilter ff_af_bass; extern const AVFilter ff_af_biquad; extern const AVFilter ff_af_bs2b; -extern const AVFilter ff_vf_chromaber_vulkan; extern const AVFilter ff_af_channelmap; extern const AVFilter ff_af_channelsplit; extern const AVFilter ff_af_chorus; @@ -185,6 +184,7 @@ extern const AVFilter ff_vf_boxblur; extern const AVFilter ff_vf_boxblur_opencl; extern const AVFilter ff_vf_bwdif; extern const AVFilter ff_vf_cas; +extern const AVFilter ff_vf_chromaber_vulkan; extern const AVFilter ff_vf_chromahold; extern const AVFilter ff_vf_chromakey; extern const AVFilter ff_vf_chromanr; From patchwork Tue Nov 23 10:29:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 31558 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp8446130iob; Tue, 23 Nov 2021 02:31:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJyn0fKSiCQkOJ4Tt2VJgivzKLK33BialDxkRZPGwuuiUf05TB7/ldx00Wb1UaiAFBNiFO9w X-Received: by 2002:a05:6402:50ca:: with SMTP id h10mr7648314edb.70.1637663510679; Tue, 23 Nov 2021 02:31:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637663510; cv=none; d=google.com; s=arc-20160816; b=1HCSENwCU1KkIGfhDfM+LVFMlNaV6GB8lR49/R12DqZ6hKvMW2geGkBe2Xx6J/QDRr R1jO8aXuC2xkXH5udT9UJrMv+3HRgjRhfT//ey6VuoqrToEocs3zSfV+bqophAqYr2rd N4alqO+Pq6rj1FIIQ5OHUVzRVpxhPWRtei591VCd8o1QoNbw8AFl6erqy9Cv4RHKK32j hBMYCL0ZPv2a3koM6L5CkdSv9aZt30z5IvwqT0IQgVC+YZ8haVBwL6qP9Jbm7jPwI5Ro ax+WkEhsNt2IH0QH0KWZ3uSrC2bzFpdW0vO952RxTEJ7mcdDdNJW+Zcmpr8aztBbbLxa b05A== 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=gAS8wnnIQ2Kw65kbqPqLUXsMluWC13JCFeDxBs5rB1o=; b=NvZE3Wb75Vvk1pU5VWuQ6F/40mTLsxZhU2Zez3RjUzbf4Xw05azU7mfO9DGPS7W0WE cupvMPg0rccSFAUdWSfBmqPvVlX5p00CA9nkScOHrq3y6k4wuLsminZD4xF/FrjVtWoB KTl8WoCCf0A3ErTq9UzTfUmWf76Q8FoXOQZeGoa86UXm53ImmKX8Stbphjw0U0Zcv1Ip MUBXv62xNOx/tU7+WlAP+Fc0KIRef/f8t1Bp0nXP1qAcxoNZ8WXGjYftqILDSk5ZKRdM dbzd2p9S49BeYaYo0soK4vGmU/EW6Bq+VN1j0EVNY3/cIwPJC1P/lFfcPtyAH/rC0NjT GkFg== 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 gb42si31516883ejc.415.2021.11.23.02.31.50; Tue, 23 Nov 2021 02:31:50 -0800 (PST) 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 6565F68AEB2; Tue, 23 Nov 2021 12:31:17 +0200 (EET) 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 3E8D868ADAE for ; Tue, 23 Nov 2021 12:31:08 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id E17BE24017E for ; Tue, 23 Nov 2021 11:31:07 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id F203x4CzTS1d for ; Tue, 23 Nov 2021 11:31:06 +0100 (CET) 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 EA7A124017A for ; Tue, 23 Nov 2021 11:31:05 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id CAD083A067C; Tue, 23 Nov 2021 11:31:05 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Nov 2021 11:29:59 +0100 Message-Id: <20211123103001.12888-2-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211123103001.12888-1-anton@khirnov.net> References: <20211123103001.12888-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/4] avfilter: add AVFILTER_FLAG_META 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: Z17B4Pk/vE1h This flag allows distinguishing between filters that actually modify the data and those that only modify metadata or gather some stream information. --- doc/APIchanges | 3 +++ libavfilter/af_acopy.c | 1 + libavfilter/af_aformat.c | 1 + libavfilter/af_anull.c | 1 + libavfilter/af_asdr.c | 1 + libavfilter/af_asetrate.c | 1 + libavfilter/af_ashowinfo.c | 1 + libavfilter/af_asr.c | 1 + libavfilter/af_astats.c | 2 +- libavfilter/af_drmeter.c | 1 + libavfilter/af_replaygain.c | 1 + libavfilter/af_silencedetect.c | 1 + libavfilter/af_volumedetect.c | 1 + libavfilter/avfilter.h | 16 ++++++++++++++++ libavfilter/f_bench.c | 2 ++ libavfilter/f_cue.c | 1 + libavfilter/f_latency.c | 3 ++- libavfilter/f_metadata.c | 6 ++++-- libavfilter/f_perms.c | 6 ++++-- libavfilter/f_realtime.c | 2 ++ libavfilter/f_segment.c | 4 ++-- libavfilter/f_select.c | 2 +- libavfilter/f_sendcmd.c | 2 ++ libavfilter/f_sidedata.c | 6 ++++-- libavfilter/fifo.c | 2 ++ libavfilter/setpts.c | 2 ++ libavfilter/settb.c | 2 ++ libavfilter/split.c | 4 ++-- libavfilter/trim.c | 1 + libavfilter/version.h | 2 +- libavfilter/vf_addroi.c | 2 ++ libavfilter/vf_aspect.c | 2 ++ libavfilter/vf_bbox.c | 2 +- libavfilter/vf_blackdetect.c | 2 +- libavfilter/vf_blackframe.c | 1 + libavfilter/vf_copy.c | 1 + libavfilter/vf_cropdetect.c | 2 +- libavfilter/vf_entropy.c | 2 +- libavfilter/vf_find_rect.c | 1 + libavfilter/vf_format.c | 4 ++++ libavfilter/vf_fps.c | 1 + libavfilter/vf_framestep.c | 2 +- libavfilter/vf_freezedetect.c | 1 + libavfilter/vf_identity.c | 8 ++++++-- libavfilter/vf_idet.c | 1 + libavfilter/vf_mestimate.c | 1 + libavfilter/vf_null.c | 1 + libavfilter/vf_ocr.c | 1 + libavfilter/vf_psnr.c | 4 +++- libavfilter/vf_qp.c | 3 ++- libavfilter/vf_readeia608.c | 4 +++- libavfilter/vf_readvitc.c | 1 + libavfilter/vf_scdet.c | 1 + libavfilter/vf_setparams.c | 3 +++ libavfilter/vf_showinfo.c | 1 + libavfilter/vf_ssim.c | 4 +++- libavfilter/vf_vfrdet.c | 1 + libavfilter/vf_vidstabdetect.c | 1 + libavfilter/vf_vif.c | 4 +++- libavfilter/vf_vmafmotion.c | 1 + 60 files changed, 116 insertions(+), 26 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 565f7e091e..031e09aab2 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-11-xx - xxxxxxxxxx - lavfi 8.18.100 - avfilter.h + Add AVFILTER_FLAG_META. + 2021-11-17 - xxxxxxxxxx - lavf 57.9.100 - frame.h Add AV_FRAME_DATA_DOVI_RPU_BUFFER. diff --git a/libavfilter/af_acopy.c b/libavfilter/af_acopy.c index 32455d9186..751644ebc7 100644 --- a/libavfilter/af_acopy.c +++ b/libavfilter/af_acopy.c @@ -63,6 +63,7 @@ static const AVFilterPad acopy_outputs[] = { const AVFilter ff_af_acopy = { .name = "acopy", .description = NULL_IF_CONFIG_SMALL("Copy the input audio unchanged to the output."), + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(acopy_inputs), FILTER_OUTPUTS(acopy_outputs), }; diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c index 7e25c0c6a4..8fdb070b4e 100644 --- a/libavfilter/af_aformat.c +++ b/libavfilter/af_aformat.c @@ -162,6 +162,7 @@ const AVFilter ff_af_aformat = { .uninit = uninit, .priv_size = sizeof(AFormatContext), .priv_class = &aformat_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_af_aformat_inputs), FILTER_OUTPUTS(avfilter_af_aformat_outputs), FILTER_QUERY_FUNC(query_formats), diff --git a/libavfilter/af_anull.c b/libavfilter/af_anull.c index 065d37e17e..2c52636250 100644 --- a/libavfilter/af_anull.c +++ b/libavfilter/af_anull.c @@ -44,6 +44,7 @@ static const AVFilterPad avfilter_af_anull_outputs[] = { const AVFilter ff_af_anull = { .name = "anull", .description = NULL_IF_CONFIG_SMALL("Pass the source unchanged to the output."), + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_af_anull_inputs), FILTER_OUTPUTS(avfilter_af_anull_outputs), }; diff --git a/libavfilter/af_asdr.c b/libavfilter/af_asdr.c index 72b6dfa78b..2e9bbb4649 100644 --- a/libavfilter/af_asdr.c +++ b/libavfilter/af_asdr.c @@ -166,6 +166,7 @@ const AVFilter ff_af_asdr = { .priv_size = sizeof(AudioSDRContext), .activate = activate, .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(inputs), FILTER_OUTPUTS(outputs), FILTER_SINGLE_SAMPLEFMT(AV_SAMPLE_FMT_DBLP), diff --git a/libavfilter/af_asetrate.c b/libavfilter/af_asetrate.c index 637fa4fbb8..1e65427eec 100644 --- a/libavfilter/af_asetrate.c +++ b/libavfilter/af_asetrate.c @@ -113,4 +113,5 @@ const AVFilter ff_af_asetrate = { FILTER_OUTPUTS(asetrate_outputs), FILTER_QUERY_FUNC(query_formats), .priv_class = &asetrate_class, + .flags = AVFILTER_FLAG_META, }; diff --git a/libavfilter/af_ashowinfo.c b/libavfilter/af_ashowinfo.c index b6623fa69d..b8cc424153 100644 --- a/libavfilter/af_ashowinfo.c +++ b/libavfilter/af_ashowinfo.c @@ -257,6 +257,7 @@ const AVFilter ff_af_ashowinfo = { .description = NULL_IF_CONFIG_SMALL("Show textual information for each audio frame."), .priv_size = sizeof(AShowInfoContext), .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(inputs), FILTER_OUTPUTS(outputs), }; diff --git a/libavfilter/af_asr.c b/libavfilter/af_asr.c index b9c7068526..9b97efcde8 100644 --- a/libavfilter/af_asr.c +++ b/libavfilter/af_asr.c @@ -172,6 +172,7 @@ const AVFilter ff_af_asr = { .priv_class = &asr_class, .init = asr_init, .uninit = asr_uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(asr_inputs), FILTER_OUTPUTS(asr_outputs), FILTER_QUERY_FUNC(query_formats), diff --git a/libavfilter/af_astats.c b/libavfilter/af_astats.c index 0621d18b35..04de842a1e 100644 --- a/libavfilter/af_astats.c +++ b/libavfilter/af_astats.c @@ -852,5 +852,5 @@ const AVFilter ff_af_astats = { AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64P, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBLP), - .flags = AVFILTER_FLAG_SLICE_THREADS, + .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_META, }; diff --git a/libavfilter/af_drmeter.c b/libavfilter/af_drmeter.c index 6e0d80a3f1..1aa5332a28 100644 --- a/libavfilter/af_drmeter.c +++ b/libavfilter/af_drmeter.c @@ -202,6 +202,7 @@ const AVFilter ff_af_drmeter = { .priv_size = sizeof(DRMeterContext), .priv_class = &drmeter_class, .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(drmeter_inputs), FILTER_OUTPUTS(drmeter_outputs), FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_FLT), diff --git a/libavfilter/af_replaygain.c b/libavfilter/af_replaygain.c index ee0312da82..e2acf38173 100644 --- a/libavfilter/af_replaygain.c +++ b/libavfilter/af_replaygain.c @@ -606,6 +606,7 @@ const AVFilter ff_af_replaygain = { .description = NULL_IF_CONFIG_SMALL("ReplayGain scanner."), .uninit = uninit, .priv_size = sizeof(ReplayGainContext), + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(replaygain_inputs), FILTER_OUTPUTS(replaygain_outputs), FILTER_QUERY_FUNC(query_formats), diff --git a/libavfilter/af_silencedetect.c b/libavfilter/af_silencedetect.c index fa0884bee8..90bcd47b59 100644 --- a/libavfilter/af_silencedetect.c +++ b/libavfilter/af_silencedetect.c @@ -272,4 +272,5 @@ const AVFilter ff_af_silencedetect = { AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P), .priv_class = &silencedetect_class, + .flags = AVFILTER_FLAG_META, }; diff --git a/libavfilter/af_volumedetect.c b/libavfilter/af_volumedetect.c index c137cc7e50..870aa448c1 100644 --- a/libavfilter/af_volumedetect.c +++ b/libavfilter/af_volumedetect.c @@ -134,6 +134,7 @@ const AVFilter ff_af_volumedetect = { .description = NULL_IF_CONFIG_SMALL("Detect audio volume."), .priv_size = sizeof(VolDetectContext), .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(volumedetect_inputs), FILTER_OUTPUTS(volumedetect_outputs), FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P), diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index f7208754a7..a59922bb25 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -119,6 +119,22 @@ enum AVMediaType avfilter_pad_get_type(const AVFilterPad *pads, int pad_idx); * and processing them concurrently. */ #define AVFILTER_FLAG_SLICE_THREADS (1 << 2) +/** + * The filter is a "metadata" filter - it does not modify the frame data in any + * way. It may only affect the metadata (i.e. those fields copied by + * av_frame_copy_props()). + * + * More precisely, this means: + * - video: the data of any frame output by the filter must be exactly equal to + * some frame that is received on one of its inputs. Furthermore, all frames + * produced on a given output must correspond to frames received on the same + * input and their order must be unchanged. Note that the filter may still + * drop or duplicate the frames. + * - audio: the data produced by the filter on any of its outputs (viewed e.g. + * as an array of interleaved samples) must be exactly equal to the data + * received by the filter on one of its inputs. + */ +#define AVFILTER_FLAG_META (1 << 3) /** * Some filters support a generic "enable" expression option that can be used * to enable or disable a filter in the timeline. Filters supporting this diff --git a/libavfilter/f_bench.c b/libavfilter/f_bench.c index f7098adaf4..b0e97da2c0 100644 --- a/libavfilter/f_bench.c +++ b/libavfilter/f_bench.c @@ -113,6 +113,7 @@ const AVFilter ff_vf_bench = { FILTER_INPUTS(bench_inputs), FILTER_OUTPUTS(bench_outputs), .priv_class = &bench_class, + .flags = AVFILTER_FLAG_META, }; #endif /* CONFIG_BENCH_FILTER */ @@ -143,5 +144,6 @@ const AVFilter ff_af_abench = { FILTER_INPUTS(abench_inputs), FILTER_OUTPUTS(abench_outputs), .priv_class = &abench_class, + .flags = AVFILTER_FLAG_META, }; #endif /* CONFIG_ABENCH_FILTER */ diff --git a/libavfilter/f_cue.c b/libavfilter/f_cue.c index fd55e4bf5f..db20bcebd5 100644 --- a/libavfilter/f_cue.c +++ b/libavfilter/f_cue.c @@ -142,6 +142,7 @@ const AVFilter ff_af_acue = { .description = NULL_IF_CONFIG_SMALL("Delay filtering to match a cue."), .priv_class = &cue_acue_class, .priv_size = sizeof(CueContext), + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(acue_inputs), FILTER_OUTPUTS(acue_outputs), .activate = activate, diff --git a/libavfilter/f_latency.c b/libavfilter/f_latency.c index de885ca026..8f770213a4 100644 --- a/libavfilter/f_latency.c +++ b/libavfilter/f_latency.c @@ -118,7 +118,8 @@ const AVFilter ff_vf_latency = { .init = init, .uninit = uninit, .activate = activate, - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | + AVFILTER_FLAG_META, FILTER_INPUTS(latency_inputs), FILTER_OUTPUTS(latency_outputs), }; diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c index cecfe62a9c..57d8528ddc 100644 --- a/libavfilter/f_metadata.c +++ b/libavfilter/f_metadata.c @@ -391,7 +391,8 @@ const AVFilter ff_af_ametadata = { .uninit = uninit, FILTER_INPUTS(ainputs), FILTER_OUTPUTS(aoutputs), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | + AVFILTER_FLAG_META, }; #endif /* CONFIG_AMETADATA_FILTER */ @@ -424,6 +425,7 @@ const AVFilter ff_vf_metadata = { .uninit = uninit, FILTER_INPUTS(inputs), FILTER_OUTPUTS(outputs), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | + AVFILTER_FLAG_META, }; #endif /* CONFIG_METADATA_FILTER */ diff --git a/libavfilter/f_perms.c b/libavfilter/f_perms.c index 470db45bee..ed5d55fd23 100644 --- a/libavfilter/f_perms.c +++ b/libavfilter/f_perms.c @@ -138,7 +138,8 @@ const AVFilter ff_af_aperms = { .priv_size = sizeof(PermsContext), FILTER_INPUTS(aperms_inputs), FILTER_OUTPUTS(aperms_outputs), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | + AVFILTER_FLAG_META, }; #endif /* CONFIG_APERMS_FILTER */ @@ -167,6 +168,7 @@ const AVFilter ff_vf_perms = { FILTER_INPUTS(perms_inputs), FILTER_OUTPUTS(perms_outputs), .priv_class = &perms_class, - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | + AVFILTER_FLAG_META, }; #endif /* CONFIG_PERMS_FILTER */ diff --git a/libavfilter/f_realtime.c b/libavfilter/f_realtime.c index 11bdb058ed..d7fc26d3c5 100644 --- a/libavfilter/f_realtime.c +++ b/libavfilter/f_realtime.c @@ -95,6 +95,7 @@ const AVFilter ff_vf_realtime = { .description = NULL_IF_CONFIG_SMALL("Slow down filtering to match realtime."), .priv_size = sizeof(RealtimeContext), .priv_class = &realtime_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_vf_realtime_inputs), FILTER_OUTPUTS(avfilter_vf_realtime_outputs), }; @@ -122,6 +123,7 @@ const AVFilter ff_af_arealtime = { .description = NULL_IF_CONFIG_SMALL("Slow down filtering to match realtime."), .priv_class = &realtime_class, .priv_size = sizeof(RealtimeContext), + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(arealtime_inputs), FILTER_OUTPUTS(arealtime_outputs), }; diff --git a/libavfilter/f_segment.c b/libavfilter/f_segment.c index 70c8393972..33c19b5aa7 100644 --- a/libavfilter/f_segment.c +++ b/libavfilter/f_segment.c @@ -286,7 +286,7 @@ const AVFilter ff_vf_segment = { .activate = activate, FILTER_INPUTS(segment_inputs), .outputs = NULL, - .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, + .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_META, }; #endif // CONFIG_SEGMENT_FILTER @@ -325,6 +325,6 @@ const AVFilter ff_af_asegment = { .activate = activate, FILTER_INPUTS(asegment_inputs), .outputs = NULL, - .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, + .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_META, }; #endif // CONFIG_ASEGMENT_FILTER diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c index 47e7d1fef8..532547bcaf 100644 --- a/libavfilter/f_select.c +++ b/libavfilter/f_select.c @@ -533,6 +533,6 @@ const AVFilter ff_vf_select = { .priv_class = &select_class, FILTER_INPUTS(avfilter_vf_select_inputs), FILTER_QUERY_FUNC(query_formats), - .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, + .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_META, }; #endif /* CONFIG_SELECT_FILTER */ diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c index f71d211eb4..089cd56ce6 100644 --- a/libavfilter/f_sendcmd.c +++ b/libavfilter/f_sendcmd.c @@ -597,6 +597,7 @@ const AVFilter ff_vf_sendcmd = { .init = init, .uninit = uninit, .priv_size = sizeof(SendCmdContext), + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(sendcmd_inputs), FILTER_OUTPUTS(sendcmd_outputs), .priv_class = &sendcmd_class, @@ -628,6 +629,7 @@ const AVFilter ff_af_asendcmd = { .init = init, .uninit = uninit, .priv_size = sizeof(SendCmdContext), + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(asendcmd_inputs), FILTER_OUTPUTS(asendcmd_outputs), }; diff --git a/libavfilter/f_sidedata.c b/libavfilter/f_sidedata.c index 5c9f905cc2..41238f7468 100644 --- a/libavfilter/f_sidedata.c +++ b/libavfilter/f_sidedata.c @@ -147,7 +147,8 @@ const AVFilter ff_af_asidedata = { .init = init, FILTER_INPUTS(ainputs), FILTER_OUTPUTS(aoutputs), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | + AVFILTER_FLAG_META, }; #endif /* CONFIG_ASIDEDATA_FILTER */ @@ -179,6 +180,7 @@ const AVFilter ff_vf_sidedata = { .init = init, FILTER_INPUTS(inputs), FILTER_OUTPUTS(outputs), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | + AVFILTER_FLAG_META, }; #endif /* CONFIG_SIDEDATA_FILTER */ diff --git a/libavfilter/fifo.c b/libavfilter/fifo.c index bb7d78f09c..36007cdc61 100644 --- a/libavfilter/fifo.c +++ b/libavfilter/fifo.c @@ -132,6 +132,7 @@ const AVFilter ff_vf_fifo = { .init = init, .uninit = uninit, .priv_size = sizeof(FifoContext), + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_vf_fifo_inputs), FILTER_OUTPUTS(avfilter_vf_fifo_outputs), }; @@ -158,6 +159,7 @@ const AVFilter ff_af_afifo = { .init = init, .uninit = uninit, .priv_size = sizeof(FifoContext), + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_af_afifo_inputs), FILTER_OUTPUTS(avfilter_af_afifo_outputs), }; diff --git a/libavfilter/setpts.c b/libavfilter/setpts.c index fad92033e4..0cf21203a4 100644 --- a/libavfilter/setpts.c +++ b/libavfilter/setpts.c @@ -294,6 +294,7 @@ const AVFilter ff_vf_setpts = { .init = init, .activate = activate, .uninit = uninit, + .flags = AVFILTER_FLAG_META, .priv_size = sizeof(SetPTSContext), .priv_class = &setpts_class, @@ -334,6 +335,7 @@ const AVFilter ff_af_asetpts = { .uninit = uninit, .priv_size = sizeof(SetPTSContext), .priv_class = &asetpts_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(asetpts_inputs), FILTER_OUTPUTS(asetpts_outputs), }; diff --git a/libavfilter/settb.c b/libavfilter/settb.c index ae2cf9b888..1bdfe608d7 100644 --- a/libavfilter/settb.c +++ b/libavfilter/settb.c @@ -185,6 +185,7 @@ const AVFilter ff_vf_settb = { FILTER_INPUTS(avfilter_vf_settb_inputs), FILTER_OUTPUTS(avfilter_vf_settb_outputs), .activate = activate, + .flags = AVFILTER_FLAG_META, }; #endif /* CONFIG_SETTB_FILTER */ @@ -216,5 +217,6 @@ const AVFilter ff_af_asettb = { FILTER_OUTPUTS(avfilter_af_asettb_outputs), .priv_class = &asettb_class, .activate = activate, + .flags = AVFILTER_FLAG_META, }; #endif /* CONFIG_ASETTB_FILTER */ diff --git a/libavfilter/split.c b/libavfilter/split.c index a08ddf72b1..e83c6c5240 100644 --- a/libavfilter/split.c +++ b/libavfilter/split.c @@ -112,7 +112,7 @@ const AVFilter ff_vf_split = { .init = split_init, FILTER_INPUTS(avfilter_vf_split_inputs), .outputs = NULL, - .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, + .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_META, }; static const AVFilterPad avfilter_af_asplit_inputs[] = { @@ -131,5 +131,5 @@ const AVFilter ff_af_asplit = { .init = split_init, FILTER_INPUTS(avfilter_af_asplit_inputs), .outputs = NULL, - .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS, + .flags = AVFILTER_FLAG_DYNAMIC_OUTPUTS | AVFILTER_FLAG_META, }; diff --git a/libavfilter/trim.c b/libavfilter/trim.c index c260da3a0b..a102d53741 100644 --- a/libavfilter/trim.c +++ b/libavfilter/trim.c @@ -363,6 +363,7 @@ const AVFilter ff_af_atrim = { .init = init, .priv_size = sizeof(TrimContext), .priv_class = &atrim_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(atrim_inputs), FILTER_OUTPUTS(atrim_outputs), }; diff --git a/libavfilter/version.h b/libavfilter/version.h index b9e610ea1f..e0bdcb836d 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #include "libavutil/version.h" #define LIBAVFILTER_VERSION_MAJOR 8 -#define LIBAVFILTER_VERSION_MINOR 17 +#define LIBAVFILTER_VERSION_MINOR 18 #define LIBAVFILTER_VERSION_MICRO 100 diff --git a/libavfilter/vf_addroi.c b/libavfilter/vf_addroi.c index 5f9ec21754..a378d83495 100644 --- a/libavfilter/vf_addroi.c +++ b/libavfilter/vf_addroi.c @@ -262,6 +262,8 @@ const AVFilter ff_vf_addroi = { .priv_size = sizeof(AddROIContext), .priv_class = &addroi_class, + .flags = AVFILTER_FLAG_META, + FILTER_INPUTS(addroi_inputs), FILTER_OUTPUTS(addroi_outputs), }; diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c index 995c7f4f14..889d96a97e 100644 --- a/libavfilter/vf_aspect.c +++ b/libavfilter/vf_aspect.c @@ -188,6 +188,7 @@ const AVFilter ff_vf_setdar = { .description = NULL_IF_CONFIG_SMALL("Set the frame display aspect ratio."), .priv_size = sizeof(AspectContext), .priv_class = &setdar_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_vf_setdar_inputs), FILTER_OUTPUTS(avfilter_vf_setdar_outputs), }; @@ -250,6 +251,7 @@ const AVFilter ff_vf_setsar = { .description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."), .priv_size = sizeof(AspectContext), .priv_class = &setsar_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_vf_setsar_inputs), FILTER_OUTPUTS(avfilter_vf_setsar_outputs), }; diff --git a/libavfilter/vf_bbox.c b/libavfilter/vf_bbox.c index 559ca505bf..67a6d51dfb 100644 --- a/libavfilter/vf_bbox.c +++ b/libavfilter/vf_bbox.c @@ -151,6 +151,6 @@ const AVFilter ff_vf_bbox = { FILTER_INPUTS(bbox_inputs), FILTER_OUTPUTS(bbox_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_META, .process_command = ff_filter_process_command, }; diff --git a/libavfilter/vf_blackdetect.c b/libavfilter/vf_blackdetect.c index 93d5b077f1..ee14350d0f 100644 --- a/libavfilter/vf_blackdetect.c +++ b/libavfilter/vf_blackdetect.c @@ -257,5 +257,5 @@ const AVFilter ff_vf_blackdetect = { FILTER_PIXFMTS_ARRAY(pix_fmts), .uninit = uninit, .priv_class = &blackdetect_class, - .flags = AVFILTER_FLAG_SLICE_THREADS, + .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_META, }; diff --git a/libavfilter/vf_blackframe.c b/libavfilter/vf_blackframe.c index d37b3f3c13..1b1a0d2759 100644 --- a/libavfilter/vf_blackframe.c +++ b/libavfilter/vf_blackframe.c @@ -127,6 +127,7 @@ const AVFilter ff_vf_blackframe = { .description = NULL_IF_CONFIG_SMALL("Detect frames that are (almost) black."), .priv_size = sizeof(BlackFrameContext), .priv_class = &blackframe_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_vf_blackframe_inputs), FILTER_OUTPUTS(avfilter_vf_blackframe_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), diff --git a/libavfilter/vf_copy.c b/libavfilter/vf_copy.c index 5554565bae..858fa551e2 100644 --- a/libavfilter/vf_copy.c +++ b/libavfilter/vf_copy.c @@ -75,6 +75,7 @@ static const AVFilterPad avfilter_vf_copy_outputs[] = { const AVFilter ff_vf_copy = { .name = "copy", .description = NULL_IF_CONFIG_SMALL("Copy the input video unchanged to the output."), + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_vf_copy_inputs), FILTER_OUTPUTS(avfilter_vf_copy_outputs), FILTER_QUERY_FUNC(query_formats), diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index af3a8f333f..79b6b40a1e 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -273,5 +273,5 @@ const AVFilter ff_vf_cropdetect = { FILTER_INPUTS(avfilter_vf_cropdetect_inputs), FILTER_OUTPUTS(avfilter_vf_cropdetect_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_META, }; diff --git a/libavfilter/vf_entropy.c b/libavfilter/vf_entropy.c index 16569682a9..09cc678fc4 100644 --- a/libavfilter/vf_entropy.c +++ b/libavfilter/vf_entropy.c @@ -192,5 +192,5 @@ const AVFilter ff_vf_entropy = { FILTER_OUTPUTS(outputs), FILTER_PIXFMTS_ARRAY(pixfmts), .priv_class = &entropy_class, - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_META, }; diff --git a/libavfilter/vf_find_rect.c b/libavfilter/vf_find_rect.c index 6ac714ce45..37636ec302 100644 --- a/libavfilter/vf_find_rect.c +++ b/libavfilter/vf_find_rect.c @@ -294,6 +294,7 @@ const AVFilter ff_vf_find_rect = { .priv_size = sizeof(FOCContext), .init = init, .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(foc_inputs), FILTER_OUTPUTS(foc_outputs), FILTER_PIXFMTS(AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVJ420P), diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c index 7e15c43086..88b213a1f3 100644 --- a/libavfilter/vf_format.c +++ b/libavfilter/vf_format.c @@ -169,6 +169,8 @@ const AVFilter ff_vf_format = { .priv_size = sizeof(FormatContext), .priv_class = &format_class, + .flags = AVFILTER_FLAG_META, + FILTER_INPUTS(avfilter_vf_format_inputs), FILTER_OUTPUTS(avfilter_vf_format_outputs), @@ -203,6 +205,8 @@ const AVFilter ff_vf_noformat = { .priv_size = sizeof(FormatContext), + .flags = AVFILTER_FLAG_META, + FILTER_INPUTS(avfilter_vf_noformat_inputs), FILTER_OUTPUTS(avfilter_vf_noformat_outputs), diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index b8714727fa..f922fced65 100644 --- a/libavfilter/vf_fps.c +++ b/libavfilter/vf_fps.c @@ -388,6 +388,7 @@ const AVFilter ff_vf_fps = { .priv_size = sizeof(FPSContext), .priv_class = &fps_class, .activate = activate, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_vf_fps_inputs), FILTER_OUTPUTS(avfilter_vf_fps_outputs), }; diff --git a/libavfilter/vf_framestep.c b/libavfilter/vf_framestep.c index 5509df53e9..5c4d994bf5 100644 --- a/libavfilter/vf_framestep.c +++ b/libavfilter/vf_framestep.c @@ -94,5 +94,5 @@ const AVFilter ff_vf_framestep = { .priv_class = &framestep_class, FILTER_INPUTS(framestep_inputs), FILTER_OUTPUTS(framestep_outputs), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_META, }; diff --git a/libavfilter/vf_freezedetect.c b/libavfilter/vf_freezedetect.c index 99f0aae5a2..d936004e1f 100644 --- a/libavfilter/vf_freezedetect.c +++ b/libavfilter/vf_freezedetect.c @@ -217,6 +217,7 @@ const AVFilter ff_vf_freezedetect = { .priv_size = sizeof(FreezeDetectContext), .priv_class = &freezedetect_class, .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(freezedetect_inputs), FILTER_OUTPUTS(freezedetect_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), diff --git a/libavfilter/vf_identity.c b/libavfilter/vf_identity.c index 5096bda382..9b11f966ba 100644 --- a/libavfilter/vf_identity.c +++ b/libavfilter/vf_identity.c @@ -412,7 +412,9 @@ const AVFilter ff_vf_identity = { FILTER_INPUTS(identity_inputs), FILTER_OUTPUTS(identity_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | + AVFILTER_FLAG_SLICE_THREADS | + AVFILTER_FLAG_META, }; #endif /* CONFIG_IDENTITY_FILTER */ @@ -434,7 +436,9 @@ const AVFilter ff_vf_msad = { FILTER_INPUTS(identity_inputs), FILTER_OUTPUTS(identity_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | + AVFILTER_FLAG_SLICE_THREADS | + AVFILTER_FLAG_META, }; #endif /* CONFIG_MSAD_FILTER */ diff --git a/libavfilter/vf_idet.c b/libavfilter/vf_idet.c index 0f3e78c4ec..e568a7b219 100644 --- a/libavfilter/vf_idet.c +++ b/libavfilter/vf_idet.c @@ -436,6 +436,7 @@ const AVFilter ff_vf_idet = { .priv_size = sizeof(IDETContext), .init = init, .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(idet_inputs), FILTER_OUTPUTS(idet_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), diff --git a/libavfilter/vf_mestimate.c b/libavfilter/vf_mestimate.c index d8bcfdde02..b7aa1d37a8 100644 --- a/libavfilter/vf_mestimate.c +++ b/libavfilter/vf_mestimate.c @@ -363,6 +363,7 @@ const AVFilter ff_vf_mestimate = { .priv_size = sizeof(MEContext), .priv_class = &mestimate_class, .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(mestimate_inputs), FILTER_OUTPUTS(mestimate_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), diff --git a/libavfilter/vf_null.c b/libavfilter/vf_null.c index 33b1185ce0..7cfb8c1392 100644 --- a/libavfilter/vf_null.c +++ b/libavfilter/vf_null.c @@ -43,6 +43,7 @@ static const AVFilterPad avfilter_vf_null_outputs[] = { const AVFilter ff_vf_null = { .name = "null", .description = NULL_IF_CONFIG_SMALL("Pass the source unchanged to the output."), + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_vf_null_inputs), FILTER_OUTPUTS(avfilter_vf_null_outputs), }; diff --git a/libavfilter/vf_ocr.c b/libavfilter/vf_ocr.c index f6249e61fc..57c3a2605f 100644 --- a/libavfilter/vf_ocr.c +++ b/libavfilter/vf_ocr.c @@ -143,6 +143,7 @@ const AVFilter ff_vf_ocr = { .priv_class = &ocr_class, .init = init, .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(ocr_inputs), FILTER_OUTPUTS(ocr_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), diff --git a/libavfilter/vf_psnr.c b/libavfilter/vf_psnr.c index f96179db44..5e40d0bf1d 100644 --- a/libavfilter/vf_psnr.c +++ b/libavfilter/vf_psnr.c @@ -466,5 +466,7 @@ const AVFilter ff_vf_psnr = { FILTER_INPUTS(psnr_inputs), FILTER_OUTPUTS(psnr_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | + AVFILTER_FLAG_SLICE_THREADS | + AVFILTER_FLAG_META, }; diff --git a/libavfilter/vf_qp.c b/libavfilter/vf_qp.c index d942ba1579..74f7341a4d 100644 --- a/libavfilter/vf_qp.c +++ b/libavfilter/vf_qp.c @@ -198,5 +198,6 @@ const AVFilter ff_vf_qp = { FILTER_INPUTS(qp_inputs), FILTER_OUTPUTS(qp_outputs), .priv_class = &qp_class, - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | + AVFILTER_FLAG_META, }; diff --git a/libavfilter/vf_readeia608.c b/libavfilter/vf_readeia608.c index b9dc46e10e..86e5b72fd7 100644 --- a/libavfilter/vf_readeia608.c +++ b/libavfilter/vf_readeia608.c @@ -555,6 +555,8 @@ const AVFilter ff_vf_readeia608 = { FILTER_OUTPUTS(readeia608_outputs), FILTER_PIXFMTS_ARRAY(pixel_fmts), .uninit = uninit, - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | + AVFILTER_FLAG_SLICE_THREADS | + AVFILTER_FLAG_META, .process_command = process_command, }; diff --git a/libavfilter/vf_readvitc.c b/libavfilter/vf_readvitc.c index 370cf5d15d..49222b9345 100644 --- a/libavfilter/vf_readvitc.c +++ b/libavfilter/vf_readvitc.c @@ -242,6 +242,7 @@ const AVFilter ff_vf_readvitc = { .description = NULL_IF_CONFIG_SMALL("Read vertical interval timecode and write it to frame metadata."), .priv_size = sizeof(ReadVitcContext), .priv_class = &readvitc_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(inputs), FILTER_OUTPUTS(outputs), FILTER_PIXFMTS_ARRAY(pixel_fmts), diff --git a/libavfilter/vf_scdet.c b/libavfilter/vf_scdet.c index d11d2e2e2c..7401d411b3 100644 --- a/libavfilter/vf_scdet.c +++ b/libavfilter/vf_scdet.c @@ -206,6 +206,7 @@ const AVFilter ff_vf_scdet = { .priv_size = sizeof(SCDetContext), .priv_class = &scdet_class, .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(scdet_inputs), FILTER_OUTPUTS(scdet_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), diff --git a/libavfilter/vf_setparams.c b/libavfilter/vf_setparams.c index 0a79599bab..94a464ac08 100644 --- a/libavfilter/vf_setparams.c +++ b/libavfilter/vf_setparams.c @@ -165,6 +165,7 @@ const AVFilter ff_vf_setparams = { .description = NULL_IF_CONFIG_SMALL("Force field, or color property for the output video frame."), .priv_size = sizeof(SetParamsContext), .priv_class = &setparams_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(inputs), FILTER_OUTPUTS(outputs), }; @@ -204,6 +205,7 @@ const AVFilter ff_vf_setrange = { .priv_size = sizeof(SetParamsContext), .init = init_setrange, .priv_class = &setrange_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(inputs), FILTER_OUTPUTS(outputs), }; @@ -238,6 +240,7 @@ const AVFilter ff_vf_setfield = { .priv_size = sizeof(SetParamsContext), .init = init_setfield, .priv_class = &setfield_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(inputs), FILTER_OUTPUTS(outputs), }; diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index ff438e70c6..1b5186b0db 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -678,4 +678,5 @@ const AVFilter ff_vf_showinfo = { FILTER_OUTPUTS(avfilter_vf_showinfo_outputs), .priv_size = sizeof(ShowInfoContext), .priv_class = &showinfo_class, + .flags = AVFILTER_FLAG_META, }; diff --git a/libavfilter/vf_ssim.c b/libavfilter/vf_ssim.c index c6989d618b..7de7eb304c 100644 --- a/libavfilter/vf_ssim.c +++ b/libavfilter/vf_ssim.c @@ -592,5 +592,7 @@ const AVFilter ff_vf_ssim = { FILTER_INPUTS(ssim_inputs), FILTER_OUTPUTS(ssim_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | + AVFILTER_FLAG_SLICE_THREADS | + AVFILTER_FLAG_META, }; diff --git a/libavfilter/vf_vfrdet.c b/libavfilter/vf_vfrdet.c index fda8c2d485..b4c194c784 100644 --- a/libavfilter/vf_vfrdet.c +++ b/libavfilter/vf_vfrdet.c @@ -108,6 +108,7 @@ const AVFilter ff_vf_vfrdet = { .priv_size = sizeof(VFRDETContext), .init = init, .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(vfrdet_inputs), FILTER_OUTPUTS(vfrdet_outputs), }; diff --git a/libavfilter/vf_vidstabdetect.c b/libavfilter/vf_vidstabdetect.c index 05c95d0eeb..009c333f9b 100644 --- a/libavfilter/vf_vidstabdetect.c +++ b/libavfilter/vf_vidstabdetect.c @@ -196,6 +196,7 @@ const AVFilter ff_vf_vidstabdetect = { .priv_size = sizeof(StabData), .init = init, .uninit = uninit, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(avfilter_vf_vidstabdetect_inputs), FILTER_OUTPUTS(avfilter_vf_vidstabdetect_outputs), FILTER_PIXFMTS_ARRAY(ff_vidstab_pix_fmts), diff --git a/libavfilter/vf_vif.c b/libavfilter/vf_vif.c index 09854641b1..dbf0c3e33c 100644 --- a/libavfilter/vf_vif.c +++ b/libavfilter/vf_vif.c @@ -638,5 +638,7 @@ const AVFilter ff_vf_vif = { FILTER_INPUTS(vif_inputs), FILTER_OUTPUTS(vif_outputs), FILTER_PIXFMTS_ARRAY(pix_fmts), - .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | + AVFILTER_FLAG_SLICE_THREADS | + AVFILTER_FLAG_META, }; diff --git a/libavfilter/vf_vmafmotion.c b/libavfilter/vf_vmafmotion.c index 362839735e..d1abca7c2f 100644 --- a/libavfilter/vf_vmafmotion.c +++ b/libavfilter/vf_vmafmotion.c @@ -363,6 +363,7 @@ const AVFilter ff_vf_vmafmotion = { .uninit = uninit, .priv_size = sizeof(VMAFMotionContext), .priv_class = &vmafmotion_class, + .flags = AVFILTER_FLAG_META, FILTER_INPUTS(vmafmotion_inputs), FILTER_OUTPUTS(vmafmotion_outputs), FILTER_QUERY_FUNC(query_formats), From patchwork Tue Nov 23 10:30:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 31560 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp8445698iob; Tue, 23 Nov 2021 02:31:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzh2F+RUEuilgV0qBNdRDcyV/wPk9Im2VW8BvyqOpKXoW1HS733MjZfiQfPjf2IVaMedF1N X-Received: by 2002:a17:906:3e83:: with SMTP id a3mr6267953ejj.383.1637663488963; Tue, 23 Nov 2021 02:31:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637663488; cv=none; d=google.com; s=arc-20160816; b=xf1s7soEYyonjPV38uRJx5U+iff5IK03eR/snfre8Id4JJzTdFEU8y+ogoqVCKUF6s UhSP1xlmBO6QpP3z/MiVMTdTaU/VdB8Rm4XNUrCSk15natTO2TRbpyAjq6jPbkgDAGjY da9ohVl0hhlSeHshWclY/jsF3woMYN+KnpTZarkrp6VV4ndA3siLWJPGYG6EtNDDP4a2 aeqiH1rnjhYIjX8t+h7u7w7Hqz053aoEcST2Mp8ZoZ8M3LzVlf4cQ6WWPRn6MC0YgwiR WfoOjlm8xPz6SGqNF89ii1gaDFcvvJJXVLLfJ4ICC71fjWsw7WnzGEJU0EyvEAWG5iJ0 j1uw== 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=/ku1SwL9NHPUKBj8BknLnMiBZC/OnSNDvC7R+UASDYY=; b=JP1iDTynnfLUgnxN6aK2F4cpEKavK0AwcnGSmAFi20F29fRxoxUCv1E+D605ReJIVv wJJNOizl9zBebnLYT5MFmvH7LTNmOnPrM8VRBUbxZpUjGeN1Bh6Jq7zRSfrx4UfpaMCe JASt+qULXOtqFMZ9OmBpXtAC4WTLhDkqpmGawDA9s3V2TGFK3e1+2P/Fe0Ook1e0NGGa p1TusXekFpAMDV7bDFDaqhzgqDMJt6q/SKEMQjEsCl/CdiREDP96eVCYRC21lZLVZ685 VwA0XADuBNIlqAUJU6Ln+3yASIu/d2xnypb6gIuftcuoHU7+v4gdQY8zYuntK8gNh1mH rMmQ== 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 cw18si36944557ejc.639.2021.11.23.02.31.28; Tue, 23 Nov 2021 02:31:28 -0800 (PST) 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 6CDEC68AEA3; Tue, 23 Nov 2021 12:31:14 +0200 (EET) 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 6774868A44C for ; Tue, 23 Nov 2021 12:31:07 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 16258240177 for ; Tue, 23 Nov 2021 11:31:07 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id qUiO-zCdgdMa for ; Tue, 23 Nov 2021 11:31:06 +0100 (CET) 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 F415A24017C for ; Tue, 23 Nov 2021 11:31:05 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id CFAC83A073E; Tue, 23 Nov 2021 11:31:05 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Nov 2021 11:30:00 +0100 Message-Id: <20211123103001.12888-3-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211123103001.12888-1-anton@khirnov.net> References: <20211123103001.12888-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/4] ffmpeg: make -bits_per_raw_sample a per-output-stream 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: aJT0a6YcHZdk Also, document it and make it apply to audio in addition to video. --- doc/ffmpeg.texi | 7 +++++++ fftools/ffmpeg.c | 11 +++++++---- fftools/ffmpeg.h | 3 +++ fftools/ffmpeg_opt.c | 11 +++++++---- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 8418573618..5279a05b10 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -1945,6 +1945,13 @@ filter (scale, aresample) in the graph. On by default, to explicitly disable it you need to specify @code{-noauto_conversion_filters}. +@item -bits_per_raw_sample[:@var{stream_specifier}] @var{value} (@emph{output,per-stream}) +Declare the number of bits per raw sample in the given output stream to be +@var{value}. Note that this option sets the information provided to the +encoder/muxer, it does not change the stream to conform to this value. Setting +values that do not match the stream properties may result in encoding failures +or invalid output files. + @end table @section Preset files diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 7dfcfc13f5..55ad4e558e 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3411,13 +3411,16 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) switch (enc_ctx->codec_type) { case AVMEDIA_TYPE_AUDIO: enc_ctx->sample_fmt = av_buffersink_get_format(ost->filter->filter); - if (dec_ctx) - enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, - av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3); enc_ctx->sample_rate = av_buffersink_get_sample_rate(ost->filter->filter); enc_ctx->channel_layout = av_buffersink_get_channel_layout(ost->filter->filter); enc_ctx->channels = av_buffersink_get_channels(ost->filter->filter); + if (ost->bits_per_raw_sample) + enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample; + else if (dec_ctx) + enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, + av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3); + init_encoder_time_base(ost, av_make_q(1, enc_ctx->sample_rate)); break; @@ -3460,7 +3463,7 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) enc_ctx->width != dec_ctx->width || enc_ctx->height != dec_ctx->height || enc_ctx->pix_fmt != dec_ctx->pix_fmt) { - enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample; + enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample; } // Field order: autodetection diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 545ff1c8e7..3d9bb30e72 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -236,6 +236,8 @@ typedef struct OptionsContext { int nb_enc_time_bases; SpecifierOpt *autoscale; int nb_autoscale; + SpecifierOpt *bits_per_raw_sample; + int nb_bits_per_raw_sample; } OptionsContext; typedef struct InputFilter { @@ -493,6 +495,7 @@ typedef struct OutputStream { int top_field_first; int rotate_overridden; int autoscale; + int bits_per_raw_sample; double rotate_override_value; AVRational frame_aspect_ratio; diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index b423d0e59c..e839a830a6 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -96,6 +96,7 @@ static const char *const opt_name_discard[] = {"discard", NULL static const char *const opt_name_disposition[] = {"disposition", NULL}; static const char *const opt_name_time_bases[] = {"time_base", NULL}; static const char *const opt_name_enc_time_bases[] = {"enc_time_base", NULL}; +static const char *const opt_name_bits_per_raw_sample[] = {"bits_per_raw_sample", NULL}; #define WARN_MULTIPLE_OPT_USAGE(name, type, so, st)\ {\ @@ -167,7 +168,6 @@ int abort_on_flags = 0; int print_stats = -1; int qp_hist = 0; int stdin_interaction = 1; -int frame_bits_per_raw_sample = 0; float max_error_rate = 2.0/3; char *filter_nbthreads; int filter_complex_nbthreads = 0; @@ -1636,6 +1636,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e ost->muxing_queue_data_threshold = 50*1024*1024; MATCH_PER_STREAM_OPT(muxing_queue_data_threshold, i, ost->muxing_queue_data_threshold, oc, st); + MATCH_PER_STREAM_OPT(bits_per_raw_sample, i, ost->bits_per_raw_sample, + oc, st); + if (oc->oformat->flags & AVFMT_GLOBALHEADER) ost->enc_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; @@ -1801,7 +1804,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in exit_program(1); } - video_enc->bits_per_raw_sample = frame_bits_per_raw_sample; MATCH_PER_STREAM_OPT(frame_pix_fmts, str, frame_pix_fmt, oc, st); if (frame_pix_fmt && *frame_pix_fmt == '+') { ost->keep_pix_fmt = 1; @@ -3743,6 +3745,9 @@ const OptionDef options[] = { "set the maximum number of queued packets from the demuxer" }, { "find_stream_info", OPT_BOOL | OPT_PERFILE | OPT_INPUT | OPT_EXPERT, { &find_stream_info }, "read and decode the streams to fill missing information with heuristics" }, + { "bits_per_raw_sample", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, + { .off = OFFSET(bits_per_raw_sample) }, + "set the number of bits per raw sample", "number" }, /* video options */ { "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_frames }, @@ -3762,8 +3767,6 @@ const OptionDef options[] = { { "pix_fmt", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_pix_fmts) }, "set pixel format", "format" }, - { "bits_per_raw_sample", OPT_VIDEO | OPT_INT | HAS_ARG, { &frame_bits_per_raw_sample }, - "set the number of bits per raw sample", "number" }, { "intra", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &intra_only }, "deprecated use -g 1" }, { "vn", OPT_VIDEO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(video_disable) }, From patchwork Tue Nov 23 10:30:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 31557 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:d206:0:0:0:0:0 with SMTP id q6csp8445893iob; Tue, 23 Nov 2021 02:31:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGfR1kSV09TE+swtijysfgCzutvAWC/Tx+s2k7YIqK9QU2JB4PqWdDx1feGxAUH4RQqCH5 X-Received: by 2002:a05:6402:358c:: with SMTP id y12mr7951589edc.44.1637663499009; Tue, 23 Nov 2021 02:31:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637663499; cv=none; d=google.com; s=arc-20160816; b=sx7/TYfORnk5uS46Tl4+gwySMOC0P1D4BFFadD5qlNmzAtACoPBs0LMJmUsWHkxRqs q0HXMgfgpw8ZOU1B5ejUurTgccqq/CVH7d+isVmoXF+99sEcmmoOf5+HrmjJ2erJ51tQ 3sQzcDjhqFDHR0COQy/EnA1l8smDdg2tjltP4gG3Jdf/SV+8cGv0OGS9ocOBb5H/f1gH QNZJIX1LKw/8JoN7PkUMOJ+J6/ikD4h7Edd/ONbOdnRheKx5ibVMw8fGUt+zBZ+3Wvia qctCuIVU609VA1S3ZF7HMtIBpfTp+sDbe4NT7pbgSgyGd+Wi6rcHTKuWsIqy4uH/LX2F mWgA== 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=4xv2abIBgu+1ZlC/3sVy8eOWqkVWyD0ZBwLJNGqNZ5o=; b=vI7mlfhcCVftsa8F6DjcwxwPcYEijB5VvKS7EKK9Z6aNOgizDkMDQs+tLhSfLgM8EW U+UrHu+0LCS3DjQPPw4UR/BoNAVy7rK7T/lxg61l0GXdkkyjHZbtaQ/1zB4oNaUJD98a DDHFjGVR4VUogYJfQwv85rNUUfNHCkN5TQH4JfyBvRR9CgNhroLVD0lmlYreyUu1U8F8 OZnkt0YXJQtgstEAxaIin6qqMLzOcqw36I3LLDt2tlt8QX/yjpN3N0AT7CnJNGmFtdSp Xj/RDllewq0K3subLRaA62Qoe6nb4jkfSY+mGgHqRxecCNM49TkPXjVZPBLav34z/2cr x4gg== 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 ga32si33955582ejc.769.2021.11.23.02.31.38; Tue, 23 Nov 2021 02:31:38 -0800 (PST) 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 4A4D068AEA4; Tue, 23 Nov 2021 12:31:16 +0200 (EET) 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 E138068AE74 for ; Tue, 23 Nov 2021 12:31:07 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 92BF924017C for ; Tue, 23 Nov 2021 11:31:07 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id wpEWb5r4dw19 for ; Tue, 23 Nov 2021 11:31:07 +0100 (CET) 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 005F424017E for ; Tue, 23 Nov 2021 11:31:05 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id D459F3A0743; Tue, 23 Nov 2021 11:31:05 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 23 Nov 2021 11:30:01 +0100 Message-Id: <20211123103001.12888-4-anton@khirnov.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211123103001.12888-1-anton@khirnov.net> References: <20211123103001.12888-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] ffmpeg: only copy bits_per_sample from decoder when it remains valid 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: z13EqZsp3FDs I.e. when the only filters that are applied do not modify the frame data. --- fftools/ffmpeg.c | 14 +++++--------- fftools/ffmpeg.h | 3 +++ fftools/ffmpeg_filter.c | 26 ++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 55ad4e558e..ff4bae11b3 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -3417,7 +3417,7 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) if (ost->bits_per_raw_sample) enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample; - else if (dec_ctx) + else if (dec_ctx && ost->filter->graph->is_meta) enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, av_get_bytes_per_sample(enc_ctx->sample_fmt) << 3); @@ -3443,7 +3443,10 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) av_buffersink_get_sample_aspect_ratio(ost->filter->filter); enc_ctx->pix_fmt = av_buffersink_get_format(ost->filter->filter); - if (dec_ctx) + + if (ost->bits_per_raw_sample) + enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample; + else if (dec_ctx && ost->filter->graph->is_meta) enc_ctx->bits_per_raw_sample = FFMIN(dec_ctx->bits_per_raw_sample, av_pix_fmt_desc_get(enc_ctx->pix_fmt)->comp[0].depth); @@ -3459,13 +3462,6 @@ static int init_output_stream_encode(OutputStream *ost, AVFrame *frame) ost->st->avg_frame_rate = ost->frame_rate; - if (!dec_ctx || - enc_ctx->width != dec_ctx->width || - enc_ctx->height != dec_ctx->height || - enc_ctx->pix_fmt != dec_ctx->pix_fmt) { - enc_ctx->bits_per_raw_sample = ost->bits_per_raw_sample; - } - // Field order: autodetection if (frame) { if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) && diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 3d9bb30e72..51ab81b161 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -294,6 +294,9 @@ typedef struct FilterGraph { AVFilterGraph *graph; int reconfiguration; + // true when the filtergraph contains only meta filters + // that do not modify the frame data + int is_meta; InputFilter **inputs; int nb_inputs; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index c70903295f..ac7a74ba02 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -980,6 +980,30 @@ static void cleanup_filtergraph(FilterGraph *fg) avfilter_graph_free(&fg->graph); } +static int filter_is_buffersrc(const AVFilterContext *f) +{ + return f->nb_inputs == 0 && + (!strcmp(f->filter->name, "buffersrc") || + !strcmp(f->filter->name, "abuffersrc")); +} + +static int graph_is_meta(AVFilterGraph *graph) +{ + for (unsigned i = 0; i < graph->nb_filters; i++) { + const AVFilterContext *f = graph->filters[i]; + + /* in addition to filters flagged as meta, also + * disregard sinks and buffersources (but not other sources, + * since they introduce data we are not aware of) + */ + if (!((f->filter->flags & AVFILTER_FLAG_META) || + f->nb_outputs == 0 || + filter_is_buffersrc(f))) + return 0; + } + return 1; +} + int configure_filtergraph(FilterGraph *fg) { AVFilterInOut *inputs, *outputs, *cur; @@ -1080,6 +1104,8 @@ int configure_filtergraph(FilterGraph *fg) if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0) goto fail; + fg->is_meta = graph_is_meta(fg->graph); + /* limit the lists of allowed formats to the ones selected, to * make sure they stay the same if the filtergraph is reconfigured later */ for (i = 0; i < fg->nb_outputs; i++) {