From patchwork Wed Oct 4 22:37:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "pkv.stream" X-Patchwork-Id: 5417 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.76 with SMTP id m12csp1369325jah; Wed, 4 Oct 2017 15:37:23 -0700 (PDT) X-Received: by 10.223.151.9 with SMTP id r9mr10469187wrb.238.1507156642906; Wed, 04 Oct 2017 15:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507156642; cv=none; d=google.com; s=arc-20160816; b=T0sOMa223pg5CBhuquSKmkwkb+20knFlJ8k38KTnZvZsL3oMGiupLjLowep8dODgYP kU2x6Sf7W2gmGY+z0GJ2vzDKiymoX1Ey56QbMNVYRWpd6EGL/GT/ywE23KUK0FAi2oAr bMZZX9oiOUXl4xeL6rEF9v+OEdYqjDfihnKdemk3Za/r6kCRd1vrNrgjoQz+qxiArkOv g8LVff+O5fTeGeKfE+Tw8p1aO+5EDWgwOVhKrlfA2vFeYyVfLDl0XD4Nz2dOR9kzbQ4H 5B0fYG2tKNAnKtvfZOP5Xibf4okmyRIj4guz7l9tJ1tRWNbqeVadlhN6/8vatI2DR6jp uwxw== 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=4pO8vT7YoEPADFWqNGVT1wu9TO0CP47Z506ctV6nhQc=; b=zLAJ9uiPVdRIyvr/Kg1WAajplCc9GoIQbo1E0Z/5p9YvaJOIt8E7UlzWTx5h5TErH4 HTy95v42q3Tzb69+bW730WkaV2cRfofauQbZu35C8AWmEg1NfGgWsubEChnWGrfg6jlG lg32kATwQ/5lsqk5WikF+4hAbK+RF4+fyy9gWKCo0xX8hPnvF7gA1CpnIy+UQEGlcRsD 5YBfwBiIUBk0o0SedaSQyl8TZuMR3uu0doNvisV7Zr1PMAAAsp626saBkTRf+HzpP7gF Q9lnAW7u7qO4Gyh0LlIpo0wC4jYmJPcboT4LB9dooEz9hc2lsdyQCDf9QJV2axykT667 41sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=nD68Y88G; 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 q205si12423532wme.150.2017.10.04.15.37.22; Wed, 04 Oct 2017 15:37:22 -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=nD68Y88G; 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 06D6468A3C0; Thu, 5 Oct 2017 01:37:06 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com [74.125.82.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 368BC68A3A4 for ; Thu, 5 Oct 2017 01:37:00 +0300 (EEST) Received: by mail-wm0-f51.google.com with SMTP id b189so21585807wmd.4 for ; Wed, 04 Oct 2017 15:37:15 -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=Pf+gMX5gfHp8DzKT/R+YBi/MWAvk0lotGzT9FQtYclA=; b=nD68Y88GKEqjAz0cjajD+RiKOh3D18qm09XT+xLoTZsoM8CMrzkRQfbM+fXY2h5Qom EWoUpQgX8wBvFZ00+frNd0dnc2pnx7e86k+NXovL8MgNe/Cfqf4m6Lh+Aws2MuK7eYBn UPo8znKFANMKfoakvSUpHzWsMW9mWgzrUTZCeb8TEgiFGATTHANDasrOPLyRJnV5Da3h oblkCjGZ4+rbdoE+LmnhXT8sRavGtR6+INcBS67i+BCtxbddoFRTSKUxkUEXlb5lu6QN klWbHkwh5vCCHK79PV1qcB/gRUA7WjXB+3us/REy/C0fCN8shep+capgTGSuNmhoTBEa 1gEg== 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=Pf+gMX5gfHp8DzKT/R+YBi/MWAvk0lotGzT9FQtYclA=; b=t9BEcDzU8y5xqAPksbotqAGhTFQfzNs91ULw0jEdpvipBPfROCxntNinIjrLPswFB1 fzIO1wTH4sGlkqg6dQVeeAjontat42eRsOlMa5FBaamoevUlKYWYdfQ9j73y/xILtrx0 7ShRrj3w6dwy+WEOnqD2yk5Ym0sOCxz+LJs22mDyiV84WEQAS2M+gQts73PYOmlGVf+2 mf6amRM0M1A492FDgSIWTaOIyAHLqGScIuv1m+XvdsO3br2wWkU3BmUStUt5TyLNum2a oZRQrQ/Ot3E/i/J9SI7aRz+VkvqeG0lirC9g65cPCcZdt+tlhCuZVhj1aCxNrcW9xfcZ R7cw== X-Gm-Message-State: AHPjjUhifNwk1uTclKJUiwePf+RFY2SnbGkcZvnA4ewFRirIzMJNVg5f Abxg8RI80z9ScK14Z+aMuEaDcw== X-Google-Smtp-Source: AOwi7QBDwU7MEXVQgmcT8TOAHTjSsbjXi5TnNgQSIpYMnwxRmaLgs9jUBurEJCzMZTL4pTbbq5fwZQ== X-Received: by 10.80.145.40 with SMTP id e37mr30018511eda.245.1507156635000; Wed, 04 Oct 2017 15:37:15 -0700 (PDT) Received: from [192.168.0.2] ([176.159.7.188]) by smtp.googlemail.com with ESMTPSA id i6sm12471575edk.3.2017.10.04.15.37.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 15:37:14 -0700 (PDT) To: ffmpeg-devel@ffmpeg.org References: <8058ec17-1a5c-62e3-f07b-d3fabe18f8ed@gmail.com> <20171002193537.GU30840@nb4> <55b601f7-541e-e83c-366b-cf9b881770bd@gmail.com> <20171004211840.GB24666@sunshine.barsnick.net> From: "pkv.stream" Message-ID: <31846c44-6a8b-887a-8cfa-9a4e7fa07302@gmail.com> Date: Thu, 5 Oct 2017 00:37:13 +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: <20171004211840.GB24666@sunshine.barsnick.net> Content-Language: fr 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" Le 04/10/2017 à 11:18 PM, Moritz Barsnick a écrit : > On Mon, Oct 02, 2017 at 21:50:50 +0200, pkv.stream wrote: >> if (!ost->stream_copy) { >> - char *sample_fmt = NULL; >> + >> + char *sample_fmt = NULL; >> > This is very obviously a patch which will not be accepted. > > >> - 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); > Your indentation is totally wrong, and makes use of tabs. Please follow > the ffmpeg style. styling fixed thanks for your input From 4ec55dc88923108132307b41300a1abddf32e6f7 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 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c index 100fa76..cf5a63c 100644 --- a/ffmpeg_opt.c +++ b/ffmpeg_opt.c @@ -1804,6 +1804,12 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, 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) { @@ -2524,7 +2530,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])