diff options
author | Oliver Freyermuth <o.freyermuth@googlemail.com> | 2019-10-01 23:49:40 +0200 |
---|---|---|
committer | Oliver Freyermuth <o.freyermuth@googlemail.com> | 2019-10-02 01:25:45 +0200 |
commit | c408a48119cecca71db0d06aff4aca7b4d9e84d7 (patch) | |
tree | 5bc0c9a42d8e5d3932f292698559b11842cb6ebc /player | |
parent | 9cd4638d2bed50130e6ebdcf37405438cb16a29b (diff) | |
download | mpv-c408a48119cecca71db0d06aff4aca7b4d9e84d7.tar.bz2 mpv-c408a48119cecca71db0d06aff4aca7b4d9e84d7.tar.xz |
player: Add mp_property_dvb_channel helper.
Reinitializes the player as is needed when
tuning to a new DVB channel.
Currently triggered when dvbin-prog is written to,
i.e. when the user explicity switches to a channel by name.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c index f97f699259..e0af394473 100644 --- a/player/command.c +++ b/player/command.c @@ -137,6 +137,8 @@ static int edit_filters(struct MPContext *mpctx, struct mp_log *log, static int set_filters(struct MPContext *mpctx, enum stream_type mediatype, struct m_obj_settings *new_chain); +static bool is_property_set(int action, void *val); + static int mp_property_do_silent(const char *name, int action, void *val, struct MPContext *ctx); @@ -2889,6 +2891,19 @@ static int mp_property_cursor_autohide(void *ctx, struct m_property *prop, return r; } +static int mp_property_dvb_channel(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + int r = mp_property_generic_option(mpctx, prop, action, arg); + if (r == M_PROPERTY_OK && is_property_set(action, arg)) { + if (!mpctx->stop_play) { + mpctx->stop_play = PT_CURRENT_ENTRY; + } + } + return r; +} + static int mp_property_playlist_pos_x(void *ctx, struct m_property *prop, int action, void *arg, int base) { @@ -3514,6 +3529,8 @@ static const struct m_property mp_properties_base[] = { {"track-list", property_list_tracks}, {"edition-list", property_list_editions}, + {"dvbin-prog", mp_property_dvb_channel}, + {"playlist", mp_property_playlist}, {"playlist-pos", mp_property_playlist_pos}, {"playlist-pos-1", mp_property_playlist_pos_1}, |