[vlc-commits] python bindings: wrap tracks_get to return the appropriate objects

Olivier Aubert git at videolan.org
Wed Jun 25 13:49:33 CEST 2014


vlc/python | branch: master | Olivier Aubert <contact at olivieraubert.net> | Wed Jun 25 13:49:06 2014 +0200| [51fb7496155913ebfe74fa665d2a6f9cff1dbdbb] | committer: Olivier Aubert

python bindings: wrap tracks_get to return the appropriate objects

Code contributed by Frederic Turmel <me at fredt.org>

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

 override.py |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/override.py b/override.py
index f431ea3..5869de4 100644
--- a/override.py
+++ b/override.py
@@ -157,6 +157,19 @@ class Media:
         for o in options:
             self.add_option(o)
 
+    def tracks_get(self):
+        """Get media descriptor's elementary streams description
+        Note, you need to call L{parse}() or play the media at least once
+        before calling this function.
+        Not doing this will result in an empty array.
+        The result must be freed with L{tracks_release}.
+        @version: LibVLC 2.1.0 and later.
+        """
+        mediaTrack_pp = ctypes.POINTER(MediaTrack)()
+        n = libvlc_media_tracks_get(self, byref(mediaTrack_pp))
+        info = cast(ctypes.mediaTrack_pp, ctypes.POINTER(ctypes.POINTER(MediaTrack) * n))
+        return info
+
 class MediaList:
     """Create a new MediaList instance.
     



More information about the vlc-commits mailing list