vlc/python | branch: master | Jean Brouwers <[email protected]> | Tue Dec 7 18:20:46 2010 +0100| [feb35a182efe6cf006b804a1aa489fa7cb248a64] | committer: Olivier Aubert
python-vlc: override video_get_cursor/_get_size definitions so that the video parameter is optional. Signed-off-by: Olivier Aubert <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=feb35a182efe6cf006b804a1aa489fa7cb248a64 --- override.py | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) diff --git a/override.py b/override.py index ea81196..4ac7a2e 100644 --- a/override.py +++ b/override.py @@ -169,6 +169,17 @@ class MediaPlayer: #PYCHOK expected (comment is lost) """ return track_description_list(libvlc_audio_get_track_description(self)) + def video_get_size(self, num=0): + """Get the video size in pixels as 2-tuple (width, height). + + @param num: video number (default 0). + """ + r = libvlc_video_get_size(self, num) + if isinstance(r, tuple) and len(r) == 2: + return r + else: + raise VLCException('invalid video number (%s)' % (num,)) + def video_get_width(self, num=0): """Get the width of a video in pixels. @@ -183,6 +194,30 @@ class MediaPlayer: #PYCHOK expected (comment is lost) """ return self.video_get_size(num)[1] + def video_get_cursor(self, num=0): + """Get the mouse pointer coordinates over a video as 2-tuple (x, y). + + Coordinates are expressed in terms of the decoded video resolution, + B{not} in terms of pixels on the screen/viewport. To get the + latter, you must query your windowing system directly. + + Either coordinate may be negative or larger than the corresponding + size of the video, if the cursor is outside the rendering area. + + @warning: The coordinates may be out-of-date if the pointer is not + located on the video rendering area. LibVLC does not track the + mouse pointer if the latter is outside the video widget. + + @note: LibVLC does not support multiple mouse pointers (but does + support multiple input devices sharing the same pointer). + + @param num: video number (default 0). + """ + r = libvlc_video_get_cursor(self, num) + if isinstance(r, tuple) and len(r) == 2: + return r + raise VLCException('invalid video number (%s)' % (num,)) + class MediaListPlayer: """Create a new MediaListPlayer instance. _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
