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 4C04A46144 for ; Fri, 7 Jul 2023 09:50:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0829468C804; Fri, 7 Jul 2023 12:49:20 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C757368C7BC for ; Fri, 7 Jul 2023 12:49:08 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 917F52404EA for ; Fri, 7 Jul 2023 11:49:08 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id R3CyXLiQLKXC for ; Fri, 7 Jul 2023 11:49:08 +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 189B5240706 for ; Fri, 7 Jul 2023 11:49:01 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id BAE653A15A9 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:37 +0200 Message-Id: <20230707094847.25324-12-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 12/22] fftools/ffmpeg_filter: consolidate calling avfilter_graph_set_auto_convert() 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: Do not call it from choose_pix_fmts(), as that function is not supposed to modify random filtergraph properties. --- fftools/ffmpeg_filter.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index f60d1cd23b..caf85194c5 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -48,6 +48,7 @@ typedef struct FilterGraphPriv { // true when the filtergraph contains only meta filters // that do not modify the frame data int is_meta; + int disable_conversions; const char *graph_desc; @@ -321,8 +322,6 @@ static const char *choose_pix_fmts(OutputFilter *ofilter, AVBPrint *bprint) av_opt_set(ost->enc_ctx, "strict", strict_dict->value, 0); if (ost->keep_pix_fmt) { - avfilter_graph_set_auto_convert(ofilter->graph->graph, - AVFILTER_AUTO_CONVERT_NONE); if (ost->enc_ctx->pix_fmt == AV_PIX_FMT_NONE) return NULL; return av_get_pix_fmt_name(ost->enc_ctx->pix_fmt); @@ -679,6 +678,7 @@ void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost) { OutputFilterPriv *ofp = ofp_from_ofilter(ofilter); FilterGraph *fg = ofilter->graph; + FilterGraphPriv *fgp = fgp_from_fg(fg); const AVCodec *c = ost->enc_ctx->codec; av_assert0(!ofilter->ost); @@ -695,6 +695,9 @@ void ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost) } else { ofp->formats = c->pix_fmts; } + + fgp->disable_conversions |= ost->keep_pix_fmt; + break; case AVMEDIA_TYPE_AUDIO: if (ost->enc_ctx->sample_fmt != AV_SAMPLE_FMT_NONE) { @@ -830,6 +833,7 @@ FilterGraph *fg_create(char *graph_desc) fg->class = &fg_class; fg->index = nb_filtergraphs - 1; fgp->graph_desc = graph_desc; + fgp->disable_conversions = !auto_conversion_filters; snprintf(fgp->log_name, sizeof(fgp->log_name), "fc#%d", fg->index); @@ -1587,7 +1591,7 @@ static int configure_filtergraph(FilterGraph *fg) configure_output_filter(fg, fg->outputs[i], cur); avfilter_inout_free(&outputs); - if (!auto_conversion_filters) + if (fgp->disable_conversions) avfilter_graph_set_auto_convert(fg->graph, AVFILTER_AUTO_CONVERT_NONE); if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0) 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".