mirror of https://github.com/mpv-player/mpv
ba70b150fb
When the current file changes (or rather, when starting/finishing playback of a playlist entry), clients tend to have the problem that it's hard to tell whether a property change notification (via mpv_observe_property() and mechanisms layered on top of it) is from the previous or new playlist entry. The previous commit probably helps, but all the asynchronity is still a bit unhelpful. Try to make this better by adding new hooks, that are run before/after playback init/deinit. This is similar to the existing hooks, except they're outside of "initialized" playback, which excludes that you might accidentally get an overlap between the current and the previous/next playlist entry. That still doesn't seem quite enough, since normally, property change notifications come after the hook event. So basically a client would have to explicitly "drain" the event queue within the hook, and make the hook continue only after that is done. Knowing when property notifications are done is another asynchronous nightmare (how exactly it works keeps changing within client.c, and an API user probably can't tell anymore when all pending properties are truly done). So introduce another guarantee: properties that were changed before the hook happens will be returned before the hook event is returned. That means the client will have received all pending property notifications from the previous playlist entry (or whatever) before the hook is entered. As another minor complication, we shouldn't just keep the hook pending until _all_ property notifications are done, since the client's hook could produce new ones. (Or just consider things like the demuxer thread hammering the client with cache update events, while the "on_preloaded" hook is run.) So there is some extra untested, fragile logic in client.c to handle this (the waiting_for_hook flag). This probably works, but was barely tested. Not sure if this helps anyone, but I think it's fine for my own purposes. (I really hated this aspect of the API whenever I used it myself.) |
||
---|---|---|
.. | ||
README.md | ||
acompressor.lua | ||
ao-null-reload.lua | ||
audio-hotplug-test.lua | ||
autocrop.lua | ||
autodeint.lua | ||
autoload.lua | ||
command-test.lua | ||
cycle-deinterlace-pullup.lua | ||
nan-test.lua | ||
observe-all.lua | ||
ontop-playback.lua | ||
osd-test.lua | ||
pause-when-minimize.lua | ||
skip-logo.lua | ||
status-line.lua | ||
test-hooks.lua |
README.md
mpv lua scripts
The lua scripts in this folder can be loaded on a one-time basis by adding the option
--script=/path/to/script.lua
to mpv's command line.
Where appropriate, they may also be placed in ~/.config/mpv/scripts/ from where they will be automatically loaded when mpv starts.
This is only a small selection of internally maintained scripts. Some of them are just for testing mpv internals, or serve as examples. An extensive user-edited list of 3rd party scripts is available here:
https://github.com/mpv-player/mpv/wiki/User-Scripts
(Anyone can add their own scripts to that list.)