[vlc-commits] live555 : enable/disable tracks on the fly
Sébastien Escudier
git at videolan.org
Mon Dec 5 16:32:56 CET 2011
vlc | branch: master | Sébastien Escudier <sebastien-devel at celeos.eu> | Thu Dec 1 09:37:12 2011 +0100| [af107361d0ec376cf764a6111c9ba5ce433e15f1] | committer: Sébastien Escudier
live555 : enable/disable tracks on the fly
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af107361d0ec376cf764a6111c9ba5ce433e15f1
---
modules/demux/live555.cpp | 47 +++++++++++++++++++++++++++++++++++++++++---
1 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index df55529..b30d066 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -165,6 +165,8 @@ typedef struct
int64_t i_pts;
float i_npt;
+ bool b_selected;
+
} live_track_t;
struct timeout_thread_t
@@ -813,6 +815,7 @@ static int SessionsSetup( demux_t *p_demux )
tk->b_rtcp_sync = false;
tk->i_pts = VLC_TS_INVALID;
tk->i_npt = 0.;
+ tk->b_selected = true;
tk->i_buffer = 65536;
tk->p_buffer = (uint8_t *)malloc( 65536 );
if( !tk->p_buffer )
@@ -1184,6 +1187,44 @@ static int Demux( demux_t *p_demux )
{
live_track_t *tk = p_sys->track[i];
+ if( tk->p_es )
+ {
+ bool b;
+ es_out_Control( p_demux->out, ES_OUT_GET_ES_STATE, tk->p_es, &b );
+ if( !b && tk->b_selected )
+ {
+ tk->b_selected = false;
+ p_sys->rtsp->sendTeardownCommand( *tk->sub, NULL );
+ }
+ else if( b && !tk->b_selected)
+ {
+ bool b_rtsp_tcp = var_GetBool( p_demux, "rtsp-tcp" ) ||
+ var_GetBool( p_demux, "rtsp-http" );
+ p_sys->rtsp->sendSetupCommand( *tk->sub, default_live555_callback, False,
+ toBool( b_rtsp_tcp ),
+ toBool( p_sys->b_force_mcast && !b_rtsp_tcp ) );
+ if( !wait_Live555_response( p_demux ) )
+ {
+ msg_Err( p_demux, "SETUP of'%s/%s' failed %s",
+ tk->sub->mediumName(), tk->sub->codecName(),
+ p_sys->env->getResultMsg() );
+ }
+ else
+ {
+ p_sys->rtsp->sendPlayCommand( *tk->sub, default_live555_callback, -1, -1, p_sys->ms->scale() );
+ if( !wait_Live555_response(p_demux) )
+ {
+ msg_Err( p_demux, "RTSP PLAY failed %s", p_sys->env->getResultMsg() );
+ p_sys->rtsp->sendTeardownCommand( *tk->sub, NULL );
+ }
+ else
+ tk->b_selected = true;
+ }
+ if( !tk->b_selected )
+ es_out_Control( p_demux->out, ES_OUT_SET_ES_STATE, tk->p_es, false );
+ }
+ }
+
if( tk->b_asf || tk->b_muxed )
b_send_pcr = false;
#if 0
@@ -1919,12 +1960,10 @@ static void StreamClose( void *p_private )
live_track_t *tk = (live_track_t*)p_private;
demux_t *p_demux = tk->p_demux;
demux_sys_t *p_sys = p_demux->p_sys;
-
- msg_Dbg( p_demux, "StreamClose" );
-
+ tk->b_selected = false;
+ msg_Dbg( p_demux, "RTSP track Close" );
p_sys->event_rtsp = 0xff;
p_sys->event_data = 0xff;
- p_sys->b_error = true;
}
More information about the vlc-commits
mailing list