I still insist on copying the QuickTime palette to extradata in
matroskadec.c, since it's currently needed for MPlayer to use the
correct palette. As I have explained so many times before, MPlayer, for
some inexplicable reason, currently adds *another* palette side data
packet *after* the one added in matroskadec.c, using whatever is in
extradata as the palette.

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From e6202f0f7caa9c82915b2fa3276b263d16d1aaaa Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Mon, 28 Dec 2015 05:12:49 +0100
Subject: [PATCH] lavf/matroskadec.c: Copy QuickTime palette to extradata

I still insist on copying the QuickTime palette to extradata in
matroskadec.c, since it's currently needed for MPlayer to use the
correct palette. As I have explained so many times before, MPlayer, for
some inexpblicable reason, currently adds *another* palette side data
packet *after* the one added in matroskadec.c, using whatever is in
extradata as the palette.

Mats

---
 libavformat/matroskadec.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 9de7cfb..d788dce 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1893,6 +1893,15 @@ static int matroska_parse_tracks(AVFormatContext *s)
                                   0, NULL, NULL, NULL, NULL);
                 if (ff_get_qtpalette(codec_id, &b, matroska->palette)) {
                     bit_depth &= 0x1F;
+                    /* Copy the palette to extradata. This is needed
+                     * because MPlayer currently adds *another* palette
+                     * side data packet *after* the one added in
+                     * matroska_deliver_packet(), using whatever is in
+                     * extradata as the palette. */
+                    if (ff_alloc_extradata(st->codec, AVPALETTE_SIZE))
+                        return AVERROR(ENOMEM);
+                    memcpy(st->codec->extradata, matroska->palette,
+                            AVPALETTE_SIZE);
                     matroska->has_palette = 1;
                 }
             }
-- 
1.7.10.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to