]> git.sesse.net Git - vlc/blobdiff - modules/demux/live555.cpp
Never print the password in the logs.
[vlc] / modules / demux / live555.cpp
index 60751c60184dbca73461331096a872636bb86e68..9287f8367e861f68105c4b0860cf79eb66ebaec2 100644 (file)
@@ -18,9 +18,9 @@
  * 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 General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -79,16 +79,16 @@ static void Close( vlc_object_t * );
     "value should be set in millisecond units." )
 
 #define KASENNA_TEXT N_( "Kasenna RTSP dialect")
-#define KASENNA_LONGTEXT N_( "Kasenna servers use an old and unstandard " \
-    "dialect of RTSP. When you set this parameter, VLC will try this dialect "\
-    "for communication. In this mode you cannot connect to normal RTSP servers." )
+#define KASENNA_LONGTEXT N_( "Kasenna servers use an old and nonstandard " \
+    "dialect of RTSP. With this parameter VLC will try this dialect, but "\
+    "then it cannot connect to normal RTSP servers." )
 
 #define USER_TEXT N_("RTSP user name")
-#define USER_LONGTEXT N_("Allows you to modify the user name that will " \
-    "be used for authenticating the connection.")
+#define USER_LONGTEXT N_("Sets the username for the connection, " \
+    "if no username or password are set in the url.")
 #define PASS_TEXT N_("RTSP password")
-#define PASS_LONGTEXT N_("Allows you to modify the password that will be " \
-    "used for the connection.")
+#define PASS_LONGTEXT N_("Sets the password for the connection, " \
+    "if no username or password are set in the url.")
 
 vlc_module_begin ()
     set_description( N_("RTP/RTSP/SDP demuxer (using Live555)" ) )
@@ -134,8 +134,8 @@ vlc_module_begin ()
                     KASENNA_LONGTEXT, true )
         add_string( "rtsp-user", NULL, NULL, USER_TEXT,
                     USER_LONGTEXT, true )
-        add_string( "rtsp-pwd", NULL, NULL, PASS_TEXT,
-                    PASS_LONGTEXT, true )
+        add_password( "rtsp-pwd", NULL, NULL, PASS_TEXT,
+                      PASS_LONGTEXT, true )
 vlc_module_end ()
 
 
@@ -154,6 +154,7 @@ typedef struct
     bool            b_muxed;
     bool            b_quicktime;
     bool            b_asf;
+    bool            b_discard_trunc;
     stream_t        *p_out_muxed;    /* for muxed stream */
 
     uint8_t         *p_buffer;
@@ -619,8 +620,7 @@ describe:
                         _("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 );
+                msg_Dbg( p_demux, "retrying with user=%s", psz_user );
                 goto describe;
             }
         }
@@ -784,6 +784,7 @@ static int SessionsSetup( demux_t *p_demux )
             tk->b_quicktime = false;
             tk->b_asf       = false;
             tk->b_muxed     = false;
+            tk->b_discard_trunc = false;
             tk->p_out_muxed = NULL;
             tk->waiting     = 0;
             tk->b_rtcp_sync = false;
@@ -998,6 +999,13 @@ static int SessionsSetup( demux_t *p_demux )
                         p_sys->p_out_asf = stream_DemuxNew( p_demux, "asf",
                                                             p_demux->out );;
                 }
+                else if( !strcmp( sub->codecName(), "DV" ) )
+                {
+                    tk->b_muxed = true;
+                    tk->b_discard_trunc = true;
+                    tk->p_out_muxed = stream_DemuxNew( p_demux, "rawdv",
+                                                       p_demux->out );
+                }
             }
 
             if( !tk->b_quicktime && !tk->b_muxed && !tk->b_asf )
@@ -1348,11 +1356,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 return VLC_EGENERIC;
 
             /* According to RFC 2326 p56 chapter 12.35 a RTSP server that
-             * supports Scale should:
+             * supports Scale:
              *
-             * "The server should try to approximate the viewing rate, but may
-             *  restrict the range of scale values that it supports. The response
-             *  MUST contain the actual scale value chosen by the server."
+             * "[...] should try to approximate the viewing rate, but
+             *  may restrict the range of scale values that it supports.
+             *  The response MUST contain the actual scale value chosen
+             *  by the server."
              *
              * Scale = 1 indicates normal play
              * Scale > 1 indicates fast forward
@@ -1611,27 +1620,35 @@ static void StreamRead( void *p_private, unsigned int i_size,
 
     /* grow buffer if it looks like buffer is too small, but don't eat
      * up all the memory on strange streams */
-    if( i_truncated_bytes > 0 && tk->i_buffer < 2000000 )
+    if( i_truncated_bytes > 0 )
     {
-        void *p_tmp;
-        msg_Dbg( p_demux, "lost %d bytes", i_truncated_bytes );
-        msg_Dbg( p_demux, "increasing buffer size to %d", tk->i_buffer * 2 );
-        tk->i_buffer *= 2;
-        p_tmp = realloc( tk->p_buffer, tk->i_buffer );
-        if( p_tmp == NULL )
+        if( tk->i_buffer < 2000000 )
         {
-            msg_Warn( p_demux, "realloc failed" );
+            void *p_tmp;
+            msg_Dbg( p_demux, "lost %d bytes", i_truncated_bytes );
+            msg_Dbg( p_demux, "increasing buffer size to %d", tk->i_buffer * 2 );
+            p_tmp = realloc( tk->p_buffer, tk->i_buffer * 2 );
+            if( p_tmp == NULL )
+            {
+                msg_Warn( p_demux, "realloc failed" );
+            }
+            else
+            {
+                tk->p_buffer = (uint8_t*)p_tmp;
+                tk->i_buffer *= 2;
+            }
         }
-        else
+
+        if( tk->b_discard_trunc )
         {
-            tk->p_buffer = (uint8_t*)p_tmp;
+            p_sys->event = 0xff;
+            tk->waiting = 0;
+            return;
         }
     }
-    if( i_size > tk->i_buffer )
-    {
-        msg_Warn( p_demux, "buffer overflow" );
-    }
-    /* FIXME could i_size be > buffer size ? */
+
+    assert( i_size <= tk->i_buffer );
+
     if( tk->fmt.i_codec == VLC_CODEC_AMR_NB ||
         tk->fmt.i_codec == VLC_CODEC_AMR_WB )
     {