Exemplo n.º 1
0
/* internal function, used by audio, video */
libvlc_track_description_t *
libvlc_get_track_description( libvlc_media_player_t *p_mi,
                              const char *psz_variable )
{
    input_thread_t *p_input = libvlc_get_input_thread( p_mi );
    libvlc_track_description_t *p_track_description = NULL,
                                *p_actual, *p_previous;

    if( !p_input )
        return NULL;

    vlc_value_t val_list, text_list;
    var_Change( p_input, psz_variable, VLC_VAR_GETLIST, &val_list, &text_list);

    /* no tracks */
    if( val_list.p_list->i_count <= 0 )
        goto end;

    p_track_description = ( libvlc_track_description_t * )
                          malloc( sizeof( libvlc_track_description_t ) );
    if ( !p_track_description )
    {
        libvlc_printerr( "Not enough memory" );
        goto end;
    }
    p_actual = p_track_description;
    p_previous = NULL;
    for( int i = 0; i < val_list.p_list->i_count; i++ )
    {
        if( !p_actual )
        {
            p_actual = ( libvlc_track_description_t * )
                       malloc( sizeof( libvlc_track_description_t ) );
            if ( !p_actual )
            {
                libvlc_track_description_release( p_track_description );
                libvlc_printerr( "Not enough memory" );
                goto end;
            }
        }
        p_actual->i_id = val_list.p_list->p_values[i].i_int;
        p_actual->psz_name = strdup( text_list.p_list->p_values[i].psz_string );
        p_actual->p_next = NULL;
        if( p_previous )
            p_previous->p_next = p_actual;
        p_previous = p_actual;
        p_actual =  NULL;
    }

end:
    var_FreeList( &val_list, &text_list );
    vlc_object_release( p_input );

    return p_track_description;
}
Exemplo n.º 2
0
void VLCMediaController::refreshSubtitles()
{
    current_subtitle = Phonon::SubtitleDescription();
    available_subtitles.clear();

    libvlc_track_description_t *p_info = libvlc_video_get_spu_description(
        p_vlc_media_player, p_vlc_exception );
    checkException();
    while(p_info)
    {
        subtitleAdded( p_info->i_id, p_info->psz_name, "" );
        p_info = p_info->p_next;
    }
    libvlc_track_description_release( p_info );
}
Exemplo n.º 3
0
void VLCMediaController::refreshAudioChannels()
{
    current_audio_channel = Phonon::AudioChannelDescription();
    available_audio_channels.clear();

	libvlc_track_description_t * p_info = libvlc_audio_get_track_description(
	        p_vlc_media_player, p_vlc_exception );
    checkException();
    while( p_info )
    {
        audioChannelAdded( p_info->i_id, p_info->psz_name );
        p_info = p_info->p_next;
    }
    libvlc_track_description_release( p_info );
}
Exemplo n.º 4
0
/* when title is changed, we need to rebuild available chapters */
void VLCMediaController::refreshChapters( int i_title )
{
    //current_chapter = Phonon::ChapterDescription();
    //available_chapters.clear();
    current_chapter = 0;
    available_chapters = 0;

    // give info about chapters for actual title
    libvlc_track_description_t *p_info = libvlc_video_get_chapter_description(
        p_vlc_media_player, i_title, p_vlc_exception );
    checkException();
    while( p_info )
    {
        chapterAdded( p_info->i_id, p_info->psz_name );
        p_info = p_info->p_next;
    }
    libvlc_track_description_release( p_info );
}