[vlc-devel] commit: python-ctypes: add support for media stats (Olivier Aubert )

git version control git at videolan.org
Mon Nov 23 20:53:46 CET 2009


vlc | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Mon Nov 23 20:53:26 2009 +0100| [bcdc891a158a8fe52e34257ab3739ae37f539504] | committer: Olivier Aubert 

python-ctypes: add support for media stats

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

 bindings/python-ctypes/generate.py |    1 +
 bindings/python-ctypes/header.py   |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/bindings/python-ctypes/generate.py b/bindings/python-ctypes/generate.py
index 6804efd..bbf3de7 100755
--- a/bindings/python-ctypes/generate.py
+++ b/bindings/python-ctypes/generate.py
@@ -340,6 +340,7 @@ class PythonGenerator(object):
         'libvlc_media_list_view_t*': 'MediaListView',
         'libvlc_track_description_t*': 'TrackDescription',
         'libvlc_audio_output_t*': 'AudioOutput',
+        'libvlc_media_stats_t*': 'ctypes.POINTER(MediaStats)',
 
         'mediacontrol_Instance*': 'MediaControl',
         'mediacontrol_Exception*': 'MediaControlException',
diff --git a/bindings/python-ctypes/header.py b/bindings/python-ctypes/header.py
index 4fc7193..447ce8b 100755
--- a/bindings/python-ctypes/header.py
+++ b/bindings/python-ctypes/header.py
@@ -149,6 +149,28 @@ else:
         def clear(self):
             libvlc_exception_clear(self)
 
+class MediaStats(ctypes.Structure):
+    _fields_= [
+                ('read_bytes',          ctypes.c_int  ),
+                ('input_bitrate',       ctypes.c_float),
+                ('demux_read_bytes',    ctypes.c_int  ),
+                ('demux_bitrate',       ctypes.c_float),
+                ('demux_corrupted',     ctypes.c_int  ),
+                ('demux_discontinuity', ctypes.c_int  ),
+                ('decoded_video',       ctypes.c_int  ),
+                ('decoded_audio',       ctypes.c_int  ),
+                ('displayed_pictures',  ctypes.c_int  ),
+                ('lost_pictures',       ctypes.c_int  ),
+                ('played_abuffers',     ctypes.c_int  ),
+                ('lost_abuffers',       ctypes.c_int  ),
+                ('sent_packets',        ctypes.c_int  ),
+                ('sent_bytes',          ctypes.c_int  ),
+                ('send_bitrate',        ctypes.c_float),
+                ]
+
+    def __str__(self):
+        return "MediaStats\n%s" % "\n".join( "%s:\t%s" % (n, getattr(self, n)) for n in self._fields_ )
+
 class PlaylistItem(ctypes.Structure):
     _fields_= [
                 ('id', ctypes.c_int),




More information about the vlc-devel mailing list