[MPlayer-cvslog] r27100 - in trunk: DOCS/tech/slave.txt command.c etc/input.conf input/input.c input/input.h

ben subversion at mplayerhq.hu
Thu Jun 19 20:51:43 CEST 2008


Author: ben
Date: Thu Jun 19 20:51:42 2008
New Revision: 27100

Log:
Change DVDNAV command key names.
Parameters now use a string much more intuitive than previous int value.



Modified:
   trunk/DOCS/tech/slave.txt
   trunk/command.c
   trunk/etc/input.conf
   trunk/input/input.c
   trunk/input/input.h

Modified: trunk/DOCS/tech/slave.txt
==============================================================================
--- trunk/DOCS/tech/slave.txt	(original)
+++ trunk/DOCS/tech/slave.txt	Thu Jun 19 20:51:42 2008
@@ -66,14 +66,16 @@ change_rectangle <val1> <val2>
 dvb_set_channel <channel_number> <card_number>
     Set DVB channel.
 
-dvdnav <button>
+dvdnav <button_name>
     Press the given dvdnav button.
-        1 up
-        2 down
-        3 left
-        4 right
-        5 menu
-        6 select
+        up
+        down
+        left
+        right
+        menu
+        select
+        prev
+        mouse
 
 edl_mark
     Write the current position into the EDL file.

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	(original)
+++ trunk/command.c	Thu Jun 19 20:51:42 2008
@@ -2281,6 +2281,22 @@ static int set_property_command(MPContex
     return 1;
 }
 
