summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/command.c1
-rw-r--r--stream/dvbin.h1
-rw-r--r--stream/stream_dvb.c7
3 files changed, 9 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index e0af394473..6e1fc94e8a 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3530,6 +3530,7 @@ static const struct m_property mp_properties_base[] = {
{"edition-list", property_list_editions},
{"dvbin-prog", mp_property_dvb_channel},
+ {"dvbin-channel-switch-offset", mp_property_dvb_channel},
{"playlist", mp_property_playlist},
{"playlist-pos", mp_property_playlist_pos},
diff --git a/stream/dvbin.h b/stream/dvbin.h
index 60b4070f04..eaeb68190d 100644
--- a/stream/dvbin.h
+++ b/stream/dvbin.h
@@ -121,6 +121,7 @@ typedef struct {
int cfg_timeout;
char *cfg_file;
int cfg_full_transponder;
+ int cfg_channel_switch_offset;
} dvb_opts_t;
typedef struct {
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c
index 5291ef9860..6f47aed2fc 100644
--- a/stream/stream_dvb.c
+++ b/stream/stream_dvb.c
@@ -78,6 +78,7 @@ const struct m_sub_options stream_dvb_conf = {
OPT_INTRANGE("timeout", cfg_timeout, 0, 1, 30),
OPT_STRING("file", cfg_file, M_OPT_FILE),
OPT_FLAG("full-transponder", cfg_full_transponder, 0),
+ OPT_INT("channel-switch-offset", cfg_channel_switch_offset, 0),
{0}
},
.size = sizeof(dvb_opts_t),
@@ -1044,6 +1045,12 @@ static int dvb_streaming_start(stream_t *stream, char *progname)
}
list->current = i;
+
+ // When switching channels, cfg_channel_switch_offset
+ // keeps the offset to the initially chosen channel.
+ list->current = (list->NUM_CHANNELS + list->current + priv->opts->cfg_channel_switch_offset) % list->NUM_CHANNELS;
+ channel = &(list->channels[list->current]);
+ MP_INFO(stream, "Tuning to channel \"%s\"...\n", channel->name);
MP_VERBOSE(stream, "PROGRAM NUMBER %d: name=%s, freq=%u\n", i,
channel->name, channel->freq);