1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-23 07:12:39 +00:00

tv: remove weird option parsing stuff

Mostly untested.
This commit is contained in:
wm4 2016-09-09 17:36:01 +02:00
parent 9213db0d49
commit 5324fb731f
2 changed files with 14 additions and 23 deletions

View File

@ -27,13 +27,21 @@ static int demux_open_tv(demuxer_t *demuxer, enum demux_check check)
tv_param_t *params = mp_get_config_group(demuxer, demuxer->global,
&tv_params_conf);
struct tv_stream_params *sparams = demuxer->stream->priv;
if (sparams->channel && sparams->channel[0]) {
talloc_free(params->channel);
params->channel = talloc_strdup(NULL, sparams->channel);
bstr urlparams = bstr0(demuxer->stream->path);
bstr channel, input;
bstr_split_tok(urlparams, "/", &channel, &input);
if (channel.len) {
talloc_free(params->channels);
params->channel = bstrto0(NULL, channel);
}
if (input.len) {
bstr r;
params->input = bstrtoll(input, &r, 0);
if (r.len) {
MP_ERR(demuxer->stream, "invalid input: '%.*s'\n", BSTR_P(input));
return -1;
}
}
if (sparams->input >= 0)
params->input = sparams->input;
assert(demuxer->priv==NULL);
if(!(tvh=tv_begin(params, demuxer->log))) return -1;

View File

@ -31,13 +31,6 @@
#include <stdio.h>
#define OPT_BASE_STRUCT struct tv_stream_params
static const m_option_t stream_opts_fields[] = {
OPT_STRING("channel", channel, 0),
OPT_INT("input", input, 0),
{0}
};
static void
tv_stream_close (stream_t *stream)
{
@ -58,14 +51,4 @@ const stream_info_t stream_info_tv = {
.name = "tv",
.open = tv_stream_open,
.protocols = (const char*const[]){ "tv", NULL },
.priv_size = sizeof(tv_param_t),
.priv_defaults = &(const struct tv_stream_params){
.input = -1,
},
.options = stream_opts_fields,
.url_options = (const char*const[]){
"hostname=channel",
"filename=input",
NULL
},
};