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

ib subversion at mplayerhq.hu
Wed Jun 29 16:24:39 CEST 2011


Author: ib
Date: Wed Jun 29 16:24:39 2011
New Revision: 33782

Log:
Don't let MPlayer directly call user interface functions.

Provide uiEnd() as the new guiGetEvent type guiEndFile. That way,
access is possible through the official interface function.

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

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Wed Jun 29 15:37:04 2011	(r33781)
+++ trunk/gui/interface.c	Wed Jun 29 16:24:39 2011	(r33782)
@@ -555,6 +555,7 @@ int guiGetEvent(int type, void *arg)
 #ifdef CONFIG_DVDREAD
     dvd_priv_t *dvd;
 #endif
+    plItem *next;
 
     if (guiInfo.mpcontext)
         mixer = mpctx_get_mixer(guiInfo.mpcontext);
@@ -970,6 +971,50 @@ int guiGetEvent(int type, void *arg)
         wsEvents(wsDisplay, arg);
         gtkEventHandling();
         break;
+
+    case guiEndFile:
+
+        if (!uiGotoTheNext && guiInfo.Playing) {
+            uiGotoTheNext = 1;
+            break;
+        }
+
+        if (guiInfo.Playing && (next = gtkSet(gtkGetNextPlItem, 0, NULL)) && (plLastPlayed != next)) {
+            plLastPlayed = next;
+            guiSetDF(guiInfo.Filename, next->path, next->name);
+            guiInfo.StreamType      = STREAMTYPE_FILE;
+            guiInfo.FilenameChanged = guiInfo.NewPlay = 1;
+            gfree((void **)&guiInfo.AudioFile);
+            gfree((void **)&guiInfo.Subtitlename);
+        } else {
+            if (guiInfo.FilenameChanged || guiInfo.NewPlay)
+                break;
+
+            guiInfo.TimeSec       = 0;
+            guiInfo.Position      = 0;
+            guiInfo.AudioChannels = 0;
+            guiInfo.MovieWindow   = True;
+
+#ifdef CONFIG_DVDREAD
+            guiInfo.DVD.current_title   = 1;
+            guiInfo.DVD.current_chapter = 1;
+            guiInfo.DVD.current_angle   = 1;
+#endif
+
+            if (!guiApp.subWindow.isFullScreen && gtkShowVideoWindow) {
+                wsResizeWindow(&guiApp.subWindow, guiApp.sub.width, guiApp.sub.height);
+                wsMoveWindow(&guiApp.subWindow, True, guiApp.sub.x, guiApp.sub.y);
+            } else
+                wsVisibleWindow(&guiApp.subWindow, wsHideWindow);
+
+            guiGetEvent(guiSetState, (void *)GUI_STOP);
+            uiSubRender = 1;
+            wsSetBackgroundRGB(&guiApp.subWindow, guiApp.sub.R, guiApp.sub.G, guiApp.sub.B);
+            wsClearWindow(guiApp.subWindow);
+            wsPostRedisplay(&guiApp.subWindow);
+        }
+
+        break;
     }
 
     return True;

Modified: trunk/gui/interface.h
==============================================================================
--- trunk/gui/interface.h	Wed Jun 29 15:37:04 2011	(r33781)
+++ trunk/gui/interface.h	Wed Jun 29 16:24:39 2011	(r33782)
@@ -51,6 +51,7 @@ extern int use_gui;             // this 
 #define guiPreparation     16
 #define guiSetAfilter      17
 #define guiSetContext      18
+#define guiEndFile         19
 
 #define GUI_STOP  0
 #define GUI_PLAY  1

Modified: trunk/gui/ui/actions.c
==============================================================================
--- trunk/gui/ui/actions.c	Wed Jun 29 15:37:04 2011	(r33781)
+++ trunk/gui/ui/actions.c	Wed Jun 29 16:24:39 2011	(r33782)
@@ -91,51 +91,6 @@ void uiFullScreen(void)
         wsSetBackgroundRGB(&guiApp.subWindow, guiApp.sub.R, guiApp.sub.G, guiApp.sub.B);
 }
 
