[Mplayer-cvslog] CVS: main/libmpdemux open.c,1.68,1.69

Michael Niedermayer CVS michael at mplayerhq.hu
Wed Mar 5 11:56:50 CET 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv31361/libmpdemux

Modified Files:
	open.c 
Log Message:
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)



Index: open.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/open.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- open.c	5 Jan 2003 23:51:05 -0000	1.68
+++ open.c	5 Mar 2003 10:56:47 -0000	1.69
@@ -221,10 +221,33 @@
      * Open the disc.
      */
     if(!dvd_device) dvd_device=strdup(DEFAULT_DVD_DEVICE);
-    dvd = DVDOpen(dvd_device);
-    if( !dvd ) {
-        mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,dvd_device);
-        return NULL;
+#ifdef SYS_DARWIN
+    /* Dynamic DVD drive selection on Darwin */
+    if (!strcmp(dvd_device, "/dev/rdiskN")) {
+	int i;
+	char *temp_device = malloc((strlen(dvd_device)+1)*sizeof(char));
+	
+	for (i = 1; i < 10; i++) {
+	    sprintf(temp_device, "/dev/rdisk%d", i);
+	    dvd = DVDOpen(temp_device);
+	    if (!dvd) {
+	        mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,temp_device);
+	    } else {
+	        free(temp_device);
+	        break;
+	    }
+	}
+	
+	if (!dvd)
+	    return NULL;
+    } else
+#endif /* SYS_DARWIN */
+    {
+        dvd = DVDOpen(dvd_device);
+	if( !dvd ) {
+	    mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,dvd_device);
+	    return NULL;
+	}
     }
 
     mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_DVDwait);



More information about the MPlayer-cvslog mailing list