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

ib subversion at mplayerhq.hu
Mon Jan 2 16:16:55 CET 2012


Author: ib
Date: Mon Jan  2 16:16:55 2012
New Revision: 34487

Log:
Don't explicitly set stream type if the type doesn't change.

Use a self-explanatory symbolic constant which makes the code
more easily understandable.

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

Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c	Mon Jan  2 13:53:20 2012	(r34486)
+++ trunk/gui/interface.c	Mon Jan  2 16:16:55 2012	(r34487)
@@ -416,7 +416,7 @@ int gui(int what, void *data)
             char tmp[512];
 
             sprintf(tmp, "cdda://%d", guiInfo.Track);
-            uiSetFileName(NULL, tmp, STREAMTYPE_CDDA);
+            uiSetFileName(NULL, tmp, SAME_STREAMTYPE);
         }
         break;
 #endif
@@ -427,7 +427,7 @@ int gui(int what, void *data)
             char tmp[512];
 
             sprintf(tmp, "vcd://%d", guiInfo.Track);
-            uiSetFileName(NULL, tmp, STREAMTYPE_VCD);
+            uiSetFileName(NULL, tmp, SAME_STREAMTYPE);
         }
         break;
 #endif
@@ -438,7 +438,7 @@ int gui(int what, void *data)
             char tmp[512];
 
             sprintf(tmp, "dvd://%d", guiInfo.Track);
-            uiSetFileName(NULL, tmp, STREAMTYPE_DVD);
+            uiSetFileName(NULL, tmp, SAME_STREAMTYPE);
         }
 
             dvd_chapter = guiInfo.Chapter;

Modified: trunk/gui/ui/actions.c
==============================================================================
--- trunk/gui/ui/actions.c	Mon Jan  2 13:53:20 2012	(r34486)
+++ trunk/gui/ui/actions.c	Mon Jan  2 16:16:55 2012	(r34487)
@@ -37,7 +37,6 @@
 #include "libmpcodecs/vd.h"
 #include "libvo/video_out.h"
 #include "mp_core.h"
-#include "stream/stream.h"
 
 int uiGotoTheNext = 1;
 
@@ -227,6 +226,8 @@ void uiSetFileName(char *dir, char *name
         setddup(&guiInfo.Filename, dir, name);
 
     filename = guiInfo.Filename;
+
+    if (type != SAME_STREAMTYPE)
     guiInfo.StreamType = type;
 
     nfree(guiInfo.AudioFilename);

Modified: trunk/gui/ui/actions.h
==============================================================================
--- trunk/gui/ui/actions.h	Mon Jan  2 13:53:20 2012	(r34486)
+++ trunk/gui/ui/actions.h	Mon Jan  2 16:16:55 2012	(r34487)
@@ -19,6 +19,10 @@
 #ifndef MPLAYER_GUI_ACTIONS_H
 #define MPLAYER_GUI_ACTIONS_H
 
+#include "stream/stream.h"
+
+#define SAME_STREAMTYPE (STREAMTYPE_DUMMY - 1)
+
 extern int uiGotoTheNext;
 
 void uiAbsSeek(float sec);

Modified: trunk/gui/ui/main.c
==============================================================================
--- trunk/gui/ui/main.c	Mon Jan  2 13:53:20 2012	(r34486)
+++ trunk/gui/ui/main.c	Mon Jan  2 16:16:55 2012	(r34487)
@@ -198,7 +198,7 @@ play:
 	 {
 	  plItem * next = listSet( gtkGetCurrPlItem,NULL );
 	  plLastPlayed=next;
-	  uiSetFileName( next->path,next->name,STREAMTYPE_FILE );
+	  uiSetFileName( next->path,next->name,SAME_STREAMTYPE );
 	 }
 
         switch ( guiInfo.StreamType )
@@ -214,7 +214,7 @@ play:
           case STREAMTYPE_CDDA:
 	       guiInfoMediumClear( CLEAR_ALL - CLEAR_VCD - CLEAR_FILE );
 	       if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE );
-	       uiSetFileName( NULL,cdrom_device,STREAMTYPE_CDDA );
+	       uiSetFileName( NULL,cdrom_device,SAME_STREAMTYPE );
 	       if ( guiInfo.Playing != GUI_PAUSE )
 	        {
 		 if ( !guiInfo.Track )
@@ -227,7 +227,7 @@ play:
           case STREAMTYPE_VCD:
 	       guiInfoMediumClear( CLEAR_ALL - CLEAR_VCD - CLEAR_FILE );
 	       if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE );
-	       uiSetFileName( NULL,cdrom_device,STREAMTYPE_VCD );
+	       uiSetFileName( NULL,cdrom_device,SAME_STREAMTYPE );
 	       if ( guiInfo.Playing != GUI_PAUSE )
 	        {
 		 if ( !guiInfo.Track )
@@ -240,7 +240,7 @@ play:
           case STREAMTYPE_DVD:
 	       guiInfoMediumClear( CLEAR_ALL - CLEAR_DVD - CLEAR_FILE );
 	       if ( !dvd_device ) dvd_device=gstrdup( DEFAULT_DVD_DEVICE );
-	       uiSetFileName( NULL,dvd_device,STREAMTYPE_DVD );
+	       uiSetFileName( NULL,dvd_device,SAME_STREAMTYPE );
 	       if ( guiInfo.Playing != GUI_PAUSE )
 	        {
                  guiInfo.NewPlay=GUI_FILE_SAME;

Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c	Mon Jan  2 13:53:20 2012	(r34486)
+++ trunk/gui/win32/interface.c	Mon Jan  2 16:16:55 2012	(r34487)
@@ -66,6 +66,8 @@
 #include <cdio/cdio.h>
 #endif
 
+#define SAME_STREAMTYPE (STREAMTYPE_DUMMY - 1)
+
 int guiWinID = 0;
 
 char *skinName = NULL;
@@ -441,6 +443,8 @@ void uiSetFileName(char *dir, char *name
     // it will find the filename in the Linux filesystem.
     filename = unix_name(filename);
 #endif
+
+    if (type != SAME_STREAMTYPE)
     guiInfo.StreamType = type;
 
     nfree(guiInfo.AudioFilename);
@@ -561,7 +565,7 @@ int gui(int what, void *data)
             {
                 case STREAMTYPE_FILE:
                 case STREAMTYPE_STREAM:
-                    uiSetFileName(NULL, mygui->playlist->tracks[mygui->playlist->current]->filename, STREAMTYPE_FILE);
+                    uiSetFileName(NULL, mygui->playlist->tracks[mygui->playlist->current]->filename, SAME_STREAMTYPE);
                     guiInfo.Track = mygui->playlist->current + 1;
                     break;
 #ifdef CONFIG_DVDREAD
@@ -571,7 +575,7 @@ int gui(int what, void *data)
                     dvd_chapter = guiInfo.Chapter;
                     dvd_angle = guiInfo.Angle;
                     sprintf(tmp,"dvd://%d", guiInfo.Track);
-                    uiSetFileName(NULL, tmp, STREAMTYPE_DVD);
+                    uiSetFileName(NULL, tmp, SAME_STREAMTYPE);
                     break;
                 }
 #endif


More information about the MPlayer-cvslog mailing list