From bdd8ef820a64faeb8fd1fd48b1c50cbcb4519389 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 25 Oct 2015 23:00:57 +0100 Subject: [PATCH] Feature: update vlc.py from upstream --- openlp/core/ui/media/vendor/vlc.py | 1126 +++++++++++++++++++++++----- 1 file changed, 925 insertions(+), 201 deletions(-) diff --git a/openlp/core/ui/media/vendor/vlc.py b/openlp/core/ui/media/vendor/vlc.py index f56d3ef56..4065825ee 100644 --- a/openlp/core/ui/media/vendor/vlc.py +++ b/openlp/core/ui/media/vendor/vlc.py @@ -5,7 +5,7 @@ # Copyright (C) 2009-2012 the VideoLAN team # $Id: $ # -# Authors: Olivier Aubert +# Authors: Olivier Aubert # Jean Brouwers # Geoff Salmon # @@ -43,12 +43,18 @@ import ctypes from ctypes.util import find_library import os import sys +import functools # Used by EventManager in override.py from inspect import getargspec __version__ = "N/A" -build_date = "Wed Jun 25 13:46:01 2014" +build_date = "Wed Sep 30 15:51:48 2015" + +# The libvlc doc states that filenames are expected to be in UTF8, do +# not rely on sys.getfilesystemencoding() which will be confused, +# esp. on windows. +DEFAULT_ENCODING = 'utf-8' if sys.version_info[0] > 2: str = str @@ -60,7 +66,7 @@ if sys.version_info[0] > 2: """Translate string or bytes to bytes. """ if isinstance(s, str): - return s.encode() + return bytes(s, DEFAULT_ENCODING) else: return s @@ -68,7 +74,7 @@ if sys.version_info[0] > 2: """Translate bytes to string. """ if isinstance(b, bytes): - return b.decode(sys.getfilesystemencoding()) + return b.decode(DEFAULT_ENCODING) else: return b else: @@ -81,7 +87,7 @@ else: """Translate string or bytes to bytes. """ if isinstance(s, unicode): - return s.encode(sys.getfilesystemencoding()) + return s.encode(DEFAULT_ENCODING) else: return s @@ -89,7 +95,7 @@ else: """Translate bytes to unicode string. """ if isinstance(b, str): - return unicode(b, sys.getfilesystemencoding()) + return unicode(b, DEFAULT_ENCODING) else: return b @@ -177,6 +183,35 @@ except NameError: # no long in Python 3+ _Ints = int _Seqs = (list, tuple) +# Used for handling *event_manager() methods. +class memoize_parameterless(object): + """Decorator. Caches a parameterless method's return value each time it is called. + + If called later with the same arguments, the cached value is returned + (not reevaluated). + Adapted from https://wiki.python.org/moin/PythonDecoratorLibrary + """ + def __init__(self, func): + self.func = func + self._cache = {} + + def __call__(self, obj): + try: + return self._cache[obj] + except KeyError: + v = self._cache[obj] = self.func(obj) + return v + + def __repr__(self): + """Return the function's docstring. + """ + return self.func.__doc__ + + def __get__(self, obj, objtype): + """Support instance methods. + """ + return functools.partial(self.__call__, obj) + # Default instance. It is used to instanciate classes directly in the # OO-wrapper. _default_instance = None @@ -390,10 +425,20 @@ class EventType(_Enum): 273: 'MediaPlayerLengthChanged', 274: 'MediaPlayerVout', 275: 'MediaPlayerScrambledChanged', + 276: 'MediaPlayerESAdded', + 277: 'MediaPlayerESDeleted', + 278: 'MediaPlayerESSelected', + 279: 'MediaPlayerCorked', + 280: 'MediaPlayerUncorked', + 281: 'MediaPlayerMuted', + 282: 'MediaPlayerUnmuted', + 283: 'MediaPlayerAudioVolume', + 284: 'MediaPlayerAudioDevice', 0x200: 'MediaListItemAdded', 513: 'MediaListWillAddItem', 514: 'MediaListItemDeleted', 515: 'MediaListWillDeleteItem', + 516: 'MediaListEndReached', 0x300: 'MediaListViewItemAdded', 769: 'MediaListViewWillAddItem', 770: 'MediaListViewItemDeleted', @@ -419,6 +464,7 @@ EventType.MediaDiscovererEnded = EventType(1281) EventType.MediaDiscovererStarted = EventType(0x500) EventType.MediaDurationChanged = EventType(2) EventType.MediaFreed = EventType(4) +EventType.MediaListEndReached = EventType(516) EventType.MediaListItemAdded = EventType(0x200) EventType.MediaListItemDeleted = EventType(514) EventType.MediaListPlayerNextItemSet = EventType(1025) @@ -432,13 +478,20 @@ EventType.MediaListWillAddItem = EventType(513) EventType.MediaListWillDeleteItem = EventType(515) EventType.MediaMetaChanged = EventType(0) EventType.MediaParsedChanged = EventType(3) +EventType.MediaPlayerAudioDevice = EventType(284) +EventType.MediaPlayerAudioVolume = EventType(283) EventType.MediaPlayerBackward = EventType(264) EventType.MediaPlayerBuffering = EventType(259) +EventType.MediaPlayerCorked = EventType(279) +EventType.MediaPlayerESAdded = EventType(276) +EventType.MediaPlayerESDeleted = EventType(277) +EventType.MediaPlayerESSelected = EventType(278) EventType.MediaPlayerEncounteredError = EventType(266) EventType.MediaPlayerEndReached = EventType(265) EventType.MediaPlayerForward = EventType(263) EventType.MediaPlayerLengthChanged = EventType(273) EventType.MediaPlayerMediaChanged = EventType(0x100) +EventType.MediaPlayerMuted = EventType(281) EventType.MediaPlayerNothingSpecial = EventType(257) EventType.MediaPlayerOpening = EventType(258) EventType.MediaPlayerPausableChanged = EventType(270) @@ -451,6 +504,8 @@ EventType.MediaPlayerSnapshotTaken = EventType(272) EventType.MediaPlayerStopped = EventType(262) EventType.MediaPlayerTimeChanged = EventType(267) EventType.MediaPlayerTitleChanged = EventType(271) +EventType.MediaPlayerUncorked = EventType(280) +EventType.MediaPlayerUnmuted = EventType(282) EventType.MediaPlayerVout = EventType(274) EventType.MediaStateChanged = EventType(5) EventType.MediaSubItemAdded = EventType(1) @@ -494,15 +549,19 @@ class Meta(_Enum): 20: 'Episode', 21: 'ShowName', 22: 'Actors', + 23: 'AlbumArtist', + 24: 'DiscNumber', } Meta.Actors = Meta(22) Meta.Album = Meta(4) +Meta.AlbumArtist = Meta(23) Meta.Artist = Meta(1) Meta.ArtworkURL = Meta(15) Meta.Copyright = Meta(3) Meta.Date = Meta(8) Meta.Description = Meta(6) Meta.Director = Meta(18) +Meta.DiscNumber = Meta(24) Meta.EncodedBy = Meta(14) Meta.Episode = Meta(20) Meta.Genre = Meta(2) @@ -560,6 +619,40 @@ TrackType.text = TrackType(2) TrackType.unknown = TrackType(-1) TrackType.video = TrackType(1) +class MediaType(_Enum): + '''Media type +See libvlc_media_get_type. + ''' + _enum_names_ = { + 0: 'unknown', + 1: 'file', + 2: 'directory', + 3: 'disc', + 4: 'stream', + 5: 'playlist', + } +MediaType.directory = MediaType(2) +MediaType.disc = MediaType(3) +MediaType.file = MediaType(1) +MediaType.playlist = MediaType(5) +MediaType.stream = MediaType(4) +MediaType.unknown = MediaType(0) + +class MediaParseFlag(_Enum): + '''Parse flags used by libvlc_media_parse_with_options() +See libvlc_media_parse_with_options. + ''' + _enum_names_ = { + 0x00: 'local', + 0x01: 'network', + 0x02: 'local', + 0x04: 'network', + } +MediaParseFlag.local = MediaParseFlag(0x00) +MediaParseFlag.local = MediaParseFlag(0x02) +MediaParseFlag.network = MediaParseFlag(0x01) +MediaParseFlag.network = MediaParseFlag(0x04) + class PlaybackMode(_Enum): '''Defines playback modes for playlist. ''' @@ -730,7 +823,7 @@ class Callback(ctypes.c_void_p): class LogCb(ctypes.c_void_p): """Callback prototype for LibVLC log message handler. \param data data pointer as given to L{libvlc_log_set}() -\param level message level (@ref enum libvlc_log_level) +\param level message level (@ref libvlc_log_level) \param ctx message context (meta-information about the message) \param fmt printf() format string (as defined by ISO C11) \param args variable argument list for the format @@ -739,6 +832,49 @@ class LogCb(ctypes.c_void_p): variable arguments are only valid until the callback returns. """ pass +class MediaOpenCb(ctypes.c_void_p): + """Callback prototype to open a custom bitstream input media. +The same media item can be opened multiple times. Each time, this callback +is invoked. It should allocate and initialize any instance-specific +resources, then store them in *datap. The instance resources can be freed +in the @ref libvlc_media_close_cb callback. +\param opaque private pointer as passed to L{libvlc_media_new_callbacks}() +\param datap storage space for a private data pointer [OUT] +\param sizep byte length of the bitstream or UINT64_MAX if unknown [OUT] +\note For convenience, *datap is initially NULL and *sizep is initially 0. +\return 0 on success, non-zero on error. In case of failure, the other +callbacks will not be invoked and any value stored in *datap and *sizep is +discarded. + """ + pass +class MediaReadCb(ctypes.c_void_p): + """Callback prototype to read data from a custom bitstream input media. +\param opaque private pointer as set by the @ref libvlc_media_open_cb + callback +\param buf start address of the buffer to read data into +\param len bytes length of the buffer +\return strictly positive number of bytes read, 0 on end-of-stream, + or -1 on non-recoverable error +\note If no data is immediately available, then the callback should sleep. +\warning The application is responsible for avoiding deadlock situations. +In particular, the callback should return an error if playback is stopped; +if it does not return, then L{libvlc_media_player_stop}() will never return. + """ + pass +class MediaSeekCb(ctypes.c_void_p): + """Callback prototype to seek a custom bitstream input media. +\param opaque private pointer as set by the @ref libvlc_media_open_cb + callback +\param offset absolute byte offset to seek to +\return 0 on success, -1 on error. + """ + pass +class MediaCloseCb(ctypes.c_void_p): + """Callback prototype to close a custom bitstream input media. +\param opaque private pointer as set by the @ref libvlc_media_open_cb + callback + """ + pass class VideoLockCb(ctypes.c_void_p): """Callback prototype to allocate and lock a picture buffer. Whenever a new video frame needs to be decoded, the lock callback is @@ -796,7 +932,7 @@ the number of bytes per pixel multiplied by the pixel width. Similarly, the number of scanlines must be bigger than of equal to the pixel height. Furthermore, we recommend that pitches and lines be multiple of 32 -to not break assumption that might be made by various optimizations +to not break assumptions that might be held by optimized code in the video decoders, video filters and/or video converters. """ pass @@ -873,7 +1009,7 @@ class CallbackDecorators(object): LogCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, Log_ptr, ctypes.c_char_p, ctypes.c_void_p) LogCb.__doc__ = '''Callback prototype for LibVLC log message handler. \param data data pointer as given to L{libvlc_log_set}() -\param level message level (@ref enum libvlc_log_level) +\param level message level (@ref libvlc_log_level) \param ctx message context (meta-information about the message) \param fmt printf() format string (as defined by ISO C11) \param args variable argument list for the format @@ -881,6 +1017,45 @@ class CallbackDecorators(object): \warning The message context pointer, the format string parameters and the variable arguments are only valid until the callback returns. ''' + MediaOpenCb = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_int), ctypes.c_void_p, ListPOINTER(ctypes.c_void_p), ctypes.POINTER(ctypes.c_uint64)) + MediaOpenCb.__doc__ = '''Callback prototype to open a custom bitstream input media. +The same media item can be opened multiple times. Each time, this callback +is invoked. It should allocate and initialize any instance-specific +resources, then store them in *datap. The instance resources can be freed +in the @ref libvlc_media_close_cb callback. +\param opaque private pointer as passed to L{libvlc_media_new_callbacks}() +\param datap storage space for a private data pointer [OUT] +\param sizep byte length of the bitstream or UINT64_MAX if unknown [OUT] +\note For convenience, *datap is initially NULL and *sizep is initially 0. +\return 0 on success, non-zero on error. In case of failure, the other +callbacks will not be invoked and any value stored in *datap and *sizep is +discarded. + ''' + MediaReadCb = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_ssize_t), ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t) + MediaReadCb.__doc__ = '''Callback prototype to read data from a custom bitstream input media. +\param opaque private pointer as set by the @ref libvlc_media_open_cb + callback +\param buf start address of the buffer to read data into +\param len bytes length of the buffer +\return strictly positive number of bytes read, 0 on end-of-stream, + or -1 on non-recoverable error +\note If no data is immediately available, then the callback should sleep. +\warning The application is responsible for avoiding deadlock situations. +In particular, the callback should return an error if playback is stopped; +if it does not return, then L{libvlc_media_player_stop}() will never return. + ''' + MediaSeekCb = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_int), ctypes.c_void_p, ctypes.c_uint64) + MediaSeekCb.__doc__ = '''Callback prototype to seek a custom bitstream input media. +\param opaque private pointer as set by the @ref libvlc_media_open_cb + callback +\param offset absolute byte offset to seek to +\return 0 on success, -1 on error. + ''' + MediaCloseCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p) + MediaCloseCb.__doc__ = '''Callback prototype to close a custom bitstream input media. +\param opaque private pointer as set by the @ref libvlc_media_open_cb + callback + ''' VideoLockCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ListPOINTER(ctypes.c_void_p)) VideoLockCb.__doc__ = '''Callback prototype to allocate and lock a picture buffer. Whenever a new video frame needs to be decoded, the lock callback is @@ -935,7 +1110,7 @@ the number of bytes per pixel multiplied by the pixel width. Similarly, the number of scanlines must be bigger than of equal to the pixel height. Furthermore, we recommend that pitches and lines be multiple of 32 -to not break assumption that might be made by various optimizations +to not break assumptions that might be held by optimized code in the video decoders, video filters and/or video converters. ''' VideoCleanupCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p) @@ -1183,12 +1358,15 @@ class EventUnion(ctypes.Union): ('new_status', ctypes.c_int ), ('media', ctypes.c_void_p ), ('new_state', ctypes.c_uint ), - # Media instance + # FIXME: Media instance + ('new_cache', ctypes.c_float ), ('new_position', ctypes.c_float ), ('new_time', ctypes.c_longlong), ('new_title', ctypes.c_int ), ('new_seekable', ctypes.c_longlong), ('new_pausable', ctypes.c_longlong), + ('new_scrambled', ctypes.c_longlong), + ('new_count', ctypes.c_longlong), # FIXME: Skipped MediaList and MediaListView... ('filename', ctypes.c_char_p ), ('new_length', ctypes.c_longlong), @@ -1239,6 +1417,20 @@ AudioOutputDevice._fields_ = [ # recursive struct ('description', ctypes.c_char_p), ] +class TitleDescription(_Cstruct): + _fields = [ + ('duration', ctypes.c_longlong), + ('name', ctypes.c_char_p), + ('menu', ctypes.c_bool), + ] + +class ChapterDescription(_Cstruct): + _fields = [ + ('time_offset', ctypes.c_longlong), + ('duration', ctypes.c_longlong), + ('name', ctypes.c_char_p), + ] + # End of header.py # class EventManager(_Ctype): @@ -1384,13 +1576,14 @@ class Instance(_Ctype): local path. If you need more control, directly use media_new_location/media_new_path methods. - Options can be specified as supplementary string parameters, e.g. + Options can be specified as supplementary string parameters, + but note that many options cannot be set at the media level, + and rather at the Instance level. For instance, the marquee + filter must be specified when creating the vlc.Instance or + vlc.MediaPlayer. - C{m = i.media_new('foo.avi', 'sub-filter=marq{marquee=Hello}', 'vout-filter=invert')} - - Alternatively, the options can be added to the media using the Media.add_options method: - - C{m.add_options('foo.avi', 'sub-filter=marq@test{marquee=Hello}', 'video-filter=invert')} + Alternatively, options can be added to the media using the + Media.add_options method (with the same limitation). @param options: optional media option=value strings """ @@ -1450,25 +1643,29 @@ class Instance(_Ctype): return module_description_list(libvlc_video_filter_list_get(self)) + def release(self): '''Decrement the reference count of a libvlc instance, and destroy it if it reaches zero. ''' return libvlc_release(self) + def retain(self): '''Increments the reference count of a libvlc instance. The initial reference count is 1 after L{new}() returns. ''' return libvlc_retain(self) + def add_intf(self, name): '''Try to start a user interface for the libvlc instance. - @param name: interface name, or NULL for default. + @param name: interface name, or None for default. @return: 0 on success, -1 on error. ''' return libvlc_add_intf(self, str_to_bytes(name)) + def set_user_agent(self, name, http): '''Sets the application name. LibVLC passes this as the user agent string when a protocol requires it. @@ -1478,6 +1675,7 @@ class Instance(_Ctype): ''' return libvlc_set_user_agent(self, str_to_bytes(name), str_to_bytes(http)) + def set_app_id(self, id, version, icon): '''Sets some meta-information about the application. See also L{set_user_agent}(). @@ -1488,6 +1686,7 @@ class Instance(_Ctype): ''' return libvlc_set_app_id(self, str_to_bytes(id), str_to_bytes(version), str_to_bytes(icon)) + def log_unset(self): '''Unsets the logging callback for a LibVLC instance. This is rarely needed: the callback is implicitly unset when the instance is destroyed. @@ -1497,6 +1696,7 @@ class Instance(_Ctype): ''' return libvlc_log_unset(self) + def log_set(self, data, p_instance): '''Sets the logging callback for a LibVLC instance. This function is thread-safe: it will wait for any pending callbacks @@ -1507,6 +1707,7 @@ class Instance(_Ctype): ''' return libvlc_log_set(self, data, p_instance) + def log_set_file(self, stream): '''Sets up logging to a file. @param stream: FILE pointer opened for writing (the FILE pointer must remain valid until L{log_unset}()). @@ -1514,6 +1715,7 @@ class Instance(_Ctype): ''' return libvlc_log_set_file(self, stream) + def media_new_location(self, psz_mrl): '''Create a media with a certain given media resource location, for instance a valid URL. @@ -1523,18 +1725,20 @@ class Instance(_Ctype): local files. See L{media_release}. @param psz_mrl: the media location. - @return: the newly created media or NULL on error. + @return: the newly created media or None on error. ''' return libvlc_media_new_location(self, str_to_bytes(psz_mrl)) + def media_new_path(self, path): '''Create a media for a certain file path. See L{media_release}. @param path: local filesystem path. - @return: the newly created media or NULL on error. + @return: the newly created media or None on error. ''' return libvlc_media_new_path(self, str_to_bytes(path)) + def media_new_fd(self, fd): '''Create a media for an already open file descriptor. The file descriptor shall be open for reading (or reading and writing). @@ -1550,42 +1754,70 @@ class Instance(_Ctype): descriptor should probably be rewound to the beginning with lseek(). See L{media_release}. @param fd: open file descriptor. - @return: the newly created media or NULL on error. + @return: the newly created media or None on error. @version: LibVLC 1.1.5 and later. ''' return libvlc_media_new_fd(self, fd) + + def media_new_callbacks(self, open_cb, read_cb, seek_cb, close_cb, opaque): + '''Create a media with custom callbacks to read the data from. + @param open_cb: callback to open the custom bitstream input media. + @param read_cb: callback to read data (must not be None). + @param seek_cb: callback to seek, or None if seeking is not supported. + @param close_cb: callback to close the media, or None if unnecessary. + @param opaque: data pointer for the open callback. + @return: the newly created media or None on error @note If open_cb is None, the opaque pointer will be passed to read_cb, seek_cb and close_cb, and the stream size will be treated as unknown. @note The callbacks may be called asynchronously (from another thread). A single stream instance need not be reentrant. However the open_cb needs to be reentrant if the media is used by multiple player instances. @warning The callbacks may be used until all or any player instances that were supplied the media item are stopped. See L{media_release}. + @version: LibVLC 3.0.0 and later. + ''' + return libvlc_media_new_callbacks(self, open_cb, read_cb, seek_cb, close_cb, opaque) + + def media_new_as_node(self, psz_name): '''Create a media as an empty node with a given name. See L{media_release}. @param psz_name: the name of the node. - @return: the new empty media or NULL on error. + @return: the new empty media or None on error. ''' return libvlc_media_new_as_node(self, str_to_bytes(psz_name)) - def media_discoverer_new_from_name(self, psz_name): - '''Discover media service by name. + + def media_discoverer_new(self, psz_name): + '''Create a media discoverer object by name. + After this object is created, you should attach to events in order to be + notified of the discoverer state. + You should also attach to media_list events in order to be notified of new + items discovered. + You need to call L{media_discoverer_start}() in order to start the + discovery. + See L{media_discoverer_media_list} + See L{media_discoverer_event_manager} + See L{media_discoverer_start}. @param psz_name: service name. - @return: media discover object or NULL in case of error. + @return: media discover object or None in case of error. + @version: LibVLC 3.0.0 or later. ''' - return libvlc_media_discoverer_new_from_name(self, str_to_bytes(psz_name)) + return libvlc_media_discoverer_new(self, str_to_bytes(psz_name)) + def media_library_new(self): '''Create an new Media Library object. - @return: a new object or NULL on error. + @return: a new object or None on error. ''' return libvlc_media_library_new(self) + def audio_output_list_get(self): '''Gets the list of available audio output modules. - @return: list of available audio outputs. It must be freed it with In case of error, NULL is returned. + @return: list of available audio outputs. It must be freed with In case of error, None is returned. ''' return libvlc_audio_output_list_get(self) + def audio_output_device_list_get(self, aout): '''Gets a list of audio output devices for a given audio output module, See L{audio_output_device_set}(). - @note: Not all audio outputs support this. In particular, an empty (NULL) + @note: Not all audio outputs support this. In particular, an empty (None) list of devices does B{not} imply that the specified audio output does not work. @note: The list might not be exhaustive. @@ -1593,16 +1825,18 @@ class Instance(_Ctype): some circumstances. By default, it is recommended to not specify any explicit audio device. @param psz_aout: audio output name (as returned by L{audio_output_list_get}()). - @return: A NULL-terminated linked list of potential audio output devices. It must be freed it with L{audio_output_device_list_release}(). + @return: A None-terminated linked list of potential audio output devices. It must be freed with L{audio_output_device_list_release}(). @version: LibVLC 2.1.0 or later. ''' return libvlc_audio_output_device_list_get(self, str_to_bytes(aout)) + def vlm_release(self): '''Release the vlm instance related to the given L{Instance}. ''' return libvlc_vlm_release(self) + def vlm_add_broadcast(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Add a broadcast, with one input. @param psz_name: the name of the new broadcast. @@ -1616,6 +1850,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_add_broadcast(self, str_to_bytes(psz_name), str_to_bytes(psz_input), str_to_bytes(psz_output), i_options, ppsz_options, b_enabled, b_loop) + def vlm_add_vod(self, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux): '''Add a vod, with one input. @param psz_name: the name of the new vod media. @@ -1628,6 +1863,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_add_vod(self, str_to_bytes(psz_name), str_to_bytes(psz_input), i_options, ppsz_options, b_enabled, str_to_bytes(psz_mux)) + def vlm_del_media(self, psz_name): '''Delete a media (VOD or broadcast). @param psz_name: the media to delete. @@ -1635,6 +1871,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_del_media(self, str_to_bytes(psz_name)) + def vlm_set_enabled(self, psz_name, b_enabled): '''Enable or disable a media (VOD or broadcast). @param psz_name: the media to work on. @@ -1643,6 +1880,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_set_enabled(self, str_to_bytes(psz_name), b_enabled) + def vlm_set_output(self, psz_name, psz_output): '''Set the output for a media. @param psz_name: the media to work on. @@ -1651,6 +1889,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_set_output(self, str_to_bytes(psz_name), str_to_bytes(psz_output)) + def vlm_set_input(self, psz_name, psz_input): '''Set a media's input MRL. This will delete all existing inputs and add the specified one. @@ -1660,6 +1899,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_set_input(self, str_to_bytes(psz_name), str_to_bytes(psz_input)) + def vlm_add_input(self, psz_name, psz_input): '''Add a media's input MRL. This will add the specified one. @param psz_name: the media to work on. @@ -1668,6 +1908,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_add_input(self, str_to_bytes(psz_name), str_to_bytes(psz_input)) + def vlm_set_loop(self, psz_name, b_loop): '''Set a media's loop status. @param psz_name: the media to work on. @@ -1676,6 +1917,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_set_loop(self, str_to_bytes(psz_name), b_loop) + def vlm_set_mux(self, psz_name, psz_mux): '''Set a media's vod muxer. @param psz_name: the media to work on. @@ -1684,6 +1926,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_set_mux(self, str_to_bytes(psz_name), str_to_bytes(psz_mux)) + def vlm_change_media(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Edit the parameters of a media. This will delete all existing inputs and add the specified one. @@ -1698,6 +1941,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_change_media(self, str_to_bytes(psz_name), str_to_bytes(psz_input), str_to_bytes(psz_output), i_options, ppsz_options, b_enabled, b_loop) + def vlm_play_media(self, psz_name): '''Play the named broadcast. @param psz_name: the name of the broadcast. @@ -1705,6 +1949,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_play_media(self, str_to_bytes(psz_name)) + def vlm_stop_media(self, psz_name): '''Stop the named broadcast. @param psz_name: the name of the broadcast. @@ -1712,6 +1957,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_stop_media(self, str_to_bytes(psz_name)) + def vlm_pause_media(self, psz_name): '''Pause the named broadcast. @param psz_name: the name of the broadcast. @@ -1719,6 +1965,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_pause_media(self, str_to_bytes(psz_name)) + def vlm_seek_media(self, psz_name, f_percentage): '''Seek in the named broadcast. @param psz_name: the name of the broadcast. @@ -1727,6 +1974,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_seek_media(self, str_to_bytes(psz_name), f_percentage) + def vlm_show_media(self, psz_name): '''Return information about the named media as a JSON string representation. @@ -1737,10 +1985,11 @@ class Instance(_Ctype): Currently there are no such functions available for vlm_media_t though. @param psz_name: the name of the media, if the name is an empty string, all media is described. - @return: string with information about named media, or NULL on error. + @return: string with information about named media, or None on error. ''' return libvlc_vlm_show_media(self, str_to_bytes(psz_name)) + def vlm_get_media_instance_position(self, psz_name, i_instance): '''Get vlm_media instance position by name or instance id. @param psz_name: name of vlm media instance. @@ -1749,6 +1998,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_position(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_time(self, psz_name, i_instance): '''Get vlm_media instance time by name or instance id. @param psz_name: name of vlm media instance. @@ -1757,6 +2007,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_time(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_length(self, psz_name, i_instance): '''Get vlm_media instance length by name or instance id. @param psz_name: name of vlm media instance. @@ -1765,6 +2016,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_length(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_rate(self, psz_name, i_instance): '''Get vlm_media instance playback rate by name or instance id. @param psz_name: name of vlm media instance. @@ -1773,6 +2025,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_rate(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_title(self, psz_name, i_instance): '''Get vlm_media instance title number by name or instance id. @param psz_name: name of vlm media instance. @@ -1782,6 +2035,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_title(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_chapter(self, psz_name, i_instance): '''Get vlm_media instance chapter number by name or instance id. @param psz_name: name of vlm media instance. @@ -1791,6 +2045,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_chapter(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_seekable(self, psz_name, i_instance): '''Is libvlc instance seekable ? @param psz_name: name of vlm media instance. @@ -1800,6 +2055,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_seekable(self, str_to_bytes(psz_name), i_instance) + @memoize_parameterless def vlm_get_event_manager(self): '''Get libvlc_event_manager from a vlm media. The p_event_manager is immutable, so you don't have to hold the lock. @@ -1833,13 +2089,10 @@ class Media(_Ctype): def add_options(self, *options): """Add a list of options to the media. - Options must be written without the double-dash, e.g.: - - C{m.add_options('sub-filter=marq@test{marquee=Hello}', 'video-filter=invert')} - - Alternatively, the options can directly be passed in the Instance.media_new method: - - C{m = instance.media_new('foo.avi', 'sub-filter=marq@test{marquee=Hello}', 'video-filter=invert')} + Options must be written without the double-dash. Warning: most + audio and video options, such as text renderer, have no + effects on an individual media. These options must be set at + the vlc.Instance or vlc.MediaPlayer instanciation. @param options: optional media option=value strings """ @@ -1855,11 +2108,12 @@ class Media(_Ctype): @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)) + n = libvlc_media_tracks_get(self, ctypes.byref(mediaTrack_pp)) + info = ctypes.cast(ctypes.mediaTrack_pp, ctypes.POINTER(ctypes.POINTER(MediaTrack) * n)) return info + def add_option(self, psz_options): '''Add an option to the media. This option will be used to determine how the media_player will @@ -1876,6 +2130,7 @@ class Media(_Ctype): ''' return libvlc_media_add_option(self, str_to_bytes(psz_options)) + def add_option_flag(self, psz_options, i_flags): '''Add an option to the media with configurable flags. This option will be used to determine how the media_player will @@ -1891,6 +2146,7 @@ class Media(_Ctype): ''' return libvlc_media_add_option_flag(self, str_to_bytes(psz_options), i_flags) + def retain(self): '''Retain a reference to a media descriptor object (libvlc_media_t). Use L{release}() to decrement the reference count of a @@ -1898,6 +2154,7 @@ class Media(_Ctype): ''' return libvlc_media_retain(self) + def release(self): '''Decrement the reference count of a media descriptor object. If the reference count is 0, then L{release}() will release the @@ -1907,20 +2164,23 @@ class Media(_Ctype): ''' return libvlc_media_release(self) + def get_mrl(self): '''Get the media resource locator (mrl) from a media descriptor object. @return: string with mrl of media descriptor object. ''' return libvlc_media_get_mrl(self) + def duplicate(self): '''Duplicate a media descriptor object. ''' return libvlc_media_duplicate(self) + def get_meta(self, e_meta): '''Read the meta of the media. - If the media has not yet been parsed this will return NULL. + If the media has not yet been parsed this will return None. This methods automatically calls L{parse_async}(), so after calling it you may receive a libvlc_MediaMetaChanged event. If you prefer a synchronous version ensure that you call L{parse}() before get_meta(). @@ -1932,6 +2192,7 @@ class Media(_Ctype): ''' return libvlc_media_get_meta(self, e_meta) + def set_meta(self, e_meta, psz_value): '''Set the meta of the media (this function will not save the meta, call L{save_meta} in order to save the meta). @@ -1940,12 +2201,14 @@ class Media(_Ctype): ''' return libvlc_media_set_meta(self, e_meta, str_to_bytes(psz_value)) + def save_meta(self): '''Save the meta previously set. @return: true if the write operation was successful. ''' return libvlc_media_save_meta(self) + def get_state(self): '''Get current state of media descriptor object. Possible media states are defined in libvlc_structures.c ( libvlc_NothingSpecial=0, @@ -1957,6 +2220,7 @@ class Media(_Ctype): ''' return libvlc_media_get_state(self) + def get_stats(self, p_stats): '''Get the current statistics about the media. @param p_stats:: structure that contain the statistics about the media (this structure must be allocated by the caller). @@ -1964,14 +2228,16 @@ class Media(_Ctype): ''' return libvlc_media_get_stats(self, p_stats) + def subitems(self): '''Get subitems of media descriptor object. This will increment the reference count of supplied media descriptor object. Use L{list_release}() to decrement the reference counting. - @return: list of media descriptor subitems or NULL. + @return: list of media descriptor subitems or None. ''' return libvlc_media_subitems(self) + @memoize_parameterless def event_manager(self): '''Get event manager from media descriptor object. NOTE: this function doesn't increment reference counting. @@ -1979,15 +2245,17 @@ class Media(_Ctype): ''' return libvlc_media_event_manager(self) + def get_duration(self): '''Get duration (in ms) of media descriptor object item. @return: duration of media item or -1 on error. ''' return libvlc_media_get_duration(self) + def parse(self): '''Parse a media. - This fetches (local) meta data and tracks information. + This fetches (local) art, meta data and tracks information. The method is synchronous. See L{parse_async} See L{get_meta} @@ -1995,9 +2263,10 @@ class Media(_Ctype): ''' return libvlc_media_parse(self) + def parse_async(self): '''Parse a media. - This fetches (local) meta data and tracks information. + This fetches (local) art, meta data and tracks information. The method is the asynchronous of L{parse}(). To track when this is over you can listen to libvlc_MediaParsedChanged event. However if the media was already parsed you will not receive this @@ -2009,6 +2278,28 @@ class Media(_Ctype): ''' return libvlc_media_parse_async(self) + + def parse_with_options(self, parse_flag): + '''Parse the media asynchronously with options. + This fetches (local or network) art, meta data and/or tracks information. + This method is the extended version of L{parse_async}(). + To track when this is over you can listen to libvlc_MediaParsedChanged + event. However if this functions returns an error, you will not receive this + event. + It uses a flag to specify parse options (see libvlc_media_parse_flag_t). All + these flags can be combined. By default, media is parsed if it's a local + file. + See libvlc_MediaParsedChanged + See L{get_meta} + See L{tracks_get} + See libvlc_media_parse_flag_t. + @param parse_flag: parse options: + @return: -1 in case of error, 0 otherwise. + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_media_parse_with_options(self, parse_flag) + + def is_parsed(self): '''Get Parsed status for media descriptor object. See libvlc_MediaParsedChanged. @@ -2016,6 +2307,7 @@ class Media(_Ctype): ''' return libvlc_media_is_parsed(self) + def set_user_data(self, p_new_user_data): '''Sets media descriptor's user_data. user_data is specialized data accessed by the host application, VLC.framework uses it as a pointer to @@ -2024,6 +2316,7 @@ class Media(_Ctype): ''' return libvlc_media_set_user_data(self, p_new_user_data) + def get_user_data(self): '''Get media descriptor's user_data. user_data is specialized data accessed by the host application, VLC.framework uses it as a pointer to @@ -2031,9 +2324,18 @@ class Media(_Ctype): ''' return libvlc_media_get_user_data(self) + + def get_type(self): + '''Get the media type of the media descriptor object. + @return: media type. + @version: LibVLC 3.0.0 and later. See libvlc_media_type_t. + ''' + return libvlc_media_get_type(self) + + def player_new_from_media(self): '''Create a Media Player object from a Media. - @return: a new media player object, or NULL on error. + @return: a new media player object, or None on error. ''' return libvlc_media_player_new_from_media(self) @@ -2045,30 +2347,54 @@ class MediaDiscoverer(_Ctype): '''(INTERNAL) ctypes wrapper constructor. ''' return _Constructor(cls, ptr) + + def start(self): + '''Start media discovery. + To stop it, call L{stop}() or + L{release}() directly. + See L{stop}. + @return: -1 in case of error, 0 otherwise. + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_media_discoverer_start(self) + + + def stop(self): + '''Stop media discovery. + See L{start}. + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_media_discoverer_stop(self) + + def release(self): '''Release media discover object. If the reference count reaches 0, then the object will be released. ''' return libvlc_media_discoverer_release(self) + def localized_name(self): '''Get media service discover object its localized name. @return: localized name. ''' return libvlc_media_discoverer_localized_name(self) + def media_list(self): '''Get media service discover media list. @return: list of media items. ''' return libvlc_media_discoverer_media_list(self) + @memoize_parameterless def event_manager(self): '''Get event manager from media service discover object. @return: event manager object. ''' return libvlc_media_discoverer_event_manager(self) + def is_running(self): '''Query if media service discover object is running. @return: true if running, false if not \libvlc_return_bool. @@ -2083,6 +2409,7 @@ class MediaLibrary(_Ctype): '''(INTERNAL) ctypes wrapper constructor. ''' return _Constructor(cls, ptr) + def release(self): '''Release media library object. This functions decrements the reference count of the media library object. If it reaches 0, @@ -2090,6 +2417,7 @@ class MediaLibrary(_Ctype): ''' return libvlc_media_library_release(self) + def retain(self): '''Retain a reference to a media library object. This function will increment the reference counting for this object. Use @@ -2097,12 +2425,14 @@ class MediaLibrary(_Ctype): ''' return libvlc_media_library_retain(self) + def load(self): '''Load media library. @return: 0 on success, -1 on error. ''' return libvlc_media_library_load(self) + def media_list(self): '''Get media library subitems. @return: media list subitems. @@ -2144,16 +2474,19 @@ class MediaList(_Ctype): return libvlc_media_list_add_media(self, mrl) + def release(self): '''Release media list created with L{new}(). ''' return libvlc_media_list_release(self) + def retain(self): '''Retain reference to a media list. ''' return libvlc_media_list_retain(self) + def set_media(self, p_md): '''Associate media instance with this media list instance. If another media instance was present it will be released. @@ -2162,6 +2495,7 @@ class MediaList(_Ctype): ''' return libvlc_media_list_set_media(self, p_md) + def media(self): '''Get media instance from this media list instance. This action will increase the refcount on the media instance. @@ -2170,6 +2504,7 @@ class MediaList(_Ctype): ''' return libvlc_media_list_media(self) + def insert_media(self, p_md, i_pos): '''Insert media instance in media list on a position The L{lock} should be held upon entering this function. @@ -2179,6 +2514,7 @@ class MediaList(_Ctype): ''' return libvlc_media_list_insert_media(self, p_md, i_pos) + def remove_index(self, i_pos): '''Remove media instance from media list on a position The L{lock} should be held upon entering this function. @@ -2187,6 +2523,7 @@ class MediaList(_Ctype): ''' return libvlc_media_list_remove_index(self, i_pos) + def count(self): '''Get count on media list items The L{lock} should be held upon entering this function. @@ -2197,11 +2534,12 @@ class MediaList(_Ctype): def __len__(self): return libvlc_media_list_count(self) + def item_at_index(self, i_pos): '''List media instance in media list at a position The L{lock} should be held upon entering this function. @param i_pos: position in array where to insert. - @return: media instance at position i_pos, or NULL if not found. In case of success, L{media_retain}() is called to increase the refcount on the media. + @return: media instance at position i_pos, or None if not found. In case of success, L{media_retain}() is called to increase the refcount on the media. ''' return libvlc_media_list_item_at_index(self, i_pos) @@ -2212,6 +2550,7 @@ class MediaList(_Ctype): for i in range(len(self)): yield self[i] + def index_of_item(self, p_md): '''Find index position of List media instance in media list. Warning: the function will return the first matched position. @@ -2221,23 +2560,27 @@ class MediaList(_Ctype): ''' return libvlc_media_list_index_of_item(self, p_md) + def is_readonly(self): '''This indicates if this media list is read-only from a user point of view. @return: 1 on readonly, 0 on readwrite \libvlc_return_bool. ''' return libvlc_media_list_is_readonly(self) + def lock(self): '''Get lock on media list items. ''' return libvlc_media_list_lock(self) + def unlock(self): '''Release lock on media list items The L{lock} should be held upon entering this function. ''' return libvlc_media_list_unlock(self) + @memoize_parameterless def event_manager(self): '''Get libvlc_event_manager from this media list instance. The p_event_manager is immutable, so you don't have to hold the lock. @@ -2272,6 +2615,7 @@ class MediaListPlayer(_Ctype): return self._instance #PYCHOK expected + def release(self): '''Release a media_list_player after use Decrement the reference count of a media player object. If the @@ -2281,52 +2625,68 @@ class MediaListPlayer(_Ctype): ''' return libvlc_media_list_player_release(self) + def retain(self): '''Retain a reference to a media player list object. Use L{release}() to decrement reference count. ''' return libvlc_media_list_player_retain(self) + @memoize_parameterless def event_manager(self): '''Return the event manager of this media_list_player. @return: the event manager. ''' return libvlc_media_list_player_event_manager(self) + def set_media_player(self, p_mi): '''Replace media player in media_list_player with this instance. @param p_mi: media player instance. ''' return libvlc_media_list_player_set_media_player(self, p_mi) + + def get_media_player(self): + '''Get media player of the media_list_player instance. + @return: media player instance @note the caller is responsible for releasing the returned instance. + ''' + return libvlc_media_list_player_get_media_player(self) + + def set_media_list(self, p_mlist): '''Set the media list associated with the player. @param p_mlist: list of media. ''' return libvlc_media_list_player_set_media_list(self, p_mlist) + def play(self): '''Play media list. ''' return libvlc_media_list_player_play(self) + def pause(self): '''Toggle pause (or resume) media list. ''' return libvlc_media_list_player_pause(self) + def is_playing(self): '''Is media list playing? @return: true for playing and false for not playing \libvlc_return_bool. ''' return libvlc_media_list_player_is_playing(self) + def get_state(self): '''Get current libvlc_state of media list player. @return: libvlc_state_t for media list player. ''' return libvlc_media_list_player_get_state(self) + def play_item_at_index(self, i_index): '''Play media list item at position index. @param i_index: index in media list to play. @@ -2341,6 +2701,7 @@ class MediaListPlayer(_Ctype): for i in range(len(self)): yield self[i] + def play_item(self, p_md): '''Play the given media item. @param p_md: the media instance. @@ -2348,23 +2709,27 @@ class MediaListPlayer(_Ctype): ''' return libvlc_media_list_player_play_item(self, p_md) + def stop(self): '''Stop playing media list. ''' return libvlc_media_list_player_stop(self) + def next(self): '''Play next item from media list. @return: 0 upon success -1 if there is no next item. ''' return libvlc_media_list_player_next(self) + def previous(self): '''Play previous item from media list. @return: 0 upon success -1 if there is no previous item. ''' return libvlc_media_list_player_previous(self) + def set_playback_mode(self, e_mode): '''Sets the playback mode for the playlist. @param e_mode: playback mode specification. @@ -2403,6 +2768,10 @@ class MediaPlayer(_Ctype): def set_mrl(self, mrl, *options): """Set the MRL to play. + Warning: most audio and video options, such as text renderer, + have no effects on an individual media. These options must be + set at the vlc.Instance or vlc.MediaPlayer instanciation. + @param mrl: The MRL @param options: optional media option=value strings @return: the Media object @@ -2438,6 +2807,27 @@ class MediaPlayer(_Ctype): """ return track_description_list(libvlc_audio_get_track_description(self)) + def get_full_title_descriptions(self): + '''Get the full description of available titles. + @return: the titles list + @version: LibVLC 3.0.0 and later. + ''' + titleDescription_pp = ctypes.POINTER(TitleDescription)() + n = libvlc_media_player_get_full_title_descriptions(self, ctypes.byref(titleDescription_pp)) + info = ctypes.cast(ctypes.titleDescription_pp, ctypes.POINTER(ctypes.POINTER(TitleDescription) * n)) + return info + + def get_full_chapter_descriptions(self, i_chapters_of_title): + '''Get the full description of available chapters. + @param index: of the title to query for chapters. + @return: the chapter list + @version: LibVLC 3.0.0 and later. + ''' + chapterDescription_pp = ctypes.POINTER(ChapterDescription)() + n = libvlc_media_player_get_full_chapter_descriptions(self, ctypes.byref(chapterDescription_pp)) + info = ctypes.cast(ctypes.chapterDescription_pp, ctypes.POINTER(ctypes.POINTER(ChapterDescription) * n)) + return info + def video_get_size(self, num=0): """Get the video size in pixels as 2-tuple (width, height). @@ -2501,6 +2891,7 @@ class MediaPlayer(_Ctype): raise VLCException('invalid video number (%s)' % (num,)) + def release(self): '''Release a media_player after use Decrement the reference count of a media player object. If the @@ -2510,12 +2901,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_release(self) + def retain(self): '''Retain a reference to a media player object. Use L{release}() to decrement reference count. ''' return libvlc_media_player_retain(self) + def set_media(self, p_md): '''Set the media that will be used by the media_player. If any, previous md will be released. @@ -2523,30 +2916,35 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_media(self, p_md) + def get_media(self): '''Get the media used by the media_player. - @return: the media associated with p_mi, or NULL if no media is associated. + @return: the media associated with p_mi, or None if no media is associated. ''' return libvlc_media_player_get_media(self) + @memoize_parameterless def event_manager(self): '''Get the Event Manager from which the media player send event. @return: the event manager associated with p_mi. ''' return libvlc_media_player_event_manager(self) + def is_playing(self): '''is_playing. @return: 1 if the media player is playing, 0 otherwise \libvlc_return_bool. ''' return libvlc_media_player_is_playing(self) + def play(self): '''Play. @return: 0 if playback started (and was already started), or -1 on error. ''' return libvlc_media_player_play(self) + def set_pause(self, do_pause): '''Pause or resume (no effect if there is no media). @param do_pause: play/resume if zero, pause if non-zero. @@ -2554,29 +2952,33 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_pause(self, do_pause) + def pause(self): '''Toggle pause (no effect if there is no media). ''' return libvlc_media_player_pause(self) + def stop(self): '''Stop (no effect if there is no media). ''' return libvlc_media_player_stop(self) + def video_set_callbacks(self, lock, unlock, display, opaque): '''Set callbacks and private data to render decoded video to a custom area in memory. Use L{video_set_format}() or L{video_set_format_callbacks}() to configure the decoded format. - @param lock: callback to lock video memory (must not be NULL). - @param unlock: callback to unlock video memory (or NULL if not needed). - @param display: callback to display video (or NULL if not needed). + @param lock: callback to lock video memory (must not be None). + @param unlock: callback to unlock video memory (or None if not needed). + @param display: callback to display video (or None if not needed). @param opaque: private pointer for the three callbacks (as first parameter). @version: LibVLC 1.1.1 or later. ''' return libvlc_video_set_callbacks(self, lock, unlock, display, opaque) + def video_set_format(self, chroma, width, height, pitch): '''Set decoded video chroma and dimensions. This only works in combination with L{video_set_callbacks}(), @@ -2590,21 +2992,23 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_format(self, str_to_bytes(chroma), width, height, pitch) + def video_set_format_callbacks(self, setup, cleanup): '''Set decoded video chroma and dimensions. This only works in combination with L{video_set_callbacks}(). - @param setup: callback to select the video format (cannot be NULL). - @param cleanup: callback to release any allocated resources (or NULL). + @param setup: callback to select the video format (cannot be None). + @param cleanup: callback to release any allocated resources (or None). @version: LibVLC 2.0.0 or later. ''' return libvlc_video_set_format_callbacks(self, setup, cleanup) + def set_nsobject(self, drawable): '''Set the NSView handler where the media player should render its video output. Use the vout called "macosx". The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding protocol: - @begincode + @code.m \@protocol VLCOpenGLVideoViewEmbedding - (void)addVoutSubview:(NSView *)view; - (void)removeVoutSubview:(NSView *)view; @@ -2613,7 +3017,7 @@ class MediaPlayer(_Ctype): Or it can be an NSView object. If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then the following code should work: - @begincode + @code.mm NSView *video = [[NSView alloc] init]; QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent); @@ -2626,37 +3030,49 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_nsobject(self, drawable) + def get_nsobject(self): '''Get the NSView handler previously set with L{set_nsobject}(). @return: the NSView handler or 0 if none where set. ''' return libvlc_media_player_get_nsobject(self) + def set_agl(self, drawable): - '''Set the agl handler where the media player should render its video output. - @param drawable: the agl handler. + '''\deprecated Use L{set_nsobject} instead. ''' return libvlc_media_player_set_agl(self, drawable) + def get_agl(self): - '''Get the agl handler previously set with L{set_agl}(). - @return: the agl handler or 0 if none where set. + '''\deprecated Use L{get_nsobject} instead. ''' return libvlc_media_player_get_agl(self) + def set_xwindow(self, drawable): '''Set an X Window System drawable where the media player should render its - video output. If LibVLC was built without X11 output support, then this has - no effects. - The specified identifier must correspond to an existing Input/Output class - X11 window. Pixmaps are B{not} supported. The caller shall ensure that - the X11 server is the same as the one the VLC instance has been configured - with. This function must be called before video playback is started; - otherwise it will only take effect after playback stop and restart. - @param drawable: the ID of the X window. + video output. The call takes effect when the playback starts. If it is + already started, it might need to be stopped before changes apply. + If LibVLC was built without X11 output support, then this function has no + effects. + By default, LibVLC will capture input events on the video rendering area. + Use L{video_set_mouse_input}() and L{video_set_key_input}() to + disable that and deliver events to the parent window / to the application + instead. By design, the X11 protocol delivers input events to only one + recipient. + @warning + The application must call the XInitThreads() function from Xlib before + L{new}(), and before any call to XOpenDisplay() directly or via any + other library. Failure to call XInitThreads() will seriously impede LibVLC + performance. Calling XOpenDisplay() before XInitThreads() will eventually + crash the process. That is a limitation of Xlib. + @param drawable: X11 window ID @note The specified identifier must correspond to an existing Input/Output class X11 window. Pixmaps are B{not} currently supported. The default X11 server is assumed, i.e. that specified in the DISPLAY environment variable. @warning LibVLC can deal with invalid X11 handle errors, however some display drivers (EGL, GLX, VA and/or VDPAU) can unfortunately not. Thus the window handle must remain valid until playback is stopped, otherwise the process may abort or crash. + @bug No more than one window handle per media player instance can be specified. If the media has multiple simultaneously active video tracks, extra tracks will be rendered into external windows beyond the control of the application. ''' return libvlc_media_player_set_xwindow(self, drawable) + def get_xwindow(self): '''Get the X Window System window identifier previously set with L{set_xwindow}(). Note that this will return the identifier @@ -2666,46 +3082,61 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_get_xwindow(self) + def get_hwnd(self): '''Get the Windows API window handle (HWND) previously set with L{set_hwnd}(). The handle will be returned even if LibVLC is not currently outputting any video to it. - @return: a window handle or NULL if there are none. + @return: a window handle or None if there are none. ''' return libvlc_media_player_get_hwnd(self) + + def set_android_context(self, p_jvm, p_awindow_handler): + '''Set the android context. + @param p_jvm: the Java VM of the android process. + @param awindow_handler: org.videolan.libvlc.IAWindowNativeHandler jobject implemented by the org.videolan.libvlc.MediaPlayer class from the libvlc-android project. + @version: LibVLC 3.0.0 and later. + ''' + return libvlc_media_player_set_android_context(self, p_jvm, p_awindow_handler) + + def audio_set_callbacks(self, play, pause, resume, flush, drain, opaque): '''Set callbacks and private data for decoded audio. Use L{audio_set_format}() or L{audio_set_format_callbacks}() to configure the decoded audio format. - @param play: callback to play audio samples (must not be NULL). - @param pause: callback to pause playback (or NULL to ignore). - @param resume: callback to resume playback (or NULL to ignore). - @param flush: callback to flush audio buffers (or NULL to ignore). - @param drain: callback to drain audio buffers (or NULL to ignore). + @param play: callback to play audio samples (must not be None). + @param pause: callback to pause playback (or None to ignore). + @param resume: callback to resume playback (or None to ignore). + @param flush: callback to flush audio buffers (or None to ignore). + @param drain: callback to drain audio buffers (or None to ignore). @param opaque: private pointer for the audio callbacks (as first parameter). @version: LibVLC 2.0.0 or later. ''' return libvlc_audio_set_callbacks(self, play, pause, resume, flush, drain, opaque) + def audio_set_volume_callback(self, set_volume): - '''Set callbacks and private data for decoded audio. + '''Set callbacks and private data for decoded audio. This only works in + combination with L{audio_set_callbacks}(). Use L{audio_set_format}() or L{audio_set_format_callbacks}() to configure the decoded audio format. - @param set_volume: callback to apply audio volume, or NULL to apply volume in software. + @param set_volume: callback to apply audio volume, or None to apply volume in software. @version: LibVLC 2.0.0 or later. ''' return libvlc_audio_set_volume_callback(self, set_volume) + def audio_set_format_callbacks(self, setup, cleanup): '''Set decoded audio format. This only works in combination with L{audio_set_callbacks}(). - @param setup: callback to select the audio format (cannot be NULL). - @param cleanup: callback to release any allocated resources (or NULL). + @param setup: callback to select the audio format (cannot be None). + @param cleanup: callback to release any allocated resources (or None). @version: LibVLC 2.0.0 or later. ''' return libvlc_audio_set_format_callbacks(self, setup, cleanup) + def audio_set_format(self, format, rate, channels): '''Set decoded audio format. This only works in combination with L{audio_set_callbacks}(), @@ -2717,18 +3148,21 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_format(self, str_to_bytes(format), rate, channels) + def get_length(self): '''Get the current movie length (in ms). @return: the movie length (in ms), or -1 if there is no media. ''' return libvlc_media_player_get_length(self) + def get_time(self): '''Get the current movie time (in ms). @return: the movie time (in ms), or -1 if there is no media. ''' return libvlc_media_player_get_time(self) + def set_time(self, i_time): '''Set the movie time (in ms). This has no effect if no media is being played. Not all formats and protocols support this. @@ -2736,12 +3170,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_time(self, i_time) + def get_position(self): '''Get movie position as percentage between 0.0 and 1.0. @return: movie position, or -1. in case of error. ''' return libvlc_media_player_get_position(self) + def set_position(self, f_pos): '''Set movie position as percentage between 0.0 and 1.0. This has no effect if playback is not enabled. @@ -2750,30 +3186,35 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_position(self, f_pos) + def set_chapter(self, i_chapter): '''Set movie chapter (if applicable). @param i_chapter: chapter number to play. ''' return libvlc_media_player_set_chapter(self, i_chapter) + def get_chapter(self): '''Get movie chapter. @return: chapter number currently playing, or -1 if there is no media. ''' return libvlc_media_player_get_chapter(self) + def get_chapter_count(self): '''Get movie chapter count. @return: number of chapters in movie, or -1. ''' return libvlc_media_player_get_chapter_count(self) + def will_play(self): '''Is the player able to play. @return: boolean \libvlc_return_bool. ''' return libvlc_media_player_will_play(self) + def get_chapter_count_for_title(self, i_title): '''Get title chapter count. @param i_title: title. @@ -2781,34 +3222,40 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_get_chapter_count_for_title(self, i_title) + def set_title(self, i_title): '''Set movie title. @param i_title: title number to play. ''' return libvlc_media_player_set_title(self, i_title) + def get_title(self): '''Get movie title. @return: title number currently playing, or -1. ''' return libvlc_media_player_get_title(self) + def get_title_count(self): '''Get movie title count. @return: title number count, or -1. ''' return libvlc_media_player_get_title_count(self) + def previous_chapter(self): '''Set previous chapter (if applicable). ''' return libvlc_media_player_previous_chapter(self) + def next_chapter(self): '''Set next chapter (if applicable). ''' return libvlc_media_player_next_chapter(self) + def get_rate(self): '''Get the requested movie play rate. @warning: Depending on the underlying media, the requested rate may be @@ -2817,6 +3264,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_get_rate(self) + def set_rate(self, rate): '''Set movie play rate. @param rate: movie play rate to set. @@ -2824,36 +3272,42 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_rate(self, rate) + def get_state(self): '''Get current movie state. @return: the current state of the media player (playing, paused, ...) See libvlc_state_t. ''' return libvlc_media_player_get_state(self) + def get_fps(self): '''Get movie fps rate. @return: frames per second (fps) for this playing movie, or 0 if unspecified. ''' return libvlc_media_player_get_fps(self) + def has_vout(self): '''How many video outputs does this media player have? @return: the number of video outputs. ''' return libvlc_media_player_has_vout(self) + def is_seekable(self): '''Is this media player seekable? @return: true if the media player can seek \libvlc_return_bool. ''' return libvlc_media_player_is_seekable(self) + def can_pause(self): '''Can this media player be paused? @return: true if the media player can pause \libvlc_return_bool. ''' return libvlc_media_player_can_pause(self) + def program_scrambled(self): '''Check if the current program is scrambled. @return: true if the current program is scrambled \libvlc_return_bool. @@ -2861,11 +3315,13 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_program_scrambled(self) + def next_frame(self): '''Display the next frame (if supported). ''' return libvlc_media_player_next_frame(self) + def navigate(self, navigate): '''Navigate through DVD Menu. @param navigate: the Navigation mode. @@ -2873,6 +3329,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_navigate(self, navigate) + def set_video_title_display(self, position, timeout): '''Set if, and how, the video title will be shown when media is played. @param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed. @@ -2881,6 +3338,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_video_title_display(self, position, timeout) + def toggle_fullscreen(self): '''Toggle fullscreen status on non-embedded video outputs. @warning: The same limitations applies to this function @@ -2888,6 +3346,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_toggle_fullscreen(self) + def set_fullscreen(self, b_fullscreen): '''Enable or disable fullscreen. @warning: With most window managers, only a top-level windows can be in @@ -2900,12 +3359,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_set_fullscreen(self, b_fullscreen) + def get_fullscreen(self): '''Get current fullscreen status. @return: the fullscreen status (boolean) \libvlc_return_bool. ''' return libvlc_get_fullscreen(self) + def video_set_key_input(self, on): '''Enable or disable key press events handling, according to the LibVLC hotkeys configuration. By default and for historical reasons, keyboard events are @@ -2919,6 +3380,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_key_input(self, on) + def video_set_mouse_input(self, on): '''Enable or disable mouse click events handling. By default, those events are handled. This is needed for DVD menus to work, as well as a few video @@ -2929,6 +3391,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_mouse_input(self, on) + def video_get_scale(self): '''Get the current video scaling factor. See also L{video_set_scale}(). @@ -2936,6 +3399,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_get_scale(self) + def video_set_scale(self, f_factor): '''Set the video scaling factor. That is the ratio of the number of pixels on screen to the number of pixels in the original decoded video in each @@ -2946,30 +3410,35 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_scale(self, f_factor) + def video_get_aspect_ratio(self): '''Get current video aspect ratio. - @return: the video aspect ratio or NULL if unspecified (the result must be released with free() or L{free}()). + @return: the video aspect ratio or None if unspecified (the result must be released with free() or L{free}()). ''' return libvlc_video_get_aspect_ratio(self) + def video_set_aspect_ratio(self, psz_aspect): '''Set new video aspect ratio. - @param psz_aspect: new video aspect-ratio or NULL to reset to default @note Invalid aspect ratios are ignored. + @param psz_aspect: new video aspect-ratio or None to reset to default @note Invalid aspect ratios are ignored. ''' return libvlc_video_set_aspect_ratio(self, str_to_bytes(psz_aspect)) + def video_get_spu(self): '''Get current video subtitle. @return: the video subtitle selected, or -1 if none. ''' return libvlc_video_get_spu(self) + def video_get_spu_count(self): '''Get the number of available video subtitles. @return: the number of available video subtitles. ''' return libvlc_video_get_spu_count(self) + def video_set_spu(self, i_spu): '''Set new video subtitle. @param i_spu: video subtitle track to select (i_id from track description). @@ -2977,6 +3446,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_spu(self, i_spu) + def video_set_subtitle_file(self, psz_subtitle): '''Set new video subtitle file. @param psz_subtitle: new video subtitle file. @@ -2984,6 +3454,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_subtitle_file(self, str_to_bytes(psz_subtitle)) + def video_get_spu_delay(self): '''Get the current subtitle delay. Positive values means subtitles are being displayed later, negative values earlier. @@ -2992,6 +3463,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_get_spu_delay(self) + def video_set_spu_delay(self, i_delay): '''Set the subtitle delay. This affects the timing of when the subtitle will be displayed. Positive values result in subtitles being displayed later, @@ -3003,47 +3475,55 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_spu_delay(self, i_delay) + def video_get_crop_geometry(self): '''Get current crop filter geometry. - @return: the crop filter geometry or NULL if unset. + @return: the crop filter geometry or None if unset. ''' return libvlc_video_get_crop_geometry(self) + def video_set_crop_geometry(self, psz_geometry): '''Set new crop filter geometry. - @param psz_geometry: new crop filter geometry (NULL to unset). + @param psz_geometry: new crop filter geometry (None to unset). ''' return libvlc_video_set_crop_geometry(self, str_to_bytes(psz_geometry)) + def video_get_teletext(self): '''Get current teletext page requested. @return: the current teletext page requested. ''' return libvlc_video_get_teletext(self) + def video_set_teletext(self, i_page): '''Set new teletext page to retrieve. @param i_page: teletex page number requested. ''' return libvlc_video_set_teletext(self, i_page) + def toggle_teletext(self): '''Toggle teletext transparent status on video output. ''' return libvlc_toggle_teletext(self) + def video_get_track_count(self): '''Get number of available video tracks. @return: the number of available video tracks (int). ''' return libvlc_video_get_track_count(self) + def video_get_track(self): '''Get current video track. @return: the video track ID (int) or -1 if no active input. ''' return libvlc_video_get_track(self) + def video_set_track(self, i_track): '''Set video track. @param i_track: the track ID (i_id field from track description). @@ -3051,6 +3531,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_track(self, i_track) + def video_take_snapshot(self, num, psz_filepath, i_width, i_height): '''Take a snapshot of the current video window. If i_width AND i_height is 0, original size is used. @@ -3063,24 +3544,28 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_take_snapshot(self, num, str_to_bytes(psz_filepath), i_width, i_height) + def video_set_deinterlace(self, psz_mode): '''Enable or disable deinterlace filter. - @param psz_mode: type of deinterlace filter, NULL to disable. + @param psz_mode: type of deinterlace filter, None to disable. ''' return libvlc_video_set_deinterlace(self, str_to_bytes(psz_mode)) + def video_get_marquee_int(self, option): '''Get an integer marquee option value. @param option: marq option to get See libvlc_video_marquee_int_option_t. ''' return libvlc_video_get_marquee_int(self, option) + def video_get_marquee_string(self, option): '''Get a string marquee option value. @param option: marq option to get See libvlc_video_marquee_string_option_t. ''' return libvlc_video_get_marquee_string(self, option) + def video_set_marquee_int(self, option, i_val): '''Enable, disable or set an integer marquee option Setting libvlc_marquee_Enable has the side effect of enabling (arg !0) @@ -3090,6 +3575,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_marquee_int(self, option, i_val) + def video_set_marquee_string(self, option, psz_text): '''Set a marquee string option. @param option: marq option to set See libvlc_video_marquee_string_option_t. @@ -3097,12 +3583,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_marquee_string(self, option, str_to_bytes(psz_text)) + def video_get_logo_int(self, option): '''Get integer logo option. @param option: logo option to get, values of libvlc_video_logo_option_t. ''' return libvlc_video_get_logo_int(self, option) + def video_set_logo_int(self, option, value): '''Set logo option as integer. Options that take a different type value are ignored. @@ -3113,6 +3601,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_logo_int(self, option, value) + def video_set_logo_string(self, option, psz_value): '''Set logo option as string. Options that take a different type value are ignored. @@ -3121,6 +3610,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_logo_string(self, option, str_to_bytes(psz_value)) + def video_get_adjust_int(self, option): '''Get integer adjust option. @param option: adjust option to get, values of libvlc_video_adjust_option_t. @@ -3128,6 +3618,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_get_adjust_int(self, option) + def video_set_adjust_int(self, option, value): '''Set adjust option as integer. Options that take a different type value are ignored. @@ -3139,6 +3630,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_adjust_int(self, option, value) + def video_get_adjust_float(self, option): '''Get float adjust option. @param option: adjust option to get, values of libvlc_video_adjust_option_t. @@ -3146,6 +3638,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_get_adjust_float(self, option) + def video_set_adjust_float(self, option, value): '''Set adjust option as float. Options that take a different type value are ignored. @@ -3155,6 +3648,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_adjust_float(self, option, value) + def audio_output_set(self, psz_name): '''Selects an audio output module. @note: Any change will take be effect only after playback is stopped and @@ -3164,31 +3658,33 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_output_set(self, str_to_bytes(psz_name)) + def audio_output_device_enum(self): '''Gets a list of potential audio output devices, See L{audio_output_device_set}(). @note: Not all audio outputs support enumerating devices. - The audio output may be functional even if the list is empty (NULL). + The audio output may be functional even if the list is empty (None). @note: The list may not be exhaustive. @warning: Some audio output devices in the list might not actually work in some circumstances. By default, it is recommended to not specify any explicit audio device. - @return: A NULL-terminated linked list of potential audio output devices. It must be freed it with L{audio_output_device_list_release}(). + @return: A None-terminated linked list of potential audio output devices. It must be freed with L{audio_output_device_list_release}(). @version: LibVLC 2.2.0 or later. ''' return libvlc_audio_output_device_enum(self) + def audio_output_device_set(self, module, device_id): '''Configures an explicit audio output device. - If the module paramater is NULL, audio output will be moved to the device + If the module paramater is None, audio output will be moved to the device specified by the device identifier string immediately. This is the recommended usage. A list of adequate potential device strings can be obtained with L{audio_output_device_enum}(). - However passing NULL is supported in LibVLC version 2.2.0 and later only; + However passing None is supported in LibVLC version 2.2.0 and later only; in earlier versions, this function would have no effects when the module - parameter was NULL. - If the module parameter is not NULL, the device parameter of the + parameter was None. + If the module parameter is not None, the device parameter of the corresponding audio output, if it exists, will be set to the specified string. Note that some audio output modules do not have such a parameter (notably MMDevice and PulseAudio). @@ -3199,35 +3695,58 @@ class MediaPlayer(_Ctype): @warning: The syntax for the device parameter depends on the audio output. Some audio output modules require further parameters (e.g. a channels map in the case of ALSA). - @param module: If NULL, current audio output module. if non-NULL, name of audio output module. + @param module: If None, current audio output module. if non-None, name of audio output module. @param device_id: device identifier string. @return: Nothing. Errors are ignored (this is a design bug). ''' return libvlc_audio_output_device_set(self, str_to_bytes(module), str_to_bytes(device_id)) + + def audio_output_device_get(self): + '''Get the current audio output device identifier. + This complements L{audio_output_device_set}(). + @warning: The initial value for the current audio output device identifier + may not be set or may be some unknown value. A LibVLC application should + compare this value against the known device identifiers (e.g. those that + were previously retrieved by a call to L{audio_output_device_enum} or + L{audio_output_device_list_get}) to find the current audio output device. + It is possible that the selected audio output device changes (an external + change) without a call to L{audio_output_device_set}. That may make this + method unsuitable to use if a LibVLC application is attempting to track + dynamic audio device changes as they happen. + @return: the current audio output device identifier None if no device is selected or in case of error (the result must be released with free() or L{free}()). + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_audio_output_device_get(self) + + def audio_toggle_mute(self): '''Toggle mute status. ''' return libvlc_audio_toggle_mute(self) + def audio_get_mute(self): '''Get current mute status. @return: the mute status (boolean) if defined, -1 if undefined/unapplicable. ''' return libvlc_audio_get_mute(self) + def audio_set_mute(self, status): '''Set mute status. @param status: If status is true then mute, otherwise unmute @warning This function does not always work. If there are no active audio playback stream, the mute status might not be available. If digital pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also some audio output plugins do not support muting at all. @note To force silent playback, disable all audio tracks. This is more efficient and reliable than mute. ''' return libvlc_audio_set_mute(self, status) + def audio_get_volume(self): '''Get current software audio volume. @return: the software volume in percents (0 = mute, 100 = nominal / 0dB). ''' return libvlc_audio_get_volume(self) + def audio_set_volume(self, i_volume): '''Set current software audio volume. @param i_volume: the volume in percents (0 = mute, 100 = 0dB). @@ -3235,18 +3754,21 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_volume(self, i_volume) + def audio_get_track_count(self): '''Get number of available audio tracks. @return: the number of available audio tracks (int), or -1 if unavailable. ''' return libvlc_audio_get_track_count(self) + def audio_get_track(self): '''Get current audio track. @return: the audio track ID or -1 if no active input. ''' return libvlc_audio_get_track(self) + def audio_set_track(self, i_track): '''Set current audio track. @param i_track: the track ID (i_id field from track description). @@ -3254,12 +3776,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_track(self, i_track) + def audio_get_channel(self): '''Get current audio channel. @return: the audio channel See libvlc_audio_output_channel_t. ''' return libvlc_audio_get_channel(self) + def audio_set_channel(self, channel): '''Set current audio channel. @param channel: the audio channel, See libvlc_audio_output_channel_t. @@ -3267,6 +3791,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_channel(self, channel) + def audio_get_delay(self): '''Get current audio delay. @return: the audio delay (microseconds). @@ -3274,6 +3799,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_get_delay(self) + def audio_set_delay(self, i_delay): '''Set current audio delay. The audio delay will be reset to zero each time the media changes. @param i_delay: the audio delay (microseconds). @@ -3282,6 +3808,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_delay(self, i_delay) + def set_equalizer(self, p_equalizer): '''Apply new equalizer settings to a media player. The equalizer is first created by invoking L{audio_equalizer_new}() or @@ -3293,12 +3820,12 @@ class MediaPlayer(_Ctype): If there is no currently playing media, the new equalizer settings will be applied later if and when new media is played. Equalizer settings will automatically be applied to subsequently played media. - To disable the equalizer for a media player invoke this method passing NULL for the + To disable the equalizer for a media player invoke this method passing None for the p_equalizer parameter. The media player does not keep a reference to the supplied equalizer so it is safe for an application to release the equalizer reference any time after this method returns. - @param p_equalizer: opaque equalizer handle, or NULL to disable the equalizer for this media player. + @param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player. @return: zero on success, -1 on error. @version: LibVLC 2.2.0 or later. ''' @@ -3312,7 +3839,7 @@ def libvlc_errmsg(): thread. The resulting string is valid until another error occurs (at least until the next LibVLC call). @warning - This will be NULL if there was no error. + This will be None if there was no error. ''' f = _Cfunctions.get('libvlc_errmsg', None) or \ _Cfunction('libvlc_errmsg', (), None, @@ -3345,10 +3872,31 @@ def libvlc_new(argc, argv): '''Create and initialize a libvlc instance. This functions accept a list of "command line" arguments similar to the main(). These arguments affect the LibVLC instance default configuration. + @note + LibVLC may create threads. Therefore, any thread-unsafe process + initialization must be performed before calling L{libvlc_new}(). In particular + and where applicable: + - setlocale() and textdomain(), + - setenv(), unsetenv() and putenv(), + - with the X11 display system, XInitThreads() + (see also L{libvlc_media_player_set_xwindow}()) and + - on Microsoft Windows, SetErrorMode(). + - sigprocmask() shall never be invoked; pthread_sigmask() can be used. + On POSIX systems, the SIGCHLD signal must B{not} be ignored, i.e. the + signal handler must set to SIG_DFL or a function pointer, not SIG_IGN. + Also while LibVLC is active, the wait() function shall not be called, and + any call to waitpid() shall use a strictly positive value for the first + parameter (i.e. the PID). Failure to follow those rules may lead to a + deadlock or a busy loop. + Also on POSIX systems, it is recommended that the SIGPIPE signal be blocked, + even if it is not, in principles, necessary. + On Microsoft Windows Vista/2008, the process error mode + SEM_FAILCRITICALERRORS flag B{must} with the SetErrorMode() function + before using LibVLC. On later versions, it is optional and unnecessary. @param argc: the number of arguments (should be 0). - @param argv: list of arguments (should be NULL). - @return: the libvlc instance or NULL in case of error. - @version Arguments are meant to be passed from the command line to LibVLC, just like VLC media player does. The list of valid arguments depends on the LibVLC version, the operating system and platform, and set of available LibVLC plugins. Invalid or unsupported arguments will cause the function to fail (i.e. return NULL). Also, some arguments may alter the behaviour or otherwise interfere with other LibVLC functions. @warning There is absolutely no warranty or promise of forward, backward and cross-platform compatibility with regards to L{libvlc_new}() arguments. We recommend that you do not use them, other than when debugging. + @param argv: list of arguments (should be None). + @return: the libvlc instance or None in case of error. + @version Arguments are meant to be passed from the command line to LibVLC, just like VLC media player does. The list of valid arguments depends on the LibVLC version, the operating system and platform, and set of available LibVLC plugins. Invalid or unsupported arguments will cause the function to fail (i.e. return None). Also, some arguments may alter the behaviour or otherwise interfere with other LibVLC functions. @warning There is absolutely no warranty or promise of forward, backward and cross-platform compatibility with regards to L{libvlc_new}() arguments. We recommend that you do not use them, other than when debugging. ''' f = _Cfunctions.get('libvlc_new', None) or \ _Cfunction('libvlc_new', ((1,), (1,),), class_result(Instance), @@ -3378,7 +3926,7 @@ def libvlc_retain(p_instance): def libvlc_add_intf(p_instance, name): '''Try to start a user interface for the libvlc instance. @param p_instance: the instance. - @param name: interface name, or NULL for default. + @param name: interface name, or None for default. @return: 0 on success, -1 on error. ''' f = _Cfunctions.get('libvlc_add_intf', None) or \ @@ -3491,10 +4039,10 @@ def libvlc_event_type_name(event_type): def libvlc_log_get_context(ctx): '''Gets debugging information about a log message: the name of the VLC module emitting the message and the message location within the source code. - The returned module name and file name will be NULL if unknown. + The returned module name and file name will be None if unknown. The returned line number will similarly be zero if unknown. @param ctx: message context (as passed to the @ref libvlc_log_cb callback). - @return: module module name storage (or NULL), file source code file name storage (or NULL), line source code file line number storage (or NULL). + @return: module module name storage (or None), file source code file name storage (or None), line source code file line number storage (or None). @version: LibVLC 2.1.0 or later. ''' f = _Cfunctions.get('libvlc_log_get_context', None) or \ @@ -3507,13 +4055,13 @@ def libvlc_log_get_object(ctx, id): object emitting the message, the object header if any and a temporaly-unique object identifier. This information is mainly meant for B{manual} troubleshooting. - The returned type name may be "generic" if unknown, but it cannot be NULL. - The returned header will be NULL if unset; in current versions, the header + The returned type name may be "generic" if unknown, but it cannot be None. + The returned header will be None if unset; in current versions, the header is used to distinguish for VLM inputs. The returned object ID will be zero if the message is not associated with any VLC object. @param ctx: message context (as passed to the @ref libvlc_log_cb callback). - @return: name object name storage (or NULL), header object header (or NULL), line source code file line number storage (or NULL). + @return: name object name storage (or None), header object header (or None), line source code file line number storage (or None). @version: LibVLC 2.1.0 or later. ''' f = _Cfunctions.get('libvlc_log_get_object', None) or \ @@ -3571,7 +4119,7 @@ def libvlc_module_description_list_release(p_list): def libvlc_audio_filter_list_get(p_instance): '''Returns a list of audio filters that are available. @param p_instance: libvlc instance. - @return: a list of module descriptions. It should be freed with L{libvlc_module_description_list_release}(). In case of an error, NULL is returned. See L{ModuleDescription} See L{libvlc_module_description_list_release}. + @return: a list of module descriptions. It should be freed with L{libvlc_module_description_list_release}(). In case of an error, None is returned. See L{ModuleDescription} See L{libvlc_module_description_list_release}. ''' f = _Cfunctions.get('libvlc_audio_filter_list_get', None) or \ _Cfunction('libvlc_audio_filter_list_get', ((1,),), None, @@ -3581,7 +4129,7 @@ def libvlc_audio_filter_list_get(p_instance): def libvlc_video_filter_list_get(p_instance): '''Returns a list of video filters that are available. @param p_instance: libvlc instance. - @return: a list of module descriptions. It should be freed with L{libvlc_module_description_list_release}(). In case of an error, NULL is returned. See L{ModuleDescription} See L{libvlc_module_description_list_release}. + @return: a list of module descriptions. It should be freed with L{libvlc_module_description_list_release}(). In case of an error, None is returned. See L{ModuleDescription} See L{libvlc_module_description_list_release}. ''' f = _Cfunctions.get('libvlc_video_filter_list_get', None) or \ _Cfunction('libvlc_video_filter_list_get', ((1,),), None, @@ -3611,7 +4159,7 @@ def libvlc_media_new_location(p_instance, psz_mrl): See L{libvlc_media_release}. @param p_instance: the instance. @param psz_mrl: the media location. - @return: the newly created media or NULL on error. + @return: the newly created media or None on error. ''' f = _Cfunctions.get('libvlc_media_new_location', None) or \ _Cfunction('libvlc_media_new_location', ((1,), (1,),), class_result(Media), @@ -3623,7 +4171,7 @@ def libvlc_media_new_path(p_instance, path): See L{libvlc_media_release}. @param p_instance: the instance. @param path: local filesystem path. - @return: the newly created media or NULL on error. + @return: the newly created media or None on error. ''' f = _Cfunctions.get('libvlc_media_new_path', None) or \ _Cfunction('libvlc_media_new_path', ((1,), (1,),), class_result(Media), @@ -3646,7 +4194,7 @@ def libvlc_media_new_fd(p_instance, fd): See L{libvlc_media_release}. @param p_instance: the instance. @param fd: open file descriptor. - @return: the newly created media or NULL on error. + @return: the newly created media or None on error. @version: LibVLC 1.1.5 and later. ''' f = _Cfunctions.get('libvlc_media_new_fd', None) or \ @@ -3654,12 +4202,28 @@ def libvlc_media_new_fd(p_instance, fd): ctypes.c_void_p, Instance, ctypes.c_int) return f(p_instance, fd) +def libvlc_media_new_callbacks(instance, open_cb, read_cb, seek_cb, close_cb, opaque): + '''Create a media with custom callbacks to read the data from. + @param instance: LibVLC instance. + @param open_cb: callback to open the custom bitstream input media. + @param read_cb: callback to read data (must not be None). + @param seek_cb: callback to seek, or None if seeking is not supported. + @param close_cb: callback to close the media, or None if unnecessary. + @param opaque: data pointer for the open callback. + @return: the newly created media or None on error @note If open_cb is None, the opaque pointer will be passed to read_cb, seek_cb and close_cb, and the stream size will be treated as unknown. @note The callbacks may be called asynchronously (from another thread). A single stream instance need not be reentrant. However the open_cb needs to be reentrant if the media is used by multiple player instances. @warning The callbacks may be used until all or any player instances that were supplied the media item are stopped. See L{libvlc_media_release}. + @version: LibVLC 3.0.0 and later. + ''' + f = _Cfunctions.get('libvlc_media_new_callbacks', None) or \ + _Cfunction('libvlc_media_new_callbacks', ((1,), (1,), (1,), (1,), (1,), (1,),), class_result(Media), + ctypes.c_void_p, Instance, MediaOpenCb, MediaReadCb, MediaSeekCb, MediaCloseCb, ctypes.c_void_p) + return f(instance, open_cb, read_cb, seek_cb, close_cb, opaque) + def libvlc_media_new_as_node(p_instance, psz_name): '''Create a media as an empty node with a given name. See L{libvlc_media_release}. @param p_instance: the instance. @param psz_name: the name of the node. - @return: the new empty media or NULL on error. + @return: the new empty media or None on error. ''' f = _Cfunctions.get('libvlc_media_new_as_node', None) or \ _Cfunction('libvlc_media_new_as_node', ((1,), (1,),), class_result(Media), @@ -3750,7 +4314,7 @@ def libvlc_media_duplicate(p_md): def libvlc_media_get_meta(p_md, e_meta): '''Read the meta of the media. - If the media has not yet been parsed this will return NULL. + If the media has not yet been parsed this will return None. This methods automatically calls L{libvlc_media_parse_async}(), so after calling it you may receive a libvlc_MediaMetaChanged event. If you prefer a synchronous version ensure that you call L{libvlc_media_parse}() before get_meta(). @@ -3819,7 +4383,7 @@ def libvlc_media_subitems(p_md): the reference count of supplied media descriptor object. Use L{libvlc_media_list_release}() to decrement the reference counting. @param p_md: media descriptor object. - @return: list of media descriptor subitems or NULL. + @return: list of media descriptor subitems or None. ''' f = _Cfunctions.get('libvlc_media_subitems', None) or \ _Cfunction('libvlc_media_subitems', ((1,),), class_result(MediaList), @@ -3849,7 +4413,7 @@ def libvlc_media_get_duration(p_md): def libvlc_media_parse(p_md): '''Parse a media. - This fetches (local) meta data and tracks information. + This fetches (local) art, meta data and tracks information. The method is synchronous. See L{libvlc_media_parse_async} See L{libvlc_media_get_meta} @@ -3863,7 +4427,7 @@ def libvlc_media_parse(p_md): def libvlc_media_parse_async(p_md): '''Parse a media. - This fetches (local) meta data and tracks information. + This fetches (local) art, meta data and tracks information. The method is the asynchronous of L{libvlc_media_parse}(). To track when this is over you can listen to libvlc_MediaParsedChanged event. However if the media was already parsed you will not receive this @@ -3879,6 +4443,30 @@ def libvlc_media_parse_async(p_md): None, Media) return f(p_md) +def libvlc_media_parse_with_options(p_md, parse_flag): + '''Parse the media asynchronously with options. + This fetches (local or network) art, meta data and/or tracks information. + This method is the extended version of L{libvlc_media_parse_async}(). + To track when this is over you can listen to libvlc_MediaParsedChanged + event. However if this functions returns an error, you will not receive this + event. + It uses a flag to specify parse options (see libvlc_media_parse_flag_t). All + these flags can be combined. By default, media is parsed if it's a local + file. + See libvlc_MediaParsedChanged + See L{libvlc_media_get_meta} + See L{libvlc_media_tracks_get} + See libvlc_media_parse_flag_t. + @param p_md: media descriptor object. + @param parse_flag: parse options: + @return: -1 in case of error, 0 otherwise. + @version: LibVLC 3.0.0 or later. + ''' + f = _Cfunctions.get('libvlc_media_parse_with_options', None) or \ + _Cfunction('libvlc_media_parse_with_options', ((1,), (1,),), None, + ctypes.c_int, Media, MediaParseFlag) + return f(p_md, parse_flag) + def libvlc_media_is_parsed(p_md): '''Get Parsed status for media descriptor object. See libvlc_MediaParsedChanged. @@ -3928,6 +4516,18 @@ def libvlc_media_tracks_get(p_md, tracks): ctypes.c_uint, Media, ctypes.POINTER(ctypes.POINTER(MediaTrack))) return f(p_md, tracks) +def libvlc_media_get_codec_description(i_type, i_codec): + '''Get codec description from media elementary stream. + @param i_type: i_type from L{MediaTrack}. + @param i_codec: i_codec or i_original_fourcc from L{MediaTrack}. + @return: codec description. + @version: LibVLC 3.0.0 and later. See L{MediaTrack}. + ''' + f = _Cfunctions.get('libvlc_media_get_codec_description', None) or \ + _Cfunction('libvlc_media_get_codec_description', ((1,), (1,),), None, + ctypes.c_char_p, TrackType, ctypes.c_uint32) + return f(i_type, i_codec) + def libvlc_media_tracks_release(p_tracks, i_count): '''Release media descriptor's elementary streams description array. @param p_tracks: tracks info array to release. @@ -3939,17 +4539,63 @@ def libvlc_media_tracks_release(p_tracks, i_count): None, ctypes.POINTER(MediaTrack), ctypes.c_uint) return f(p_tracks, i_count) -def libvlc_media_discoverer_new_from_name(p_inst, psz_name): - '''Discover media service by name. +def libvlc_media_get_type(p_md): + '''Get the media type of the media descriptor object. + @param p_md: media descriptor object. + @return: media type. + @version: LibVLC 3.0.0 and later. See libvlc_media_type_t. + ''' + f = _Cfunctions.get('libvlc_media_get_type', None) or \ + _Cfunction('libvlc_media_get_type', ((1,),), None, + MediaType, Media) + return f(p_md) + +def libvlc_media_discoverer_new(p_inst, psz_name): + '''Create a media discoverer object by name. + After this object is created, you should attach to events in order to be + notified of the discoverer state. + You should also attach to media_list events in order to be notified of new + items discovered. + You need to call L{libvlc_media_discoverer_start}() in order to start the + discovery. + See L{libvlc_media_discoverer_media_list} + See L{libvlc_media_discoverer_event_manager} + See L{libvlc_media_discoverer_start}. @param p_inst: libvlc instance. @param psz_name: service name. - @return: media discover object or NULL in case of error. + @return: media discover object or None in case of error. + @version: LibVLC 3.0.0 or later. ''' - f = _Cfunctions.get('libvlc_media_discoverer_new_from_name', None) or \ - _Cfunction('libvlc_media_discoverer_new_from_name', ((1,), (1,),), class_result(MediaDiscoverer), + f = _Cfunctions.get('libvlc_media_discoverer_new', None) or \ + _Cfunction('libvlc_media_discoverer_new', ((1,), (1,),), class_result(MediaDiscoverer), ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_inst, psz_name) +def libvlc_media_discoverer_start(p_mdis): + '''Start media discovery. + To stop it, call L{libvlc_media_discoverer_stop}() or + L{libvlc_media_discoverer_release}() directly. + See L{libvlc_media_discoverer_stop}. + @param p_mdis: media discover object. + @return: -1 in case of error, 0 otherwise. + @version: LibVLC 3.0.0 or later. + ''' + f = _Cfunctions.get('libvlc_media_discoverer_start', None) or \ + _Cfunction('libvlc_media_discoverer_start', ((1,),), None, + ctypes.c_int, MediaDiscoverer) + return f(p_mdis) + +def libvlc_media_discoverer_stop(p_mdis): + '''Stop media discovery. + See L{libvlc_media_discoverer_start}. + @param p_mdis: media discover object. + @version: LibVLC 3.0.0 or later. + ''' + f = _Cfunctions.get('libvlc_media_discoverer_stop', None) or \ + _Cfunction('libvlc_media_discoverer_stop', ((1,),), None, + None, MediaDiscoverer) + return f(p_mdis) + def libvlc_media_discoverer_release(p_mdis): '''Release media discover object. If the reference count reaches 0, then the object will be released. @@ -4003,7 +4649,7 @@ def libvlc_media_discoverer_is_running(p_mdis): def libvlc_media_library_new(p_instance): '''Create an new Media Library object. @param p_instance: the libvlc instance. - @return: a new object or NULL on error. + @return: a new object or None on error. ''' f = _Cfunctions.get('libvlc_media_library_new', None) or \ _Cfunction('libvlc_media_library_new', ((1,),), class_result(MediaLibrary), @@ -4055,7 +4701,7 @@ def libvlc_media_library_media_list(p_mlib): def libvlc_media_list_new(p_instance): '''Create an empty media list. @param p_instance: libvlc instance. - @return: empty media list, or NULL on error. + @return: empty media list, or None on error. ''' f = _Cfunctions.get('libvlc_media_list_new', None) or \ _Cfunction('libvlc_media_list_new', ((1,),), class_result(MediaList), @@ -4157,7 +4803,7 @@ def libvlc_media_list_item_at_index(p_ml, i_pos): The L{libvlc_media_list_lock} should be held upon entering this function. @param p_ml: a media list instance. @param i_pos: position in array where to insert. - @return: media instance at position i_pos, or NULL if not found. In case of success, L{libvlc_media_retain}() is called to increase the refcount on the media. + @return: media instance at position i_pos, or None if not found. In case of success, L{libvlc_media_retain}() is called to increase the refcount on the media. ''' f = _Cfunctions.get('libvlc_media_list_item_at_index', None) or \ _Cfunction('libvlc_media_list_item_at_index', ((1,), (1,),), class_result(Media), @@ -4220,7 +4866,7 @@ def libvlc_media_list_event_manager(p_ml): def libvlc_media_list_player_new(p_instance): '''Create new media_list_player. @param p_instance: libvlc instance. - @return: media list player instance or NULL on error. + @return: media list player instance or None on error. ''' f = _Cfunctions.get('libvlc_media_list_player_new', None) or \ _Cfunction('libvlc_media_list_player_new', ((1,),), class_result(MediaListPlayer), @@ -4270,6 +4916,16 @@ def libvlc_media_list_player_set_media_player(p_mlp, p_mi): None, MediaListPlayer, MediaPlayer) return f(p_mlp, p_mi) +def libvlc_media_list_player_get_media_player(p_mlp): + '''Get media player of the media_list_player instance. + @param p_mlp: media list player instance. + @return: media player instance @note the caller is responsible for releasing the returned instance. + ''' + f = _Cfunctions.get('libvlc_media_list_player_get_media_player', None) or \ + _Cfunction('libvlc_media_list_player_get_media_player', ((1,),), class_result(MediaPlayer), + ctypes.c_void_p, MediaListPlayer) + return f(p_mlp) + def libvlc_media_list_player_set_media_list(p_mlp, p_mlist): '''Set the media list associated with the player. @param p_mlp: media list player instance. @@ -4382,7 +5038,7 @@ def libvlc_media_list_player_set_playback_mode(p_mlp, e_mode): def libvlc_media_player_new(p_libvlc_instance): '''Create an empty Media Player object. @param p_libvlc_instance: the libvlc instance in which the Media Player should be created. - @return: a new media player object, or NULL on error. + @return: a new media player object, or None on error. ''' f = _Cfunctions.get('libvlc_media_player_new', None) or \ _Cfunction('libvlc_media_player_new', ((1,),), class_result(MediaPlayer), @@ -4392,7 +5048,7 @@ def libvlc_media_player_new(p_libvlc_instance): def libvlc_media_player_new_from_media(p_md): '''Create a Media Player object from a Media. @param p_md: the media. Afterwards the p_md can be safely destroyed. - @return: a new media player object, or NULL on error. + @return: a new media player object, or None on error. ''' f = _Cfunctions.get('libvlc_media_player_new_from_media', None) or \ _Cfunction('libvlc_media_player_new_from_media', ((1,),), class_result(MediaPlayer), @@ -4436,7 +5092,7 @@ def libvlc_media_player_set_media(p_mi, p_md): def libvlc_media_player_get_media(p_mi): '''Get the media used by the media_player. @param p_mi: the Media Player. - @return: the media associated with p_mi, or NULL if no media is associated. + @return: the media associated with p_mi, or None if no media is associated. ''' f = _Cfunctions.get('libvlc_media_player_get_media', None) or \ _Cfunction('libvlc_media_player_get_media', ((1,),), class_result(Media), @@ -4508,9 +5164,9 @@ def libvlc_video_set_callbacks(mp, lock, unlock, display, opaque): Use L{libvlc_video_set_format}() or L{libvlc_video_set_format_callbacks}() to configure the decoded format. @param mp: the media player. - @param lock: callback to lock video memory (must not be NULL). - @param unlock: callback to unlock video memory (or NULL if not needed). - @param display: callback to display video (or NULL if not needed). + @param lock: callback to lock video memory (must not be None). + @param unlock: callback to unlock video memory (or None if not needed). + @param display: callback to display video (or None if not needed). @param opaque: private pointer for the three callbacks (as first parameter). @version: LibVLC 1.1.1 or later. ''' @@ -4540,8 +5196,8 @@ def libvlc_video_set_format_callbacks(mp, setup, cleanup): '''Set decoded video chroma and dimensions. This only works in combination with L{libvlc_video_set_callbacks}(). @param mp: the media player. - @param setup: callback to select the video format (cannot be NULL). - @param cleanup: callback to release any allocated resources (or NULL). + @param setup: callback to select the video format (cannot be None). + @param cleanup: callback to release any allocated resources (or None). @version: LibVLC 2.0.0 or later. ''' f = _Cfunctions.get('libvlc_video_set_format_callbacks', None) or \ @@ -4554,7 +5210,7 @@ def libvlc_media_player_set_nsobject(p_mi, drawable): Use the vout called "macosx". The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding protocol: - @begincode + @code.m \@protocol VLCOpenGLVideoViewEmbedding - (void)addVoutSubview:(NSView *)view; - (void)removeVoutSubview:(NSView *)view; @@ -4563,7 +5219,7 @@ def libvlc_media_player_set_nsobject(p_mi, drawable): Or it can be an NSView object. If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then the following code should work: - @begincode + @code.mm NSView *video = [[NSView alloc] init]; QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent); @@ -4591,9 +5247,7 @@ def libvlc_media_player_get_nsobject(p_mi): return f(p_mi) def libvlc_media_player_set_agl(p_mi, drawable): - '''Set the agl handler where the media player should render its video output. - @param p_mi: the Media Player. - @param drawable: the agl handler. + '''\deprecated Use L{libvlc_media_player_set_nsobject} instead. ''' f = _Cfunctions.get('libvlc_media_player_set_agl', None) or \ _Cfunction('libvlc_media_player_set_agl', ((1,), (1,),), None, @@ -4601,9 +5255,7 @@ def libvlc_media_player_set_agl(p_mi, drawable): return f(p_mi, drawable) def libvlc_media_player_get_agl(p_mi): - '''Get the agl handler previously set with L{libvlc_media_player_set_agl}(). - @param p_mi: the Media Player. - @return: the agl handler or 0 if none where set. + '''\deprecated Use L{libvlc_media_player_get_nsobject} instead. ''' f = _Cfunctions.get('libvlc_media_player_get_agl', None) or \ _Cfunction('libvlc_media_player_get_agl', ((1,),), None, @@ -4612,15 +5264,24 @@ def libvlc_media_player_get_agl(p_mi): def libvlc_media_player_set_xwindow(p_mi, drawable): '''Set an X Window System drawable where the media player should render its - video output. If LibVLC was built without X11 output support, then this has - no effects. - The specified identifier must correspond to an existing Input/Output class - X11 window. Pixmaps are B{not} supported. The caller shall ensure that - the X11 server is the same as the one the VLC instance has been configured - with. This function must be called before video playback is started; - otherwise it will only take effect after playback stop and restart. - @param p_mi: the Media Player. - @param drawable: the ID of the X window. + video output. The call takes effect when the playback starts. If it is + already started, it might need to be stopped before changes apply. + If LibVLC was built without X11 output support, then this function has no + effects. + By default, LibVLC will capture input events on the video rendering area. + Use L{libvlc_video_set_mouse_input}() and L{libvlc_video_set_key_input}() to + disable that and deliver events to the parent window / to the application + instead. By design, the X11 protocol delivers input events to only one + recipient. + @warning + The application must call the XInitThreads() function from Xlib before + L{libvlc_new}(), and before any call to XOpenDisplay() directly or via any + other library. Failure to call XInitThreads() will seriously impede LibVLC + performance. Calling XOpenDisplay() before XInitThreads() will eventually + crash the process. That is a limitation of Xlib. + @param p_mi: media player. + @param drawable: X11 window ID @note The specified identifier must correspond to an existing Input/Output class X11 window. Pixmaps are B{not} currently supported. The default X11 server is assumed, i.e. that specified in the DISPLAY environment variable. @warning LibVLC can deal with invalid X11 handle errors, however some display drivers (EGL, GLX, VA and/or VDPAU) can unfortunately not. Thus the window handle must remain valid until playback is stopped, otherwise the process may abort or crash. + @bug No more than one window handle per media player instance can be specified. If the media has multiple simultaneously active video tracks, extra tracks will be rendered into external windows beyond the control of the application. ''' f = _Cfunctions.get('libvlc_media_player_set_xwindow', None) or \ _Cfunction('libvlc_media_player_set_xwindow', ((1,), (1,),), None, @@ -4657,23 +5318,35 @@ def libvlc_media_player_get_hwnd(p_mi): L{libvlc_media_player_set_hwnd}(). The handle will be returned even if LibVLC is not currently outputting any video to it. @param p_mi: the Media Player. - @return: a window handle or NULL if there are none. + @return: a window handle or None if there are none. ''' f = _Cfunctions.get('libvlc_media_player_get_hwnd', None) or \ _Cfunction('libvlc_media_player_get_hwnd', ((1,),), None, ctypes.c_void_p, MediaPlayer) return f(p_mi) +def libvlc_media_player_set_android_context(p_mi, p_jvm, p_awindow_handler): + '''Set the android context. + @param p_mi: the media player. + @param p_jvm: the Java VM of the android process. + @param awindow_handler: org.videolan.libvlc.IAWindowNativeHandler jobject implemented by the org.videolan.libvlc.MediaPlayer class from the libvlc-android project. + @version: LibVLC 3.0.0 and later. + ''' + f = _Cfunctions.get('libvlc_media_player_set_android_context', None) or \ + _Cfunction('libvlc_media_player_set_android_context', ((1,), (1,), (1,),), None, + None, MediaPlayer, ctypes.c_void_p, ctypes.c_void_p) + return f(p_mi, p_jvm, p_awindow_handler) + def libvlc_audio_set_callbacks(mp, play, pause, resume, flush, drain, opaque): '''Set callbacks and private data for decoded audio. Use L{libvlc_audio_set_format}() or L{libvlc_audio_set_format_callbacks}() to configure the decoded audio format. @param mp: the media player. - @param play: callback to play audio samples (must not be NULL). - @param pause: callback to pause playback (or NULL to ignore). - @param resume: callback to resume playback (or NULL to ignore). - @param flush: callback to flush audio buffers (or NULL to ignore). - @param drain: callback to drain audio buffers (or NULL to ignore). + @param play: callback to play audio samples (must not be None). + @param pause: callback to pause playback (or None to ignore). + @param resume: callback to resume playback (or None to ignore). + @param flush: callback to flush audio buffers (or None to ignore). + @param drain: callback to drain audio buffers (or None to ignore). @param opaque: private pointer for the audio callbacks (as first parameter). @version: LibVLC 2.0.0 or later. ''' @@ -4683,11 +5356,12 @@ def libvlc_audio_set_callbacks(mp, play, pause, resume, flush, drain, opaque): return f(mp, play, pause, resume, flush, drain, opaque) def libvlc_audio_set_volume_callback(mp, set_volume): - '''Set callbacks and private data for decoded audio. + '''Set callbacks and private data for decoded audio. This only works in + combination with L{libvlc_audio_set_callbacks}(). Use L{libvlc_audio_set_format}() or L{libvlc_audio_set_format_callbacks}() to configure the decoded audio format. @param mp: the media player. - @param set_volume: callback to apply audio volume, or NULL to apply volume in software. + @param set_volume: callback to apply audio volume, or None to apply volume in software. @version: LibVLC 2.0.0 or later. ''' f = _Cfunctions.get('libvlc_audio_set_volume_callback', None) or \ @@ -4699,8 +5373,8 @@ def libvlc_audio_set_format_callbacks(mp, setup, cleanup): '''Set decoded audio format. This only works in combination with L{libvlc_audio_set_callbacks}(). @param mp: the media player. - @param setup: callback to select the audio format (cannot be NULL). - @param cleanup: callback to release any allocated resources (or NULL). + @param setup: callback to select the audio format (cannot be None). + @param cleanup: callback to release any allocated resources (or None). @version: LibVLC 2.0.0 or later. ''' f = _Cfunctions.get('libvlc_audio_set_format_callbacks', None) or \ @@ -5128,7 +5802,7 @@ def libvlc_video_set_scale(p_mi, f_factor): def libvlc_video_get_aspect_ratio(p_mi): '''Get current video aspect ratio. @param p_mi: the media player. - @return: the video aspect ratio or NULL if unspecified (the result must be released with free() or L{libvlc_free}()). + @return: the video aspect ratio or None if unspecified (the result must be released with free() or L{libvlc_free}()). ''' f = _Cfunctions.get('libvlc_video_get_aspect_ratio', None) or \ _Cfunction('libvlc_video_get_aspect_ratio', ((1,),), string_result, @@ -5138,7 +5812,7 @@ def libvlc_video_get_aspect_ratio(p_mi): def libvlc_video_set_aspect_ratio(p_mi, psz_aspect): '''Set new video aspect ratio. @param p_mi: the media player. - @param psz_aspect: new video aspect-ratio or NULL to reset to default @note Invalid aspect ratios are ignored. + @param psz_aspect: new video aspect-ratio or None to reset to default @note Invalid aspect ratios are ignored. ''' f = _Cfunctions.get('libvlc_video_set_aspect_ratio', None) or \ _Cfunction('libvlc_video_set_aspect_ratio', ((1,), (1,),), None, @@ -5168,7 +5842,7 @@ def libvlc_video_get_spu_count(p_mi): def libvlc_video_get_spu_description(p_mi): '''Get the description of available video subtitles. @param p_mi: the media player. - @return: list containing description of available video subtitles. + @return: list containing description of available video subtitles. It must be freed with L{libvlc_track_description_list_release}(). ''' f = _Cfunctions.get('libvlc_video_get_spu_description', None) or \ _Cfunction('libvlc_video_get_spu_description', ((1,),), None, @@ -5224,31 +5898,57 @@ def libvlc_video_set_spu_delay(p_mi, i_delay): ctypes.c_int, MediaPlayer, ctypes.c_int64) return f(p_mi, i_delay) -def libvlc_video_get_title_description(p_mi): - '''Get the description of available titles. +def libvlc_media_player_get_full_title_descriptions(p_mi, titles): + '''Get the full description of available titles. @param p_mi: the media player. - @return: list containing description of available titles. + @param address: to store an allocated array of title descriptions descriptions (must be freed with L{libvlc_title_descriptions_release}() by the caller) [OUT]. + @return: the number of titles (-1 on error). + @version: LibVLC 3.0.0 and later. ''' - f = _Cfunctions.get('libvlc_video_get_title_description', None) or \ - _Cfunction('libvlc_video_get_title_description', ((1,),), None, - ctypes.POINTER(TrackDescription), MediaPlayer) - return f(p_mi) + f = _Cfunctions.get('libvlc_media_player_get_full_title_descriptions', None) or \ + _Cfunction('libvlc_media_player_get_full_title_descriptions', ((1,), (1,),), None, + ctypes.c_int, MediaPlayer, ctypes.POINTER(ctypes.POINTER(TitleDescription))) + return f(p_mi, titles) -def libvlc_video_get_chapter_description(p_mi, i_title): - '''Get the description of available chapters for specific title. - @param p_mi: the media player. - @param i_title: selected title. - @return: list containing description of available chapter for title i_title. +def libvlc_title_descriptions_release(p_titles, i_count): + '''Release a title description. + @param title: description array to release. + @param number: of title descriptions to release. + @version: LibVLC 3.0.0 and later. ''' - f = _Cfunctions.get('libvlc_video_get_chapter_description', None) or \ - _Cfunction('libvlc_video_get_chapter_description', ((1,), (1,),), None, - ctypes.POINTER(TrackDescription), MediaPlayer, ctypes.c_int) - return f(p_mi, i_title) + f = _Cfunctions.get('libvlc_title_descriptions_release', None) or \ + _Cfunction('libvlc_title_descriptions_release', ((1,), (1,),), None, + None, ctypes.POINTER(TitleDescription), ctypes.c_uint) + return f(p_titles, i_count) + +def libvlc_media_player_get_full_chapter_descriptions(p_mi, i_chapters_of_title, pp_chapters): + '''Get the full description of available chapters. + @param p_mi: the media player. + @param index: of the title to query for chapters (uses current title if set to -1). + @param address: to store an allocated array of chapter descriptions descriptions (must be freed with L{libvlc_chapter_descriptions_release}() by the caller) [OUT]. + @return: the number of chapters (-1 on error). + @version: LibVLC 3.0.0 and later. + ''' + f = _Cfunctions.get('libvlc_media_player_get_full_chapter_descriptions', None) or \ + _Cfunction('libvlc_media_player_get_full_chapter_descriptions', ((1,), (1,), (1,),), None, + ctypes.c_int, MediaPlayer, ctypes.c_int, ctypes.POINTER(ctypes.POINTER(ChapterDescription))) + return f(p_mi, i_chapters_of_title, pp_chapters) + +def libvlc_chapter_descriptions_release(p_chapters, i_count): + '''Release a chapter description. + @param chapter: description array to release. + @param number: of chapter descriptions to release. + @version: LibVLC 3.0.0 and later. + ''' + f = _Cfunctions.get('libvlc_chapter_descriptions_release', None) or \ + _Cfunction('libvlc_chapter_descriptions_release', ((1,), (1,),), None, + None, ctypes.POINTER(ChapterDescription), ctypes.c_uint) + return f(p_chapters, i_count) def libvlc_video_get_crop_geometry(p_mi): '''Get current crop filter geometry. @param p_mi: the media player. - @return: the crop filter geometry or NULL if unset. + @return: the crop filter geometry or None if unset. ''' f = _Cfunctions.get('libvlc_video_get_crop_geometry', None) or \ _Cfunction('libvlc_video_get_crop_geometry', ((1,),), string_result, @@ -5258,7 +5958,7 @@ def libvlc_video_get_crop_geometry(p_mi): def libvlc_video_set_crop_geometry(p_mi, psz_geometry): '''Set new crop filter geometry. @param p_mi: the media player. - @param psz_geometry: new crop filter geometry (NULL to unset). + @param psz_geometry: new crop filter geometry (None to unset). ''' f = _Cfunctions.get('libvlc_video_set_crop_geometry', None) or \ _Cfunction('libvlc_video_set_crop_geometry', ((1,), (1,),), None, @@ -5307,7 +6007,7 @@ def libvlc_video_get_track_count(p_mi): def libvlc_video_get_track_description(p_mi): '''Get the description of available video tracks. @param p_mi: media player. - @return: list with description of available video tracks, or NULL on error. + @return: list with description of available video tracks, or None on error. It must be freed with L{libvlc_track_description_list_release}(). ''' f = _Cfunctions.get('libvlc_video_get_track_description', None) or \ _Cfunction('libvlc_video_get_track_description', ((1,),), None, @@ -5354,7 +6054,7 @@ def libvlc_video_take_snapshot(p_mi, num, psz_filepath, i_width, i_height): def libvlc_video_set_deinterlace(p_mi, psz_mode): '''Enable or disable deinterlace filter. @param p_mi: libvlc media player. - @param psz_mode: type of deinterlace filter, NULL to disable. + @param psz_mode: type of deinterlace filter, None to disable. ''' f = _Cfunctions.get('libvlc_video_set_deinterlace', None) or \ _Cfunction('libvlc_video_set_deinterlace', ((1,), (1,),), None, @@ -5494,7 +6194,7 @@ def libvlc_video_set_adjust_float(p_mi, option, value): def libvlc_audio_output_list_get(p_instance): '''Gets the list of available audio output modules. @param p_instance: libvlc instance. - @return: list of available audio outputs. It must be freed it with In case of error, NULL is returned. + @return: list of available audio outputs. It must be freed with In case of error, None is returned. ''' f = _Cfunctions.get('libvlc_audio_output_list_get', None) or \ _Cfunction('libvlc_audio_output_list_get', ((1,),), None, @@ -5527,13 +6227,13 @@ def libvlc_audio_output_device_enum(mp): '''Gets a list of potential audio output devices, See L{libvlc_audio_output_device_set}(). @note: Not all audio outputs support enumerating devices. - The audio output may be functional even if the list is empty (NULL). + The audio output may be functional even if the list is empty (None). @note: The list may not be exhaustive. @warning: Some audio output devices in the list might not actually work in some circumstances. By default, it is recommended to not specify any explicit audio device. @param mp: media player. - @return: A NULL-terminated linked list of potential audio output devices. It must be freed it with L{libvlc_audio_output_device_list_release}(). + @return: A None-terminated linked list of potential audio output devices. It must be freed with L{libvlc_audio_output_device_list_release}(). @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_output_device_enum', None) or \ @@ -5544,7 +6244,7 @@ def libvlc_audio_output_device_enum(mp): def libvlc_audio_output_device_list_get(p_instance, aout): '''Gets a list of audio output devices for a given audio output module, See L{libvlc_audio_output_device_set}(). - @note: Not all audio outputs support this. In particular, an empty (NULL) + @note: Not all audio outputs support this. In particular, an empty (None) list of devices does B{not} imply that the specified audio output does not work. @note: The list might not be exhaustive. @@ -5553,7 +6253,7 @@ def libvlc_audio_output_device_list_get(p_instance, aout): explicit audio device. @param p_instance: libvlc instance. @param psz_aout: audio output name (as returned by L{libvlc_audio_output_list_get}()). - @return: A NULL-terminated linked list of potential audio output devices. It must be freed it with L{libvlc_audio_output_device_list_release}(). + @return: A None-terminated linked list of potential audio output devices. It must be freed with L{libvlc_audio_output_device_list_release}(). @version: LibVLC 2.1.0 or later. ''' f = _Cfunctions.get('libvlc_audio_output_device_list_get', None) or \ @@ -5573,15 +6273,15 @@ def libvlc_audio_output_device_list_release(p_list): def libvlc_audio_output_device_set(mp, module, device_id): '''Configures an explicit audio output device. - If the module paramater is NULL, audio output will be moved to the device + If the module paramater is None, audio output will be moved to the device specified by the device identifier string immediately. This is the recommended usage. A list of adequate potential device strings can be obtained with L{libvlc_audio_output_device_enum}(). - However passing NULL is supported in LibVLC version 2.2.0 and later only; + However passing None is supported in LibVLC version 2.2.0 and later only; in earlier versions, this function would have no effects when the module - parameter was NULL. - If the module parameter is not NULL, the device parameter of the + parameter was None. + If the module parameter is not None, the device parameter of the corresponding audio output, if it exists, will be set to the specified string. Note that some audio output modules do not have such a parameter (notably MMDevice and PulseAudio). @@ -5593,7 +6293,7 @@ def libvlc_audio_output_device_set(mp, module, device_id): Some audio output modules require further parameters (e.g. a channels map in the case of ALSA). @param mp: media player. - @param module: If NULL, current audio output module. if non-NULL, name of audio output module. + @param module: If None, current audio output module. if non-None, name of audio output module. @param device_id: device identifier string. @return: Nothing. Errors are ignored (this is a design bug). ''' @@ -5602,6 +6302,27 @@ def libvlc_audio_output_device_set(mp, module, device_id): None, MediaPlayer, ctypes.c_char_p, ctypes.c_char_p) return f(mp, module, device_id) +def libvlc_audio_output_device_get(mp): + '''Get the current audio output device identifier. + This complements L{libvlc_audio_output_device_set}(). + @warning: The initial value for the current audio output device identifier + may not be set or may be some unknown value. A LibVLC application should + compare this value against the known device identifiers (e.g. those that + were previously retrieved by a call to L{libvlc_audio_output_device_enum} or + L{libvlc_audio_output_device_list_get}) to find the current audio output device. + It is possible that the selected audio output device changes (an external + change) without a call to L{libvlc_audio_output_device_set}. That may make this + method unsuitable to use if a LibVLC application is attempting to track + dynamic audio device changes as they happen. + @param mp: media player. + @return: the current audio output device identifier None if no device is selected or in case of error (the result must be released with free() or L{libvlc_free}()). + @version: LibVLC 3.0.0 or later. + ''' + f = _Cfunctions.get('libvlc_audio_output_device_get', None) or \ + _Cfunction('libvlc_audio_output_device_get', ((1,),), None, + ctypes.c_char_p, MediaPlayer) + return f(mp) + def libvlc_audio_toggle_mute(p_mi): '''Toggle mute status. @param p_mi: media player @warning Toggling mute atomically is not always possible: On some platforms, other processes can mute the VLC audio playback stream asynchronously. Thus, there is a small race condition where toggling will not work. See also the limitations of L{libvlc_audio_set_mute}(). @@ -5665,7 +6386,7 @@ def libvlc_audio_get_track_count(p_mi): def libvlc_audio_get_track_description(p_mi): '''Get the description of available audio tracks. @param p_mi: media player. - @return: list with description of available audio tracks, or NULL. + @return: list with description of available audio tracks, or None. It must be freed with L{libvlc_track_description_list_release}(). ''' f = _Cfunctions.get('libvlc_audio_get_track_description', None) or \ _Cfunction('libvlc_audio_get_track_description', ((1,),), None, @@ -5752,7 +6473,7 @@ def libvlc_audio_equalizer_get_preset_name(u_index): This name can be used, for example, to prepare a preset label or menu in a user interface. @param u_index: index of the preset, counting from zero. - @return: preset name, or NULL if there is no such preset. + @return: preset name, or None if there is no such preset. @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_preset_name', None) or \ @@ -5789,7 +6510,7 @@ def libvlc_audio_equalizer_new(): L{libvlc_media_player_set_equalizer}(). The returned handle should be freed via L{libvlc_audio_equalizer_release}() when it is no longer needed. - @return: opaque equalizer handle, or NULL on error. + @return: opaque equalizer handle, or None on error. @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_new', None) or \ @@ -5805,7 +6526,7 @@ def libvlc_audio_equalizer_new_from_preset(u_index): The returned handle should be freed via L{libvlc_audio_equalizer_release}() when it is no longer needed. @param u_index: index of the preset, counting from zero. - @return: opaque equalizer handle, or NULL on error. + @return: opaque equalizer handle, or None on error. @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_new_from_preset', None) or \ @@ -5817,8 +6538,8 @@ def libvlc_audio_equalizer_release(p_equalizer): '''Release a previously created equalizer instance. The equalizer was previously created by using L{libvlc_audio_equalizer_new}() or L{libvlc_audio_equalizer_new_from_preset}(). - It is safe to invoke this method with a NULL p_equalizer parameter for no effect. - @param p_equalizer: opaque equalizer handle, or NULL. + It is safe to invoke this method with a None p_equalizer parameter for no effect. + @param p_equalizer: opaque equalizer handle, or None. @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_release', None) or \ @@ -5831,7 +6552,7 @@ def libvlc_audio_equalizer_set_preamp(p_equalizer, f_preamp): The new equalizer settings are subsequently applied to a media player by invoking L{libvlc_media_player_set_equalizer}(). The supplied amplification value will be clamped to the -20.0 to +20.0 range. - @param p_equalizer: valid equalizer handle, must not be NULL. + @param p_equalizer: valid equalizer handle, must not be None. @param f_preamp: preamp value (-20.0 to 20.0 Hz). @return: zero on success, -1 on error. @version: LibVLC 2.2.0 or later. @@ -5843,7 +6564,7 @@ def libvlc_audio_equalizer_set_preamp(p_equalizer, f_preamp): def libvlc_audio_equalizer_get_preamp(p_equalizer): '''Get the current pre-amplification value from an equalizer. - @param p_equalizer: valid equalizer handle, must not be NULL. + @param p_equalizer: valid equalizer handle, must not be None. @return: preamp value (Hz). @version: LibVLC 2.2.0 or later. ''' @@ -5857,7 +6578,7 @@ def libvlc_audio_equalizer_set_amp_at_index(p_equalizer, f_amp, u_band): The new equalizer settings are subsequently applied to a media player by invoking L{libvlc_media_player_set_equalizer}(). The supplied amplification value will be clamped to the -20.0 to +20.0 range. - @param p_equalizer: valid equalizer handle, must not be NULL. + @param p_equalizer: valid equalizer handle, must not be None. @param f_amp: amplification value (-20.0 to 20.0 Hz). @param u_band: index, counting from zero, of the frequency band to set. @return: zero on success, -1 on error. @@ -5870,7 +6591,7 @@ def libvlc_audio_equalizer_set_amp_at_index(p_equalizer, f_amp, u_band): def libvlc_audio_equalizer_get_amp_at_index(p_equalizer, u_band): '''Get the amplification value for a particular equalizer frequency band. - @param p_equalizer: valid equalizer handle, must not be NULL. + @param p_equalizer: valid equalizer handle, must not be None. @param u_band: index, counting from zero, of the frequency band to get. @return: amplification value (Hz); NaN if there is no such frequency band. @version: LibVLC 2.2.0 or later. @@ -5891,13 +6612,13 @@ def libvlc_media_player_set_equalizer(p_mi, p_equalizer): If there is no currently playing media, the new equalizer settings will be applied later if and when new media is played. Equalizer settings will automatically be applied to subsequently played media. - To disable the equalizer for a media player invoke this method passing NULL for the + To disable the equalizer for a media player invoke this method passing None for the p_equalizer parameter. The media player does not keep a reference to the supplied equalizer so it is safe for an application to release the equalizer reference any time after this method returns. @param p_mi: opaque media player handle. - @param p_equalizer: opaque equalizer handle, or NULL to disable the equalizer for this media player. + @param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player. @return: zero on success, -1 on error. @version: LibVLC 2.2.0 or later. ''' @@ -6106,7 +6827,7 @@ def libvlc_vlm_show_media(p_instance, psz_name): vlm_media_t though. @param p_instance: the instance. @param psz_name: the name of the media, if the name is an empty string, all media is described. - @return: string with information about named media, or NULL on error. + @return: string with information about named media, or None on error. ''' f = _Cfunctions.get('libvlc_vlm_show_media', None) or \ _Cfunction('libvlc_vlm_show_media', ((1,), (1,),), string_result, @@ -6218,7 +6939,7 @@ def libvlc_vlm_get_event_manager(p_instance): # libvlc_printerr # libvlc_set_exit_handler -# 28 function(s) not wrapped as methods: +# 31 function(s) not wrapped as methods: # libvlc_audio_equalizer_get_amp_at_index # libvlc_audio_equalizer_get_band_count # libvlc_audio_equalizer_get_band_frequency @@ -6232,6 +6953,7 @@ def libvlc_vlm_get_event_manager(p_instance): # libvlc_audio_equalizer_set_preamp # libvlc_audio_output_device_list_release # libvlc_audio_output_list_release +# libvlc_chapter_descriptions_release # libvlc_clearerr # libvlc_clock # libvlc_errmsg @@ -6242,9 +6964,11 @@ def libvlc_vlm_get_event_manager(p_instance): # libvlc_get_version # libvlc_log_get_context # libvlc_log_get_object +# libvlc_media_get_codec_description # libvlc_media_tracks_release # libvlc_module_description_list_release # libvlc_new +# libvlc_title_descriptions_release # libvlc_track_description_list_release # libvlc_vprinterr