diff msrle.c @ 1607:9ef0d51e809b libavcodec

Set buffer hints, use cr where available
author rtognimp
date Fri, 07 Nov 2003 21:21:36 +0000
parents 21190cfac0e1
children 7f4d1ab4ac17
line wrap: on
line diff
--- a/msrle.c	Fri Nov 07 21:20:24 2003 +0000
+++ b/msrle.c	Fri Nov 07 21:21:36 2003 +0000
@@ -160,10 +160,19 @@
 {
     MsrleContext *s = (MsrleContext *)avctx->priv_data;
 
+	/* no supplementary picture */
+	if (buf_size == 0)
+		return 0;
+
     s->buf = buf;
     s->size = buf_size;
 
     s->frame.reference = 1;
+    s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE;
+    if (avctx->cr_available)
+        s->frame.buffer_hints |= FF_BUFFER_HINTS_REUSABLE;
+    else
+        s->frame.buffer_hints |= FF_BUFFER_HINTS_READABLE;
     if (avctx->get_buffer(avctx, &s->frame)) {
         av_log(avctx, AV_LOG_ERROR, "  MS RLE: get_buffer() failed\n");
         return -1;
@@ -185,6 +194,7 @@
         avctx->release_buffer(avctx, &s->prev_frame);
 
     /* shuffle frames */
+  if (!avctx->cr_available)
     s->prev_frame = s->frame;
 
     *data_size = sizeof(AVFrame);
@@ -214,5 +224,5 @@
     NULL,
     msrle_decode_end,
     msrle_decode_frame,
-    CODEC_CAP_DR1,
+    CODEC_CAP_DR1 | CODEC_CAP_CR,
 };