[MPlayer-cvslog] r33784 - in trunk: command.c gui/interface.c gui/interface.h gui/ui/actions.c gui/ui/actions.h gui/win32/interface.c

ib subversion at mplayerhq.hu
Wed Jun 29 17:22:22 CEST 2011


Author: ib
Date: Wed Jun 29 17:22:22 2011
New Revision: 33784

Log:
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.

Modified:
   trunk/command.c
   trunk/gui/interface.c
   trunk/gui/interface.h
   trunk/gui/ui/actions.c
   trunk/gui/ui/actions.h
   trunk/gui/win32/interface.c

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	Wed Jun 29 16:31:17 2011	(r33783)
+++ trunk/command.c	Wed Jun 29 17:22:22 2011	(r33784)
@@ -2801,10 +2801,10 @@ int run_command(MPContext *mpctx, mp_cmd
                     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 @@ int run_command(MPContext *mpctx, mp_cmd
 #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.

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Wed Jun 29 16:31:17 2011	(r33783)
+++ trunk/gui/interface.c	Wed Jun 29 17:22:22 2011	(r33784)
@@ -610,6 +610,18 @@ int guiGetEvent(int type, void *arg)
         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;

Modified: trunk/gui/interface.h
==============================================================================
--- trunk/gui/interface.h	Wed Jun 29 16:31:17 2011	(r33783)
+++ trunk/gui/interface.h	Wed Jun 29 17:22:22 2011	(r33784)
@@ -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
 // ------------------------------------------------------------

Modified: trunk/gui/ui/actions.c
==============================================================================
--- trunk/gui/ui/actions.c	Wed Jun 29 16:31:17 2011	(r33783)
+++ trunk/gui/ui/actions.c	Wed Jun 29 17:22:22 2011	(r33784)
@@ -416,8 +416,3 @@ void uiNext(void)
     if (guiInfo.Playing == GUI_PLAY)
         uiEventHandling(evPlay, 0);
 }
-
-void uiStop(void)
-{
-    uiEventHandling(evStop, 0);
-}

Modified: trunk/gui/ui/actions.h
==============================================================================
--- trunk/gui/ui/actions.h	Wed Jun 29 16:31:17 2011	(r33783)
+++ trunk/gui/ui/actions.h	Wed Jun 29 17:22:22 2011	(r33784)
@@ -32,6 +32,5 @@ void uiPrev(void);
 void uiRelSeek(float percent);
 void uiSetFileName(char *dir, char *name, int type);
 void uiState(void);
-void uiStop(void);
 
 #endif /* MPLAYER_GUI_ACTIONS_H */

Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c	Wed Jun 29 16:31:17 2011	(r33783)
+++ trunk/gui/win32/interface.c	Wed Jun 29 17:22:22 2011	(r33784)
@@ -384,11 +384,6 @@ void uiPrev(void)
     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 @@ int guiGetEvent(int type, void *arg)
                     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;
             }


More information about the MPlayer-cvslog mailing list