]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/roqvideodec.c
Merge commit '1720791e36f9cc24c05efea5bb275ab52156ce50'
[ffmpeg] / libavcodec / roqvideodec.c
index 68ef160ecff19d114730a88a26a4dac45e90a123..5f0b2047c6857dadb4f3249eb3efe9f915d11324 100644 (file)
@@ -26,6 +26,8 @@
  */
 
 #include "libavutil/avassert.h"
+#include "libavutil/imgutils.h"
+
 #include "avcodec.h"
 #include "bytestream.h"
 #include "internal.h"
@@ -202,15 +204,17 @@ static int roq_decode_frame(AVCodecContext *avctx,
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     RoqContext *s = avctx->priv_data;
-    int copy= !s->current_frame->data[0];
+    int copy = !s->current_frame->data[0] && s->last_frame->data[0];
     int ret;
 
     if ((ret = ff_reget_buffer(avctx, s->current_frame)) < 0)
         return ret;
 
-    if(copy)
-        av_picture_copy((AVPicture*)s->current_frame, (AVPicture*)s->last_frame,
-                        avctx->pix_fmt, avctx->width, avctx->height);
+    if (copy) {
+        ret = av_frame_copy(s->current_frame, s->last_frame);
+        if (ret < 0)
+            return ret;
+    }
 
     bytestream2_init(&s->gb, buf, buf_size);
     roqvideo_decode_frame(s);