[MPlayer-cvslog] r33703 - in trunk: gui/interface.c gui/ui/actions.c gui/ui/main.c gui/ui/render.c gui/win32/dialogs.c gui/win32/gui.c gui/win32/interface.c gui/win32/widgetrender.c mplayer.c

ib subversion at mplayerhq.hu
Wed Jun 22 14:53:30 CEST 2011


Author: ib
Date: Wed Jun 22 14:53:30 2011
New Revision: 33703

Log:
Replace all playback integer constants by their symbolic constants.

Modified:
   trunk/gui/interface.c
   trunk/gui/ui/actions.c
   trunk/gui/ui/main.c
   trunk/gui/ui/render.c
   trunk/gui/win32/dialogs.c
   trunk/gui/win32/gui.c
   trunk/gui/win32/interface.c
   trunk/gui/win32/widgetrender.c
   trunk/mplayer.c

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Wed Jun 22 14:12:50 2011	(r33702)
+++ trunk/gui/interface.c	Wed Jun 22 14:53:30 2011	(r33703)
@@ -354,7 +354,7 @@ void guiInit(void)
 
                 guiApp.subWindow.Mapped = wsMapped;
             }
-            guiInfo.Playing = 2;   // set pause, because of !gtkShowVideoWindow...
+            guiInfo.Playing = GUI_PAUSE; // because of !gtkShowVideoWindow...
             uiFullScreen();        // ...guiInfo.Playing is required
             wsVisibleWindow(&guiApp.subWindow, wsHideWindow);
             btnModify(evFullScreen, btnPressed);
@@ -362,7 +362,7 @@ void guiInit(void)
     }
 #endif
 
-    guiInfo.Playing = 0;
+    guiInfo.Playing = GUI_STOP;
 
     uiSubRender = 1;
 
@@ -576,17 +576,17 @@ int guiGetEvent(int type, void *arg)
 
         switch ((int)arg) {
         case GUI_PLAY:
-            guiInfo.Playing = 1;
 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &guiApp.subWindow,wsHideWindow );
+            guiInfo.Playing = GUI_PLAY;
             break;
 
         case GUI_STOP:
-            guiInfo.Playing = 0;
 // if ( !gtkShowVideoWindow ) wsVisibleWindow( &guiApp.subWindow,wsHideWindow );
+            guiInfo.Playing = GUI_STOP;
             break;
 
         case GUI_PAUSE:
-            guiInfo.Playing = 2;
+            guiInfo.Playing = GUI_PAUSE;
             break;
         }
 

Modified: trunk/gui/ui/actions.c
==============================================================================
--- trunk/gui/ui/actions.c	Wed Jun 22 14:12:50 2011	(r33702)
+++ trunk/gui/ui/actions.c	Wed Jun 22 14:53:30 2011	(r33703)
@@ -140,10 +140,10 @@ void uiPlay(void)
 {
     if (!guiInfo.Filename ||
         (guiInfo.Filename[0] == 0) ||
-        (guiInfo.Playing == 1))
+        (guiInfo.Playing == GUI_PLAY))
         return;
 
