[vlc-devel] commit: Split the test for user/passwd and the test for the port number ( the two tests are independent). ( Rémi Duraffort )

git version control git at videolan.org
Mon Jun 22 14:45:02 CEST 2009


vlc | branch: 1.0-bugfix | Rémi Duraffort <ivoire at videolan.org> | Mon Jun 22 10:25:40 2009 +0200| [9f8053e6b942a23a3c690e64175a475581e3dd26] | committer: Rémi Duraffort 

Split the test for user/passwd and the test for the port number (the two tests are independent).

Signed-off-by: JP Dinger <jpd at videolan.org>
(cherry picked from commit e3787b90a0cd4b12af67513230cd0f36fea3d372)

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9f8053e6b942a23a3c690e64175a475581e3dd26
---

 modules/demux/live555.cpp |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index 6a8540c..f6e9b2c 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -486,23 +486,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" );
     }




More information about the vlc-devel mailing list