]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/dnxhddec.c
avcodec: Constify AVCodecs
[ffmpeg] / libavcodec / dnxhddec.c
index e5d01e2e71e577484cfbd65f82caf0f33e8783bc..b9e07a85626464852624f9129e231dc4d9e225cf 100644 (file)
@@ -25,6 +25,8 @@
  */
 
 #include "libavutil/imgutils.h"
+#include "libavutil/mem_internal.h"
+
 #include "avcodec.h"
 #include "blockdsp.h"
 #define  UNCHECKED_BITSTREAM_READER 1
@@ -111,18 +113,19 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
 static int dnxhd_init_vlc(DNXHDContext *ctx, uint32_t cid, int bitdepth)
 {
     if (cid != ctx->cid) {
-        int index;
+        const CIDEntry *cid_table = ff_dnxhd_get_cid_table(cid);
 
-        if ((index = ff_dnxhd_get_cid_table(cid)) < 0) {
+        if (!cid_table) {
             av_log(ctx->avctx, AV_LOG_ERROR, "unsupported cid %"PRIu32"\n", cid);
             return AVERROR(ENOSYS);
         }
-        if (ff_dnxhd_cid_table[index].bit_depth != bitdepth &&
-            ff_dnxhd_cid_table[index].bit_depth != DNXHD_VARIABLE) {
-            av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n", ff_dnxhd_cid_table[index].bit_depth, bitdepth);
+        if (cid_table->bit_depth != bitdepth &&
+            cid_table->bit_depth != DNXHD_VARIABLE) {
+            av_log(ctx->avctx, AV_LOG_ERROR, "bit depth mismatches %d %d\n",
+                   cid_table->bit_depth, bitdepth);
             return AVERROR_INVALIDDATA;
         }
-        ctx->cid_table = &ff_dnxhd_cid_table[index];
+        ctx->cid_table = cid_table;
         av_log(ctx->avctx, AV_LOG_VERBOSE, "Profile cid %"PRIu32".\n", cid);
 
         ff_free_vlc(&ctx->ac_vlc);
@@ -714,7 +717,7 @@ static av_cold int dnxhd_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec ff_dnxhd_decoder = {
+const AVCodec ff_dnxhd_decoder = {
     .name           = "dnxhd",
     .long_name      = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
     .type           = AVMEDIA_TYPE_VIDEO,