示例#1
0
文件: alsa.c 项目: FLYKingdom/vlc
/*****************************************************************************
 * ALSAThread: asynchronous thread used to DMA the data to the device
 *****************************************************************************/
static void* ALSAThread( vlc_object_t* p_this )
{
    aout_instance_t * p_aout = (aout_instance_t*)p_this;
    struct aout_sys_t * p_sys = p_aout->output.p_sys;
    int canc = vlc_savecancel ();
    p_sys->p_status = (snd_pcm_status_t *)malloc(snd_pcm_status_sizeof());

    /* Wait for the exact time to start playing (avoids resampling) */
    vlc_mutex_lock( &p_sys->lock );
    while( !p_sys->start_date && vlc_object_alive (p_aout) )
        vlc_cond_wait( &p_sys->wait, &p_sys->lock );
    vlc_mutex_unlock( &p_sys->lock );

    if( !vlc_object_alive (p_aout) )
        goto cleanup;

    mwait( p_sys->start_date - AOUT_PTS_TOLERANCE / 4 );

    while ( vlc_object_alive (p_aout) )
    {
        ALSAFill( p_aout );
    }

cleanup:
    snd_pcm_drop( p_sys->p_snd_pcm );
    free( p_aout->output.p_sys->p_status );
    vlc_restorecancel (canc);
    return NULL;
}
示例#2
0
文件: alsa.c 项目: shanewfx/vlc-arib
/*****************************************************************************
 * ALSAThread: asynchronous thread used to DMA the data to the device
 *****************************************************************************/
static void* ALSAThread( void *data )
{
    aout_instance_t * p_aout = data;
    struct aout_sys_t * p_sys = p_aout->output.p_sys;

    /* Wait for the exact time to start playing (avoids resampling) */
    vlc_sem_wait( &p_sys->wait );
    mwait( p_sys->start_date - AOUT_PTS_TOLERANCE / 4 );

    vlc_cleanup_push( pcm_drop, p_sys->p_snd_pcm );
    for(;;)
        ALSAFill( p_aout );

    assert(0);
    vlc_cleanup_pop();
}