+2008-02-05 Sebastian Dröge <slomo@circular-chaos.org>
+
+ * gst/gstbin.c: (gst_bin_get_type), (gst_bin_base_init),
+ (gst_bin_class_init):
+ * gst/gstelement.c: (gst_element_base_class_init),
+ (gst_element_class_add_pad_template):
+ * gst/gstpadtemplate.c: (gst_pad_template_init):
+ * gst/gstpipeline.c: (gst_pipeline_get_type),
+ (gst_pipeline_base_init), (gst_pipeline_class_init):
+ * libs/gst/base/gstbasesink.c:
+ * libs/gst/base/gstbasesrc.c: (gst_base_src_get_type),
+ (gst_base_src_base_init), (gst_base_src_class_init):
+ * plugins/elements/gstcapsfilter.c: (gst_capsfilter_base_init),
+ (gst_capsfilter_class_init):
+ * plugins/elements/gstfakesink.c: (gst_fake_sink_base_init),
+ (gst_fake_sink_class_init):
+ * plugins/elements/gstfakesrc.c: (gst_fake_src_base_init),
+ (gst_fake_src_class_init):
+ * plugins/elements/gstfdsink.c: (gst_fd_sink_base_init),
+ (gst_fd_sink_class_init):
+ * plugins/elements/gstfdsrc.c: (gst_fd_src_base_init),
+ (gst_fd_src_class_init):
+ * plugins/elements/gstfilesink.c: (gst_file_sink_base_init),
+ (gst_file_sink_class_init):
+ * plugins/elements/gstfilesrc.c: (gst_file_src_base_init),
+ (gst_file_src_class_init):
+ * plugins/elements/gstidentity.c: (gst_identity_base_init),
+ (gst_identity_class_init):
+ * plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init),
+ (gst_multi_queue_class_init):
+ * plugins/elements/gstqueue.c: (gst_queue_base_init),
+ (gst_queue_class_init):
+ * plugins/elements/gsttee.c: (gst_tee_base_init),
+ (gst_tee_class_init):
+ * plugins/elements/gsttypefindelement.c:
+ (gst_type_find_element_base_init),
+ (gst_type_find_element_class_init):
+ * tests/check/gst/gstelement.c: (gst_element_suite):
+ Revert previous changes to the behaviour of GstPadTemplates, etc
+ and the possiblity to call them in class_init as it breaks too
+ many elements. Reopens bug #491501.
+
+ Should be applied again for 0.11, thus added a few FIXME 0.11 at
+ several places.
+
2008-02-05 Stefan Kost <ensonic@users.sf.net>
* tools/gst-launch.c:
GST_DEBUG_CATEGORY_STATIC (bin_debug);
#define GST_CAT_DEFAULT bin_debug
-static const GstElementDetails gst_bin_details =
-GST_ELEMENT_DETAILS ("Generic bin",
- "Generic/Bin",
- "Simple container object",
- "Erik Walthinsen <omega@cse.ogi.edu>,"
- "Wim Taymans <wim.taymans@gmail.com>");
-
/* a bin is toplevel if it has no parent or when it is configured to behave like
* a toplevel bin */
#define BIN_IS_TOPLEVEL(bin) ((GST_OBJECT_PARENT (bin) == NULL) || bin->priv->asynchandling)
/* FILL ME */
};
+static void gst_bin_base_init (gpointer g_class);
static void gst_bin_class_init (GstBinClass * klass);
static void gst_bin_init (GstBin * bin);
static void gst_bin_child_proxy_init (gpointer g_iface, gpointer iface_data);
if (G_UNLIKELY (gst_bin_type == 0)) {
static const GTypeInfo bin_info = {
sizeof (GstBinClass),
- NULL,
+ gst_bin_base_init,
NULL,
(GClassInitFunc) gst_bin_class_init,
NULL,
return gst_bin_type;
}
+static void
+gst_bin_base_init (gpointer g_class)
+{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class, "Generic bin",
+ "Generic/Bin",
+ "Simple container object",
+ "Erik Walthinsen <omega@cse.ogi.edu>,"
+ "Wim Taymans <wim.taymans@gmail.com>");
+}
+
static GstObject *
gst_bin_child_proxy_get_child_by_index (GstChildProxy * child_proxy,
guint index)
GST_DEBUG_FUNCPTR (gst_bin_restore_thyself);
#endif
- gst_element_class_set_details (gstelement_class, &gst_bin_details);
-
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_bin_change_state_func);
gstelement_class->get_state = GST_DEBUG_FUNCPTR (gst_bin_get_state_func);
gst_element_base_class_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GList *node, *padtemplates;
-
- /* Copy the element details here so elements can inherit the
- * details from their base class and classes only need to set
- * the details in class_init instead of base_init */
- /* FIXME: We probably need something like for copying
- * the details at a central place */
- element_class->details.longname = g_strdup (element_class->details.longname);
- element_class->details.klass = g_strdup (element_class->details.klass);
- element_class->details.description =
- g_strdup (element_class->details.description);
- element_class->details.author = g_strdup (element_class->details.author);
-
- /* Copy the pad templates so elements inherit them
- * from their base class but elements can add pad templates in class_init
- * instead of base_init.
- */
- /* FIXME: Do we consider GstPadTemplates as immutable? If so we can
- * simply ref them instead of copying.
- */
- padtemplates = g_list_copy (element_class->padtemplates);
- for (node = padtemplates; node != NULL; node = node->next) {
- GstPadTemplate *tmpl = (GstPadTemplate *) node->data;
- node->data = gst_pad_template_new (tmpl->name_template,
- tmpl->direction, tmpl->presence, gst_caps_copy (tmpl->caps));
- }
- element_class->padtemplates = padtemplates;
+ /* FIXME 0.11: Copy the element details and instead of clearing the
+ * pad template list copy the list and increase the refcount of
+ * the pad templates by one.
+ *
+ * This will make it possible to add pad templates and set element
+ * details in the class_init functions and is the real GObject way
+ * of doing things.
+ * See http://bugzilla.gnome.org/show_bug.cgi?id=491501
+ */
+ memset (&element_class->details, 0, sizeof (GstElementDetails));
+ element_class->padtemplates = NULL;
}
static void
* @klass: the #GstElementClass to add the pad template to.
* @templ: a #GstPadTemplate to add to the element class.
*
- * Adds a padtemplate to an element class. This is mainly used in the
- * _class_init functions of classes. If a pad template with the same
- * name as an already existing one is added the old one is replaced
- * by the new one.
- *
- * This function takes the ownership of the #GstPadTemplate.
+ * Adds a padtemplate to an element class. This is mainly used in the _base_init
+ * functions of classes.
*/
void
gst_element_class_add_pad_template (GstElementClass * klass,
GstPadTemplate * templ)
{
- GList *template_list = klass->padtemplates;
-
g_return_if_fail (GST_IS_ELEMENT_CLASS (klass));
g_return_if_fail (GST_IS_PAD_TEMPLATE (templ));
- /* If we already have a pad template with the same name replace the
- * old one. */
- while (template_list) {
- GstPadTemplate *padtempl = (GstPadTemplate *) template_list->data;
-
- /* Found pad with the same name, replace and return */
- if (strcmp (templ->name_template, padtempl->name_template) == 0) {
- gst_object_unref (padtempl);
- template_list->data = templ;
- return;
- }
- template_list = g_list_next (template_list);
- }
-
- /* Not found a pad with the same name so add it to the list */
- klass->padtemplates = g_list_append (klass->padtemplates, templ);
+ /* FIXME 0.11: allow replacing the pad templates by
+ * calling this with the same name as an already existing pad
+ * template. For this we _must_ _not_ ref the added pad template
+ * a second time and _must_ document that this function takes
+ * ownership of the pad template. Otherwise we will leak pad templates
+ * or the caller unref's the pad template and it disappears */
+ /* avoid registering pad templates with the same name */
+ g_return_if_fail (gst_element_class_get_pad_template (klass,
+ templ->name_template) == NULL);
+
+ klass->padtemplates = g_list_append (klass->padtemplates,
+ gst_object_ref (templ));
klass->numpadtemplates++;
}
* @details: details to set
*
* Sets the detailed information for a #GstElementClass.
- * <note>This function is for use in _class_init functions only.</note>
+ * <note>This function is for use in _base_init functions only.</note>
*
* The @details are copied.
*/
*
* Sets the detailed information for a #GstElementClass. Simpler version of
* gst_element_class_set_details() that generates less linker overhead.
- * <note>This function is for use in _class_init functions only.</note>
+ * <note>This function is for use in _base_init functions only.</note>
*
* The detail parameter strings are copied into the #GstElementDetails for
* the element class.
* </example>
*
* The following example shows you how to add the padtemplate to an
- * element class, this is usually done in the class_init of the class:
+ * element class, this is usually done in the base_init of the class:
* <informalexample>
* <programlisting>
* static void
- * my_element_class_init (GstMyElementClass *klass)
+ * my_element_base_init (gpointer g_class)
* {
- * GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
+ * GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
*
* gst_element_class_add_pad_template (gstelement_class,
* gst_static_pad_template_get (&my_template));
static void
gst_pad_template_init (GstPadTemplate * templ, GstPadTemplateClass * klass)
{
+ /* FIXME 0.11: Does anybody remember why this is here? If not, let's
+ * change it for 0.11 and let gst_element_class_add_pad_template() for
+ * example ref/sink the pad templates.
+ */
/* We ensure that the pad template we're creating has a sunken reference.
* Inconsistencies in pad templates being floating or sunken has caused
* problems in the past with leaks, etc.
GST_DEBUG_CATEGORY_STATIC (pipeline_debug);
#define GST_CAT_DEFAULT pipeline_debug
-static const GstElementDetails gst_pipeline_details =
-GST_ELEMENT_DETAILS ("Pipeline object",
- "Generic/Bin",
- "Complete pipeline object",
- "Erik Walthinsen <omega@cse.ogi.edu>, Wim Taymans <wim@fluendo.com>");
-
/* Pipeline signals and args */
enum
{
};
+static void gst_pipeline_base_init (gpointer g_class);
static void gst_pipeline_class_init (gpointer g_class, gpointer class_data);
static void gst_pipeline_init (GTypeInstance * instance, gpointer g_class);
if (G_UNLIKELY (pipeline_type == 0)) {
static const GTypeInfo pipeline_info = {
sizeof (GstPipelineClass),
- NULL,
+ gst_pipeline_base_init,
NULL,
(GClassInitFunc) gst_pipeline_class_init,
NULL,
}
static void
+gst_pipeline_base_init (gpointer g_class)
+{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class, "Pipeline object",
+ "Generic/Bin",
+ "Complete pipeline object",
+ "Erik Walthinsen <omega@cse.ogi.edu>, Wim Taymans <wim@fluendo.com>");
+}
+
+static void
gst_pipeline_class_init (gpointer g_class, gpointer class_data)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (g_class);
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_pipeline_dispose);
- gst_element_class_set_details (gstelement_class, &gst_pipeline_details);
-
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_pipeline_change_state);
gstelement_class->provide_clock =
*
* #GstBaseSink provides support for exactly one sink pad, which should be
* named "sink". A sink implementation (subclass of #GstBaseSink) should
- * install a pad template in its class_init function, like so:
+ * install a pad template in its base_init function, like so:
* <programlisting>
* static void
- * my_element_class_init (GstMyElementClass *klass)
+ * my_element_base_init (gpointer g_class)
* {
- * GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
+ * GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
*
* // sinktemplate should be a #GstStaticPadTemplate with direction
* // #GST_PAD_SINK and name "sink"
static GstElementClass *parent_class = NULL;
+static void gst_base_src_base_init (gpointer g_class);
static void gst_base_src_class_init (GstBaseSrcClass * klass);
static void gst_base_src_init (GstBaseSrc * src, gpointer g_class);
static void gst_base_src_finalize (GObject * object);
if (G_UNLIKELY (base_src_type == 0)) {
static const GTypeInfo base_src_info = {
sizeof (GstBaseSrcClass),
- NULL,
+ (GBaseInitFunc) gst_base_src_base_init,
NULL,
(GClassInitFunc) gst_base_src_class_init,
NULL,
guint length, GstBuffer ** buf);
static void
+gst_base_src_base_init (gpointer g_class)
+{
+ GST_DEBUG_CATEGORY_INIT (gst_base_src_debug, "basesrc", 0, "basesrc element");
+}
+
+static void
gst_base_src_class_init (GstBaseSrcClass * klass)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
gstelement_class = GST_ELEMENT_CLASS (klass);
- GST_DEBUG_CATEGORY_INIT (gst_base_src_debug, "basesrc", 0, "basesrc element");
-
g_type_class_add_private (klass, sizeof (GstBaseSrcPrivate));
parent_class = g_type_class_peek_parent (klass);
GST_BOILERPLATE_FULL (GstCapsFilter, gst_capsfilter, GstBaseTransform,
GST_TYPE_BASE_TRANSFORM, _do_init);
+
static void gst_capsfilter_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_capsfilter_get_property (GObject * object, guint prop_id,
static void
gst_capsfilter_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "CapsFilter",
+ "Generic",
+ "Pass data without modification, limiting formats",
+ "David Schleef <ds@schleef.org>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&srctemplate));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sinktemplate));
}
static void
{
GObjectClass *gobject_class;
GstBaseTransformClass *trans_class;
- GstElementClass *gstelement_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = gst_capsfilter_set_property;
"Setting this property takes a reference to the supplied GstCaps "
"object."), GST_TYPE_CAPS, G_PARAM_READWRITE));
- gstelement_class = GST_ELEMENT_CLASS (klass);
- gst_element_class_set_details_simple (gstelement_class,
- "CapsFilter",
- "Generic",
- "Pass data without modification, limiting formats",
- "David Schleef <ds@schleef.org>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&srctemplate));
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&sinktemplate));
-
trans_class = GST_BASE_TRANSFORM_CLASS (klass);
trans_class->transform_caps = gst_capsfilter_transform_caps;
trans_class->transform_ip = gst_capsfilter_transform_ip;
static void
gst_fake_sink_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "Fake Sink",
+ "Sink",
+ "Black hole for data",
+ "Erik Walthinsen <omega@cse.ogi.edu>, "
+ "Wim Taymans <wim@fluendo.com>, "
+ "Mr. 'frag-me-more' Vanderwingo <wingo@fluendo.com>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sinktemplate));
}
static void
NULL, NULL, gst_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2,
GST_TYPE_BUFFER, GST_TYPE_PAD);
- gst_element_class_set_details_simple (gstelement_class,
- "Fake Sink",
- "Sink",
- "Black hole for data",
- "Erik Walthinsen <omega@cse.ogi.edu>, "
- "Wim Taymans <wim@fluendo.com>, "
- "Mr. 'frag-me-more' Vanderwingo <wingo@fluendo.com>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&sinktemplate));
-
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_fake_sink_change_state);
static void
gst_fake_src_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "Fake Source",
+ "Source",
+ "Push empty (no data) buffers around",
+ "Erik Walthinsen <omega@cse.ogi.edu>, " "Wim Taymans <wim@fluendo.com>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&srctemplate));
}
static void
gst_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, GST_TYPE_BUFFER,
GST_TYPE_PAD);
- gst_element_class_set_details_simple (gstelement_class,
- "Fake Source",
- "Source",
- "Push empty (no data) buffers around",
- "Erik Walthinsen <omega@cse.ogi.edu>, " "Wim Taymans <wim@fluendo.com>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&srctemplate));
-
gstbase_src_class->is_seekable = GST_DEBUG_FUNCPTR (gst_fake_src_is_seekable);
gstbase_src_class->start = GST_DEBUG_FUNCPTR (gst_fake_src_start);
gstbase_src_class->stop = GST_DEBUG_FUNCPTR (gst_fake_src_stop);
static void
gst_fd_sink_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "Filedescriptor Sink",
+ "Sink/File",
+ "Write data to a file descriptor", "Erik Walthinsen <omega@cse.ogi.edu>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sinktemplate));
}
static void
gst_fd_sink_class_init (GstFdSinkClass * klass)
{
GObjectClass *gobject_class;
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
GstBaseSinkClass *gstbasesink_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->get_property = gst_fd_sink_get_property;
gobject_class->dispose = gst_fd_sink_dispose;
- gst_element_class_set_details_simple (gstelement_class,
- "Filedescriptor Sink",
- "Sink/File",
- "Write data to a file descriptor", "Erik Walthinsen <omega@cse.ogi.edu>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&sinktemplate));
-
gstbasesink_class->get_times = NULL;
gstbasesink_class->render = GST_DEBUG_FUNCPTR (gst_fd_sink_render);
gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_fd_sink_start);
static void
gst_fd_src_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "Filedescriptor Source",
+ "Source/File",
+ "Read from a file descriptor", "Erik Walthinsen <omega@cse.ogi.edu>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&srctemplate));
}
static void
g_param_spec_int ("fd", "fd", "An open file descriptor to read from",
0, G_MAXINT, 0, G_PARAM_READWRITE));
- gst_element_class_set_details_simple (gstelement_class,
- "Filedescriptor Source",
- "Source/File",
- "Read from a file descriptor", "Erik Walthinsen <omega@cse.ogi.edu>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&srctemplate));
-
gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_fd_src_start);
gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_fd_src_stop);
gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_fd_src_unlock);
static void
gst_file_sink_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "File Sink",
+ "Sink/File", "Write stream to a file", "Thomas <thomas@apestaart.org>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sinktemplate));
}
static void
gst_file_sink_class_init (GstFileSinkClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
GstBaseSinkClass *gstbasesink_class = GST_BASE_SINK_CLASS (klass);
gobject_class->dispose = gst_file_sink_dispose;
"Size of buffer in number of bytes for line or full buffer-mode", 0,
G_MAXUINT, DEFAULT_BUFFER_SIZE, G_PARAM_READWRITE));
- gst_element_class_set_details_simple (gstelement_class,
- "File Sink",
- "Sink/File", "Write stream to a file", "Thomas <thomas@apestaart.org>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&sinktemplate));
-
gstbasesink_class->get_times = NULL;
gstbasesink_class->start = GST_DEBUG_FUNCPTR (gst_file_sink_start);
gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_file_sink_stop);
static void
gst_file_src_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "File Source",
+ "Source/File",
+ "Read from arbitrary point in a file",
+ "Erik Walthinsen <omega@cse.ogi.edu>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&srctemplate));
}
static void
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_file_src_finalize);
- gst_element_class_set_details_simple (gstelement_class,
- "File Source",
- "Source/File",
- "Read from arbitrary point in a file",
- "Erik Walthinsen <omega@cse.ogi.edu>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&srctemplate));
-
gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_file_src_start);
gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_file_src_stop);
gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_file_src_is_seekable);
static void
gst_identity_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "Identity",
+ "Generic",
+ "Pass data without modification", "Erik Walthinsen <omega@cse.ogi.edu>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&srctemplate));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sinktemplate));
}
static void
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_identity_finalize);
- gst_element_class_set_details_simple (gstelement_class,
- "Identity",
- "Generic",
- "Pass data without modification", "Erik Walthinsen <omega@cse.ogi.edu>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&srctemplate));
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&sinktemplate));
-
gstbasetrans_class->event = GST_DEBUG_FUNCPTR (gst_identity_event);
gstbasetrans_class->transform_ip =
GST_DEBUG_FUNCPTR (gst_identity_transform_ip);
static void
gst_multi_queue_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "MultiQueue",
+ "Generic", "Multiple data queue", "Edward Hervey <edward@fluendo.com>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sinktemplate));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&srctemplate));
}
static void
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_multi_queue_finalize);
- gst_element_class_set_details_simple (gstelement_class,
- "MultiQueue",
- "Generic", "Multiple data queue", "Edward Hervey <edward@fluendo.com>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&sinktemplate));
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&srctemplate));
-
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_multi_queue_request_new_pad);
gstelement_class->release_pad =
static void
gst_queue_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "Queue",
+ "Generic", "Simple data queue", "Erik Walthinsen <omega@cse.ogi.edu>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&srctemplate));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sinktemplate));
}
static void
/* set several parent class virtual functions */
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_queue_finalize);
- gst_element_class_set_details_simple (gstelement_class,
- "Queue",
- "Generic", "Simple data queue", "Erik Walthinsen <omega@cse.ogi.edu>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&srctemplate));
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&sinktemplate));
-
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_queue_change_state);
}
static void
gst_tee_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "Tee pipe fitting",
+ "Generic",
+ "1-to-N pipe fitting",
+ "Erik Walthinsen <omega@cse.ogi.edu>, " "Wim Taymans <wim@fluendo.com>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sinktemplate));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&tee_src_template));
+
+ push_data = g_quark_from_static_string ("tee-push-data");
}
static void
"Behavior of tee in pull mode", GST_TYPE_TEE_PULL_MODE,
DEFAULT_PULL_MODE, G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
- gst_element_class_set_details_simple (gstelement_class,
- "Tee pipe fitting",
- "Generic",
- "1-to-N pipe fitting",
- "Erik Walthinsen <omega@cse.ogi.edu>, " "Wim Taymans <wim@fluendo.com>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&sinktemplate));
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&tee_src_template));
-
- push_data = g_quark_from_static_string ("tee-push-data");
-
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_tee_request_new_pad);
gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_tee_release_pad);
static void
gst_type_find_element_base_init (gpointer g_class)
{
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "TypeFind",
+ "Generic",
+ "Finds the media type of a stream",
+ "Benjamin Otte <in7y118@public.uni-hamburg.de>");
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&type_find_element_src_template));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&type_find_element_sink_template));
}
static void
gst_marshal_VOID__UINT_BOXED, G_TYPE_NONE, 2,
G_TYPE_UINT, GST_TYPE_CAPS | G_SIGNAL_TYPE_STATIC_SCOPE);
- gst_element_class_set_details_simple (gstelement_class,
- "TypeFind",
- "Generic",
- "Finds the media type of a stream",
- "Benjamin Otte <in7y118@public.uni-hamburg.de>");
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&type_find_element_src_template));
- gst_element_class_add_pad_template (gstelement_class,
- gst_static_pad_template_get (&type_find_element_sink_template));
-
gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_type_find_element_change_state);
}
GST_END_TEST;
-typedef struct _GstTestElement
-{
- GstElement parent;
-
-} GstTestElement;
-
-typedef struct _GstTestElementClass
-{
- GstElementClass parent;
-
-} GstTestElementClass;
-
-static void
-gst_test_element_class_init (GstTestElementClass * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- GstPadTemplate *templ;
-
- gst_element_class_set_details_simple (element_class, "Test element",
- "Element", "Does nothing", "Foo Bar <foo@bar.com>");
-
- fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list
- (element_class)), 0);
-
- fail_unless (gst_element_class_get_pad_template (element_class,
- "test") == NULL);
-
- gst_element_class_add_pad_template (element_class,
- gst_pad_template_new ("test", GST_PAD_SRC, GST_PAD_ALWAYS, GST_CAPS_ANY));
-
- fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list
- (element_class)), 1);
-
- fail_unless ((templ =
- gst_element_class_get_pad_template (element_class, "test")) != NULL);
- fail_unless (gst_caps_is_any (templ->caps));
-
- gst_element_class_add_pad_template (element_class,
- gst_pad_template_new ("test2", GST_PAD_SRC, GST_PAD_ALWAYS,
- GST_CAPS_ANY));
-
- fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list
- (element_class)), 2);
-
- fail_unless ((templ =
- gst_element_class_get_pad_template (element_class, "test2")) != NULL);
- fail_unless (gst_caps_is_any (templ->caps));
-
- /* Add "test" again, with NONE caps this time */
- gst_element_class_add_pad_template (element_class,
- gst_pad_template_new ("test", GST_PAD_SRC, GST_PAD_ALWAYS,
- GST_CAPS_NONE));
-
- fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list
- (element_class)), 2);
-
- fail_unless ((templ =
- gst_element_class_get_pad_template (element_class, "test")) != NULL);
- fail_unless (gst_caps_is_empty (templ->caps));
-}
-
-GType
-gst_test_element_get_type (void)
-{
- static GType gst_test_element_type = G_TYPE_NONE;
-
- if (gst_test_element_type == G_TYPE_NONE) {
- static const GTypeInfo gst_test_element_info = {
- sizeof (GstTestElementClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gst_test_element_class_init,
- NULL,
- NULL,
- sizeof (GstTestElement),
- 0,
- NULL, /* instance_init */
- NULL
- };
-
- gst_test_element_type = g_type_register_static (GST_TYPE_ELEMENT,
- "GstTestElement", &gst_test_element_info, 0);
- }
- return gst_test_element_type;
-}
-
-typedef struct _GstTestElement2
-{
- GstTestElement parent;
-
-} GstTestElement2;
-
-typedef struct _GstTestElement2Class
-{
- GstTestElementClass parent;
-
-} GstTestElement2Class;
-
-static void
-gst_test_element2_class_init (GstTestElement2Class * klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
- GstPadTemplate *templ;
-
- gst_element_class_set_details_simple (element_class, "Test element 2",
- "Element", "Does nothing", "Foo Bar <foo@bar.com>");
-
- fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list
- (element_class)), 2);
-
- fail_unless ((templ =
- gst_element_class_get_pad_template (element_class, "test")) != NULL);
- fail_unless (gst_caps_is_empty (templ->caps));
-
- fail_unless ((templ =
- gst_element_class_get_pad_template (element_class, "test2")) != NULL);
- fail_unless (gst_caps_is_any (templ->caps));
-
- /* Add "test" pad with ANY caps, should have "test" pad with EMPTY caps before */
- gst_element_class_add_pad_template (element_class,
- gst_pad_template_new ("test", GST_PAD_SRC, GST_PAD_ALWAYS, GST_CAPS_ANY));
-
- fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list
- (element_class)), 2);
-
- fail_unless ((templ =
- gst_element_class_get_pad_template (element_class, "test")) != NULL);
- fail_unless (gst_caps_is_any (templ->caps));
-
-
- gst_element_class_add_pad_template (element_class,
- gst_pad_template_new ("test4", GST_PAD_SRC, GST_PAD_ALWAYS,
- GST_CAPS_ANY));
-
- fail_unless_equals_int (g_list_length (gst_element_class_get_pad_template_list
- (element_class)), 3);
-
- fail_unless ((templ =
- gst_element_class_get_pad_template (element_class, "test4")) != NULL);
- fail_unless (gst_caps_is_any (templ->caps));
-}
-
-GType
-gst_test_element2_get_type (void)
-{
- static GType gst_test_element2_type = G_TYPE_NONE;
-
- if (gst_test_element2_type == G_TYPE_NONE) {
- static const GTypeInfo gst_test_element2_info = {
- sizeof (GstTestElement2Class),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gst_test_element2_class_init,
- NULL,
- NULL,
- sizeof (GstTestElement2),
- 0,
- NULL, /* instance_init */
- NULL
- };
-
- gst_test_element2_type =
- g_type_register_static (gst_test_element_get_type (), "GstTestElement2",
- &gst_test_element2_info, 0);
- }
- return gst_test_element2_type;
-}
-
-
-GST_START_TEST (test_pad_templates)
-{
- GstTestElement *test;
- GstTestElement2 *test2;
-
- test = g_object_new (gst_test_element_get_type (), NULL);
- test2 = g_object_new (gst_test_element2_get_type (), NULL);
-
- g_object_unref (test);
- g_object_unref (test2);
-}
-
-GST_END_TEST;
-
Suite *
gst_element_suite (void)
{
tcase_add_test (tc_chain, test_link);
tcase_add_test (tc_chain, test_link_no_pads);
tcase_add_test (tc_chain, test_class);
- tcase_add_test (tc_chain, test_pad_templates);
return s;
}