Merge branch 'master' into 0.11
[platform/upstream/gstreamer.git] / tests / examples / seek / jsseek.c
index ec74cc8..b7283e8 100644 (file)
@@ -2044,6 +2044,8 @@ shot_cb (GtkButton * button, gpointer data)
     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
@@ -2066,12 +2068,17 @@ shot_cb (GtkButton * button, gpointer data)
 
     /* 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);