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

Olivier Aubert olivier.aubert at liris.cnrs.fr
Tue Apr 20 15:32:06 CEST 2010


Thanks for reporting this. The change has been integrated in the git
tree.

Olivier

On Wed, 2010-04-14 at 15:43 +0200, Denis Charmet wrote:
> 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__':





More information about the vlc-devel mailing list