]> git.sesse.net Git - vlc/commitdiff
Split the test for user/passwd and the test for the port number (the two tests are...
authorRémi Duraffort <ivoire@videolan.org>
Mon, 22 Jun 2009 08:25:40 +0000 (10:25 +0200)
committerJP Dinger <jpd@videolan.org>
Mon, 22 Jun 2009 09:03:31 +0000 (11:03 +0200)
Signed-off-by: JP Dinger <jpd@videolan.org>
modules/demux/live555.cpp

index f271dd1e68a04ace1dbd6e4ac5710e755d089bbc..d97a1944a44738d94807ff8ad13d980c3bf64bcb 100644 (file)
@@ -459,23 +459,28 @@ static int Connect( demux_t *p_demux )
     int  i_http_port  = 0;
     int  i_ret        = VLC_SUCCESS;
 
-    if( p_sys->url.i_port == 0 ) p_sys->url.i_port = 554;
-    if( p_sys->url.psz_username || p_sys->url.psz_password )
+    /* Create the url using the port number if available */
+    if( p_sys->url.i_port == 0 )
+    {
+        p_sys->url.i_port = 554;
+        if( asprintf( &psz_url, "rtsp://%s", p_sys->psz_path ) == -1 )
+            return VLC_ENOMEM;
+    }
+    else
     {
-        int err;
-        err = asprintf( &psz_url, "rtsp://%s:%d%s", p_sys->url.psz_host,
-                        p_sys->url.i_port, p_sys->url.psz_path );
-        if( err == -1 ) return VLC_ENOMEM;
+        if( asprintf( &psz_url, "rtsp://%s:%d%s", p_sys->url.psz_host,
+                      p_sys->url.i_port, p_sys->url.psz_path ) == -1 )
+            return VLC_ENOMEM;
+    }
 
+    /* Get the user name and password */
+    if( p_sys->url.psz_username || p_sys->url.psz_password )
+    {
         psz_user = strdup( p_sys->url.psz_username ? p_sys->url.psz_username : "" );
         psz_pwd  = strdup( p_sys->url.psz_password ? p_sys->url.psz_password : "");
     }
     else
     {
-        int err;
-        err = asprintf( &psz_url, "rtsp://%s", p_sys->psz_path );
-        if( err == -1 ) return VLC_ENOMEM;
-
         psz_user = var_CreateGetString( p_demux, "rtsp-user" );
         psz_pwd  = var_CreateGetString( p_demux, "rtsp-pwd" );
     }