Switch everything to static pad templates

Original commit message from CVS:
Switch everything to static pad templates
This commit is contained in:
David Schleef 2003-11-25 08:57:17 +00:00
parent 408ca875b9
commit a53fe6571b
16 changed files with 104 additions and 72 deletions

View file

@ -51,11 +51,11 @@ enum {
/* FILL ME */
};
GST_PAD_TEMPLATE_FACTORY (aggregator_src_factory,
GstStaticPadTemplate aggregator_src_template = GST_STATIC_PAD_TEMPLATE (
"sink%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
#define GST_TYPE_AGGREGATOR_SCHED (gst_aggregator_sched_get_type())
@ -124,7 +124,8 @@ static void
gst_aggregator_base_init (gpointer g_class)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (aggregator_src_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&aggregator_src_template));
gst_element_class_set_details (gstelement_class, &gst_aggregator_details);
}
static void

View file

@ -56,11 +56,11 @@ enum {
ARG_LAST_MESSAGE,
};
GST_PAD_TEMPLATE_FACTORY (fakesink_sink_factory,
GstStaticPadTemplate fakesink_sink_template = GST_STATIC_PAD_TEMPLATE (
"sink%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
#define GST_TYPE_FAKESINK_STATE_ERROR (gst_fakesink_state_error_get_type())
@ -135,8 +135,10 @@ gst_fakesink_base_init (gpointer g_class)
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (gstelement_class, &gst_fakesink_details);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (fakesink_sink_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&fakesink_sink_template));
}
static void
gst_fakesink_class_init (GstFakeSinkClass *klass)
{

View file

@ -73,11 +73,11 @@ enum {
ARG_LAST_MESSAGE,
};
GST_PAD_TEMPLATE_FACTORY (fakesrc_src_factory,
GstStaticPadTemplate fakesrc_src_template = GST_STATIC_PAD_TEMPLATE (
"src%d",
GST_PAD_SRC,
GST_PAD_REQUEST,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
#define GST_TYPE_FAKESRC_OUTPUT (gst_fakesrc_output_get_type())
@ -204,8 +204,10 @@ gst_fakesrc_base_init (gpointer g_class)
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (gstelement_class, &gst_fakesrc_details);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (fakesrc_src_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&fakesrc_src_template));
}
static void
gst_fakesrc_class_init (GstFakeSrcClass *klass)
{

View file

@ -54,11 +54,11 @@ enum {
/* FILL ME */
};
GST_PAD_TEMPLATE_FACTORY (md5_sink_factory,
GstStaticPadTemplate md5_sink_template = GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
/* GObject stuff */
@ -412,8 +412,10 @@ gst_md5sink_base_init (gpointer g_class)
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (gstelement_class, &gst_md5sink_details);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (md5_sink_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&md5_sink_template));
}
static void
gst_md5sink_class_init (GstMD5SinkClass *klass)
{
@ -438,7 +440,8 @@ static void
gst_md5sink_init (GstMD5Sink *md5sink)
{
GstPad *pad;
pad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (md5_sink_factory), "sink");
pad = gst_pad_new_from_template (gst_static_pad_template_get (
&md5_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (md5sink), pad);
gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_md5sink_chain));

View file

@ -60,18 +60,18 @@ typedef struct
GstBuffer *buffer;
} GstShaperConnection;
GST_PAD_TEMPLATE_FACTORY (shaper_src_factory,
GstStaticPadTemplate shaper_src_template = GST_STATIC_PAD_TEMPLATE (
"src%d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
GST_PAD_TEMPLATE_FACTORY (shaper_sink_factory,
GstStaticPadTemplate shaper_sink_template = GST_STATIC_PAD_TEMPLATE (
"sink%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
#define GST_TYPE_SHAPER_POLICY (gst_shaper_policy_get_type())
@ -137,9 +137,12 @@ gst_shaper_base_init (gpointer g_class)
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (gstelement_class, &gst_shaper_details);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (shaper_src_factory));
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (shaper_sink_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&shaper_src_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&shaper_sink_template));
}
static void
gst_shaper_class_init (GstShaperClass *klass)
{
@ -230,7 +233,8 @@ gst_shaper_create_connection (GstShaper *shaper)
connection = g_new0 (GstShaperConnection, 1);
padname = g_strdup_printf ("sink%d", shaper->nconnections);
connection->sinkpad = gst_pad_new_from_template (shaper_sink_factory (), padname);
connection->sinkpad = gst_pad_new_from_template (
gst_static_pad_template_get (&shaper_sink_template), padname);
g_free (padname);
gst_pad_set_bufferpool_function (connection->sinkpad, gst_shaper_get_bufferpool);
gst_pad_set_getcaps_function (connection->sinkpad, gst_shaper_getcaps);
@ -240,7 +244,8 @@ gst_shaper_create_connection (GstShaper *shaper)
gst_element_add_pad (GST_ELEMENT (shaper), connection->sinkpad);
padname = g_strdup_printf ("src%d", shaper->nconnections);
connection->srcpad = gst_pad_new_from_template (shaper_src_factory (), padname);
connection->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get (&shaper_src_template), padname);
g_free (padname);
gst_pad_set_getcaps_function (connection->srcpad, gst_shaper_getcaps);
gst_pad_set_internal_link_function (connection->srcpad, gst_shaper_get_internal_link);

View file

@ -53,11 +53,11 @@ enum {
/* FILL ME */
};
GST_PAD_TEMPLATE_FACTORY (tee_src_factory,
GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE (
"src%d",
GST_PAD_SRC,
GST_PAD_REQUEST,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
static void gst_tee_base_init (gpointer g_class);
@ -106,7 +106,8 @@ gst_tee_base_init (gpointer g_class)
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (gstelement_class, &gst_tee_details);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (tee_src_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&tee_src_template));
}
static void
gst_tee_class_init (GstTeeClass *klass)

View file

@ -54,17 +54,18 @@ GstElementDetails gst_type_find_element_details = GST_ELEMENT_DETAILS (
);
/* generic templates */
GST_PAD_TEMPLATE_FACTORY (type_find_element_sink_factory,
GstStaticPadTemplate type_find_element_sink_template = GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
GST_PAD_TEMPLATE_FACTORY (type_find_element_src_factory,
GstStaticPadTemplate type_find_element_src_template = GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
/* TypeFind signals and args */
@ -206,13 +207,13 @@ gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
/* sinkpad */
typefind->sink = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (type_find_element_sink_factory), "sink");
gst_static_pad_template_get (&type_find_element_sink_template), "sink");
gst_pad_set_chain_function (typefind->sink,
gst_type_find_element_chain);
gst_element_add_pad (GST_ELEMENT (typefind), typefind->sink);
/* srcpad */
typefind->src = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (type_find_element_src_factory), "src");
gst_static_pad_template_get (&type_find_element_src_template), "src");
gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event);
gst_pad_set_event_mask_function (typefind->src, gst_type_find_element_src_event_mask);
gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);

