[gst-cvs] gst-plugins-good: udp: make url parsing compatible with VLC syntax

Wim Taymans wtay at kemper.freedesktop.org
Fri Jun 18 07:18:12 PDT 2010


Module: gst-plugins-good
Branch: master
Commit: e25cdc31d30d5bade601fcc662cecb3f2e707e78
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=e25cdc31d30d5bade601fcc662cecb3f2e707e78

Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Fri Jun 18 16:16:28 2010 +0200

udp: make url parsing compatible with VLC syntax

Skip everything before the @ sign in the url location. VLC uses that as the
remote address to connect to (but we ignore it for now). This makes our udp urls
compatible with the ones used by VLC.

Fixes #597695

---

 gst/udp/gstudpnetutils.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/gst/udp/gstudpnetutils.c b/gst/udp/gstudpnetutils.c
index 85d6f74..f488fcc 100644
--- a/gst/udp/gstudpnetutils.c
+++ b/gst/udp/gstudpnetutils.c
@@ -370,7 +370,7 @@ gst_udp_uri_update (GstUDPUri * uri, const gchar * host, gint port)
 int
 gst_udp_parse_uri (const gchar * uristr, GstUDPUri * uri)
 {
-  gchar *protocol;
+  gchar *protocol, *location_start;
   gchar *location, *location_end;
   gchar *colptr;
 
@@ -379,11 +379,19 @@ gst_udp_parse_uri (const gchar * uristr, GstUDPUri * uri)
     goto wrong_protocol;
   g_free (protocol);
 
-  location = gst_uri_get_location (uristr);
-  if (!location)
+  location_start = gst_uri_get_location (uristr);
+  if (!location_start)
     return FALSE;
 
-  GST_DEBUG ("got location '%s'", location);
+  GST_DEBUG ("got location '%s'", location_start);
+
+  /* VLC compatibility, strip everything before the @ sign. VLC uses that as the
+   * remote address. */
+  location = g_strstr_len (location_start, -1, "@");
+  if (location == NULL)
+    location = location_start;
+  else
+    location += 1;
 
   if (location[0] == '[') {
     GST_DEBUG ("parse IPV6 address '%s'", location);
@@ -412,7 +420,7 @@ gst_udp_parse_uri (const gchar * uristr, GstUDPUri * uri)
   if (colptr != NULL) {
     uri->port = atoi (colptr + 1);
   }
-  g_free (location);
+  g_free (location_start);
 
   return 0;
 





More information about the Gstreamer-commits mailing list