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 7B0EC45E79 for ; Thu, 13 Apr 2023 14:16:42 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 64BDB68BE3E; Thu, 13 Apr 2023 17:16:04 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A2B9168BD76 for ; Thu, 13 Apr 2023 17:15:55 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 697E22404F8 for ; Thu, 13 Apr 2023 16:15:55 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 1-GLA22QGN-p for ; Thu, 13 Apr 2023 16:15:54 +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 34C28240591 for ; Thu, 13 Apr 2023 16:15:53 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 252B73A038E for ; Thu, 13 Apr 2023 16:15:53 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 13 Apr 2023 16:12:06 +0200 Message-Id: <20230413141223.17245-8-anton@khirnov.net> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230413141223.17245-1-anton@khirnov.net> References: <20230413141223.17245-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 08/25] fftools/ffmpeg_mux_init: consolidate input stream flagging code 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: Makes it easier to see where the input stream is modified from muxer code. --- fftools/ffmpeg_mux_init.c | 42 ++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c index e3d66b9897..dc1dd834e0 100644 --- a/fftools/ffmpeg_mux_init.c +++ b/fftools/ffmpeg_mux_init.c @@ -1200,13 +1200,6 @@ static OutputStream *ost_add(Muxer *mux, const OptionsContext *o, if (ost->enc_ctx && av_get_exact_bits_per_sample(ost->enc_ctx->codec_id) == 24) av_dict_set(&ost->swr_opts, "output_sample_bits", "24", 0); - if (ost->ist) { - ost->ist->discard = 0; - ost->ist->st->discard = ost->ist->user_set_discard; - - if (!(ost->enc && (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO))) - ist_output_add(ost->ist, ost); - } ost->last_mux_dts = AV_NOPTS_VALUE; MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, @@ -1221,6 +1214,25 @@ static OutputStream *ost_add(Muxer *mux, const OptionsContext *o, default: new_stream_unknown (mux, o, ost); break; } + if (ost->ist) { + ost->ist->discard = 0; + ost->ist->st->discard = ost->ist->user_set_discard; + + if (ost->enc) + ost->ist->decoding_needed |= DECODING_FOR_OST; + + if (ost->enc && + (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)) { + ret = init_simple_filtergraph(ost->ist, ost); + if (ret < 0) { + av_log(ost, AV_LOG_ERROR, + "Error initializing a simple filtergraph\n"); + exit_program(1); + } + } else + ist_output_add(ost->ist, ost); + } + if (ost->ist && !ost->enc) { ret = streamcopy_init(mux, o, ost); if (ret < 0) @@ -2407,25 +2419,9 @@ int of_open(const OptionsContext *o, const char *filename) /* check if all codec options have been used */ validate_enc_avopt(mux, o->g->codec_opts); - /* set the decoding_needed flags and create simple filtergraphs */ for (int i = 0; i < of->nb_streams; i++) { OutputStream *ost = of->streams[i]; - if (ost->enc_ctx && ost->ist) { - InputStream *ist = ost->ist; - ist->decoding_needed |= DECODING_FOR_OST; - - if (ost->st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO || - ost->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { - err = init_simple_filtergraph(ist, ost); - if (err < 0) { - av_log(ost, AV_LOG_ERROR, - "Error initializing a simple filtergraph\n"); - exit_program(1); - } - } - } - /* set the filter output constraints */ if (ost->filter) { const AVCodec *c = ost->enc_ctx->codec; -- 2.39.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".