summaryrefslogtreecommitdiffstats
path: root/ext/gsm
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2006-07-27 10:50:39 +0000
committerWim Taymans <wim.taymans@gmail.com>2006-07-27 10:50:39 +0000
commit3ca2e121ec1af161a564e0de32c70ef0cb337f4e (patch)
tree799c8afb1bbfb37f58d6123fc3b85ad25fb8cb05 /ext/gsm
parentb093995aa90655418907fa204243ae6d7d591feb (diff)
downloadgst-plugins-bad-3ca2e121ec1af161a564e0de32c70ef0cb337f4e.tar.gz
gst-plugins-bad-3ca2e121ec1af161a564e0de32c70ef0cb337f4e.tar.bz2
gst-plugins-bad-3ca2e121ec1af161a564e0de32c70ef0cb337f4e.zip
ext/gsm/: Fix negotiation.
Original commit message from CVS: * ext/gsm/gstgsmdec.c: (gst_gsmdec_init), (gst_gsmdec_sink_setcaps), (gst_gsmdec_sink_event): * ext/gsm/gstgsmenc.c: (gst_gsmenc_init), (gst_gsmenc_setcaps): Fix negotiation.
Diffstat (limited to 'ext/gsm')
-rw-r--r--ext/gsm/gstgsmdec.c29
-rw-r--r--ext/gsm/gstgsmenc.c22
2 files changed, 45 insertions, 6 deletions
diff --git a/ext/gsm/gstgsmdec.c b/ext/gsm/gstgsmdec.c
index e312255c..ec520538 100644
--- a/ext/gsm/gstgsmdec.c
+++ b/ext/gsm/gstgsmdec.c
@@ -55,6 +55,7 @@ static void gst_gsmdec_class_init (GstGSMDec * klass);
static void gst_gsmdec_init (GstGSMDec * gsmdec);
static void gst_gsmdec_finalize (GObject * object);
+static gboolean gst_gsmdec_sink_setcaps (GstPad * pad, GstCaps * caps);
static gboolean gst_gsmdec_sink_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_gsmdec_chain (GstPad * pad, GstBuffer * buf);
@@ -141,6 +142,7 @@ gst_gsmdec_init (GstGSMDec * gsmdec)
gsmdec->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gsmdec_sink_template), "sink");
+ gst_pad_set_setcaps_function (gsmdec->sinkpad, gst_gsmdec_sink_setcaps);
gst_pad_set_event_function (gsmdec->sinkpad, gst_gsmdec_sink_event);
gst_pad_set_chain_function (gsmdec->sinkpad, gst_gsmdec_chain);
gst_element_add_pad (GST_ELEMENT (gsmdec), gsmdec->sinkpad);
@@ -175,6 +177,23 @@ gst_gsmdec_finalize (GObject * object)
}
static gboolean
+gst_gsmdec_sink_setcaps (GstPad * pad, GstCaps * caps)
+{
+ GstGSMDec *gsmdec;
+ GstCaps *srccaps;
+
+ gsmdec = GST_GSMDEC (gst_pad_get_parent (pad));
+
+ srccaps = gst_static_pad_template_get_caps (&gsmdec_src_template);
+
+ gst_pad_set_caps (gsmdec->srcpad, srccaps);
+
+ gst_object_unref (gsmdec);
+
+ return TRUE;
+}
+
+static gboolean
gst_gsmdec_sink_event (GstPad * pad, GstEvent * event)
{
gboolean res;
@@ -194,15 +213,15 @@ gst_gsmdec_sink_event (GstPad * pad, GstEvent * event)
{
gboolean update;
GstFormat format;
- gdouble rate;
+ gdouble rate, arate;
gint64 start, stop, time;
- gst_event_parse_new_segment (event, &update, &rate, &format, &start,
- &stop, &time);
+ gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
+ &start, &stop, &time);
/* now configure the values */
- gst_segment_set_newsegment (&gsmdec->segment, update,
- rate, format, start, stop, time);
+ gst_segment_set_newsegment_full (&gsmdec->segment, update,
+ rate, arate, format, start, stop, time);
/* and forward */
res = gst_pad_push_event (gsmdec->srcpad, event);
diff --git a/ext/gsm/gstgsmenc.c b/ext/gsm/gstgsmenc.c
index 209e5c58..a791b884 100644
--- a/ext/gsm/gstgsmenc.c
+++ b/ext/gsm/gstgsmenc.c
@@ -55,6 +55,7 @@ static void gst_gsmenc_class_init (GstGSMEnc * klass);
static void gst_gsmenc_init (GstGSMEnc * gsmenc);
static void gst_gsmenc_finalize (GObject * object);
+static gboolean gst_gsmenc_setcaps (GstPad * pad, GstCaps * caps);
static GstFlowReturn gst_gsmenc_chain (GstPad * pad, GstBuffer * buf);
static GstElementClass *parent_class = NULL;
@@ -138,8 +139,9 @@ gst_gsmenc_init (GstGSMEnc * gsmenc)
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_setcaps_function (gsmenc->sinkpad, gst_gsmenc_setcaps);
+ gst_element_add_pad (GST_ELEMENT (gsmenc), gsmenc->sinkpad);
gsmenc->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
@@ -169,6 +171,24 @@ gst_gsmenc_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
+static gboolean
+gst_gsmenc_setcaps (GstPad * pad, GstCaps * caps)
+{
+ GstGSMEnc *gsmenc;
+ GstCaps *srccaps;
+
+ gsmenc = GST_GSMENC (gst_pad_get_parent (pad));
+
+ srccaps = gst_static_pad_template_get_caps (&gsmenc_src_template);
+
+ gst_pad_set_caps (gsmenc->srcpad, srccaps);
+
+ gst_object_unref (gsmenc);
+
+ return TRUE;
+}
+
+
static GstFlowReturn
gst_gsmenc_chain (GstPad * pad, GstBuffer * buf)
{