[FFmpeg-cvslog] avcodec/wavpackenc: add support for encoding unspec channel layouts

Paul B Mahol git at videolan.org
Tue Aug 15 01:33:43 EEST 2023


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Aug 15 00:27:40 2023 +0200| [a3b434e1515ecb0de0c4b92c6b7659e510b980c2] | committer: Paul B Mahol

avcodec/wavpackenc: add support for encoding unspec channel layouts

Also write 0 for chmask if mask have bits outside of first 32 bits,
as wavpack does not support more bits than 32 for channel layouts.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a3b434e1515ecb0de0c4b92c6b7659e510b980c2
---

 libavcodec/wavpackenc.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/wavpackenc.c b/libavcodec/wavpackenc.c
index 9271e87990..33a5dfcc89 100644
--- a/libavcodec/wavpackenc.c
+++ b/libavcodec/wavpackenc.c
@@ -2592,7 +2592,16 @@ static int wavpack_encode_block(WavPackEncodeContext *s,
         s->avctx->ch_layout.u.mask != AV_CH_LAYOUT_STEREO) {
         put_metadata_block(&pb, WP_ID_CHANINFO, 5);
         bytestream2_put_byte(&pb, s->avctx->ch_layout.nb_channels);
-        bytestream2_put_le32(&pb, s->avctx->ch_layout.u.mask);
+        if (s->avctx->ch_layout.u.mask >> 32)
+            bytestream2_put_le32(&pb, 0);
+        else
+            bytestream2_put_le32(&pb, s->avctx->ch_layout.u.mask);
+        bytestream2_put_byte(&pb, 0);
+    } else if (s->flags & WV_INITIAL_BLOCK &&
+               s->avctx->ch_layout.order == AV_CHANNEL_ORDER_UNSPEC) {
+        put_metadata_block(&pb, WP_ID_CHANINFO, 5);
+        bytestream2_put_byte(&pb, s->avctx->ch_layout.nb_channels);
+        bytestream2_put_le32(&pb, 0);
         bytestream2_put_byte(&pb, 0);
     }
 



More information about the ffmpeg-cvslog mailing list