Commit 6dc062fb authored by Olivier Crete's avatar Olivier Crete Committed by Wim Taymans
Browse files

gst/rtp/gstrtpilbcpay.c: Add negotiation for the ILBC mode. See #465146.

Original commit message from CVS:
Patch by: Olivier Crete <tester at tester dot ca>
* gst/rtp/gstrtpilbcpay.c: (gst_rtpilbcpay_class_init),
(gst_rtpilbcpay_sink_setcaps), (gst_rtpilbcpay_sink_getcaps):
Add negotiation for the ILBC mode. See #465146.
parent 39eb91d6
2008-05-02 Wim Taymans <wim.taymans@collabora.co.uk>
Patch by: Olivier Crete <tester at tester dot ca>
* gst/rtp/gstrtpilbcpay.c: (gst_rtpilbcpay_class_init),
(gst_rtpilbcpay_sink_setcaps), (gst_rtpilbcpay_sink_getcaps):
Add negotiation for the ILBC mode. See #465146.
2008-05-02 Stefan Kost <ensonic@users.sf.net>
 
* ext/soup/gstsouphttpsrc.c:
......
......@@ -54,7 +54,10 @@ GST_STATIC_PAD_TEMPLATE ("src",
"mode = (string) { \"20\", \"30\" }")
);
static gboolean gst_rtpilbcpay_setcaps (GstBaseRTPPayload * payload,
static GstCaps *gst_rtpilbcpay_sink_getcaps (GstBaseRTPPayload * payload,
GstPad * pad);
static gboolean gst_rtpilbcpay_sink_setcaps (GstBaseRTPPayload * payload,
GstCaps * caps);
GST_BOILERPLATE (GstRTPILBCPay, gst_rtpilbcpay, GstBaseRTPAudioPayload,
......@@ -85,7 +88,8 @@ gst_rtpilbcpay_class_init (GstRTPILBCPayClass * klass)
parent_class = g_type_class_ref (GST_TYPE_BASE_RTP_PAYLOAD);
gstbasertppayload_class->set_caps = gst_rtpilbcpay_setcaps;
gstbasertppayload_class->set_caps = gst_rtpilbcpay_sink_setcaps;
gstbasertppayload_class->get_caps = gst_rtpilbcpay_sink_getcaps;
GST_DEBUG_CATEGORY_INIT (rtpilbcpay_debug, "rtpilbcpay", 0,
"iLBC audio RTP payloader");
......@@ -111,7 +115,7 @@ gst_rtpilbcpay_init (GstRTPILBCPay * rtpilbcpay, GstRTPILBCPayClass * klass)
}
static gboolean
gst_rtpilbcpay_setcaps (GstBaseRTPPayload * basertppayload, GstCaps * caps)
gst_rtpilbcpay_sink_setcaps (GstBaseRTPPayload * basertppayload, GstCaps * caps)
{
GstRTPILBCPay *rtpilbcpay;
GstBaseRTPAudioPayload *basertpaudiopayload;
......@@ -173,6 +177,40 @@ mode_changed:
}
}
/* we return the padtemplate caps with the mode field fixated to a value if we
* can */
static GstCaps *
gst_rtpilbcpay_sink_getcaps (GstBaseRTPPayload * rtppayload, GstPad * pad)
{
GstCaps *otherpadcaps;
GstCaps *caps;
otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad);
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
if (otherpadcaps) {
if (!gst_caps_is_empty (otherpadcaps)) {
GstStructure *structure;
const gchar *mode_str;
gint mode;
structure = gst_caps_get_structure (otherpadcaps, 0);
/* parse mode, if we can */
mode_str = gst_structure_get_string (structure, "mode");
if (mode_str) {
mode = strtol (mode_str, NULL, 10);
if (mode == 20 || mode == 30) {
structure = gst_caps_get_structure (caps, 0);
gst_structure_set (structure, "mode", G_TYPE_INT, mode, NULL);
}
}
}
gst_caps_unref (otherpadcaps);
}
return caps;
}
gboolean
gst_rtp_ilbc_pay_plugin_init (GstPlugin * plugin)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment