changeset 33696:24d919fb6778

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.
author ib
date Wed, 29 Jun 2011 15:22:22 +0000
parents 60093217cb01
children 7c93ed3e80cd
files command.c gui/interface.c gui/interface.h gui/ui/actions.c gui/ui/actions.h gui/win32/interface.c
diffstat 6 files changed, 24 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- 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;
--- 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
 // ------------------------------------------------------------
--- 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);
-}
--- 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 */
--- 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;
             }