[MPlayer-cvslog] r34309 - trunk/libmpcodecs/vd_ffmpeg.c

reimar subversion at mplayerhq.hu
Sun Nov 6 01:26:16 CET 2011


Author: reimar
Date: Sun Nov  6 01:26:16 2011
New Revision: 34309

Log:
Do not create a 0-sized palette side data from extradata.

Fixes decoding of interplay video files.

Modified:
   trunk/libmpcodecs/vd_ffmpeg.c

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Sun Nov  6 00:12:16 2011	(r34308)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Sun Nov  6 01:26:16 2011	(r34309)
@@ -785,13 +785,16 @@ static mp_image_t *decode(sh_video_t *sh
     pkt.flags = AV_PKT_FLAG_KEY;
     if (!ctx->palette_sent && sh->bih && sh->bih->biBitCount <= 8) {
         /* Pass palette to codec */
-        uint8_t *pal = av_packet_new_side_data(&pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
         unsigned palsize = sh->bih->biSize - sizeof(*sh->bih);
         if (palsize == 0) {
             /* Palette size in biClrUsed */
             palsize = sh->bih->biClrUsed * 4;
         }
-        memcpy(pal, sh->bih+1, FFMIN(palsize, AVPALETTE_SIZE));
+        // if still 0, we simply have no palette in extradata.
+        if (palsize) {
+            uint8_t *pal = av_packet_new_side_data(&pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
+            memcpy(pal, sh->bih+1, FFMIN(palsize, AVPALETTE_SIZE));
+        }
         ctx->palette_sent = 1;
     }
     ret = avcodec_decode_video2(avctx, pic, &got_picture, &pkt);


More information about the MPlayer-cvslog mailing list