-    if (guiInfo.Playing == 2) {
+    if (guiInfo.Playing == GUI_PAUSE) {
         uiPause();
         return;
     }
@@ -159,18 +159,18 @@ void uiPause(void)
     if (!guiInfo.Playing)
         return;
 
-    if (guiInfo.Playing == 1) {
+    if (guiInfo.Playing == GUI_PLAY) {
         mp_cmd_t *cmd = calloc(1, sizeof(*cmd));
         cmd->id   = MP_CMD_PAUSE;
         cmd->name = strdup("pause");
         mp_input_queue_cmd(cmd);
     } else
-        guiInfo.Playing = 1;
+        guiInfo.Playing = GUI_PLAY;
 }
 
 void uiState(void)
 {
-    if (guiInfo.Playing == 0 || guiInfo.Playing == 2) {
+    if (guiInfo.Playing == GUI_STOP || guiInfo.Playing == GUI_PAUSE) {
         btnModify(evPlaySwitchToPause, btnReleased);
         btnModify(evPauseSwitchToPlay, btnDisabled);
     } else {
@@ -314,7 +314,7 @@ void uiCurr(void)
     plItem *curr;
     int stop = 0;
 
-    if (guiInfo.Playing == 2)
+    if (guiInfo.Playing == GUI_PAUSE)
         return;
 
     switch (guiInfo.StreamType) {
@@ -344,7 +344,7 @@ void uiCurr(void)
     if (stop)
         uiEventHandling(evStop, 0);
 
-    if (guiInfo.Playing == 1)
+    if (guiInfo.Playing == GUI_PLAY)
         uiEventHandling(evPlay, 0);
 }
 
@@ -353,7 +353,7 @@ void uiPrev(void)
     plItem *prev;
     int stop = 0;
 
-    if (guiInfo.Playing == 2)
+    if (guiInfo.Playing == GUI_PAUSE)
         return;
 
     switch (guiInfo.StreamType) {
@@ -398,7 +398,7 @@ void uiPrev(void)
     if (stop)
         uiEventHandling(evStop, 0);
 
-    if (guiInfo.Playing == 1)
+    if (guiInfo.Playing == GUI_PLAY)
         uiEventHandling(evPlay, 0);
 }
 
@@ -407,7 +407,7 @@ void uiNext(void)
     int stop = 0;
     plItem *next;
 
-    if (guiInfo.Playing == 2)
+    if (guiInfo.Playing == GUI_PAUSE)
         return;
 
     switch (guiInfo.StreamType) {
@@ -458,7 +458,7 @@ void uiNext(void)
     if (stop)
         uiEventHandling(evStop, 0);
 
-    if (guiInfo.Playing == 1)
+    if (guiInfo.Playing == GUI_PLAY)
         uiEventHandling(evPlay, 0);
 }
 

Modified: trunk/gui/ui/main.c
==============================================================================
--- trunk/gui/ui/main.c	Wed Jun 22 14:12:50 2011	(r33702)
+++ trunk/gui/ui/main.c	Wed Jun 22 14:53:30 2011	(r33703)
@@ -153,7 +153,7 @@ play_dvd_2:
    case evPlaySwitchToPause:
 play:
 
-        if ( ( msg == evPlaySwitchToPause )&&( guiInfo.Playing == 2 ) ) goto NoPause;
+        if ( ( msg == evPlaySwitchToPause )&&( guiInfo.Playing == GUI_PAUSE ) ) goto NoPause;
 
 	if ( gtkSet( gtkGetCurrPlItem,0,NULL ) &&( guiInfo.StreamType == STREAMTYPE_FILE ) )
 	 {
@@ -173,7 +173,7 @@ play:
 	       gtkSet( gtkClearStruct,0,(void *)(guiALL - guiVCD - guiFilenames) );
 	       if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE );
 	       uiSetFileName( NULL,cdrom_device,STREAMTYPE_VCD );
-	       if ( guiInfo.Playing != 2 )
+	       if ( guiInfo.Playing != GUI_PAUSE )
 	        {
 		 if ( !guiInfo.Track )
                    guiInfo.Track=1;
@@ -186,7 +186,7 @@ play:
 	       gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD - guiFilenames) );
 	       if ( !dvd_device ) dvd_device=gstrdup( DEFAULT_DVD_DEVICE );
 	       uiSetFileName( NULL,dvd_device,STREAMTYPE_DVD );
-	       if ( guiInfo.Playing != 2 )
+	       if ( guiInfo.Playing != GUI_PAUSE )
 	        {
 		 guiInfo.Title=guiInfo.DVD.current_title;
 		 guiInfo.Chapter=guiInfo.DVD.current_chapter;
@@ -626,7 +626,7 @@ void uiDandDHandler(int num,char** files
 
   if (filename) {
     uiSetFileName( NULL,filename,STREAMTYPE_FILE );
-    if ( guiInfo.Playing == 1 ) uiEventHandling( evStop,0 );
+    if ( guiInfo.Playing == GUI_PLAY ) uiEventHandling( evStop,0 );
     uiEventHandling( evPlay,0 );
   }
   if (subtitles) {

Modified: trunk/gui/ui/render.c
==============================================================================
--- trunk/gui/ui/render.c	Wed Jun 22 14:12:50 2011	(r33702)
+++ trunk/gui/ui/render.c	Wed Jun 22 14:53:30 2011	(r33703)
@@ -230,17 +230,17 @@ calclengthmmmmss:
                 break;
 
             case 's':
-                if (guiInfo.Playing == 0)
+                if (guiInfo.Playing == GUI_STOP)
                     av_strlcat(trbuf, "s", sizeof(trbuf));
                 break;
 
             case 'l':
-                if (guiInfo.Playing == 1)
+                if (guiInfo.Playing == GUI_PLAY)
                     av_strlcat(trbuf, "p", sizeof(trbuf));
                 break;
 
             case 'e':
-                if (guiInfo.Playing == 2)
+                if (guiInfo.Playing == GUI_PAUSE)
                     av_strlcat(trbuf, "e", sizeof(trbuf));
                 break;
 

Modified: trunk/gui/win32/dialogs.c
==============================================================================
--- trunk/gui/win32/dialogs.c	Wed Jun 22 14:12:50 2011	(r33702)
+++ trunk/gui/win32/dialogs.c	Wed Jun 22 14:53:30 2011	(r33703)
@@ -159,7 +159,7 @@ void display_opensubtitlewindow(gui_t *g
     char subtitlefile[MAX_PATH];
 
     /* Safety check */
-    if (guiInfo.Playing == 0 || !guiInfo.sh_video) return;
+    if (guiInfo.Playing == GUI_STOP || !guiInfo.sh_video) return;
 
     memset(&subtitleopen, 0, sizeof(OPENFILENAME));
     memset(subtitlefile, 0, sizeof(subtitlefile));

Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c	Wed Jun 22 14:12:50 2011	(r33702)
+++ trunk/gui/win32/gui.c	Wed Jun 22 14:53:30 2011	(r33703)
@@ -263,7 +263,7 @@ static void updatedisplay(gui_t *gui, HW
             {
                 gui->skin->widgets[i]->value = guiInfo.Playing;
                     renderwidget(gui->skin, get_drawground(hwnd), gui->skin->widgets[i],
-                                 guiInfo.Playing == 1 ? 0 : 1);
+                                 guiInfo.Playing == GUI_PLAY ? 0 : 1);
             }
             if(gui->skin->widgets[i]->msg == evMute)
             {
@@ -607,7 +607,7 @@ static LRESULT CALLBACK SubProc(HWND hWn
             GetClientRect(hWnd, &rect);
             width = rect.right - rect.left;
             height = rect.bottom - rect.top;
-            if(guiInfo.Playing == 0)
+            if(guiInfo.Playing == GUI_STOP)
             {
                 int i;
                 window *desc = NULL;

Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c	Wed Jun 22 14:12:50 2011	(r33702)
+++ trunk/gui/win32/interface.c	Wed Jun 22 14:53:30 2011	(r33703)
@@ -243,7 +243,7 @@ static void guiSetEvent(int event)
         {
             float l,r;
 
-            if (guiInfo.Playing == 0)
+            if (guiInfo.Playing == GUI_STOP)
                 break;
 
             if (guiInfo.Balance == 50.0f)
@@ -318,7 +318,7 @@ void uiPlay( void )
    if((!guiInfo.Filename ) || (guiInfo.Filename[0] == 0))
      return;
 
-   if(guiInfo.Playing > 0)
+   if(guiInfo.Playing > GUI_STOP)
    {
        uiPause();
        return;
@@ -331,18 +331,18 @@ void uiPause( void )
 {
    if(!guiInfo.Playing) return;
 
-   if(guiInfo.Playing == 1)
+   if(guiInfo.Playing == GUI_PLAY)
    {
        mp_cmd_t * cmd = calloc(1, sizeof(*cmd));
        cmd->id=MP_CMD_PAUSE;
        cmd->name=strdup("pause");
        mp_input_queue_cmd(cmd);
-   } else guiInfo.Playing = 1;
+   } else guiInfo.Playing = GUI_PLAY;
 }
 
 void uiNext(void)
 {
-    if(guiInfo.Playing == 2) return;
+    if(guiInfo.Playing == GUI_PAUSE) return;
     switch(guiInfo.StreamType)
     {
 #ifdef CONFIG_DVDREAD
@@ -364,7 +364,7 @@ void uiNext(void)
 
 void uiPrev(void)
 {
-    if(guiInfo.Playing == 2) return;
+    if(guiInfo.Playing == GUI_PAUSE) return;
     switch(guiInfo.StreamType)
     {
 #ifdef CONFIG_DVDREAD
@@ -667,19 +667,19 @@ int guiGetEvent(int type, void *arg)
             {
                 case GUI_PLAY:
                 {
-                    guiInfo.Playing = 1;
+                    guiInfo.Playing = GUI_PLAY;
                     break;
                 }
                 case GUI_STOP:
                 {
-                    guiInfo.Playing = 0;
+                    guiInfo.Playing = GUI_STOP;
                     if(movie_aspect >= 0)
                         movie_aspect = -1;
                     update_subwindow();
                     break;
                 }
                 case GUI_PAUSE:
-                    guiInfo.Playing = 2;
+                    guiInfo.Playing = GUI_PAUSE;
                     break;
             }
             break;
@@ -912,7 +912,7 @@ static int update_subwindow(void)
     wp.flags = SWP_NOOWNERZORDER | SWP_SHOWWINDOW;
 
     /* erase the bitmap image if there's video */
-    if(guiInfo.Playing != 0 && guiInfo.sh_video)
+    if(guiInfo.Playing != GUI_STOP && guiInfo.sh_video)
         SendMessage(mygui->subwindow, WM_ERASEBKGND, (WPARAM)GetDC(mygui->subwindow), 0);
 
     /* reset the window aspect */

Modified: trunk/gui/win32/widgetrender.c
==============================================================================
--- trunk/gui/win32/widgetrender.c	Wed Jun 22 14:12:50 2011	(r33702)
+++ trunk/gui/win32/widgetrender.c	Wed Jun 22 14:53:30 2011	(r33703)
@@ -151,9 +151,9 @@ static char *generatetextfromlabel(widge
 
     if(!strcmp(text, "$p") || !strcmp(text, "$s") || !strcmp(text, "$e"))
     {
-        if(guiInfo.Playing == 0) stringreplace(text, NULL, "s");
-        else if(guiInfo.Playing == 1) stringreplace(text, NULL, "p");
-        else if(guiInfo.Playing == 2) stringreplace(text, NULL, "e");
+        if(guiInfo.Playing == GUI_STOP) stringreplace(text, NULL, "s");
+        else if(guiInfo.Playing == GUI_PLAY) stringreplace(text, NULL, "p");
+        else if(guiInfo.Playing == GUI_PAUSE) stringreplace(text, NULL, "e");
     }
 
     if(guiInfo.AudioType == 0) stringreplace(text, "$a", "n");

Modified: trunk/mplayer.c
==============================================================================
--- trunk/mplayer.c	Wed Jun 22 14:12:50 2011	(r33702)
+++ trunk/mplayer.c	Wed Jun 22 14:53:30 2011	(r33703)
@@ -2558,7 +2558,7 @@ static void pause_loop(void)
         if (use_gui) {
             guiEventHandling();
             guiGetEvent(guiReDraw, NULL);
-            if (guiInfo.Playing != 2 || (rel_seek_secs || abs_seek_pos))
+            if (guiInfo.Playing != GUI_PAUSE || (rel_seek_secs || abs_seek_pos))
                 break;
         }
 #endif
@@ -3052,7 +3052,7 @@ int main(int argc, char *argv[])
     if (use_gui) {
         guiInit();
         guiGetEvent(guiSetContext, mpctx);
-        guiGetEvent(guiSetState, (char *)((gui_no_filename) ? 0 : 1));
+        guiGetEvent(guiSetState, (void *)((gui_no_filename) ? GUI_STOP : GUI_PLAY));
     }
 #endif
 
@@ -3091,7 +3091,7 @@ play_next_file:
     if (use_gui) {
         mpctx->file_format = DEMUXER_TYPE_UNKNOWN;
         guiGetEvent(guiSetDefaults, 0);
-        while (guiInfo.Playing != 1) {
+        while (guiInfo.Playing != GUI_PLAY) {
             mp_cmd_t *cmd;
             usec_sleep(20000);
             guiEventHandling();
@@ -4006,9 +4006,9 @@ goto_enable_cache:
                 guiInfo.LengthInSec = demuxer_get_time_length(mpctx->demuxer);
                 guiGetEvent(guiReDraw, NULL);
                 guiGetEvent(guiSetVolume, NULL);
-                if (guiInfo.Playing == 0)
+                if (guiInfo.Playing == GUI_STOP)
                     break;                  // STOP
-                if (guiInfo.Playing == 2)
+                if (guiInfo.Playing == GUI_PAUSE)
                     mpctx->osd_function = OSD_PAUSE;
                 if (guiInfo.DiskChanged || guiInfo.NewPlay)
                     goto goto_next_file;


More information about the MPlayer-cvslog mailing list