]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/roqvideodec.c
Add long names to AVCodec declarations.
[ffmpeg] / libavcodec / roqvideodec.c
index 8a3328ecc69c7da1945929cc029ea621e2fa4bfd..65dac91c72791bd75a03b1739ec555ca99d52506 100644 (file)
@@ -16,7 +16,6 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
  */
 
 /**
@@ -33,7 +32,6 @@
 
 #include "avcodec.h"
 #include "bytestream.h"
-#include "dsputil.h"
 #include "roqvideo.h"
 
 static void roqvideo_decode_frame(RoqContext *ri)
@@ -44,8 +42,8 @@ static void roqvideo_decode_frame(RoqContext *ri)
     int vqid, bpos, xpos, ypos, xp, yp, x, y, mx, my;
     int frame_stats[2][4] = {{0},{0}};
     roq_qcell *qcell;
-    unsigned char *buf = ri->buf;
-    unsigned char *buf_end = ri->buf + ri->size;
+    const unsigned char *buf = ri->buf;
+    const unsigned char *buf_end = ri->buf + ri->size;
 
     while (buf < buf_end) {
         chunk_id = bytestream_get_le16(&buf);
@@ -155,7 +153,7 @@ static void roqvideo_decode_frame(RoqContext *ri)
 }
 
 
-static int roq_decode_init(AVCodecContext *avctx)
+static av_cold int roq_decode_init(AVCodecContext *avctx)
 {
     RoqContext *s = avctx->priv_data;
 
@@ -165,23 +163,25 @@ static int roq_decode_init(AVCodecContext *avctx)
     s->last_frame    = &s->frames[0];
     s->current_frame = &s->frames[1];
     avctx->pix_fmt = PIX_FMT_YUV444P;
-    dsputil_init(&s->dsp, avctx);
 
     return 0;
 }
 
 static int roq_decode_frame(AVCodecContext *avctx,
                             void *data, int *data_size,
-                            uint8_t *buf, int buf_size)
+                            const uint8_t *buf, int buf_size)
 {
     RoqContext *s = avctx->priv_data;
+    int copy= !s->current_frame->data[0];
 
     if (avctx->reget_buffer(avctx, s->current_frame)) {
         av_log(avctx, AV_LOG_ERROR, "  RoQ: get_buffer() failed\n");
         return -1;
     }
-    s->y_stride = s->current_frame->linesize[0];
-    s->c_stride = s->current_frame->linesize[1];
+
+    if(copy)
+        av_picture_copy((AVPicture*)s->current_frame, (AVPicture*)s->last_frame,
+                        avctx->pix_fmt, avctx->width, avctx->height);
 
     s->buf = buf;
     s->size = buf_size;
@@ -196,7 +196,7 @@ static int roq_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-static int roq_decode_end(AVCodecContext *avctx)
+static av_cold int roq_decode_end(AVCodecContext *avctx)
 {
     RoqContext *s = avctx->priv_data;
 
@@ -219,4 +219,5 @@ AVCodec roq_decoder = {
     roq_decode_end,
     roq_decode_frame,
     CODEC_CAP_DR1,
+    .long_name = "Id RoQ video",
 };