[MPlayer-cvslog] r34427 - in trunk: Changelog DOCS/tech/slave.txt command.c gui/app.c gui/app.h gui/interface.c gui/interface.h gui/win32/interface.c input/input.c input/input.h mplayer.c
ib
subversion at mplayerhq.hu
Sun Dec 11 15:43:17 CET 2011
Author: ib
Date: Sun Dec 11 15:43:16 2011
New Revision: 34427
Log:
Enable gui slave commands.
Allow sending the GUI skin messages which enables operating the GUI
with a remote control.
Only messages defined in current skin window will be executed, i.e.
only messages that could result from mouse clicks as well.
Modified:
trunk/Changelog
trunk/DOCS/tech/slave.txt
trunk/command.c
trunk/gui/app.c
trunk/gui/app.h
trunk/gui/interface.c
trunk/gui/interface.h
trunk/gui/win32/interface.c
trunk/input/input.c
trunk/input/input.h
trunk/mplayer.c
Modified: trunk/Changelog
==============================================================================
--- trunk/Changelog Sat Dec 10 21:55:31 2011 (r34426)
+++ trunk/Changelog Sun Dec 11 15:43:16 2011 (r34427)
@@ -20,6 +20,9 @@ MPlayer (1.0)
* experimental af_cmdline slave command to change e.g. audio equalizer options at runtime.
* vo x11: don't hide or show cursor any more if attached to an existing window (-wid)
+ GUI:
+ * all skin messages available as slave commands (gui <message>)
+
Ports:
* Wine (see DOCS/tech/crosscompile.txt)
Modified: trunk/DOCS/tech/slave.txt
==============================================================================
--- trunk/DOCS/tech/slave.txt Sat Dec 10 21:55:31 2011 (r34426)
+++ trunk/DOCS/tech/slave.txt Sun Dec 11 15:43:16 2011 (r34427)
@@ -181,6 +181,10 @@ get_video_codec
get_video_resolution
Print out the video resolution of the current file.
+gui <message>
+ Send GUI skin message <message>. (See the skin documentation on GUI
+ messages for details.)
+
screenshot <value>
Take a screenshot. Requires the screenshot filter to be loaded.
0 Take a single screenshot.
Modified: trunk/command.c
==============================================================================
--- trunk/command.c Sat Dec 10 21:55:31 2011 (r34426)
+++ trunk/command.c Sun Dec 11 15:43:16 2011 (r34427)
@@ -3511,6 +3511,11 @@ int run_command(MPContext *mpctx, mp_cmd
break;
default:
+#ifdef CONFIG_GUI
+ if (use_gui && cmd->id == MP_CMD_GUI)
+ gui(GUI_RUN_MESSAGE, cmd->args[0].v.s);
+ else
+#endif
mp_msg(MSGT_CPLAYER, MSGL_V,
"Received unknown cmd %s\n", cmd->name);
}
Modified: trunk/gui/app.c
==============================================================================
--- trunk/gui/app.c Sat Dec 10 21:55:31 2011 (r34426)
+++ trunk/gui/app.c Sun Dec 11 15:43:16 2011 (r34427)
@@ -148,6 +148,33 @@ int appFindMessage(const char *name)
}
/**
+ * @brief Find the item belonging to an event.
+ *
+ * @param event event
+ *
+ * @return pointer to the item (ok) or NULL (not found)
+ */
+wItem *appFindItem(int event)
+{
+ wItem *item;
+ int i, n;
+
+ if (guiApp.subWindow.isFullScreen && guiApp.playbarIsPresent) {
+ item = guiApp.playbarItems;
+ n = guiApp.IndexOfPlaybarItems;
+ } else {
+ item = guiApp.mainItems;
+ n = guiApp.IndexOfMainItems;
+ }
+
+ for (i = 0; i <= n; i++)
+ if (item[i].message == event)
+ return item;
+
+ return NULL;
+}
+
+/**
* @brief Modify the state (i.e. set a new value) to the item belonging to an event.
*
* @param event event
Modified: trunk/gui/app.h
==============================================================================
--- trunk/gui/app.h Sat Dec 10 21:55:31 2011 (r34426)
+++ trunk/gui/app.h Sun Dec 11 15:43:16 2011 (r34427)
@@ -175,6 +175,7 @@ typedef struct {
extern guiItems guiApp;
+wItem *appFindItem(int event);
int appFindMessage(const char *name);
void appFreeStruct(void);
void btnModify(int event, float state);
Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c Sat Dec 10 21:55:31 2011 (r34426)
+++ trunk/gui/interface.c Sun Dec 11 15:43:16 2011 (r34427)
@@ -323,7 +323,7 @@ int gui(int what, void *data)
dvd_priv_t *dvd;
#endif
plItem *next;
- int state;
+ int msg, state;
if (guiInfo.mpcontext)
mixer = mpctx_get_mixer(guiInfo.mpcontext);
@@ -382,6 +382,13 @@ int gui(int what, void *data)
break;
+ case GUI_RUN_MESSAGE:
+ mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[interface] GUI_RUN_MESSAGE: %s\n", (const char *)data);
+ msg = appFindMessage((const char *)data);
+ if (appFindItem(msg))
+ uiEventHandling(msg, 0);
+ break;
+
case GUI_PREPARE:
wsVisibleMouse(&guiApp.subWindow, wsHideMouseCursor);
Modified: trunk/gui/interface.h
==============================================================================
--- trunk/gui/interface.h Sat Dec 10 21:55:31 2011 (r34426)
+++ trunk/gui/interface.h Sun Dec 11 15:43:16 2011 (r34427)
@@ -45,6 +45,7 @@ enum {
GUI_PREPARE,
GUI_REDRAW,
GUI_RUN_COMMAND,
+ GUI_RUN_MESSAGE,
GUI_SETUP_VIDEO_WINDOW,
GUI_SET_AFILTER,
GUI_SET_AUDIO,
Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c Sat Dec 10 21:55:31 2011 (r34426)
+++ trunk/gui/win32/interface.c Sun Dec 11 15:43:16 2011 (r34427)
@@ -657,6 +657,8 @@ int gui(int what, void *data)
}
break;
}
+ case GUI_RUN_MESSAGE:
+ break;
case GUI_HANDLE_EVENTS:
break;
case GUI_SET_MIXER:
Modified: trunk/input/input.c
==============================================================================
--- trunk/input/input.c Sat Dec 10 21:55:31 2011 (r34426)
+++ trunk/input/input.c Sun Dec 11 15:43:16 2011 (r34427)
@@ -208,6 +208,8 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_AF_CLR, "af_clr", 0, { {-1,{0}} } },
{ MP_CMD_AF_CMDLINE, "af_cmdline", 2, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
+ { MP_CMD_GUI, "gui", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
+
{ 0, NULL, 0, {} }
};
Modified: trunk/input/input.h
==============================================================================
--- trunk/input/input.h Sat Dec 10 21:55:31 2011 (r34426)
+++ trunk/input/input.h Sun Dec 11 15:43:16 2011 (r34427)
@@ -162,6 +162,9 @@ typedef enum {
MP_CMD_AF_CLR,
MP_CMD_AF_CMDLINE,
+ /// GUI command
+ MP_CMD_GUI,
+
} mp_command_type;
// The arg types
Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c Sat Dec 10 21:55:31 2011 (r34426)
+++ trunk/mplayer.c Sun Dec 11 15:43:16 2011 (r34427)
@@ -3058,6 +3058,9 @@ play_next_file:
gui(GUI_HANDLE_EVENTS, 0);
gui(GUI_REDRAW, 0);
if ((cmd = mp_input_get_cmd(0, 0, 0)) != NULL) {
+ if (cmd->id == MP_CMD_GUI)
+ gui(GUI_RUN_MESSAGE, cmd->args[0].v.s);
+ else
gui(GUI_RUN_COMMAND, (void *)cmd->id);
mp_cmd_free(cmd);
}
More information about the MPlayer-cvslog
mailing list