summaryrefslogtreecommitdiffstats
path: root/ext/gsm
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2002-01-13 22:27:25 +0000
committerWim Taymans <wim.taymans@gmail.com>2002-01-13 22:27:25 +0000
commit93e9ac34a1058caab1ef680071874d620a10d132 (patch)
tree4c730c821178cc2ea708454dc276a1d36b5bfe1b /ext/gsm
parente92b7beff5470ec3f1662e2413622295b37f8710 (diff)
downloadgst-plugins-bad-93e9ac34a1058caab1ef680071874d620a10d132.tar.gz
gst-plugins-bad-93e9ac34a1058caab1ef680071874d620a10d132.tar.bz2
gst-plugins-bad-93e9ac34a1058caab1ef680071874d620a10d132.zip
Bring the plugins in sync with the new core capsnego system.
Original commit message from CVS: Bring the plugins in sync with the new core capsnego system. Added some features, enhancements...
Diffstat (limited to 'ext/gsm')
-rw-r--r--ext/gsm/gstgsmdec.c27
-rw-r--r--ext/gsm/gstgsmenc.c41
2 files changed, 37 insertions, 31 deletions
diff --git a/ext/gsm/gstgsmdec.c b/ext/gsm/gstgsmdec.c
index 5ead519c..8a61453a 100644
--- a/ext/gsm/gstgsmdec.c
+++ b/ext/gsm/gstgsmdec.c
@@ -45,11 +45,11 @@ enum {
/* FILL ME */
};
-static void gst_gsmdec_class_init (GstGSMDec *klass);
-static void gst_gsmdec_init (GstGSMDec *gsmdec);
+static void gst_gsmdec_class_init (GstGSMDec *klass);
+static void gst_gsmdec_init (GstGSMDec *gsmdec);
-static void gst_gsmdec_chain (GstPad *pad, GstBuffer *buf);
-static void gst_gsmdec_newcaps (GstPad *pad, GstCaps *caps);
+static void gst_gsmdec_chain (GstPad *pad, GstBuffer *buf);
+static GstPadConnectReturn gst_gsmdec_sinkconnect (GstPad *pad, GstCaps *caps);
static GstElementClass *parent_class = NULL;
//static guint gst_gsmdec_signals[LAST_SIGNAL] = { 0 };
@@ -93,7 +93,7 @@ gst_gsmdec_init (GstGSMDec *gsmdec)
gsmdec->sinkpad = gst_pad_new_from_template (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_newcaps_function (gsmdec->sinkpad, gst_gsmdec_newcaps);
+ gst_pad_set_connect_function (gsmdec->sinkpad, gst_gsmdec_sinkconnect);
gsmdec->srcpad = gst_pad_new_from_template (gsmdec_src_template, "src");
gst_element_add_pad (GST_ELEMENT (gsmdec), gsmdec->srcpad);
@@ -102,13 +102,18 @@ gst_gsmdec_init (GstGSMDec *gsmdec)
gsmdec->bufsize = 0;
}
-static void
-gst_gsmdec_newcaps (GstPad *pad, GstCaps *caps)
+static GstPadConnectReturn
+gst_gsmdec_sinkconnect (GstPad *pad, GstCaps *caps)
{
GstGSMDec *gsmdec;
gsmdec = GST_GSMDEC (gst_pad_get_parent (pad));
- gst_pad_set_caps (gsmdec->srcpad, GST_CAPS_NEW (
+
+ if (!GST_CAPS_IS_FIXED (caps))
+ return GST_PAD_CONNECT_DELAYED;
+
+ if (gst_pad_try_set_caps (gsmdec->srcpad,
+ GST_CAPS_NEW (
"gsm_raw",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
@@ -119,7 +124,11 @@ gst_gsmdec_newcaps (GstPad *pad, GstCaps *caps)
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT (gst_caps_get_int (caps, "rate")),
"channels", GST_PROPS_INT (1)
- ));
+ )))
+ {
+ return GST_PAD_CONNECT_OK;
+ }
+ return GST_PAD_CONNECT_REFUSED;
}
static void
diff --git a/ext/gsm/gstgsmenc.c b/ext/gsm/gstgsmenc.c
index b5ad0bce..abe4279d 100644
--- a/ext/gsm/gstgsmenc.c
+++ b/ext/gsm/gstgsmenc.c
@@ -46,22 +46,11 @@ enum {
/* FILL ME */
};
-GST_PADTEMPLATE_FACTORY (src_factory,
- "src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_CAPS_NEW (
- "gsm_enc",
- "audio/x-gsm",
- "rate", GST_PROPS_INT_RANGE (1000, 48000)
- )
-);
-
-static void gst_gsmenc_class_init (GstGSMEnc *klass);
-static void gst_gsmenc_init (GstGSMEnc *gsmenc);
-
-static void gst_gsmenc_chain (GstPad *pad,GstBuffer *buf);
-static void gst_gsmenc_newcaps (GstPad *pad, GstCaps *caps);
+static void gst_gsmenc_class_init (GstGSMEnc *klass);
+static void gst_gsmenc_init (GstGSMEnc *gsmenc);
+
+static void gst_gsmenc_chain (GstPad *pad,GstBuffer *buf);
+static GstPadConnectReturn gst_gsmenc_sinkconnect (GstPad *pad, GstCaps *caps);
static GstElementClass *parent_class = NULL;
static guint gst_gsmenc_signals[LAST_SIGNAL] = { 0 };
@@ -113,7 +102,7 @@ gst_gsmenc_init (GstGSMEnc *gsmenc)
gsmenc->sinkpad = gst_pad_new_from_template (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_newcaps_function (gsmenc->sinkpad, gst_gsmenc_newcaps);
+ gst_pad_set_connect_function (gsmenc->sinkpad, gst_gsmenc_sinkconnect);
gsmenc->srcpad = gst_pad_new_from_template (gsmenc_src_template, "src");
gst_element_add_pad (GST_ELEMENT (gsmenc), gsmenc->srcpad);
@@ -124,19 +113,27 @@ gst_gsmenc_init (GstGSMEnc *gsmenc)
gsmenc->rate = 8000;
}
-static void
-gst_gsmenc_newcaps (GstPad *pad, GstCaps *caps)
+static GstPadConnectReturn
+gst_gsmenc_sinkconnect (GstPad *pad, GstCaps *caps)
{
GstGSMEnc *gsmenc;
gsmenc = GST_GSMENC (gst_pad_get_parent (pad));
+ if (!GST_CAPS_IS_FIXED (caps))
+ return GST_PAD_CONNECT_DELAYED;
+
gsmenc->rate = gst_caps_get_int (caps, "rate");
- gst_pad_set_caps (gsmenc->srcpad, GST_CAPS_NEW (
+ if (gst_pad_try_set_caps (gsmenc->srcpad, GST_CAPS_NEW (
"gsm_gsm",
"audio/x-gsm",
"rate", GST_PROPS_INT (gsmenc->rate)
- ));
+ )))
+ {
+ return GST_PAD_CONNECT_OK;
+ }
+ return GST_PAD_CONNECT_REFUSED;
+
}
static void
@@ -153,7 +150,7 @@ gst_gsmenc_chain (GstPad *pad, GstBuffer *buf)
gsmenc = GST_GSMENC (GST_OBJECT_PARENT (pad));
if (!GST_PAD_CAPS (gsmenc->srcpad)) {
- gst_pad_set_caps (gsmenc->srcpad,
+ gst_pad_try_set_caps (gsmenc->srcpad,
GST_CAPS_NEW (
"gsm_enc",
"audio/x-gsm",