From patchwork Sat Mar 9 21:54:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 46922 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:dc95:b0:1a1:738b:6bc0 with SMTP id ky21csp442217pzb; Sat, 9 Mar 2024 13:54:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV2kZYsAjL0On95vr15KlTnVvAqwqYSM6vT/5l3qCQCFu4XDQGhm+5EQOiksGbzpnNmrloOulHU3KAeiV5Ve84PZYWe2YQh8qDkFg== X-Google-Smtp-Source: AGHT+IEtRZl5HtzyqHI6J+wuyq3bbDSTUBpH4TohF/cVyqYr/m0lHO3alfPxC/kKCUuZxVrvswW4 X-Received: by 2002:a50:cd98:0:b0:568:171:f82a with SMTP id p24-20020a50cd98000000b005680171f82amr1792182edi.20.1710021291755; Sat, 09 Mar 2024 13:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1710021291; cv=none; d=google.com; s=arc-20160816; b=jeI7X2oYWpKn609GHM9riStRYUTb8mow5Ae/L44N971CBdEydcTKr3r22IHirgBH0B JCqArO6m8c6jQvmBzdlBb5RdwD2+FSnqbHzkFxW4SMBj1cAMRNR0Th7vdstJiJqqCqXX tq/+k/7V0ZbruhWM8G2yh/0q14PBF4+b+KSDUtJPJqKsyNOs1LZ/lbD/UsoBja6ceXXy gP453LdlWXdLHs+iVR796FGiIhkK03+P5iaUdQTxKuvRpgxGyrbRljEO6z8gGVdj1+Sf RvJhwZuFNtXedcWX7VJ/O8QhOPhgocI5Pn4VJrtLQzOXnYllggyVTh3WErnF7NzufC6k o9TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=6smUzRTvVNb34yJhjPzeo5ep7IuEXn0tyU8JDgaFOVc=; fh=s+G8Ss4JbeMFkWPSp2LmIH/LXFyBlALRiww1j3FPjHY=; b=NclBM/pEMoLly0yxBI4zfJTWRPn9X1bo2C5ytv2xJOUL7Gj2lsoO84c8VQrHYV2CC/ rc4R/SO1kHU39KGGYMzlbVY0MD8eCf8a1QG0skqpR6/o2aM+8jR9PXP/BOmrrXBh5V2f az2RfojRKWM+S2Sbr9wQiJIdI/cgOyppSh77y2Zr/qV0a68RCcxCw9P+XCK+Bj788t4d NepB1y7RCQ4s9Clw4dRxUDT0fmuFR7/P+oDOMvkufR+mynkbmiaaXE6e2koIAKmTYdxM kKyFP+hhL3XMx3UjLxTOBCoNumM+LngZ1mPdYO6Nc92Y/N5uzeQnUYHEYsvVWwz5Nn+G zquQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q4-20020a056402032400b00566dedfb08dsi1062562edw.582.2024.03.09.13.54.51; Sat, 09 Mar 2024 13:54:51 -0800 (PST) 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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id EB20068CD3F; Sat, 9 Mar 2024 23:54:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0CBC168C82F for ; Sat, 9 Mar 2024 23:54:34 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id D9F3AE8EA0; Sat, 9 Mar 2024 22:54:33 +0100 (CET) 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 0HPyJjojNg8X; Sat, 9 Mar 2024 22:54:32 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 3E7F0E98EB; Sat, 9 Mar 2024 22:54:32 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 9 Mar 2024 22:54:09 +0100 Message-Id: <20240309215414.26699-2-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240309215414.26699-1-cus@passwd.hu> References: <20240309215414.26699-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/7] avformat/mov_chan: simplify channel layout canonicalization 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: oKuQmyj2H6sQ Signed-off-by: Marton Balint --- libavformat/mov_chan.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 3e186b0837..ead3a9b91b 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -543,10 +543,8 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, ch_layout->u.map[i].id = mov_get_channel_id(label); } - ret = av_channel_layout_retype(ch_layout, AV_CHANNEL_ORDER_NATIVE, AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS); - if (ret == AVERROR(ENOSYS)) - ret = av_channel_layout_retype(ch_layout, AV_CHANNEL_ORDER_UNSPEC, AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS); - if (ret < 0 && ret != AVERROR(ENOSYS)) + ret = av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL); + if (ret < 0) goto out; } else { uint64_t mask = mov_get_channel_layout(layout_tag, bitmap); @@ -843,10 +841,8 @@ int ff_mov_read_chnl(AVFormatContext *s, AVIOContext *pb, AVStream *st) ch_layout->u.map[i].id = channel; } - ret = av_channel_layout_retype(ch_layout, AV_CHANNEL_ORDER_NATIVE, AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS); - if (ret == AVERROR(ENOSYS)) - ret = av_channel_layout_retype(ch_layout, AV_CHANNEL_ORDER_UNSPEC, AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS); - if (ret < 0 && ret != AVERROR(ENOSYS)) + ret = av_channel_layout_retype(ch_layout, 0, AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL); + if (ret < 0) return ret; } else { uint64_t omitted_channel_map = avio_rb64(pb);