gst/avi/gstavidemux.c: Invert other uncompressed RGB formats. Fixes #558554.

Original commit message from CVS:
Patch by: Nick Haddad <nick at haddads dot net>
* gst/avi/gstavidemux.c: (gst_avi_demux_is_uncompressed),
(gst_avi_demux_invert), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data):
Invert other uncompressed RGB formats. Fixes #558554.
This commit is contained in:
Nick Haddad 2008-10-31 10:00:18 +00:00 committed by Wim Taymans
parent bab5d042b2
commit 66c804b41c
2 changed files with 26 additions and 5 deletions

View file

@ -1,3 +1,12 @@
2008-10-31 Wim Taymans <wim.taymans@collabora.co.uk>
Patch by: Nick Haddad <nick at haddads dot net>
* gst/avi/gstavidemux.c: (gst_avi_demux_is_uncompressed),
(gst_avi_demux_invert), (gst_avi_demux_process_next_entry),
(gst_avi_demux_stream_data):
Invert other uncompressed RGB formats. Fixes #558554.
2008-10-30 Sebastian Dröge <slomo@circular-chaos.org>
* gst/wavenc/gstwavenc.c: (gst_wavenc_create_header_buf),

View file

@ -3583,6 +3583,17 @@ swap_line (guint8 * d1, guint8 * d2, guint8 * tmp, gint bytes)
memcpy (d2, tmp, bytes);
}
/*
* Helper for gst_avi_demux_insert()
*/
static gboolean
gst_avi_demux_is_uncompressed (guint32 fourcc)
{
return fourcc == GST_RIFF_DIB ||
fourcc == GST_RIFF_rgb ||
fourcc == GST_RIFF_RGB || fourcc == GST_RIFF_RAW;
}
/*
* Invert DIB buffers... Takes existing buffer and
* returns either the buffer or a new one (with old
@ -3597,6 +3608,10 @@ gst_avi_demux_invert (avi_stream_context * stream, GstBuffer * buf)
gint bpp, stride;
guint8 *tmp = NULL;
if (!gst_avi_demux_is_uncompressed (stream->strh->fcc_handler)) {
return buf; /* Ignore non DIB buffers */
}
s = gst_caps_get_structure (GST_PAD_CAPS (stream->pad), 0);
if (!gst_structure_get_int (s, "bpp", &bpp)) {
GST_WARNING ("Failed to retrieve depth from caps");
@ -3770,8 +3785,7 @@ gst_avi_demux_process_next_entry (GstAviDemux * avi)
goto short_buffer;
/* invert the picture if needed */
if (stream->strh->fcc_handler == GST_MAKE_FOURCC ('D', 'I', 'B', ' '))
buf = gst_avi_demux_invert (stream, buf);
buf = gst_avi_demux_invert (stream, buf);
/* mark non-keyframes */
if (!(entry->flags & GST_AVI_INDEX_ENTRY_FLAG_KEYFRAME))
@ -3997,9 +4011,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
GstClockTime dur_ts = 0;
/* invert the picture if needed */
if (stream->strh->fcc_handler == GST_MAKE_FOURCC ('D', 'I', 'B', ' ')) {
buf = gst_avi_demux_invert (stream, buf);
}
buf = gst_avi_demux_invert (stream, buf);
gst_pad_query_position (stream->pad, &format, (gint64 *) & dur_ts);
if (format != GST_FORMAT_TIME)