+2006-03-14 Tim-Philipp Müller <tim at centricular dot net>
+
+ * gst/avi/gstavidemux.c: (gst_avi_demux_invert):
+ Fix DIB image inversion for pictures with a
+ depth != 8 (#305279).
+
2006-03-14 Tim-Philipp Müller <tim at centricular dot net>
* ext/jpeg/gstjpegdec.c: (gst_jpeg_dec_class_init),
static GstBuffer *
gst_avi_demux_invert (avi_stream_context * stream, GstBuffer * buf)
{
- gint y, h = stream->strf.vids->height, w = stream->strf.vids->width;
+ GstStructure *s;
+ gint y, h = stream->strf.vids->height;
+ gint bpp, stride;
guint8 *tmp = NULL;
+ 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");
+ return buf;
+ }
+
+ stride = stream->strf.vids->width * (bpp / 8);
+
buf = gst_buffer_make_writable (buf);
- if (GST_BUFFER_SIZE (buf) < (w * h)) {
- GST_WARNING ("Buffer is smaller than reported Width x Height");
+ if (GST_BUFFER_SIZE (buf) < (stride * h)) {
+ GST_WARNING ("Buffer is smaller than reported Width x Height x Depth");
return buf;
}
- tmp = g_malloc (w);
+ tmp = g_malloc (stride);
for (y = 0; y < h / 2; y++) {
- swap_line (GST_BUFFER_DATA (buf) + w * y,
- GST_BUFFER_DATA (buf) + w * (h - 1 - y), tmp, w);
+ swap_line (GST_BUFFER_DATA (buf) + stride * y,
+ GST_BUFFER_DATA (buf) + stride * (h - 1 - y), tmp, stride);
}
g_free (tmp);