mirror of
https://github.com/mpv-player/mpv
synced 2024-12-29 02:22:19 +00:00
player: send MPV_EVENT_TICK during init for the sake of the osc
The OSC's (osc.lua) event handling is fundamentally broken. It waits for MPV_EVENT_TICK to update the UI, and MPV_EVENT_TICK has become entirely meaningless, except as a hack for the OSC. There are many situations where the OSC doesn't properly update because the TICK event it expects isn't sent. Fix one of them: it doesn't update the cache state if the VO window is forced and --demuxer-cache-wait is used. Make it so that the tick event is sent even if playback initialization is taking time. This is still slightly broken, because it works only if the mainloop is actually run, which depends on random circumstances (such as moving the mouse over the VO window). The next commit will add another such circumstance which will make it appear to work, although it's still conceptually broken. If we "fixed" it and strictly woke up the player if the idle timer ran out, we'd send tick events all the time, even if nothing is going on, which we don't want. Fucking shitshow.
This commit is contained in:
parent
f08387c552
commit
eb951835ff
@ -945,7 +945,10 @@ err:
|
||||
// Potentially needed by some Lua scripts, which assume TICK always comes.
|
||||
static void handle_dummy_ticks(struct MPContext *mpctx)
|
||||
{
|
||||
if (mpctx->video_status == STATUS_EOF || mpctx->paused) {
|
||||
if ((mpctx->video_status != STATUS_PLAYING &&
|
||||
mpctx->video_status != STATUS_DRAINING) ||
|
||||
mpctx->paused)
|
||||
{
|
||||
if (mp_time_sec() - mpctx->last_idle_tick > 0.050) {
|
||||
mpctx->last_idle_tick = mp_time_sec();
|
||||
mp_notify(mpctx, MPV_EVENT_TICK, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user