From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id CC70046CAA for ; Fri, 7 Jul 2023 09:51:59 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 71E5A68C842; Fri, 7 Jul 2023 12:49:28 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 853E068C79D for ; Fri, 7 Jul 2023 12:49:07 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id DEF452405EC for ; Fri, 7 Jul 2023 11:49:04 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id uFoWmoPQVc6i for ; Fri, 7 Jul 2023 11:49:04 +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 D7AA02405F9 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 AF1033A1531 for ; Fri, 7 Jul 2023 11:48:54 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Jul 2023 11:48:36 +0200 Message-Id: <20230707094847.25324-11-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 11/22] fftools/ffmpeg_filter: make OutputFile.{formats, ch_layouts, sample_rates} 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: They are not used outside of the filtering code. --- fftools/ffmpeg.h | 6 ------ fftools/ffmpeg_filter.c | 35 ++++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 79f3f35b3a..3201163a4f 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -294,12 +294,6 @@ typedef struct OutputFilter { enum AVMediaType type; - // those are only set if no format is specified and the encoder gives us multiple options - // They point directly to the relevant lists of the encoder. - const int *formats; - const AVChannelLayout *ch_layouts; - const int *sample_rates; - /* pts of the last frame received from this filter, in AV_TIME_BASE_Q */ int64_t last_pts; } OutputFilter; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 0874187f3e..f60d1cd23b 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -141,6 +141,12 @@ typedef struct OutputFilterPriv { int width, height; int sample_rate; AVChannelLayout ch_layout; + + // those are only set if no format is specified and the encoder gives us multiple options + // They point directly to the relevant lists of the encoder. + const int *formats; + const AVChannelLayout *ch_layouts; + const int *sample_rates; } OutputFilterPriv; static OutputFilterPriv *ofp_from_ofilter(OutputFilter *ofilter) @@ -346,10 +352,9 @@ static const char *choose_pix_fmts(OutputFilter *ofilter, AVBPrint *bprint) /* Define a function for appending a list of allowed formats * to an AVBPrint. If nonempty, the list will have a header. */ #define DEF_CHOOSE_FORMAT(name, type, var, supported_list, none, printf_format, get_name) \ -static void choose_ ## name (OutputFilter *ofilter, AVBPrint *bprint) \ +static void choose_ ## name (OutputFilterPriv *ofp, AVBPrint *bprint) \ { \ - OutputFilterPriv *ofp = ofp_from_ofilter(ofilter); \ - if (ofp->var == none && !ofilter->supported_list) \ + if (ofp->var == none && !ofp->supported_list) \ return; \ av_bprintf(bprint, #name "="); \ if (ofp->var != none) { \ @@ -357,7 +362,7 @@ static void choose_ ## name (OutputFilter *ofilter, AVBPrint *bprint) \ } else { \ const type *p; \ \ - for (p = ofilter->supported_list; *p != none; p++) { \ + for (p = ofp->supported_list; *p != none; p++) { \ av_bprintf(bprint, printf_format "|", get_name(*p)); \ } \ if (bprint->len > 0) \ @@ -375,17 +380,16 @@ DEF_CHOOSE_FORMAT(sample_fmts, enum AVSampleFormat, format, formats, DEF_CHOOSE_FORMAT(sample_rates, int, sample_rate, sample_rates, 0, "%d", ) -static void choose_channel_layouts(OutputFilter *ofilter, AVBPrint *bprint) +static void choose_channel_layouts(OutputFilterPriv *ofp, AVBPrint *bprint) { - OutputFilterPriv *ofp = ofp_from_ofilter(ofilter); if (av_channel_layout_check(&ofp->ch_layout)) { av_bprintf(bprint, "channel_layouts="); av_channel_layout_describe_bprint(&ofp->ch_layout, bprint); - } else if (ofilter->ch_layouts) { + } else if (ofp->ch_layouts) { const AVChannelLayout *p; av_bprintf(bprint, "channel_layouts="); - for (p = ofilter->ch_layouts; p->nb_channels; p++) { + for (p = ofp->ch_layouts; p->nb_channels; p++) { av_channel_layout_describe_bprint(p, bprint); av_bprintf(bprint, "|"); } @@ -689,24 +693,24 @@ void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost) if (ost->enc_ctx->pix_fmt != AV_PIX_FMT_NONE) { ofp->format = ost->enc_ctx->pix_fmt; } else { - ofilter->formats = c->pix_fmts; + ofp->formats = c->pix_fmts; } break; case AVMEDIA_TYPE_AUDIO: if (ost->enc_ctx->sample_fmt != AV_SAMPLE_FMT_NONE) { ofp->format = ost->enc_ctx->sample_fmt; } else { - ofilter->formats = c->sample_fmts; + ofp->formats = c->sample_fmts; } if (ost->enc_ctx->sample_rate) { ofp->sample_rate = ost->enc_ctx->sample_rate; } else { - ofilter->sample_rates = c->supported_samplerates; + ofp->sample_rates = c->supported_samplerates; } if (ost->enc_ctx->ch_layout.nb_channels) { set_channel_layout(ofp, ost); } else if (c->ch_layouts) { - ofilter->ch_layouts = c->ch_layouts; + ofp->ch_layouts = c->ch_layouts; } break; } @@ -1144,6 +1148,7 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { + OutputFilterPriv *ofp = ofp_from_ofilter(ofilter); OutputStream *ost = ofilter->ost; OutputFile *of = output_files[ost->file_index]; AVFilterContext *last_filter = out->filter_ctx; @@ -1196,9 +1201,9 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, } #endif - choose_sample_fmts(ofilter, &args); - choose_sample_rates(ofilter, &args); - choose_channel_layouts(ofilter, &args); + choose_sample_fmts(ofp, &args); + choose_sample_rates(ofp, &args); + choose_channel_layouts(ofp, &args); if (!av_bprint_is_complete(&args)) { ret = AVERROR(ENOMEM); goto fail; -- 2.40.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".