[Android] [PATCH] DVD navigation with remote
Jean-Baptiste Kempf
jb at videolan.org
Fri Oct 31 16:17:31 CET 2014
LGTM.
On 31 Oct, Geoffrey Métais wrote :
> ---
> vlc-android/jni/libvlcjni.c | 10 +++++++
> vlc-android/src/org/videolan/libvlc/LibVLC.java | 7 +++++
> .../vlc/gui/video/VideoPlayerActivity.java | 33 ++++++++++++++++++++++
> 3 files changed, 50 insertions(+)
>
> diff --git a/vlc-android/jni/libvlcjni.c b/vlc-android/jni/libvlcjni.c
> index 0813d7c..89f9e74 100644
> --- a/vlc-android/jni/libvlcjni.c
> +++ b/vlc-android/jni/libvlcjni.c
> @@ -621,3 +621,13 @@ jint Java_org_videolan_libvlc_LibVLC_getTitleCount(JNIEnv *env, jobject thiz)
> return libvlc_media_player_get_title_count(mp);
> return -1;
> }
> +
> +void Java_org_videolan_libvlc_LibVLC_playerNavigate(JNIEnv *env, jobject thiz, jint navigate)
> +{
> + unsigned nav = navigate;
> + LOGD("nav to %d", nav);
> + libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
> + if (mp)
> + libvlc_media_player_navigate(mp, (unsigned) nav);
> +}
> +
> diff --git a/vlc-android/src/org/videolan/libvlc/LibVLC.java b/vlc-android/src/org/videolan/libvlc/LibVLC.java
> index 8d5ad0e..790855a 100644
> --- a/vlc-android/src/org/videolan/libvlc/LibVLC.java
> +++ b/vlc-android/src/org/videolan/libvlc/LibVLC.java
> @@ -49,6 +49,12 @@ public class LibVLC {
> public static final int DEV_HW_DECODER_MEDIACODEC = 2;
> public static final int DEV_HW_DECODER_MEDIACODEC_DR = 3;
>
> + public static final int INPUT_NAV_ACTIVATE = 0;
> + public static final int INPUT_NAV_UP = 1;
> + public static final int INPUT_NAV_DOWN = 2;
> + public static final int INPUT_NAV_LEFT = 3;
> + public static final int INPUT_NAV_RIGHT = 4;
> +
> private static final String DEFAULT_CODEC_LIST = "mediacodec,iomx,all";
>
> private static LibVLC sInstance;
> @@ -848,5 +854,6 @@ public class LibVLC {
> public native void setTitle(int title);
> public native int getChapterCountForTitle(int title);
> public native int getTitleCount();
> + public native void playerNavigate(int navigate);
>
> }
> diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
> index d80b92d..a27cfe1 100644
> --- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
> +++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
> @@ -788,11 +788,44 @@ public class VideoPlayerActivity extends Activity implements IVideoPlayer {
> case KeyEvent.KEYCODE_MEDIA_STOP:
> finish();
> return true;
> + case KeyEvent.KEYCODE_DPAD_UP:
> + case KeyEvent.KEYCODE_DPAD_DOWN:
> + case KeyEvent.KEYCODE_DPAD_LEFT:
> + case KeyEvent.KEYCODE_DPAD_RIGHT:
> + case KeyEvent.KEYCODE_DPAD_CENTER:
> + case KeyEvent.KEYCODE_ENTER:
> + if (mIsNavMenu)
> + return navigateDvdMenu(keyCode);
> + else
> + return super.onKeyDown(keyCode, event);
> default:
> return super.onKeyDown(keyCode, event);
> }
> }
>
> + private boolean navigateDvdMenu(int keyCode) {
> + switch (keyCode) {
> + case KeyEvent.KEYCODE_DPAD_UP:
> + mLibVLC.playerNavigate(LibVLC.INPUT_NAV_UP);
> + return true;
> + case KeyEvent.KEYCODE_DPAD_DOWN:
> + mLibVLC.playerNavigate(LibVLC.INPUT_NAV_DOWN);
> + return true;
> + case KeyEvent.KEYCODE_DPAD_LEFT:
> + mLibVLC.playerNavigate(LibVLC.INPUT_NAV_LEFT);
> + return true;
> + case KeyEvent.KEYCODE_DPAD_RIGHT:
> + mLibVLC.playerNavigate(LibVLC.INPUT_NAV_RIGHT);
> + return true;
> + case KeyEvent.KEYCODE_DPAD_CENTER:
> + case KeyEvent.KEYCODE_ENTER:
> + mLibVLC.playerNavigate(LibVLC.INPUT_NAV_ACTIVATE);
> + return true;
> + default:
> + return false;
> + }
> + }
> +
> @Override
> public void onConfigurationChanged(Configuration newConfig) {
> setSurfaceSize(mVideoWidth, mVideoHeight, mVideoVisibleWidth, mVideoVisibleHeight, mSarNum, mSarDen);
> --
> 1.9.1
>
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android
--
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the Android
mailing list