summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2003-12-19 09:08:03 +0000
committerDavid Schleef <ds@schleef.org>2003-12-19 09:08:03 +0000
commitb1789e0711fb15218d04b6a0ccd7a42e03113401 (patch)
tree1bead34215b8083f8eea75b84b88d9f30e3ba0ec
parent8f235b8a62a0cf8a3095ef8fb6c130ce43f36fde (diff)
downloadgstreamer-plugins-bad-b1789e0711fb15218d04b6a0ccd7a42e03113401.tar.gz
Convert to caps
Original commit message from CVS: Convert to caps
-rw-r--r--ext/audiofile/gstafparse.c5
-rw-r--r--ext/gsm/gstgsmdec.c93
-rw-r--r--ext/gsm/gstgsmenc.c100
-rw-r--r--ext/jack/gstjack.c48
-rw-r--r--ext/ladspa/gstladspa.c132
-rw-r--r--ext/ladspa/gstladspa.h2
-rw-r--r--ext/sdl/sdlvideosink.c7
-rw-r--r--ext/sdl/sdlvideosink.h1
-rw-r--r--ext/sndfile/gstsf.c69
-rw-r--r--ext/swfdec/gstswfdec.c12
-rw-r--r--ext/swfdec/gstswfdec.h1
11 files changed, 187 insertions, 283 deletions
diff --git a/ext/audiofile/gstafparse.c b/ext/audiofile/gstafparse.c
index 52e319ec4..bb37687b7 100644
--- a/ext/audiofile/gstafparse.c
+++ b/ext/audiofile/gstafparse.c
@@ -187,7 +187,6 @@ gst_afparse_loop(GstElement *element)
{
GstAFParse *afparse;
GstBuffer *buf;
- GstBufferPool *bufpool;
gint numframes = 0, frames_to_bytes, frames_per_read, bytes_per_read;
guint8 *data;
gboolean bypass_afread = TRUE;
@@ -226,7 +225,6 @@ gst_afparse_loop(GstElement *element)
frames_per_read = afparse->frames_per_read;
bytes_per_read = frames_per_read * frames_to_bytes;
- bufpool = gst_buffer_pool_get_default (bytes_per_read, 8);
afSeekFrame(afparse->file, AF_DEFAULT_TRACK, 0);
if (bypass_afread){
@@ -265,7 +263,7 @@ gst_afparse_loop(GstElement *element)
}
else {
do {
- buf = gst_buffer_new_from_pool (bufpool, 0, 0);
+ buf = gst_buffer_new_and_alloc (bytes_per_read);
GST_BUFFER_TIMESTAMP(buf) = afparse->timestamp;
data = GST_BUFFER_DATA(buf);
numframes = afReadFrames (afparse->file, AF_DEFAULT_TRACK, data, frames_per_read);
@@ -286,7 +284,6 @@ gst_afparse_loop(GstElement *element)
while (TRUE);
}
gst_afparse_close_file (afparse);
- gst_buffer_pool_unref(bufpool);
gst_bytestream_destroy ((GstByteStream*) afparse->vfile->closure);
diff --git a/ext/gsm/gstgsmdec.c b/ext/gsm/gstgsmdec.c
index 095140c1d..2a218c838 100644
--- a/ext/gsm/gstgsmdec.c
+++ b/ext/gsm/gstgsmdec.c
@@ -25,8 +25,6 @@
#include "gstgsmdec.h"
-static GstPadTemplate *gsmdec_src_template, *gsmdec_sink_template;
-
/* elementfactory information */
GstElementDetails gst_gsmdec_details = {
"GSM audio decoder",
@@ -51,7 +49,7 @@ static void gst_gsmdec_class_init (GstGSMDec *klass);
static void gst_gsmdec_init (GstGSMDec *gsmdec);
static void gst_gsmdec_chain (GstPad *pad, GstData *_data);
-static GstPadLinkReturn gst_gsmdec_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_gsmdec_sinkconnect (GstPad *pad, const GstCaps2 *caps);
static GstElementClass *parent_class = NULL;
/*static guint gst_gsmdec_signals[LAST_SIGNAL] = { 0 }; */
@@ -77,39 +75,43 @@ gst_gsmdec_get_type(void) {
return gsmdec_type;
}
-GST_CAPS_FACTORY (gsm_caps_factory,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
- )
-)
-
-GST_CAPS_FACTORY (raw_caps_factory,
- GST_CAPS_NEW (
- "gsm_raw",
- "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_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
+GstStaticPadTemplate gsmdec_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (
+ "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
+ )
+);
+
+GstStaticPadTemplate gsmdec_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (
+ "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
)
-)
+);
static void
gst_gsmdec_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gsmdec_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS, gsm_caps_factory(), NULL);
- gsmdec_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS, raw_caps_factory(), NULL);
- gst_element_class_add_pad_template (element_class, gsmdec_sink_template);
- gst_element_class_add_pad_template (element_class, gsmdec_src_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gsmdec_sink_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gsmdec_src_template));
gst_element_class_set_details (element_class, &gst_gsmdec_details);
}
@@ -129,12 +131,14 @@ gst_gsmdec_init (GstGSMDec *gsmdec)
GST_DEBUG ("gst_gsmdec_init: initializing");
/* create the sink and src pads */
- gsmdec->sinkpad = gst_pad_new_from_template (gsmdec_sink_template, "sink");
+ gsmdec->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gsmdec_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (gsmdec), gsmdec->sinkpad);
gst_pad_set_chain_function (gsmdec->sinkpad, gst_gsmdec_chain);
gst_pad_set_link_function (gsmdec->sinkpad, gst_gsmdec_sinkconnect);
- gsmdec->srcpad = gst_pad_new_from_template (gsmdec_src_template, "src");
+ gsmdec->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gsmdec_src_template), "src");
gst_element_add_pad (GST_ELEMENT (gsmdec), gsmdec->srcpad);
gsmdec->state = gsm_create ();
@@ -142,29 +146,26 @@ gst_gsmdec_init (GstGSMDec *gsmdec)
}
static GstPadLinkReturn
-gst_gsmdec_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_gsmdec_sinkconnect (GstPad *pad, const GstCaps2 *caps)
{
GstGSMDec *gsmdec;
gint rate;
+ GstStructure *structure;
gsmdec = GST_GSMDEC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "rate", &rate);
+ structure = gst_caps2_get_nth_cap (caps, 0);
+ gst_structure_get_int (structure, "rate", &rate);
if (gst_pad_try_set_caps (gsmdec->srcpad,
- GST_CAPS_NEW (
- "gsm_raw",
- "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 (rate),
- "channels", GST_PROPS_INT (1)
- )) > 0)
+ gst_caps2_new_simple ("audio/x-raw-int",
+ "endianness", G_TYPE_INT, G_BYTE_ORDER,
+ "signed", G_TYPE_BOOLEAN, TRUE,
+ "width", G_TYPE_INT, 16,
+ "depth", G_TYPE_INT, 16,
+ "rate", G_TYPE_INT, rate,
+ "channels", G_TYPE_INT, 1,
+ NULL)) > 0)
{
return GST_PAD_LINK_OK;
}
diff --git a/ext/gsm/gstgsmenc.c b/ext/gsm/gstgsmenc.c
index d8949b54c..7158630c5 100644
--- a/ext/gsm/gstgsmenc.c
+++ b/ext/gsm/gstgsmenc.c
@@ -25,8 +25,6 @@
#include "gstgsmenc.h"
-static GstPadTemplate *gsmenc_src_template, *gsmenc_sink_template;
-
/* elementfactory information */
GstElementDetails gst_gsmenc_details = {
"GSM audio encoder",
@@ -52,7 +50,7 @@ static void gst_gsmenc_class_init (GstGSMEnc *klass);
static void gst_gsmenc_init (GstGSMEnc *gsmenc);
static void gst_gsmenc_chain (GstPad *pad,GstData *_data);
-static GstPadLinkReturn gst_gsmenc_sinkconnect (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_gsmenc_sinkconnect (GstPad *pad, const GstCaps2 *caps);
static GstElementClass *parent_class = NULL;
static guint gst_gsmenc_signals[LAST_SIGNAL] = { 0 };
@@ -79,45 +77,43 @@ gst_gsmenc_get_type (void)
return gsmenc_type;
}
-GST_CAPS_FACTORY (gsm_caps_factory,
- GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
+static GstStaticPadTemplate gsmenc_src_template =
+GST_STATIC_PAD_TEMPLATE (
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (
+ "audio/x-gsm, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
)
-)
-
-GST_CAPS_FACTORY (raw_caps_factory,
- GST_CAPS_NEW (
- "gsm_raw",
- "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_RANGE (1000, 48000),
- "channels", GST_PROPS_INT (1)
+);
+
+static GstStaticPadTemplate gsmenc_sink_template =
+GST_STATIC_PAD_TEMPLATE (
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS (
+ "audio/x-raw-int, "
+ "endianness = (int) BYTE_ORDER, "
+ "signed = (boolean) true, "
+ "width = (int) 16, "
+ "depth = (int) 16, "
+ "rate = (int) [ 1000, 48000 ], "
+ "channels = (int) 1"
)
-)
+);
static void
gst_gsmenc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- GstCaps *raw_caps, *gsm_caps;
- raw_caps = GST_CAPS_GET (raw_caps_factory);
- gsm_caps = GST_CAPS_GET (gsm_caps_factory);
-
- gsmenc_sink_template = gst_pad_template_new ("sink", GST_PAD_SINK,
- GST_PAD_ALWAYS,
- raw_caps, NULL);
- gsmenc_src_template = gst_pad_template_new ("src", GST_PAD_SRC,
- GST_PAD_ALWAYS,
- gsm_caps, NULL);
- gst_element_class_add_pad_template (element_class, gsmenc_sink_template);
- gst_element_class_add_pad_template (element_class, gsmenc_src_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gsmenc_sink_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gsmenc_src_template));
gst_element_class_set_details (element_class, &gst_gsmenc_details);
}
@@ -143,12 +139,14 @@ static void
gst_gsmenc_init (GstGSMEnc *gsmenc)
{
/* create the sink and src pads */
- gsmenc->sinkpad = gst_pad_new_from_template (gsmenc_sink_template, "sink");
+ gsmenc->sinkpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gsmenc_sink_template), "sink");
gst_element_add_pad (GST_ELEMENT (gsmenc), gsmenc->sinkpad);
gst_pad_set_chain_function (gsmenc->sinkpad, gst_gsmenc_chain);
gst_pad_set_link_function (gsmenc->sinkpad, gst_gsmenc_sinkconnect);
- gsmenc->srcpad = gst_pad_new_from_template (gsmenc_src_template, "src");
+ gsmenc->srcpad = gst_pad_new_from_template (
+ gst_static_pad_template_get (&gsmenc_src_template), "src");
gst_element_add_pad (GST_ELEMENT (gsmenc), gsmenc->srcpad);
gsmenc->state = gsm_create ();
@@ -158,22 +156,20 @@ gst_gsmenc_init (GstGSMEnc *gsmenc)
}
static GstPadLinkReturn
-gst_gsmenc_sinkconnect (GstPad *pad, GstCaps *caps)
+gst_gsmenc_sinkconnect (GstPad *pad, const GstCaps2 *caps)
{
GstGSMEnc *gsmenc;
+ GstStructure *structure;
gsmenc = GST_GSMENC (gst_pad_get_parent (pad));
- if (!GST_CAPS_IS_FIXED (caps))
- return GST_PAD_LINK_DELAYED;
-
- gst_caps_get_int (caps, "rate", &gsmenc->rate);
- if (gst_pad_try_set_caps (gsmenc->srcpad, GST_CAPS_NEW (
- "gsm_gsm",
- "audio/x-gsm",
- "rate", GST_PROPS_INT (gsmenc->rate),
- "channels", GST_PROPS_INT (1)
- )) > 0)
+ structure = gst_caps2_get_nth_cap (caps, 0);
+ gst_structure_get_int (structure, "rate", &gsmenc->rate);
+ if (gst_pad_try_set_caps (gsmenc->srcpad,
+ gst_caps2_new_simple("audio/x-gsm",
+ "rate", G_TYPE_INT, gsmenc->rate,
+ "channels", G_TYPE_INT, 1,
+ NULL)) > 0)
{
return GST_PAD_LINK_OK;
}
@@ -195,16 +191,6 @@ gst_gsmenc_chain (GstPad *pad, GstData *_data)
gsmenc = GST_GSMENC (GST_OBJECT_PARENT (pad));
- if (!GST_PAD_CAPS (gsmenc->srcpad)) {
- gst_pad_try_set_caps (gsmenc->srcpad,
- GST_CAPS_NEW (
- "gsm_enc",
- "audio/x-gsm",
- "rate", GST_PROPS_INT (gsmenc->rate),
- "channels", GST_PROPS_INT (1)
- ));
- }
-
data = (gsm_signal*) GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf) / sizeof (gsm_signal);
diff --git a/ext/jack/gstjack.c b/ext/jack/gstjack.c
index 85d57658c..4ebeded2b 100644
--- a/ext/jack/gstjack.c
+++ b/ext/jack/gstjack.c
@@ -77,7 +77,7 @@ static GstPadTemplate* gst_jack_sink_request_pad_factory();
static GstPad* gst_jack_request_new_pad (GstElement *element, GstPadTemplate *templ,
const gchar *name);
static GstElementStateReturn gst_jack_change_state (GstElement *element);
-static GstPadLinkReturn gst_jack_link (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_jack_link (GstPad *pad, const GstCaps2 *caps);
static void gst_jack_loop (GstElement *element);
@@ -263,12 +263,10 @@ gst_jack_src_request_pad_factory (void)
static GstPadTemplate *template = NULL;
if (!template) {
- GstCaps *caps;
- caps = gst_caps_new ("src",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS);
+ GstCaps2 *caps;
+ caps = gst_caps2_from_string (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS);
template = gst_pad_template_new ("%s", GST_PAD_SRC,
- GST_PAD_REQUEST, caps, NULL);
+ GST_PAD_REQUEST, caps);
}
return template;
@@ -280,12 +278,10 @@ gst_jack_sink_request_pad_factory (void)
static GstPadTemplate *template = NULL;
if (!template) {
- GstCaps *caps;
- caps = gst_caps_new ("sink",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS);
+ GstCaps2 *caps;
+ caps = gst_caps2_from_string (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS);
template = gst_pad_template_new ("%s", GST_PAD_SINK,
- GST_PAD_REQUEST, caps, NULL);
+ GST_PAD_REQUEST, caps);
}
return template;
@@ -353,7 +349,7 @@ gst_jack_change_state (GstElement *element)
GstJack *this;
GList *l = NULL, **pads;
GstJackPad *pad;
- GstCaps *caps;
+ GstCaps2 *caps;
g_return_val_if_fail (element != NULL, FALSE);
this = GST_JACK (element);
@@ -397,10 +393,10 @@ gst_jack_change_state (GstElement *element)
while (l) {
pad = GST_JACK_PAD (l);
caps = gst_pad_get_caps (pad->pad);
- gst_caps_set (caps, "rate", GST_PROPS_INT_TYPE,
- (gint)this->bin->rate, NULL);
- gst_caps_set (caps, "buffer-frames", GST_PROPS_INT_TYPE,
- (gint)this->bin->nframes, NULL);
+ gst_caps2_set_simple (caps,
+ "rate", G_TYPE_INT, (int)this->bin->rate,
+ "buffer-frames", G_TYPE_INT, (gint)this->bin->nframes,
+ NULL);
if (gst_pad_try_set_caps (pad->pad, caps) <= 0)
return GST_STATE_FAILURE;
l = g_list_next (l);
@@ -421,24 +417,22 @@ gst_jack_change_state (GstElement *element)
}
static GstPadLinkReturn
-gst_jack_link (GstPad *pad, GstCaps *caps)
+gst_jack_link (GstPad *pad, const GstCaps2 *caps)
{
GstJack *this;
gint rate, buffer_frames;
+ GstStructure *structure;
this = GST_JACK (GST_OBJECT_PARENT (pad));
- if (GST_CAPS_IS_FIXED (caps)) {
- gst_caps_get_int (caps, "rate", &rate);
- gst_caps_get_int (caps, "buffer-frames", &buffer_frames);
- if (this->bin && (rate != this->bin->rate ||
- buffer_frames != this->bin->nframes))
- return GST_PAD_LINK_REFUSED;
-
- return GST_PAD_LINK_OK;
- }
+ structure = gst_caps2_get_nth_cap (caps, 0);
+ gst_structure_get_int (structure, "rate", &rate);
+ gst_structure_get_int (structure, "buffer-frames", &buffer_frames);
+ if (this->bin && (rate != this->bin->rate ||
+ buffer_frames != this->bin->nframes))
+ return GST_PAD_LINK_REFUSED;
- return GST_PAD_LINK_DELAYED;
+ return GST_PAD_LINK_OK;
}
static void
diff --git a/ext/ladspa/gstladspa.c b/ext/ladspa/gstladspa.c
index 6ecb3ce16..b6e97120d 100644
--- a/ext/ladspa/gstladspa.c
+++ b/ext/ladspa/gstladspa.c
@@ -37,45 +37,15 @@
#define LADSPA_VERSION "1.0"
#endif
-/* takes ownership of the name */
-static GstPadTemplate*
-ladspa_sink_factory (gchar *name)
-{
- return GST_PAD_TEMPLATE_NEW (
- name,
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "ladspa_sink",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
- )
- );
-}
-
-/* takes ownership of the name */
-static GstPadTemplate*
-ladspa_src_factory (gchar *name)
-{
- return GST_PAD_TEMPLATE_NEW (
- name,
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- gst_caps_new (
- "ladspa_src",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
- )
- );
-}
+static GstStaticCaps2 ladspa_pad_caps =
+GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS);
static void gst_ladspa_class_init (GstLADSPAClass *klass);
static void gst_ladspa_base_init (GstLADSPAClass *klass);
static void gst_ladspa_init (GstLADSPA *ladspa);
static void gst_ladspa_update_int (const GValue *value, gpointer data);
-static GstPadLinkReturn gst_ladspa_link (GstPad *pad, GstCaps *caps);
-static void gst_ladspa_force_src_caps (GstLADSPA *ladspa, GstPad *pad);
+static GstPadLinkReturn gst_ladspa_link (GstPad *pad, const GstCaps2 *caps);
static void gst_ladspa_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void gst_ladspa_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
@@ -141,10 +111,12 @@ gst_ladspa_base_init (GstLADSPAClass *klass)
/* the factories take ownership of the name */
if (LADSPA_IS_PORT_INPUT(desc->PortDescriptors[j])) {
- templ = ladspa_sink_factory (name);
+ templ = gst_pad_template_new (name, GST_PAD_SINK, GST_PAD_ALWAYS,
+ gst_caps2_copy (gst_static_caps2_get (&ladspa_pad_caps)));
klass->numsinkpads++;
} else {
- templ = ladspa_src_factory (name);
+ templ = gst_pad_template_new (name, GST_PAD_SRC, GST_PAD_ALWAYS,
+ gst_caps2_copy (gst_static_caps2_get (&ladspa_pad_caps)));
klass->numsrcpads++;
}
@@ -456,7 +428,6 @@ gst_ladspa_init (GstLADSPA *ladspa)
ladspa->buffer_frames = 0; /* should be set with caps */
ladspa->activated = FALSE;
- ladspa->bufpool = NULL;
ladspa->inplace_broken = LADSPA_IS_INPLACE_BROKEN(ladspa->descriptor->Properties);
if (sinkcount==0 && srccount == 1) {
@@ -492,52 +463,43 @@ gst_ladspa_update_int(const GValue *value, gpointer data)
}
static GstPadLinkReturn
-gst_ladspa_link (GstPad *pad, GstCaps *caps)
+gst_ladspa_link (GstPad *pad, const GstCaps2 *caps)
{
GstElement *element = (GstElement*)GST_PAD_PARENT (pad);
GstLADSPA *ladspa = (GstLADSPA*)element;
const GList *l = NULL;
gint rate;
+ GstStructure *structure;
- if (GST_CAPS_IS_FIXED (caps)) {
- /* if this fails in some other plugin, the graph is left in an inconsistent
- state */
- for (l=gst_element_get_pad_list (element); l; l=l->next)
- if (pad != (GstPad*)l->data)
- if (gst_pad_try_set_caps ((GstPad*)l->data, caps) <= 0)
- return GST_PAD_LINK_REFUSED;
-
- /* we assume that the ladspa plugin can handle any sample rate, so this
- check gets put last */
- gst_caps_get_int (caps, "rate", &rate);
- /* have to instantiate ladspa plugin when samplerate changes (groan) */
- if (ladspa->samplerate != rate) {
- ladspa->samplerate = rate;
- if (! gst_ladspa_instantiate(ladspa))
+ /* if this fails in some other plugin, the graph is left in an inconsistent
+ state */
+ for (l=gst_element_get_pad_list (element); l; l=l->next)
+ if (pad != (GstPad*)l->data)
+ if (gst_pad_try_set_caps ((GstPad*)l->data, caps) <= 0)
return GST_PAD_LINK_REFUSED;
- }
-
- gst_caps_get_int (caps, "buffer-frames", &ladspa->buffer_frames);
-
- if (ladspa->bufpool)
- gst_buffer_pool_unref (ladspa->bufpool);
- ladspa->bufpool = gst_buffer_pool_get_default (ladspa->buffer_frames * sizeof(gfloat),
- 3);
-
- return GST_PAD_LINK_OK;
+
+ /* we assume that the ladspa plugin can handle any sample rate, so this
+ check gets put last */
+ structure = gst_caps2_get_nth_cap (caps, 0);
+ gst_structure_get_int (structure, "rate", &rate);
+ /* have to instantiate ladspa plugin when samplerate changes (groan) */
+ if (ladspa->samplerate != rate) {
+ ladspa->samplerate = rate;
+ if (! gst_ladspa_instantiate(ladspa))
+ return GST_PAD_LINK_REFUSED;
}
- return GST_PAD_LINK_DELAYED;
+ gst_structure_get_int (structure, "buffer-frames", &ladspa->buffer_frames);
+
+ return GST_PAD_LINK_OK;
}
+#if 0
static void
gst_ladspa_force_src_caps(GstLADSPA *ladspa, GstPad *pad)
{
if (!ladspa->buffer_frames) {
ladspa->buffer_frames = 256; /* 5 ms at 44100 kHz (just a default...) */
- g_return_if_fail (ladspa->bufpool == NULL);
- ladspa->bufpool =
- gst_buffer_pool_get_default (ladspa->buffer_frames * sizeof(gfloat), 3);
}
DEBUG_OBJ (ladspa, "forcing caps with rate=%d, buffer-frames=%d",
@@ -548,13 +510,14 @@ gst_ladspa_force_src_caps(GstLADSPA *ladspa, GstPad *pad)
"ladspa_src_caps",
"audio/x-raw-float",
gst_props_new (
- "width", GST_PROPS_INT (32),
- "endianness", GST_PROPS_INT (G_BYTE_ORDER),
- "rate", GST_PROPS_INT (ladspa->samplerate),
- "buffer-frames", GST_PROPS_INT (ladspa->buffer_frames),
- "channels", GST_PROPS_INT (1),
+ "width", G_TYPE_INT (32),
+ "endianness", G_TYPE_INT (G_BYTE_ORDER),
+ "rate", G_TYPE_INT (ladspa->samplerate),
+ "buffer-frames", G_TYPE_INT (ladspa->buffer_frames),
+ "channels", G_TYPE_INT (1),
NULL)));
}
+#endif
static void
gst_ladspa_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
@@ -759,11 +722,6 @@ gst_ladspa_loop (GstElement *element)
GST_BUFFER_TIMESTAMP(buffers_in[i]) = ladspa->timestamp;
}
- if (!ladspa->bufpool) {
- gst_element_error (element, "Caps were never set, bailing...");
- return;
- }
-
i=0;
if (!ladspa->inplace_broken) {
for (; i<numsrcpads && i<numsinkpads; i++) {
@@ -773,8 +731,7 @@ gst_ladspa_loop (GstElement *element)
}
}
for (; i<numsrcpads; i++) {
- /* we have to make new buffers -- at least we're taking them from a pool */
- buffers_out[i] = gst_buffer_new_from_pool (ladspa->bufpool, 0, 0);
+ buffers_out[i] = gst_buffer_new_and_alloc (ladspa->buffer_frames * sizeof(gfloat));
GST_BUFFER_TIMESTAMP (buffers_out[i]) = ladspa->timestamp;
data_out[i] = (LADSPA_Data*)GST_BUFFER_DATA (buffers_out[i]);
}
@@ -850,11 +807,6 @@ gst_ladspa_chain (GstPad *pad, GstData *_data)
/* we shouldn't get events here... */
g_return_if_fail (GST_IS_BUFFER (buffer_in));
- if (!ladspa->bufpool) {
- gst_element_error ((GstElement*)ladspa, "Caps were never set, bailing...");
- return;
- }
-
/* FIXME: this function shouldn't need to malloc() anything */
if (numsrcpads > 0) {
buffers_out = g_new(GstBuffer*, numsrcpads);
@@ -870,11 +822,7 @@ gst_ladspa_chain (GstPad *pad, GstData *_data)
i++;
}
for (; i<numsrcpads; i++) {
- /* we have to make new buffers -- at least we're taking them from a pool */
- buffers_out[i] = gst_buffer_new_from_pool (ladspa->bufpool, 0, 0);
- /* the size of the buffer returned from the pool is the maximum size; this
- chained buffer might be smaller */
- GST_BUFFER_SIZE (buffers_out[i]) = GST_BUFFER_SIZE (buffer_in);
+ buffers_out[i] = gst_buffer_new_and_alloc (GST_BUFFER_SIZE(buffer_in));
DEBUG ("new %d", GST_BUFFER_SIZE (buffer_in));
GST_BUFFER_TIMESTAMP (buffers_out[i]) = ladspa->timestamp;
data_out[i] = (LADSPA_Data*)GST_BUFFER_DATA (buffers_out[i]);
@@ -932,12 +880,8 @@ gst_ladspa_get(GstPad *pad)
oclass = (GstLADSPAClass*)(G_OBJECT_GET_CLASS(ladspa));
desc = ladspa->descriptor;
- if (!ladspa->bufpool) {
- /* capsnego hasn't happened... */
- gst_ladspa_force_src_caps(ladspa, ladspa->srcpads[0]);
- }
-
- buf = gst_buffer_new_from_pool (ladspa->bufpool, 0, 0);
+ /* 4096 is arbitrary */
+ buf = gst_buffer_new_and_alloc (4096);
GST_BUFFER_TIMESTAMP(buf) = ladspa->timestamp;
data = (LADSPA_Data *) GST_BUFFER_DATA(buf);
diff --git a/ext/ladspa/gstladspa.h b/ext/ladspa/gstladspa.h
index b588ffa4e..f3556f74d 100644
--- a/ext/ladspa/gstladspa.h
+++ b/ext/ladspa/gstladspa.h
@@ -59,8 +59,6 @@ struct _GstLADSPA {
GstPad **sinkpads,
**srcpads;
- GstBufferPool *bufpool;
-
gboolean activated;
gint samplerate, buffer_frames;
diff --git a/ext/sdl/sdlvideosink.c b/ext/sdl/sdlvideosink.c
index b71142677..1628057ad 100644
--- a/ext/sdl/sdlvideosink.c
+++ b/ext/sdl/sdlvideosink.c
@@ -191,6 +191,8 @@ gst_sdlvideosink_class_init (GstSDLVideoSinkClass *klass)
gstvs_class->set_geometry = gst_sdlvideosink_set_geometry;*/
}
+#if 0
+/* FIXME */
static GstBuffer *
gst_sdlvideosink_buffer_new (GstBufferPool *pool,
gint64 location,
@@ -250,14 +252,13 @@ gst_sdlvideosink_get_bufferpool (GstPad *pad)
return NULL;
}
+#endif
static void
gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
{
GST_VIDEOSINK_PAD (sdlvideosink) = gst_pad_new_from_template (sink_template,
"sink");
- gst_pad_set_bufferpool_function (GST_VIDEOSINK_PAD (sdlvideosink),
- gst_sdlvideosink_get_bufferpool);
gst_element_add_pad (GST_ELEMENT (sdlvideosink),
GST_VIDEOSINK_PAD (sdlvideosink));
@@ -280,6 +281,7 @@ gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
sdlvideosink->lock = g_mutex_new ();
+#if 0
sdlvideosink->bufferpool = gst_buffer_pool_new (
NULL, /* free */
NULL, /* copy */
@@ -287,6 +289,7 @@ gst_sdlvideosink_init (GstSDLVideoSink *sdlvideosink)
NULL, /* buffer copy, the default is fine */
(GstBufferPoolBufferFreeFunction) gst_sdlvideosink_buffer_free,
sdlvideosink);
+#endif
GST_FLAG_SET(sdlvideosink, GST_ELEMENT_THREAD_SUGGESTED);
GST_FLAG_SET(sdlvideosink, GST_ELEMENT_EVENT_AWARE);
diff --git a/ext/sdl/sdlvideosink.h b/ext/sdl/sdlvideosink.h
index a3725a959..e4e0df0cb 100644
--- a/ext/sdl/sdlvideosink.h
+++ b/ext/sdl/sdlvideosink.h
@@ -60,7 +60,6 @@ struct _GstSDLVideoSink {
SDL_Rect rect;
GMutex *lock;
- GstBufferPool *bufferpool;
};
struct _GstSDLVideoSinkClass {
diff --git a/ext/sndfile/gstsf.c b/ext/sndfile/gstsf.c
index 34a8b60f7..c3a69265d 100644
--- a/ext/sndfile/gstsf.c
+++ b/ext/sndfile/gstsf.c
@@ -53,26 +53,20 @@ enum {
ARG_CREATE_PADS
};
-GST_PAD_TEMPLATE_FACTORY (sf_src_factory,
+static GstStaticPadTemplate sf_src_factory =
+GST_STATIC_PAD_TEMPLATE (
"src%d",
GST_PAD_SRC,
GST_PAD_REQUEST,
- gst_caps_new (
- "sf_src",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
- )
+ GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
);
-GST_PAD_TEMPLATE_FACTORY (sf_sink_factory,
+static GstStaticPadTemplate sf_sink_factory =
+GST_STATIC_PAD_TEMPLATE (
"sink%d",
GST_PAD_SINK,
GST_PAD_REQUEST,
- gst_caps_new (
- "sf_sink",
- "audio/x-raw-float",
- GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_PROPS
- )
+ GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS)
);
#define GST_TYPE_SF_MAJOR_TYPES (gst_sf_major_types_get_type())
@@ -162,7 +156,7 @@ static GstPad* gst_sf_request_new_pad (GstElement *element, GstPadTemplate *tem
static void gst_sf_release_request_pad (GstElement *element, GstPad *pad);
static GstElementStateReturn gst_sf_change_state (GstElement *element);
-static GstPadLinkReturn gst_sf_link (GstPad *pad, GstCaps *caps);
+static GstPadLinkReturn gst_sf_link (GstPad *pad, const GstCaps2 *caps);
static void gst_sf_loop (GstElement *element);
@@ -249,7 +243,7 @@ gst_sfsrc_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 (sf_src_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sf_src_factory));
gst_element_class_set_details (element_class, &sfsrc_details);
}
@@ -258,7 +252,7 @@ gst_sfsink_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 (sf_sink_factory));
+ gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sf_sink_factory));
gst_element_class_set_details (element_class, &sfsink_details);
}
@@ -530,28 +524,27 @@ gst_sf_release_request_pad (GstElement *element, GstPad *pad)
}
static GstPadLinkReturn
-gst_sf_link (GstPad *pad, GstCaps *caps)
+gst_sf_link (GstPad *pad, const GstCaps2 *caps)
{
GstSF *this = (GstSF*)GST_OBJECT_PARENT (pad);
+ GstStructure *structure;
+
+ structure = gst_caps2_get_nth_cap (caps, 0);
- if (GST_CAPS_IS_FIXED (caps)) {
- gst_caps_get_int (caps, "rate", &this->rate);
- gst_caps_get_int (caps, "buffer-frames", &this->buffer_frames);
-
- INFO_OBJ (this, "linked pad %s:%s with fixed caps, frames=%d, rate=%d",
- GST_DEBUG_PAD_NAME (pad), this->rate, this->buffer_frames);
-
- if (this->numchannels) {
- /* we can go ahead and allocate our buffer */
- if (this->buffer)
- g_free (this->buffer);
- this->buffer = g_malloc (this->numchannels * this->buffer_frames * sizeof (float));
- memset (this->buffer, 0, this->numchannels * this->buffer_frames * sizeof (float));
- }
- return GST_PAD_LINK_OK;
+ gst_structure_get_int (structure, "rate", &this->rate);
+ gst_structure_get_int (structure, "buffer-frames", &this->buffer_frames);
+
+ INFO_OBJ (this, "linked pad %s:%s with fixed caps, frames=%d, rate=%d",
+ GST_DEBUG_PAD_NAME (pad), this->rate, this->buffer_frames);
+
+ if (this->numchannels) {
+ /* we can go ahead and allocate our buffer */
+ if (this->buffer)
+ g_free (this->buffer);
+ this->buffer = g_malloc (this->numchannels * this->buffer_frames * sizeof (float));
+ memset (this->buffer, 0, this->numchannels * this->buffer_frames * sizeof (float));
}
-
- return GST_PAD_LINK_DELAYED;
+ return GST_PAD_LINK_OK;
}
static gboolean
@@ -702,12 +695,14 @@ gst_sf_loop (GstElement *element)
continue;
if (!channel->caps_set) {
- GstCaps *caps = GST_PAD_CAPS (GST_SF_CHANNEL (l)->pad);
+ GstCaps2 *caps = GST_PAD_CAPS (GST_SF_CHANNEL (l)->pad);
if (!caps)
- caps = gst_caps_copy
+ caps = gst_caps2_copy
(GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (GST_SF_CHANNEL (l)->pad)));
- gst_caps_set (caps, "rate", GST_PROPS_INT (this->rate), NULL);
- gst_caps_set (caps, "buffer-frames", GST_PROPS_INT (this->buffer_frames), NULL);
+ gst_caps2_set_simple (caps,
+ "rate", G_TYPE_INT, this->rate,
+ "buffer-frames", G_TYPE_INT, this->buffer_frames,
+ NULL);
if (!gst_pad_try_set_caps (GST_SF_CHANNEL (l)->pad, caps)) {
gst_element_error (GST_ELEMENT (this),
g_strdup_printf ("Opened file with sample rate %d, but could not set caps",
diff --git a/ext/swfdec/gstswfdec.c b/ext/swfdec/gstswfdec.c
index 4cf19378d..da222e342 100644
--- a/ext/swfdec/gstswfdec.c
+++ b/ext/swfdec/gstswfdec.c
@@ -541,7 +541,6 @@ gst_swfdec_change_state (GstElement *element)
//swfdec->decoder->is_sequence_needed = 1;
//swfdec->decoder->frame_rate_code = 0;
swfdec->timestamp = 0;
- swfdec->pool = NULL;
swfdec->closed = FALSE;
/* reset the initial video state */
@@ -552,19 +551,8 @@ gst_swfdec_change_state (GstElement *element)
break;
}
case GST_STATE_PAUSED_TO_PLAYING:
- /* try to get a bufferpool */
-#if 0
- swfdec->pool = gst_pad_get_bufferpool (swfdec->videopad);
- if (swfdec->pool)
- GST_INFO ( "got pool %p", swfdec->pool);
-#endif
break;
case GST_STATE_PLAYING_TO_PAUSED:
- /* need to clear things we get from other plugins, since we could be reconnected */
- if (swfdec->pool) {
- gst_buffer_pool_unref (swfdec->pool);
- swfdec->pool = NULL;
- }
break;
case GST_STATE_PAUSED_TO_READY:
/* if we are not closed by an EOS event do so now, this cen send a few frames but
diff --git a/ext/swfdec/gstswfdec.h b/ext/swfdec/gstswfdec.h
index 8aa3ce3ac..5ee2a3b56 100644
--- a/ext/swfdec/gstswfdec.h
+++ b/ext/swfdec/gstswfdec.h
@@ -51,7 +51,6 @@ struct _GstSwfdec {
GstPad *sinkpad;
GstPad *videopad;
GstPad *audiopad;
- GstBufferPool *pool;
SwfdecDecoder *state;
gboolean closed;