changeset 34405:35fd66684548

Use cdparanoia compatibility names for CD function calls. Allow using cdparanoia (in the Wine port, for example).
author ib
date Tue, 03 Jan 2012 16:16:04 +0000
parents 95f802285711
children 2364585f3f1e
files gui/win32/gui.c gui/win32/interface.c
diffstat 2 files changed, 35 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/gui/win32/gui.c	Tue Jan 03 15:51:26 2012 +0000
+++ b/gui/win32/gui.c	Tue Jan 03 16:16:04 2012 +0000
@@ -848,7 +848,7 @@
             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 @@
                     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 @@
                             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 */
--- a/gui/win32/interface.c	Tue Jan 03 15:51:26 2012 +0000
+++ b/gui/win32/interface.c	Tue Jan 03 16:16:04 2012 +0000
@@ -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 @@
             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 @@
                 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;
         }