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.
This commit is contained in:
Oliver Freyermuth 2019-10-01 23:49:40 +02:00
parent 9cd4638d2b
commit c408a48119
1 changed files with 17 additions and 0 deletions

View File

@ -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},