View file

@ -54,17 +54,18 @@ GstElementDetails gst_type_find_element_details = GST_ELEMENT_DETAILS (
);
/* generic templates */
GST_PAD_TEMPLATE_FACTORY (type_find_element_sink_factory,
GstStaticPadTemplate type_find_element_sink_template = GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
GST_PAD_TEMPLATE_FACTORY (type_find_element_src_factory,
GstStaticPadTemplate type_find_element_src_template = GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
/* TypeFind signals and args */
@ -206,13 +207,13 @@ gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
/* sinkpad */
typefind->sink = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (type_find_element_sink_factory), "sink");
gst_static_pad_template_get (&type_find_element_sink_template), "sink");
gst_pad_set_chain_function (typefind->sink,
gst_type_find_element_chain);
gst_element_add_pad (GST_ELEMENT (typefind), typefind->sink);
/* srcpad */
typefind->src = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (type_find_element_src_factory), "src");
gst_static_pad_template_get (&type_find_element_src_template), "src");
gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event);
gst_pad_set_event_mask_function (typefind->src, gst_type_find_element_src_event_mask);
gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);

View file

@ -51,11 +51,11 @@ enum {
/* FILL ME */
};
GST_PAD_TEMPLATE_FACTORY (aggregator_src_factory,
GstStaticPadTemplate aggregator_src_template = GST_STATIC_PAD_TEMPLATE (
"sink%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
#define GST_TYPE_AGGREGATOR_SCHED (gst_aggregator_sched_get_type())
@ -124,7 +124,8 @@ static void
gst_aggregator_base_init (gpointer g_class)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (aggregator_src_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&aggregator_src_template));
gst_element_class_set_details (gstelement_class, &gst_aggregator_details);
}
static void

