Ejemplo n.º 1
0
void player::get_media_sub_items( const vlc::media& media, playlist_t* out )
{
    assert( out );

    if( !media || !out )
        return;

    libvlc_media_list_t* sub_items = libvlc_media_subitems( media.libvlc_media_t() );
    if( !sub_items )
        return;

    libvlc_media_list_lock( sub_items );

    int sub_items_count =
        std::min<unsigned>( libvlc_media_list_count( sub_items ), PLAYLIST_MAX_SIZE );

    for( int i = 0; i < sub_items_count; ++i ) {
        libvlc_media_t* sub_item = libvlc_media_list_item_at_index( sub_items, i );
        if( sub_item ) {
            playlist_item item = { vlc::media( sub_item, false ), false, std::string() };
            out->push_back( item );
        }
    }

    libvlc_media_list_unlock( sub_items );

    libvlc_media_list_release( sub_items );
}
void basic_player::set_media( const vlc::media& media )
{
    if( is_open() )
        return libvlc_media_player_set_media( _mp, media.libvlc_media_t() );
}