From 5274c3f4e2139b8f781315ba6ed5858ca2760a8e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 1 Oct 2007 16:34:56 +0000 Subject: [PATCH] gst/rtsp/gstrtspsrc.*: Parse bandwidth modifiers, they are not yet configured in the session manager because we don't... Original commit message from CVS: * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_get_bandwidth), (gst_rtspsrc_collect_bandwidth), (gst_rtspsrc_create_stream), (gst_rtspsrc_media_to_caps), (gst_rtspsrc_loop_interleaved): * gst/rtsp/gstrtspsrc.h: Parse bandwidth modifiers, they are not yet configured in the session manager because we don't have an API for that yet. --- ChangeLog | 9 +++++++++ gst/rtsp/gstrtspsrc.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ gst/rtsp/gstrtspsrc.h | 5 +++++ 3 files changed, 65 insertions(+) diff --git a/ChangeLog b/ChangeLog index d6832e7..a37c09a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2007-10-01 Wim Taymans + * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_get_bandwidth), + (gst_rtspsrc_collect_bandwidth), (gst_rtspsrc_create_stream), + (gst_rtspsrc_media_to_caps), (gst_rtspsrc_loop_interleaved): + * gst/rtsp/gstrtspsrc.h: + Parse bandwidth modifiers, they are not yet configured in the session + manager because we don't have an API for that yet. + +2007-10-01 Wim Taymans + * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_parse_rtpmap), (gst_rtspsrc_media_to_caps), (gst_rtspsrc_loop_interleaved): Use shiny new function in -base to get the default clock-rate. diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index e06f8b6..c7cfbcd 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -537,6 +537,53 @@ find_stream (GstRTSPSrc * src, gconstpointer data, gconstpointer func) return NULL; } +static const GstSDPBandwidth * +gst_rtspsrc_get_bandwidth (GstRTSPSrc * src, const GstSDPMessage * sdp, + const GstSDPMedia * media, const gchar * type) +{ + guint i, len; + + /* first look in the media specific section */ + len = gst_sdp_media_bandwidths_len (media); + for (i = 0; i < len; i++) { + const GstSDPBandwidth *bw = gst_sdp_media_get_bandwidth (media, i); + + if (strcmp (bw->bwtype, type) == 0) + return bw; + } + /* then look in the message specific section */ + len = gst_sdp_message_bandwidths_len (sdp); + for (i = 0; i < len; i++) { + const GstSDPBandwidth *bw = gst_sdp_message_get_bandwidth (sdp, i); + + if (strcmp (bw->bwtype, type) == 0) + return bw; + } + return NULL; +} + +static void +gst_rtspsrc_collect_bandwidth (GstRTSPSrc * src, const GstSDPMessage * sdp, + const GstSDPMedia * media, GstRTSPStream * stream) +{ + const GstSDPBandwidth *bw; + + if ((bw = gst_rtspsrc_get_bandwidth (src, sdp, media, GST_SDP_BWTYPE_AS))) + stream->as_bandwidth = bw->bandwidth; + else + stream->as_bandwidth = -1; + + if ((bw = gst_rtspsrc_get_bandwidth (src, sdp, media, GST_SDP_BWTYPE_RR))) + stream->rr_bandwidth = bw->bandwidth; + else + stream->rr_bandwidth = -1; + + if ((bw = gst_rtspsrc_get_bandwidth (src, sdp, media, GST_SDP_BWTYPE_RS))) + stream->rs_bandwidth = bw->bandwidth; + else + stream->rs_bandwidth = -1; +} + static GstRTSPStream * gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx) { @@ -561,6 +608,9 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx) stream->eos = FALSE; stream->discont = TRUE; + /* collect bandwidth information for this steam */ + gst_rtspsrc_collect_bandwidth (src, sdp, media, stream); + /* we must have a payload. No payload means we cannot create caps */ /* FIXME, handle multiple formats. */ if ((payload = gst_sdp_media_get_format (media, 0))) { @@ -584,6 +634,7 @@ gst_rtspsrc_create_stream (GstRTSPSrc * src, GstSDPMessage * sdp, gint idx) * the RTP-Info header field returned from PLAY. */ control_url = gst_sdp_media_get_attribute_val (media, "control"); + GST_DEBUG_OBJECT (src, "stream %d, (%p)", stream->id, stream); GST_DEBUG_OBJECT (src, " pt: %d", stream->pt); GST_DEBUG_OBJECT (src, " container: %d", stream->container); diff --git a/gst/rtsp/gstrtspsrc.h b/gst/rtsp/gstrtspsrc.h index 29f23ce..77088b8 100644 --- a/gst/rtsp/gstrtspsrc.h +++ b/gst/rtsp/gstrtspsrc.h @@ -120,6 +120,11 @@ struct _GstRTSPStream { guint32 ssrc; guint32 seqbase; guint64 timebase; + + /* bandwidth */ + guint as_bandwidth; + guint rs_bandwidth; + guint rr_bandwidth; }; struct _GstRTSPSrc { -- 2.7.4