diff options
author | Stefan Kost <ensonic@users.sf.net> | 2009-07-21 16:48:26 +0300 |
---|---|---|
committer | Stefan Kost <ensonic@users.sf.net> | 2009-07-21 17:52:33 +0300 |
commit | b3753116d22f90a992f6ec8b4a876faca3a3ebfc (patch) | |
tree | f792405b4117b5930315909b27fb449b1d9df2f2 | |
parent | 60fa2e2cced543f730bf8ff2e0b6a4d665f8debd (diff) | |
download | gst-plugins-bad-b3753116d22f90a992f6ec8b4a876faca3a3ebfc.tar.gz gst-plugins-bad-b3753116d22f90a992f6ec8b4a876faca3a3ebfc.tar.bz2 gst-plugins-bad-b3753116d22f90a992f6ec8b4a876faca3a3ebfc.zip |
camerabin: we need to copy the data in the example
gdk_pixbuf_new_from_data does not copy the data.
-rw-r--r-- | tests/examples/camerabin/gst-camera-perf.c | 6 |
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 2337321d..ba8ff6a6 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", |