]> git.sesse.net Git - vlc/commitdiff
python-ctypes: add support for media stats
authorOlivier Aubert <olivier.aubert@liris.cnrs.fr>
Mon, 23 Nov 2009 19:53:26 +0000 (20:53 +0100)
committerOlivier Aubert <olivier.aubert@liris.cnrs.fr>
Mon, 23 Nov 2009 19:53:44 +0000 (20:53 +0100)
bindings/python-ctypes/generate.py
bindings/python-ctypes/header.py

index 6804efd8ef07448a16e63c0efd2897da2e634250..bbf3de772537713680454f51621c835f3fb22b85 100755 (executable)
@@ -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',
index 4fc7193e7dc31050a37617ebac7c7be58f98a0c9..447ce8b5734133aa758c824d81672a4eaaf1ef17 100755 (executable)
@@ -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),