From 7fb1f1901f805dfedf031b0a20850b857458a225 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 17 Aug 2004 14:11:23 +0000 Subject: [PATCH] gst/: s/gst_pad_new/&_from_template/ register pad templates in the base_init function add static pad template definit... Original commit message from CVS: * gst/autoplug/gstspideridentity.c: (gst_spider_identity_request_new_pad): * gst/elements/gstaggregator.c: (gst_aggregator_base_init), (gst_aggregator_init): * gst/elements/gstfakesink.c: (gst_fakesink_base_init), (gst_fakesink_init): * gst/elements/gstfakesrc.c: (gst_fakesrc_base_init), (gst_fakesrc_init): * gst/elements/gstfdsink.c: (gst_fdsink_base_init), (gst_fdsink_init): * gst/elements/gstfdsrc.c: (gst_fdsrc_base_init), (gst_fdsrc_init): * gst/elements/gstfilesink.c: (gst_filesink_base_init), (gst_filesink_init): * gst/elements/gstfilesrc.c: (gst_filesrc_base_init), (gst_filesrc_init): * gst/elements/gstidentity.c: (gst_identity_base_init), (gst_identity_init): * gst/elements/gstmultifilesrc.c: (gst_multifilesrc_base_init), (gst_multifilesrc_init): * gst/elements/gstpipefilter.c: (gst_pipefilter_base_init), (gst_pipefilter_init): * gst/elements/gststatistics.c: (gst_statistics_base_init), (gst_statistics_init): * gst/elements/gsttee.c: (gst_tee_base_init), (gst_tee_init): * gst/gstqueue.c: (gst_queue_base_init), (gst_queue_init): s/gst_pad_new/&_from_template/ register pad templates in the base_init function add static pad template definitions --- ChangeLog | 31 ++++++++++++++++++++++++++++++ gst/autoplug/gstspideridentity.c | 8 ++++++-- gst/elements/gstaggregator.c | 11 ++++++++++- gst/elements/gstfakesink.c | 11 ++++++++++- gst/elements/gstfakesrc.c | 11 ++++++++++- gst/elements/gstfdsink.c | 11 ++++++++++- gst/elements/gstfdsrc.c | 11 ++++++++++- gst/elements/gstfilesink.c | 11 ++++++++++- gst/elements/gstfilesrc.c | 11 ++++++++++- gst/elements/gstidentity.c | 22 +++++++++++++++++++-- gst/elements/gstmultifilesrc.c | 11 ++++++++++- gst/elements/gstpipefilter.c | 22 +++++++++++++++++++-- gst/elements/gststatistics.c | 22 +++++++++++++++++++-- gst/elements/gsttee.c | 11 ++++++++++- gst/gstqueue.c | 22 +++++++++++++++++++-- plugins/elements/gstaggregator.c | 11 ++++++++++- plugins/elements/gstfakesink.c | 11 ++++++++++- plugins/elements/gstfakesrc.c | 11 ++++++++++- plugins/elements/gstfdsink.c | 11 ++++++++++- plugins/elements/gstfdsrc.c | 11 ++++++++++- plugins/elements/gstfilesink.c | 11 ++++++++++- plugins/elements/gstfilesrc.c | 11 ++++++++++- plugins/elements/gstidentity.c | 22 +++++++++++++++++++-- plugins/elements/gstmultifilesrc.c | 11 ++++++++++- plugins/elements/gstpipefilter.c | 22 +++++++++++++++++++-- plugins/elements/gstqueue.c | 22 +++++++++++++++++++-- plugins/elements/gststatistics.c | 22 +++++++++++++++++++-- plugins/elements/gsttee.c | 11 ++++++++++- 28 files changed, 377 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0666ba801f..7dfd690d6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +2004-08-17 Benjamin Otte + + * gst/autoplug/gstspideridentity.c: + (gst_spider_identity_request_new_pad): + * gst/elements/gstaggregator.c: (gst_aggregator_base_init), + (gst_aggregator_init): + * gst/elements/gstfakesink.c: (gst_fakesink_base_init), + (gst_fakesink_init): + * gst/elements/gstfakesrc.c: (gst_fakesrc_base_init), + (gst_fakesrc_init): + * gst/elements/gstfdsink.c: (gst_fdsink_base_init), + (gst_fdsink_init): + * gst/elements/gstfdsrc.c: (gst_fdsrc_base_init), (gst_fdsrc_init): + * gst/elements/gstfilesink.c: (gst_filesink_base_init), + (gst_filesink_init): + * gst/elements/gstfilesrc.c: (gst_filesrc_base_init), + (gst_filesrc_init): + * gst/elements/gstidentity.c: (gst_identity_base_init), + (gst_identity_init): + * gst/elements/gstmultifilesrc.c: (gst_multifilesrc_base_init), + (gst_multifilesrc_init): + * gst/elements/gstpipefilter.c: (gst_pipefilter_base_init), + (gst_pipefilter_init): + * gst/elements/gststatistics.c: (gst_statistics_base_init), + (gst_statistics_init): + * gst/elements/gsttee.c: (gst_tee_base_init), (gst_tee_init): + * gst/gstqueue.c: (gst_queue_base_init), (gst_queue_init): + s/gst_pad_new/&_from_template/ + register pad templates in the base_init function + add static pad template definitions + 2004-08-17 Benjamin Otte * testsuite/bytestream/gstbstest.c: (gst_bstest_init): diff --git a/gst/autoplug/gstspideridentity.c b/gst/autoplug/gstspideridentity.c index 94a4cf7898..b493139a58 100644 --- a/gst/autoplug/gstspideridentity.c +++ b/gst/autoplug/gstspideridentity.c @@ -319,7 +319,9 @@ gst_spider_identity_request_new_pad (GstElement * element, break; /* sink */ GST_DEBUG ("element %s requests new sink pad", GST_ELEMENT_NAME (ident)); - ident->sink = gst_pad_new ("sink", GST_PAD_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)); @@ -331,7 +333,9 @@ gst_spider_identity_request_new_pad (GstElement * element, if (ident->src != NULL) break; GST_DEBUG ("element %s requests new src pad", GST_ELEMENT_NAME (ident)); - ident->src = gst_pad_new ("src", GST_PAD_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)); diff --git a/gst/elements/gstaggregator.c b/gst/elements/gstaggregator.c index 48343e683a..702bfb8144 100644 --- a/gst/elements/gstaggregator.c +++ b/gst/elements/gstaggregator.c @@ -26,6 +26,11 @@ #include "gstaggregator.h" +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_aggregator_debug); #define GST_CAT_DEFAULT gst_aggregator_debug @@ -105,6 +110,8 @@ gst_aggregator_base_init (gpointer g_class) gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&aggregator_src_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); gst_element_class_set_details (gstelement_class, &gst_aggregator_details); } @@ -155,7 +162,9 @@ gst_aggregator_class_init (GstAggregatorClass * klass) static void gst_aggregator_init (GstAggregator * aggregator) { - aggregator->srcpad = gst_pad_new ("src", GST_PAD_SRC); + aggregator->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_pad_set_getcaps_function (aggregator->srcpad, gst_pad_proxy_getcaps); gst_element_add_pad (GST_ELEMENT (aggregator), aggregator->srcpad); diff --git a/gst/elements/gstfakesink.c b/gst/elements/gstfakesink.c index e9f1653fab..e872122046 100644 --- a/gst/elements/gstfakesink.c +++ b/gst/elements/gstfakesink.c @@ -28,6 +28,11 @@ #include "gstfakesink.h" #include +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_fakesink_debug); #define GST_CAT_DEFAULT gst_fakesink_debug @@ -117,6 +122,8 @@ gst_fakesink_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); gst_element_class_set_details (gstelement_class, &gst_fakesink_details); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&fakesink_sink_template)); @@ -177,7 +184,9 @@ gst_fakesink_init (GstFakeSink * fakesink) { GstPad *pad; - pad = gst_pad_new ("sink", GST_PAD_SINK); + pad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (fakesink), pad); gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_chain)); diff --git a/gst/elements/gstfakesrc.c b/gst/elements/gstfakesrc.c index 78d4dab747..5184b9f2a2 100644 --- a/gst/elements/gstfakesrc.c +++ b/gst/elements/gstfakesrc.c @@ -35,6 +35,11 @@ #define DEFAULT_SIZEMAX 4096 #define DEFAULT_PARENTSIZE 4096*10 +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_fakesrc_debug); #define GST_CAT_DEFAULT gst_fakesrc_debug @@ -188,6 +193,8 @@ gst_fakesrc_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); gst_element_class_set_details (gstelement_class, &gst_fakesrc_details); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&fakesrc_src_template)); @@ -276,7 +283,9 @@ gst_fakesrc_init (GstFakeSrc * fakesrc) GstPad *pad; /* create our first output pad */ - pad = gst_pad_new ("src", GST_PAD_SRC); + pad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_element_add_pad (GST_ELEMENT (fakesrc), pad); fakesrc->loop_based = FALSE; diff --git a/gst/elements/gstfdsink.c b/gst/elements/gstfdsink.c index 93f8f576e3..411dd0a32e 100644 --- a/gst/elements/gstfdsink.c +++ b/gst/elements/gstfdsink.c @@ -29,6 +29,11 @@ #include #endif +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_fdsink_debug); #define GST_CAT_DEFAULT gst_fdsink_debug @@ -72,6 +77,8 @@ gst_fdsink_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); gst_element_class_set_details (gstelement_class, &gst_fdsink_details); } static void @@ -93,7 +100,9 @@ gst_fdsink_class_init (GstFdSinkClass * klass) static void gst_fdsink_init (GstFdSink * fdsink) { - fdsink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + fdsink->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (fdsink), fdsink->sinkpad); gst_pad_set_chain_function (fdsink->sinkpad, gst_fdsink_chain); diff --git a/gst/elements/gstfdsrc.c b/gst/elements/gstfdsrc.c index cd4fe15cda..ca33db3c25 100644 --- a/gst/elements/gstfdsrc.c +++ b/gst/elements/gstfdsrc.c @@ -39,6 +39,11 @@ #define DEFAULT_BLOCKSIZE 4096 +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_fdsrc_debug); #define GST_CAT_DEFAULT gst_fdsrc_debug @@ -86,6 +91,8 @@ gst_fdsrc_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); gst_element_class_set_details (gstelement_class, &gst_fdsrc_details); } static void @@ -121,7 +128,9 @@ gst_fdsrc_class_init (GstFdSrcClass * klass) static void gst_fdsrc_init (GstFdSrc * fdsrc) { - fdsrc->srcpad = gst_pad_new ("src", GST_PAD_SRC); + fdsrc->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_pad_set_get_function (fdsrc->srcpad, gst_fdsrc_get); gst_element_add_pad (GST_ELEMENT (fdsrc), fdsrc->srcpad); diff --git a/gst/elements/gstfilesink.c b/gst/elements/gstfilesink.c index bd670dac2e..3b388816d5 100644 --- a/gst/elements/gstfilesink.c +++ b/gst/elements/gstfilesink.c @@ -38,6 +38,11 @@ #endif +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_filesink_debug); #define GST_CAT_DEFAULT gst_filesink_debug @@ -131,6 +136,8 @@ gst_filesink_base_init (gpointer g_class) GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); gstelement_class->change_state = gst_filesink_change_state; + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); gst_element_class_set_details (gstelement_class, &gst_filesink_details); } static void @@ -157,7 +164,9 @@ gst_filesink_init (GstFileSink * filesink) { GstPad *pad; - pad = gst_pad_new ("sink", GST_PAD_SINK); + pad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (filesink), pad); gst_pad_set_chain_function (pad, gst_filesink_chain); diff --git a/gst/elements/gstfilesrc.c b/gst/elements/gstfilesrc.c index ba18487c3d..2a21eb6da0 100644 --- a/gst/elements/gstfilesrc.c +++ b/gst/elements/gstfilesrc.c @@ -41,6 +41,11 @@ #include "../gst-i18n-lib.h" +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + /* FIXME we should be using glib for this */ #ifndef S_ISREG #define S_ISREG(mode) ((mode)&_S_IFREG) @@ -197,6 +202,8 @@ gst_filesrc_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); gst_element_class_set_details (gstelement_class, &gst_filesrc_details); } static void @@ -237,7 +244,9 @@ gst_filesrc_class_init (GstFileSrcClass * klass) static void gst_filesrc_init (GstFileSrc * src) { - src->srcpad = gst_pad_new ("src", GST_PAD_SRC); + src->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_pad_set_get_function (src->srcpad, gst_filesrc_get); gst_pad_set_event_function (src->srcpad, gst_filesrc_srcpad_event); gst_pad_set_event_mask_function (src->srcpad, gst_filesrc_get_event_mask); diff --git a/gst/elements/gstidentity.c b/gst/elements/gstidentity.c index 44a703d25d..49ec840ee4 100644 --- a/gst/elements/gstidentity.c +++ b/gst/elements/gstidentity.c @@ -31,6 +31,16 @@ #include "gstidentity.h" #include +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_identity_debug); #define GST_CAT_DEFAULT gst_identity_debug @@ -87,6 +97,10 @@ gst_identity_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + 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)); gst_element_class_set_details (gstelement_class, &gst_identity_details); } @@ -162,14 +176,18 @@ gst_identity_class_init (GstIdentityClass * klass) static void gst_identity_init (GstIdentity * identity) { - identity->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + identity->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (identity), identity->sinkpad); gst_pad_set_chain_function (identity->sinkpad, GST_DEBUG_FUNCPTR (gst_identity_chain)); gst_pad_set_link_function (identity->sinkpad, gst_pad_proxy_pad_link); gst_pad_set_getcaps_function (identity->sinkpad, gst_pad_proxy_getcaps); - identity->srcpad = gst_pad_new ("src", GST_PAD_SRC); + identity->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad); gst_pad_set_link_function (identity->srcpad, gst_pad_proxy_pad_link); gst_pad_set_getcaps_function (identity->srcpad, gst_pad_proxy_getcaps); diff --git a/gst/elements/gstmultifilesrc.c b/gst/elements/gstmultifilesrc.c index fd32423a23..f781844865 100644 --- a/gst/elements/gstmultifilesrc.c +++ b/gst/elements/gstmultifilesrc.c @@ -37,6 +37,11 @@ #include "gstmultifilesrc.h" +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_multifilesrc_debug); #define GST_CAT_DEFAULT gst_multifilesrc_debug @@ -89,6 +94,8 @@ gst_multifilesrc_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); gst_element_class_set_details (gstelement_class, &gst_multifilesrc_details); } static void @@ -125,7 +132,9 @@ gst_multifilesrc_init (GstMultiFileSrc * multifilesrc) { /* GST_FLAG_SET (filesrc, GST_SRC_); */ - multifilesrc->srcpad = gst_pad_new ("src", GST_PAD_SRC); + multifilesrc->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_pad_set_get_function (multifilesrc->srcpad, gst_multifilesrc_get); /* gst_pad_set_getregion_function (multifilesrc->srcpad,gst_multifilesrc_get_region); */ gst_element_add_pad (GST_ELEMENT (multifilesrc), multifilesrc->srcpad); diff --git a/gst/elements/gstpipefilter.c b/gst/elements/gstpipefilter.c index c141186e67..f802124076 100644 --- a/gst/elements/gstpipefilter.c +++ b/gst/elements/gstpipefilter.c @@ -37,6 +37,16 @@ #include "../gst-i18n-lib.h" #include "gstpipefilter.h" +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_pipefilter_debug); #define GST_CAT_DEFAULT gst_pipefilter_debug @@ -83,6 +93,10 @@ gst_pipefilter_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + 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)); gst_element_class_set_details (gstelement_class, &gst_pipefilter_details); } static void @@ -108,11 +122,15 @@ gst_pipefilter_init (GstPipefilter * pipefilter) { GST_FLAG_SET (pipefilter, GST_ELEMENT_DECOUPLED); - pipefilter->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + pipefilter->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->sinkpad); gst_pad_set_chain_function (pipefilter->sinkpad, gst_pipefilter_chain); - pipefilter->srcpad = gst_pad_new ("src", GST_PAD_SRC); + pipefilter->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->srcpad); gst_pad_set_get_function (pipefilter->srcpad, gst_pipefilter_get); diff --git a/gst/elements/gststatistics.c b/gst/elements/gststatistics.c index a8f22399cc..82744ff6f4 100644 --- a/gst/elements/gststatistics.c +++ b/gst/elements/gststatistics.c @@ -27,6 +27,16 @@ #include "gststatistics.h" +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_statistics_debug); #define GST_CAT_DEFAULT gst_statistics_debug @@ -84,6 +94,10 @@ gst_statistics_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + 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)); gst_element_class_set_details (gstelement_class, &gst_statistics_details); } @@ -155,12 +169,16 @@ gst_statistics_class_init (GstStatisticsClass * klass) static void gst_statistics_init (GstStatistics * statistics) { - statistics->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + statistics->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (statistics), statistics->sinkpad); gst_pad_set_chain_function (statistics->sinkpad, GST_DEBUG_FUNCPTR (gst_statistics_chain)); - statistics->srcpad = gst_pad_new ("src", GST_PAD_SRC); + statistics->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_element_add_pad (GST_ELEMENT (statistics), statistics->srcpad); statistics->timer = NULL; diff --git a/gst/elements/gsttee.c b/gst/elements/gsttee.c index 05194ff1d3..d29336d1f1 100644 --- a/gst/elements/gsttee.c +++ b/gst/elements/gsttee.c @@ -28,6 +28,11 @@ #include +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_tee_debug); #define GST_CAT_DEFAULT gst_tee_debug @@ -80,6 +85,8 @@ gst_tee_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); gst_element_class_set_details (gstelement_class, &gst_tee_details); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&tee_src_template)); @@ -129,7 +136,9 @@ gst_tee_class_init (GstTeeClass * klass) static void gst_tee_init (GstTee * tee) { - tee->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + tee->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad); gst_pad_set_chain_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_chain)); gst_pad_set_link_function (tee->sinkpad, diff --git a/gst/gstqueue.c b/gst/gstqueue.c index f4f923017e..00d585ad45 100644 --- a/gst/gstqueue.c +++ b/gst/gstqueue.c @@ -30,6 +30,16 @@ #include "gstinfo.h" #include "gsterror.h" +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (queue_dataflow); static GstElementDetails gst_queue_details = GST_ELEMENT_DETAILS ("Queue", @@ -170,6 +180,10 @@ gst_queue_base_init (GstQueueClass * klass) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); + 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)); gst_element_class_set_details (gstelement_class, &gst_queue_details); } @@ -265,7 +279,9 @@ gst_queue_init (GstQueue * queue) GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED); GST_FLAG_SET (queue, GST_ELEMENT_EVENT_AWARE); - queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + queue->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_pad_set_chain_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_queue_chain)); gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad); @@ -275,7 +291,9 @@ gst_queue_init (GstQueue * queue) GST_DEBUG_FUNCPTR (gst_queue_getcaps)); gst_pad_set_active (queue->sinkpad, TRUE); - queue->srcpad = gst_pad_new ("src", GST_PAD_SRC); + queue->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_pad_set_get_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_get)); gst_element_add_pad (GST_ELEMENT (queue), queue->srcpad); gst_pad_set_link_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_link)); diff --git a/plugins/elements/gstaggregator.c b/plugins/elements/gstaggregator.c index 48343e683a..702bfb8144 100644 --- a/plugins/elements/gstaggregator.c +++ b/plugins/elements/gstaggregator.c @@ -26,6 +26,11 @@ #include "gstaggregator.h" +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_aggregator_debug); #define GST_CAT_DEFAULT gst_aggregator_debug @@ -105,6 +110,8 @@ gst_aggregator_base_init (gpointer g_class) gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&aggregator_src_template)); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); gst_element_class_set_details (gstelement_class, &gst_aggregator_details); } @@ -155,7 +162,9 @@ gst_aggregator_class_init (GstAggregatorClass * klass) static void gst_aggregator_init (GstAggregator * aggregator) { - aggregator->srcpad = gst_pad_new ("src", GST_PAD_SRC); + aggregator->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_pad_set_getcaps_function (aggregator->srcpad, gst_pad_proxy_getcaps); gst_element_add_pad (GST_ELEMENT (aggregator), aggregator->srcpad); diff --git a/plugins/elements/gstfakesink.c b/plugins/elements/gstfakesink.c index e9f1653fab..e872122046 100644 --- a/plugins/elements/gstfakesink.c +++ b/plugins/elements/gstfakesink.c @@ -28,6 +28,11 @@ #include "gstfakesink.h" #include +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_fakesink_debug); #define GST_CAT_DEFAULT gst_fakesink_debug @@ -117,6 +122,8 @@ gst_fakesink_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); gst_element_class_set_details (gstelement_class, &gst_fakesink_details); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&fakesink_sink_template)); @@ -177,7 +184,9 @@ gst_fakesink_init (GstFakeSink * fakesink) { GstPad *pad; - pad = gst_pad_new ("sink", GST_PAD_SINK); + pad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (fakesink), pad); gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_fakesink_chain)); diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index 78d4dab747..5184b9f2a2 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -35,6 +35,11 @@ #define DEFAULT_SIZEMAX 4096 #define DEFAULT_PARENTSIZE 4096*10 +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_fakesrc_debug); #define GST_CAT_DEFAULT gst_fakesrc_debug @@ -188,6 +193,8 @@ gst_fakesrc_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); gst_element_class_set_details (gstelement_class, &gst_fakesrc_details); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&fakesrc_src_template)); @@ -276,7 +283,9 @@ gst_fakesrc_init (GstFakeSrc * fakesrc) GstPad *pad; /* create our first output pad */ - pad = gst_pad_new ("src", GST_PAD_SRC); + pad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_element_add_pad (GST_ELEMENT (fakesrc), pad); fakesrc->loop_based = FALSE; diff --git a/plugins/elements/gstfdsink.c b/plugins/elements/gstfdsink.c index 93f8f576e3..411dd0a32e 100644 --- a/plugins/elements/gstfdsink.c +++ b/plugins/elements/gstfdsink.c @@ -29,6 +29,11 @@ #include #endif +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_fdsink_debug); #define GST_CAT_DEFAULT gst_fdsink_debug @@ -72,6 +77,8 @@ gst_fdsink_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); gst_element_class_set_details (gstelement_class, &gst_fdsink_details); } static void @@ -93,7 +100,9 @@ gst_fdsink_class_init (GstFdSinkClass * klass) static void gst_fdsink_init (GstFdSink * fdsink) { - fdsink->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + fdsink->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (fdsink), fdsink->sinkpad); gst_pad_set_chain_function (fdsink->sinkpad, gst_fdsink_chain); diff --git a/plugins/elements/gstfdsrc.c b/plugins/elements/gstfdsrc.c index cd4fe15cda..ca33db3c25 100644 --- a/plugins/elements/gstfdsrc.c +++ b/plugins/elements/gstfdsrc.c @@ -39,6 +39,11 @@ #define DEFAULT_BLOCKSIZE 4096 +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_fdsrc_debug); #define GST_CAT_DEFAULT gst_fdsrc_debug @@ -86,6 +91,8 @@ gst_fdsrc_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); gst_element_class_set_details (gstelement_class, &gst_fdsrc_details); } static void @@ -121,7 +128,9 @@ gst_fdsrc_class_init (GstFdSrcClass * klass) static void gst_fdsrc_init (GstFdSrc * fdsrc) { - fdsrc->srcpad = gst_pad_new ("src", GST_PAD_SRC); + fdsrc->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_pad_set_get_function (fdsrc->srcpad, gst_fdsrc_get); gst_element_add_pad (GST_ELEMENT (fdsrc), fdsrc->srcpad); diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index bd670dac2e..3b388816d5 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -38,6 +38,11 @@ #endif +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_filesink_debug); #define GST_CAT_DEFAULT gst_filesink_debug @@ -131,6 +136,8 @@ gst_filesink_base_init (gpointer g_class) GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); gstelement_class->change_state = gst_filesink_change_state; + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); gst_element_class_set_details (gstelement_class, &gst_filesink_details); } static void @@ -157,7 +164,9 @@ gst_filesink_init (GstFileSink * filesink) { GstPad *pad; - pad = gst_pad_new ("sink", GST_PAD_SINK); + pad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (filesink), pad); gst_pad_set_chain_function (pad, gst_filesink_chain); diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index ba18487c3d..2a21eb6da0 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -41,6 +41,11 @@ #include "../gst-i18n-lib.h" +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + /* FIXME we should be using glib for this */ #ifndef S_ISREG #define S_ISREG(mode) ((mode)&_S_IFREG) @@ -197,6 +202,8 @@ gst_filesrc_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); gst_element_class_set_details (gstelement_class, &gst_filesrc_details); } static void @@ -237,7 +244,9 @@ gst_filesrc_class_init (GstFileSrcClass * klass) static void gst_filesrc_init (GstFileSrc * src) { - src->srcpad = gst_pad_new ("src", GST_PAD_SRC); + src->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_pad_set_get_function (src->srcpad, gst_filesrc_get); gst_pad_set_event_function (src->srcpad, gst_filesrc_srcpad_event); gst_pad_set_event_mask_function (src->srcpad, gst_filesrc_get_event_mask); diff --git a/plugins/elements/gstidentity.c b/plugins/elements/gstidentity.c index 44a703d25d..49ec840ee4 100644 --- a/plugins/elements/gstidentity.c +++ b/plugins/elements/gstidentity.c @@ -31,6 +31,16 @@ #include "gstidentity.h" #include +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_identity_debug); #define GST_CAT_DEFAULT gst_identity_debug @@ -87,6 +97,10 @@ gst_identity_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + 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)); gst_element_class_set_details (gstelement_class, &gst_identity_details); } @@ -162,14 +176,18 @@ gst_identity_class_init (GstIdentityClass * klass) static void gst_identity_init (GstIdentity * identity) { - identity->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + identity->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (identity), identity->sinkpad); gst_pad_set_chain_function (identity->sinkpad, GST_DEBUG_FUNCPTR (gst_identity_chain)); gst_pad_set_link_function (identity->sinkpad, gst_pad_proxy_pad_link); gst_pad_set_getcaps_function (identity->sinkpad, gst_pad_proxy_getcaps); - identity->srcpad = gst_pad_new ("src", GST_PAD_SRC); + identity->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_element_add_pad (GST_ELEMENT (identity), identity->srcpad); gst_pad_set_link_function (identity->srcpad, gst_pad_proxy_pad_link); gst_pad_set_getcaps_function (identity->srcpad, gst_pad_proxy_getcaps); diff --git a/plugins/elements/gstmultifilesrc.c b/plugins/elements/gstmultifilesrc.c index fd32423a23..f781844865 100644 --- a/plugins/elements/gstmultifilesrc.c +++ b/plugins/elements/gstmultifilesrc.c @@ -37,6 +37,11 @@ #include "gstmultifilesrc.h" +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_multifilesrc_debug); #define GST_CAT_DEFAULT gst_multifilesrc_debug @@ -89,6 +94,8 @@ gst_multifilesrc_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&srctemplate)); gst_element_class_set_details (gstelement_class, &gst_multifilesrc_details); } static void @@ -125,7 +132,9 @@ gst_multifilesrc_init (GstMultiFileSrc * multifilesrc) { /* GST_FLAG_SET (filesrc, GST_SRC_); */ - multifilesrc->srcpad = gst_pad_new ("src", GST_PAD_SRC); + multifilesrc->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_pad_set_get_function (multifilesrc->srcpad, gst_multifilesrc_get); /* gst_pad_set_getregion_function (multifilesrc->srcpad,gst_multifilesrc_get_region); */ gst_element_add_pad (GST_ELEMENT (multifilesrc), multifilesrc->srcpad); diff --git a/plugins/elements/gstpipefilter.c b/plugins/elements/gstpipefilter.c index c141186e67..f802124076 100644 --- a/plugins/elements/gstpipefilter.c +++ b/plugins/elements/gstpipefilter.c @@ -37,6 +37,16 @@ #include "../gst-i18n-lib.h" #include "gstpipefilter.h" +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_pipefilter_debug); #define GST_CAT_DEFAULT gst_pipefilter_debug @@ -83,6 +93,10 @@ gst_pipefilter_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + 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)); gst_element_class_set_details (gstelement_class, &gst_pipefilter_details); } static void @@ -108,11 +122,15 @@ gst_pipefilter_init (GstPipefilter * pipefilter) { GST_FLAG_SET (pipefilter, GST_ELEMENT_DECOUPLED); - pipefilter->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + pipefilter->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->sinkpad); gst_pad_set_chain_function (pipefilter->sinkpad, gst_pipefilter_chain); - pipefilter->srcpad = gst_pad_new ("src", GST_PAD_SRC); + pipefilter->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->srcpad); gst_pad_set_get_function (pipefilter->srcpad, gst_pipefilter_get); diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index f4f923017e..00d585ad45 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -30,6 +30,16 @@ #include "gstinfo.h" #include "gsterror.h" +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (queue_dataflow); static GstElementDetails gst_queue_details = GST_ELEMENT_DETAILS ("Queue", @@ -170,6 +180,10 @@ gst_queue_base_init (GstQueueClass * klass) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); + 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)); gst_element_class_set_details (gstelement_class, &gst_queue_details); } @@ -265,7 +279,9 @@ gst_queue_init (GstQueue * queue) GST_FLAG_SET (queue, GST_ELEMENT_DECOUPLED); GST_FLAG_SET (queue, GST_ELEMENT_EVENT_AWARE); - queue->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + queue->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_pad_set_chain_function (queue->sinkpad, GST_DEBUG_FUNCPTR (gst_queue_chain)); gst_element_add_pad (GST_ELEMENT (queue), queue->sinkpad); @@ -275,7 +291,9 @@ gst_queue_init (GstQueue * queue) GST_DEBUG_FUNCPTR (gst_queue_getcaps)); gst_pad_set_active (queue->sinkpad, TRUE); - queue->srcpad = gst_pad_new ("src", GST_PAD_SRC); + queue->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_pad_set_get_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_get)); gst_element_add_pad (GST_ELEMENT (queue), queue->srcpad); gst_pad_set_link_function (queue->srcpad, GST_DEBUG_FUNCPTR (gst_queue_link)); diff --git a/plugins/elements/gststatistics.c b/plugins/elements/gststatistics.c index a8f22399cc..82744ff6f4 100644 --- a/plugins/elements/gststatistics.c +++ b/plugins/elements/gststatistics.c @@ -27,6 +27,16 @@ #include "gststatistics.h" +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + +static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_statistics_debug); #define GST_CAT_DEFAULT gst_statistics_debug @@ -84,6 +94,10 @@ gst_statistics_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + 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)); gst_element_class_set_details (gstelement_class, &gst_statistics_details); } @@ -155,12 +169,16 @@ gst_statistics_class_init (GstStatisticsClass * klass) static void gst_statistics_init (GstStatistics * statistics) { - statistics->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + statistics->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (statistics), statistics->sinkpad); gst_pad_set_chain_function (statistics->sinkpad, GST_DEBUG_FUNCPTR (gst_statistics_chain)); - statistics->srcpad = gst_pad_new ("src", GST_PAD_SRC); + statistics->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get (&srctemplate), + "src"); gst_element_add_pad (GST_ELEMENT (statistics), statistics->srcpad); statistics->timer = NULL; diff --git a/plugins/elements/gsttee.c b/plugins/elements/gsttee.c index 05194ff1d3..d29336d1f1 100644 --- a/plugins/elements/gsttee.c +++ b/plugins/elements/gsttee.c @@ -28,6 +28,11 @@ #include +static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS_ANY); + GST_DEBUG_CATEGORY_STATIC (gst_tee_debug); #define GST_CAT_DEFAULT gst_tee_debug @@ -80,6 +85,8 @@ gst_tee_base_init (gpointer g_class) { GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + gst_element_class_add_pad_template (gstelement_class, + gst_static_pad_template_get (&sinktemplate)); gst_element_class_set_details (gstelement_class, &gst_tee_details); gst_element_class_add_pad_template (gstelement_class, gst_static_pad_template_get (&tee_src_template)); @@ -129,7 +136,9 @@ gst_tee_class_init (GstTeeClass * klass) static void gst_tee_init (GstTee * tee) { - tee->sinkpad = gst_pad_new ("sink", GST_PAD_SINK); + tee->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get (&sinktemplate), + "sink"); gst_element_add_pad (GST_ELEMENT (tee), tee->sinkpad); gst_pad_set_chain_function (tee->sinkpad, GST_DEBUG_FUNCPTR (gst_tee_chain)); gst_pad_set_link_function (tee->sinkpad,