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.
This commit is contained in:
Wim Taymans 2007-10-01 16:34:56 +00:00
parent b3e03a9a12
commit 5274c3f4e2
3 changed files with 65 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2007-10-01 Wim Taymans <wim.taymans@gmail.com>
* 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 <wim.taymans@gmail.com>
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_parse_rtpmap),

View file

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

View file

@ -120,6 +120,11 @@ struct _GstRTSPStream {
guint32 ssrc;
guint32 seqbase;
guint64 timebase;
/* bandwidth */
guint as_bandwidth;
guint rs_bandwidth;
guint rr_bandwidth;
};
struct _GstRTSPSrc {