+#ifdef USE_DVDNAV
+static const struct {
+  const char *name;
+  const mp_command_type cmd;
+} mp_dvdnav_bindings[] = {
+  { "up",       MP_CMD_DVDNAV_UP              },
+  { "down",     MP_CMD_DVDNAV_DOWN            },
+  { "left",     MP_CMD_DVDNAV_LEFT            },
+  { "right",    MP_CMD_DVDNAV_RIGHT           },
+  { "menu",     MP_CMD_DVDNAV_MENU            },
+  { "select",   MP_CMD_DVDNAV_SELECT          },
+  { "prev",     MP_CMD_DVDNAV_PREVMENU        },
+  { "mouse",    MP_CMD_DVDNAV_MOUSECLICK      },
+  { NULL,       0                             }
+};
+#endif
 
 int run_command(MPContext * mpctx, mp_cmd_t * cmd)
 {
@@ -3105,10 +3121,18 @@ int run_command(MPContext * mpctx, mp_cm
 #ifdef USE_DVDNAV
 	case MP_CMD_DVDNAV:{
 		int button = -1;
+		int i;
+		mp_command_type command = 0;
 		if (mpctx->stream->type != STREAMTYPE_DVDNAV)
 		    break;
 
-		mp_dvdnav_handle_input(mpctx->stream,cmd->args[0].v.i,&button);
+		for (i = 0; mp_dvdnav_bindings[i].name; i++)
+		  if (cmd->args[0].v.s &&
+		      !strcasecmp (cmd->args[0].v.s,
+		                   mp_dvdnav_bindings[i].name))
+		    command = mp_dvdnav_bindings[i].cmd;
+
+		mp_dvdnav_handle_input(mpctx->stream,command,&button);
 		if (osd_level > 1 && button > 0)
 		    set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
 				"Selected button number %d", button);

Modified: trunk/etc/input.conf
==============================================================================
--- trunk/etc/input.conf	(original)
+++ trunk/etc/input.conf	Thu Jun 19 20:51:42 2008
@@ -149,20 +149,20 @@ AR_VDOWN volume -1
 ## Requires dvdnav://
 ##
 
-UP    {dvdnav} dvdnav 1    # DVDNav UP
-DOWN  {dvdnav} dvdnav 2    # DVDNav DOWN
-LEFT  {dvdnav} dvdnav 3    # DVDNav LEFT
-RIGHT {dvdnav} dvdnav 4    # DVDNav RIGHT
-ESC   {dvdnav} dvdnav 5    # DVDNav MENU
-ENTER {dvdnav} dvdnav 6    # DVDNav SELECT (ok)
-BS    {dvdnav} dvdnav 7    # DVDNav PREVIOUS menu (in the order chapter->title->root)
+UP    {dvdnav} dvdnav up          # DVDNav UP
+DOWN  {dvdnav} dvdnav down        # DVDNav DOWN
+LEFT  {dvdnav} dvdnav left        # DVDNav LEFT
+RIGHT {dvdnav} dvdnav right       # DVDNav RIGHT
+ESC   {dvdnav} dvdnav menu        # DVDNav MENU
+ENTER {dvdnav} dvdnav select      # DVDNav SELECT (ok)
+BS    {dvdnav} dvdnav prev        # DVDNav PREVIOUS menu (in the order chapter->title->root)
 
-AR_VUP    {dvdnav} dvdnav 1    # DVDNav UP
-AR_VDOWN  {dvdnav} dvdnav 2    # DVDNav DOWN
-AR_PREV   {dvdnav} dvdnav 3    # DVDNav LEFT
-AR_NEXT   {dvdnav} dvdnav 4    # DVDNav RIGHT
-AR_MENU   {dvdnav} dvdnav 5    # DVDNav MENU
-AR_PLAY   {dvdnav} dvdnav 6    # DVDNav SELECT (ok)
+AR_VUP    {dvdnav} dvdnav up      # DVDNav UP
+AR_VDOWN  {dvdnav} dvdnav down    # DVDNav DOWN
+AR_PREV   {dvdnav} dvdnav left    # DVDNav LEFT
+AR_NEXT   {dvdnav} dvdnav right   # DVDNav RIGHT
+AR_MENU   {dvdnav} dvdnav menu    # DVDNav MENU
+AR_PLAY   {dvdnav} dvdnav select  # DVDNav SELECT (ok)
 
 #? seek_chapter -1      # skip to previous dvd chapter
 #? seek_chapter +1      #         next

Modified: trunk/input/input.c
==============================================================================
--- trunk/input/input.c	(original)
+++ trunk/input/input.c	Thu Jun 19 20:51:42 2008
@@ -171,7 +171,7 @@ static const mp_cmd_t mp_cmds[] = {
 #endif
 
 #ifdef USE_DVDNAV
-  { MP_CMD_DVDNAV, "dvdnav", 1, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+  { MP_CMD_DVDNAV, "dvdnav", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
 #endif
 
 #ifdef HAVE_MENU
@@ -347,14 +347,14 @@ static const mp_cmd_bind_t def_cmd_binds
   { {  MOUSE_BTN6, 0 }, "volume -1" },
   
 #ifdef USE_DVDNAV
-  { { KEY_KP8, 0 }, "dvdnav 1" },   // up
-  { { KEY_KP2, 0 }, "dvdnav 2" },   // down
-  { { KEY_KP4, 0 }, "dvdnav 3" },   // left
-  { { KEY_KP6, 0 }, "dvdnav 4" },   // right
-  { { KEY_KP5, 0 }, "dvdnav 5" },   // menu
-  { { KEY_KPENTER, 0 }, "dvdnav 6" },   // select
-  { { MOUSE_BTN0, 0 }, "dvdnav 8" },   //select
-  { { KEY_KP7, 0 }, "dvdnav 7" },   // previous menu
+  { { KEY_KP8, 0 }, "dvdnav up" },   // up
+  { { KEY_KP2, 0 }, "dvdnav down" },   // down
+  { { KEY_KP4, 0 }, "dvdnav left" },   // left
+  { { KEY_KP6, 0 }, "dvdnav right" },   // right
+  { { KEY_KP5, 0 }, "dvdnav menu" },   // menu
+  { { KEY_KPENTER, 0 }, "dvdnav select" },   // select
+  { { MOUSE_BTN0, 0 }, "dvdnav mouse" },   //select
+  { { KEY_KP7, 0 }, "dvdnav prev" },   // previous menu
 #endif
 
   { { KEY_RIGHT, 0 }, "seek 10" },

Modified: trunk/input/input.h
==============================================================================
--- trunk/input/input.h	(original)
+++ trunk/input/input.h	Thu Jun 19 20:51:42 2008
@@ -112,6 +112,16 @@ typedef enum {
   MP_CMD_SWITCH_TITLE,
   MP_CMD_STOP,
 
+  /// DVDNAV commands
+  MP_CMD_DVDNAV_UP = 1000,
+  MP_CMD_DVDNAV_DOWN,
+  MP_CMD_DVDNAV_LEFT,
+  MP_CMD_DVDNAV_RIGHT,
+  MP_CMD_DVDNAV_MENU,
+  MP_CMD_DVDNAV_SELECT,
+  MP_CMD_DVDNAV_PREVMENU,
+  MP_CMD_DVDNAV_MOUSECLICK,
+  
   /// GUI commands
   MP_CMD_GUI_EVENTS = 5000,
   MP_CMD_GUI_LOADFILE,
@@ -133,15 +143,6 @@ typedef enum {
   MP_CMD_CHIDE,
 } mp_command_type;
 
-#define MP_CMD_DVDNAV_UP        1
-#define MP_CMD_DVDNAV_DOWN      2
-#define MP_CMD_DVDNAV_LEFT      3
-#define MP_CMD_DVDNAV_RIGHT     4
-#define MP_CMD_DVDNAV_MENU      5
-#define MP_CMD_DVDNAV_SELECT    6
-#define MP_CMD_DVDNAV_PREVMENU  7
-#define MP_CMD_DVDNAV_MOUSECLICK  8
-
 // The arg types
 #define MP_CMD_ARG_INT 0
 #define MP_CMD_ARG_FLOAT 1



More information about the MPlayer-cvslog mailing list