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);
On Sun, 6 Nov 2011 01:26:16 +0100 (CET), reimar wrote:
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.
are you creating some kind of mplayer testsuite to detect all of these bugs? :) -compn
On Sat, Nov 05, 2011 at 08:40:07PM -0400, compn wrote:
On Sun, 6 Nov 2011 01:26:16 +0100 (CET), reimar wrote:
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.
are you creating some kind of mplayer testsuite to detect all of these bugs? :)
No. It probably should be possible e.g. using -vo md5sum but I currently have not plans for it, even though it would be a good idea to at least run through everything in FATE.
participants (3)
-
compn -
reimar -
Reimar Döffinger