summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mpv.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/mpv.py b/mpv.py
index 08e9cdd..674e204 100644
--- a/mpv.py
+++ b/mpv.py
@@ -18,6 +18,9 @@ else:
class MpvHandle(c_void_p):
pass
+class MpvOpenGLCbContext(c_void_p):
+ pass
+
class ErrorCode(object):
""" For documentation on these, see mpv's libmpv/client.h """
@@ -111,6 +114,9 @@ class MpvEventID(c_int):
CLIENT_MESSAGE, VIDEO_RECONFIG, AUDIO_RECONFIG, METADATA_UPDATE, SEEK, PLAYBACK_RESTART, PROPERTY_CHANGE,
CHAPTER_CHANGE )
+class MpvSubApi(c_int):
+ MPV_SUB_API_OPENGL_CB = 1
+
class MpvEvent(Structure):
_fields_ = [('event_id', MpvEventID),
('error', c_int),
@@ -181,12 +187,14 @@ class MpvEventClientMessage(Structure):
WakeupCallback = CFUNCTYPE(None, c_void_p)
+OpenGlCbUpdateFn = CFUNCTYPE(None, c_void_p)
+OpenGlCbGetProcAddrFn = CFUNCTYPE(None, c_void_p, c_char_p)
-def _handle_func(name, args=[], res=None):
+def _handle_func(name, args=[], res=None, context=MpvHandle):
func = getattr(backend, name)
if res is not None:
func.restype = res
- func.argtypes = [MpvHandle] + args
+ func.argtypes = [context] + args
def wrapper(*args):
if res is not None:
return func(*args)
@@ -194,6 +202,9 @@ def _handle_func(name, args=[], res=None):
ErrorCode.raise_for_ec(func, *args)
globals()['_'+name] = wrapper
+def _handle_gl_func(name, args=[], res=None):
+ _handle_func(name, args, res, MpvOpenGLCbContext)
+
backend.mpv_client_api_version.restype = c_ulong
def _mpv_client_api_version():
ver = backend.mpv_client_api_version()
@@ -247,6 +258,15 @@ _handle_func('mpv_wakeup', [], c_int)
_handle_func('mpv_set_wakeup_callback', [WakeupCallback, c_void_p], c_int)
_handle_func('mpv_get_wakeup_pipe', [], c_int)
+_handle_func('mpv_get_sub_api', [MpvSubApi], c_void_p)
+
+_handle_gl_func('mpv_opengl_cb_set_update_callback', [OpenGlCbUpdateFn, c_void_p])
+_handle_gl_func('mpv_opengl_cb_init_gl', [c_char_p, OpenGlCbGetProcAddrFn, c_void_p], c_int)
+_handle_gl_func('mpv_opengl_cb_draw', [c_int, c_int, c_int], c_int);
+_handle_gl_func('mpv_opengl_cb_render', [c_int, c_int], c_int);
+_handle_gl_func('mpv_opengl_cb_report_flip', [c_ulonglong], c_int);
+_handle_gl_func('mpv_opengl_cb_uninit_gl', [], c_int);
+
class ynbool(object):
def __init__(self, val=False):