mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
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.
This commit is contained in:
parent
fedcff79d7
commit
6867ec5627
1 changed files with 9 additions and 11 deletions
|
@ -602,8 +602,8 @@ run_pipeline (gpointer user_data)
|
||||||
{
|
{
|
||||||
GstCaps *preview_caps = NULL;
|
GstCaps *preview_caps = NULL;
|
||||||
gchar *filename_str = NULL;
|
gchar *filename_str = NULL;
|
||||||
GString *filename_buffer = NULL;
|
|
||||||
GstElement *video_source = NULL;
|
GstElement *video_source = NULL;
|
||||||
|
const gchar *filename_suffix;
|
||||||
|
|
||||||
g_object_set (camera_bin, "mode", mode, NULL);
|
g_object_set (camera_bin, "mode", mode, NULL);
|
||||||
|
|
||||||
|
@ -618,20 +618,18 @@ run_pipeline (gpointer user_data)
|
||||||
|
|
||||||
set_metadata (camera_bin);
|
set_metadata (camera_bin);
|
||||||
|
|
||||||
filename_str = g_strdup_printf ("/test_%04u", capture_count);
|
/* Construct filename */
|
||||||
filename_buffer = g_string_new (filename->str);
|
|
||||||
filename_buffer = g_string_append (filename_buffer, filename_str);
|
|
||||||
|
|
||||||
if (mode == 1)
|
if (mode == 1)
|
||||||
filename_buffer = g_string_append (filename_buffer, ".mp4");
|
filename_suffix = ".mp4";
|
||||||
else
|
else
|
||||||
filename_buffer = g_string_append (filename_buffer, ".jpg");
|
filename_suffix = ".jpg";
|
||||||
|
filename_str =
|
||||||
g_object_set (camera_bin, "filename", filename_buffer->str, NULL);
|
g_strdup_printf ("%s/test_%04u%s", filename->str, capture_count,
|
||||||
g_string_free (filename_buffer, FALSE);
|
filename_suffix);
|
||||||
|
GST_DEBUG ("Setting filename: %s", filename_str);
|
||||||
|
g_object_set (camera_bin, "filename", filename_str, NULL);
|
||||||
g_free (filename_str);
|
g_free (filename_str);
|
||||||
|
|
||||||
|
|
||||||
g_object_get (camera_bin, "video-source", &video_source, NULL);
|
g_object_get (camera_bin, "video-source", &video_source, NULL);
|
||||||
if (video_source) {
|
if (video_source) {
|
||||||
if (GST_IS_ELEMENT (video_source) &&
|
if (GST_IS_ELEMENT (video_source) &&
|
||||||
|
|
Loading…
Reference in a new issue