From patchwork Fri Jul 7 09:48:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 42483 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1e:b0:12b:9ae3:586d with SMTP id c30csp7162202pzh; Fri, 7 Jul 2023 02:50:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlFtcB6FsXQAssLYvkNThuBw2hyY8VOjb05OelJ9Hwc0ct4XDjZfB9tnW4EY57xgCw+pfmzJ X-Received: by 2002:a2e:7019:0:b0:2b6:da64:734f with SMTP id l25-20020a2e7019000000b002b6da64734fmr3297774ljc.47.1688723433278; Fri, 07 Jul 2023 02:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688723433; cv=none; d=google.com; s=arc-20160816; b=Hnc1OSsqh+FWMH/zacmSfnU0Vp7Dk+/fu+W8PRFR8kuVpgZWvZ7XKE5T7OUMlSDa6A hawqRNhKht9vx2762FJY9+vyjexvGoqBIjy9mtvbYI+Ps+v7tA18wQr/yrgKlT+TnmLe AV2/iK36rt/i/TQ4202TUjLbIZSXK84eQ+SA/Obl1YWCHE4Fmo2dqE1VYwGl+Tyj4gZa NnjK6ospINFKnAZvOs6iZ1FQoceHUce8wzYSOS4Om7yQDxqNl2Vkel2XcwPin8x96D3l oIjqnX12TV+dXk9Qg/UFoQjr2U7SVfsBvbsfa9/vFV5Ir76CiR4JxkdAcd2j27f9Aea7 vFvg== 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=OjiVCXpQEmzTikrR4xVH2NZlhfGFx4d1tthhed4z4wI=; fh=8ZF2QtiKOjBtyn9wuO2cMeZaLsE4aq02Bq77gGK61E8=; b=JuXcbm+YqipF6gsGfEiMOfqx0MMGSLe/TFzYFhjkAH5jv+gxMHQRQ8nmfEwALDMNOA nIGGA57RuW1NoJqfdV0Oas7P7iS7Vv3bJQiOxvutzrB3KqlLMdWOZ1dTHg/L5YAHedjZ IUVg1b8xB7/Zr9KEobIlIR3hgp9QSAb6uYejoaxYLUhHZwani8vKmkDXsYmXP5Iem4PK 00x0RlUpGz5aigt12+luyGgmQTOWjk1PzhSkkhM31nANqucecKYYSKLpaRdrOg4CFBKE Mfiixkam07+OVvZO7cO3RFl/w1h1TGL2myvzYCGTDMexN4JLFqt6YRe73wulhvlWezqF 9Gcw== 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 f10-20020a056402150a00b0051e0f1fc628si1159364edw.625.2023.07.07.02.50.32; Fri, 07 Jul 2023 02:50:33 -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 4157C68C800; Fri, 7 Jul 2023 12:49:18 +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 9696568C7BC for ; Fri, 7 Jul 2023 12:49:08 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 53E702404EC for ; Fri, 7 Jul 2023 11:49:07 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id x7JQh-l4QV5n for ; Fri, 7 Jul 2023 11:49:06 +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 F3D6B2406CC for ; Fri, 7 Jul 2023 11:49:00 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 18CEE3A1929 for ; Fri, 7 Jul 2023 11:48:55 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Jul 2023 11:48:44 +0200 Message-Id: <20230707094847.25324-19-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230707094847.25324-1-anton@khirnov.net> References: <20230707094847.25324-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 19/22] 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: UXvbn+DUbIpI 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 3201163a4f..abea424486 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;