/** * Run the main control thread itself */ static void *Thread ( void *data ) { playlist_t *p_playlist = data; playlist_private_t *p_sys = pl_priv(p_playlist); PL_LOCK; for( ;; ) { while( p_sys->p_input != NULL ) LoopInput( p_playlist ); if( p_sys->killed ) break; /* THE END */ const int status = p_sys->request.b_request ? p_sys->request.i_status : p_sys->status.i_status; /* Destroy any video display if the playlist is supposed to stop */ if( status == PLAYLIST_STOPPED && input_resource_HasVout( p_sys->p_input_resource ) ) { PL_UNLOCK; /* Mind: NO LOCKS while manipulating input resources! */ input_resource_TerminateVout( p_sys->p_input_resource ); PL_LOCK; continue; /* lost lock = lost state */ } LoopRequest( p_playlist, status ); } p_sys->status.i_status = PLAYLIST_STOPPED; PL_UNLOCK; input_resource_Terminate( p_sys->p_input_resource ); return NULL; }
/** * Run the main control thread itself */ static void *Thread ( void *data ) { playlist_t *p_playlist = data; playlist_private_t *p_sys = pl_priv(p_playlist); playlist_Lock( p_playlist ); while( vlc_object_alive( p_playlist ) || p_sys->p_input ) { /* FIXME: what's that ! */ if( p_sys->b_reset_currently_playing && mdate() - p_sys->last_rebuild_date > 30000 ) // 30 ms { ResetCurrentlyPlaying( p_playlist, get_current_status_item( p_playlist ) ); p_sys->last_rebuild_date = mdate(); } /* If there is an input, check that it doesn't need to die. */ while( !LoopInput( p_playlist ) ) vlc_cond_wait( &p_sys->signal, &p_sys->lock ); LoopRequest( p_playlist ); } playlist_Unlock( p_playlist ); return NULL; }
/** * Run the main control thread itself */ static void *Thread ( void *data ) { playlist_t *p_playlist = data; playlist_private_t *p_sys = pl_priv(p_playlist); PL_LOCK; while( !p_sys->killed ) { /* Playlist in stopped state */ assert(p_sys->p_input == NULL); if( !p_sys->request.b_request ) { vlc_cond_wait( &p_sys->signal, &p_sys->lock ); continue; } while( !p_sys->killed && Next( p_playlist ) ) { /* Playlist in running state */ assert(p_sys->p_input != NULL); do LoopInput( p_playlist ); while( p_sys->p_input != NULL ); } msg_Dbg( p_playlist, "nothing to play" ); if( var_InheritBool( p_playlist, "play-and-exit" ) ) { msg_Info( p_playlist, "end of playlist, exiting" ); libvlc_Quit( p_playlist->p_libvlc ); } /* Destroy any video display now (XXX: ugly hack) */ if( input_resource_HasVout( p_sys->p_input_resource ) ) { PL_UNLOCK; /* Mind: NO LOCKS while manipulating input resources! */ input_resource_TerminateVout( p_sys->p_input_resource ); PL_LOCK; } } PL_UNLOCK; input_resource_Terminate( p_sys->p_input_resource ); return NULL; }