gint width, height;
GdkPixbuf *pixbuf;
GError *error = NULL;
+ gsize size;
+ guint8 *data;
/* get the snapshot buffer format now. We set the caps on the appsink so
* that it can only be an rgb buffer. The only thing we have not specified
/* create pixmap from buffer and save, gstreamer video buffers have a stride
* that is rounded up to the nearest multiple of 4 */
- pixbuf = gdk_pixbuf_new_from_data (GST_BUFFER_DATA (buffer),
+ data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
+ pixbuf = gdk_pixbuf_new_from_data (data,
GDK_COLORSPACE_RGB, FALSE, 8, width, height,
GST_ROUND_UP_4 (width * 3), NULL, NULL);
/* save the pixbuf */
gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL);
+ gst_buffer_unmap (buffer, data, size);
+
+ /* save the pixbuf */
+ gdk_pixbuf_save (pixbuf, "snapshot.png", "png", &error, NULL);
done:
gst_buffer_unref (buffer);