Windows: Look for DLL in script directory
Loading DLLs through ctypes on Windows is a mess. ctypes looks in PATH, which is different from the Windows built-in DLL loading system. By default ctypes looks next to python.exe, but you might not want to install python script dependencies next to the system-wide python interpreter.
This commit adds a fallback looking for mpv-1.dll in the same directory the mpv.py script is placed in to allow people to use python-mpv with a minimum in configuration. You can still control loading behavior through PATH. For details on this, consult the following stackoverflow answer: https://stackoverflow.com/a/23805306
This allows you to directly feed bytes into mpv without going through a
file, FIFO etc. first. The new API is:
@player.register_stream_protocol(name)
@player.python_stream(name, size)
@player.python_stream_catchall
See their docstrings for their usage.
This change breaks the key binding API. Old code has to be modified to
add the new "char" parameter:
old:
player = mpv.MPV()
@player.key_binding('Q')
def binding(state, name):
print('blep')
new:
player = mpv.MPV()
@player.key_binding('Q')
def binding(state, name, char): # <<< here
print('blep')
Adapt key binding script message handling to be compatible with the new
key char parameter introduced upstream in
21f2468d67
This change is backwards-compatible. With older mpv versions this
parameter will be None.
key-binding message has key name parameter only since mpv version 0.15.0 (as stated in manual), therefore trying to bind keys with earlier versions results in TypeError: _handle_key_binding_message() missing 1 required positional argument: 'key_name'.
This change makes this argument optional and default to None.
This will break lots of stuff.
* Use MPV_FORMAT_NODE mostly everywhere
* Dynamically discover properties instead of using a static list
* Modify encoding handling to be more versatile