mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 14:52:43 +00:00
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).
This commit is contained in:
parent
fc50f3772c
commit
22291a2587
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user