]> git.sesse.net Git - vlc/blobdiff - modules/demux/live555.cpp
Improved ac3/eac3 support in mp4 (fix #2524).
[vlc] / modules / demux / live555.cpp
index d03b77618c7821adb3cd82ac97865ce651a73521..00b51715c46569702444d1047f3c81305e03fc79 100644 (file)
@@ -107,28 +107,28 @@ vlc_module_begin ()
         set_callbacks( Open, Close )
         add_bool( "rtsp-tcp", 0, NULL,
                   N_("Use RTP over RTSP (TCP)"),
-                  N_("Use RTP over RTSP (TCP)"), true );
+                  N_("Use RTP over RTSP (TCP)"), true )
         add_integer( "rtp-client-port", -1, NULL,
                   N_("Client port"),
-                  N_("Port to use for the RTP source of the session"), true );
+                  N_("Port to use for the RTP source of the session"), true )
         add_bool( "rtsp-mcast", false, NULL,
                   N_("Force multicast RTP via RTSP"),
-                  N_("Force multicast RTP via RTSP"), true );
+                  N_("Force multicast RTP via RTSP"), true )
         add_bool( "rtsp-http", 0, NULL,
                   N_("Tunnel RTSP and RTP over HTTP"),
-                  N_("Tunnel RTSP and RTP over HTTP"), true );
+                  N_("Tunnel RTSP and RTP over HTTP"), true )
         add_integer( "rtsp-http-port", 80, NULL,
                   N_("HTTP tunnel port"),
                   N_("Port to use for tunneling the RTSP/RTP over HTTP."),
-                  true );
+                  true )
         add_integer("rtsp-caching", 4 * DEFAULT_PTS_DELAY / 1000, NULL,
-                    CACHING_TEXT, CACHING_LONGTEXT, true );
+                    CACHING_TEXT, CACHING_LONGTEXT, true )
         add_bool(   "rtsp-kasenna", false, NULL, KASENNA_TEXT,
-                    KASENNA_LONGTEXT, true );
+                    KASENNA_LONGTEXT, true )
         add_string( "rtsp-user", NULL, NULL, USER_TEXT,
-                    USER_LONGTEXT, true );
+                    USER_LONGTEXT, true )
         add_string( "rtsp-pwd", NULL, NULL, PASS_TEXT,
-                    PASS_LONGTEXT, true );
+                    PASS_LONGTEXT, true )
 vlc_module_end ()
 
 
@@ -235,8 +235,6 @@ static int  Open ( vlc_object_t *p_this )
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys = NULL;
 
-    MediaSubsessionIterator *iter   = NULL;
-    MediaSubsession         *sub    = NULL;
     int i, i_return;
     int i_error = VLC_EGENERIC;
 
@@ -398,14 +396,14 @@ error:
     {
         live_track_t *tk = p_sys->track[i];
 
-        if( tk->b_muxed ) stream_DemuxDelete( tk->p_out_muxed );
+        if( tk->b_muxed ) stream_Delete( tk->p_out_muxed );
         es_format_Clean( &tk->fmt );
         free( tk->p_buffer );
         free( tk );
     }
 
     if( p_sys->i_track ) free( p_sys->track );
-    if( p_sys->p_out_asf ) stream_DemuxDelete( p_sys->p_out_asf );
+    if( p_sys->p_out_asf ) stream_Delete( p_sys->p_out_asf );
     if( p_sys->rtsp && p_sys->ms ) p_sys->rtsp->teardownMediaSession( *p_sys->ms );
     if( p_sys->p_timeout )
     {
@@ -439,14 +437,14 @@ static void Close( vlc_object_t *p_this )
     {
         live_track_t *tk = p_sys->track[i];
 
-        if( tk->b_muxed ) stream_DemuxDelete( tk->p_out_muxed );
+        if( tk->b_muxed ) stream_Delete( tk->p_out_muxed );
         es_format_Clean( &tk->fmt );
         free( tk->p_buffer );
         free( tk );
     }
 
     if( p_sys->i_track ) free( p_sys->track );
-    if( p_sys->p_out_asf ) stream_DemuxDelete( p_sys->p_out_asf );
+    if( p_sys->p_out_asf ) stream_Delete( p_sys->p_out_asf );
     if( p_sys->rtsp && p_sys->ms ) p_sys->rtsp->teardownMediaSession( *p_sys->ms );
     if( p_sys->p_timeout )
     {
@@ -554,20 +552,29 @@ describe:
     psz_options = p_sys->rtsp->sendOptionsCmd( psz_url, psz_user, psz_pwd,
                                                &authenticator );
 #endif
-    if( psz_options )
+    if( psz_options == NULL && authenticator.realm() != NULL )
     {
+        // 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 );
+#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,
+    p_sdp = p_sys->rtsp->describeWithPassword( psz_url, (const char*)psz_user, (const char*)psz_pwd,
                                           var_GetBool( p_demux, "rtsp-kasenna" ), 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 */
@@ -783,6 +790,7 @@ static int SessionsSetup( demux_t *p_demux )
             tk->p_buffer    = (uint8_t *)malloc( 65536 );
             if( !tk->p_buffer )
             {
+                free( tk );
                 delete iter;
                 return VLC_ENOMEM;
             }
@@ -1033,7 +1041,6 @@ static int SessionsSetup( demux_t *p_demux )
 static int Play( demux_t *p_demux )
 {
     demux_sys_t *p_sys = p_demux->p_sys;
-    int i;
 
     if( p_sys->rtsp )
     {
@@ -1326,7 +1333,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         case DEMUX_SET_RATE:
         {
             double f_scale, f_old_scale;
-            int i;
 
             if( !p_sys->rtsp || (p_sys->i_npt_length <= 0) ||
                 var_GetBool( p_demux, "rtsp-kasenna" ) )
@@ -1371,8 +1377,6 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             p_sys->i_pcr = 0;
             p_sys->i_npt = 0.0;
 
-            es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
-
             *pi_int = (int)( INPUT_RATE_DEFAULT / p_sys->ms->scale() );
             msg_Dbg( p_demux, "PLAY with new Scale %0.2f (%d)", p_sys->ms->scale(), (*pi_int) );
             return VLC_SUCCESS;
@@ -1458,14 +1462,14 @@ static int RollOverTcp( demux_t *p_demux )
     {
         live_track_t *tk = p_sys->track[i];
 
-        if( tk->b_muxed ) stream_DemuxDelete( tk->p_out_muxed );
+        if( tk->b_muxed ) stream_Delete( tk->p_out_muxed );
         if( tk->p_es ) es_out_Del( p_demux->out, tk->p_es );
         es_format_Clean( &tk->fmt );
         free( tk->p_buffer );
         free( tk );
     }
     if( p_sys->i_track ) free( p_sys->track );
-    if( p_sys->p_out_asf ) stream_DemuxDelete( p_sys->p_out_asf );
+    if( p_sys->p_out_asf ) stream_Delete( p_sys->p_out_asf );
 
     p_sys->rtsp->teardownMediaSession( *p_sys->ms );
     Medium::close( p_sys->ms );