# HG changeset patch # User ib # Date 1309360942 0 # Node ID 24d919fb67784d910b76287b8f3a2763a27be40f # Parent 60093217cb016f61701a17d251b90dfec46f916a Don't let MPlayer directly call user interface functions. Provide the necessary actions for MPlayer commands by guiGetEvent type guiRunCommand instead. That way, access is possible through the official interface function. diff -r 60093217cb01 -r 24d919fb6778 command.c --- a/command.c Wed Jun 29 14:31:17 2011 +0000 +++ b/command.c Wed Jun 29 15:22:22 2011 +0000 @@ -2801,10 +2801,10 @@ int i = 0; if (n > 0) for (i = 0; i < n; i++) - uiNext(); + guiGetEvent(guiRunCommand, (void *)MP_CMD_PLAY_TREE_STEP); else for (i = 0; i < -1 * n; i++) - uiPrev(); + guiGetEvent(guiRunCommand, (void *)-MP_CMD_PLAY_TREE_STEP); } else #endif { @@ -2966,7 +2966,7 @@ #ifdef CONFIG_GUI // playtree_iter isn't used by the GUI if (use_gui) - uiStop(); + guiGetEvent(guiRunCommand, (void *)MP_CMD_STOP); else #endif // Go back to the starting point. diff -r 60093217cb01 -r 24d919fb6778 gui/interface.c --- a/gui/interface.c Wed Jun 29 14:31:17 2011 +0000 +++ b/gui/interface.c Wed Jun 29 15:22:22 2011 +0000 @@ -610,6 +610,18 @@ case MP_CMD_VO_FULLSCREEN: uiEventHandling(evFullScreen, 0); break; + + case MP_CMD_PLAY_TREE_STEP: + uiEventHandling(evNext, 0); + break; + + case -MP_CMD_PLAY_TREE_STEP: + uiEventHandling(evPrev, 0); + break; + + case MP_CMD_STOP: + uiEventHandling(evStop, 0); + break; } break; diff -r 60093217cb01 -r 24d919fb6778 gui/interface.h --- a/gui/interface.h Wed Jun 29 14:31:17 2011 +0000 +++ b/gui/interface.h Wed Jun 29 15:22:22 2011 +0000 @@ -29,7 +29,6 @@ // the GUI and that only need to include interface.h for this. // ------------------------------------------------------------ #include "cfg.h" -#include "ui/actions.h" extern int use_gui; // this is defined in mplayer.c // ------------------------------------------------------------ diff -r 60093217cb01 -r 24d919fb6778 gui/ui/actions.c --- a/gui/ui/actions.c Wed Jun 29 14:31:17 2011 +0000 +++ b/gui/ui/actions.c Wed Jun 29 15:22:22 2011 +0000 @@ -416,8 +416,3 @@ if (guiInfo.Playing == GUI_PLAY) uiEventHandling(evPlay, 0); } - -void uiStop(void) -{ - uiEventHandling(evStop, 0); -} diff -r 60093217cb01 -r 24d919fb6778 gui/ui/actions.h --- a/gui/ui/actions.h Wed Jun 29 14:31:17 2011 +0000 +++ b/gui/ui/actions.h Wed Jun 29 15:22:22 2011 +0000 @@ -32,6 +32,5 @@ void uiRelSeek(float percent); void uiSetFileName(char *dir, char *name, int type); void uiState(void); -void uiStop(void); #endif /* MPLAYER_GUI_ACTIONS_H */ diff -r 60093217cb01 -r 24d919fb6778 gui/win32/interface.c --- a/gui/win32/interface.c Wed Jun 29 14:31:17 2011 +0000 +++ b/gui/win32/interface.c Wed Jun 29 15:22:22 2011 +0000 @@ -384,11 +384,6 @@ mygui->startplay(mygui); } -void uiStop(void) -{ - guiGetEvent(guiSetState, (void *) GUI_STOP); -} - void uiSetFileName(char *dir, char *name, int type) { if(!name) return; @@ -651,6 +646,15 @@ exit_player(EXIT_QUIT); return 1; } + case MP_CMD_PLAY_TREE_STEP: + guiSetEvent(evNext); + break; + case -MP_CMD_PLAY_TREE_STEP: + guiSetEvent(evPrev); + break; + case MP_CMD_STOP: + guiSetEvent(evStop); + break; default: break; }