diff --git a/ChangeLog b/ChangeLog index c70f0048c8..fa1c7ce892 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-10-31 Wim Taymans + + Patch by: Nick Haddad + + * 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 * gst/wavenc/gstwavenc.c: (gst_wavenc_create_header_buf), diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 62313e5ac4..05912fa163 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -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)