diff options
author | David Schleef <ds@schleef.org> | 2003-12-22 01:47:09 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2003-12-22 01:47:09 +0000 |
commit | b144bc6c58979f49a6e8e04a04a65f771247297a (patch) | |
tree | 648bc437ca5562bc7c67224ad71ef90dfacc12d1 /gst/filter | |
parent | 2309d726b7b0c37dbd9c57c653e2053ec6258ac8 (diff) | |
download | gst-plugins-bad-b144bc6c58979f49a6e8e04a04a65f771247297a.tar.gz gst-plugins-bad-b144bc6c58979f49a6e8e04a04a65f771247297a.tar.bz2 gst-plugins-bad-b144bc6c58979f49a6e8e04a04a65f771247297a.zip |
Merge CAPS branch
Original commit message from CVS:
Merge CAPS branch
Diffstat (limited to 'gst/filter')
-rw-r--r-- | gst/filter/gstbpwsinc.c | 21 | ||||
-rw-r--r-- | gst/filter/gstfilter.c | 50 | ||||
-rw-r--r-- | gst/filter/gstfilter.h | 4 | ||||
-rw-r--r-- | gst/filter/gstiir.c | 21 | ||||
-rw-r--r-- | gst/filter/gstlpwsinc.c | 21 |
5 files changed, 49 insertions, 68 deletions
diff --git a/gst/filter/gstbpwsinc.c b/gst/filter/gstbpwsinc.c index c7144621..77529053 100644 --- a/gst/filter/gstbpwsinc.c +++ b/gst/filter/gstbpwsinc.c @@ -105,7 +105,7 @@ static void gst_bpwsinc_get_property (GObject * object, guint prop_id, static void gst_bpwsinc_chain (GstPad * pad, GstData *_data); static GstPadLinkReturn - gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps); + gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps); static GstElementClass *parent_class = NULL; /*static guint gst_bpwsinc_signals[LAST_SIGNAL] = { 0 }; */ @@ -136,8 +136,10 @@ gst_bpwsinc_base_init (gpointer g_class) GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); /* register src pads */ - gst_element_class_add_pad_template (element_class, gst_filter_src_factory ()); - gst_element_class_add_pad_template (element_class, gst_filter_sink_factory ()); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_filter_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_filter_sink_template)); gst_element_class_set_details (element_class, &gst_bpwsinc_details); } @@ -176,12 +178,14 @@ gst_bpwsinc_class_init (GstBPWSincClass * klass) static void gst_bpwsinc_init (GstBPWSinc * filter) { - filter->sinkpad = gst_pad_new_from_template (gst_filter_sink_factory (), "sink"); + filter->sinkpad = gst_pad_new_from_template ( + gst_static_pad_template_get (&gst_filter_sink_template), "sink"); gst_pad_set_chain_function (filter->sinkpad, gst_bpwsinc_chain); gst_pad_set_link_function (filter->sinkpad, gst_bpwsinc_sink_connect); gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); - filter->srcpad = gst_pad_new_from_template (gst_filter_src_factory (), "src"); + filter->srcpad = gst_pad_new_from_template ( + gst_static_pad_template_get (&gst_filter_src_template), "src"); gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad); filter->wing_size = 50; @@ -191,7 +195,7 @@ gst_bpwsinc_init (GstBPWSinc * filter) } static GstPadLinkReturn -gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps) +gst_bpwsinc_sink_connect (GstPad * pad, const GstCaps * caps) { int i = 0; double sum = 0.0; @@ -204,10 +208,7 @@ gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps) g_assert (GST_IS_PAD (pad)); g_assert (caps != NULL); - if (!GST_CAPS_IS_FIXED (caps)) - return GST_PAD_LINK_DELAYED; - - set_retval = gst_pad_try_set_caps (filter->srcpad, gst_caps_ref (caps)); + set_retval = gst_pad_try_set_caps (filter->srcpad, caps); if (set_retval > 0) { diff --git a/gst/filter/gstfilter.c b/gst/filter/gstfilter.c index cb7fe554..7a5d4248 100644 --- a/gst/filter/gstfilter.c +++ b/gst/filter/gstfilter.c @@ -39,43 +39,21 @@ static struct _elements_entry _elements[] = { { NULL, 0 }, }; -GstPadTemplate* -gst_filter_src_factory (void) -{ - static GstPadTemplate *templ = NULL; - if (!templ) { - templ = GST_PAD_TEMPLATE_NEW ( - "src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - gst_caps_new ( - "filter_src", - "audio/x-raw-float", - GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS - ) - ); - } - return templ; -} +GstStaticPadTemplate gst_filter_src_template = +GST_STATIC_PAD_TEMPLATE ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ( GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS ) +); -GstPadTemplate* -gst_filter_sink_factory (void) -{ - static GstPadTemplate *templ = NULL; - if (!templ) { - templ = GST_PAD_TEMPLATE_NEW ( - "sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - gst_caps_new ( - "filter_src", - "audio/x-raw-float", - GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS - ) - ); - } - return templ; -} +GstStaticPadTemplate gst_filter_sink_template = +GST_STATIC_PAD_TEMPLATE ( + "sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ( GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS ) +); static gboolean plugin_init (GstPlugin * plugin) diff --git a/gst/filter/gstfilter.h b/gst/filter/gstfilter.h index 4669e554..1ad53a81 100644 --- a/gst/filter/gstfilter.h +++ b/gst/filter/gstfilter.h @@ -29,7 +29,7 @@ GType gst_iir_get_type (void); GType gst_lpwsinc_get_type (void); GType gst_bpwsinc_get_type (void); -extern GstPadTemplate *gst_filter_sink_factory (); -extern GstPadTemplate *gst_filter_src_factory (); +extern GstStaticPadTemplate gst_filter_sink_template; +extern GstStaticPadTemplate gst_filter_src_template; #endif /* __GST_FILTER_H__ */ diff --git a/gst/filter/gstiir.c b/gst/filter/gstiir.c index 007bdb7a..4ccf9f09 100644 --- a/gst/filter/gstiir.c +++ b/gst/filter/gstiir.c @@ -89,7 +89,7 @@ static void gst_iir_get_property (GObject * object, guint prop_id, static void gst_iir_chain (GstPad * pad, GstData *_data); static GstPadLinkReturn - gst_iir_sink_connect (GstPad * pad, GstCaps * caps); + gst_iir_sink_connect (GstPad * pad, const GstCaps * caps); static GstElementClass *parent_class = NULL; /*static guint gst_iir_signals[LAST_SIGNAL] = { 0 }; */ @@ -120,8 +120,10 @@ gst_iir_base_init (gpointer g_class) GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); /* register src pads */ - gst_element_class_add_pad_template (element_class, gst_filter_src_factory ()); - gst_element_class_add_pad_template (element_class, gst_filter_sink_factory ()); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_filter_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_filter_sink_template)); gst_element_class_set_details (element_class, &gst_iir_details); } @@ -161,12 +163,14 @@ gst_iir_class_init (GstIIRClass * klass) static void gst_iir_init (GstIIR * filter) { - filter->sinkpad = gst_pad_new_from_template (gst_filter_sink_factory (), "sink"); + filter->sinkpad = gst_pad_new_from_template ( + gst_static_pad_template_get (&gst_filter_sink_template), "sink"); gst_pad_set_chain_function (filter->sinkpad, gst_iir_chain); gst_pad_set_link_function (filter->sinkpad, gst_iir_sink_connect); gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); - filter->srcpad = gst_pad_new_from_template (gst_filter_src_factory (), "src"); + filter->srcpad = gst_pad_new_from_template ( + gst_static_pad_template_get (&gst_filter_src_template), "src"); gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad); filter->A = 0.0; @@ -177,17 +181,14 @@ gst_iir_init (GstIIR * filter) } static GstPadLinkReturn -gst_iir_sink_connect (GstPad * pad, GstCaps * caps) +gst_iir_sink_connect (GstPad * pad, const GstCaps * caps) { GstIIR *filter; GstPadLinkReturn set_retval; filter = GST_IIR (gst_pad_get_parent (pad)); - if (!GST_CAPS_IS_FIXED (caps)) - return GST_PAD_LINK_DELAYED; - - set_retval = gst_pad_try_set_caps(filter->srcpad, gst_caps_ref (caps)); + set_retval = gst_pad_try_set_caps(filter->srcpad, caps); if (set_retval > 0) { /* connection works, so init the filter */ /* FIXME: remember to free it */ diff --git a/gst/filter/gstlpwsinc.c b/gst/filter/gstlpwsinc.c index aaa7463e..603d8775 100644 --- a/gst/filter/gstlpwsinc.c +++ b/gst/filter/gstlpwsinc.c @@ -102,7 +102,7 @@ static void gst_lpwsinc_get_property (GObject * object, guint prop_id, static void gst_lpwsinc_chain (GstPad * pad, GstData *_data); static GstPadLinkReturn - gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps); + gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps); static GstElementClass *parent_class = NULL; /*static guint gst_lpwsinc_signals[LAST_SIGNAL] = { 0 }; */ @@ -133,8 +133,10 @@ gst_lpwsinc_base_init (gpointer g_class) GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); /* register src pads */ - gst_element_class_add_pad_template (element_class, gst_filter_src_factory ()); - gst_element_class_add_pad_template (element_class, gst_filter_sink_factory ()); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_filter_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_filter_sink_template)); gst_element_class_set_details (element_class, &gst_lpwsinc_details); } @@ -168,12 +170,14 @@ gst_lpwsinc_class_init (GstLPWSincClass * klass) static void gst_lpwsinc_init (GstLPWSinc * filter) { - filter->sinkpad = gst_pad_new_from_template (gst_filter_sink_factory (), "sink"); + filter->sinkpad = gst_pad_new_from_template ( + gst_static_pad_template_get (&gst_filter_sink_template), "sink"); gst_pad_set_chain_function (filter->sinkpad, gst_lpwsinc_chain); gst_pad_set_link_function (filter->sinkpad, gst_lpwsinc_sink_connect); gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad); - filter->srcpad = gst_pad_new_from_template (gst_filter_src_factory (), "src"); + filter->srcpad = gst_pad_new_from_template ( + gst_static_pad_template_get (&gst_filter_src_template), "src"); gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad); filter->wing_size = 50; @@ -182,7 +186,7 @@ gst_lpwsinc_init (GstLPWSinc * filter) } static GstPadLinkReturn -gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps) +gst_lpwsinc_sink_connect (GstPad * pad, const GstCaps * caps) { int i = 0; double sum = 0.0; @@ -193,10 +197,7 @@ gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps) g_assert (GST_IS_PAD (pad)); g_assert (caps != NULL); - if (!GST_CAPS_IS_FIXED (caps)) - return GST_PAD_LINK_DELAYED; - - set_retval = gst_pad_try_set_caps(filter->srcpad, gst_caps_ref (caps)); + set_retval = gst_pad_try_set_caps(filter->srcpad, caps); if (set_retval > 0) { |