gst/realmedia/rtspreal.*: Move assembly rule parsing to the place where we parse the SDP as it's also there that we c...
Original commit message from CVS: * gst/realmedia/rtspreal.c: (rtsp_ext_real_before_send), (rtsp_ext_real_parse_sdp), (rtsp_ext_real_stream_select): * gst/realmedia/rtspreal.h: Move assembly rule parsing to the place where we parse the SDP as it's also there that we create the MDPR and we need the currently selected asmrule in order to select the right MTLI. Fixes #529359.
This commit is contained in:
parent
a7de0e326a
commit
dc920d924b
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2008-04-30 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
* gst/realmedia/rtspreal.c: (rtsp_ext_real_before_send),
|
||||||
|
(rtsp_ext_real_parse_sdp), (rtsp_ext_real_stream_select):
|
||||||
|
* gst/realmedia/rtspreal.h:
|
||||||
|
Move assembly rule parsing to the place where we parse the SDP as it's
|
||||||
|
also there that we create the MDPR and we need the currently selected
|
||||||
|
asmrule in order to select the right MTLI.
|
||||||
|
Fixes #529359.
|
||||||
|
|
||||||
2008-04-29 Michael Smith <msmith@songbirdnest.com>
|
2008-04-29 Michael Smith <msmith@songbirdnest.com>
|
||||||
|
|
||||||
* gst/realmedia/realhash.c:
|
* gst/realmedia/realhash.c:
|
||||||
|
@ -56,6 +56,7 @@ GST_ELEMENT_DETAILS ("RealMedia RTSP Extension",
|
|||||||
"Wim Taymans <wim.taymans@gmail.com>");
|
"Wim Taymans <wim.taymans@gmail.com>");
|
||||||
|
|
||||||
#define SERVER_PREFIX "RealServer"
|
#define SERVER_PREFIX "RealServer"
|
||||||
|
#define DEFAULT_BANDWIDTH "10485800"
|
||||||
|
|
||||||
static GstRTSPResult
|
static GstRTSPResult
|
||||||
rtsp_ext_real_get_transports (GstRTSPExtension * ext,
|
rtsp_ext_real_get_transports (GstRTSPExtension * ext,
|
||||||
@ -121,7 +122,8 @@ rtsp_ext_real_before_send (GstRTSPExtension * ext, GstRTSPMessage * request)
|
|||||||
}
|
}
|
||||||
case GST_RTSP_DESCRIBE:
|
case GST_RTSP_DESCRIBE:
|
||||||
{
|
{
|
||||||
gst_rtsp_message_add_header (request, GST_RTSP_HDR_BANDWIDTH, "10485800");
|
gst_rtsp_message_add_header (request, GST_RTSP_HDR_BANDWIDTH,
|
||||||
|
DEFAULT_BANDWIDTH);
|
||||||
gst_rtsp_message_add_header (request, GST_RTSP_HDR_GUID,
|
gst_rtsp_message_add_header (request, GST_RTSP_HDR_GUID,
|
||||||
"00000000-0000-0000-0000-000000000000");
|
"00000000-0000-0000-0000-000000000000");
|
||||||
gst_rtsp_message_add_header (request, GST_RTSP_HDR_REGION_DATA, "0");
|
gst_rtsp_message_add_header (request, GST_RTSP_HDR_REGION_DATA, "0");
|
||||||
@ -268,6 +270,8 @@ rtsp_ext_real_parse_sdp (GstRTSPExtension * ext, GstSDPMessage * sdp,
|
|||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
gchar *opaque_data;
|
gchar *opaque_data;
|
||||||
gsize opaque_data_len, asm_rule_book_len;
|
gsize opaque_data_len, asm_rule_book_len;
|
||||||
|
GHashTable *vars;
|
||||||
|
GString *rules;
|
||||||
|
|
||||||
/* don't bother for non-real formats */
|
/* don't bother for non-real formats */
|
||||||
READ_INT (sdp, "IsRealDataType", ctx->isreal);
|
READ_INT (sdp, "IsRealDataType", ctx->isreal);
|
||||||
@ -345,13 +349,19 @@ rtsp_ext_real_parse_sdp (GstRTSPExtension * ext, GstSDPMessage * sdp,
|
|||||||
WRITE_STRING2 (datap, comment, comment_len);
|
WRITE_STRING2 (datap, comment, comment_len);
|
||||||
offset += size;
|
offset += size;
|
||||||
|
|
||||||
|
/* fix the hashtale for the rule parser */
|
||||||
|
rules = g_string_new ("");
|
||||||
|
vars = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
|
g_hash_table_insert (vars, "Bandwidth", DEFAULT_BANDWIDTH);
|
||||||
|
|
||||||
/* MDPR */
|
/* MDPR */
|
||||||
for (i = 0; i < ctx->n_streams; i++) {
|
for (i = 0; i < ctx->n_streams; i++) {
|
||||||
const GstSDPMedia *media;
|
const GstSDPMedia *media;
|
||||||
guint16 j, sel;
|
|
||||||
guint32 len;
|
guint32 len;
|
||||||
GstRTSPRealStream *stream;
|
GstRTSPRealStream *stream;
|
||||||
gchar *str;
|
gchar *str;
|
||||||
|
gint rulematches[MAX_RULEMATCHES];
|
||||||
|
gint sel, j, n;
|
||||||
|
|
||||||
media = gst_sdp_message_get_media (sdp, i);
|
media = gst_sdp_message_get_media (sdp, i);
|
||||||
|
|
||||||
@ -391,7 +401,14 @@ rtsp_ext_real_parse_sdp (GstRTSPExtension * ext, GstSDPMessage * sdp,
|
|||||||
*/
|
*/
|
||||||
READ_STRING (media, "ASMRuleBook", str, asm_rule_book_len);
|
READ_STRING (media, "ASMRuleBook", str, asm_rule_book_len);
|
||||||
stream->rulebook = gst_asm_rule_book_new (str);
|
stream->rulebook = gst_asm_rule_book_new (str);
|
||||||
sel = 0;
|
|
||||||
|
n = gst_asm_rule_book_match (stream->rulebook, vars, rulematches);
|
||||||
|
for (j = 0; j < n; j++) {
|
||||||
|
g_string_append_printf (rules, "stream=%u;rule=%u,", i, rulematches[j]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get the MLTI for the first matched rules */
|
||||||
|
sel = rulematches[0];
|
||||||
|
|
||||||
READ_BUFFER_M (media, "OpaqueData", opaque_data, opaque_data_len);
|
READ_BUFFER_M (media, "OpaqueData", opaque_data, opaque_data_len);
|
||||||
|
|
||||||
@ -527,6 +544,17 @@ rtsp_ext_real_parse_sdp (GstRTSPExtension * ext, GstSDPMessage * sdp,
|
|||||||
offset += size;
|
offset += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* destroy the rulebook hashtable now */
|
||||||
|
g_hash_table_destroy (vars);
|
||||||
|
|
||||||
|
/* strip final , if we added some stream rules */
|
||||||
|
if (rules->len > 0) {
|
||||||
|
rules = g_string_truncate (rules, rules->len - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* and store rules in the context */
|
||||||
|
ctx->rules = g_string_free (rules, FALSE);
|
||||||
|
|
||||||
/* DATA */
|
/* DATA */
|
||||||
size = 18;
|
size = 18;
|
||||||
ENSURE_SIZE (offset + size);
|
ENSURE_SIZE (offset + size);
|
||||||
@ -569,14 +597,13 @@ rtsp_ext_real_stream_select (GstRTSPExtension * ext, GstRTSPUrl * url)
|
|||||||
GstRTSPMessage request = { 0 };
|
GstRTSPMessage request = { 0 };
|
||||||
GstRTSPMessage response = { 0 };
|
GstRTSPMessage response = { 0 };
|
||||||
gchar *req_url;
|
gchar *req_url;
|
||||||
GString *rules;
|
|
||||||
GList *walk;
|
|
||||||
gint i;
|
|
||||||
GHashTable *vars;
|
|
||||||
|
|
||||||
if (!ctx->isreal)
|
if (!ctx->isreal)
|
||||||
return GST_RTSP_OK;
|
return GST_RTSP_OK;
|
||||||
|
|
||||||
|
if (!ctx->rules)
|
||||||
|
return GST_RTSP_OK;
|
||||||
|
|
||||||
req_url = gst_rtsp_url_get_request_uri (url);
|
req_url = gst_rtsp_url_get_request_uri (url);
|
||||||
|
|
||||||
/* create SET_PARAMETER */
|
/* create SET_PARAMETER */
|
||||||
@ -586,34 +613,7 @@ rtsp_ext_real_stream_select (GstRTSPExtension * ext, GstRTSPUrl * url)
|
|||||||
|
|
||||||
g_free (req_url);
|
g_free (req_url);
|
||||||
|
|
||||||
rules = g_string_new ("");
|
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SUBSCRIBE, ctx->rules);
|
||||||
vars = g_hash_table_new (g_str_hash, g_str_equal);
|
|
||||||
g_hash_table_insert (vars, "Bandwidth", "300000");
|
|
||||||
|
|
||||||
for (walk = ctx->streams, i = 0; walk; walk = g_list_next (walk), i++) {
|
|
||||||
GstRTSPRealStream *stream;
|
|
||||||
gint rulematches[MAX_RULEMATCHES];
|
|
||||||
gint j, n;
|
|
||||||
|
|
||||||
stream = (GstRTSPRealStream *) walk->data;
|
|
||||||
|
|
||||||
n = gst_asm_rule_book_match (stream->rulebook, vars, rulematches);
|
|
||||||
for (j = 0; j < n; j++) {
|
|
||||||
g_string_append_printf (rules, "stream=%u;rule=%u,", i, rulematches[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_hash_table_destroy (vars);
|
|
||||||
|
|
||||||
/* strip final , if we added some stream rules */
|
|
||||||
if (rules->len > 0) {
|
|
||||||
rules = g_string_truncate (rules, rules->len - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* do selection */
|
|
||||||
gst_rtsp_message_add_header (&request, GST_RTSP_HDR_SUBSCRIBE, rules->str);
|
|
||||||
|
|
||||||
g_string_free (rules, TRUE);
|
|
||||||
|
|
||||||
/* send SET_PARAMETER */
|
/* send SET_PARAMETER */
|
||||||
if ((res = gst_rtsp_extension_send (ext, &request, &response)) < 0)
|
if ((res = gst_rtsp_extension_send (ext, &request, &response)) < 0)
|
||||||
|
@ -74,6 +74,8 @@ struct _GstRTSPReal {
|
|||||||
guint max_packet_size;
|
guint max_packet_size;
|
||||||
guint avg_packet_size;
|
guint avg_packet_size;
|
||||||
guint duration;
|
guint duration;
|
||||||
|
|
||||||
|
gchar *rules;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstRTSPRealClass {
|
struct _GstRTSPRealClass {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user