]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/msrle.c
avutil: Switch crypto APIs to size_t
[ffmpeg] / libavcodec / msrle.c
index b83b3d2a41b99e279ade0abfbd52590eb626a3ec..42c8f483730d02d0f9d2e940fbb8c12e1eb9db3e 100644 (file)
@@ -33,6 +33,7 @@
 #include <string.h>
 
 #include "avcodec.h"
+#include "decode.h"
 #include "internal.h"
 #include "msrledec.h"
 #include "libavutil/imgutils.h"
@@ -93,19 +94,12 @@ static int msrle_decode_frame(AVCodecContext *avctx,
     if (buf_size < 2) //Minimally a end of picture code should be there
         return AVERROR_INVALIDDATA;
 
-    if ((ret = ff_reget_buffer(avctx, s->frame)) < 0)
+    if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
         return ret;
 
     if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) {
-        int size;
-        const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
-
-        if (pal && size == AVPALETTE_SIZE) {
-            s->frame->palette_has_changed = 1;
-            memcpy(s->pal, pal, AVPALETTE_SIZE);
-        } else if (pal) {
-            av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
-        }
+        s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
+
         /* make the palette available */
         memcpy(s->frame->data[1], s->pal, AVPALETTE_SIZE);
     }