[Android] LibVLC: MediaPlayer: add UpdateViewPoint
Thomas Guillem
git at videolan.org
Mon Nov 28 16:58:09 CET 2016
vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Nov 28 16:57:42 2016 +0100| [062c5bdefb153a5d7c42135a2fe4197749802265] | committer: Thomas Guillem
LibVLC: MediaPlayer: add UpdateViewPoint
> https://code.videolan.org/videolan/vlc-android/commit/062c5bdefb153a5d7c42135a2fe4197749802265
---
libvlc/jni/libvlcjni-mediaplayer.c | 30 +++++++++++++++++++++++++
libvlc/src/org/videolan/libvlc/MediaPlayer.java | 16 +++++++++++++
2 files changed, 46 insertions(+)
diff --git a/libvlc/jni/libvlcjni-mediaplayer.c b/libvlc/jni/libvlcjni-mediaplayer.c
index e36d26b..b8e50b7 100644
--- a/libvlc/jni/libvlcjni-mediaplayer.c
+++ b/libvlc/jni/libvlcjni-mediaplayer.c
@@ -49,6 +49,7 @@ static const libvlc_event_type_t mp_events[] = {
struct vlcjni_object_sys
{
jobject jwindow;
+ libvlc_video_viewpoint_t *p_vp;
};
static libvlc_equalizer_t *
@@ -177,6 +178,7 @@ Java_org_videolan_libvlc_MediaPlayer_nativeRelease(JNIEnv *env, jobject thiz)
if (p_obj->p_sys && p_obj->p_sys->jwindow)
(*env)->DeleteGlobalRef(env, p_obj->p_sys->jwindow);
+ free(p_obj->p_sys->p_vp);
free(p_obj->p_sys);
VLCJniObject_release(env, thiz, p_obj);
@@ -946,6 +948,34 @@ Java_org_videolan_libvlc_MediaPlayer_nativeSetAspectRatio(JNIEnv *env,
}
jboolean
+Java_org_videolan_libvlc_MediaPlayer_nativeUpdateViewPoint(JNIEnv *env,
+ jobject thiz,
+ jfloat yaw,
+ jfloat pitch,
+ jfloat roll,
+ jfloat fov,
+ jboolean absolute)
+{
+ vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);
+ if (!p_obj)
+ return false;
+
+ if (p_obj->p_sys->p_vp == NULL)
+ {
+ p_obj->p_sys->p_vp = libvlc_video_new_viewpoint();
+ if (p_obj->p_sys->p_vp == NULL)
+ return false;
+ }
+ p_obj->p_sys->p_vp->f_yaw = yaw;
+ p_obj->p_sys->p_vp->f_pitch = pitch;
+ p_obj->p_sys->p_vp->f_roll = roll;
+ p_obj->p_sys->p_vp->f_field_of_view = fov;
+
+ return libvlc_video_update_viewpoint(p_obj->u.p_mp, p_obj->p_sys->p_vp,
+ absolute) == 0 ? true : false;
+}
+
+jboolean
Java_org_videolan_libvlc_MediaPlayer_nativeAddSlave(JNIEnv *env,
jobject thiz, jint type,
jstring jmrl, jboolean select)
diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
index d3bde71..22e5bad 100644
--- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java
+++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java
@@ -517,6 +517,21 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
}
/**
+ * Update the video viewpoint information
+ *
+ * @param yaw View point yaw in degrees
+ * @param pitch View point pitch in degrees
+ * @param roll View point roll in degrees
+ * @param fov Field of view in degrees (default 80.0f)
+ * @param absolute if true replace the old viewpoint with the new one. If false,
+ * increase/decrease it.
+ * @return true on success.
+ */
+ public boolean updateViewpoint(float yaw, float pitch, float roll, float fov, boolean absolute) {
+ return nativeUpdateViewpoint(yaw, pitch, roll, fov, absolute);
+ }
+
+ /**
* Selects an audio output module.
* Any change will take effect only after playback is stopped and
* restarted. Audio output cannot be changed while playing.
@@ -934,6 +949,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> {
private native void nativeSetScale(float scale);
private native String nativeGetAspectRatio();
private native void nativeSetAspectRatio(String aspect);
+ private native boolean nativeUpdateViewpoint(float yaw, float pitch, float roll, float fov, boolean absolute);
private native boolean nativeSetAudioOutput(String aout);
private native boolean nativeSetAudioOutputDevice(String id);
private native Title[] nativeGetTitles();
More information about the Android
mailing list