diff options
author | David Schleef <ds@schleef.org> | 2003-12-22 01:47:09 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2003-12-22 01:47:09 +0000 |
commit | ce51f6173ca1c37d90f8e2e316d90316583d7755 (patch) | |
tree | 270b121765a11455f5bf8166b526d7ac336dc56c /gst/rtp/gstrtpL16pay.c | |
parent | f43f0a9fd781bafab689e46bd936af9cb5ed2690 (diff) |
Merge CAPS branch
Original commit message from CVS:
Merge CAPS branch
Diffstat (limited to 'gst/rtp/gstrtpL16pay.c')
-rw-r--r-- | gst/rtp/gstrtpL16pay.c | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/gst/rtp/gstrtpL16pay.c b/gst/rtp/gstrtpL16pay.c index 610ef051..45d6a95a 100644 --- a/gst/rtp/gstrtpL16pay.c +++ b/gst/rtp/gstrtpL16pay.c @@ -44,30 +44,27 @@ enum ARG_0, }; -GST_PAD_TEMPLATE_FACTORY (sink_factory, - "sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "audio_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_RANGE (1, 2) - ) +static GstStaticPadTemplate gst_rtpL16enc_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, 2 ]" + ) ); -GST_PAD_TEMPLATE_FACTORY (src_factory, - "src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_CAPS_NEW ( - "rtp", - "application/x-rtp", - NULL) +static GstStaticPadTemplate gst_rtpL16enc_src_template = +GST_STATIC_PAD_TEMPLATE ( + "src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("application/x-rtp") ); static void gst_rtpL16enc_class_init (GstRtpL16EncClass * klass); @@ -78,7 +75,7 @@ static void gst_rtpL16enc_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_rtpL16enc_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps); +static GstPadLinkReturn gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps * caps); static GstElementStateReturn gst_rtpL16enc_change_state (GstElement * element); static GstElementClass *parent_class = NULL; @@ -111,9 +108,9 @@ gst_rtpL16enc_base_init (GstRtpL16EncClass * klass) GstElementClass *element_class = GST_ELEMENT_CLASS (klass); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (sink_factory)); + gst_static_pad_template_get (&gst_rtpL16enc_sink_template)); gst_element_class_add_pad_template (element_class, - GST_PAD_TEMPLATE_GET (src_factory)); + gst_static_pad_template_get (&gst_rtpL16enc_src_template)); gst_element_class_set_details (element_class, &gst_rtpL16enc_details); } @@ -137,8 +134,10 @@ gst_rtpL16enc_class_init (GstRtpL16EncClass * klass) static void gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc) { - rtpL16enc->sinkpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (sink_factory), "sink"); - rtpL16enc->srcpad = gst_pad_new_from_template (GST_PAD_TEMPLATE_GET (src_factory), "src"); + rtpL16enc->sinkpad = gst_pad_new_from_template ( + gst_static_pad_template_get (&gst_rtpL16enc_sink_template), "sink"); + rtpL16enc->srcpad = gst_pad_new_from_template ( + gst_static_pad_template_get (&gst_rtpL16enc_src_template), "src"); gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->sinkpad); gst_element_add_pad (GST_ELEMENT (rtpL16enc), rtpL16enc->srcpad); gst_pad_set_chain_function (rtpL16enc->sinkpad, gst_rtpL16enc_chain); @@ -155,14 +154,20 @@ gst_rtpL16enc_init (GstRtpL16Enc * rtpL16enc) } static GstPadLinkReturn -gst_rtpL16enc_sinkconnect (GstPad * pad, GstCaps * caps) +gst_rtpL16enc_sinkconnect (GstPad * pad, const GstCaps * caps) { GstRtpL16Enc *rtpL16enc; + GstStructure *structure; + gboolean ret; rtpL16enc = GST_RTP_L16_ENC (gst_pad_get_parent (pad)); - gst_caps_get_int (caps, "rate", &rtpL16enc->frequency); - gst_caps_get_int (caps, "channels", &rtpL16enc->channels); + structure = gst_caps_get_structure (caps, 0); + + ret = gst_structure_get_int (structure, "rate", &rtpL16enc->frequency); + ret &= gst_structure_get_int (structure, "channels", &rtpL16enc->channels); + + if (!ret) return GST_PAD_LINK_REFUSED; /* Pre-calculate what we can */ rtpL16enc->time_interval = GST_SECOND / (2 * rtpL16enc->channels * rtpL16enc->frequency); |