本文整理汇总了C++中VLCJniObject_getInstance函数的典型用法代码示例。如果您正苦于以下问题:C++ VLCJniObject_getInstance函数的具体用法?C++ VLCJniObject_getInstance怎么用?C++ VLCJniObject_getInstance使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VLCJniObject_getInstance函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Java_org_videolan_libvlc_MediaPlayer_nativePlayMRL
/* TODO: NOT IN VLC API */
void
Java_org_videolan_libvlc_MediaPlayer_nativePlayMRL(JNIEnv *env, jobject thiz,
jstring mrl,
jobjectArray mediaOptions)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return;
/* New Media */
const char* p_mrl = (*env)->GetStringUTFChars(env, mrl, 0);
libvlc_media_t* p_md = libvlc_media_new_location(p_obj->p_libvlc, p_mrl);
/* media options */
if (mediaOptions != NULL)
add_media_options(p_md, env, mediaOptions);
(*env)->ReleaseStringUTFChars(env, mrl, p_mrl);
/* Connect the media event manager. */
/* TODO use VlcObject events */
libvlc_event_manager_t *ev_media = libvlc_media_event_manager(p_md);
static const libvlc_event_type_t mp_media_events[] = {
libvlc_MediaParsedChanged,
libvlc_MediaMetaChanged,
};
for(int i = 0; i < (sizeof(mp_media_events) / sizeof(*mp_media_events)); i++)
libvlc_event_attach(ev_media, mp_media_events[i], vlc_event_callback, NULL);
libvlc_media_player_set_media(p_obj->u.p_mp, p_md);
libvlc_media_release(p_md);
libvlc_media_player_play(p_obj->u.p_mp);
}
示例2: Java_org_videolan_libvlc_MediaPlayer_nativeGetTitles
jobject
Java_org_videolan_libvlc_MediaPlayer_nativeGetTitles(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
libvlc_title_description_t **pp_titles = NULL;
int i_nb_titles;
jobjectArray array;
if (!p_obj)
return NULL;
i_nb_titles = libvlc_media_player_get_full_title_descriptions(p_obj->u.p_mp,
&pp_titles);
if (i_nb_titles <= 0)
return NULL;
array = (*env)->NewObjectArray(env, i_nb_titles,
fields.MediaPlayer.Title.clazz, NULL);
if (!array)
goto error;
for (int i = 0; i < i_nb_titles; ++i)
{
jobject jtitle = mediaplayer_title_to_object(env, pp_titles[i]);
if (jtitle)
(*env)->SetObjectArrayElement(env, array, i, jtitle);
}
error:
if (pp_titles)
libvlc_title_descriptions_release(pp_titles, i_nb_titles);
return array;
}
示例3: Java_org_videolan_libvlc_MediaPlayer_stop
void
Java_org_videolan_libvlc_MediaPlayer_stop(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return;
/* TODO: REMOVE */
libvlc_media_t* p_md = libvlc_media_player_get_media(p_obj->u.p_mp);
if (p_md)
{
libvlc_event_manager_t *ev_media = libvlc_media_event_manager(p_md);
static const libvlc_event_type_t mp_media_events[] = {
libvlc_MediaParsedChanged,
libvlc_MediaMetaChanged,
};
for(int i = 0; i < (sizeof(mp_media_events) / sizeof(*mp_media_events)); i++)
libvlc_event_detach(ev_media, mp_media_events[i], vlc_event_callback, NULL);
libvlc_media_release(p_md);
libvlc_media_player_set_media(p_obj->u.p_mp, NULL);
}
libvlc_media_player_stop(p_obj->u.p_mp);
}
示例4: Java_org_videolan_libvlc_MediaPlayer_nativeRelease
void
Java_org_videolan_libvlc_MediaPlayer_nativeRelease(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return;
/* TODO: REMOVE */
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_detach(ev, mp_events[i], vlc_event_callback, NULL);
libvlc_media_player_release(p_obj->u.p_mp);
VLCJniObject_release(env, thiz, p_obj);
}
示例5: VLCJniObject_newFromLibVlc
vlcjni_object *
VLCJniObject_newFromLibVlc(JNIEnv *env, jobject thiz,
libvlc_instance_t *p_libvlc,
const char **pp_error)
{
vlcjni_object *p_obj;
libvlc_event_manager_t *ev;
p_obj = VLCJniObject_getInstance(env, thiz);
if (p_obj)
{
*pp_error = "VLCObject.mInstanceID already exists";
return NULL;
}
p_obj = calloc(1, sizeof(vlcjni_object));
if (!p_obj)
{
*pp_error = "vlcjni_object calloc failed";
goto error;
}
p_obj->p_owner = calloc(1, sizeof(vlcjni_object_owner));
if (!p_obj->p_owner)
{
*pp_error = "vlcjni_object_owner calloc failed";
goto error;
}
p_obj->p_libvlc = p_libvlc;
libvlc_retain(p_libvlc);
if (fields.VLCObject.getWeakReferenceID)
{
jobject weakCompat = (*env)->CallObjectMethod(env, thiz,
fields.VLCObject.getWeakReferenceID);
if (weakCompat)
{
p_obj->p_owner->weakCompat = (*env)->NewGlobalRef(env, weakCompat);
(*env)->DeleteLocalRef(env, weakCompat);
}
} else
p_obj->p_owner->weak = (*env)->NewWeakGlobalRef(env, thiz);
if (!p_obj->p_owner->weak && !p_obj->p_owner->weakCompat)
{
*pp_error = "No VLCObject weak reference";
goto error;
}
VLCJniObject_setInstance(env, thiz, p_obj);
*pp_error = NULL;
return p_obj;
error:
VLCJniObject_release(env, thiz, p_obj);
return NULL;
}
示例6: Java_org_videolan_libvlc_MediaDiscoverer_nativeStop
void
Java_org_videolan_libvlc_MediaDiscoverer_nativeStop(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return;
libvlc_media_discoverer_stop(p_obj->u.p_md);
}
示例7: Java_org_videolan_libvlc_MediaPlayer_isSeekable
jboolean
Java_org_videolan_libvlc_MediaPlayer_isSeekable(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return false;
return !!libvlc_media_player_is_seekable(p_obj->u.p_mp);
}
示例8: Java_org_videolan_libvlc_MediaPlayer_getLength
jlong
Java_org_videolan_libvlc_MediaPlayer_getLength(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return -1;
return (jlong) libvlc_media_player_get_length(p_obj->u.p_mp);
}
示例9: Java_org_videolan_libvlc_MediaPlayer_getRate
jfloat
Java_org_videolan_libvlc_MediaPlayer_getRate(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return 0.0f;
return libvlc_media_player_get_rate(p_obj->u.p_mp);
}
示例10: Java_org_videolan_libvlc_MediaPlayer_getPosition
jfloat
Java_org_videolan_libvlc_MediaPlayer_getPosition(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return -1;
return (jfloat) libvlc_media_player_get_position(p_obj->u.p_mp);
}
示例11: Java_org_videolan_libvlc_MediaPlayer_getTitleCount
jint
Java_org_videolan_libvlc_MediaPlayer_getTitleCount(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return -1;
return libvlc_media_player_get_title_count(p_obj->u.p_mp);
}
示例12: Java_org_videolan_libvlc_MediaPlayer_nextChapter
void
Java_org_videolan_libvlc_MediaPlayer_nextChapter(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return;
libvlc_media_player_next_chapter(p_obj->u.p_mp);
}
示例13: Java_org_videolan_libvlc_MediaDiscoverer_nativeStart
jboolean
Java_org_videolan_libvlc_MediaDiscoverer_nativeStart(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return false;
return libvlc_media_discoverer_start(p_obj->u.p_md) == 0 ? true : false;
}
示例14: Java_org_videolan_libvlc_MediaPlayer_getVolume
jint
Java_org_videolan_libvlc_MediaPlayer_getVolume(JNIEnv *env, jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return -1;
return (jint) libvlc_audio_get_volume(p_obj->u.p_mp);
}
示例15: Java_org_videolan_libvlc_MediaPlayer_nativeGetAudioTrack
jint
Java_org_videolan_libvlc_MediaPlayer_nativeGetAudioTrack(JNIEnv *env,
jobject thiz)
{
vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
if (!p_obj)
return -2;
return libvlc_audio_get_track(p_obj->u.p_mp);
}