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 1729344A01 for ; Mon, 31 Oct 2022 19:40:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 804B368BDFC; Mon, 31 Oct 2022 21:40:25 +0200 (EET) Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 13F9768BC9B for ; Mon, 31 Oct 2022 21:40:20 +0200 (EET) Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-13b103a3e5dso14595488fac.2 for ; Mon, 31 Oct 2022 12:40:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=wEZzcxX9tPpZR5usmL/Tf3KBfyzLFZZnlJS4tQxsmtI=; b=VI17YMKQjIAmz58snpvZuQZUWyClUWKPV939VxtkCLm9b+wVlWvYhHCFw+LsaIm1Fy 7UV/HiwWtd97n2ZCkPv+CiHiYdtXo2DvR1pfENuvmJCifT6f4I2x8EClKIUou//GEqD4 lgR/SopcVPCjHYwG9yYT7s4f9C8nw/XblX80d/pvEE6SrGcSot8d66qsTbu9qUzeb9o7 oGRgNJyceiH+KFUjjpvDmgBf1yToBQ2nBGSpB43sSVneae6Y/awfl0EsgMhhUR4fga7D 7Y0muEAK9hd8xS62d3n9sEVad4jx9k5pczwFUqWBi1UkUTJA5fPyviqK76WlI7BtGM/M //Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wEZzcxX9tPpZR5usmL/Tf3KBfyzLFZZnlJS4tQxsmtI=; b=SnJdmkh2PqXCdDKDzou94D7fera0RthnCeg0C+ETJ2ZCN1Lw7PHoN3e315RXncBIId p0WO/3jvY0jMlu3bZyRNegZ+jOD2Gdgp87INAh26ogoqFbqVau5HTczNDYEU/FzquJvH TuuXmieoiSofiGoIDq2auD6vjHULlIXQYnc2YC58HFhpHpXDy77Fof/RXhDwoiIFI4O2 yzMjyIKI4dHGmC7HQEerp6Uf+Blk/R7vTnTlthGz846yG9ROpdt40g8yd1uFH4Uv7Pc5 ZXIBculys04S751B9dIhSqA1+AXrVYz+8KlvSbLcim6uLckJz10Tsg5z9QFqVTzt1N59 LoJQ== X-Gm-Message-State: ACrzQf2NY4Iz/5Xf3FaKEUTIN2enLG8dh9tdeh2Vfmyo0PnJ0vh+tvzH O3CSkBx+H5CJyq7U+t3a/gxlkaxQstQ= X-Google-Smtp-Source: AMsMyM64BAt1zzMSioP5Klk6evhNLBZv+VCpbqkUMXKe4rz1C++J2UdFCN6Je9sDGyAeZ+XhBp9cjA== X-Received: by 2002:a05:6870:f201:b0:13b:2f1f:865b with SMTP id t1-20020a056870f20100b0013b2f1f865bmr18682872oao.205.1667245218177; Mon, 31 Oct 2022 12:40:18 -0700 (PDT) Received: from [192.168.0.13] ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id fo13-20020a0568709a0d00b00136f3e4bc29sm3488473oab.9.2022.10.31.12.40.16 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 Oct 2022 12:40:17 -0700 (PDT) Message-ID: <7b8834a4-14f7-0fc4-7be8-0d1742743e84@gmail.com> Date: Mon, 31 Oct 2022 16:40:16 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 To: ffmpeg-devel@ffmpeg.org References: Content-Language: en-US From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] avfilter/src_movie: support unknown channel layouts 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 10/31/2022 9:15 AM, Andreas Rheinhardt wrote: > Paul B Mahol: >> - av_log(log_ctx, AV_LOG_ERROR, >> + char *cl_name; >> + >> + av_log(log_ctx, AV_LOG_WARNING, >> "Channel layout is not set in stream %d, and could not " >> "be guessed from the number of channels (%d)\n", >> st_index, dec_par->ch_layout.nb_channels); >> - return AVERROR(EINVAL); >> + cl_name = av_asprintf("%dC", dec_par->ch_layout.nb_channels); >> + av_channel_layout_from_string(&chl, cl_name); >> + free(cl_name); > > 1. Wrong deallocator. > 2. The allocation is completely unnecessary: One can just use snprintf > with a big enough (yet still small) buffer. > 3. But even that is unnecessary: Just set chl = (AVChannelLayout){ > .order = AV_CHANNEL_ORDER_UNSPEC, .nb_channels = > dec_par->ch_layout.nb_channels }. He doesn't even need to do that because it's already set. av_channel_layout_default() will give set the output layout as an UNSPEC one with nb_channels amount of channels if it can't find a named native layout for it. There is however a problem with this patch as is, and it's the next printed warning now that he removed the return. After this change it will mention a layout was guessed when one wasn't. So this patch should simply change the "return AVERROR(EINVAL)" into another "return av_channel_layout_copy(&dec_par->ch_layout, &chl);" _______________________________________________ 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".