summaryrefslogtreecommitdiff
path: root/tests/examples/camerabin
diff options
context:
space:
mode:
authorLasse Laukkanen <ext-lasse.2.laukkanen@nokia.com>2010-11-08 10:33:58 -0300
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-11-08 11:07:17 -0300
commit6867ec56273f7123557590a5576a4635d64e9d5f (patch)
treeb7626be50f740b9f3ded618ab0397abf67952cff /tests/examples/camerabin
parentfedcff79d723fdc6441dd93f23917e3ecdc2ffd3 (diff)
downloadgstreamer-plugins-bad-6867ec56273f7123557590a5576a4635d64e9d5f.tar.gz
examples: camerabin: Remove gstring leak
Simplify gst-camerabin-test by removing GString and replacing with gchar for the filename handling. Also removes a leak of the GString data.
Diffstat (limited to 'tests/examples/camerabin')
-rw-r--r--tests/examples/camerabin/gst-camerabin-test.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/examples/camerabin/gst-camerabin-test.c b/tests/examples/camerabin/gst-camerabin-test.c
index 8c5f362c9..6ebd1e237 100644
--- a/tests/examples/camerabin/gst-camerabin-test.c
+++ b/tests/examples/camerabin/gst-camerabin-test.c
@@ -602,8 +602,8 @@ run_pipeline (gpointer user_data)
{
GstCaps *preview_caps = NULL;
gchar *filename_str = NULL;
- GString *filename_buffer = NULL;
GstElement *video_source = NULL;
+ const gchar *filename_suffix;
g_object_set (camera_bin, "mode", mode, NULL);
@@ -618,20 +618,18 @@ run_pipeline (gpointer user_data)
set_metadata (camera_bin);
- filename_str = g_strdup_printf ("/test_%04u", capture_count);
- filename_buffer = g_string_new (filename->str);
- filename_buffer = g_string_append (filename_buffer, filename_str);
-
+ /* Construct filename */
if (mode == 1)
- filename_buffer = g_string_append (filename_buffer, ".mp4");
+ filename_suffix = ".mp4";
else
- filename_buffer = g_string_append (filename_buffer, ".jpg");
-
- g_object_set (camera_bin, "filename", filename_buffer->str, NULL);
- g_string_free (filename_buffer, FALSE);
+ filename_suffix = ".jpg";
+ filename_str =
+ g_strdup_printf ("%s/test_%04u%s", filename->str, capture_count,
+ filename_suffix);
+ GST_DEBUG ("Setting filename: %s", filename_str);
+ g_object_set (camera_bin, "filename", filename_str, NULL);
g_free (filename_str);
-
g_object_get (camera_bin, "video-source", &video_source, NULL);
if (video_source) {
if (GST_IS_ELEMENT (video_source) &&