]> git.sesse.net Git - vlc/blobdiff - modules/demux/live555.cpp
live555: Mark --rtsp-tcp as safe.
[vlc] / modules / demux / live555.cpp
index 1643f8b6b954b2f9b67d80bbc2a61e8052580aba..fbbad33e91820735fe13d2fad54f99f9dfe11097 100644 (file)
@@ -42,7 +42,7 @@
 #include <vlc_plugin.h>
 #include <vlc_input.h>
 #include <vlc_demux.h>
-#include <vlc_interface.h>
+#include <vlc_dialog.h>
 #include <vlc_network.h>
 #include <vlc_url.h>
 
@@ -103,11 +103,14 @@ vlc_module_begin ()
         set_description( N_("RTSP/RTP access and demux") )
         add_shortcut( "rtsp" )
         add_shortcut( "sdp" )
+        add_shortcut( "live" )
+        add_shortcut( "livedotcom" )
         set_capability( "access_demux", 0 )
         set_callbacks( Open, Close )
         add_bool( "rtsp-tcp", 0, NULL,
                   N_("Use RTP over RTSP (TCP)"),
                   N_("Use RTP over RTSP (TCP)"), true )
+            change_safe()
         add_integer( "rtp-client-port", -1, NULL,
                   N_("Client port"),
                   N_("Port to use for the RTP source of the session"), true )
@@ -123,6 +126,7 @@ vlc_module_begin ()
                   true )
         add_integer("rtsp-caching", 4 * DEFAULT_PTS_DELAY / 1000, NULL,
                     CACHING_TEXT, CACHING_LONGTEXT, true )
+            change_safe()
         add_bool(   "rtsp-kasenna", false, NULL, KASENNA_TEXT,
                     KASENNA_LONGTEXT, true )
         add_string( "rtsp-user", NULL, NULL, USER_TEXT,
@@ -479,7 +483,6 @@ static int Connect( demux_t *p_demux )
     char *p_sdp       = NULL;
     int  i_http_port  = 0;
     int  i_ret        = VLC_SUCCESS;
-    int timeout;
 
     if( p_sys->url.i_port == 0 ) p_sys->url.i_port = 554;
     if( p_sys->url.psz_username || p_sys->url.psz_password )
@@ -542,12 +545,12 @@ describe:
     authenticator.setUsernameAndPassword( (const char*)psz_user,
                                           (const char*)psz_pwd );
 
-    timeout = var_CreateGetInteger(p_demux, "ipv4-timeout");
-    timeout /= 1000;
+    /* */
+    const int i_timeout = var_CreateGetInteger(p_demux, "ipv4-timeout") / 1000;
 
 #if LIVEMEDIA_LIBRARY_VERSION_INT >= 1223337600
     psz_options = p_sys->rtsp->sendOptionsCmd( psz_url, psz_user, psz_pwd,
-                                               &authenticator, timeout );
+                                               &authenticator, i_timeout );
 #else
     psz_options = p_sys->rtsp->sendOptionsCmd( psz_url, psz_user, psz_pwd,
                                                &authenticator );
@@ -557,26 +560,24 @@ describe:
         // try again, with the realm set this time
 #if LIVEMEDIA_LIBRARY_VERSION_INT >= 1223337600
         psz_options = p_sys->rtsp->sendOptionsCmd( psz_url, psz_user, psz_pwd,
-                                               &authenticator, timeout );
+                                               &authenticator, i_timeout );
 #else
         psz_options = p_sys->rtsp->sendOptionsCmd( psz_url, psz_user, psz_pwd,
                                                &authenticator );
 #endif
     }
     if( psz_options )
-    {
         p_sys->b_get_param = strstr( psz_options, "GET_PARAMETER" ) ? true : false ;
+    delete [] psz_options;
+
 #if LIVEMEDIA_LIBRARY_VERSION_INT >= 1223337600
-        p_sdp = p_sys->rtsp->describeWithPassword( psz_url, (const char*)psz_user, (const char*)psz_pwd,
-                                          var_GetBool( p_demux, "rtsp-kasenna" ), timeout );
+    p_sdp = p_sys->rtsp->describeWithPassword( psz_url, (const char*)psz_user, (const char*)psz_pwd,
+                                          var_GetBool( p_demux, "rtsp-kasenna" ), i_timeout );
 #else
-        p_sdp = p_sys->rtsp->describeWithPassword( psz_url, (const char*)psz_user, (const char*)psz_pwd,
+    p_sdp = p_sys->rtsp->describeWithPassword( psz_url, (const char*)psz_user, (const char*)psz_pwd,
                                           var_GetBool( p_demux, "rtsp-kasenna" ) );
 #endif
 
-    }
-    delete [] psz_options;
-
     if( p_sdp == NULL )
     {
         /* failure occurred */
@@ -606,17 +607,14 @@ describe:
 
         if( i_code == 401 )
         {
-            int i_result;
             msg_Dbg( p_demux, "authentication failed" );
 
             free( psz_user );
             free( psz_pwd );
-            psz_user = psz_pwd = NULL;
-
-            i_result = intf_UserLoginPassword( p_demux, _("RTSP authentication"),
-                           _("Please enter a valid login name and a password."),
-                                                   &psz_user, &psz_pwd );
-            if( i_result == DIALOG_OK_YES )
+            dialog_Login( p_demux, &psz_user, &psz_pwd,
+                          _("RTSP authentication"),
+                        _("Please enter a valid login name and a password.") );
+            if( psz_user != NULL && psz_pwd != NULL )
             {
                 msg_Dbg( p_demux, "retrying with user=%s, pwd=%s",
                          psz_user, psz_pwd );
@@ -1033,7 +1031,13 @@ static int SessionsSetup( demux_t *p_demux )
     /* Retrieve the duration if possible */
     p_sys->i_npt_length = p_sys->ms->playEndTime();
 
+    /* */
     msg_Dbg( p_demux, "setup start: %f stop:%f", p_sys->i_npt_start, p_sys->i_npt_length );
+
+    /* */
+    p_sys->b_no_data = true;
+    p_sys->i_no_data_ti = 0;
+
     return i_return;
 }
 
@@ -1424,7 +1428,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             }
 
             /* Retrieve the starttime if possible */
-            p_sys->i_npt = p_sys->i_npt_start = p_sys->ms->playStartTime();
+            p_sys->i_npt_start = p_sys->ms->playStartTime();
 
             /* Retrieve the duration if possible */
             p_sys->i_npt_length = p_sys->ms->playEndTime();
@@ -1481,6 +1485,8 @@ static int RollOverTcp( demux_t *p_demux )
     p_sys->rtsp = NULL;
     p_sys->track = NULL;
     p_sys->i_track = 0;
+    p_sys->b_no_data = true;
+    p_sys->i_no_data_ti = 0;
 
     /* Reopen rtsp client */
     if( ( i_return = Connect( p_demux ) ) != VLC_SUCCESS )