diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2007-04-25 09:47:48 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2007-04-25 09:47:48 +0000 |
commit | 24c5812d65e45f630edd172ce493ab9fac6df887 (patch) | |
tree | e6e532be7522238565734287de46f875c0a0ac78 /gst/rtp/gstrtpilbcdepay.c | |
parent | 1beeda3ff2859372cecbea4542a4da8dc05960d6 (diff) |
gst/rtp/: Make sure we configure the clock_rate in the baseclass in the setcaps function. Fixes #431282.
Original commit message from CVS:
* gst/rtp/gstrtpL16depay.c: (gst_rtp_L16_depay_set_property):
* gst/rtp/gstrtpamrdepay.c: (gst_rtp_amr_depay_init),
(gst_rtp_amr_depay_setcaps), (gst_rtp_amr_depay_process):
* gst/rtp/gstrtpgsmdepay.c: (gst_rtp_gsm_depay_init),
(gst_rtp_gsm_depay_setcaps):
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_setcaps):
* gst/rtp/gstrtph264depay.c: (gst_rtp_h264_depay_setcaps):
* gst/rtp/gstrtpilbcdepay.c: (gst_rtp_ilbc_depay_class_init),
(gst_rtp_ilbc_depay_init), (gst_rtp_ilbc_depay_setcaps),
(gst_rtp_ilbc_depay_process), (gst_ilbc_depay_set_property),
(gst_ilbc_depay_get_property):
* gst/rtp/gstrtpmp2tdepay.c: (gst_rtp_mp2t_depay_setcaps):
* gst/rtp/gstrtpmp4adepay.c:
* gst/rtp/gstrtppcmadepay.c: (gst_rtp_pcma_depay_init),
(gst_rtp_pcma_depay_setcaps):
* gst/rtp/gstrtppcmudepay.c: (gst_rtp_pcmu_depay_init),
(gst_rtp_pcmu_depay_setcaps):
Make sure we configure the clock_rate in the baseclass in the setcaps
function. Fixes #431282.
Diffstat (limited to 'gst/rtp/gstrtpilbcdepay.c')
-rw-r--r-- | gst/rtp/gstrtpilbcdepay.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/gst/rtp/gstrtpilbcdepay.c b/gst/rtp/gstrtpilbcdepay.c index df21acfd..3ab1611d 100644 --- a/gst/rtp/gstrtpilbcdepay.c +++ b/gst/rtp/gstrtpilbcdepay.c @@ -39,12 +39,15 @@ enum LAST_SIGNAL }; +#define DEFAULT_MODE GST_ILBC_MODE_30 + enum { - ARG_0, - ARG_MODE + PROP_0, + PROP_MODE }; +/* FIXME, mode should be string because it is a parameter in SDP fmtp */ static GstStaticPadTemplate gst_rtp_ilbc_depay_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, @@ -119,11 +122,10 @@ gst_rtp_ilbc_depay_class_init (GstRTPiLBCDepayClass * klass) gobject_class->set_property = gst_ilbc_depay_set_property; gobject_class->get_property = gst_ilbc_depay_get_property; - g_object_class_install_property (gobject_class, ARG_MODE, g_param_spec_enum ("mode", "Mode", "iLBC frame mode", GST_TYPE_ILBC_MODE, /* enum type */ - GST_ILBC_MODE_30, /* default value */ - G_PARAM_READWRITE)); - - parent_class = g_type_class_peek_parent (klass); + /* FIXME, mode is in the caps */ + g_object_class_install_property (gobject_class, PROP_MODE, + g_param_spec_enum ("mode", "Mode", "iLBC frame mode", + GST_TYPE_ILBC_MODE, DEFAULT_MODE, G_PARAM_READWRITE)); gstbasertpdepayload_class->process = gst_rtp_ilbc_depay_process; gstbasertpdepayload_class->set_caps = gst_rtp_ilbc_depay_setcaps; @@ -137,10 +139,8 @@ gst_rtp_ilbc_depay_init (GstRTPiLBCDepay * rtpilbcdepay, depayload = GST_BASE_RTP_DEPAYLOAD (rtpilbcdepay); - depayload->clock_rate = 8000; - - /* Set default mode to 30 */ - rtpilbcdepay->mode = GST_ILBC_MODE_30; + /* Set default mode */ + rtpilbcdepay->mode = DEFAULT_MODE; } static gboolean @@ -149,26 +149,33 @@ gst_rtp_ilbc_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps) GstRTPiLBCDepay *rtpilbcdepay = GST_RTP_ILBC_DEPAY (depayload); GstCaps *srccaps; GstStructure *structure; + gint mode; gboolean ret; - srccaps = gst_caps_copy (gst_static_pad_template_get_caps - (&gst_rtp_ilbc_depay_src_template)); - structure = gst_caps_get_structure (srccaps, 0); - gst_structure_set (structure, "mode", G_TYPE_INT, - rtpilbcdepay->mode == GST_ILBC_MODE_30 ? 30 : 20, NULL); + structure = gst_caps_get_structure (caps, 0); + + /* parse mode, if we can */ + mode = rtpilbcdepay->mode; + gst_structure_get_int (structure, "mode", &mode); + rtpilbcdepay->mode = mode; + srccaps = gst_caps_new_simple ("audio/x-iLBC", + "mode", G_TYPE_INT, rtpilbcdepay->mode, NULL); ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps); GST_DEBUG ("set caps on source: %" GST_PTR_FORMAT " (ret=%d)", srccaps, ret); - gst_caps_unref (srccaps); + + /* always fixed clock rate of 8000 */ + depayload->clock_rate = 8000; + return ret; } static GstBuffer * gst_rtp_ilbc_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) { - GstBuffer *outbuf = NULL; + GstBuffer *outbuf; GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d", GST_BUFFER_SIZE (buf), @@ -187,7 +194,7 @@ gst_ilbc_depay_set_property (GObject * object, GstRTPiLBCDepay *rtpilbcdepay = GST_RTP_ILBC_DEPAY (object); switch (prop_id) { - case ARG_MODE: + case PROP_MODE: rtpilbcdepay->mode = g_value_get_enum (value); break; default: @@ -203,7 +210,7 @@ gst_ilbc_depay_get_property (GObject * object, GstRTPiLBCDepay *rtpilbcdepay = GST_RTP_ILBC_DEPAY (object); switch (prop_id) { - case ARG_MODE: + case PROP_MODE: g_value_set_enum (value, rtpilbcdepay->mode); break; default: |