[MPlayer-cvslog] r33859 - in trunk/gui: interface.c interface.h ui/main.c

ib subversion at mplayerhq.hu
Sat Jul 9 13:48:13 CEST 2011


Author: ib
Date: Sat Jul  9 13:48:13 2011
New Revision: 33859

Log:
Remove gtkClearStruct code from mplayer() in interface.c.

Move it as static function guiInfoMediumClear() where it is used
and rename the symbolic constants used with this code.

Modified:
   trunk/gui/interface.c
   trunk/gui/interface.h
   trunk/gui/ui/main.c

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Sat Jul  9 13:11:52 2011	(r33858)
+++ trunk/gui/interface.c	Sat Jul  9 13:48:13 2011	(r33859)
@@ -986,29 +986,6 @@ void mplayer(int what, float fparam, voi
         break;
 #endif
 
-    // misc
-    // NOTE TO MYSELF: This should rather be in app.c.
-    case gtkClearStruct:
-
-        if ((unsigned int)vparam & guiFilenames) {
-            nfree(guiInfo.Filename);
-            nfree(guiInfo.Subtitlename);
-            nfree(guiInfo.AudioFile);
-            listSet(gtkDelPl, NULL);
-        }
-
-#ifdef CONFIG_DVDREAD
-        if ((unsigned int)vparam & guiDVD)
-            memset(&guiInfo.DVD, 0, sizeof(guiDVDStruct));
-#endif
-
-#ifdef CONFIG_VCD
-        if ((unsigned int)vparam & guiVCD)
-            guiInfo.VCDTracks = 0;
-#endif
-
-        break;
-
     case MPLAYER_SET_EXTRA_STEREO:
         gtkAOExtraStereoMul = fparam;
         if (guiInfo.afilter)

Modified: trunk/gui/interface.h
==============================================================================
--- trunk/gui/interface.h	Sat Jul  9 13:11:52 2011	(r33858)
+++ trunk/gui/interface.h	Sat Jul  9 13:48:13 2011	(r33859)
@@ -56,13 +56,6 @@ enum {
 #define GUI_PLAY  1
 #define GUI_PAUSE 2
 
-// NOTE TO MYSELF: This should rather be in app.h.
-#define guiDVD       1
-#define guiVCD       2
-#define guiFilenames 4
-#define guiALL       0xffffffff
-#define gtkClearStruct 99
-
 enum {
     MPLAYER_EXIT_GUI,
     MPLAYER_SET_AUTO_QUALITY,

Modified: trunk/gui/ui/main.c
==============================================================================
--- trunk/gui/ui/main.c	Sat Jul  9 13:11:52 2011	(r33858)
+++ trunk/gui/ui/main.c	Sat Jul  9 13:48:13 2011	(r33859)
@@ -55,6 +55,11 @@
 #include "mp_core.h"
 #include "mpcommon.h"
 
+#define CLEAR_FILE 1
+#define CLEAR_DVD  2
+#define CLEAR_VCD  4
+#define CLEAR_ALL  (CLEAR_FILE + CLEAR_DVD + CLEAR_VCD)
+
 #define GUI_REDRAW_WAIT 375
 
 #include "actions.h"
@@ -98,6 +103,25 @@ void uiMainDraw( void )
 // XFlush( wsDisplay );
 }
 
+static void guiInfoMediumClear (int what)
+{
+  if (what & CLEAR_FILE)
+  {
+    nfree(guiInfo.Filename);
+    nfree(guiInfo.Subtitlename);
+    nfree(guiInfo.AudioFile);
+    listSet(gtkDelPl, NULL);
+  }
+
+#ifdef CONFIG_DVDREAD
+  if (what & CLEAR_DVD) memset(&guiInfo.DVD, 0, sizeof(guiDVDStruct));
+#endif
+
+#ifdef CONFIG_VCD
+  if (what & CLEAR_VCD) guiInfo.VCDTracks = 0;
+#endif
+}
+
 static unsigned last_redraw_time = 0;
 
 void uiEventHandling( int msg,float param )
@@ -139,7 +163,7 @@ void uiEventHandling( int msg,float para
    case evSetVCDTrack:
         guiInfo.Track=iparam;
    case evPlayVCD:
- 	mplayer( gtkClearStruct,0,(void *)guiALL );
+ 	guiInfoMediumClear ( CLEAR_ALL );
 	guiInfo.StreamType=STREAMTYPE_VCD;
 	goto play;
 #endif
@@ -149,7 +173,7 @@ void uiEventHandling( int msg,float para
         guiInfo.DVD.current_chapter=1;
         guiInfo.DVD.current_angle=1;
 play_dvd_2:
- 	mplayer( gtkClearStruct,0,(void *)(guiALL - guiDVD) );
+ 	guiInfoMediumClear( CLEAR_ALL - CLEAR_DVD );
         guiInfo.StreamType=STREAMTYPE_DVD;
 	goto play;
 #endif
@@ -170,11 +194,11 @@ play:
          {
 	  case STREAMTYPE_STREAM:
 	  case STREAMTYPE_FILE:
-	       mplayer( gtkClearStruct,0,(void *)(guiALL - guiFilenames) );
+	       guiInfoMediumClear( CLEAR_ALL - CLEAR_FILE );
 	       break;
 #ifdef CONFIG_VCD
           case STREAMTYPE_VCD:
-	       mplayer( gtkClearStruct,0,(void *)(guiALL - guiVCD - guiFilenames) );
+	       guiInfoMediumClear( CLEAR_ALL - CLEAR_VCD - CLEAR_FILE );
 	       if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE );
 	       uiSetFileName( NULL,cdrom_device,STREAMTYPE_VCD );
 	       if ( guiInfo.Playing != GUI_PAUSE )
@@ -187,7 +211,7 @@ play:
 #endif
 #ifdef CONFIG_DVDREAD
           case STREAMTYPE_DVD:
-	       mplayer( gtkClearStruct,0,(void *)(guiALL - guiDVD - guiFilenames) );
+	       guiInfoMediumClear( CLEAR_ALL - CLEAR_DVD - CLEAR_FILE );
 	       if ( !dvd_device ) dvd_device=gstrdup( DEFAULT_DVD_DEVICE );
 	       uiSetFileName( NULL,dvd_device,STREAMTYPE_DVD );
 	       if ( guiInfo.Playing != GUI_PAUSE )


More information about the MPlayer-cvslog mailing list