summaryrefslogtreecommitdiffstats
path: root/gst/rtsp
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-10-01 16:34:56 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-10-01 16:34:56 +0000
commit5274c3f4e2139b8f781315ba6ed5858ca2760a8e (patch)
treec65d964f52e0ce46c5fed9eb14d89d588a760679 /gst/rtsp
parentb3e03a9a121bf3c69a2d33e9e8feef3e1547dfe0 (diff)
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.
Diffstat (limited to 'gst/rtsp')
-rw-r--r--gst/rtsp/gstrtspsrc.c51
-rw-r--r--gst/rtsp/gstrtspsrc.h5
2 files changed, 56 insertions, 0 deletions
diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c
index e06f8b62..c7cfbcd9 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 29f23ce4..77088b8a 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 {