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 32D5C45E6C for ; Thu, 13 Apr 2023 14:17:09 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3EDA868BE77; Thu, 13 Apr 2023 17:16:06 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8096568BDA5 for ; Thu, 13 Apr 2023 17:16:01 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 568642406CC for ; Thu, 13 Apr 2023 16:16:00 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id IBhbw92ywsmQ for ; Thu, 13 Apr 2023 16:15:59 +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 79C872406CF 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 6A7603A03E5 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:12 +0200 Message-Id: <20230413141223.17245-14-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 14/25] fftools/ffmpeg: open decoders right after we know they are needed 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: Will allow initializing subtitle encoding earlier. --- fftools/ffmpeg.c | 5 ----- fftools/ffmpeg_demux.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index d8b06eb724..900d6e5e83 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1882,11 +1882,6 @@ static int transcode_init(void) ifile->streams[j]->start = av_gettime_relative(); } - /* init input streams */ - for (InputStream *ist = ist_iter(NULL); ist; ist = ist_iter(ist)) - if (ist->decoding_needed && (ret = dec_open(ist)) < 0) - goto dump_format; - /* * initialize stream copy and subtitle/data streams. * Encoded AVFrame based streams will get initialized when the first AVFrame diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index d15a714e90..91609509b2 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -566,6 +566,12 @@ static void ist_use(InputStream *ist, int decoding_needed) ist->discard = 0; ist->st->discard = ist->user_set_discard; ist->decoding_needed |= decoding_needed; + + if (decoding_needed && !avcodec_is_open(ist->dec_ctx)) { + int ret = dec_open(ist); + if (ret < 0) + report_and_exit(ret); + } } void ist_output_add(InputStream *ist, OutputStream *ost) -- 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".