jaseg / python-mpv

Python interface to the awesome mpv media player
https://git.jaseg.de/python-mpv.git
Other
554 stars 69 forks source link

Possibility to get this working under Windows #2

Closed Amaranthes closed 8 years ago

Amaranthes commented 8 years ago

Is it possible to get this working with lachs0r's Windows build of libmpv? (It's included in the Dev package).

I've tried changing every CDDL to WinDLL and every CFUNCTYPE to WINFUNCTYPE but it did not work.

I get the following exception:

Traceback (most recent call last):
  File "E:\libmpv-test\start.py", line 4, in <module>
    mp = mpv.MPV()
  File "E:\libmpv-test\mpv.py", line 271, in __init__
    self._event_fd = _mpv_get_wakeup_pipe(self.handle)
  File "E:\libmpv-test\mpv.py", line 172, in wrapper
    return func(*args)
ValueError: Procedure probably called with too many arguments (4 bytes in excess)

while executing the following code:

import mpv
m = mpv.MPV()

I would appreciate any help.

jaseg commented 8 years ago

You were a bit hasty there ;)

There is no need to replace CDLL with WinDLL as even on Windows, libmpv is linked using a MinGW/gnu toolchain and the resulting library uses the cdecl calling convention that is supported via CDLL.

After I got that running, I ran into the problem that on Windows, mpv does not support the eventfd mechanism that I was super-cleverly using with asyncio. I now just patched out the asyncio stuff, and it now works for me on Windows after replacing libmpv.so with mpv-1.dll. Only video output does not work properly, but that's probably due to my VM setup and not caused by this script.

Try getting the version I just pushed to master and tell me whether this works for you.

Amaranthes commented 8 years ago

A quick test with

m = mpv.MPV()
m.loadfile("file.mkv")

properly opens the player.

Thank you very much! :)