changeset 27163:704a4fdb762a

added support for the device part in the url; patch by Mathieu SCHROETER mathieu.schroeter gamesover ch
author nicodvb
date Fri, 04 Jul 2008 15:54:45 +0000
parents 045b7646abb2
children 4c4ce3ecf125
files stream/stream_dvd.c
diffstat 1 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_dvd.c	Fri Jul 04 15:47:31 2008 +0000
+++ b/stream/stream_dvd.c	Fri Jul 04 15:54:45 2008 +0000
@@ -42,6 +42,7 @@
 #include "libavutil/intreadwrite.h"
 
 extern char* dvd_device;
+static char* dvd_device_current;
 int dvd_angle=1;
 int dvd_speed=0; /* 0 => don't touch speed */
 
@@ -138,14 +139,17 @@
 
 static struct stream_priv_s {
   int title;
+  char* device;
 } stream_priv_dflts = {
-  1
+  1,
+  NULL
 };
 
 #define ST_OFF(f) M_ST_OFF(struct stream_priv_s,f)
 /// URL definition
 static const m_option_t stream_opts_fields[] = {
   { "hostname", ST_OFF(title), CONF_TYPE_INT, M_OPT_MIN, 1, 0, NULL },
+  { "filename", ST_OFF(device), CONF_TYPE_STRING, 0, 0 ,0, NULL},
   { NULL, NULL, 0, 0, 0, 0,  NULL }
 };
 static const struct m_struct_st stream_opts = {
@@ -484,7 +488,7 @@
   DVDClose(d->dvd);
   dvd_chapter = 1;
   dvd_last_chapter = 0;
-  dvd_set_speed(dvd_device, -1); /* -1 => restore default */
+  dvd_set_speed(dvd_device_current, -1); /* -1 => restore default */
 }
 
 static int fill_buffer(stream_t *s, char *but, int len)
@@ -781,13 +785,18 @@
     /**
      * Open the disc.
      */
-    if(!dvd_device) dvd_device=strdup(DEFAULT_DVD_DEVICE);
-    dvd_set_speed(dvd_device, dvd_speed);
+    if(p->device)
+      dvd_device_current = p->device;
+    else if(dvd_device)
+      dvd_device_current = dvd_device;
+    else
+      dvd_device_current = strdup(DEFAULT_DVD_DEVICE);
+    dvd_set_speed(dvd_device_current, dvd_speed);
 #if defined(__APPLE__) || defined(__DARWIN__)
     /* Dynamic DVD drive selection on Darwin */
-    if(!strcmp(dvd_device, "/dev/rdiskN")) {
+    if(!strcmp(dvd_device_current, "/dev/rdiskN")) {
       int i;
-      size_t len = strlen(dvd_device)+1;
+      size_t len = strlen(dvd_device_current)+1;
       char *temp_device = malloc(len);
 
       for (i = 1; i < 10; i++) {
@@ -817,9 +826,9 @@
     } else
 #endif /* defined(__APPLE__) || defined(__DARWIN__) */
     {
-        dvd = DVDOpen(dvd_device);
+        dvd = DVDOpen(dvd_device_current);
         if(!dvd) {
-          mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,dvd_device, strerror(errno));
+          mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,dvd_device_current, strerror(errno));
           m_struct_free(&stream_opts,opts);
           return STREAM_UNSUPPORTED;
         }