From c408a48119cecca71db0d06aff4aca7b4d9e84d7 Mon Sep 17 00:00:00 2001 From: Oliver Freyermuth Date: Tue, 1 Oct 2019 23:49:40 +0200 Subject: 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. --- player/command.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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}, -- cgit v1.2.3