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.
This commit is contained in:
Luciana Fujii Pontello 2011-02-04 01:00:55 -02:00 committed by Stefan Kost
parent 2522a672a9
commit fa45b1fe2d

View file

@ -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,7 +4045,10 @@ gst_camerabin_capture_start (GstCameraBin * camera)
}
}
if (g_str_equal (camera->filename->str, "")) {
/* 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;