From patchwork Mon Oct 2 19:50:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "pkv.stream" X-Patchwork-Id: 5387 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.61.8 with SMTP id n8csp1882674jan; Mon, 2 Oct 2017 12:51:02 -0700 (PDT) X-Received: by 10.28.14.144 with SMTP id 138mr11941475wmo.110.1506973862522; Mon, 02 Oct 2017 12:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506973862; cv=none; d=google.com; s=arc-20160816; b=VApAE3fumFapEin7SVI8MWZlP22E3sBM0eyRA1jl6II7BkwsIXNh9x0YMUyG0qpMDg b4LfNqRsaAIedZyxRAfh5EpfPbeGCofDcnnt5Gy1fDuWNYy79RsIS3+Z2ZSTx9fZrjEY I0JIGbYxL2lu4btUdwqpZeKo5Nj4igrWJnv2PWhl7Eo6k2wZx8GVjUUel2aCGXuufXxs c0VpUQheCio5NJFTYVJP/vPxT0Cse6B+YBw8a+JMDVznZmnHucJXC6IyxA4SJ0QLQSMl 2CrtzepnWz0MXVkHFXOHzxDuLXbOTVs7l8zXBehmaE1thtOjKtx+a5RnIt9VwHZCJN2Q etHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:dkim-signature:delivered-to :arc-authentication-results; bh=2aKU8tk7P9o3aADMWDHJsbcnW3kiq/14K2cFCPc9DJ4=; b=JUEmmR4S4+hYhZBmZOFymXQSSKmpE2/uYOq8Tcul/vJpQ+/CaaSUzWjGcdyETegiby Y64/0Gn9YQjOqdJZsZL/mM4WUaMDF1j/EBCuZFP7E3/5p0Jvzw8HJ+m3es6l5EaglORg B3cWyt+EduzlEPvEgEhGoGrPxsEwL8KeUmKMTm2EZ5MP/rHpVpug8OJ3YRniTxCne9wk 0gaTHybN4DcyX1gB5Mkz0if9P4/h0I4xf3nZqcrsSqwTYpT7mz0pDuYoc6ZwqehyksM3 HWJSEuLZfqKMMN89Z6J3qnpDVzRWytGC4OSZxLD4Y+NG/qKGtXNJPlc37sH/tMok1xlv MA7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=JpizsgY6; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y66si7788735wrc.542.2017.10.02.12.51.01; Mon, 02 Oct 2017 12:51:02 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=JpizsgY6; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 59871689FBB; Mon, 2 Oct 2017 22:50:46 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f50.google.com (mail-wm0-f50.google.com [74.125.82.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 485EF689F96 for ; Mon, 2 Oct 2017 22:50:40 +0300 (EEST) Received: by mail-wm0-f50.google.com with SMTP id f4so4649024wme.0 for ; Mon, 02 Oct 2017 12:50:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=mBKWGkO+pxXayOsmwx3hzV1IDMrjVKriLL+Bq131+t0=; b=JpizsgY6KoiIjbCU+KduWH07y1jjwbqFzTiwdaukptTPJPG1fAfZo5e9A5zTDecQON RhM1UoW9M00WDc+LGcGrXvO+2MvKrmiGvqEFwljK+4BlMsJXjjnk6/lVSek2s8m11Ge/ MXZ01YzP/IkqZaFkEj1b6IrkWddlovlLITAyJ+ai6F7y6DQzftbUGMa6zgymvkfn3xsF fRycqYzvYIWZz7Yjkd0k+U/ajDv4dUHgHNhlcDm+p97fL6KHu5VesXnTKOlSSAHP785q zhf1BAYe4QoxnrXZuOsU5N8JEyBArwWLrDL1T2FjTmVjuC6eIWl7PXoA/Iamw1BE6KaE 2alg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=mBKWGkO+pxXayOsmwx3hzV1IDMrjVKriLL+Bq131+t0=; b=Qrrceg0HGhfEdyB4Tpy6yRy1AFp8bZKdsA6YpGhevcjfPamqN97KbRZl5JnSmYYg4F XZ0klNJUv4+6JCBIdJt+YV2JPFVeSPlbCOnZjG39MviZMp9MZRccSEG3HnDoM/R5oOgY F8FJTKRxLO5LAh8MJbv6k8xeacIyIgc3KARfT7N+QjDCHcR+n05GD0p84LnFyLtDTkt+ 3ISRgMB7BIi+DcRwyxutl0HDa86zrdqeHRRHQ0mxE9x3MiLBhliYdyX/j4i1iDQBLDMu Rqy29vLltsyPkR94Hrt+b262MXs206wrdLnEmtviDDFUQOqCna7GIWVUiQytaWUt2Cfa /zFA== X-Gm-Message-State: AMCzsaUiqKZEVFUk96diEVywHGKk4LaUaTLfPEbb3NReYAYny9R3UrnP /iiLdeDE054JowbjcTHVudkXhA== X-Google-Smtp-Source: AOwi7QAYZS9UEJt/lW2WY9SlKwEH2dvkaX+lozIDRb3TSE/sLEaWbVdrHR53glQ+0Nfjro6xFc5Biw== X-Received: by 10.28.35.9 with SMTP id j9mr3224759wmj.109.1506973854254; Mon, 02 Oct 2017 12:50:54 -0700 (PDT) Received: from [192.168.0.2] ([176.159.7.188]) by smtp.googlemail.com with ESMTPSA id r123sm2021908wmf.12.2017.10.02.12.50.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 12:50:52 -0700 (PDT) To: ffmpeg-devel@ffmpeg.org References: <8058ec17-1a5c-62e3-f07b-d3fabe18f8ed@gmail.com> <20171002193537.GU30840@nb4> From: "pkv.stream" Message-ID: <55b601f7-541e-e83c-366b-cf9b881770bd@gmail.com> Date: Mon, 2 Oct 2017 21:50:50 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171002193537.GU30840@nb4> Content-Language: fr X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: Re: [FFmpeg-devel] [DEVEL][PATCH] ffmpeg: fix channel_layout bug on non-default layout X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Thanks Michael; replaced the offending MSVC function. Le 02/10/2017 à 9:35 PM, Michael Niedermayer a écrit : > On Sun, Oct 01, 2017 at 03:17:30AM +0200, pkv.stream wrote: >> Hello >> >> the submitted patch addresses the regression discussed in ticket #6706. >> >> >> >> The -channel_layout option is not working when the channel layout is not >> a default one (ex: for 4 channels, quad is interpreted as 4.0 which is >> the default layout for 4 channels; or octagonal interpreted as 7.1). >> This leads to the spurious auto-insertion of an auto-resampler filter >> remapping the channels even if input and output have identical channel >> layouts. >> >> Thanks for any comments. > fails build: > > fftools/ffmpeg_opt.c:1810:13: error: implicit declaration of function ‘_strtoui64’ [-Werror=implicit-function-declaration] > ost->enc_ctx->channel_layout = _strtoui64(output_layout->value, NULL, 10); > > > [...] > > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel From 5a51fc45da691feed05a67ec72a8ee581a2444b3 Mon Sep 17 00:00:00 2001 From: pkviet Date: Mon, 2 Oct 2017 11:14:31 +0200 Subject: [PATCH] ffmpeg: fix channel_layout bug on non-default layout Fix for ticket 6706. The -channel_layout option was not working when the channel layout was not a default one (ex: for 4 channels, quad was interpreted as 4.0 which is the default layout for 4 channels; or octagonal interpreted as 7.1). This led to the spurious auto-insertion of an auto-resampler filter remapping the channels even if input and output had identical channel layouts. The fix operates by directly calling the channel layout if defined in options. If the layout is undefined, the default layout is selected as before the fix. --- ffmpeg_opt.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 100fa76..9dfef50 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1800,11 +1800,16 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in MATCH_PER_STREAM_OPT(filters, str, ost->filters, oc, st); if (!ost->stream_copy) { - char *sample_fmt = NULL; + + char *sample_fmt = NULL; MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st); - MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st); + AVDictionaryEntry *output_layout = av_dict_get(o->g->codec_opts, "channel_layout",NULL, AV_DICT_MATCH_CASE); + if (output_layout) + ost->enc_ctx->channel_layout = strtoull(output_layout->value, NULL, 10); + + MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st); if (sample_fmt && (audio_enc->sample_fmt = av_get_sample_fmt(sample_fmt)) == AV_SAMPLE_FMT_NONE) { av_log(NULL, AV_LOG_FATAL, "Invalid sample format '%s'\n", sample_fmt); @@ -2524,7 +2529,10 @@ loop_end: (count + 1) * sizeof(*f->sample_rates)); } if (ost->enc_ctx->channels) { - f->channel_layout = av_get_default_channel_layout(ost->enc_ctx->channels); + if (ost->enc_ctx->channel_layout) + f->channel_layout = ost->enc_ctx->channel_layout; + else + f->channel_layout = av_get_default_channel_layout(ost->enc_ctx->channels); } else if (ost->enc->channel_layouts) { count = 0; while (ost->enc->channel_layouts[count])