mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
Revert previous changes to the behaviour of GstPadTemplates, etc and the possiblity to call them in class_init as it ...
Original commit message from CVS: * 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.
This commit is contained in:
parent
b6a0640cf9
commit
2faa733276
20 changed files with 231 additions and 370 deletions
45
ChangeLog
45
ChangeLog
|
@ -1,3 +1,48 @@
|
|||
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:
|
||||
|
|
24
gst/gstbin.c
24
gst/gstbin.c
|
@ -185,13 +185,6 @@ static gboolean enable_latency = TRUE;
|
|||
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)
|
||||
|
@ -268,6 +261,7 @@ enum
|
|||
/* 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);
|
||||
|
@ -289,7 +283,7 @@ gst_bin_get_type (void)
|
|||
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,
|
||||
|
@ -326,6 +320,18 @@ gst_bin_get_type (void)
|
|||
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)
|
||||
|
@ -429,8 +435,6 @@ gst_bin_class_init (GstBinClass * klass)
|
|||
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);
|
||||
|
|
|
@ -238,34 +238,18 @@ static void
|
|||
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 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
|
||||
*/
|
||||
/* 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;
|
||||
memset (&element_class->details, 0, sizeof (GstElementDetails));
|
||||
element_class->padtemplates = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1127,38 +1111,28 @@ gst_element_iterate_sink_pads (GstElement * element)
|
|||
* @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;
|
||||
/* 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);
|
||||
|
||||
/* 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);
|
||||
klass->padtemplates = g_list_append (klass->padtemplates,
|
||||
gst_object_ref (templ));
|
||||
klass->numpadtemplates++;
|
||||
}
|
||||
|
||||
|
@ -1168,7 +1142,7 @@ gst_element_class_add_pad_template (GstElementClass * klass,
|
|||
* @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.
|
||||
*/
|
||||
|
@ -1196,7 +1170,7 @@ gst_element_class_set_details (GstElementClass * klass,
|
|||
*
|
||||
* 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.
|
||||
|
|
|
@ -78,13 +78,13 @@
|
|||
* </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));
|
||||
|
@ -175,6 +175,10 @@ gst_pad_template_class_init (GstPadTemplateClass * klass)
|
|||
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.
|
||||
|
|
|
@ -90,12 +90,6 @@
|
|||
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
|
||||
{
|
||||
|
@ -128,6 +122,7 @@ struct _GstPipelinePrivate
|
|||
};
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
@ -155,7 +150,7 @@ gst_pipeline_get_type (void)
|
|||
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,
|
||||
|
@ -175,6 +170,17 @@ gst_pipeline_get_type (void)
|
|||
return pipeline_type;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -222,8 +228,6 @@ gst_pipeline_class_init (gpointer g_class, gpointer class_data)
|
|||
|
||||
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 =
|
||||
|
|
|
@ -36,12 +36,12 @@
|
|||
*
|
||||
* #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"
|
||||
|
|
|
@ -250,6 +250,7 @@ struct _GstBaseSrcPrivate
|
|||
|
||||
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);
|
||||
|
@ -263,7 +264,7 @@ gst_base_src_get_type (void)
|
|||
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,
|
||||
|
@ -318,6 +319,12 @@ static GstFlowReturn gst_base_src_pad_get_range (GstPad * pad, guint64 offset,
|
|||
static GstFlowReturn gst_base_src_get_range (GstBaseSrc * src, guint64 offset,
|
||||
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)
|
||||
{
|
||||
|
@ -327,8 +334,6 @@ gst_base_src_class_init (GstBaseSrcClass * klass)
|
|||
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);
|
||||
|
|
|
@ -62,6 +62,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_capsfilter_debug);
|
|||
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,
|
||||
|
@ -80,6 +81,17 @@ static gboolean gst_capsfilter_transform_size (GstBaseTransform * trans,
|
|||
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
|
||||
|
@ -87,7 +99,6 @@ gst_capsfilter_class_init (GstCapsFilterClass * klass)
|
|||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstBaseTransformClass *trans_class;
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
gobject_class->set_property = gst_capsfilter_set_property;
|
||||
|
@ -100,17 +111,6 @@ gst_capsfilter_class_init (GstCapsFilterClass * klass)
|
|||
"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;
|
||||
|
|
|
@ -129,6 +129,17 @@ static guint gst_fake_sink_signals[LAST_SIGNAL] = { 0 };
|
|||
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
|
||||
|
@ -209,16 +220,6 @@ gst_fake_sink_class_init (GstFakeSinkClass * klass)
|
|||
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);
|
||||
|
||||
|
|
|
@ -229,6 +229,15 @@ static guint gst_fake_src_signals[LAST_SIGNAL] = { 0 };
|
|||
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
|
||||
|
@ -328,14 +337,6 @@ gst_fake_src_class_init (GstFakeSrcClass * klass)
|
|||
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);
|
||||
|
|
|
@ -140,13 +140,20 @@ static gboolean gst_fd_sink_unlock_stop (GstBaseSink * basesink);
|
|||
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);
|
||||
|
@ -156,13 +163,6 @@ gst_fd_sink_class_init (GstFdSinkClass * 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);
|
||||
|
|
|
@ -123,6 +123,14 @@ static GstFlowReturn gst_fd_src_create (GstPushSrc * psrc, GstBuffer ** outbuf);
|
|||
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
|
||||
|
@ -148,13 +156,6 @@ gst_fd_src_class_init (GstFdSrcClass * klass)
|
|||
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);
|
||||
|
|
|
@ -137,13 +137,19 @@ GST_BOILERPLATE_FULL (GstFileSink, gst_file_sink, GstBaseSink,
|
|||
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;
|
||||
|
@ -165,12 +171,6 @@ gst_file_sink_class_init (GstFileSinkClass * klass)
|
|||
"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);
|
||||
|
|
|
@ -180,6 +180,15 @@ GST_BOILERPLATE_FULL (GstFileSrc, gst_file_src, GstBaseSrc, GST_TYPE_BASE_SRC,
|
|||
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
|
||||
|
@ -241,14 +250,6 @@ gst_file_src_class_init (GstFileSrcClass * klass)
|
|||
|
||||
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);
|
||||
|
|
|
@ -115,6 +115,16 @@ static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
|
|||
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
|
||||
|
@ -249,15 +259,6 @@ gst_identity_class_init (GstIdentityClass * klass)
|
|||
|
||||
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);
|
||||
|
|
|
@ -249,6 +249,15 @@ static guint gst_multi_queue_signals[LAST_SIGNAL] = { 0 };
|
|||
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
|
||||
|
@ -303,14 +312,6 @@ gst_multi_queue_class_init (GstMultiQueueClass * klass)
|
|||
|
||||
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 =
|
||||
|
|
|
@ -235,6 +235,15 @@ static guint gst_queue_signals[LAST_SIGNAL] = { 0 };
|
|||
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
|
||||
|
@ -345,14 +354,6 @@ gst_queue_class_init (GstQueueClass * klass)
|
|||
/* 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,19 @@ static GstFlowReturn gst_tee_src_get_range (GstPad * pad, guint64 offset,
|
|||
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
|
||||
|
@ -175,18 +188,6 @@ gst_tee_class_init (GstTeeClass * klass)
|
|||
"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);
|
||||
|
|
|
@ -161,6 +161,17 @@ gst_type_find_element_have_type (GstTypeFindElement * typefind,
|
|||
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
|
||||
|
@ -205,16 +216,6 @@ gst_type_find_element_class_init (GstTypeFindElementClass * typefind_class)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -205,189 +205,6 @@ GST_START_TEST (test_class)
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -401,7 +218,6 @@ 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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue