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.
This commit is contained in:
Wim Taymans 2006-07-27 10:50:39 +00:00
parent b093995aa9
commit 3ca2e121ec
3 changed files with 52 additions and 6 deletions

View file

@ -1,3 +1,10 @@
2006-07-27 Wim Taymans <wim@fluendo.com>
* 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.
2006-07-26 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gdp/gstgdpdepay.c: (gst_gdp_depay_init):

View file

@ -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);
@ -174,6 +176,23 @@ gst_gsmdec_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (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)
{
@ -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);

View file

@ -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)
{