summaryrefslogtreecommitdiffstats
path: root/stream/stream_dvd.c
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-07-04 15:54:45 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-07-04 15:54:45 +0000
commit93b837f0a781e329ec1c06910226b1afd852931a (patch)
treeb2c432856bc6c468f833d938ac526c9e9008ffd5 /stream/stream_dvd.c
parent869e44fdcccf86a4b9b496ca95bdb02b99732383 (diff)
downloadmpv-93b837f0a781e329ec1c06910226b1afd852931a.tar.bz2
mpv-93b837f0a781e329ec1c06910226b1afd852931a.tar.xz
added support for the device part in the url; patch by
Mathieu SCHROETER mathieu.schroeter gamesover ch git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27195 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream/stream_dvd.c')
-rw-r--r--stream/stream_dvd.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index 85a0d6ba03..941cb824a2 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -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 @@ const char * const dvd_audio_stream_channels[6] = { "mono", "stereo", "unknown",
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 @@ void dvd_close(dvd_priv_t *d) {
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 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
/**
* 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 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
} 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;
}