From patchwork Thu Jul 13 10:55:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 42660 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6da1:b0:131:a7d0:bc6d with SMTP id gl33csp2824316pzb; Thu, 13 Jul 2023 04:01:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlFA3cIp6fg6B1/5oMZPuLaUpbxsQQ9aBozjHSZMGgtumWkOBAqTau0Jw4uz4kQBRnPtDT+N X-Received: by 2002:aa7:d299:0:b0:51e:293e:eb96 with SMTP id w25-20020aa7d299000000b0051e293eeb96mr1249045edq.40.1689246102069; Thu, 13 Jul 2023 04:01:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689246102; cv=none; d=google.com; s=arc-20160816; b=pmIugwqwtkYj1XJ0uAX7VShcQTCHYaiwO5+AwQpLrqoGZmJcIsza3iVYHqYzgldyv9 oynuwwNpD9F4x7xzVXr8j21hsweOXaVEfAReAVyoBxYOSIWXJlNH7UfJYn2jH3WJX1OL tZefQ4l9Lwt1Oi+8mapAsafk3nOkwNPh9qcGe4UVwi82PxGnsDS2Gxq3aXEMUiBlGL4S jhmuSSHibG2D8XBvpUykzz5R6Sg+l8r+zlF1WXd+vSYWEueKNay3tkMMqsAuKzH3seyP hxiXxaXXTZFjorRORb7F4AMQiHzIXkDtNj0hn/JFOmuxYh2e2ZFIJ9jWoXGHb97os7Jw nVDg== 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=xSzgJLW6fw0PVRIBQywDxTKYb9jyMsxMWP+g0Uu9VME=; fh=8ZF2QtiKOjBtyn9wuO2cMeZaLsE4aq02Bq77gGK61E8=; b=X6LQ8QDGMpKVMFicZkycMy8EjeOjxd6dmdL/8DxqjTl+bQtmhOUwxq/aPW+e0dPrsg HcGn/5w4KadOH7gcK6pdxq9pzQzCKnLGABXstNWi7nUqSncHflknoxoV2hkWjttufF0m lBTIEdnTl5c43GA2N6oWxnhwWxIoZ4Ue7stntFzpfDLbBhhLxP6G8ZSJymqIEoJqOjV/ t8WhcpC7MCS4Un7BCP8Ja6sPe+g4mSRYW4/z7AxiWSHnU2Sw1VeOxv4fsIlZQOvlFcyn aH2q2aq5Z/dwEMandUt6RHAscHGaNf4RXHPVcQ/zHfhshkhj8Sq3LXQc9z7ABVjyy978 coKQ== 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 v25-20020aa7d819000000b0051e23d22f37si6926824edq.649.2023.07.13.04.01.41; Thu, 13 Jul 2023 04:01:42 -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 BB2D668C735; Thu, 13 Jul 2023 13:58:17 +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 D97D168C6BD for ; Thu, 13 Jul 2023 13:57:55 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id A9C772404EC for ; Thu, 13 Jul 2023 12:57:55 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id joNEbf4CfmIh for ; Thu, 13 Jul 2023 12:57:53 +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 C5407240D1C for ; Thu, 13 Jul 2023 12:57:41 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 5731C3A21C7 for ; Thu, 13 Jul 2023 12:57:36 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 13 Jul 2023 12:55:50 +0200 Message-Id: <20230713105553.21052-30-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230713105553.21052-1-anton@khirnov.net> References: <20230713105553.21052-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 30/33] fftools/ffmpeg_filter: make OutputFilter.filter private 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: XWXcMGUT9QLL It should not be accessed from outside of filtering code. --- fftools/ffmpeg.h | 1 - fftools/ffmpeg_filter.c | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index bcd9cc584e..bd6b0ed6d1 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -283,7 +283,6 @@ typedef struct InputFilter { } InputFilter; typedef struct OutputFilter { - AVFilterContext *filter; struct OutputStream *ost; struct FilterGraph *graph; uint8_t *name; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 4955fe38dd..e14b8f0f3c 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -137,6 +137,8 @@ static InputFilterPriv *ifp_from_ifilter(InputFilter *ifilter) typedef struct OutputFilterPriv { OutputFilter ofilter; + AVFilterContext *filter; + /* desired output stream properties */ int format; int width, height; @@ -1060,7 +1062,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, char name[255]; snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index); - ret = avfilter_graph_create_filter(&ofilter->filter, + ret = avfilter_graph_create_filter(&ofp->filter, avfilter_get_by_name("buffersink"), name, NULL, NULL, fg->graph); @@ -1116,7 +1118,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, return ret; - if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0) + if ((ret = avfilter_link(last_filter, pad_idx, ofp->filter, 0)) < 0) return ret; return 0; @@ -1134,12 +1136,12 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, int ret; snprintf(name, sizeof(name), "out_%d_%d", ost->file_index, ost->index); - ret = avfilter_graph_create_filter(&ofilter->filter, + ret = avfilter_graph_create_filter(&ofp->filter, avfilter_get_by_name("abuffersink"), name, NULL, NULL, fg->graph); if (ret < 0) return ret; - if ((ret = av_opt_set_int(ofilter->filter, "all_channel_counts", 1, AV_OPT_SEARCH_CHILDREN)) < 0) + if ((ret = av_opt_set_int(ofp->filter, "all_channel_counts", 1, AV_OPT_SEARCH_CHILDREN)) < 0) return ret; #define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \ @@ -1222,7 +1224,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, if (ret < 0) goto fail; - if ((ret = avfilter_link(last_filter, pad_idx, ofilter->filter, 0)) < 0) + if ((ret = avfilter_link(last_filter, pad_idx, ofp->filter, 0)) < 0) goto fail; fail: av_bprint_finalize(&args, NULL); @@ -1470,7 +1472,7 @@ static void cleanup_filtergraph(FilterGraph *fg) { int i; for (i = 0; i < fg->nb_outputs; i++) - fg->outputs[i]->filter = (AVFilterContext *)NULL; + ofp_from_ofilter(fg->outputs[i])->filter = NULL; for (i = 0; i < fg->nb_inputs; i++) ifp_from_ifilter(fg->inputs[i])->filter = NULL; avfilter_graph_free(&fg->graph); @@ -1575,7 +1577,7 @@ static int configure_filtergraph(FilterGraph *fg) for (i = 0; i < fg->nb_outputs; i++) { OutputFilter *ofilter = fg->outputs[i]; OutputFilterPriv *ofp = ofp_from_ofilter(ofilter); - AVFilterContext *sink = ofilter->filter; + AVFilterContext *sink = ofp->filter; ofp->format = av_buffersink_get_format(sink); @@ -1705,9 +1707,9 @@ int reap_filters(int flush) if (!ost->filter || !ost->filter->graph->graph) continue; - filter = ost->filter->filter; fgp = fgp_from_fg(ost->filter->graph); ofp = ofp_from_ofilter(ost->filter); + filter = ofp->filter; filtered_frame = fgp->frame;