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 B63884B320 for ; Mon, 3 Jun 2024 21:49:04 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0961E68D689; Tue, 4 Jun 2024 00:49:02 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3C99D68CC90 for ; Tue, 4 Jun 2024 00:48:55 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 0EE59EA428; Mon, 3 Jun 2024 23:48:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9pzn_dIBbMRk; Mon, 3 Jun 2024 23:48:53 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 7FFB4EA35A; Mon, 3 Jun 2024 23:48:53 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Mon, 3 Jun 2024 23:48:47 +0200 Message-Id: <20240603214847.19205-1-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] fftools/ffmpeg_demux: gracefully ignore mismatching channel layouts for -channel_layout option 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 Cc: Marton Balint 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: The very old behaviour of -channel_layout was to simply warn the user about channel layouts which does not have a matching channel count, and ignore them, instead of reporting an error. The recent fix re-added support for overriding -channel_layout, but it rejected mismatching layouts. There is no easy way for the user to specify a channel layout only for streams with matching number of channels, so this patch restores the very old behaviour of ignoring mismatching layouts. See the discussion in ticket #11016. Signed-off-by: Marton Balint --- fftools/ffmpeg_demux.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 1ca8d804ae..2e77210237 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -1399,13 +1399,14 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st) av_channel_layout_uninit(&par->ch_layout); par->ch_layout = ch_layout; } else { - av_log(ist, AV_LOG_ERROR, - "Specified channel layout '%s' has %d channels, but input has %d channels.\n", + av_log(ist, AV_LOG_WARNING, + "Specified channel layout '%s' has %d channels, but input has %d channels. Ignoring specified layout.\n", ch_layout_str, ch_layout.nb_channels, par->ch_layout.nb_channels); av_channel_layout_uninit(&ch_layout); - return AVERROR(EINVAL); + ch_layout_str = NULL; } - } else { + } + if (!ch_layout_str) { int guess_layout_max = INT_MAX; MATCH_PER_STREAM_OPT(guess_layout_max, i, guess_layout_max, ic, st); guess_input_channel_layout(ist, par, guess_layout_max); -- 2.35.3 _______________________________________________ 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".