[vlc-devel] commit: Add osd menu api to lua (DVD menus). (Antoine Cellerier )

git version control git at videolan.org
Mon Dec 14 23:29:56 CET 2009


vlc | branch: master | Antoine Cellerier <antoine at macbook.(none)> | Mon Dec 14 22:07:15 2009 +0100| [b7c1008797b413ded64e654ad960c61b1102fc2e] | committer: Antoine Cellerier 

Add osd menu api to lua (DVD menus).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b7c1008797b413ded64e654ad960c61b1102fc2e
---

 modules/misc/lua/libs/osd.c |   63 +++++++++++++++++++++++++++++++++++++++++++
 share/lua/README.txt        |    7 +++++
 2 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/modules/misc/lua/libs/osd.c b/modules/misc/lua/libs/osd.c
index c723149..e0ee7db 100644
--- a/modules/misc/lua/libs/osd.c
+++ b/modules/misc/lua/libs/osd.c
@@ -154,6 +154,55 @@ static int vlclua_spu_channel_clear( lua_State *L )
     return 0;
 }
 
+static int vlclua_menu_show( lua_State *L )
+{
+    vlc_object_t *p_this = vlclua_get_this( L );
+    osd_MenuShow( p_this );
+    return 0;
+}
+
+static int vlclua_menu_hide( lua_State *L )
+{
+    vlc_object_t *p_this = vlclua_get_this( L );
+    osd_MenuHide( p_this );
+    return 0;
+}
+
+static int vlclua_menu_prev( lua_State *L )
+{
+    vlc_object_t *p_this = vlclua_get_this( L );
+    osd_MenuPrev( p_this );
+    return 0;
+}
+
+static int vlclua_menu_next( lua_State *L )
+{
+    vlc_object_t *p_this = vlclua_get_this( L );
+    osd_MenuNext( p_this );
+    return 0;
+}
+
+static int vlclua_menu_up( lua_State *L )
+{
+    vlc_object_t *p_this = vlclua_get_this( L );
+    osd_MenuUp( p_this );
+    return 0;
+}
+
+static int vlclua_menu_down( lua_State *L )
+{
+    vlc_object_t *p_this = vlclua_get_this( L );
+    osd_MenuDown( p_this );
+    return 0;
+}
+
+static int vlclua_menu_activate( lua_State *L )
+{
+    vlc_object_t *p_this = vlclua_get_this( L );
+    osd_MenuActivate( p_this );
+    return 0;
+}
+
 /*****************************************************************************
  *
  *****************************************************************************/
@@ -166,9 +215,23 @@ static const luaL_Reg vlclua_osd_reg[] = {
     { NULL, NULL }
 };
 
+static const luaL_Reg vlclua_menu_reg[] = {
+    { "show", vlclua_menu_show },
+    { "hide", vlclua_menu_hide },
+    { "prev", vlclua_menu_prev },
+    { "next", vlclua_menu_next },
+    { "up", vlclua_menu_up },
+    { "down", vlclua_menu_down },
+    { "activate", vlclua_menu_activate },
+    { NULL, NULL }
+};
+
 void luaopen_osd( lua_State *L )
 {
     lua_newtable( L );
     luaL_register( L, NULL, vlclua_osd_reg );
+    lua_newtable( L );
+    luaL_register( L, NULL, vlclua_menu_reg );
+    lua_setfield( L, -2, "menu" );
     lua_setfield( L, -2, "osd" );
 }
diff --git a/share/lua/README.txt b/share/lua/README.txt
index 7d6f3fb..b0c0138 100644
--- a/share/lua/README.txt
+++ b/share/lua/README.txt
@@ -175,6 +175,13 @@ osd.slider( position, type, [id] ): Display slider. Position is an integer
   from 0 to 100. Type can be "horizontal" or "vertical".
 osd.channel_register(): Register a new OSD channel. Returns the channel id.
 osd.channel_clear( id ): Clear OSD channel.
+osd.menu.show(): Show the OSD menu.
+osd.menu.hide(): Hide the OSD menu.
+osd.menu.prev(): Select previous/left item.
+osd.menu.next(): Select next/right item.
+osd.menu.up(): Move selection up.
+osd.menu.down(): Move selection down.
+osd.menu.activate(): Activate/validate current selection.
 
 Playlist
 --------




More information about the vlc-devel mailing list