summaryrefslogtreecommitdiffstats
path: root/demux/demux_tv.c
diff options
context:
space:
mode:
Diffstat (limited to 'demux/demux_tv.c')
-rw-r--r--demux/demux_tv.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/demux/demux_tv.c b/demux/demux_tv.c
index 4f1e3ac1c2..d80693e465 100644
--- a/demux/demux_tv.c
+++ b/demux/demux_tv.c
@@ -25,15 +25,23 @@ static int demux_open_tv(demuxer_t *demuxer, enum demux_check check)
if (check > DEMUX_CHECK_REQUEST || demuxer->stream->type != STREAMTYPE_TV)
return -1;
- tv_param_t *params = m_sub_options_copy(demuxer, &tv_params_conf,
- demuxer->opts->tv_params);
- 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);
+ tv_param_t *params = mp_get_config_group(demuxer, demuxer->global,
+ &tv_params_conf);
+ 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;