summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorStefan Kost <ensonic@users.sf.net>2009-06-12 10:26:30 +0300
committerStefan Kost <ensonic@users.sf.net>2009-06-14 10:56:30 +0300
commit80408b1de27ebb2c5f6f68518a5b07719e1b3e50 (patch)
tree2a6c5b98278392b7cd469204cf1858a88161b139 /gst
parent1187b88acdb0b9d7d50418309c60a6b4b8f7a72a (diff)
downloadgst-plugins-bad-80408b1de27ebb2c5f6f68518a5b07719e1b3e50.tar.gz
gst-plugins-bad-80408b1de27ebb2c5f6f68518a5b07719e1b3e50.tar.bz2
gst-plugins-bad-80408b1de27ebb2c5f6f68518a5b07719e1b3e50.zip
camerabin: set imagebin to PAUSED on capture and delayed filename setting
We need to set imagebin to PAUSED to not fail the bufferalloc. We also need to keep the filesinks state locked until we have the filename for the run.
Diffstat (limited to 'gst')
-rw-r--r--gst/camerabin/camerabinimage.c26
-rw-r--r--gst/camerabin/gstcamerabin.c5
2 files changed, 25 insertions, 6 deletions
diff --git a/gst/camerabin/camerabinimage.c b/gst/camerabin/camerabinimage.c
index 338d2e3d..10b0adf0 100644
--- a/gst/camerabin/camerabinimage.c
+++ b/gst/camerabin/camerabinimage.c
@@ -193,13 +193,22 @@ gst_camerabin_image_change_state (GstElement * element,
}
/* Allow setting filename when image bin in READY state */
gst_element_set_locked_state (img->sink, TRUE);
+ GST_INFO_OBJECT (img, "locking imagebin->sink state to %s",
+ gst_element_state_get_name (GST_STATE (img->sink)));
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
- gst_element_set_locked_state (img->sink, FALSE);
+ if (!g_str_equal (img->filename->str, "")) {
+ GST_INFO_OBJECT (img, "preparing image with filename: %s",
+ img->filename->str);
+ gst_element_set_locked_state (img->sink, FALSE);
+ } else {
+ GST_INFO_OBJECT (img, "keep sink locked, we have no filename yet");
+ }
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
/* Set sink to NULL in order to write the file _now_ */
- GST_INFO ("write img file: %s", img->filename->str);
+ GST_INFO_OBJECT (img, "write image with filename: %s",
+ img->filename->str);
gst_element_set_locked_state (img->sink, TRUE);
gst_element_set_state (img->sink, GST_STATE_NULL);
break;
@@ -258,11 +267,18 @@ gst_camerabin_image_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_FILENAME:
g_string_assign (bin->filename, g_value_get_string (value));
+ GST_INFO_OBJECT (bin, "received filename: '%s'", bin->filename->str);
if (bin->sink) {
- g_object_set (G_OBJECT (bin->sink), "location", bin->filename->str,
- NULL);
+ if (!g_str_equal (bin->filename->str, "")) {
+ g_object_set (G_OBJECT (bin->sink), "location", bin->filename->str,
+ NULL);
+ gst_element_set_locked_state (bin->sink, FALSE);
+ gst_element_sync_state_with_parent (bin->sink);
+ } else {
+ GST_INFO_OBJECT (bin, "empty filename");
+ }
} else {
- GST_INFO ("no sink, not setting name yet");
+ GST_INFO_OBJECT (bin, "no sink, not setting name yet");
}
break;
default:
diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c
index 22bf1465..f1cd897a 100644
--- a/gst/camerabin/gstcamerabin.c
+++ b/gst/camerabin/gstcamerabin.c
@@ -1562,7 +1562,10 @@ gst_camerabin_start_image_capture (GstCameraBin * camera)
if (!wait_for_prepare) {
/* Image queue's srcpad data probe will set imagebin to PLAYING */
- state_ret = gst_element_set_state (camera->imgbin, GST_STATE_READY);
+ state_ret = gst_element_set_state (camera->imgbin, GST_STATE_PAUSED);
+ GST_DEBUG_OBJECT (camera, "setting imagebin to paused: %s",
+ gst_element_state_change_return_get_name (state_ret));
+
if (state_ret != GST_STATE_CHANGE_FAILURE) {
g_mutex_lock (camera->capture_mutex);
g_object_set (G_OBJECT (camera->src_out_sel), "resend-latest", TRUE,