From 22291a25871a0268430231615be00edbcaf78790 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 20 Jun 2016 21:35:59 +0200 Subject: command: improve playlist* properties change notifications Until now, only the "playlist" property itself had proper change notification. Extend it to all other properties as well. Fixes #3267 (hopefully). --- player/command.c | 15 +++++++++------ player/command.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/player/command.c b/player/command.c index ac48a1147f..bc48d8cf2d 100644 --- a/player/command.c +++ b/player/command.c @@ -3950,7 +3950,10 @@ static const char *const *const mp_event_property_change[] = { "demuxer-cache-duration", "demuxer-cache-idle", "paused-for-cache", "demuxer-cache-time", "cache-buffering-state", "cache-speed"), E(MP_EVENT_WIN_RESIZE, "window-scale", "osd-width", "osd-height", "osd-par"), - E(MP_EVENT_WIN_STATE, "window-minimized", "display-names", "display-fps", "fullscreen"), + E(MP_EVENT_WIN_STATE, "window-minimized", "display-names", "display-fps", + "fullscreen"), + E(MP_EVENT_CHANGE_PLAYLIST, "playlist", "playlist-pos", "playlist-pos-1", + "playlist-count", "playlist/count"), }; #undef E @@ -4869,7 +4872,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re mp_write_watch_later_conf(mpctx); mp_set_playlist_entry(mpctx, entry); } - mp_notify_property(mpctx, "playlist"); + mp_notify(mpctx, MP_EVENT_CHANGE_PLAYLIST, NULL); break; } @@ -4888,7 +4891,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re if (!append && mpctx->playlist->first) mp_set_playlist_entry(mpctx, new ? new : mpctx->playlist->first); - mp_notify_property(mpctx, "playlist"); + mp_notify(mpctx, MP_EVENT_CHANGE_PLAYLIST, NULL); } else { MP_ERR(mpctx, "Unable to load playlist %s.\n", filename); return -1; @@ -4909,7 +4912,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re } playlist_remove(mpctx->playlist, e); } - mp_notify_property(mpctx, "playlist"); + mp_notify(mpctx, MP_EVENT_CHANGE_PLAYLIST, NULL); break; } @@ -4924,7 +4927,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re if (mpctx->playlist->current == e && !mpctx->stop_play) mpctx->stop_play = PT_CURRENT_ENTRY; playlist_remove(mpctx->playlist, e); - mp_notify_property(mpctx, "playlist"); + mp_notify(mpctx, MP_EVENT_CHANGE_PLAYLIST, NULL); break; } @@ -4936,7 +4939,7 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re if (!e1) return -1; playlist_move(mpctx->playlist, e1, e2); - mp_notify_property(mpctx, "playlist"); + mp_notify(mpctx, MP_EVENT_CHANGE_PLAYLIST, NULL); break; } diff --git a/player/command.h b/player/command.h index e65ffa0740..7c3994c39e 100644 --- a/player/command.h +++ b/player/command.h @@ -51,6 +51,7 @@ enum { MP_EVENT_CACHE_UPDATE, MP_EVENT_WIN_RESIZE, MP_EVENT_WIN_STATE, + MP_EVENT_CHANGE_PLAYLIST, }; bool mp_hook_test_completion(struct MPContext *mpctx, char *type); -- cgit v1.2.3