]> git.sesse.net Git - vlc/blobdiff - modules/access/rtp/rtp.c
modules: use the new add_shortcut capability (add multiple shortcuts at a time).
[vlc] / modules / access / rtp / rtp.c
index a13c71d4465880ad3afd53dd00c89a3da88b6835..cf848686dc476e52cd343e11128e9c1d73ad97a2 100644 (file)
@@ -8,7 +8,7 @@
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2.0
+ * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
@@ -16,7 +16,7 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU Lesser General Public
+ * You should have received a copy of the GNU General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  ****************************************************************************/
@@ -34,8 +34,6 @@
 #include <vlc_network.h>
 #include <vlc_plugin.h>
 
-#include <vlc_codecs.h>
-
 #include "rtp.h"
 #ifdef HAVE_SRTP
 # include <srtp.h>
@@ -117,11 +115,9 @@ vlc_module_begin ()
                  RTP_MAX_MISORDER_LONGTEXT, true)
         change_integer_range (0, 32767)
 
-    add_shortcut ("dccp")
     /*add_shortcut ("sctp")*/
-    add_shortcut ("rtptcp") /* "tcp" is already taken :( */
-    add_shortcut ("rtp")
-    add_shortcut ("udplite")
+    add_shortcut ("dccp", "rtptcp", /* "tcp" is already taken :( */
+                  "rtp", "udplite")
 vlc_module_end ()
 
 /*
@@ -170,17 +166,26 @@ static int Open (vlc_object_t *obj)
         return VLC_EGENERIC;
 
     char *tmp = strdup (demux->psz_path);
-    char *shost = tmp;
-    if (shost == NULL)
+    if (tmp == NULL)
         return VLC_ENOMEM;
 
-    char *dhost = strchr (shost, '@');
-    if (dhost)
-        *dhost++ = '\0';
+    char *shost;
+    char *dhost = strchr (tmp, '@');
+    if (dhost != NULL)
+    {
+        *(dhost++) = '\0';
+        shost = tmp;
+    }
+    else
+    {
+        dhost = tmp;
+        shost = NULL;
+    }
 
     /* Parses the port numbers */
     int sport = 0, dport = 0;
-    sport = extract_port (&shost);
+    if (shost != NULL)
+        sport = extract_port (&shost);
     if (dhost != NULL)
         dport = extract_port (&dhost);
     if (dport == 0)
@@ -213,14 +218,14 @@ static int Open (vlc_object_t *obj)
 #ifdef SOCK_DCCP
             var_Create (obj, "dccp-service", VLC_VAR_STRING);
             var_SetString (obj, "dccp-service", "RTPV"); /* FIXME: RTPA? */
-            fd = net_Connect (obj, shost, sport, SOCK_DCCP, tp);
+            fd = net_Connect (obj, dhost, dport, SOCK_DCCP, tp);
 #else
             msg_Err (obj, "DCCP support not included");
 #endif
             break;
 
         case IPPROTO_TCP:
-            fd = net_Connect (obj, shost, sport, SOCK_STREAM, tp);
+            fd = net_Connect (obj, dhost, dport, SOCK_STREAM, tp);
             break;
     }
 
@@ -247,7 +252,8 @@ static int Open (vlc_object_t *obj)
     p_sys->rtcp_fd      = rtcp_fd;
     p_sys->caching      = var_CreateGetInteger (obj, "rtp-caching");
     p_sys->max_src      = var_CreateGetInteger (obj, "rtp-max-src");
-    p_sys->timeout      = var_CreateGetInteger (obj, "rtp-timeout");
+    p_sys->timeout      = var_CreateGetInteger (obj, "rtp-timeout")
+                        * CLOCK_FREQ;
     p_sys->max_dropout  = var_CreateGetInteger (obj, "rtp-max-dropout");
     p_sys->max_misorder = var_CreateGetInteger (obj, "rtp-max-misorder");
     p_sys->framed_rtp   = (tp == IPPROTO_TCP);