[vlc-devel] [PATCH] Fix callbackmethod prototype in python bindings

Denis Charmet typx at dinauz.org
Wed Apr 14 15:43:11 CEST 2010


Hello,

It seems that callbackmethod prototype is wrong, as it takes Event
object instead of ctypes.POINTER(Event), which cause the python callback
to be called with bad arguments.

-- 
TypX
Le mauvais esprit est un art de vivre

>From 1058d38af51a3b163305ea42f17c51e54153657e Mon Sep 17 00:00:00 2001
---
 footer.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/footer.py b/footer.py
index e95f36f..66a348f 100644
--- a/footer.py
+++ b/footer.py
@@ -34,13 +34,13 @@ class Event(ctypes.Structure):
         ]
 
 # Decorator for callback methods
-callbackmethod=ctypes.CFUNCTYPE(None, Event, ctypes.c_void_p)
+callbackmethod=ctypes.CFUNCTYPE(None, ctypes.POINTER(Event), ctypes.c_void_p)
 
 # Example callback method
 @callbackmethod
 def debug_callback(event, data):
     print "Debug callback method"
-    print "Event:", event.type
+    print "Event:", event.contents.type
     print "Data", data
 
 if __name__ == '__main__':
-- 
1.6.3.3




More information about the vlc-devel mailing list