[vlc-commits] Implement FILE_ptr ctypes wrapper

Olivier Aubert git at videolan.org
Thu Jun 14 15:27:18 CEST 2012


vlc/python | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Fri Jun  8 16:12:08 2012 +0200| [6dbe80d2d387a5bb436ae5685d2c48c43072df52] | committer: Olivier Aubert

Implement FILE_ptr ctypes wrapper

> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=6dbe80d2d387a5bb436ae5685d2c48c43072df52
---

 header.py |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/header.py b/header.py
index ab017db..e5cca3f 100755
--- a/header.py
+++ b/header.py
@@ -234,6 +234,23 @@ def class_result(classname):
         return classname(result)
     return wrap_errcheck
 
+# FILE* ctypes wrapper, copied from
+# http://svn.python.org/projects/ctypes/trunk/ctypeslib/ctypeslib/contrib/pythonhdr.py
+class FILE(ctypes.Structure):
+    pass
+FILE_ptr = ctypes.POINTER(FILE)
+
+PyFile_FromFile = ctypes.pythonapi.PyFile_FromFile
+PyFile_FromFile.restype = ctypes.py_object
+PyFile_FromFile.argtypes = [FILE_ptr,
+                            ctypes.c_char_p,
+                            ctypes.c_char_p,
+                            ctypes.CFUNCTYPE(ctypes.c_int, FILE_ptr)]
+
+PyFile_AsFile = ctypes.pythonapi.PyFile_AsFile
+PyFile_AsFile.restype = FILE_ptr
+PyFile_AsFile.argtypes = [ctypes.py_object]
+
  # Generated enum types #
 # GENERATED_ENUMS go here  # see generate.py
  # End of generated enum types #



More information about the vlc-commits mailing list