[vlc-commits] python: restore helper functions

Olivier Aubert git at videolan.org
Thu Apr 8 12:57:24 UTC 2021


vlc/python | branch: master | Olivier Aubert <contact at olivieraubert.net> | Thu Apr  8 14:56:08 2021 +0200| [723ef37632999c7995087c632798b946658d7bac] | committer: Olivier Aubert

python: restore helper functions

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

 generator/templates/header.py | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/generator/templates/header.py b/generator/templates/header.py
index e75fc2c..b5bc527 100755
--- a/generator/templates/header.py
+++ b/generator/templates/header.py
@@ -406,6 +406,36 @@ else:
     PyFile_AsFile.restype = FILE_ptr
     PyFile_AsFile.argtypes = [ctypes.py_object]
 
+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
+
+def track_description_list(head):
+    """Convert a TrackDescription linked list to a Python list (and release the former).
+    """
+    r = []
+    if head:
+        item = head
+        while item:
+            item = item.contents
+            r.append((item.id, item.name))
+            item = item.next
+        try:
+            libvlc_track_description_release(head)
+        except NameError:
+            libvlc_track_description_list_release(head)
+
+    return r
+
 # Generated enum types #
 # GENERATED_ENUMS go here  # see generate.py
 # End of generated enum types #



More information about the vlc-commits mailing list