void Java_org_videolan_libvlc_MediaDiscoverer_nativeNew(JNIEnv *env, jobject thiz, jobject libVlc, jstring jname) { vlcjni_object *p_obj; const char* p_name; if (!jname || !(p_name = (*env)->GetStringUTFChars(env, jname, 0))) { throw_Exception(env, VLCJNI_EX_ILLEGAL_STATE, "jname invalid"); return; } p_obj = VLCJniObject_newFromJavaLibVlc(env, thiz, libVlc); if (!p_obj) { (*env)->ReleaseStringUTFChars(env, jname, p_name); return; } p_obj->u.p_md = libvlc_media_discoverer_new(p_obj->p_libvlc, p_name); (*env)->ReleaseStringUTFChars(env, jname, p_name); if (!p_obj->u.p_md) { VLCJniObject_release(env, thiz, p_obj); throw_Exception(env, VLCJNI_EX_ILLEGAL_STATE, "can't create MediaDiscoverer instance"); return; } }
void Java_org_videolan_libvlc_MediaPlayer_nativeNewFromLibVlc(JNIEnv *env, jobject thiz, jobject libvlc, jobject jwindow) { vlcjni_object *p_obj = VLCJniObject_newFromJavaLibVlc(env, thiz, libvlc); if (!p_obj) return; /* Create a media player playing environment */ p_obj->u.p_mp = libvlc_media_player_new(p_obj->p_libvlc); MediaPlayer_newCommon(env, thiz, p_obj, jwindow); }
void Java_org_videolan_libvlc_MediaPlayer_nativeNewFromLibVlc(JNIEnv *env, jobject thiz, jobject libvlc) { vlcjni_object *p_obj = VLCJniObject_newFromJavaLibVlc(env, thiz, libvlc); if (!p_obj) return; /* Create a media player playing environment */ p_obj->u.p_mp = libvlc_media_player_new(p_obj->p_libvlc); if (!p_obj->u.p_mp) { VLCJniObject_release(env, thiz, p_obj); throw_IllegalStateException(env, "can't create MediaPlayer instance"); return; } libvlc_media_player_set_video_title_display(p_obj->u.p_mp, libvlc_position_disable, 0); /* TODO NOT HERE */ /* Connect the event manager */ libvlc_event_manager_t *ev = libvlc_media_player_event_manager(p_obj->u.p_mp); static const libvlc_event_type_t mp_events[] = { libvlc_MediaPlayerPlaying, libvlc_MediaPlayerPaused, libvlc_MediaPlayerEndReached, libvlc_MediaPlayerStopped, libvlc_MediaPlayerVout, libvlc_MediaPlayerPositionChanged, libvlc_MediaPlayerTimeChanged, libvlc_MediaPlayerEncounteredError, libvlc_MediaPlayerESAdded, libvlc_MediaPlayerESDeleted, }; for(int i = 0; i < (sizeof(mp_events) / sizeof(*mp_events)); i++) libvlc_event_attach(ev, mp_events[i], vlc_event_callback, NULL); }