mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
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).
This commit is contained in:
parent
010e22b641
commit
c12d7735ac
2 changed files with 20 additions and 3 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
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>
|
2006-03-07 Julien MOUTTE <julien@moutte.net>
|
||||||
|
|
||||||
* ext/pango/gsttextoverlay.c: (gst_text_overlay_text_event),
|
* ext/pango/gsttextoverlay.c: (gst_text_overlay_text_event),
|
||||||
|
|
|
@ -547,15 +547,26 @@ gst_riff_create_video_caps (guint32 codec_fcc,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* palette */
|
/* palette */
|
||||||
if (palette && GST_BUFFER_SIZE (palette) >= 256 * 4) {
|
if (palette) {
|
||||||
GstBuffer *copy = gst_buffer_copy (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)
|
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
||||||
gint n;
|
gint n;
|
||||||
guint32 *data = (guint32 *) GST_BUFFER_DATA (copy);
|
guint32 *data = (guint32 *) GST_BUFFER_DATA (copy);
|
||||||
|
|
||||||
/* own endianness */
|
/* own endianness */
|
||||||
for (n = 0; n < 256; n++)
|
for (n = 0; n < num_colors; n++)
|
||||||
data[n] = GUINT32_FROM_LE (data[n]);
|
data[n] = GUINT32_FROM_LE (data[n]);
|
||||||
#endif
|
#endif
|
||||||
gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, copy, NULL);
|
gst_caps_set_simple (caps, "palette_data", GST_TYPE_BUFFER, copy, NULL);
|
||||||
|
|
Loading…
Reference in a new issue