[vlc-devel] [PATCH 1/2] Extend libvlc Media Player API for DVD menu navigation
Arnaud Vallat
rno.rno at gmail.com
Tue Sep 7 14:41:36 CEST 2010
---
include/vlc/libvlc_media_player.h | 36 ++++++++++++++++++++++++++++++++++++
src/control/media_player.c | 37 +++++++++++++++++++++++++++++++++++++
src/libvlc.sym | 1 +
3 files changed, 74 insertions(+), 0 deletions(-)
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index d328e51..6960c3a 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -96,6 +96,18 @@ typedef enum libvlc_video_marquee_option_t {
} libvlc_video_marquee_option_t;
/**
+ * Navigation mode
+ */
+typedef enum libvlc_navigation_mode_t
+{
+ libvlc_navigate_up = 0,
+ libvlc_navigate_down,
+ libvlc_navigate_right,
+ libvlc_navigate_left,
+ libvlc_navigate_activate
+} libvlc_navigate_mode_t;
+
+/**
* Create an empty Media Player object
*
* \param p_libvlc_instance the libvlc instance in which the Media Player
@@ -424,6 +436,30 @@ VLC_PUBLIC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi
VLC_PUBLIC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi );
/**
+ * Navigate through DVD menu
+ *
+ * \param p_mi the Media Player
+ * \param
+ */
+VLC_PUBLIC_API void libvlc_media_player_navigate( libvlc_media_player_t *p_mi,
+ libvlc_navigate_mode_t navigate );
+
+#define libvlc_media_player_navigate_up( a ) \
+ libvlc_media_player_navigate( (a), libvlc_navigate_up )
+
+#define libvlc_media_player_navigate_down( a ) \
+ libvlc_media_player_navigate( (a), libvlc_navigate_down )
+
+#define libvlc_media_player_navigate_left( a ) \
+ libvlc_media_player_navigate( (a), libvlc_navigate_left )
+
+#define libvlc_media_player_navigate_right( a ) \
+ libvlc_media_player_navigate( (a), libvlc_navigate_right )
+
+#define libvlc_media_player_navigate_activate( a ) \
+ libvlc_media_player_navigate( (a), libvlc_navigate_activate )
+
+/**
* Is the player able to play
*
* \param p_mi the Media Player
diff --git a/src/control/media_player.c b/src/control/media_player.c
index 4b71ec8..ad44dae 100644
--- a/src/control/media_player.c
+++ b/src/control/media_player.c
@@ -34,6 +34,7 @@
#include <vlc_demux.h>
#include <vlc_input.h>
#include <vlc_vout.h>
+#include <vlc_keys.h>
#include "libvlc.h"
@@ -1194,6 +1195,42 @@ int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi )
return b_seekable;
}
+void libvlc_media_player_navigate( libvlc_media_player_t *p_mi,
+ libvlc_navigate_mode_t navigate )
+{
+ input_thread_t *p_input_thread;
+ vlc_key_t i_key = 0;
+
+ p_input_thread = libvlc_get_input_thread ( p_mi );
+ if ( !p_input_thread )
+ return;
+
+ switch (navigate)
+ {
+ case libvlc_navigate_up:
+ i_key = vlc_GetActionId("key-nav-up");
+ break;
+
+ case libvlc_navigate_down:
+ i_key = vlc_GetActionId("key-nav-down");
+ break;
+
+ case libvlc_navigate_left:
+ i_key = vlc_GetActionId("key-nav-left");
+ break;
+
+ case libvlc_navigate_right:
+ i_key = vlc_GetActionId("key-nav-right");
+ break;
+ }
+
+ if ( i_key )
+ var_SetInteger( p_mi->p_libvlc_instance->p_libvlc_int,
+ "key-action", i_key );
+
+ vlc_object_release( p_input_thread );
+}
+
/* internal function, used by audio, video */
libvlc_track_description_t *
libvlc_get_track_description( libvlc_media_player_t *p_mi,
diff --git a/src/libvlc.sym b/src/libvlc.sym
index afaf901..f635a68 100644
--- a/src/libvlc.sym
+++ b/src/libvlc.sym
@@ -149,6 +149,7 @@ libvlc_media_player_set_title
libvlc_media_player_set_xwindow
libvlc_media_player_stop
libvlc_media_player_will_play
+libvlc_media_player_navigate
libvlc_media_release
libvlc_media_retain
libvlc_media_save_meta
--
1.7.0.4
More information about the vlc-devel
mailing list