static void gst_camerabin_video_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstClock *gst_camerabin_video_provide_clock (GstElement * elem);
static GstStateChangeReturn
gst_camerabin_video_change_state (GstElement * element,
GstStateChange transition);
(GObjectFinalizeFunc) GST_DEBUG_FUNCPTR (gst_camerabin_video_dispose);
eklass->change_state = GST_DEBUG_FUNCPTR (gst_camerabin_video_change_state);
- eklass->provide_clock = GST_DEBUG_FUNCPTR (gst_camerabin_video_provide_clock);
-
gobject_class->set_property =
GST_DEBUG_FUNCPTR (gst_camerabin_video_set_property);
gobject_class->get_property =
}
}
-/* GstElement methods implementation */
-
-static GstClock *
-gst_camerabin_video_provide_clock (GstElement * elem)
-{
- GstElement *aud_src = GST_CAMERABIN_VIDEO (elem)->aud_src;
- if (aud_src) {
- return gst_element_provide_clock (aud_src);
- } else {
- return NULL;
- }
-}
-
static GstStateChangeReturn
gst_camerabin_video_change_state (GstElement * element,
GstStateChange transition)
static GstStateChangeReturn
gst_camerabin_change_state (GstElement * element, GstStateChange transition);
+static GstClock *gst_camerabin_provide_clock (GstElement * element);
/*
* GstBin function declarations
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_camerabin_change_state);
+ gstelement_class->provide_clock =
+ GST_DEBUG_FUNCPTR (gst_camerabin_provide_clock);
+
/* gstbin */
/* override handle_message to peek when video or image bin reaches eos */
gstbin_class->handle_message =
return ret;
}
+static GstClock *
+gst_camerabin_provide_clock (GstElement * element)
+{
+ GstClock *clock = NULL;
+ GstClock *vidbin_clock = NULL;
+ GstCameraBin *camera = GST_CAMERABIN (element);
+ GstElement *aud_src = GST_CAMERABIN_VIDEO (camera->vidbin)->aud_src;
+
+ if (aud_src)
+ vidbin_clock = gst_element_provide_clock (aud_src);
+
+ if (camera->capturing && camera->mode == MODE_VIDEO && vidbin_clock)
+ clock = vidbin_clock;
+ else {
+ clock = GST_ELEMENT_CLASS (parent_class)->provide_clock (element);
+ if (clock == vidbin_clock) {
+ /* Do not reuse vidbin_clock if it was current clock */
+ clock = gst_system_clock_obtain ();
+ }
+ }
+
+ GST_INFO_OBJECT (camera, "Reset pipeline clock to %p(%s)",
+ clock, GST_ELEMENT_NAME (clock));
+
+ return clock;
+}
+
static gboolean
gst_camerabin_imgbin_finished (gpointer u_data)
{