summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-01-07 16:36:08 -0300
committerThiago Santos <thiago.sousa.santos@collabora.co.uk>2010-01-07 16:36:08 -0300
commit6dd352580686efac0c904bb25c650a59f0006706 (patch)
treebfc28f51203f263056bad3991e95f55232da56f8
parentdb73c4337dbac61630f7f1e86883bfffaaab4861 (diff)
rmdemux: Parse and post bitrate for streams
Parse the bitrate of the streams and post their tags. Fixes #599299
-rw-r--r--gst/realmedia/rmdemux.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gst/realmedia/rmdemux.c b/gst/realmedia/rmdemux.c
index 22bd7bb9..08de6f54 100644
--- a/gst/realmedia/rmdemux.c
+++ b/gst/realmedia/rmdemux.c
@@ -1492,7 +1492,8 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
/* save for later, we must send the tags after the newsegment event */
if (codec_name != NULL && codec_tag != NULL) {
- stream->pending_tags = gst_tag_list_new ();
+ if (stream->pending_tags == NULL)
+ stream->pending_tags = gst_tag_list_new ();
gst_tag_list_add (stream->pending_tags, GST_TAG_MERGE_KEEP,
codec_tag, codec_name, NULL);
}
@@ -1556,6 +1557,8 @@ gst_rmdemux_parse_mdpr (GstRMDemux * rmdemux, const guint8 * data, int length)
guint str_len = 0;
int stream_type;
int offset;
+ guint32 max_bitrate;
+ guint32 avg_bitrate;
stream = g_new0 (GstRMDemuxStream, 1);
@@ -1569,6 +1572,24 @@ gst_rmdemux_parse_mdpr (GstRMDemux * rmdemux, const guint8 * data, int length)
stream->adapter = gst_adapter_new ();
GST_LOG_OBJECT (rmdemux, "stream_number=%d", stream->id);
+ /* parse the bitrates */
+ max_bitrate = RMDEMUX_GUINT32_GET (data + 2);
+ avg_bitrate = RMDEMUX_GUINT32_GET (data + 6);
+ GST_LOG_OBJECT (rmdemux, "Stream max bitrate=%u", max_bitrate);
+ GST_LOG_OBJECT (rmdemux, "Stream avg bitrate=%u", avg_bitrate);
+ if (max_bitrate != 0) {
+ if (stream->pending_tags == NULL)
+ stream->pending_tags = gst_tag_list_new ();
+ gst_tag_list_add (stream->pending_tags, GST_TAG_MERGE_REPLACE,
+ GST_TAG_MAXIMUM_BITRATE, max_bitrate, NULL);
+ }
+ if (avg_bitrate != 0) {
+ if (stream->pending_tags == NULL)
+ stream->pending_tags = gst_tag_list_new ();
+ gst_tag_list_add (stream->pending_tags, GST_TAG_MERGE_REPLACE,
+ GST_TAG_BITRATE, avg_bitrate, NULL);
+ }
+
offset = 30;
stream1_type_string = gst_rm_utils_read_string8 (data + offset,
length - offset, &str_len);