[MPlayer-cvslog] r34493 - in trunk/gui/win32: gui.c interface.c

ib subversion at mplayerhq.hu
Tue Jan 3 17:16:04 CET 2012


Author: ib
Date: Tue Jan  3 17:16:04 2012
New Revision: 34493

Log:
Use cdparanoia compatibility names for CD function calls.

Allow using cdparanoia (in the Wine port, for example).

Modified:
   trunk/gui/win32/gui.c
   trunk/gui/win32/interface.c

Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c	Tue Jan  3 16:51:26 2012	(r34492)
+++ trunk/gui/win32/gui.c	Tue Jan  3 17:16:04 2012	(r34493)
@@ -848,7 +848,7 @@ static LRESULT CALLBACK EventProc(HWND h
             char device[MAX_PATH];
             char searchpath[MAX_PATH];
             char searchpath2[MAX_PATH];
-#ifdef CONFIG_LIBCDIO
+#ifdef CONFIG_CDDA
             char searchpath3[MAX_PATH];
 #endif
             int len, pos = 0, cdromdrive = 0;
@@ -870,14 +870,14 @@ static LRESULT CALLBACK EventProc(HWND h
                     mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] checking %s for CD/VCD/SVCD/DVDs\n", device + pos);
                     sprintf(searchpath, "%sVIDEO_TS", device + pos);
                     sprintf(searchpath2, "%sMpegav", device + pos);
-#ifdef CONFIG_LIBCDIO
+#ifdef CONFIG_CDDA
                     sprintf(searchpath3, "%sTrack01.cda", device + pos);
 #endif
                     if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
                         flags |= MF_ENABLED;
                     else if(GetFileAttributes(searchpath2) != INVALID_FILE_ATTRIBUTES)
                         flags |= MF_ENABLED;
-#ifdef CONFIG_LIBCDIO
+#ifdef CONFIG_CDDA
                     else if(GetFileAttributes(searchpath3) != INVALID_FILE_ATTRIBUTES)
                         flags |= MF_ENABLED;
 #endif
@@ -1061,7 +1061,7 @@ static LRESULT CALLBACK EventProc(HWND h
                             sprintf(searchpath, "%sTrack01.cda", device + pos);
                             if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
                             {
-#ifdef CONFIG_LIBCDIO
+#ifdef CONFIG_CDDA
                                 free(cdrom_device);
                                 cdrom_device = strdup(device + pos);
                                 /* mplayer doesn't seem to like the trailing \ after the device name */

Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c	Tue Jan  3 16:51:26 2012	(r34492)
+++ trunk/gui/win32/interface.c	Tue Jan  3 17:16:04 2012	(r34493)
@@ -21,6 +21,14 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "config.h"
+
+#if defined(CONFIG_LIBCDIO)
+#include <cdio/cdda.h>
+#elif defined(CONFIG_CDDA)
+#include <cdda_interface.h>
+#endif
+
 #include <windows.h>
 
 #if defined(__CYGWIN__) || defined(__WINE__)
@@ -62,9 +70,6 @@
 #include "mpcommon.h"
 #include "gui.h"
 #include "dialogs.h"
-#ifdef CONFIG_LIBCDIO
-#include <cdio/cdio.h>
-#endif
 
 #define SAME_STREAMTYPE (STREAMTYPE_DUMMY - 1)
 
@@ -227,17 +232,34 @@ static void guiSetEvent(int event)
             break;
         }
 #endif
-#ifdef CONFIG_LIBCDIO
+#ifdef CONFIG_CDDA
         case evPlayCD:
         {
             int i;
             char track[10];
             char trackname[10];
-            CdIo_t *p_cdio = cdio_open(NULL, DRIVER_UNKNOWN);
-            track_t i_tracks;
+#ifdef CONFIG_LIBCDIO
+            cdrom_drive_t *cd;
+#else
+            cdrom_drive *cd;
+#endif
+            int i_tracks;
 
-            if(p_cdio == NULL) printf("Couldn't find a driver.\n");
-            i_tracks = cdio_get_num_tracks(p_cdio);
+            cd = cdda_identify(cdrom_device, 0, NULL);
+            if (cd)
+            {
+                if (cdda_open(cd) != 0)
+                {
+                    cdda_close(cd);
+                    cd = NULL;
+                }
+            }
+            if(!cd)
+            {
+                printf("Couldn't find a driver.\n");
+                break;
+            }
+            i_tracks = cdda_tracks(cd);
 
             mygui->playlist->clear_playlist(mygui->playlist);
             for(i=0;i<i_tracks;i++)
@@ -246,7 +268,7 @@ static void guiSetEvent(int event)
                 sprintf(trackname, "Track %d", i+1);
                 mygui->playlist->add_track(mygui->playlist, track, NULL, trackname, 0);
             }
-            cdio_destroy(p_cdio);
+            cdda_close(cd);
             mygui->startplay(mygui);
             break;
         }


More information about the MPlayer-cvslog mailing list