mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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.
This commit is contained in:
parent
19ca77e95e
commit
955e50449e
2 changed files with 62 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue