[FFmpeg-soc] [soc]: r1024 - jpeg2000/j2kdec.c

k.nowosad subversion at mplayerhq.hu
Sun Aug 19 15:32:24 CEST 2007


Author: k.nowosad
Date: Sun Aug 19 15:32:24 2007
New Revision: 1024

Log:
corrected frame initialization and allocation


Modified:
   jpeg2000/j2kdec.c

Modified: jpeg2000/j2kdec.c
==============================================================================
--- jpeg2000/j2kdec.c	(original)
+++ jpeg2000/j2kdec.c	Sun Aug 19 15:32:24 2007
@@ -338,8 +338,14 @@ static int get_siz(J2kDecoderContext *s)
         case 4: s->avctx->pix_fmt = PIX_FMT_BGRA; break;
     }
 
+    if (s->picture.data[0])
+        s->avctx->release_buffer(s->avctx, &s->picture);
+
     s->avctx->get_buffer(s->avctx, &s->picture);
 
+    s->picture.pict_type = FF_I_TYPE;
+    s->picture.key_frame = 1;
+
     return 0;
 }
 
@@ -1267,12 +1273,20 @@ static int decode_frame(AVCodecContext *
     return s->buf - s->buf_start;
 }
 
+static void j2kdec_init(AVCodecContext *avctx)
+{
+    J2kDecoderContext *s = avctx->priv_data;
+
+    avcodec_get_frame_defaults((AVFrame*)&s->picture);
+    avctx->coded_frame = (AVFrame*)&s->picture;
+}
+
 AVCodec jpeg2000_decoder = {
     "j2k",
     CODEC_TYPE_VIDEO,
     CODEC_ID_JPEG2000,
     sizeof(J2kDecoderContext),
-    NULL,
+    j2kdec_init,
     NULL,
     NULL,
     decode_frame,



More information about the FFmpeg-soc mailing list