View file

@ -56,11 +56,11 @@ enum {
ARG_LAST_MESSAGE,
};
GST_PAD_TEMPLATE_FACTORY (fakesink_sink_factory,
GstStaticPadTemplate fakesink_sink_template = GST_STATIC_PAD_TEMPLATE (
"sink%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
#define GST_TYPE_FAKESINK_STATE_ERROR (gst_fakesink_state_error_get_type())
@ -135,8 +135,10 @@ gst_fakesink_base_init (gpointer g_class)
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (gstelement_class, &gst_fakesink_details);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (fakesink_sink_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&fakesink_sink_template));
}
static void
gst_fakesink_class_init (GstFakeSinkClass *klass)
{

View file

@ -73,11 +73,11 @@ enum {
ARG_LAST_MESSAGE,
};
GST_PAD_TEMPLATE_FACTORY (fakesrc_src_factory,
GstStaticPadTemplate fakesrc_src_template = GST_STATIC_PAD_TEMPLATE (
"src%d",
GST_PAD_SRC,
GST_PAD_REQUEST,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
#define GST_TYPE_FAKESRC_OUTPUT (gst_fakesrc_output_get_type())
@ -204,8 +204,10 @@ gst_fakesrc_base_init (gpointer g_class)
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (gstelement_class, &gst_fakesrc_details);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (fakesrc_src_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&fakesrc_src_template));
}
static void
gst_fakesrc_class_init (GstFakeSrcClass *klass)
{

View file

@ -54,11 +54,11 @@ enum {
/* FILL ME */
};
GST_PAD_TEMPLATE_FACTORY (md5_sink_factory,
GstStaticPadTemplate md5_sink_template = GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
/* GObject stuff */
@ -412,8 +412,10 @@ gst_md5sink_base_init (gpointer g_class)
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (gstelement_class, &gst_md5sink_details);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (md5_sink_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&md5_sink_template));
}
static void
gst_md5sink_class_init (GstMD5SinkClass *klass)
{
@ -438,7 +440,8 @@ static void
gst_md5sink_init (GstMD5Sink *md5sink)
{
GstPad *pad;
pad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (md5_sink_factory), "sink");
pad = gst_pad_new_from_template (gst_static_pad_template_get (
&md5_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (md5sink), pad);
gst_pad_set_chain_function (pad, GST_DEBUG_FUNCPTR (gst_md5sink_chain));

View file

@ -60,18 +60,18 @@ typedef struct
GstBuffer *buffer;
} GstShaperConnection;
GST_PAD_TEMPLATE_FACTORY (shaper_src_factory,
GstStaticPadTemplate shaper_src_template = GST_STATIC_PAD_TEMPLATE (
"src%d",
GST_PAD_SRC,
GST_PAD_SOMETIMES,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
GST_PAD_TEMPLATE_FACTORY (shaper_sink_factory,
GstStaticPadTemplate shaper_sink_template = GST_STATIC_PAD_TEMPLATE (
"sink%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
#define GST_TYPE_SHAPER_POLICY (gst_shaper_policy_get_type())
@ -137,9 +137,12 @@ gst_shaper_base_init (gpointer g_class)
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (gstelement_class, &gst_shaper_details);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (shaper_src_factory));
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (shaper_sink_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&shaper_src_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&shaper_sink_template));
}
static void
gst_shaper_class_init (GstShaperClass *klass)
{
@ -230,7 +233,8 @@ gst_shaper_create_connection (GstShaper *shaper)
connection = g_new0 (GstShaperConnection, 1);
padname = g_strdup_printf ("sink%d", shaper->nconnections);
connection->sinkpad = gst_pad_new_from_template (shaper_sink_factory (), padname);
connection->sinkpad = gst_pad_new_from_template (
gst_static_pad_template_get (&shaper_sink_template), padname);
g_free (padname);
gst_pad_set_bufferpool_function (connection->sinkpad, gst_shaper_get_bufferpool);
gst_pad_set_getcaps_function (connection->sinkpad, gst_shaper_getcaps);
@ -240,7 +244,8 @@ gst_shaper_create_connection (GstShaper *shaper)
gst_element_add_pad (GST_ELEMENT (shaper), connection->sinkpad);
padname = g_strdup_printf ("src%d", shaper->nconnections);
connection->srcpad = gst_pad_new_from_template (shaper_src_factory (), padname);
connection->srcpad = gst_pad_new_from_template (
gst_static_pad_template_get (&shaper_src_template), padname);
g_free (padname);
gst_pad_set_getcaps_function (connection->srcpad, gst_shaper_getcaps);
gst_pad_set_internal_link_function (connection->srcpad, gst_shaper_get_internal_link);

View file

@ -53,11 +53,11 @@ enum {
/* FILL ME */
};
GST_PAD_TEMPLATE_FACTORY (tee_src_factory,
GstStaticPadTemplate tee_src_template = GST_STATIC_PAD_TEMPLATE (
"src%d",
GST_PAD_SRC,
GST_PAD_REQUEST,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
static void gst_tee_base_init (gpointer g_class);
@ -106,7 +106,8 @@ gst_tee_base_init (gpointer g_class)
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (gstelement_class, &gst_tee_details);
gst_element_class_add_pad_template (gstelement_class, GST_PAD_TEMPLATE_GET (tee_src_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&tee_src_template));
}
static void
gst_tee_class_init (GstTeeClass *klass)

View file

@ -54,17 +54,18 @@ GstElementDetails gst_type_find_element_details = GST_ELEMENT_DETAILS (
);
/* generic templates */
GST_PAD_TEMPLATE_FACTORY (type_find_element_sink_factory,
GstStaticPadTemplate type_find_element_sink_template = GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
GST_PAD_TEMPLATE_FACTORY (type_find_element_src_factory,
GstStaticPadTemplate type_find_element_src_template = GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
/* TypeFind signals and args */
@ -206,13 +207,13 @@ gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
/* sinkpad */
typefind->sink = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (type_find_element_sink_factory), "sink");
gst_static_pad_template_get (&type_find_element_sink_template), "sink");
gst_pad_set_chain_function (typefind->sink,
gst_type_find_element_chain);
gst_element_add_pad (GST_ELEMENT (typefind), typefind->sink);
/* srcpad */
typefind->src = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (type_find_element_src_factory), "src");
gst_static_pad_template_get (&type_find_element_src_template), "src");
gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event);
gst_pad_set_event_mask_function (typefind->src, gst_type_find_element_src_event_mask);
gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);

View file

@ -54,17 +54,18 @@ GstElementDetails gst_type_find_element_details = GST_ELEMENT_DETAILS (
);
/* generic templates */
GST_PAD_TEMPLATE_FACTORY (type_find_element_sink_factory,
GstStaticPadTemplate type_find_element_sink_template = GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
GST_PAD_TEMPLATE_FACTORY (type_find_element_src_factory,
GstStaticPadTemplate type_find_element_src_template = GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_CAPS2_ANY
GST_STATIC_CAPS2_ANY
);
/* TypeFind signals and args */
@ -206,13 +207,13 @@ gst_type_find_element_init (GTypeInstance *instance, gpointer g_class)
/* sinkpad */
typefind->sink = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (type_find_element_sink_factory), "sink");
gst_static_pad_template_get (&type_find_element_sink_template), "sink");
gst_pad_set_chain_function (typefind->sink,
gst_type_find_element_chain);
gst_element_add_pad (GST_ELEMENT (typefind), typefind->sink);
/* srcpad */
typefind->src = gst_pad_new_from_template (
GST_PAD_TEMPLATE_GET (type_find_element_src_factory), "src");
gst_static_pad_template_get (&type_find_element_src_template), "src");
gst_pad_set_event_function (typefind->src, gst_type_find_element_src_event);
gst_pad_set_event_mask_function (typefind->src, gst_type_find_element_src_event_mask);
gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);