]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cavsdec.c
aacdec: reset max_sfb on invalid data.
[ffmpeg] / libavcodec / cavsdec.c
index 2bf968ba2260ee2ba8da3ebed7972ac0092ff116..6e5539c2d7ff1408eafe2eff0229b521a711bc36 100644 (file)
@@ -470,7 +470,7 @@ static int decode_pic(AVSContext *h) {
 
     if (!s->context_initialized) {
         s->avctx->idct_algo = FF_IDCT_CAVS;
-        if (MPV_common_init(s) < 0)
+        if (ff_MPV_common_init(s) < 0)
             return -1;
         ff_init_scantable(s->dsp.idct_permutation,&h->scantable,ff_zigzag_direct);
     }
@@ -491,7 +491,7 @@ static int decode_pic(AVSContext *h) {
             skip_bits(&s->gb,24);//time_code
         /* old sample clips were all progressive and no low_delay,
            bump stream revision if detected otherwise */
-        if((s->low_delay) || !(show_bits(&s->gb,9) & 1))
+        if (s->low_delay || !(show_bits(&s->gb,9) & 1))
             h->stream_revision = 1;
         /* similarly test top_field_first and repeat_first_field */
         else if(show_bits(&s->gb,11) & 3)
@@ -501,9 +501,9 @@ static int decode_pic(AVSContext *h) {
     }
     /* release last B frame */
     if(h->picture.f.data[0])
-        s->avctx->release_buffer(s->avctx, (AVFrame *)&h->picture);
+        s->avctx->release_buffer(s->avctx, &h->picture.f);
 
-    s->avctx->get_buffer(s->avctx, (AVFrame *)&h->picture);
+    s->avctx->get_buffer(s->avctx, &h->picture.f);
     ff_cavs_init_pic(h);
     h->picture.poc = get_bits(&s->gb,8)*2;
 
@@ -592,7 +592,7 @@ static int decode_pic(AVSContext *h) {
     }
     if(h->pic_type != AV_PICTURE_TYPE_B) {
         if(h->DPB[1].f.data[0])
-            s->avctx->release_buffer(s->avctx, (AVFrame *)&h->DPB[1]);
+            s->avctx->release_buffer(s->avctx, &h->DPB[1].f);
         h->DPB[1] = h->DPB[0];
         h->DPB[0] = h->picture;
         memset(&h->picture,0,sizeof(Picture));
@@ -656,7 +656,8 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
     if (buf_size == 0) {
         if (!s->low_delay && h->DPB[0].f.data[0]) {
             *data_size = sizeof(AVPicture);
-            *picture = *(AVFrame *) &h->DPB[0];
+            *picture = h->DPB[0].f;
+            memset(&h->DPB[0], 0, sizeof(h->DPB[0]));
         }
         return 0;
     }
@@ -676,9 +677,9 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
         case PIC_I_START_CODE:
             if(!h->got_keyframe) {
                 if(h->DPB[0].f.data[0])
-                    avctx->release_buffer(avctx, (AVFrame *)&h->DPB[0]);
+                    avctx->release_buffer(avctx, &h->DPB[0].f);
                 if(h->DPB[1].f.data[0])
-                    avctx->release_buffer(avctx, (AVFrame *)&h->DPB[1]);
+                    avctx->release_buffer(avctx, &h->DPB[1].f);
                 h->got_keyframe = 1;
             }
         case PIC_PB_START_CODE:
@@ -692,12 +693,12 @@ static int cavs_decode_frame(AVCodecContext * avctx,void *data, int *data_size,
             *data_size = sizeof(AVPicture);
             if(h->pic_type != AV_PICTURE_TYPE_B) {
                 if(h->DPB[1].f.data[0]) {
-                    *picture = *(AVFrame *) &h->DPB[1];
+                    *picture = h->DPB[1].f;
                 } else {
                     *data_size = 0;
                 }
             } else
-                *picture = *(AVFrame *) &h->picture;
+                *picture = h->picture.f;
             break;
         case EXT_START_CODE:
             //mpeg_decode_extension(avctx,buf_ptr, input_size);