Commit c12d7735 authored by Fabrizio's avatar Fabrizio Committed by Tim-Philipp Müller
Browse files

gst-libs/gst/riff/riff-media.c: Allow palettes with less than 256 colours in AVI files

Original commit message from CVS:
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
Allow palettes with less than 256 colours in AVI files
(#333488, patch by: Fabrizio Gennari).
parent 010e22b6
2006-03-08 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps):
Allow palettes with less than 256 colours in AVI files
(#333488, patch by: Fabrizio Gennari).
2006-03-07 Julien MOUTTE <julien@moutte.net>
 
* ext/pango/gsttextoverlay.c: (gst_text_overlay_text_event),
......
......@@ -547,15 +547,26 @@ gst_riff_create_video_caps (guint32 codec_fcc,
}
/* palette */
if (palette && GST_BUFFER_SIZE (palette) >= 256 * 4) {
GstBuffer *copy = gst_buffer_copy (palette);
if (palette) {
GstBuffer *copy;
guint num_colors;
if (strf != NULL)
num_colors = strf->num_colors;
else
num_colors = 256;
/* palette is always at least 256*4 bytes */
copy = gst_buffer_new_and_alloc (MAX (num_colors * 4, 256 * 4));
memcpy (GST_BUFFER_DATA (copy), GST_BUFFER_DATA (palette),
GST_BUFFER_SIZE (palette));
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
gint n;
guint32 *data = (guint32 *) GST_BUFFER_DATA (copy);
/* own endianness */
for (n = 0; n < 256; n++)
for (n = 0; n < num_colors; n++)
data[n] = GUINT32_FROM_LE (data[n]);
#endif
gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, copy, NULL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment