[FFmpeg-devel] [PATCH] mm decoder: move buffer allocation from decode_init() to decode_frame()

Peter Ross pross
Sun Mar 13 06:27:05 CET 2011


This permits playback in ffplay when libavfilter is enabled.
---
 libavcodec/mmvideo.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
index 60e00fb..92420b1 100644
--- a/libavcodec/mmvideo.c
+++ b/libavcodec/mmvideo.c
@@ -59,10 +59,6 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
     avctx->pix_fmt = PIX_FMT_PAL8;
 
     s->frame.reference = 1;
-    if (avctx->get_buffer(avctx, &s->frame)) {
-        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
-        return -1;
-    }
 
     return 0;
 }
@@ -182,6 +178,11 @@ static int mm_decode_frame(AVCodecContext *avctx,
     buf += MM_PREAMBLE_SIZE;
     buf_size -= MM_PREAMBLE_SIZE;
 
+    if (avctx->reget_buffer(avctx, &s->frame) < 0) {
+        av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
+        return -1;
+    }
+
     switch(type) {
     case MM_TYPE_PALETTE   : mm_decode_pal(s, buf, buf_end); return buf_size;
     case MM_TYPE_INTRA     : mm_decode_intra(s, 0, 0, buf, buf_size); break;
-- 
1.7.1


-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110313/539a9907/attachment.pgp>



More information about the ffmpeg-devel mailing list