]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mlpdec.c
avcodec: Constify AVCodecs
[ffmpeg] / libavcodec / mlpdec.c
index ec346868c6f6cd7903c9f8fba0fb8de05998a404..e4992550eea8ef9d07d6fb1c66d1edcc0c75fa5d 100644 (file)
@@ -30,6 +30,7 @@
 #include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "libavutil/channel_layout.h"
+#include "libavutil/mem_internal.h"
 #include "libavutil/thread.h"
 #include "get_bits.h"
 #include "internal.h"
@@ -206,15 +207,14 @@ static VLC huff_vlc[3];
 
 static av_cold void init_static(void)
 {
-        INIT_VLC_STATIC(&huff_vlc[0], VLC_BITS, 18,
-                    &ff_mlp_huffman_tables[0][0][1], 2, 1,
-                    &ff_mlp_huffman_tables[0][0][0], 2, 1, VLC_STATIC_SIZE);
-        INIT_VLC_STATIC(&huff_vlc[1], VLC_BITS, 16,
-                    &ff_mlp_huffman_tables[1][0][1], 2, 1,
-                    &ff_mlp_huffman_tables[1][0][0], 2, 1, VLC_STATIC_SIZE);
-        INIT_VLC_STATIC(&huff_vlc[2], VLC_BITS, 15,
-                    &ff_mlp_huffman_tables[2][0][1], 2, 1,
-                    &ff_mlp_huffman_tables[2][0][0], 2, 1, VLC_STATIC_SIZE);
+    for (int i = 0; i < 3; i++) {
+        static VLC_TYPE vlc_buf[3 * VLC_STATIC_SIZE][2];
+        huff_vlc[i].table           = &vlc_buf[i * VLC_STATIC_SIZE];
+        huff_vlc[i].table_allocated = VLC_STATIC_SIZE;
+        init_vlc(&huff_vlc[i], VLC_BITS, 18,
+                 &ff_mlp_huffman_tables[i][0][1], 2, 1,
+                 &ff_mlp_huffman_tables[i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);
+    }
 
     ff_mlp_init_crc();
 }
@@ -1331,7 +1331,7 @@ error:
 }
 
 #if CONFIG_MLP_DECODER
-AVCodec ff_mlp_decoder = {
+const AVCodec ff_mlp_decoder = {
     .name           = "mlp",
     .long_name      = NULL_IF_CONFIG_SMALL("MLP (Meridian Lossless Packing)"),
     .type           = AVMEDIA_TYPE_AUDIO,
@@ -1339,12 +1339,12 @@ AVCodec ff_mlp_decoder = {
     .priv_data_size = sizeof(MLPDecodeContext),
     .init           = mlp_decode_init,
     .decode         = read_access_unit,
-    .capabilities   = AV_CODEC_CAP_DR1,
+    .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
 #endif
 #if CONFIG_TRUEHD_DECODER
-AVCodec ff_truehd_decoder = {
+const AVCodec ff_truehd_decoder = {
     .name           = "truehd",
     .long_name      = NULL_IF_CONFIG_SMALL("TrueHD"),
     .type           = AVMEDIA_TYPE_AUDIO,
@@ -1352,7 +1352,7 @@ AVCodec ff_truehd_decoder = {
     .priv_data_size = sizeof(MLPDecodeContext),
     .init           = mlp_decode_init,
     .decode         = read_access_unit,
-    .capabilities   = AV_CODEC_CAP_DR1,
+    .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
 #endif /* CONFIG_TRUEHD_DECODER */