Example #1
0
/**
 * 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;
}
Example #2
0
/**
 * 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;
}