Example #1
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 );
}
jstring
Java_org_videolan_libvlc_MediaPlayer_getChapterDescription(JNIEnv *env,
                                                           jobject thiz,
                                                           jint title)
{
    libvlc_track_description_t *description;
    jstring string = NULL;
    vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);

    if (!p_obj)
        return NULL;

    description = libvlc_video_get_chapter_description(p_obj->u.p_mp, title);
    if (description) {
        string = (*env)->NewStringUTF(env, description->psz_name);
        free(description);
    }
    return string;
}