diff --git a/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c b/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c index 42d13435af..199bf081dd 100644 --- a/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c +++ b/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c @@ -23,7 +23,7 @@ /** * SECTION:element-basecamerasrc * - * Base class for the camera source bin used by camerabin for capture. + * Base class for the camera source bin used by camerabin for capture. * Sophisticated camera hardware can derive from this baseclass and map the * features to this interface. * @@ -40,11 +40,32 @@ * During construct_pipeline() vmethod a subclass can add several elements into * the bin and expose 3 srcs pads as ghostpads implementing the 3 pad templates. * + * However the subclass is responsable for adding the pad templates for the + * source pads and they must be named "vidsrc", "imgsrc" and "vfsrc". The pad + * templates should be installed in the subclass' class_init function, like so: + * |[ + * static void + * my_element_class_init (GstMyElementClass *klass) + * { + * GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); + * // pad templates should be a #GstStaticPadTemplate with direction + * // #GST_PAD_SRC and name "vidsrc", "imgsrc" and "vfsrc" + * gst_element_class_add_static_pad_template (gstelement_class, + * &vidsrc_template); + * gst_element_class_add_static_pad_template (gstelement_class, + * &imgsrc_template); + * gst_element_class_add_static_pad_template (gstelement_class, + * &vfsrc_template); + * // see #GstElementDetails + * gst_element_class_set_details (gstelement_class, &details); + * } + * ]| + * * It is also possible to add regular pads from the subclass and implement the * dataflow methods on these pads. This way all functionality can be implemneted * directly in the subclass without extra elements. * - * The src will receive the capture mode from #GstCameraBin2 on the + * The src will receive the capture mode from #GstCameraBin2 on the * #GstBaseCameraSrc:mode property. Possible capture modes are defined in * #GstCameraBinMode. */ @@ -88,23 +109,6 @@ GST_DEBUG_CATEGORY (base_camera_src_debug); #define parent_class gst_base_camera_src_parent_class G_DEFINE_TYPE (GstBaseCameraSrc, gst_base_camera_src, GST_TYPE_BIN); -static GstStaticPadTemplate vfsrc_template = -GST_STATIC_PAD_TEMPLATE (GST_BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME, - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -static GstStaticPadTemplate imgsrc_template = -GST_STATIC_PAD_TEMPLATE (GST_BASE_CAMERA_SRC_IMAGE_PAD_NAME, - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); - -static GstStaticPadTemplate vidsrc_template = -GST_STATIC_PAD_TEMPLATE (GST_BASE_CAMERA_SRC_VIDEO_PAD_NAME, - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS_ANY); /* NOTE: we could provide a vmethod for derived class to overload to provide * it's own implementation of interface.. but in all cases I can think of at @@ -530,15 +534,6 @@ gst_base_camera_src_class_init (GstBaseCameraSrcClass * klass) gst_element_class_set_details_simple (gstelement_class, "Base class for camerabin src bin", "Source/Video", "Abstracts capture device for camerabin2", "Rob Clark "); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&vfsrc_template)); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&imgsrc_template)); - - gst_element_class_add_pad_template (gstelement_class, - gst_static_pad_template_get (&vidsrc_template)); } static void diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c index b69a08880f..189d66840b 100644 --- a/gst/camerabin2/gstwrappercamerabinsrc.c +++ b/gst/camerabin2/gstwrappercamerabinsrc.c @@ -54,6 +54,24 @@ GST_DEBUG_CATEGORY (wrapper_camera_bin_src_debug); G_DEFINE_TYPE (GstWrapperCameraBinSrc, gst_wrapper_camera_bin_src, GST_TYPE_BASE_CAMERA_SRC); +static GstStaticPadTemplate vfsrc_template = +GST_STATIC_PAD_TEMPLATE (GST_BASE_CAMERA_SRC_VIEWFINDER_PAD_NAME, + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate imgsrc_template = +GST_STATIC_PAD_TEMPLATE (GST_BASE_CAMERA_SRC_IMAGE_PAD_NAME, + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate vidsrc_template = +GST_STATIC_PAD_TEMPLATE (GST_BASE_CAMERA_SRC_VIDEO_PAD_NAME, + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + static void set_capsfilter_caps (GstWrapperCameraBinSrc * self, GstCaps * new_caps); @@ -1126,6 +1144,15 @@ gst_wrapper_camera_bin_src_class_init (GstWrapperCameraBinSrcClass * klass) GST_DEBUG_CATEGORY_INIT (wrapper_camera_bin_src_debug, "wrappercamerabinsrc", 0, "wrapper camera src"); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&vfsrc_template)); + + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&imgsrc_template)); + + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&vidsrc_template)); + gst_element_class_set_details_simple (gstelement_class, "Wrapper camera src element for camerabin2", "Source/Video", "Wrapper camera src element for camerabin2",