From: Thiago Santos Date: Thu, 2 Dec 2010 06:44:37 +0000 (-0300) Subject: camerabin2: Various fixes X-Git-Tag: RELEASE-0.10.21~236 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=122a7bd556c90f6bd7af94c0f6a6dec9f289d1a3;p=platform%2Fupstream%2Fgst-plugins-bad.git 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 --- diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index a7bd139..171c5bf 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 d1753e0..ba78a3e 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: