changeset 10591:0d381b648b51

Fix -cdrom-device to work again with cdda and vcd. Based on patch from Arwed von Merkatz.
author albeu
date Wed, 13 Aug 2003 11:18:24 +0000
parents 73e7a5165bcd
children 98c885b1ff06
files libmpdemux/cdda.c libmpdemux/stream_vcd.c
diffstat 2 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/cdda.c	Wed Aug 13 09:42:53 2003 +0000
+++ b/libmpdemux/cdda.c	Wed Aug 13 11:18:24 2003 +0000
@@ -12,6 +12,8 @@
 
 #include "cdd.h"
 
+extern char *cdrom_device;
+
 static struct cdda_params {
   int speed;
   int paranoia_mode;
@@ -32,7 +34,7 @@
   0,
   0,
   0,
-  DEFAULT_CDROM_DEVICE,
+  NULL,
   { 0, 0 }
 };
 
@@ -101,6 +103,13 @@
     return STREAM_UNSUPORTED;
   }
 
+  if(!p->device) {
+    if (cdrom_device)
+      p->device = strdup(cdrom_device);
+    else
+      p->device = strdup(DEFAULT_CDROM_DEVICE);
+  }
+
 #ifdef MPLAYER_NETWORK
   if(strncmp(st->url,"cddb",4) == 0) {
     i = cddb_resolve(p->device, &xmcd_file);
--- a/libmpdemux/stream_vcd.c	Wed Aug 13 09:42:53 2003 +0000
+++ b/libmpdemux/stream_vcd.c	Wed Aug 13 11:18:24 2003 +0000
@@ -23,12 +23,14 @@
 #include "vcd_read.h"
 #endif
 
+extern char *cdrom_device;
+
 static struct stream_priv_s {
   int track;
   char* device;
 } stream_priv_dflts = {
   1,
-  DEFAULT_CDROM_DEVICE
+  NULL
 };
 
 #define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f)
@@ -75,6 +77,13 @@
     return STREAM_UNSUPORTED;
   }
 
+  if (!p->device) {
+    if(cdrom_device)
+      p->device = strdup(cdrom_device);
+    else
+      p->device = strdup(DEFAULT_CDROM_DEVICE);
+  }
+
   f=open(p->device,O_RDONLY);
   if(f<0){ 
     mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CdDevNotfound,p->device);