summaryrefslogtreecommitdiff
path: root/tests/examples/camerabin
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2009-07-21 16:48:26 +0300
committerStefan Kost <ensonic@users.sf.net>2009-07-21 17:52:33 +0300
commitb3753116d22f90a992f6ec8b4a876faca3a3ebfc (patch)
treef792405b4117b5930315909b27fb449b1d9df2f2 /tests/examples/camerabin
parent60fa2e2cced543f730bf8ff2e0b6a4d665f8debd (diff)
downloadgstreamer-plugins-bad-b3753116d22f90a992f6ec8b4a876faca3a3ebfc.tar.gz
camerabin: we need to copy the data in the example
gdk_pixbuf_new_from_data does not copy the data.
Diffstat (limited to 'tests/examples/camerabin')
-rw-r--r--tests/examples/camerabin/gst-camera-perf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/examples/camerabin/gst-camera-perf.c b/tests/examples/camerabin/gst-camera-perf.c
index 2337321d3..ba8ff6a64 100644
--- a/tests/examples/camerabin/gst-camera-perf.c
+++ b/tests/examples/camerabin/gst-camera-perf.c
@@ -435,16 +435,18 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
GstBuffer *buf = gst_value_get_buffer (value);
GstCaps *caps = GST_BUFFER_CAPS (buf);
GstStructure *buf_st = gst_caps_get_structure (caps, 0);
- guchar *data = GST_BUFFER_DATA (buf);
gint width, height, rowstride;
GdkPixbuf *pixbuf;
+ guchar *data;
GST_INFO ("preview : buf=%p, size=%d, format=%" GST_PTR_FORMAT,
buf, GST_BUFFER_SIZE (buf), caps);
+
+ data = g_memdup (GST_BUFFER_DATA (buff), GST_BUFFER_SIZE (buff));
gst_structure_get_int (buf_st, "width", &width);
gst_structure_get_int (buf_st, "height", &height);
rowstride = GST_ROUND_UP_4 (width * 3);
- //GST_INFO ("rowstride : %d, %d", rowstride, width*3);
+
pixbuf = gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, FALSE,
8, width, height, rowstride, NULL, NULL);
gdk_pixbuf_save (pixbuf, "/tmp/gst-camerabin-preview.png", "png",