]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mss2.c
avcodec: Constify AVCodecs
[ffmpeg] / libavcodec / mss2.c
index 3180af1d607bde5352605a152f17722bff09bdc5..d7a19f6ad2497929bb5dd5987da67e6d550cf3e1 100644 (file)
@@ -152,6 +152,7 @@ static void arith2_init(ArithCoder *c, GetByteContext *gB)
     c->low           = 0;
     c->high          = 0xFFFFFF;
     c->value         = bytestream2_get_be24(gB);
+    c->overread      = 0;
     c->gbc.gB        = gB;
     c->get_model_sym = arith2_get_model_sym;
     c->get_number    = arith2_get_number;
@@ -174,7 +175,7 @@ static int decode_pal_v2(MSS12Context *ctx, const uint8_t *buf, int buf_size)
     return 1 + ncol * 3;
 }
 
-static int decode_555(GetByteContext *gB, uint16_t *dst, ptrdiff_t stride,
+static int decode_555(AVCodecContext *avctx, GetByteContext *gB, uint16_t *dst, ptrdiff_t stride,
                       int keyframe, int w, int h)
 {
     int last_symbol = 0, repeat = 0, prev_avail = 0;
@@ -212,7 +213,7 @@ static int decode_555(GetByteContext *gB, uint16_t *dst, ptrdiff_t stride,
                     repeat = 0;
                     while (b-- > 130) {
                         if (repeat >= (INT_MAX >> 8) - 1) {
-                            av_log(NULL, AV_LOG_ERROR, "repeat overflow\n");
+                            av_log(avctx, AV_LOG_ERROR, "repeat overflow\n");
                             return AVERROR_INVALIDDATA;
                         }
                         repeat = (repeat << 8) + bytestream2_get_byte(gB) + 1;
@@ -411,8 +412,6 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size,
 
     ff_mpeg_er_frame_start(s);
 
-    v->bits = buf_size * 8;
-
     v->end_mb_x = (w + 15) >> 4;
     s->end_mb_y = (h + 15) >> 4;
     if (v->respic & 1)
@@ -617,7 +616,7 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
             return AVERROR_INVALIDDATA;
         }
     } else {
-        if ((ret = ff_reget_buffer(avctx, ctx->last_pic)) < 0)
+        if ((ret = ff_reget_buffer(avctx, ctx->last_pic, 0)) < 0)
             return ret;
         if ((ret = av_frame_ref(frame, ctx->last_pic)) < 0)
             return ret;
@@ -634,7 +633,7 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     if (is_555) {
         bytestream2_init(&gB, buf, buf_size);
 
-        if (decode_555(&gB, (uint16_t *)c->rgb_pic, c->rgb_stride >> 1,
+        if (decode_555(avctx, &gB, (uint16_t *)c->rgb_pic, c->rgb_stride >> 1,
                        keyframe, avctx->width, avctx->height))
             return AVERROR_INVALIDDATA;
 
@@ -752,9 +751,7 @@ static av_cold int wmv9_init(AVCodecContext *avctx)
 
     v->s.avctx    = avctx;
 
-    if ((ret = ff_vc1_init_common(v)) < 0)
-        return ret;
-    ff_vc1dsp_init(&v->vc1dsp);
+    ff_vc1_init_common(v);
 
     v->profile = PROFILE_MAIN;
 
@@ -848,7 +845,7 @@ static av_cold int mss2_decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec ff_mss2_decoder = {
+const AVCodec ff_mss2_decoder = {
     .name           = "mss2",
     .long_name      = NULL_IF_CONFIG_SMALL("MS Windows Media Video V9 Screen"),
     .type           = AVMEDIA_TYPE_VIDEO,