Commit 3e064477 authored by Wim Taymans's avatar Wim Taymans
Browse files

gst/rtp/gstrtpamrdec.c: Fix up amr depayloader a bit.

Original commit message from CVS:
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_init),
(gst_rtpamrdec_chain):
Fix up amr depayloader a bit.

* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_send), (gst_rtspsrc_open),
(gst_rtspsrc_close), (gst_rtspsrc_play):
Look for options result in Public and Allow header fields..
spec says Allow but some servers return Public...
parent 519f58bb
2005-08-18 Wim Taymans <wim@fluendo.com>
* gst/rtp/gstrtpamrdec.c: (gst_rtpamrdec_init),
(gst_rtpamrdec_chain):
Fix up amr depayloader a bit.
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_send), (gst_rtspsrc_open),
(gst_rtspsrc_close), (gst_rtspsrc_play):
Look for options result in Public and Allow header fields..
spec says Allow but some servers return Public...
2005-08-18 Wim Taymans <wim@fluendo.com>
 
* gst/rtp/gstrtpamrenc.c: (gst_rtpamrenc_class_init),
......
......@@ -46,7 +46,7 @@ static GstStaticPadTemplate gst_rtpamrdec_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/mpeg")
GST_STATIC_CAPS ("audio/x-amr-nb")
);
static GstStaticPadTemplate gst_rtpamrdec_sink_template =
......@@ -130,11 +130,18 @@ gst_rtpamrdec_class_init (GstRtpAMRDecClass * klass)
static void
gst_rtpamrdec_init (GstRtpAMRDec * rtpamrdec)
{
GstCaps *caps;
rtpamrdec->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtpamrdec_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpamrdec), rtpamrdec->srcpad);
caps = gst_caps_new_simple ("audio/x-amr-nb",
"channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 8000, NULL);
gst_pad_set_caps (rtpamrdec->srcpad, caps);
rtpamrdec->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtpamrdec_sink_template), "sink");
......@@ -157,17 +164,14 @@ gst_rtpamrdec_chain (GstPad * pad, GstBuffer * buf)
{
gint payload_len;
guint8 *payload;
guint16 frag_offset;
guint32 timestamp;
payload_len = gst_rtpbuffer_get_payload_len (buf);
payload = gst_rtpbuffer_get_payload (buf);
frag_offset = (payload[2] << 8) | payload[3];
/* strip off header */
payload_len -= 4;
payload += 4;
payload_len -= 2;
payload += 2;
timestamp = gst_rtpbuffer_get_timestamp (buf);
......@@ -177,6 +181,8 @@ gst_rtpamrdec_chain (GstPad * pad, GstBuffer * buf)
memcpy (GST_BUFFER_DATA (outbuf), payload, payload_len);
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (rtpamrdec->srcpad));
GST_DEBUG ("gst_rtpamrdec_chain: pushing buffer of size %d",
GST_BUFFER_SIZE (outbuf));
......
......@@ -46,7 +46,7 @@ static GstStaticPadTemplate gst_rtpamrdec_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/mpeg")
GST_STATIC_CAPS ("audio/x-amr-nb")
);
static GstStaticPadTemplate gst_rtpamrdec_sink_template =
......@@ -130,11 +130,18 @@ gst_rtpamrdec_class_init (GstRtpAMRDecClass * klass)
static void
gst_rtpamrdec_init (GstRtpAMRDec * rtpamrdec)
{
GstCaps *caps;
rtpamrdec->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtpamrdec_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpamrdec), rtpamrdec->srcpad);
caps = gst_caps_new_simple ("audio/x-amr-nb",
"channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 8000, NULL);
gst_pad_set_caps (rtpamrdec->srcpad, caps);
rtpamrdec->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtpamrdec_sink_template), "sink");
......@@ -157,17 +164,14 @@ gst_rtpamrdec_chain (GstPad * pad, GstBuffer * buf)
{
gint payload_len;
guint8 *payload;
guint16 frag_offset;
guint32 timestamp;
payload_len = gst_rtpbuffer_get_payload_len (buf);
payload = gst_rtpbuffer_get_payload (buf);
frag_offset = (payload[2] << 8) | payload[3];
/* strip off header */
payload_len -= 4;
payload += 4;
payload_len -= 2;
payload += 2;
timestamp = gst_rtpbuffer_get_timestamp (buf);
......@@ -177,6 +181,8 @@ gst_rtpamrdec_chain (GstPad * pad, GstBuffer * buf)
memcpy (GST_BUFFER_DATA (outbuf), payload, payload_len);
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (rtpamrdec->srcpad));
GST_DEBUG ("gst_rtpamrdec_chain: pushing buffer of size %d",
GST_BUFFER_SIZE (outbuf));
......
......@@ -581,9 +581,15 @@ gst_rtspsrc_open (GstRTSPSrc * src)
gchar **options;
gint i;
rtsp_message_get_header (&response, RTSP_HDR_PUBLIC, &respoptions);
if (!respoptions)
goto no_options;
/* Try Allow Header first */
rtsp_message_get_header (&response, RTSP_HDR_ALLOW, &respoptions);
if (!respoptions) {
/* Then maybe Public Header... */
rtsp_message_get_header (&response, RTSP_HDR_PUBLIC, &respoptions);
if (!respoptions) {
goto no_options;
}
}
/* parse options */
options = g_strsplit (respoptions, ",", 0);
......
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