basecamerasrc: add virtual function to notify subclass of changing preview caps

Adds a virtual function to basecamerasrc in case subclasses want to be
notified of changing preview caps. This is useful if the subclass wants
to post the preview itself or if it wants to provide a preview buffer
as close to as possible to the user's requested resolution to the
preview generation pipeline.
This commit is contained in:
Lauri Lehtinen 2011-02-24 17:42:21 -03:00 committed by Thiago Santos
parent 0633901dd5
commit 76b3ff361f
2 changed files with 29 additions and 7 deletions

View file

@ -201,6 +201,28 @@ gst_base_camera_src_setup_zoom (GstBaseCameraSrc * self)
bclass->set_zoom (self, zoom);
}
/**
* gst_base_camera_src_setup_preview:
* @self: camerasrc bin
* @preview_caps: preview caps to set
*
* Apply preview caps to preview pipeline and to video source.
*/
void
gst_base_camera_src_setup_preview (GstBaseCameraSrc * self,
GstCaps * preview_caps)
{
GstBaseCameraSrcClass *bclass = GST_BASE_CAMERA_SRC_GET_CLASS (self);
if (self->preview_pipeline) {
GST_DEBUG_OBJECT (self,
"Setting preview pipeline caps %" GST_PTR_FORMAT, self->preview_caps);
gst_camerabin_preview_set_caps (self->preview_pipeline, preview_caps);
}
if (bclass->set_preview)
bclass->set_preview (self, preview_caps);
}
/**
* gst_base_camera_src_get_allowed_input_caps:
@ -327,13 +349,8 @@ gst_base_camera_src_set_property (GObject * object,
case PROP_PREVIEW_CAPS:
gst_caps_replace (&self->preview_caps,
(GstCaps *) gst_value_get_caps (value));
if (self->preview_pipeline) {
GST_DEBUG_OBJECT (self,
"Setting preview pipeline caps %" GST_PTR_FORMAT,
self->preview_caps);
gst_camerabin_preview_set_caps (self->preview_pipeline,
(GstCaps *) gst_value_get_caps (value));
}
gst_base_camera_src_setup_preview (self,
(GstCaps *) gst_value_get_caps (value));
break;
case PROP_PREVIEW_FILTER:
if (self->preview_filter)

View file

@ -109,6 +109,10 @@ struct _GstBaseCameraSrcClass
gboolean (*set_mode) (GstBaseCameraSrc *self,
GstCameraBinMode mode);
/* set preview caps */
gboolean (*set_preview) (GstBaseCameraSrc *self,
GstCaps *preview_caps);
/* */
GstCaps * (*get_allowed_input_caps) (GstBaseCameraSrc * self);
@ -130,6 +134,7 @@ GstColorBalance * gst_base_camera_src_get_color_balance (GstBaseCameraSrc *self)
gboolean gst_base_camera_src_set_mode (GstBaseCameraSrc *self, GstCameraBinMode mode);
void gst_base_camera_src_setup_zoom (GstBaseCameraSrc * self);
void gst_base_camera_src_setup_preview (GstBaseCameraSrc * self, GstCaps * preview_caps);
GstCaps * gst_base_camera_src_get_allowed_input_caps (GstBaseCameraSrc * self);
void gst_base_camera_src_finish_capture (GstBaseCameraSrc *self);