summaryrefslogtreecommitdiff
path: root/tests/examples
diff options
context:
space:
mode:
authorMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-01-25 18:49:58 +0100
committerMark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>2012-01-25 18:50:40 +0100
commit12ee41829c4e1d350adeb898c721724550620260 (patch)
treefa2f03da024198b1207562f09e82c96f2858ac8b /tests/examples
parent7aead77649ed8c1531d4e969651452dcb40f8c70 (diff)
port some more to new memory API
Fixes #668677.
Diffstat (limited to 'tests/examples')
-rw-r--r--tests/examples/camerabin/gst-camera.c10
-rw-r--r--tests/examples/camerabin/gst-camerabin-test.c10
-rw-r--r--tests/examples/camerabin2/gst-camerabin2-test.c10
-rw-r--r--tests/examples/mxf/mxfdemux-structure.c9
4 files changed, 19 insertions, 20 deletions
diff --git a/tests/examples/camerabin/gst-camera.c b/tests/examples/camerabin/gst-camera.c
index e5e48e68f..610b32f0a 100644
--- a/tests/examples/camerabin/gst-camera.c
+++ b/tests/examples/camerabin/gst-camera.c
@@ -218,8 +218,6 @@ handle_element_message (GstMessage * msg)
const GstStructure *st;
const GValue *image;
GstBuffer *buf = NULL;
- guint8 *data = NULL;
- gsize size = 0;
gchar *filename = NULL;
FILE *f = NULL;
size_t written;
@@ -243,9 +241,11 @@ handle_element_message (GstMessage * msg)
g_print ("writing buffer to %s\n", filename);
f = g_fopen (filename, "w");
if (f) {
- data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
- written = fwrite (data, size, 1, f);
- gst_buffer_unmap (buf, data, size);
+ GstMapInfo map;
+
+ gst_buffer_map (buf, &map, GST_MAP_READ);
+ written = fwrite (map.data, map.size, 1, f);
+ gst_buffer_unmap (buf, &map);
if (!written) {
g_print ("errro writing file\n");
}
diff --git a/tests/examples/camerabin/gst-camerabin-test.c b/tests/examples/camerabin/gst-camerabin-test.c
index 9c8c9f892..023542de3 100644
--- a/tests/examples/camerabin/gst-camerabin-test.c
+++ b/tests/examples/camerabin/gst-camerabin-test.c
@@ -239,8 +239,6 @@ sync_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
const GstStructure *st;
const GValue *image;
GstBuffer *buf = NULL;
- guint8 *data_buf = NULL;
- gsize size = 0;
gchar *preview_filename = NULL;
FILE *f = NULL;
size_t written;
@@ -264,14 +262,16 @@ sync_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
//extract preview-image from msg
image = gst_structure_get_value (st, "buffer");
if (image) {
+ GstMapInfo map;
+
buf = gst_value_get_buffer (image);
- data_buf = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
+ gst_buffer_map (buf, &map, GST_MAP_READ);
preview_filename = g_strdup_printf ("test_vga.rgb");
g_print ("writing buffer to %s, elapsed: %.2fs\n",
preview_filename, g_timer_elapsed (timer, NULL));
f = g_fopen (preview_filename, "w");
if (f) {
- written = fwrite (data_buf, size, 1, f);
+ written = fwrite (map.data, map.size, 1, f);
if (!written) {
g_print ("error writing file\n");
}
@@ -280,7 +280,7 @@ sync_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
g_print ("error opening file for raw image writing\n");
}
g_free (preview_filename);
- gst_buffer_unmap (buf, data_buf, size);
+ gst_buffer_unmap (buf, &map);
}
}
}
diff --git a/tests/examples/camerabin2/gst-camerabin2-test.c b/tests/examples/camerabin2/gst-camerabin2-test.c
index b32abc1ed..e4dc96338 100644
--- a/tests/examples/camerabin2/gst-camerabin2-test.c
+++ b/tests/examples/camerabin2/gst-camerabin2-test.c
@@ -341,8 +341,6 @@ sync_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
const GstStructure *st;
const GValue *image;
GstBuffer *buf = NULL;
- guint8 *data_buf = NULL;
- gsize size = 0;
gchar *preview_filename = NULL;
FILE *f = NULL;
size_t written;
@@ -385,9 +383,11 @@ sync_bus_callback (GstBus * bus, GstMessage * message, gpointer data)
preview_filename = g_strdup_printf ("test_vga.rgb");
f = g_fopen (preview_filename, "w");
if (f) {
- data_buf = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
- written = fwrite (data_buf, size, 1, f);
- gst_buffer_unmap (buf, data_buf, size);
+ GstMapInfo map;
+
+ gst_buffer_map (buf, &map, GST_MAP_READ);
+ written = fwrite (map.data, map.size, 1, f);
+ gst_buffer_unmap (buf, &map);
if (!written) {
g_print ("error writing file\n");
}
diff --git a/tests/examples/mxf/mxfdemux-structure.c b/tests/examples/mxf/mxfdemux-structure.c
index a8be22dc9..e3a3f72c5 100644
--- a/tests/examples/mxf/mxfdemux-structure.c
+++ b/tests/examples/mxf/mxfdemux-structure.c
@@ -31,13 +31,12 @@ g_value_to_string (const GValue * val)
{
if (G_VALUE_TYPE (val) == GST_TYPE_BUFFER) {
GstBuffer *buf = gst_value_get_buffer (val);
- gpointer data;
- gsize size;
+ GstMapInfo map;
gchar *ret;
- data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
- ret = g_base64_encode (data, size);
- gst_buffer_unmap (buf, data, size);
+ gst_buffer_map (buf, &map, GST_MAP_READ);
+ ret = g_base64_encode (map.data, map.size);
+ gst_buffer_unmap (buf, &map);
return ret;
} else {