diff options
author | Thiago Santos <thiago.sousa.santos@collabora.co.uk> | 2010-12-02 03:44:37 -0300 |
---|---|---|
committer | Thiago Santos <thiago.sousa.santos@collabora.co.uk> | 2010-12-08 15:38:29 -0300 |
commit | 122a7bd556c90f6bd7af94c0f6a6dec9f289d1a3 (patch) | |
tree | fbae5024ff6456b11d2f1095fef21a83aa8824da | |
parent | fb497590c71fbf5bb03950b44b85a75195490c97 (diff) |
camerabin2: Various fixes
As video recording bin's state is locked, we should always
remember of setting it to NULL when camerabin2 goes to NULL
Be more careful when using elements that might not
have been created yet
And do not set location property recursively on videorecordingbin
-rw-r--r-- | gst/camerabin2/gstcamerabin2.c | 11 | ||||
-rw-r--r-- | gst/camerabin2/gstvideorecordingbin.c | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index a7bd139ae..171c5bf1c 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -140,7 +140,8 @@ gst_camera_bin_start_capture (GstCameraBin * camerabin) static void gst_camera_bin_stop_capture (GstCameraBin * camerabin) { - g_signal_emit_by_name (camerabin->src, "stop-capture", NULL); + if (camerabin->src) + g_signal_emit_by_name (camerabin->src, "stop-capture", NULL); } static void @@ -152,7 +153,8 @@ gst_camera_bin_change_mode (GstCameraBin * camerabin, gint mode) /* stop any ongoing capture */ gst_camera_bin_stop_capture (camerabin); camerabin->mode = mode; - g_object_set (camerabin->src, "mode", mode, NULL); + if (camerabin->src) + g_object_set (camerabin->src, "mode", mode, NULL); } static void @@ -358,6 +360,7 @@ gst_camera_bin_create_elements (GstCameraBin * camera) "notify::ready-for-capture", G_CALLBACK (gst_camera_bin_src_notify_readyforcapture), camera); + g_object_set (src, "mode", camera->mode, NULL); g_object_set (vid, "location", camera->vid_location, NULL); g_object_set (img, "location", camera->img_location, NULL); @@ -385,6 +388,7 @@ gst_camera_bin_change_state (GstElement * element, GstStateChange trans) switch (trans) { case GST_STATE_CHANGE_READY_TO_NULL: + gst_element_set_state (camera->vidbin, GST_STATE_NULL); break; default: break; @@ -397,7 +401,8 @@ static void gst_camera_bin_set_location (GstCameraBin * camera, const gchar * location) { if (camera->mode == MODE_IMAGE) { - g_object_set (camera->imgbin, "location", location, NULL); + if (camera->imgbin) + g_object_set (camera->imgbin, "location", location, NULL); g_free (camera->img_location); camera->img_location = g_strdup (location); } else { diff --git a/gst/camerabin2/gstvideorecordingbin.c b/gst/camerabin2/gstvideorecordingbin.c index d1753e0a3..ba78a3e2a 100644 --- a/gst/camerabin2/gstvideorecordingbin.c +++ b/gst/camerabin2/gstvideorecordingbin.c @@ -75,7 +75,7 @@ gst_video_recording_bin_set_property (GObject * object, guint prop_id, case PROP_LOCATION: vidbin->location = g_value_dup_string (value); if (vidbin->sink) { - g_object_set (vidbin, "location", vidbin->location, NULL); + g_object_set (vidbin->sink, "location", vidbin->location, NULL); } break; default: |