summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorYouness Alaoui <youness.alaoui@collabora.co.uk>2012-05-03 19:11:57 -0400
committerThiago Santos <thiago.sousa.santos@collabora.com>2012-05-04 19:50:52 -0300
commitd3303121c87af5f42b3d745db22e26f0a0c8eb02 (patch)
treeeb0bd022e300bfabc94bc3f39613cfe20481cfb8 /gst-libs
parent99b6f14486e069dc02d7c4090417aebd104bd291 (diff)
downloadgstreamer-plugins-bad-d3303121c87af5f42b3d745db22e26f0a0c8eb02.tar.gz
basecamerabin: Do not set the pad templates in the base class.
It is best to let the subclass define the pad templates, this would allow the subclass to decide which caps the pads should have.
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c51
1 files changed, 23 insertions, 28 deletions
diff --git a/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c b/gst-libs/gst/basecamerabinsrc/gstbasecamerasrc.c
index 42d13435a..199bf081d 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,
+ * &amp;vidsrc_template);
+ * gst_element_class_add_static_pad_template (gstelement_class,
+ * &amp;imgsrc_template);
+ * gst_element_class_add_static_pad_template (gstelement_class,
+ * &amp;vfsrc_template);
+ * // see #GstElementDetails
+ * gst_element_class_set_details (gstelement_class, &amp;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 <rob@ti.com>");
-
- 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