changeset 33615:1f9a31d4f114

Replace all playback integer constants by their symbolic constants.
author ib
date Wed, 22 Jun 2011 12:53:30 +0000
parents 79743a5cf4f0
children 4221981ad74c
files 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
diffstat 9 files changed, 44 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Wed Jun 22 12:12:50 2011 +0000
+++ b/gui/interface.c	Wed Jun 22 12:53:30 2011 +0000
@@ -354,7 +354,7 @@
 
                 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 @@
     }
 #endif
 
-    guiInfo.Playing = 0;
+    guiInfo.Playing = GUI_STOP;
 
     uiSubRender = 1;
 
@@ -576,17 +576,17 @@
 
         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;
         }
 
--- a/gui/ui/actions.c	Wed Jun 22 12:12:50 2011 +0000
+++ b/gui/ui/actions.c	Wed Jun 22 12:53:30 2011 +0000
@@ -140,10 +140,10 @@
 {
     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 @@
     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 @@
     plItem *curr;
     int stop = 0;
 
-    if (guiInfo.Playing == 2)
+    if (guiInfo.Playing == GUI_PAUSE)
         return;
 
     switch (guiInfo.StreamType) {
@@ -344,7 +344,7 @@
     if (stop)
         uiEventHandling(evStop, 0);
 
-    if (guiInfo.Playing == 1)
+    if (guiInfo.Playing == GUI_PLAY)
         uiEventHandling(evPlay, 0);
 }
 
@@ -353,7 +353,7 @@
     plItem *prev;
     int stop = 0;
 
-    if (guiInfo.Playing == 2)
+    if (guiInfo.Playing == GUI_PAUSE)
         return;
 
     switch (guiInfo.StreamType) {
@@ -398,7 +398,7 @@
     if (stop)
         uiEventHandling(evStop, 0);
 
-    if (guiInfo.Playing == 1)
+    if (guiInfo.Playing == GUI_PLAY)
         uiEventHandling(evPlay, 0);
 }
 
@@ -407,7 +407,7 @@
     int stop = 0;
     plItem *next;
 
-    if (guiInfo.Playing == 2)
+    if (guiInfo.Playing == GUI_PAUSE)
         return;
 
     switch (guiInfo.StreamType) {
@@ -458,7 +458,7 @@
     if (stop)
         uiEventHandling(evStop, 0);
 
-    if (guiInfo.Playing == 1)
+    if (guiInfo.Playing == GUI_PLAY)
         uiEventHandling(evPlay, 0);
 }
 
--- a/gui/ui/main.c	Wed Jun 22 12:12:50 2011 +0000
+++ b/gui/ui/main.c	Wed Jun 22 12:53:30 2011 +0000
@@ -153,7 +153,7 @@
    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 @@
 	       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 @@
 	       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 @@
 
   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) {
--- a/gui/ui/render.c	Wed Jun 22 12:12:50 2011 +0000
+++ b/gui/ui/render.c	Wed Jun 22 12:53:30 2011 +0000
@@ -230,17 +230,17 @@
                 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;
 
--- a/gui/win32/dialogs.c	Wed Jun 22 12:12:50 2011 +0000
+++ b/gui/win32/dialogs.c	Wed Jun 22 12:53:30 2011 +0000
@@ -159,7 +159,7 @@
     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));
--- a/gui/win32/gui.c	Wed Jun 22 12:12:50 2011 +0000
+++ b/gui/win32/gui.c	Wed Jun 22 12:53:30 2011 +0000
@@ -263,7 +263,7 @@
             {
                 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 @@
             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;
--- a/gui/win32/interface.c	Wed Jun 22 12:12:50 2011 +0000
+++ b/gui/win32/interface.c	Wed Jun 22 12:53:30 2011 +0000
@@ -243,7 +243,7 @@
         {
             float l,r;
 
-            if (guiInfo.Playing == 0)
+            if (guiInfo.Playing == GUI_STOP)
                 break;
 
             if (guiInfo.Balance == 50.0f)
@@ -318,7 +318,7 @@
    if((!guiInfo.Filename ) || (guiInfo.Filename[0] == 0))
      return;
 
-   if(guiInfo.Playing > 0)
+   if(guiInfo.Playing > GUI_STOP)
    {
        uiPause();
        return;
@@ -331,18 +331,18 @@
 {
    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 uiPrev(void)
 {
-    if(guiInfo.Playing == 2) return;
+    if(guiInfo.Playing == GUI_PAUSE) return;
     switch(guiInfo.StreamType)
     {
 #ifdef CONFIG_DVDREAD
@@ -667,19 +667,19 @@
             {
                 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 @@
     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 */
--- a/gui/win32/widgetrender.c	Wed Jun 22 12:12:50 2011 +0000
+++ b/gui/win32/widgetrender.c	Wed Jun 22 12:53:30 2011 +0000
@@ -151,9 +151,9 @@
 
     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");
--- a/mplayer.c	Wed Jun 22 12:12:50 2011 +0000
+++ b/mplayer.c	Wed Jun 22 12:53:30 2011 +0000
@@ -2558,7 +2558,7 @@
         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 @@
     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 @@
     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 @@
                 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;