changeset 34399:f2c03009068d

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.
author ib
date Mon, 02 Jan 2012 15:16:55 +0000
parents 9120eb514454
children 19b68f388735
files gui/interface.c gui/ui/actions.c gui/ui/actions.h gui/ui/main.c gui/win32/interface.c
diffstat 5 files changed, 19 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/gui/interface.c	Mon Jan 02 12:53:20 2012 +0000
+++ b/gui/interface.c	Mon Jan 02 15:16:55 2012 +0000
@@ -416,7 +416,7 @@
             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 @@
             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 @@
             char tmp[512];
 
             sprintf(tmp, "dvd://%d", guiInfo.Track);
-            uiSetFileName(NULL, tmp, STREAMTYPE_DVD);
+            uiSetFileName(NULL, tmp, SAME_STREAMTYPE);
         }
 
             dvd_chapter = guiInfo.Chapter;
--- a/gui/ui/actions.c	Mon Jan 02 12:53:20 2012 +0000
+++ b/gui/ui/actions.c	Mon Jan 02 15:16:55 2012 +0000
@@ -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 @@
         setddup(&guiInfo.Filename, dir, name);
 
     filename = guiInfo.Filename;
+
+    if (type != SAME_STREAMTYPE)
     guiInfo.StreamType = type;
 
     nfree(guiInfo.AudioFilename);
--- a/gui/ui/actions.h	Mon Jan 02 12:53:20 2012 +0000
+++ b/gui/ui/actions.h	Mon Jan 02 15:16:55 2012 +0000
@@ -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);
--- a/gui/ui/main.c	Mon Jan 02 12:53:20 2012 +0000
+++ b/gui/ui/main.c	Mon Jan 02 15:16:55 2012 +0000
@@ -198,7 +198,7 @@
 	 {
 	  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 @@
           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 @@
           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 @@
           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;
--- a/gui/win32/interface.c	Mon Jan 02 12:53:20 2012 +0000
+++ b/gui/win32/interface.c	Mon Jan 02 15:16:55 2012 +0000
@@ -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 @@
     // 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 @@
             {
                 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 @@
                     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