handle removal of template factories

Original commit message from CVS:
handle removal of template factories
This commit is contained in:
David Schleef 2003-12-11 05:35:28 +00:00
parent 87dc453757
commit 72534d09df
4 changed files with 22 additions and 14 deletions

View file

@ -65,11 +65,12 @@ enum {
};
/* generic templates */
GST_PAD_TEMPLATE_FACTORY (spider_src_factory,
static GstStaticPadTemplate spider_src_factory =
GST_STATIC_PAD_TEMPLATE (
"src_%d",
GST_PAD_SRC,
GST_PAD_REQUEST,
NULL /* no caps */
GST_STATIC_CAPS2_ANY
);
/* standard GObject stuff */
@ -152,7 +153,8 @@ gst_spider_class_init (GstSpiderClass *klass)
gobject_class->get_property = gst_spider_get_property;
gobject_class->dispose = gst_spider_dispose;
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (spider_src_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&spider_src_factory));
gst_element_class_set_details (gstelement_class, &gst_spider_details);
gstelement_class->request_new_pad = GST_DEBUG_FUNCPTR(gst_spider_request_new_pad);

View file

@ -41,18 +41,20 @@ static GstElementDetails gst_spider_identity_details = GST_ELEMENT_DETAILS (
/* generic templates
* delete me when meging with spider.c
*/
GST_PAD_TEMPLATE_FACTORY (spider_src_factory,
static GstStaticPadTemplate spider_src_factory =
GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
NULL /* no caps */
GST_STATIC_CAPS2_ANY
);
GST_PAD_TEMPLATE_FACTORY (spider_sink_factory,
static GstStaticPadTemplate spider_sink_factory =
GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
NULL /* no caps */
GST_STATIC_CAPS2_ANY
);
/* SpiderIdentity signals and args */
@ -121,8 +123,10 @@ gst_spider_identity_class_init (GstSpiderIdentityClass *klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
/* add our two pad templates */
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (spider_src_factory));
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (spider_sink_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&spider_src_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&spider_sink_factory));
gst_element_class_set_details (gstelement_class, &gst_spider_identity_details);
gstelement_class->change_state = GST_DEBUG_FUNCPTR(gst_spider_identity_change_state);
@ -143,13 +147,15 @@ static void
gst_spider_identity_init (GstSpiderIdentity *ident)
{
/* sink */
ident->sink = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (spider_sink_factory), "sink");
ident->sink = gst_pad_new_from_template (
gst_static_pad_template_get (&spider_sink_factory), "sink");
gst_element_add_pad (GST_ELEMENT (ident), ident->sink);
gst_pad_set_link_function (ident->sink, GST_DEBUG_FUNCPTR (gst_spider_identity_link));
gst_pad_set_getcaps_function (ident->sink, GST_DEBUG_FUNCPTR (gst_spider_identity_getcaps));
gst_pad_set_bufferpool_function (ident->sink, GST_DEBUG_FUNCPTR (gst_spider_identity_get_bufferpool));
/* src */
ident->src = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (spider_src_factory), "src");
ident->src = gst_pad_new_from_template (
gst_static_pad_template_get (&spider_src_factory), "src");
gst_element_add_pad (GST_ELEMENT (ident), ident->src);
gst_pad_set_link_function (ident->src, GST_DEBUG_FUNCPTR (gst_spider_identity_link));
gst_pad_set_getcaps_function (ident->src, GST_DEBUG_FUNCPTR (gst_spider_identity_getcaps));

View file

@ -1470,7 +1470,7 @@ gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad,
}
templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad), GST_RPAD_DIRECTION (pad),
GST_PAD_ALWAYS, templcaps, NULL);
GST_PAD_ALWAYS, templcaps);
foundpad = gst_element_request_compatible_pad (element, templ);
gst_object_unref (GST_OBJECT (templ)); /* this will take care of the caps too */
@ -1478,7 +1478,7 @@ gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad,
have caps on their source padtemplates (spider) can link... */
if (!foundpad && !filtercaps) {
templ = gst_pad_template_new ((gchar *) GST_PAD_NAME (pad), GST_RPAD_DIRECTION (pad),
GST_PAD_ALWAYS, NULL, NULL);
GST_PAD_ALWAYS, gst_caps2_new_any());
foundpad = gst_element_request_compatible_pad (element, templ);
gst_object_unref (GST_OBJECT (templ));
}

View file

@ -1104,7 +1104,7 @@ gst_xml_registry_end_element (GMarkupParseContext *context,
template = gst_pad_template_new (xmlregistry->name_template,
xmlregistry->direction,
xmlregistry->presence,
xmlregistry->caps, NULL);
xmlregistry->caps);
g_free (xmlregistry->name_template);
xmlregistry->name_template = NULL;