summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuciana Fujii Pontello <luciana@fujii.eti.br>2011-02-04 01:00:55 -0200
committerStefan Kost <ensonic@users.sf.net>2011-02-09 13:42:07 +0200
commitfa45b1fe2d6a2613a3972b10d9595558cd521607 (patch)
tree6ea43a586420c115d50fc2b735283e8dff58e657
parent2522a672a9a841a44ff4e0b20c7372092fd61010 (diff)
camerabin: Always take photo when preview-caps is set
When filename is not set, but preview-caps is set, take the photo and send its preview.
-rw-r--r--gst/camerabin/gstcamerabin.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c
index 8267500e5..5704513c6 100644
--- a/gst/camerabin/gstcamerabin.c
+++ b/gst/camerabin/gstcamerabin.c
@@ -1816,6 +1816,10 @@ gst_camerabin_have_img_buffer (GstPad * pad, GstMiniObject * obj,
GST_LOG ("got buffer %p with size %d", buffer, GST_BUFFER_SIZE (buffer));
+ if (camera->preview_caps) {
+ gst_camerabin_send_preview (camera, buffer);
+ }
+
/* Image filename should be set by now */
if (g_str_equal (camera->filename->str, "")) {
GST_DEBUG_OBJECT (camera, "filename not set, dropping buffer");
@@ -1824,10 +1828,6 @@ gst_camerabin_have_img_buffer (GstPad * pad, GstMiniObject * obj,
goto done;
}
- if (camera->preview_caps) {
- gst_camerabin_send_preview (camera, buffer);
- }
-
gst_camerabin_rewrite_tags (camera);
/* Send a custom event which tells the filename to image queue */
@@ -4045,11 +4045,14 @@ gst_camerabin_capture_start (GstCameraBin * camera)
}
}
- if (g_str_equal (camera->filename->str, "")) {
- GST_ELEMENT_ERROR (camera, CORE, FAILED,
- ("set filename before starting capture"), (NULL));
- return;
- }
+ /* We need a filename unless it's a photo and preview_caps is set */
+
+ if (g_str_equal (camera->filename->str, ""))
+ if (camera->active_bin == camera->vidbin || !camera->preview_caps) {
+ GST_ELEMENT_ERROR (camera, CORE, FAILED,
+ ("set filename before starting capture"), (NULL));
+ return;
+ }
g_mutex_lock (camera->capture_mutex);
if (camera->capturing) {