-void uiEnd(void)
-{
-    plItem *next;
-
-    if (!uiGotoTheNext && guiInfo.Playing) {
-        uiGotoTheNext = 1;
-        return;
-    }
-
-    if (guiInfo.Playing && (next = gtkSet(gtkGetNextPlItem, 0, NULL)) && (plLastPlayed != next)) {
-        plLastPlayed = next;
-        guiSetDF(guiInfo.Filename, next->path, next->name);
-        guiInfo.StreamType      = STREAMTYPE_FILE;
-        guiInfo.FilenameChanged = guiInfo.NewPlay = 1;
-        gfree((void **)&guiInfo.AudioFile);
-        gfree((void **)&guiInfo.Subtitlename);
-    } else {
-        if (guiInfo.FilenameChanged || guiInfo.NewPlay)
-            return;
-
-        guiInfo.TimeSec       = 0;
-        guiInfo.Position      = 0;
-        guiInfo.AudioChannels = 0;
-        guiInfo.MovieWindow   = True;
-
-#ifdef CONFIG_DVDREAD
-        guiInfo.DVD.current_title   = 1;
-        guiInfo.DVD.current_chapter = 1;
-        guiInfo.DVD.current_angle   = 1;
-#endif
-
-        if (!guiApp.subWindow.isFullScreen && gtkShowVideoWindow) {
-            wsResizeWindow(&guiApp.subWindow, guiApp.sub.width, guiApp.sub.height);
-            wsMoveWindow(&guiApp.subWindow, True, guiApp.sub.x, guiApp.sub.y);
-        } else
-            wsVisibleWindow(&guiApp.subWindow, wsHideWindow);
-
-        guiGetEvent(guiSetState, (void *)GUI_STOP);
-        uiSubRender = 1;
-        wsSetBackgroundRGB(&guiApp.subWindow, guiApp.sub.R, guiApp.sub.G, guiApp.sub.B);
-        wsClearWindow(guiApp.subWindow);
-        wsPostRedisplay(&guiApp.subWindow);
-    }
-}
-
 void uiPlay(void)
 {
     if (!guiInfo.Filename ||

Modified: trunk/gui/ui/actions.h
==============================================================================
--- trunk/gui/ui/actions.h	Wed Jun 29 15:37:04 2011	(r33781)
+++ trunk/gui/ui/actions.h	Wed Jun 29 16:24:39 2011	(r33782)
@@ -24,7 +24,6 @@ extern int uiGotoTheNext;
 void uiAbsSeek(float sec);
 void uiChangeSkin(char *name);
 void uiCurr(void);
-void uiEnd(void);
 void uiFullScreen(void);
 void uiNext(void);
 void uiPause(void);

Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c	Wed Jun 29 15:37:04 2011	(r33781)
+++ trunk/gui/win32/interface.c	Wed Jun 29 16:24:39 2011	(r33782)
@@ -384,53 +384,6 @@ void uiPrev(void)
     mygui->startplay(mygui);
 }
 
-void uiEnd( void )
-{
-    if(!uiGotoTheNext && guiInfo.Playing)
-    {
-        uiGotoTheNext = 1;
-        return;
-    }
-
-    if(uiGotoTheNext && guiInfo.Playing &&
-      (mygui->playlist->current < (mygui->playlist->trackcount - 1)) &&
-      guiInfo.StreamType != STREAMTYPE_DVD &&
-      guiInfo.StreamType != STREAMTYPE_DVDNAV)
-    {
-        /* we've finished this file, reset the aspect */
-        if(movie_aspect >= 0)
-            movie_aspect = -1;
-
-        uiGotoTheNext = guiInfo.FilenameChanged = guiInfo.NewPlay = 1;
-        uiSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)++]->filename, STREAMTYPE_STREAM);
-        //sprintf(guiInfo.Filename, mygui->playlist->tracks[(mygui->playlist->current)++]->filename);
-    }
-
-    if(guiInfo.FilenameChanged && guiInfo.NewPlay)
-        return;
-
-    guiInfo.TimeSec = 0;
-    guiInfo.Position = 0;
-    guiInfo.AudioChannels = 0;
-
-#ifdef CONFIG_DVDREAD
-    guiInfo.DVD.current_title = 1;
-    guiInfo.DVD.current_chapter = 1;
-    guiInfo.DVD.current_angle = 1;
-#endif
-
-    if (mygui->playlist->current == (mygui->playlist->trackcount - 1))
-        mygui->playlist->current = 0;
-
-    fullscreen = 0;
-    if(style == WS_VISIBLE | WS_POPUP)
-    {
-        style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
-        SetWindowLong(mygui->subwindow, GWL_STYLE, style);
-    }
-    guiGetEvent(guiSetState, (void *) GUI_STOP);
-}
-
 void uiStop(void)
 {
     guiGetEvent(guiSetState, (void *) GUI_STOP);
@@ -745,6 +698,53 @@ int guiGetEvent(int type, void *arg)
             }
             break;
         }
+        case guiEndFile:
+        {
+          if(!uiGotoTheNext && guiInfo.Playing)
+          {
+              uiGotoTheNext = 1;
+              break;
+          }
+
+          if(uiGotoTheNext && guiInfo.Playing &&
+            (mygui->playlist->current < (mygui->playlist->trackcount - 1)) &&
+            guiInfo.StreamType != STREAMTYPE_DVD &&
+            guiInfo.StreamType != STREAMTYPE_DVDNAV)
+          {
+              /* we've finished this file, reset the aspect */
+              if(movie_aspect >= 0)
+                  movie_aspect = -1;
+
+              uiGotoTheNext = guiInfo.FilenameChanged = guiInfo.NewPlay = 1;
+              uiSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)++]->filename, STREAMTYPE_STREAM);
+              //sprintf(guiInfo.Filename, mygui->playlist->tracks[(mygui->playlist->current)++]->filename);
+          }
+
+          if(guiInfo.FilenameChanged && guiInfo.NewPlay)
+              break;
+
+          guiInfo.TimeSec = 0;
+          guiInfo.Position = 0;
+          guiInfo.AudioChannels = 0;
+
+#ifdef CONFIG_DVDREAD
+          guiInfo.DVD.current_title = 1;
+          guiInfo.DVD.current_chapter = 1;
+          guiInfo.DVD.current_angle = 1;
+#endif
+
+          if (mygui->playlist->current == (mygui->playlist->trackcount - 1))
+              mygui->playlist->current = 0;
+
+          fullscreen = 0;
+          if(style == WS_VISIBLE | WS_POPUP)
+          {
+              style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
+              SetWindowLong(mygui->subwindow, GWL_STYLE, style);
+          }
+          guiGetEvent(guiSetState, (void *) GUI_STOP);
+          break;
+        }
         default:
             mp_msg(MSGT_GPLAYER, MSGL_ERR, "[GUI] GOT UNHANDLED EVENT %i\n", type);
     }

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Wed Jun 29 15:37:04 2011	(r33781)
+++ trunk/mplayer.c	Wed Jun 29 16:24:39 2011	(r33782)
@@ -4103,7 +4103,7 @@ goto_next_file:  // don't jump here afte
 #ifdef CONFIG_DVDREAD
         if (!guiInfo.DiskChanged)
 #endif
-        uiEnd();
+        guiGetEvent(guiEndFile, NULL);
     }
 #endif
 


More information about the MPlayer-cvslog mailing list