[gstreamer-bugs] [Bug 628214] Add support to RTSP initiation through SDP files

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Mon Sep 6 03:00:33 PDT 2010


https://bugzilla.gnome.org/show_bug.cgi?id=628214
  GStreamer | gst-plugins-good | git

--- Comment #7 from Wim Taymans <wim.taymans at gmail.com> 2010-09-06 10:00:29 UTC ---
(From update of attachment 168963)
> static gchar **
> gst_rtspsrc_uri_get_protocols (void)
> {
>-  static const gchar *protocols[] = { "rtsp", "rtspu", "rtspt", "rtsph", NULL };
>+  static const gchar *protocols[] =
>+      { "sdp", "rtsp", "rtspu", "rtspt", "rtsph", NULL };
> 
>   return (gchar **) protocols;
> }

Please make a new rtsp-sdp:// uri which is less likely to conflict with an
existing
uri.

>+static const gchar *
>+gst_rtspsrc_init_from_sdp (GstRTSPSrc * src, const gchar * sdpstr)
>+{
>+  int i, l = strlen (sdpstr);
>+  gchar *string = g_malloc (l + 1);
>+  const gchar *control_url = NULL;
>+  strcpy (string, sdpstr);
>+
>+  for (i = 0; i < l; i++)
>+    if (string[i] == ';' && string[i + 1] > 'a' && string[i + 1] < 'z'
>+        && string[i + 2] == '=')
>+      string[i] = '\n';

Why this cleanup of the SDP? I would pass a base64 encoded version of the raw
SDP in the rtsp-sdp:// uri.

>+
>+  if (src->sdp != NULL) {
>+    GST_ERROR_OBJECT (src, "SDP already existing");
>+  } else {

Setting a new rtsp-sdp:// overrides the previous one.

>+    GST_DEBUG_OBJECT (src, "SDP protocol, extracting SDP data");
>+    if (gst_sdp_message_new (&src->sdp) == GST_SDP_OK &&
>+        gst_sdp_message_parse_buffer ((guchar *) string, l,
>+            src->sdp) == GST_SDP_OK) {
>+      GST_DEBUG_OBJECT (src, "got SDP message:\n%s", string);
>+
>+      for (i = 0;; i++) {
>+        control_url =
>+            gst_sdp_message_get_attribute_val_n (src->sdp, "control", i);
>+        if (control_url == NULL)
>+          break;
>+
>+        /* only take fully qualified urls */
>+        if (g_str_has_prefix (control_url, "rtsp://"))
>+          break;
>+      }
>+    } else {
>+      GST_ERROR_OBJECT (src, "unable to create SDP message");
>+    }
>+  }

There is no need to parse the control url, this will happen later.

> 
>+  if (g_str_has_prefix (uri, "sdp://")) {
>+    if ((uri = gst_rtspsrc_init_from_sdp (src, uri + 6)) == NULL)
>+      GST_ERROR ("unable to initialize from give SDP data");
>+  }
>+
>   /* try to parse */
>   if ((res = gst_rtsp_url_parse (uri, &newurl)) < 0)
>     goto parse_error;
> 

There is no need to retrieve the control url from the SDP and so there is also
no need to parse the control url.

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.




More information about the Gstreamer-bugs mailing list