diff mbox series

[FFmpeg-devel,2/7] avformat/mov_chan: simplify channel layout canonicalization

Message ID 20240309215414.26699-2-cus@passwd.hu
State Accepted
Commit 26e0454cad5312eb8475ce4829a9091bc846db83
Headers show
Series [FFmpeg-devel,1/7] avutil/channel_layout: add AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marton Balint March 9, 2024, 9:54 p.m. UTC
Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavformat/mov_chan.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
diff mbox series

Patch

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);