+ 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 );
+ }
+ }
+