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.
This commit is contained in:
Olivier Crete 2008-05-02 12:24:55 +00:00 committed by Wim Taymans
parent 39eb91d6f4
commit 6dc062fbdb
2 changed files with 49 additions and 3 deletions

View file

@ -1,3 +1,11 @@
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:

View file

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