From 61a8937ced18b6644fc1a0fde4b0ee23459d9606 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 19 Jul 2013 17:12:37 +0200 Subject: [PATCH] qtdemux: for non-raw video, move palette in caps We only need to append the palette to raw video buffers, non-raw video has the palette in the caps still. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=704292 --- gst/isomp4/qtdemux.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c index 9005bb5..88e9056 100644 --- a/gst/isomp4/qtdemux.c +++ b/gst/isomp4/qtdemux.c @@ -7204,11 +7204,41 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) } } + stream->caps = + qtdemux_video_caps (qtdemux, stream, fourcc, stsd_data, &codec); + if (codec) { + list = gst_tag_list_new_empty (); + gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, + GST_TAG_VIDEO_CODEC, codec, NULL); + g_free (codec); + codec = NULL; + } + + if (palette_data) { + GstStructure *s; + if (stream->rgb8_palette) gst_memory_unref (stream->rgb8_palette); stream->rgb8_palette = gst_memory_new_wrapped (GST_MEMORY_FLAG_READONLY, palette_data, palette_size, 0, palette_size, palette_data, g_free); + + s = gst_caps_get_structure (stream->caps, 0); + + /* non-raw video has a palette_data property. raw video has the palette as + * an extra plane that we append to the output buffers before we push + * them*/ + if (!gst_structure_has_name (s, "video/x-raw")) { + GstBuffer *palette; + + palette = gst_buffer_new (); + gst_buffer_append_memory (palette, stream->rgb8_palette); + stream->rgb8_palette = NULL; + + gst_caps_set_simple (stream->caps, "palette_data", + GST_TYPE_BUFFER, palette, NULL); + gst_buffer_unref (palette); + } } else if (palette_count != 0) { GST_ELEMENT_WARNING (qtdemux, STREAM, NOT_IMPLEMENTED, (NULL), ("Unsupported palette depth %d", depth)); @@ -7217,16 +7247,6 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak) GST_LOG_OBJECT (qtdemux, "frame count: %u", QT_UINT16 (stsd_data + offset + 48)); - stream->caps = - qtdemux_video_caps (qtdemux, stream, fourcc, stsd_data, &codec); - if (codec) { - list = gst_tag_list_new_empty (); - gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, - GST_TAG_VIDEO_CODEC, codec, NULL); - g_free (codec); - codec = NULL; - } - esds = NULL; pasp = NULL; /* pick 'the' stsd child */ -- 2.7.4