mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +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>
|
||||
|
||||
* 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);
|
||||
|
|
Loading…
Reference in a new issue