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 8D9F048522 for ; Sat, 6 Jan 2024 11:35:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8CFAE68CC5B; Sat, 6 Jan 2024 13:35:01 +0200 (EET) Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CF7F868BB4C for ; Sat, 6 Jan 2024 13:34:55 +0200 (EET) Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a271a28aeb4so33245166b.2 for ; Sat, 06 Jan 2024 03:34:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704540895; x=1705145695; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=4N1aWWWaNv26HWo54nyEvj4woJTtCi2lvkIlRnXIp2M=; b=m/RM716kUKiNiVXEBdMcoKeLYzNVnYlvqSaqd4ftaCVyDBdhWcrCOE4TV0JoCXMBHY 4+XrgfiqYpvztziupyMhC+qGYGA8LJNmumCjpqV6ddd5dyY2bVj6Sytbxmlz7YvnJ/cl s+0GxN2cu9P9/cLkLzpefCPzFSUrv5iMh2Ol9e5eLJOT44DBjXR8755CJUihNUyuyStk TZdnGL91206r7+MABubTjtWXSEmLjWCrskbghb+8GRqITBAbQNEIbGTI3EoVEhk4agvd 0LIYSfkZd/dGUIK01f6V2mVBiO0ZPYlODqJRmBrDPWwIumLfX46Fu6BbnNrrui7JGn+k a99w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704540895; x=1705145695; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=4N1aWWWaNv26HWo54nyEvj4woJTtCi2lvkIlRnXIp2M=; b=Y0KshdtDBHxkmxEIRlvW7cCRa3o2LkttJJLu7ynREWR0sAQBoap+xDnGDQx3+nsk5S 1iUPL7eaT+7ZiUhTf/hzE0p/tryUbcR6ztSIoIafyNyrdgQO/GB7HkgHMv6pMIr9eDGq WDwLs9rMXiMdLCOuO2lmVgXNgb/HixgpXH9BYEYjN0JsrDHhsMrYfz1jJL2eRAfb1nOr gxzJKMIHLKoljN8Bhf3Ym3UDLUhQ3KwQwYLwt5uQNCpdjE2gskp4C3dM7j6FYZdAPwXB wTPs9buwc8wqFF9w9CCh2ifb74y3HJlLju4vEAPd/wEJ3hPQEMyYxO5TraIKVcvSdn2W l5eg== X-Gm-Message-State: AOJu0YxQealPXjCraimwLtMUkfDKy3DyuBg5YeThldhKf6xSuMWPtyj9 c/VMWYMLSw0JD3nebSWVwN295C5ySFc= X-Google-Smtp-Source: AGHT+IE4/k55lA/VrNXiUXTHIMmiR1cfpPv5OjG6ljQVWE5n+vbiTH0TkG03h9pkdLP8z+sQrQT4EQ== X-Received: by 2002:a17:906:eec7:b0:a28:f0c6:5532 with SMTP id wu7-20020a170906eec700b00a28f0c65532mr348630ejb.107.1704540894681; Sat, 06 Jan 2024 03:34:54 -0800 (PST) Received: from mariano (dynamic-adsl-84-220-189-10.clienti.tiscali.it. [84.220.189.10]) by smtp.gmail.com with ESMTPSA id g16-20020a17090670d000b00a298c766585sm1242923ejk.57.2024.01.06.03.34.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 03:34:54 -0800 (PST) Received: by mariano (Postfix, from userid 1000) id 2A56FBFCDC; Sat, 6 Jan 2024 12:34:53 +0100 (CET) Date: Sat, 6 Jan 2024 12:34:53 +0100 From: Stefano Sabatini To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches References: <20240105164251.28935-1-anton@khirnov.net> <20240105164251.28935-5-anton@khirnov.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240105164251.28935-5-anton@khirnov.net> User-Agent: Mutt/2.1.4 (2021-12-11) Subject: Re: [FFmpeg-devel] [PATCH 5/8] fftools/ffmpeg_demux: only allocate the decoder when actually decoding 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: On date Friday 2024-01-05 17:42:48 +0100, Anton Khirnov wrote: > It is not needed otherwise. > --- > fftools/ffmpeg_demux.c | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c > index 892094c512..c51140b1c5 100644 > --- a/fftools/ffmpeg_demux.c > +++ b/fftools/ffmpeg_demux.c > @@ -782,6 +782,16 @@ static int ist_use(InputStream *ist, int decoding_needed) > if (decoding_needed && ds->sch_idx_dec < 0) { > int is_audio = ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO; > > + ist->dec_ctx = avcodec_alloc_context3(ist->dec); > + if (!ist->dec_ctx) > + return AVERROR(ENOMEM); > + > + ret = avcodec_parameters_to_context(ist->dec_ctx, ist->par); > + if (ret < 0) { > + av_log(ist, AV_LOG_ERROR, "Error initializing the decoder context.\n"); unrelated, here and below: might be useful to notify the failing stream identifier, assuming it is not already shown in the log > + return ret; > + } > + > ret = sch_add_dec(d->sch, decoder_thread, ist, d->loop && is_audio); > if (ret < 0) > return ret; > @@ -1215,23 +1225,13 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st) > default: av_assert0(0); > } > > - ist->dec_ctx = avcodec_alloc_context3(ist->dec); > - if (!ist->dec_ctx) > - return AVERROR(ENOMEM); > - > - ret = avcodec_parameters_to_context(ist->dec_ctx, par); > - if (ret < 0) { > - av_log(ist, AV_LOG_ERROR, "Error initializing the decoder context.\n"); > - return ret; > - } > - > ist->par = avcodec_parameters_alloc(); > if (!ist->par) > return AVERROR(ENOMEM); > > - ret = avcodec_parameters_from_context(ist->par, ist->dec_ctx); > + ret = avcodec_parameters_copy(ist->par, par); > if (ret < 0) { > - av_log(ist, AV_LOG_ERROR, "Error initializing the decoder context.\n"); > + av_log(ist, AV_LOG_ERROR, "Error exporting stream parameters.\n"); > return ret; > } LGTM anyway. _______________________________________________ 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".