diff options
author | Thiago Santos <thiago.sousa.santos@collabora.co.uk> | 2010-12-04 00:27:17 -0300 |
---|---|---|
committer | Thiago Santos <thiago.sousa.santos@collabora.co.uk> | 2010-12-08 15:38:29 -0300 |
commit | b11342d325fa68e73bd408e6dd15dd7109c3c45f (patch) | |
tree | 4478c3703d00210d17961023b49651718c0726a2 /gst/camerabin2 | |
parent | b57405665a4f6440fd17ca94134c86f30aa51f18 (diff) |
camerabin2: Reset all elements on video recording branch before capture
We need to reset the elements from the video recording branch, including
the queue and capsfilter in order to clear the eos state and activate
the pads.
This makes it possible to record multiple videos with camerabin2 in a
sequence, otherwise the source would get a unexpected return and
push EOS, stopping the whole pipeline.
Diffstat (limited to 'gst/camerabin2')
-rw-r--r-- | gst/camerabin2/gstcamerabin2.c | 14 | ||||
-rw-r--r-- | gst/camerabin2/gstcamerabin2.h | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index cc7358ec0..0a9c0cd34 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -171,13 +171,18 @@ gst_camera_bin_src_notify_readyforcapture (GObject * obj, GParamSpec * pspec, if (!ready) { gchar *location; - /* a video recording is about to start, we reset the videobin */ + /* a video recording is about to start, we reset the videobin to clear eos/flushing state + * also need to clean the queue ! capsfilter before it */ gst_element_set_state (camera->vidbin, GST_STATE_NULL); + gst_element_set_state (camera->vid_queue, GST_STATE_NULL); + gst_element_set_state (camera->vid_capsfilter, GST_STATE_NULL); location = g_strdup_printf (camera->vid_location, camera->vid_index++); GST_DEBUG_OBJECT (camera, "Switching vidbin location to %s", location); g_object_set (camera->vidbin, "location", location, NULL); g_free (location); gst_element_set_state (camera->vidbin, GST_STATE_PLAYING); + gst_element_set_state (camera->vid_capsfilter, GST_STATE_PLAYING); + gst_element_set_state (camera->vid_queue, GST_STATE_PLAYING); } } } @@ -198,6 +203,10 @@ gst_camera_bin_dispose (GObject * object) if (camerabin->vidbin) gst_object_unref (camerabin->vidbin); + if (camerabin->vid_queue) + gst_object_unref (camerabin->vid_queue); + if (camerabin->vid_capsfilter) + gst_object_unref (camerabin->vid_capsfilter); if (camerabin->imgbin) gst_object_unref (camerabin->imgbin); @@ -349,6 +358,9 @@ gst_camera_bin_create_elements (GstCameraBin * camera) gst_element_link_pads (src, "imgsrc", img_queue, "sink"); gst_element_link_pads (src, "vidsrc", vid_queue, "sink"); + camera->vid_queue = gst_object_ref (vid_queue); + camera->vid_capsfilter = gst_object_ref (vid_capsfilter); + /* * Video can't get into playing as its internal filesink will open * a file for writing and leave it empty if unused. diff --git a/gst/camerabin2/gstcamerabin2.h b/gst/camerabin2/gstcamerabin2.h index 247e18609..a4c7bb4c9 100644 --- a/gst/camerabin2/gstcamerabin2.h +++ b/gst/camerabin2/gstcamerabin2.h @@ -41,6 +41,9 @@ struct _GstCameraBin gulong src_capture_notify_id; GstElement *vidbin; + GstElement *vid_queue; + GstElement *vid_capsfilter; + GstElement *imgbin; gint vid_index; |