[MPlayer-cvslog] r27195 - trunk/stream/stream_dvd.c
nicodvb
subversion at mplayerhq.hu
Fri Jul 4 17:54:45 CEST 2008
Author: nicodvb
Date: Fri Jul 4 17:54:45 2008
New Revision: 27195
Log:
added support for the device part in the url; patch by
Mathieu SCHROETER mathieu.schroeter gamesover ch
Modified:
trunk/stream/stream_dvd.c
Modified: trunk/stream/stream_dvd.c
==============================================================================
--- trunk/stream/stream_dvd.c (original)
+++ trunk/stream/stream_dvd.c Fri Jul 4 17:54:45 2008
@@ -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_chan
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 m
/**
* 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 m
} 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;
}
More information about the MPlayer-cvslog
mailing list