Esempio n. 1
0
playlist_item_t *playlist_LockItemGetByPos( playlist_t *p_playlist, int i_pos )
{
    playlist_item_t *p_ret;
    vlc_mutex_lock( &p_playlist->object_lock );
    p_ret = playlist_ItemGetByPos( p_playlist, i_pos );
    vlc_mutex_unlock( &p_playlist->object_lock );
    return p_ret;
}
Esempio n. 2
0
/**
 * Set the duration of a playlist item
 * This function must be entered with the playlist lock
 * Legacy function due to disappear (locks the whole playlist)
 *
 * \param p_playlist the playlist
 * \param i_pos the position of the item of which we change the duration
 * \param i_duration the duration to set
 * \return VLC_SUCCESS on success, VLC_EGENERIC on failure
 */
int playlist_SetDuration( playlist_t *p_playlist, int i_pos, mtime_t i_duration )
{
    vlc_value_t val;
    playlist_item_t *p_item;
    if( !p_playlist )
    {
        return VLC_ENOOBJ;
    }

    p_item = playlist_ItemGetByPos( p_playlist , i_pos );
    if( !p_item )
    {
        return VLC_ENOOBJ;
    }

    vlc_mutex_lock( &p_item->input.lock );
    playlist_ItemSetDuration( p_item , i_duration );
    vlc_mutex_unlock( &p_item->input.lock );

    val.b_bool = (i_pos >= 0 && i_pos < p_playlist->i_size ) ? i_pos : -1;
    var_Set( p_playlist, "item-change", val );

    return VLC_SUCCESS;
}