summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-12-26 20:52:25 -0300
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-12-29 13:24:06 -0300
commit890c4ab4fdcb2791999ab35d849d6640ae72e101 (patch)
tree0709ca2a68262870e4d45e1c46d87ffbcf83e34c
parentbfe1e7f8bc967d7d88557f0d3ab625fa0667ffb6 (diff)
wrappercamerabinsrc: Implement video capture renegotiate
Handle caps renegotiation from camerabin2's renegotiate event to allow video capture to be done with the user's requested resolution.
-rw-r--r--gst/camerabin2/gstwrappercamerabinsrc.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c
index 353e733ca..74d27fe79 100644
--- a/gst/camerabin2/gstwrappercamerabinsrc.c
+++ b/gst/camerabin2/gstwrappercamerabinsrc.c
@@ -138,9 +138,8 @@ gst_wrapper_camera_bin_src_imgsrc_probe (GstPad * pad, GstBuffer * buffer,
GstBaseCameraSrc *camerasrc = GST_BASE_CAMERA_SRC (data);
gboolean ret = FALSE;
- GST_LOG_OBJECT (self, "Image probe, mode %d, capture count %d, caps %"
- GST_PTR_FORMAT, camerasrc->mode, self->image_capture_count,
- GST_BUFFER_CAPS (buffer));
+ GST_LOG_OBJECT (self, "Image probe, mode %d, capture count %d",
+ camerasrc->mode, self->image_capture_count);
g_mutex_lock (camerasrc->capturing_mutex);
if (self->image_capture_count > 0) {
@@ -836,10 +835,29 @@ gst_wrapper_camera_bin_src_start_capture (GstBaseCameraSrc * camerasrc)
start_image_capture (src);
src->image_capture_count = 1;
} else if (src->mode == MODE_VIDEO) {
+ GstCaps *caps = NULL;
+
g_mutex_unlock (camerasrc->capturing_mutex);
gst_wrapper_camera_bin_reset_video_src_caps (src, NULL);
g_mutex_lock (camerasrc->capturing_mutex);
+ if (src->video_renegotiate) {
+ /* clean capsfilter caps so they don't interfere here */
+ g_object_set (src->src_filter, "caps", NULL, NULL);
+ if (src->src_zoom_filter)
+ g_object_set (src->src_zoom_filter, "caps", NULL, NULL);
+
+ caps = gst_pad_get_allowed_caps (src->vidsrc);
+ caps = gst_caps_make_writable (caps);
+ gst_pad_fixate_caps (src->vidsrc, caps);
+ GST_DEBUG_OBJECT (src, "Vidsrc caps fixated to %" GST_PTR_FORMAT, caps);
+
+ src->video_renegotiate = FALSE;
+ g_mutex_unlock (camerasrc->capturing_mutex);
+ gst_wrapper_camera_bin_reset_video_src_caps (src, caps);
+ g_mutex_lock (camerasrc->capturing_mutex);
+ gst_caps_unref (caps);
+ }
if (src->video_rec_status == GST_VIDEO_RECORDING_STATUS_DONE) {
src->video_rec_status = GST_VIDEO_RECORDING_STATUS_STARTING;
}