[vlc-commits] commit: python-vlc: add support for module_description_list functions ( Olivier Aubert )

git at videolan.org git at videolan.org
Mon Jan 3 12:58:27 CET 2011


vlc/python | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Mon Jan  3 12:57:36 2011 +0100| [ffae4e3698106219805e08c01b9455f422fff30e] | committer: Olivier Aubert 

python-vlc: add support for module_description_list functions

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

 generate.py |    1 +
 header.py   |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/generate.py b/generate.py
index 09d052e..b8c95b0 100755
--- a/generate.py
+++ b/generate.py
@@ -694,6 +694,7 @@ class PythonGenerator(_Generator):
         'libvlc_rectangle_t*':         'ctypes.POINTER(Rectangle)',
         'libvlc_time_t':               'ctypes.c_longlong',
         'libvlc_track_description_t*': 'ctypes.POINTER(TrackDescription)',
+        'libvlc_module_description_t*': 'ctypes.POINTER(ModuleDescription)',
 
         '...':       'FIXME_va_list',
         'char*':     'ctypes.c_char_p',
diff --git a/header.py b/header.py
index 12143bd..8cee93e 100755
--- a/header.py
+++ b/header.py
@@ -358,5 +358,30 @@ class Event(ctypes.Structure):
         ('u',      EventUnion     ),
     ]
 
+class ModuleDescription(ctypes.Structure):
+    def __str__(self):
+        return '%s %s (%s)' % (self.__class__.__name__, self.shortname, self.name)
+
+ModuleDescription._fields_ = [  # recursive struct
+    ('name', ctypes.c_char_p),
+    ('shortname', ctypes.c_char_p),
+    ('longname', ctypes.c_char_p),
+    ('help', ctypes.c_char_p),
+    ('next', ctypes.POINTER(ModuleDescription)),
+    ]
+
+def module_description_list(head):
+    """Convert a ModuleDescription linked list to a Python list (and release the former).
+    """
+    r = []
+    if head:
+        item = head
+        while item:
+            item = item.contents
+            r.append((item.name, item.shortname, item.longname, item.help))
+            item = item.next
+        libvlc_module_description_list_release(head)
+    return r
+
  # End of header.py #
 



More information about the vlc-commits mailing list