summaryrefslogtreecommitdiff
path: root/gst/camerabin2
diff options
context:
space:
mode:
authorRobert Swain <robert.swain@collabora.co.uk>2012-07-31 09:36:35 +0200
committerRobert Swain <robert.swain@collabora.co.uk>2012-08-02 22:46:21 +0200
commit955e50449e471e8431664f5f8db304ffeb79ae16 (patch)
treef521a50c4369d65d3a57599a1eacdd93f9c88bb6 /gst/camerabin2
parent19ca77e95eaa4745cb9b6f64edee5d03b2334452 (diff)
downloadgstreamer-plugins-bad-955e50449e471e8431664f5f8db304ffeb79ae16.tar.gz
wrappercamerabinsrc: Save image/video reconfiguration until capturing
Add a src pad event handler function that filters reconfigure events to trigger the renegotiation code paths in the mode-specific start-capture phase. This is to work towards fixing unit tests but more work is needed.
Diffstat (limited to 'gst/camerabin2')
-rw-r--r--gst/camerabin2/gstwrappercamerabinsrc.c63
-rw-r--r--gst/camerabin2/gstwrappercamerabinsrc.h2
2 files changed, 62 insertions, 3 deletions
diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c
index 06d60b589..c263296b7 100644
--- a/gst/camerabin2/gstwrappercamerabinsrc.c
+++ b/gst/camerabin2/gstwrappercamerabinsrc.c
@@ -374,6 +374,52 @@ gst_wrapper_camera_bin_src_max_zoom_cb (GObject * self, GParamSpec * pspec,
}
+static gboolean
+gst_wrapper_camera_bin_src_src_event (GstPad * pad, GstObject * parent,
+ GstEvent * event)
+{
+ gboolean ret = TRUE;
+ GstWrapperCameraBinSrc *self = GST_WRAPPER_CAMERA_BIN_SRC (parent);
+ GstPad *upstream_pad = NULL;
+
+ GST_DEBUG_OBJECT (self, "Handling event %p %" GST_PTR_FORMAT, event, event);
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_RECONFIGURE:
+ if (pad == self->imgsrc) {
+ GST_DEBUG_OBJECT (self, "Image mode reconfigure event received");
+ self->image_renegotiate = TRUE;
+ } else if (pad == self->vidsrc) {
+ GST_DEBUG_OBJECT (self, "Video mode reconfigure event received");
+ self->video_renegotiate = TRUE;
+ }
+ if (pad == self->imgsrc || pad == self->vidsrc) {
+ gst_event_unref (event);
+ return ret;
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (pad == self->imgsrc) {
+ upstream_pad = self->outsel_imgpad;
+ } else if (pad == self->vidsrc) {
+ upstream_pad = self->outsel_vidpad;
+ }
+
+ if (upstream_pad) {
+ ret = gst_pad_send_event (upstream_pad, event);
+ } else {
+ GST_WARNING_OBJECT (self, "Event caught that doesn't have an upstream pad -"
+ "this shouldn't be possible!");
+ gst_event_unref (event);
+ ret = FALSE;
+ }
+
+ return ret;
+}
+
/**
* gst_wrapper_camera_bin_src_construct_pipeline:
* @bcamsrc: camerasrc object
@@ -721,6 +767,14 @@ start_image_capture (GstWrapperCameraBinSrc * self)
gst_caps_replace (&self->image_capture_caps, caps);
gst_caps_unref (caps);
+ /* FIXME - do we need to update basecamerasrc width/height somehow here?
+ * if not, i think we need to do something about _when_ they get updated
+ * to be sure that set_element_zoom doesn't use the wrong values */
+
+ /* We caught this event in the src pad event handler and now we want to
+ * actually push it upstream */
+ gst_pad_send_event (self->outsel_imgpad, gst_event_new_reconfigure ());
+
self->image_renegotiate = FALSE;
}
@@ -1001,6 +1055,10 @@ gst_wrapper_camera_bin_src_start_capture (GstBaseCameraSrc * camerasrc)
g_mutex_lock (&camerasrc->capturing_mutex);
gst_caps_unref (caps);
gst_caps_unref (anycaps);
+
+ /* We caught this event in the src pad event handler and now we want to
+ * actually push it upstream */
+ gst_pad_send_event (src->outsel_vidpad, gst_event_new_reconfigure ());
}
if (src->video_rec_status == GST_VIDEO_RECORDING_STATUS_DONE) {
src->video_rec_status = GST_VIDEO_RECORDING_STATUS_STARTING;
@@ -1136,7 +1194,10 @@ gst_wrapper_camera_bin_src_init (GstWrapperCameraBinSrc * self)
GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (self), self->vidsrc);
- self->srcpad_event_func = GST_PAD_EVENTFUNC (self->vfsrc);
+ gst_pad_set_event_function (self->imgsrc,
+ GST_DEBUG_FUNCPTR (gst_wrapper_camera_bin_src_src_event));
+ gst_pad_set_event_function (self->vidsrc,
+ GST_DEBUG_FUNCPTR (gst_wrapper_camera_bin_src_src_event));
/* TODO where are variables reset? */
self->image_capture_count = 0;
diff --git a/gst/camerabin2/gstwrappercamerabinsrc.h b/gst/camerabin2/gstwrappercamerabinsrc.h
index 71f345159..973348b6e 100644
--- a/gst/camerabin2/gstwrappercamerabinsrc.h
+++ b/gst/camerabin2/gstwrappercamerabinsrc.h
@@ -88,8 +88,6 @@ struct _GstWrapperCameraBinSrc
GstPad *outsel_imgpad;
GstPad *outsel_vidpad;
- GstPadEventFunction srcpad_event_func;
-
/* For changing caps without losing timestamps */
gboolean drop_newseg;