summaryrefslogtreecommitdiffstats
path: root/stream/stream_dvd.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-08 21:46:48 +0200
committerwm4 <wm4@nowhere>2016-09-08 21:46:48 +0200
commit5e30e7a04125e3c503160a76bbfe9361bff561fd (patch)
tree6aa17c781f70382471e331e4e9754aaf45ebe64b /stream/stream_dvd.c
parent35e8b6c1e68ae936ca0aeee4f30732cd13ef9932 (diff)
downloadmpv-5e30e7a04125e3c503160a76bbfe9361bff561fd.tar.bz2
mpv-5e30e7a04125e3c503160a76bbfe9361bff561fd.tar.xz
stream_dvd, stream_dvdnav: remove weird option parsing stuff
Same deal as with stream_bluray. Untested because I don't give a fuck about your shitty DVDs.
Diffstat (limited to 'stream/stream_dvd.c')
-rw-r--r--stream/stream_dvd.c62
1 files changed, 33 insertions, 29 deletions
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index 55cb6dfc7b..4b423de630 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -45,7 +45,7 @@
#define FIRST_PCM_AID 160
#include "stream.h"
-#include "options/m_option.h"
+#include "options/m_config.h"
#include "options/options.h"
#include "options/path.h"
@@ -109,18 +109,6 @@ typedef struct {
char *cfg_device;
} dvd_priv_t;
-static const dvd_priv_t stream_priv_dflts = {
- .cfg_title = 0,
-};
-
-#define OPT_BASE_STRUCT dvd_priv_t
-/// URL definition
-static const m_option_t stream_opts_fields[] = {
- OPT_INTRANGE("title", cfg_title, 0, 0, 99),
- OPT_STRING("device", cfg_device, 0),
- {0}
-};
-
static int dvd_lang_from_aid(stream_t *stream, int id) {
dvd_priv_t *d;
int i;
@@ -657,12 +645,15 @@ static int control(stream_t *stream,int cmd,void* arg)
}
-static int open_s(stream_t *stream)
+static int open_s_internal(stream_t *stream)
{
int k;
dvd_priv_t *d = stream->priv;
- d->dvd_angle = stream->opts->dvd_angle;
+ struct dvd_opts *opts =
+ mp_get_config_group(stream, stream->global, &dvd_conf);
+
+ d->dvd_angle = opts->angle;
MP_VERBOSE(stream, "URL: %s\n", stream->url);
d->dvd_title = d->cfg_title + 1;
@@ -680,11 +671,11 @@ static int open_s(stream_t *stream)
*/
if(d->cfg_device && d->cfg_device[0])
d->dvd_device_current = d->cfg_device;
- else if(stream->opts->dvd_device && stream->opts->dvd_device[0])
- d->dvd_device_current = talloc_strdup(stream, stream->opts->dvd_device);
+ else if(opts->device && opts->device[0])
+ d->dvd_device_current = talloc_strdup(stream, opts->device);
else
d->dvd_device_current = DEFAULT_DVD_DEVICE;
- d->dvd_speed = stream->opts->dvd_speed;
+ d->dvd_speed = opts->speed;
dvd_set_speed(stream,d->dvd_device_current, d->dvd_speed);
#if defined(__APPLE__) || defined(__DARWIN__)
/* Dynamic DVD drive selection on Darwin */
@@ -933,11 +924,32 @@ fail:
return STREAM_UNSUPPORTED;
}
+static int open_s(stream_t *stream)
+{
+ dvd_priv_t *d = talloc_zero(stream, dvd_priv_t);
+ stream->priv = d;
+
+ bstr title, bdevice;
+ bstr_split_tok(bstr0(stream->path), "/", &title, &bdevice);
+
+ if (title.len) {
+ bstr rest;
+ d->cfg_title = bstrtoll(title, &rest, 10);
+ if (rest.len) {
+ MP_ERR(stream, "number expected: '%.*s'\n", BSTR_P(rest));
+ return STREAM_ERROR;
+ }
+ }
+
+ d->cfg_device = bstrto0(d, bdevice);
+
+ return open_s_internal(stream);
+}
+
static int ifo_stream_open(stream_t *stream)
{
- dvd_priv_t *priv = talloc_ptrtype(stream, priv);
+ dvd_priv_t *priv = talloc_zero(stream, dvd_priv_t);
stream->priv = priv;
- *priv = stream_priv_dflts;
char *path = mp_file_get_path(priv, bstr0(stream->url));
if (!path)
@@ -958,7 +970,7 @@ static int ifo_stream_open(stream_t *stream)
priv->cfg_device = bstrto0(priv, mp_dirname(path));
MP_INFO(stream, ".IFO detected. Redirecting to dvdread://\n");
- return open_s(stream);
+ return open_s_internal(stream);
unsupported:
talloc_free(priv);
@@ -970,14 +982,6 @@ const stream_info_t stream_info_dvd = {
.name = "dvd",
.open = open_s,
.protocols = (const char*const[]){ "dvdread", NULL },
- .priv_size = sizeof(dvd_priv_t),
- .priv_defaults = &stream_priv_dflts,
- .options = stream_opts_fields,
- .url_options = (const char*const[]){
- "hostname=title",
- "filename=device",
- NULL
- },
};
const stream_info_t stream_info_ifo = {