summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2003-12-08 10:08:13 +0000
committerDavid Schleef <ds@schleef.org>2003-12-08 10:08:13 +0000
commit6e632b821c61ff7e757a5ab8b2c34786b7408daa (patch)
treef862d616cefe5ad59d20a2475356ccc91f8169e2
parent38bcf22a6ad1239af696acea7ddbb3f1bd95307e (diff)
downloadgstreamer-plugins-bad-6e632b821c61ff7e757a5ab8b2c34786b7408daa.tar.gz
Convert to new caps
Original commit message from CVS: Convert to new caps
-rw-r--r--gst/festival/gstfestival.c50
-rw-r--r--gst/filter/gstbpwsinc.c21
-rw-r--r--gst/filter/gstfilter.c50
-rw-r--r--gst/filter/gstfilter.h4
-rw-r--r--gst/filter/gstiir.c21
-rw-r--r--gst/filter/gstlpwsinc.c21
-rw-r--r--gst/flx/gstflxdec.c58
7 files changed, 87 insertions, 138 deletions
diff --git a/gst/festival/gstfestival.c b/gst/festival/gstfestival.c
index 71e97e526..ad3a0c5c6 100644
--- a/gst/festival/gstfestival.c
+++ b/gst/festival/gstfestival.c
@@ -97,27 +97,28 @@ static GstElementDetails gst_festival_details = GST_ELEMENT_DETAILS (
"Wim Taymans <wim.taymans@chello.be>"
);
-GST_PAD_TEMPLATE_FACTORY (sink_template_factory,
+static GstStaticPadTemplate sink_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"festival_sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "festival_wav",
- "text/plain",
- NULL
- )
-)
+ GST_STATIC_CAPS ( "text/plain" )
+);
-GST_PAD_TEMPLATE_FACTORY (src_template_factory,
+static GstStaticPadTemplate src_template_factory =
+GST_STATIC_PAD_TEMPLATE (
"festival_src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- gst_caps_new (
- "festival_raw",
- "audio/x-raw-int",
- GST_AUDIO_INT_PAD_TEMPLATE_PROPS
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) TRUE, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) 16000, "
+ "channels = (int) 1"
)
-)
+);
/* Festival signals and args */
enum {
@@ -161,8 +162,10 @@ gst_festival_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_PAD_TEMPLATE_GET (sink_template_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (src_template_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_template_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&src_template_factory));
gst_element_class_set_details (element_class, &gst_festival_details);
}
@@ -183,12 +186,12 @@ static void
gst_festival_init (GstFestival *festival)
{
festival->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_template_factory), "sink");
+ gst_static_pad_template_get (&sink_template_factory), "sink");
gst_pad_set_chain_function (festival->sinkpad, gst_festival_chain);
gst_element_add_pad (GST_ELEMENT (festival), festival->sinkpad);
festival->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_template_factory), "src");
+ gst_static_pad_template_get (&src_template_factory), "src");
gst_element_add_pad (GST_ELEMENT (festival), festival->srcpad);
festival->info = festival_default_info();
@@ -254,19 +257,6 @@ gst_festival_chain (GstPad *pad, GstData *_data)
GST_BUFFER_DATA (outbuf) = wavefile;
GST_BUFFER_SIZE (outbuf) = filesize;
- if (!GST_PAD_CAPS (festival->srcpad)) {
- gst_pad_try_set_caps (festival->srcpad,
- GST_CAPS_NEW (
- "festival_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "width", GST_PROPS_INT (16),
- "depth", GST_PROPS_INT (16),
- "rate", GST_PROPS_INT (16000),
- "channels", GST_PROPS_INT (1)
- ));
- }
gst_pad_push (festival->srcpad, GST_DATA (outbuf));
wavefile = NULL;
diff --git a/gst/filter/gstbpwsinc.c b/gst/filter/gstbpwsinc.c
index c71446215..d9d608d71 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 GstCaps2 * 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 GstCaps2 * 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 8b5a8cd93..85c158764 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 4669e554d..1ad53a816 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 007bdb7a5..60c5c6372 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 GstCaps2 * 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 GstCaps2 * 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 aaa7463ed..d549db525 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 GstCaps2 * 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 GstCaps2 * 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)
{
diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c
index 6a8a6101a..e7088d61c 100644
--- a/gst/flx/gstflxdec.c
+++ b/gst/flx/gstflxdec.c
@@ -47,36 +47,22 @@ enum {
};
/* input */
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
+static GstStaticPadTemplate sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "flxdec_sink",
- "video/x-fli",
- NULL
- )
-)
+ GST_STATIC_CAPS ( "video/x-fli" )
+);
/* output */
-GST_PAD_TEMPLATE_FACTORY (src_video_factory,
+static GstStaticPadTemplate src_video_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "src_video",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (32),
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT (R_MASK_32),
- "green_mask", GST_PROPS_INT (G_MASK_32),
- "blue_mask", GST_PROPS_INT (B_MASK_32),
- "width", GST_PROPS_INT_RANGE(320, 1280),
- "height", GST_PROPS_INT_RANGE(200, 1024),
- "framerate", GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT)
- )
-)
+ GST_STATIC_CAPS ( GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 )
+);
static void gst_flxdec_class_init (GstFlxDecClass *klass);
@@ -130,9 +116,9 @@ gst_flxdec_base_init (GstFlxDecClass *klass)
gst_element_class_set_details (gstelement_class, &flxdec_details);
gst_element_class_add_pad_template (gstelement_class,
- GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_static_pad_template_get (&sink_factory));
gst_element_class_add_pad_template (gstelement_class,
- GST_PAD_TEMPLATE_GET (src_video_factory));
+ gst_static_pad_template_get (&src_video_factory));
}
static void
@@ -158,12 +144,12 @@ static void
gst_flxdec_init(GstFlxDec *flxdec)
{
flxdec->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ gst_static_pad_template_get (&sink_factory), "sink");
gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->sinkpad);
gst_element_set_loop_function(GST_ELEMENT(flxdec),gst_flxdec_loop);
flxdec->srcpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (src_video_factory), "src");
+ gst_static_pad_template_get (&src_video_factory), "src");
gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->srcpad);
flxdec->bs = NULL;
@@ -444,6 +430,7 @@ gst_flxdec_loop (GstElement *element)
GstBuffer *buf;
GstBuffer *databuf;
guchar *data, *chunk;
+ GstCaps2 *caps;
GstFlxDec *flxdec;
FlxHeader *flxh;
@@ -497,19 +484,11 @@ gst_flxdec_loop (GstElement *element)
flxdec->frame_time = flxh->speed * GST_MSECOND;
}
- gst_pad_try_set_caps (flxdec->srcpad,
- GST_CAPS_NEW (
- "src_video",
- "video/x-raw-rgb",
- "bpp", GST_PROPS_INT (32),
- "depth", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BIG_ENDIAN),
- "red_mask", GST_PROPS_INT (R_MASK_32),
- "green_mask", GST_PROPS_INT (G_MASK_32),
- "blue_mask", GST_PROPS_INT (B_MASK_32),
- "width", GST_PROPS_INT (flxh->width),
- "height", GST_PROPS_INT (flxh->height),
- "framerate", GST_PROPS_FLOAT (GST_SECOND/flxdec->frame_time)));
+ caps = gst_caps2_from_string (GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32);
+ gst_caps2_set_simple (caps,
+ "width", G_TYPE_INT, flxh->width,
+ "height", G_TYPE_INT, flxh->height,
+ "framerate", G_TYPE_DOUBLE, GST_SECOND/flxdec->frame_time, NULL);
if (flxh->depth <= 8)
flxdec->converter = flx_colorspace_converter_new(flxh->width, flxh->height);
@@ -521,7 +500,6 @@ gst_flxdec_loop (GstElement *element)
g_print("GstFlxDec: (FLC) oframe1 : 0x%08x\n", flxh->oframe1);
g_print("GstFlxDec: (FLC) oframe2 : 0x%08x\n", flxh->oframe2);
}
-
flxdec->size = (flxh->width * flxh->height);