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...
This commit is contained in:
Wim Taymans 2005-08-18 20:14:46 +00:00
parent 519f58bb6b
commit 3e064477cf
4 changed files with 44 additions and 15 deletions

View file

@ -1,3 +1,14 @@
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> 2005-08-18 Wim Taymans <wim@fluendo.com>
* gst/rtp/gstrtpamrenc.c: (gst_rtpamrenc_class_init), * gst/rtp/gstrtpamrenc.c: (gst_rtpamrenc_class_init),

View file

@ -46,7 +46,7 @@ static GstStaticPadTemplate gst_rtpamrdec_src_template =
GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/mpeg") GST_STATIC_CAPS ("audio/x-amr-nb")
); );
static GstStaticPadTemplate gst_rtpamrdec_sink_template = static GstStaticPadTemplate gst_rtpamrdec_sink_template =
@ -130,11 +130,18 @@ gst_rtpamrdec_class_init (GstRtpAMRDecClass * klass)
static void static void
gst_rtpamrdec_init (GstRtpAMRDec * rtpamrdec) gst_rtpamrdec_init (GstRtpAMRDec * rtpamrdec)
{ {
GstCaps *caps;
rtpamrdec->srcpad = rtpamrdec->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtpamrdec_src_template), "src"); (&gst_rtpamrdec_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpamrdec), rtpamrdec->srcpad); 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 = rtpamrdec->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtpamrdec_sink_template), "sink"); (&gst_rtpamrdec_sink_template), "sink");
@ -157,17 +164,14 @@ gst_rtpamrdec_chain (GstPad * pad, GstBuffer * buf)
{ {
gint payload_len; gint payload_len;
guint8 *payload; guint8 *payload;
guint16 frag_offset;
guint32 timestamp; guint32 timestamp;
payload_len = gst_rtpbuffer_get_payload_len (buf); payload_len = gst_rtpbuffer_get_payload_len (buf);
payload = gst_rtpbuffer_get_payload (buf); payload = gst_rtpbuffer_get_payload (buf);
frag_offset = (payload[2] << 8) | payload[3];
/* strip off header */ /* strip off header */
payload_len -= 4; payload_len -= 2;
payload += 4; payload += 2;
timestamp = gst_rtpbuffer_get_timestamp (buf); 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); 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_DEBUG ("gst_rtpamrdec_chain: pushing buffer of size %d",
GST_BUFFER_SIZE (outbuf)); GST_BUFFER_SIZE (outbuf));

View file

@ -46,7 +46,7 @@ static GstStaticPadTemplate gst_rtpamrdec_src_template =
GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS ("audio/mpeg") GST_STATIC_CAPS ("audio/x-amr-nb")
); );
static GstStaticPadTemplate gst_rtpamrdec_sink_template = static GstStaticPadTemplate gst_rtpamrdec_sink_template =
@ -130,11 +130,18 @@ gst_rtpamrdec_class_init (GstRtpAMRDecClass * klass)
static void static void
gst_rtpamrdec_init (GstRtpAMRDec * rtpamrdec) gst_rtpamrdec_init (GstRtpAMRDec * rtpamrdec)
{ {
GstCaps *caps;
rtpamrdec->srcpad = rtpamrdec->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtpamrdec_src_template), "src"); (&gst_rtpamrdec_src_template), "src");
gst_element_add_pad (GST_ELEMENT (rtpamrdec), rtpamrdec->srcpad); 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 = rtpamrdec->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get gst_pad_new_from_template (gst_static_pad_template_get
(&gst_rtpamrdec_sink_template), "sink"); (&gst_rtpamrdec_sink_template), "sink");
@ -157,17 +164,14 @@ gst_rtpamrdec_chain (GstPad * pad, GstBuffer * buf)
{ {
gint payload_len; gint payload_len;
guint8 *payload; guint8 *payload;
guint16 frag_offset;
guint32 timestamp; guint32 timestamp;
payload_len = gst_rtpbuffer_get_payload_len (buf); payload_len = gst_rtpbuffer_get_payload_len (buf);
payload = gst_rtpbuffer_get_payload (buf); payload = gst_rtpbuffer_get_payload (buf);
frag_offset = (payload[2] << 8) | payload[3];
/* strip off header */ /* strip off header */
payload_len -= 4; payload_len -= 2;
payload += 4; payload += 2;
timestamp = gst_rtpbuffer_get_timestamp (buf); 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); 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_DEBUG ("gst_rtpamrdec_chain: pushing buffer of size %d",
GST_BUFFER_SIZE (outbuf)); GST_BUFFER_SIZE (outbuf));

View file

@ -581,9 +581,15 @@ gst_rtspsrc_open (GstRTSPSrc * src)
gchar **options; gchar **options;
gint i; gint i;
rtsp_message_get_header (&response, RTSP_HDR_PUBLIC, &respoptions); /* Try Allow Header first */
if (!respoptions) rtsp_message_get_header (&response, RTSP_HDR_ALLOW, &respoptions);
goto no_options; if (!respoptions) {
/* Then maybe Public Header... */
rtsp_message_get_header (&response, RTSP_HDR_PUBLIC, &respoptions);
if (!respoptions) {
goto no_options;
}
}
/* parse options */ /* parse options */
options = g_strsplit (respoptions, ",", 0); options = g_strsplit (respoptions, ",", 0);