Last active
August 29, 2015 14:05
-
-
Save jaseg/83d65e81729a45608770 to your computer and use it in GitHub Desktop.
Interfacing with mpv from python via ctypes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newton~ <3 ipython3 | |
Python 3.4.1 (default, May 19 2014, 17:23:49) | |
Type "copyright", "credits" or "license" for more information. | |
IPython 2.1.0 -- An enhanced Interactive Python. | |
? -> Introduction and overview of IPython's features. | |
%quickref -> Quick reference. | |
help -> Python's own help system. | |
object? -> Details about 'object', use 'object??' for extra details. | |
In [1]: import ctypes | |
In [2]: mpv = ctypes.CDLL('libmpv.so') | |
In [3]: mpv.mpv_create.restype = ctypes.c_void_p | |
In [4]: mpvh = mpv.mpv_create() | |
In [5]: mpv.mpv_initialize(mpvh) | |
Out[5]: 0 | |
In [6]: _TempArgT = ctypes.c_char_p*3 | |
In [7]: args = _TempArgT(b'loadfile', b'/data/jaseg/music/Tight Sweater by Marc Mellits (live cover).ogg', ctypes.c_char_p()) | |
In [8]: mpv.mpv_command(mpvh, args) | |
Out[8]: 0 | |
In [9]: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment