summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2003-12-13 02:48:50 +0000
committerDavid Schleef <ds@schleef.org>2003-12-13 02:48:50 +0000
commitd77f691c0b2dc2b302240fb2778bce93bc88475c (patch)
tree7d61a1b0528e36c2b8e814963cb735d3836f1451
parent942b69be576796f5457f438ac7da1d7ba416e913 (diff)
downloadgstreamer-plugins-bad-d77f691c0b2dc2b302240fb2778bce93bc88475c.tar.gz
conver to new caps
Original commit message from CVS: conver to new caps
-rw-r--r--ext/arts/gst_arts.c50
-rw-r--r--ext/artsd/gstartsdsink.c56
-rw-r--r--ext/audiofile/gstafparse.c78
-rw-r--r--ext/audiofile/gstafsink.c53
-rw-r--r--ext/audiofile/gstafsrc.c48
5 files changed, 125 insertions, 160 deletions
diff --git a/ext/arts/gst_arts.c b/ext/arts/gst_arts.c
index 15534cfe7..85e31e1aa 100644
--- a/ext/arts/gst_arts.c
+++ b/ext/arts/gst_arts.c
@@ -38,36 +38,34 @@ static GstElementDetails gst_arts_details = {
};
-GST_PAD_TEMPLATE_FACTORY ( sink_temp,
+static GstStaticPadTemplate sink_temp =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "arts_sample",
- "audio/x-raw-int",
- "depth", GST_PROPS_INT (16),
- "width", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "channels", GST_PROPS_INT (2),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER)
+ GST_STATIC_CAPS ( "audio/x-raw-int, "
+ "depth = (int) 16, "
+ "width = (int) 16, "
+ "signed = (boolean) true, "
+ "channels = (int) 2, "
+ "endianness = (int) byte_order"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY ( src_temp,
+static GstStaticPadTemplate src_temp =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "arts_sample",
- "audio/x-raw-int",
- "depth", GST_PROPS_INT (16),
- "width", GST_PROPS_INT (16),
- "signed", GST_PROPS_BOOLEAN (TRUE),
- "channels", GST_PROPS_INT (2),
- "rate", GST_PROPS_INT (44100),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER)
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "depth = (int) 16, "
+ "width = (int) 16, "
+ "signed = (boolean) true, "
+ "channels = (int) 2, "
+ "rate = (int) 44100, "
+ "endianness = (int) byte_order"
)
-)
+);
enum {
ARG_0,
@@ -112,9 +110,9 @@ gst_arts_base_init (gpointer g_class)
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (sink_temp));
+ gst_static_pad_template_get (&sink_temp));
gst_element_class_add_pad_template (element_class,
- GST_PAD_TEMPLATE_GET (src_temp));
+ gst_static_pad_template_get (&src_temp));
gst_element_class_set_details (element_class, &gst_arts_details);
}
@@ -133,10 +131,12 @@ gst_arts_class_init (GstARTSClass *klass)
static void
gst_arts_init (GstARTS *arts)
{
- arts->sinkpad = gst_pad_new_from_template(GST_PAD_TEMPLATE_GET(sink_temp),"sink");
+ arts->sinkpad = gst_pad_new_from_template(
+ gst_element_get_pad_template (GST_ELEMENT (arts), "sink"), "sink");
gst_element_add_pad(GST_ELEMENT(arts),arts->sinkpad);
- arts->srcpad = gst_pad_new_from_template(GST_PAD_TEMPLATE_GET(src_temp),"src");
+ arts->srcpad = gst_pad_new_from_template(
+ gst_element_get_pad_template (GST_ELEMENT (arts), "src"), "src");
gst_element_add_pad(GST_ELEMENT(arts),arts->srcpad);
gst_element_set_loop_function (GST_ELEMENT (arts), gst_arts_loop);
diff --git a/ext/artsd/gstartsdsink.c b/ext/artsd/gstartsdsink.c
index e02229ea8..7bb917576 100644
--- a/ext/artsd/gstartsdsink.c
+++ b/ext/artsd/gstartsdsink.c
@@ -24,6 +24,7 @@
#include "config.h"
#endif
#include "gstartsdsink.h"
+#include <gst/audio/audio.h>
/* elementfactory information */
static GstElementDetails artsdsink_details = {
@@ -45,31 +46,12 @@ enum {
ARG_NAME,
};
-GST_PAD_TEMPLATE_FACTORY (sink_factory,
- "sink", /* the name of the pads */
- GST_PAD_SINK, /* type of the pad */
- GST_PAD_ALWAYS, /* ALWAYS/SOMETIMES */
- GST_CAPS_NEW (
- "artsdsink_sink", /* the name of the caps */
- "audio/x-raw-int", /* the mime type of the caps */
- "format", GST_PROPS_STRING ("int"),
- "law", GST_PROPS_INT (0),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_BOOLEAN (FALSE),
- "width", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "depth", GST_PROPS_LIST (
- GST_PROPS_INT (8),
- GST_PROPS_INT (16)
- ),
- "rate", GST_PROPS_INT_RANGE (8000, 96000),
- "channels", GST_PROPS_LIST (
- GST_PROPS_INT (1),
- GST_PROPS_INT (2)
- )
- )
+static GstStaticPadTemplate sink_factory =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS)
);
static void gst_artsdsink_base_init (gpointer g_class);
@@ -80,7 +62,7 @@ static gboolean gst_artsdsink_open_audio (GstArtsdsink *sink);
static void gst_artsdsink_close_audio (GstArtsdsink *sink);
static GstElementStateReturn gst_artsdsink_change_state (GstElement *element);
static gboolean gst_artsdsink_sync_parms (GstArtsdsink *artsdsink);
-static GstPadLinkReturn gst_artsdsink_link (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_artsdsink_link (GstPad *pad, const GstCaps2 *caps);
static void gst_artsdsink_chain (GstPad *pad, GstData *_data);
static void gst_artsdsink_set_property (GObject *object, guint prop_id,
@@ -118,7 +100,8 @@ gst_artsdsink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&sink_factory));
gst_element_class_set_details (element_class, &artsdsink_details);
}
@@ -151,7 +134,7 @@ static void
gst_artsdsink_init(GstArtsdsink *artsdsink)
{
artsdsink->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (sink_factory), "sink");
+ gst_element_get_pad_template (GST_ELEMENT (artsdsink), "sink"), "sink");
gst_element_add_pad(GST_ELEMENT(artsdsink), artsdsink->sinkpad);
gst_pad_set_chain_function(artsdsink->sinkpad, gst_artsdsink_chain);
gst_pad_set_link_function(artsdsink->sinkpad, gst_artsdsink_link);
@@ -175,19 +158,16 @@ gst_artsdsink_sync_parms (GstArtsdsink *artsdsink)
}
static GstPadLinkReturn
-gst_artsdsink_link (GstPad *pad, GstCaps *caps)
+gst_artsdsink_link (GstPad *pad, const GstCaps2 *caps)
{
GstArtsdsink *artsdsink = GST_ARTSDSINK (gst_pad_get_parent (pad));
+ GstStructure *structure;
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get (caps,
- "rate", &artsdsink->frequency,
- "depth", &artsdsink->depth,
- "signed", &artsdsink->signd,
- "channels", &artsdsink->channels,
- NULL);
+ structure = gst_caps2_get_nth_cap (caps, 0);
+ gst_structure_get_int (structure, "rate", &artsdsink->frequency);
+ gst_structure_get_int (structure, "depth", &artsdsink->depth);
+ gst_structure_get_int (structure, "signed", &artsdsink->signd);
+ gst_structure_get_int (structure, "channels", &artsdsink->channels);
if (gst_artsdsink_sync_parms (artsdsink))
return GST_PAD_LINK_OK;
diff --git a/ext/audiofile/gstafparse.c b/ext/audiofile/gstafparse.c
index 6df1ca2eb..52e319ec4 100644
--- a/ext/audiofile/gstafparse.c
+++ b/ext/audiofile/gstafparse.c
@@ -50,42 +50,34 @@ enum {
};
/* added a src factory function to force audio/raw MIME type */
-GST_PAD_TEMPLATE_FACTORY (afparse_src_factory,
+static GstStaticPadTemplate afparse_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audiofile_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (TRUE), GST_PROPS_BOOLEAN (FALSE)),
- "width", GST_PROPS_INT_RANGE (8, 16),
- "depth", GST_PROPS_INT_RANGE (8, 16),
- "rate", GST_PROPS_INT_RANGE (1, G_MAXINT),
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS (
+ "audio/x-raw-int, "
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, MAX ], "
+ "endianness = (int) BYTE_ORDER, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "signed = (boolean) { true, false }, "
+ "buffer-frames = (int) [ 1, MAX ]"
)
-)
+);
-GST_PAD_TEMPLATE_FACTORY (afparse_sink_factory,
+static GstStaticPadTemplate afparse_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "afparse_sink_aiff",
- "audio/x-aiff",
- NULL
- ),
- GST_CAPS_NEW (
- "afparse_sink_wav",
- "audio/x-wav",
- NULL
- ),
- GST_CAPS_NEW (
- "afparse_sink_snd",
- "audio/x-au",
- NULL
+ GST_STATIC_CAPS (
+ "audio/x-aiff; "
+ "audio/x-wav; "
+ "audio/x-au"
)
-)
+);
static void gst_afparse_base_init (gpointer g_class);
static void gst_afparse_class_init(GstAFParseClass *klass);
@@ -131,8 +123,10 @@ gst_afparse_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (afparse_src_factory));
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (afparse_sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&afparse_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&afparse_sink_factory));
gst_element_class_set_details (element_class, &afparse_details);
}
@@ -154,10 +148,12 @@ gst_afparse_class_init (GstAFParseClass *klass)
static void
gst_afparse_init (GstAFParse *afparse)
{
- afparse->srcpad = gst_pad_new_from_template (afparse_src_factory (), "src");
+ afparse->srcpad = gst_pad_new_from_template (
+ gst_element_get_pad_template (GST_ELEMENT (afparse), "src"), "src");
gst_element_add_pad (GST_ELEMENT (afparse), afparse->srcpad);
- afparse->sinkpad = gst_pad_new_from_template (afparse_sink_factory (), "sink");
+ afparse->sinkpad = gst_pad_new_from_template (
+ gst_element_get_pad_template (GST_ELEMENT (afparse), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (afparse), afparse->sinkpad);
gst_element_set_loop_function (GST_ELEMENT (afparse), gst_afparse_loop);
@@ -389,17 +385,15 @@ gst_afparse_open_file (GstAFParse *afparse)
/* set caps on src */
/*FIXME: add all the possible formats, especially float ! */
gst_pad_try_set_caps (afparse->srcpad,
- GST_CAPS_NEW (
- "af_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER), /*FIXME */
- "signed", GST_PROPS_BOOLEAN (afparse->is_signed),
- "width", GST_PROPS_INT (afparse->width),
- "depth", GST_PROPS_INT (afparse->width),
- "rate", GST_PROPS_INT (afparse->rate),
- "channels", GST_PROPS_INT (afparse->channels)
- )
- );
+ gst_caps2_new_simple (
+ "audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, afparse->is_signed,
+ "width", G_TYPE_INT, afparse->width,
+ "depth", G_TYPE_INT, afparse->width,
+ "rate", G_TYPE_INT, afparse->rate,
+ "channels", G_TYPE_INT, afparse->channels,
+ NULL));
GST_FLAG_SET (afparse, GST_AFPARSE_OPEN);
diff --git a/ext/audiofile/gstafsink.c b/ext/audiofile/gstafsink.c
index efe242d47..8dad9ede2 100644
--- a/ext/audiofile/gstafsink.c
+++ b/ext/audiofile/gstafsink.c
@@ -52,22 +52,19 @@ enum {
/* added a sink factory function to force audio/raw MIME type */
/* I think the caps can be broader, we need to change that somehow */
-GST_PAD_TEMPLATE_FACTORY (afsink_sink_factory,
+static GstStaticPadTemplate afsink_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audiofile_sink",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- "width", GST_PROPS_INT_RANGE (8, 16),
- "depth", GST_PROPS_INT_RANGE (8, 16),
- "rate", GST_PROPS_INT_RANGE (4000, 48000), /*FIXME*/
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, 2 ], "
+ "endianness = (int) BYTE_ORDER, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "signed = (boolean) { true, false }, "
+ "buffer-frames = (int) [ 1, MAX ]"
)
);
@@ -143,7 +140,8 @@ gst_afsink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (afsink_sink_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&afsink_sink_factory));
gst_element_class_set_details (element_class, &afsink_details);
}
@@ -188,7 +186,7 @@ gst_afsink_init (GstAFSink *afsink)
/* GstPad *pad; this is now done in the struct */
afsink->sinkpad = gst_pad_new_from_template (
- GST_PAD_TEMPLATE_GET (afsink_sink_factory), "sink");
+ gst_element_get_pad_template (GST_ELEMENT (afsink), "sink"), "sink");
gst_element_add_pad (GST_ELEMENT (afsink), afsink->sinkpad);
gst_pad_set_chain_function (afsink->sinkpad, gst_afsink_chain);
@@ -284,7 +282,8 @@ static gboolean
gst_afsink_open_file (GstAFSink *sink)
{
AFfilesetup outfilesetup;
- GstCaps *caps;
+ const GstCaps2 *caps;
+ GstStructure *structure;
int sample_format; /* audiofile's sample format, look in audiofile.h */
int byte_order = 0; /* audiofile's byte order defines */
@@ -301,22 +300,18 @@ gst_afsink_open_file (GstAFSink *sink)
*/
/* get the audio parameters */
- caps = NULL;
g_return_val_if_fail (GST_IS_PAD (sink->sinkpad), FALSE);
caps = GST_PAD_CAPS (sink->sinkpad);
- if (caps == NULL)
- {
- /* FIXME : Please change this to a better warning method ! */
- printf ("WARNING: gstafsink chain : Could not get caps of pad !\n");
- }
- else
- {
- gst_caps_get_int (caps, "channels", &sink->channels);
- gst_caps_get_int (caps, "width", &sink->width);
- gst_caps_get_int (caps, "rate", &sink->rate);
- gst_caps_get_boolean (caps, "signed", &sink->is_signed);
- gst_caps_get_int (caps, "endianness", &sink->endianness_data);
+ if (caps == NULL) {
+ g_critical ("gstafsink chain : Could not get caps of pad !\n");
+ } else {
+ structure = gst_caps2_get_nth_cap (caps, 0);
+ gst_structure_get_int (structure, "channels", &sink->channels);
+ gst_structure_get_int (structure, "width", &sink->width);
+ gst_structure_get_int (structure, "rate", &sink->rate);
+ gst_structure_get_boolean (structure, "signed", &sink->is_signed);
+ gst_structure_get_int (structure, "endianness", &sink->endianness_data);
}
GST_DEBUG ("channels %d, width %d, rate %d, signed %s",
sink->channels, sink->width, sink->rate,
diff --git a/ext/audiofile/gstafsrc.c b/ext/audiofile/gstafsrc.c
index 13e228fca..a569f8bf8 100644
--- a/ext/audiofile/gstafsrc.c
+++ b/ext/audiofile/gstafsrc.c
@@ -51,22 +51,19 @@ enum {
/* added a src factory function to force audio/raw MIME type */
/* I think the caps can be broader, we need to change that somehow */
-GST_PAD_TEMPLATE_FACTORY (afsrc_src_factory,
+static GstStaticPadTemplate afsrc_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "audiofile_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "signed", GST_PROPS_LIST (
- GST_PROPS_BOOLEAN (TRUE),
- GST_PROPS_BOOLEAN (FALSE)
- ),
- "width", GST_PROPS_INT_RANGE (8, 16),
- "depth", GST_PROPS_INT_RANGE (8, 16),
- "rate", GST_PROPS_INT_RANGE (4000, 48000), /*FIXME*/
- "channels", GST_PROPS_INT_RANGE (1, 2)
+ GST_STATIC_CAPS ("audio/x-raw-int, "
+ "rate = (int) [ 1, MAX ], "
+ "channels = (int) [ 1, MAX ], "
+ "endianness = (int) BYTE_ORDER, "
+ "width = (int) { 8, 16 }, "
+ "depth = (int) { 8, 16 }, "
+ "signed = (boolean) { true, false }, "
+ "buffer-frames = (int) [ 1, MAX ]"
)
);
@@ -142,7 +139,8 @@ gst_afsrc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (afsrc_src_factory));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&afsrc_src_factory));
gst_element_class_set_details (element_class, &afsrc_details);
}
@@ -178,7 +176,8 @@ static void
gst_afsrc_init (GstAFSrc *afsrc)
{
/* no need for a template, caps are set based on file, right ? */
- afsrc->srcpad = gst_pad_new_from_template (afsrc_src_factory (), "src");
+ afsrc->srcpad = gst_pad_new_from_template (
+ gst_element_get_pad_template (GST_ELEMENT (afsrc), "src"), "src");
gst_element_add_pad (GST_ELEMENT (afsrc), afsrc->srcpad);
gst_pad_set_get_function (afsrc->srcpad, gst_afsrc_get);
@@ -342,17 +341,14 @@ gst_afsrc_open_file (GstAFSrc *src)
/* set caps on src */
/*FIXME: add all the possible formats, especially float ! */
gst_pad_try_set_caps (src->srcpad,
- GST_CAPS_NEW (
- "af_src",
- "audio/x-raw-int",
- "endianness", GST_PROPS_INT (G_BYTE_ORDER), /*FIXME */
- "signed", GST_PROPS_BOOLEAN (src->is_signed),
- "width", GST_PROPS_INT (src->width),
- "depth", GST_PROPS_INT (src->width),
- "rate", GST_PROPS_INT (src->rate),
- "channels", GST_PROPS_INT (src->channels)
- )
- );
+ gst_caps2_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, src->is_signed,
+ "width", G_TYPE_INT, src->width,
+ "depth", G_TYPE_INT, src->width,
+ "rate", G_TYPE_INT, src->rate,
+ "channels", G_TYPE_INT, src->channels,
+ NULL));
GST_FLAG_SET (src, GST_AFSRC_OPEN);