Module vlc
[hide private]
[frames] | no frames]

Source Code for Module vlc

   1  #! /usr/bin/python 
   2  # -*- coding: utf-8 -*- 
   3   
   4  # Python ctypes bindings for VLC 
   5  # 
   6  # Copyright (C) 2009-2017 the VideoLAN team 
   7  # $Id: $ 
   8  # 
   9  # Authors: Olivier Aubert <contact at olivieraubert.net> 
  10  #          Jean Brouwers <MrJean1 at gmail.com> 
  11  #          Geoff Salmon <geoff.salmon at gmail.com> 
  12  # 
  13  # This library is free software; you can redistribute it and/or modify 
  14  # it under the terms of the GNU Lesser General Public License as 
  15  # published by the Free Software Foundation; either version 2.1 of the 
  16  # License, or (at your option) any later version. 
  17  # 
  18  # This library is distributed in the hope that it will be useful, but 
  19  # WITHOUT ANY WARRANTY; without even the implied warranty of 
  20  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
  21  # Lesser General Public License for more details. 
  22  # 
  23  # You should have received a copy of the GNU Lesser General Public 
  24  # License along with this library; if not, write to the Free Software 
  25  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA 
  26   
  27  """This module provides bindings for the LibVLC public API, see 
  28  U{http://wiki.videolan.org/LibVLC}. 
  29   
  30  You can find the documentation and a README file with some examples 
  31  at U{https://www.olivieraubert.net/vlc/python-ctypes/}. 
  32   
  33  Basically, the most important class is L{Instance}, which is used 
  34  to create a libvlc instance.  From this instance, you then create 
  35  L{MediaPlayer} and L{MediaListPlayer} instances. 
  36   
  37  Alternatively, you may create instances of the L{MediaPlayer} and 
  38  L{MediaListPlayer} class directly and an instance of L{Instance} 
  39  will be implicitly created.  The latter can be obtained using the 
  40  C{get_instance} method of L{MediaPlayer} and L{MediaListPlayer}. 
  41  """ 
  42   
  43  import ctypes 
  44  from ctypes.util import find_library 
  45  import os 
  46  import sys 
  47  import functools 
  48   
  49  # Used by EventManager in override.py 
  50  from inspect import getargspec 
  51   
  52  import logging 
  53  logger = logging.getLogger(__name__) 
  54   
  55  __version__ = "3.0.11115" 
  56  __libvlc_version__ = "3.0.11" 
  57  __generator_version__ = "1.15" 
  58  build_date  = "Sat Jul 25 15:07:40 2020 3.0.11" 
  59   
  60  # The libvlc doc states that filenames are expected to be in UTF8, do 
  61  # not rely on sys.getfilesystemencoding() which will be confused, 
  62  # esp. on windows. 
  63  DEFAULT_ENCODING = 'utf-8' 
  64   
  65  if sys.version_info[0] > 2: 
  66      str = str 
  67      unicode = str 
  68      bytes = bytes 
  69      basestring = (str, bytes) 
  70      PYTHON3 = True 
71 - def str_to_bytes(s):
72 """Translate string or bytes to bytes. 73 """ 74 if isinstance(s, str): 75 return bytes(s, DEFAULT_ENCODING) 76 else: 77 return s
78
79 - def bytes_to_str(b):
80 """Translate bytes to string. 81 """ 82 if isinstance(b, bytes): 83 return b.decode(DEFAULT_ENCODING) 84 else: 85 return b
86 else: 87 str = str 88 unicode = unicode 89 bytes = str 90 basestring = basestring 91 PYTHON3 = False
92 - def str_to_bytes(s):
93 """Translate string or bytes to bytes. 94 """ 95 if isinstance(s, unicode): 96 return s.encode(DEFAULT_ENCODING) 97 else: 98 return s
99
100 - def bytes_to_str(b):
101 """Translate bytes to unicode string. 102 """ 103 if isinstance(b, str): 104 return unicode(b, DEFAULT_ENCODING) 105 else: 106 return b
107 108 # Internal guard to prevent internal classes to be directly 109 # instanciated. 110 _internal_guard = object()
111 112 -def find_lib():
113 dll = None 114 plugin_path = os.environ.get('PYTHON_VLC_MODULE_PATH', None) 115 if 'PYTHON_VLC_LIB_PATH' in os.environ: 116 try: 117 dll = ctypes.CDLL(os.environ['PYTHON_VLC_LIB_PATH']) 118 except OSError: 119 logger.error("Cannot load lib specified by PYTHON_VLC_LIB_PATH env. variable") 120 sys.exit(1) 121 if plugin_path and not os.path.isdir(plugin_path): 122 logger.error("Invalid PYTHON_VLC_MODULE_PATH specified. Please fix.") 123 sys.exit(1) 124 if dll is not None: 125 return dll, plugin_path 126 127 if sys.platform.startswith('win'): 128 libname = 'libvlc.dll' 129 p = find_library(libname) 130 if p is None: 131 try: # some registry settings 132 # leaner than win32api, win32con 133 if PYTHON3: 134 import winreg as w 135 else: 136 import _winreg as w 137 for r in w.HKEY_LOCAL_MACHINE, w.HKEY_CURRENT_USER: 138 try: 139 r = w.OpenKey(r, 'Software\\VideoLAN\\VLC') 140 plugin_path, _ = w.QueryValueEx(r, 'InstallDir') 141 w.CloseKey(r) 142 break 143 except w.error: 144 pass 145 except ImportError: # no PyWin32 146 pass 147 if plugin_path is None: 148 # try some standard locations. 149 programfiles = os.environ["ProgramFiles"] 150 homedir = os.environ["HOMEDRIVE"] 151 for p in ('{programfiles}\\VideoLan{libname}', '{homedir}:\\VideoLan{libname}', 152 '{programfiles}{libname}', '{homedir}:{libname}'): 153 p = p.format(homedir = homedir, 154 programfiles = programfiles, 155 libname = '\\VLC\\' + libname) 156 if os.path.exists(p): 157 plugin_path = os.path.dirname(p) 158 break 159 if plugin_path is not None: # try loading 160 # PyInstaller Windows fix 161 if 'PyInstallerCDLL' in ctypes.CDLL.__name__: 162 ctypes.windll.kernel32.SetDllDirectoryW(None) 163 p = os.getcwd() 164 os.chdir(plugin_path) 165 # if chdir failed, this will raise an exception 166 dll = ctypes.CDLL('.\\' + libname) 167 # restore cwd after dll has been loaded 168 os.chdir(p) 169 else: # may fail 170 dll = ctypes.CDLL('.\\' + libname) 171 else: 172 plugin_path = os.path.dirname(p) 173 dll = ctypes.CDLL(p) 174 175 elif sys.platform.startswith('darwin'): 176 # FIXME: should find a means to configure path 177 d = '/Applications/VLC.app/Contents/MacOS/' 178 c = d + 'lib/libvlccore.dylib' 179 p = d + 'lib/libvlc.dylib' 180 if os.path.exists(p) and os.path.exists(c): 181 # pre-load libvlccore VLC 2.2.8+ 182 ctypes.CDLL(c) 183 dll = ctypes.CDLL(p) 184 for p in ('modules', 'plugins'): 185 p = d + p 186 if os.path.isdir(p): 187 plugin_path = p 188 break 189 else: # hope, some [DY]LD_LIBRARY_PATH is set... 190 # pre-load libvlccore VLC 2.2.8+ 191 ctypes.CDLL('libvlccore.dylib') 192 dll = ctypes.CDLL('libvlc.dylib') 193 194 else: 195 # All other OSes (linux, freebsd...) 196 p = find_library('vlc') 197 try: 198 dll = ctypes.CDLL(p) 199 except OSError: # may fail 200 dll = None 201 if dll is None: 202 try: 203 dll = ctypes.CDLL('libvlc.so.5') 204 except: 205 raise NotImplementedError('Cannot find libvlc lib') 206 207 return (dll, plugin_path)
208 209 # plugin_path used on win32 and MacOS in override.py 210 dll, plugin_path = find_lib()
211 212 -class VLCException(Exception):
213 """Exception raised by libvlc methods. 214 """ 215 pass
216 217 try: 218 _Ints = (int, long) 219 except NameError: # no long in Python 3+ 220 _Ints = int 221 _Seqs = (list, tuple)
222 223 # Used for handling *event_manager() methods. 224 -class memoize_parameterless(object):
225 """Decorator. Caches a parameterless method's return value each time it is called. 226 227 If called later with the same arguments, the cached value is returned 228 (not reevaluated). 229 Adapted from https://wiki.python.org/moin/PythonDecoratorLibrary 230 """
231 - def __init__(self, func):
232 self.func = func 233 self._cache = {}
234
235 - def __call__(self, obj):
236 try: 237 return self._cache[obj] 238 except KeyError: 239 v = self._cache[obj] = self.func(obj) 240 return v
241
242 - def __repr__(self):
243 """Return the function's docstring. 244 """ 245 return self.func.__doc__
246
247 - def __get__(self, obj, objtype):
248 """Support instance methods. 249 """ 250 return functools.partial(self.__call__, obj)
251 252 # Default instance. It is used to instanciate classes directly in the 253 # OO-wrapper. 254 _default_instance = None
255 256 -def get_default_instance():
257 """Return the default VLC.Instance. 258 """ 259 global _default_instance 260 if _default_instance is None: 261 _default_instance = Instance() 262 return _default_instance
263
264 -def try_fspath(path):
265 """Try calling os.fspath 266 os.fspath is only available from py3.6 267 """ 268 try: 269 return os.fspath(path) 270 except (AttributeError, TypeError): 271 return path
272 273 _Cfunctions = {} # from LibVLC __version__ 274 _Globals = globals() # sys.modules[__name__].__dict__
275 276 -def _Cfunction(name, flags, errcheck, *types):
277 """(INTERNAL) New ctypes function binding. 278 """ 279 if hasattr(dll, name) and name in _Globals: 280 p = ctypes.CFUNCTYPE(*types) 281 f = p((name, dll), flags) 282 if errcheck is not None: 283 f.errcheck = errcheck 284 # replace the Python function 285 # in this module, but only when 286 # running as python -O or -OO 287 if __debug__: 288 _Cfunctions[name] = f 289 else: 290 _Globals[name] = f 291 return f 292 raise NameError('no function %r' % (name,))
293
294 -def _Cobject(cls, ctype):
295 """(INTERNAL) New instance from ctypes. 296 """ 297 o = object.__new__(cls) 298 o._as_parameter_ = ctype 299 return o
300
301 -def _Constructor(cls, ptr=_internal_guard):
302 """(INTERNAL) New wrapper from ctypes. 303 """ 304 if ptr == _internal_guard: 305 raise VLCException("(INTERNAL) ctypes class. You should get references for this class through methods of the LibVLC API.") 306 if ptr is None or ptr == 0: 307 return None 308 return _Cobject(cls, ctypes.c_void_p(ptr))
309
310 -class _Cstruct(ctypes.Structure):
311 """(INTERNAL) Base class for ctypes structures. 312 """ 313 _fields_ = [] # list of 2-tuples ('name', ctypes.<type>) 314
315 - def __str__(self):
316 l = [' %s:\t%s' % (n, getattr(self, n)) for n, _ in self._fields_] 317 return '\n'.join([self.__class__.__name__] + l)
318
319 - def __repr__(self):
320 return '%s.%s' % (self.__class__.__module__, self)
321
322 -class _Ctype(object):
323 """(INTERNAL) Base class for ctypes. 324 """ 325 @staticmethod
326 - def from_param(this): # not self
327 """(INTERNAL) ctypes parameter conversion method. 328 """ 329 if this is None: 330 return None 331 return this._as_parameter_
332
333 -class ListPOINTER(object):
334 """Just like a POINTER but accept a list of etype elements as an argument. 335 """
336 - def __init__(self, etype):
337 self.etype = etype
338
339 - def from_param(self, param):
340 if isinstance(param, _Seqs): 341 return (self.etype * len(param))(*param) 342 else: 343 return ctypes.POINTER(param)
344
345 # errcheck functions for some native functions. 346 -def string_result(result, func, arguments):
347 """Errcheck function. Returns a string and frees the original pointer. 348 349 It assumes the result is a char *. 350 """ 351 if result: 352 # make a python string copy 353 s = bytes_to_str(ctypes.string_at(result)) 354 # free original string ptr 355 libvlc_free(result) 356 return s 357 return None
358
359 -def class_result(classname):
360 """Errcheck function. Returns a function that creates the specified class. 361 """ 362 def wrap_errcheck(result, func, arguments): 363 if result is None: 364 return None 365 return classname(result)
366 return wrap_errcheck 367
368 # Wrapper for the opaque struct libvlc_log_t 369 -class Log(ctypes.Structure):
370 pass
371 Log_ptr = ctypes.POINTER(Log)
372 373 # FILE* ctypes wrapper, copied from 374 # http://svn.python.org/projects/ctypes/trunk/ctypeslib/ctypeslib/contrib/pythonhdr.py 375 -class FILE(ctypes.Structure):
376 pass
377 FILE_ptr = ctypes.POINTER(FILE) 378 379 if PYTHON3: 380 PyFile_FromFd = ctypes.pythonapi.PyFile_FromFd 381 PyFile_FromFd.restype = ctypes.py_object 382 PyFile_FromFd.argtypes = [ctypes.c_int, 383 ctypes.c_char_p, 384 ctypes.c_char_p, 385 ctypes.c_int, 386 ctypes.c_char_p, 387 ctypes.c_char_p, 388 ctypes.c_char_p, 389 ctypes.c_int ] 390 391 PyFile_AsFd = ctypes.pythonapi.PyObject_AsFileDescriptor 392 PyFile_AsFd.restype = ctypes.c_int 393 PyFile_AsFd.argtypes = [ctypes.py_object] 394 else: 395 PyFile_FromFile = ctypes.pythonapi.PyFile_FromFile 396 PyFile_FromFile.restype = ctypes.py_object 397 PyFile_FromFile.argtypes = [FILE_ptr, 398 ctypes.c_char_p, 399 ctypes.c_char_p, 400 ctypes.CFUNCTYPE(ctypes.c_int, FILE_ptr)] 401 402 PyFile_AsFile = ctypes.pythonapi.PyFile_AsFile 403 PyFile_AsFile.restype = FILE_ptr 404 PyFile_AsFile.argtypes = [ctypes.py_object]
405 406 # Generated enum types # 407 408 -class _Enum(ctypes.c_uint):
409 '''(INTERNAL) Base class 410 ''' 411 _enum_names_ = {} 412
413 - def __str__(self):
414 n = self._enum_names_.get(self.value, '') or ('FIXME_(%r)' % (self.value,)) 415 return '.'.join((self.__class__.__name__, n))
416
417 - def __hash__(self):
418 return self.value
419
420 - def __repr__(self):
421 return '.'.join((self.__class__.__module__, self.__str__()))
422
423 - def __eq__(self, other):
424 return ( (isinstance(other, _Enum) and self.value == other.value) 425 or (isinstance(other, _Ints) and self.value == other) )
426
427 - def __ne__(self, other):
428 return not self.__eq__(other)
429
430 -class LogLevel(_Enum):
431 '''Logging messages level. 432 \note future libvlc versions may define new levels. 433 ''' 434 _enum_names_ = { 435 0: 'DEBUG', 436 2: 'NOTICE', 437 3: 'WARNING', 438 4: 'ERROR', 439 }
440 LogLevel.DEBUG = LogLevel(0) 441 LogLevel.ERROR = LogLevel(4) 442 LogLevel.NOTICE = LogLevel(2) 443 LogLevel.WARNING = LogLevel(3)
444 445 -class MediaDiscovererCategory(_Enum):
446 '''Category of a media discoverer 447 See libvlc_media_discoverer_list_get(). 448 ''' 449 _enum_names_ = { 450 0: 'devices', 451 1: 'lan', 452 2: 'podcasts', 453 3: 'localdirs', 454 }
455 MediaDiscovererCategory.devices = MediaDiscovererCategory(0) 456 MediaDiscovererCategory.lan = MediaDiscovererCategory(1) 457 MediaDiscovererCategory.localdirs = MediaDiscovererCategory(3) 458 MediaDiscovererCategory.podcasts = MediaDiscovererCategory(2)
459 460 -class DialogQuestionType(_Enum):
461 '''@defgroup libvlc_dialog libvlc dialog 462 @ingroup libvlc 463 @{ 464 @file 465 libvlc dialog external api. 466 ''' 467 _enum_names_ = { 468 0: 'DIALOG_QUESTION_NORMAL', 469 1: 'DIALOG_QUESTION_WARNING', 470 2: 'DIALOG_QUESTION_CRITICAL', 471 }
472 DialogQuestionType.DIALOG_QUESTION_CRITICAL = DialogQuestionType(2) 473 DialogQuestionType.DIALOG_QUESTION_NORMAL = DialogQuestionType(0) 474 DialogQuestionType.DIALOG_QUESTION_WARNING = DialogQuestionType(1)
475 476 -class EventType(_Enum):
477 '''Event types. 478 ''' 479 _enum_names_ = { 480 0: 'MediaMetaChanged', 481 1: 'MediaSubItemAdded', 482 2: 'MediaDurationChanged', 483 3: 'MediaParsedChanged', 484 4: 'MediaFreed', 485 5: 'MediaStateChanged', 486 6: 'MediaSubItemTreeAdded', 487 0x100: 'MediaPlayerMediaChanged', 488 257: 'MediaPlayerNothingSpecial', 489 258: 'MediaPlayerOpening', 490 259: 'MediaPlayerBuffering', 491 260: 'MediaPlayerPlaying', 492 261: 'MediaPlayerPaused', 493 262: 'MediaPlayerStopped', 494 263: 'MediaPlayerForward', 495 264: 'MediaPlayerBackward', 496 265: 'MediaPlayerEndReached', 497 266: 'MediaPlayerEncounteredError', 498 267: 'MediaPlayerTimeChanged', 499 268: 'MediaPlayerPositionChanged', 500 269: 'MediaPlayerSeekableChanged', 501 270: 'MediaPlayerPausableChanged', 502 271: 'MediaPlayerTitleChanged', 503 272: 'MediaPlayerSnapshotTaken', 504 273: 'MediaPlayerLengthChanged', 505 274: 'MediaPlayerVout', 506 275: 'MediaPlayerScrambledChanged', 507 276: 'MediaPlayerESAdded', 508 277: 'MediaPlayerESDeleted', 509 278: 'MediaPlayerESSelected', 510 279: 'MediaPlayerCorked', 511 280: 'MediaPlayerUncorked', 512 281: 'MediaPlayerMuted', 513 282: 'MediaPlayerUnmuted', 514 283: 'MediaPlayerAudioVolume', 515 284: 'MediaPlayerAudioDevice', 516 285: 'MediaPlayerChapterChanged', 517 0x200: 'MediaListItemAdded', 518 513: 'MediaListWillAddItem', 519 514: 'MediaListItemDeleted', 520 515: 'MediaListWillDeleteItem', 521 516: 'MediaListEndReached', 522 0x300: 'MediaListViewItemAdded', 523 769: 'MediaListViewWillAddItem', 524 770: 'MediaListViewItemDeleted', 525 771: 'MediaListViewWillDeleteItem', 526 0x400: 'MediaListPlayerPlayed', 527 1025: 'MediaListPlayerNextItemSet', 528 1026: 'MediaListPlayerStopped', 529 0x500: 'MediaDiscovererStarted', 530 1281: 'MediaDiscovererEnded', 531 1282: 'RendererDiscovererItemAdded', 532 1283: 'RendererDiscovererItemDeleted', 533 0x600: 'VlmMediaAdded', 534 1537: 'VlmMediaRemoved', 535 1538: 'VlmMediaChanged', 536 1539: 'VlmMediaInstanceStarted', 537 1540: 'VlmMediaInstanceStopped', 538 1541: 'VlmMediaInstanceStatusInit', 539 1542: 'VlmMediaInstanceStatusOpening', 540 1543: 'VlmMediaInstanceStatusPlaying', 541 1544: 'VlmMediaInstanceStatusPause', 542 1545: 'VlmMediaInstanceStatusEnd', 543 1546: 'VlmMediaInstanceStatusError', 544 }
545 EventType.MediaDiscovererEnded = EventType(1281) 546 EventType.MediaDiscovererStarted = EventType(0x500) 547 EventType.MediaDurationChanged = EventType(2) 548 EventType.MediaFreed = EventType(4) 549 EventType.MediaListEndReached = EventType(516) 550 EventType.MediaListItemAdded = EventType(0x200) 551 EventType.MediaListItemDeleted = EventType(514) 552 EventType.MediaListPlayerNextItemSet = EventType(1025) 553 EventType.MediaListPlayerPlayed = EventType(0x400) 554 EventType.MediaListPlayerStopped = EventType(1026) 555 EventType.MediaListViewItemAdded = EventType(0x300) 556 EventType.MediaListViewItemDeleted = EventType(770) 557 EventType.MediaListViewWillAddItem = EventType(769) 558 EventType.MediaListViewWillDeleteItem = EventType(771) 559 EventType.MediaListWillAddItem = EventType(513) 560 EventType.MediaListWillDeleteItem = EventType(515) 561 EventType.MediaMetaChanged = EventType(0) 562 EventType.MediaParsedChanged = EventType(3) 563 EventType.MediaPlayerAudioDevice = EventType(284) 564 EventType.MediaPlayerAudioVolume = EventType(283) 565 EventType.MediaPlayerBackward = EventType(264) 566 EventType.MediaPlayerBuffering = EventType(259) 567 EventType.MediaPlayerChapterChanged = EventType(285) 568 EventType.MediaPlayerCorked = EventType(279) 569 EventType.MediaPlayerESAdded = EventType(276) 570 EventType.MediaPlayerESDeleted = EventType(277) 571 EventType.MediaPlayerESSelected = EventType(278) 572 EventType.MediaPlayerEncounteredError = EventType(266) 573 EventType.MediaPlayerEndReached = EventType(265) 574 EventType.MediaPlayerForward = EventType(263) 575 EventType.MediaPlayerLengthChanged = EventType(273) 576 EventType.MediaPlayerMediaChanged = EventType(0x100) 577 EventType.MediaPlayerMuted = EventType(281) 578 EventType.MediaPlayerNothingSpecial = EventType(257) 579 EventType.MediaPlayerOpening = EventType(258) 580 EventType.MediaPlayerPausableChanged = EventType(270) 581 EventType.MediaPlayerPaused = EventType(261) 582 EventType.MediaPlayerPlaying = EventType(260) 583 EventType.MediaPlayerPositionChanged = EventType(268) 584 EventType.MediaPlayerScrambledChanged = EventType(275) 585 EventType.MediaPlayerSeekableChanged = EventType(269) 586 EventType.MediaPlayerSnapshotTaken = EventType(272) 587 EventType.MediaPlayerStopped = EventType(262) 588 EventType.MediaPlayerTimeChanged = EventType(267) 589 EventType.MediaPlayerTitleChanged = EventType(271) 590 EventType.MediaPlayerUncorked = EventType(280) 591 EventType.MediaPlayerUnmuted = EventType(282) 592 EventType.MediaPlayerVout = EventType(274) 593 EventType.MediaStateChanged = EventType(5) 594 EventType.MediaSubItemAdded = EventType(1) 595 EventType.MediaSubItemTreeAdded = EventType(6) 596 EventType.RendererDiscovererItemAdded = EventType(1282) 597 EventType.RendererDiscovererItemDeleted = EventType(1283) 598 EventType.VlmMediaAdded = EventType(0x600) 599 EventType.VlmMediaChanged = EventType(1538) 600 EventType.VlmMediaInstanceStarted = EventType(1539) 601 EventType.VlmMediaInstanceStatusEnd = EventType(1545) 602 EventType.VlmMediaInstanceStatusError = EventType(1546) 603 EventType.VlmMediaInstanceStatusInit = EventType(1541) 604 EventType.VlmMediaInstanceStatusOpening = EventType(1542) 605 EventType.VlmMediaInstanceStatusPause = EventType(1544) 606 EventType.VlmMediaInstanceStatusPlaying = EventType(1543) 607 EventType.VlmMediaInstanceStopped = EventType(1540) 608 EventType.VlmMediaRemoved = EventType(1537)
609 610 -class Meta(_Enum):
611 '''Meta data types. 612 ''' 613 _enum_names_ = { 614 0: 'Title', 615 1: 'Artist', 616 2: 'Genre', 617 3: 'Copyright', 618 4: 'Album', 619 5: 'TrackNumber', 620 6: 'Description', 621 7: 'Rating', 622 8: 'Date', 623 9: 'Setting', 624 10: 'URL', 625 11: 'Language', 626 12: 'NowPlaying', 627 13: 'Publisher', 628 14: 'EncodedBy', 629 15: 'ArtworkURL', 630 16: 'TrackID', 631 17: 'TrackTotal', 632 18: 'Director', 633 19: 'Season', 634 20: 'Episode', 635 21: 'ShowName', 636 22: 'Actors', 637 23: 'AlbumArtist', 638 24: 'DiscNumber', 639 25: 'DiscTotal', 640 }
641 Meta.Actors = Meta(22) 642 Meta.Album = Meta(4) 643 Meta.AlbumArtist = Meta(23) 644 Meta.Artist = Meta(1) 645 Meta.ArtworkURL = Meta(15) 646 Meta.Copyright = Meta(3) 647 Meta.Date = Meta(8) 648 Meta.Description = Meta(6) 649 Meta.Director = Meta(18) 650 Meta.DiscNumber = Meta(24) 651 Meta.DiscTotal = Meta(25) 652 Meta.EncodedBy = Meta(14) 653 Meta.Episode = Meta(20) 654 Meta.Genre = Meta(2) 655 Meta.Language = Meta(11) 656 Meta.NowPlaying = Meta(12) 657 Meta.Publisher = Meta(13) 658 Meta.Rating = Meta(7) 659 Meta.Season = Meta(19) 660 Meta.Setting = Meta(9) 661 Meta.ShowName = Meta(21) 662 Meta.Title = Meta(0) 663 Meta.TrackID = Meta(16) 664 Meta.TrackNumber = Meta(5) 665 Meta.TrackTotal = Meta(17) 666 Meta.URL = Meta(10)
667 668 -class State(_Enum):
669 '''Note the order of libvlc_state_t enum must match exactly the order of 670 See mediacontrol_playerstatus, See input_state_e enums, 671 and videolan.libvlc.state (at bindings/cil/src/media.cs). 672 expected states by web plugins are: 673 idle/close=0, opening=1, playing=3, paused=4, 674 stopping=5, ended=6, error=7. 675 ''' 676 _enum_names_ = { 677 0: 'NothingSpecial', 678 1: 'Opening', 679 2: 'Buffering', 680 3: 'Playing', 681 4: 'Paused', 682 5: 'Stopped', 683 6: 'Ended', 684 7: 'Error', 685 }
686 State.Buffering = State(2) 687 State.Ended = State(6) 688 State.Error = State(7) 689 State.NothingSpecial = State(0) 690 State.Opening = State(1) 691 State.Paused = State(4) 692 State.Playing = State(3) 693 State.Stopped = State(5)
694 695 -class TrackType(_Enum):
696 '''N/A 697 ''' 698 _enum_names_ = { 699 -1: 'unknown', 700 0: 'audio', 701 1: 'video', 702 2: 'ext', 703 }
704 TrackType.audio = TrackType(0) 705 TrackType.ext = TrackType(2) 706 TrackType.unknown = TrackType(-1) 707 TrackType.video = TrackType(1)
708 709 -class VideoOrient(_Enum):
710 '''N/A 711 ''' 712 _enum_names_ = { 713 0: 'top_left', 714 1: 'top_right', 715 2: 'bottom_left', 716 3: 'bottom_right', 717 4: 'left_top', 718 5: 'left_bottom', 719 6: 'right_top', 720 7: 'right_bottom', 721 }
722 VideoOrient.bottom_left = VideoOrient(2) 723 VideoOrient.bottom_right = VideoOrient(3) 724 VideoOrient.left_bottom = VideoOrient(5) 725 VideoOrient.left_top = VideoOrient(4) 726 VideoOrient.right_bottom = VideoOrient(7) 727 VideoOrient.right_top = VideoOrient(6) 728 VideoOrient.top_left = VideoOrient(0) 729 VideoOrient.top_right = VideoOrient(1)
730 731 -class VideoProjection(_Enum):
732 '''N/A 733 ''' 734 _enum_names_ = { 735 0: 'rectangular', 736 1: 'equirectangular', 737 0x100: 'cubemap_layout_standard', 738 }
739 VideoProjection.cubemap_layout_standard = VideoProjection(0x100) 740 VideoProjection.equirectangular = VideoProjection(1) 741 VideoProjection.rectangular = VideoProjection(0)
742 743 -class MediaType(_Enum):
744 '''Media type 745 See libvlc_media_get_type. 746 ''' 747 _enum_names_ = { 748 0: 'unknown', 749 1: 'file', 750 2: 'directory', 751 3: 'disc', 752 4: 'stream', 753 5: 'playlist', 754 }
755 MediaType.directory = MediaType(2) 756 MediaType.disc = MediaType(3) 757 MediaType.file = MediaType(1) 758 MediaType.playlist = MediaType(5) 759 MediaType.stream = MediaType(4) 760 MediaType.unknown = MediaType(0)
761 762 -class MediaParseFlag(_Enum):
763 '''Parse flags used by libvlc_media_parse_with_options() 764 See libvlc_media_parse_with_options. 765 ''' 766 _enum_names_ = { 767 0x0: 'local', 768 0x1: 'network', 769 0x2: 'fetch_local', 770 0x4: 'fetch_network', 771 0x8: 'do_interact', 772 }
773 MediaParseFlag.do_interact = MediaParseFlag(0x8) 774 MediaParseFlag.fetch_local = MediaParseFlag(0x2) 775 MediaParseFlag.fetch_network = MediaParseFlag(0x4) 776 MediaParseFlag.local = MediaParseFlag(0x0) 777 MediaParseFlag.network = MediaParseFlag(0x1)
778 779 -class MediaParsedStatus(_Enum):
780 '''Parse status used sent by libvlc_media_parse_with_options() or returned by 781 libvlc_media_get_parsed_status() 782 See libvlc_media_parse_with_options 783 See libvlc_media_get_parsed_status. 784 ''' 785 _enum_names_ = { 786 1: 'skipped', 787 2: 'failed', 788 3: 'timeout', 789 4: 'done', 790 }
791 MediaParsedStatus.done = MediaParsedStatus(4) 792 MediaParsedStatus.failed = MediaParsedStatus(2) 793 MediaParsedStatus.skipped = MediaParsedStatus(1) 794 MediaParsedStatus.timeout = MediaParsedStatus(3)
795 796 -class MediaSlaveType(_Enum):
797 '''Type of a media slave: subtitle or audio. 798 ''' 799 _enum_names_ = { 800 0: 'subtitle', 801 1: 'audio', 802 }
803 MediaSlaveType.audio = MediaSlaveType(1) 804 MediaSlaveType.subtitle = MediaSlaveType(0)
805 806 -class VideoMarqueeOption(_Enum):
807 '''Marq options definition. 808 ''' 809 _enum_names_ = { 810 0: 'Enable', 811 1: 'Text', 812 2: 'Color', 813 3: 'Opacity', 814 4: 'Position', 815 5: 'Refresh', 816 6: 'Size', 817 7: 'Timeout', 818 8: 'X', 819 9: 'Y', 820 }
821 VideoMarqueeOption.Color = VideoMarqueeOption(2) 822 VideoMarqueeOption.Enable = VideoMarqueeOption(0) 823 VideoMarqueeOption.Opacity = VideoMarqueeOption(3) 824 VideoMarqueeOption.Position = VideoMarqueeOption(4) 825 VideoMarqueeOption.Refresh = VideoMarqueeOption(5) 826 VideoMarqueeOption.Size = VideoMarqueeOption(6) 827 VideoMarqueeOption.Text = VideoMarqueeOption(1) 828 VideoMarqueeOption.Timeout = VideoMarqueeOption(7) 829 VideoMarqueeOption.X = VideoMarqueeOption(8) 830 VideoMarqueeOption.Y = VideoMarqueeOption(9) 843 NavigateMode.activate = NavigateMode(0) 844 NavigateMode.down = NavigateMode(2) 845 NavigateMode.left = NavigateMode(3) 846 NavigateMode.popup = NavigateMode(5) 847 NavigateMode.right = NavigateMode(4) 848 NavigateMode.up = NavigateMode(1)
849 850 -class Position(_Enum):
851 '''Enumeration of values used to set position (e.g. of video title). 852 ''' 853 _enum_names_ = { 854 -1: 'disable', 855 0: 'center', 856 1: 'left', 857 2: 'right', 858 3: 'top', 859 4: 'top_left', 860 5: 'top_right', 861 6: 'bottom', 862 7: 'bottom_left', 863 8: 'bottom_right', 864 }
865 Position.bottom = Position(6) 866 Position.bottom_left = Position(7) 867 Position.bottom_right = Position(8) 868 Position.center = Position(0) 869 Position.disable = Position(-1) 870 Position.left = Position(1) 871 Position.right = Position(2) 872 Position.top = Position(3) 873 Position.top_left = Position(4) 874 Position.top_right = Position(5)
875 876 -class TeletextKey(_Enum):
877 '''Enumeration of teletext keys than can be passed via 878 libvlc_video_set_teletext(). 879 ''' 880 _enum_names_ = { 881 7471104: 'red', 882 6750208: 'green', 883 7929856: 'yellow', 884 6422528: 'blue', 885 6881280: 'index', 886 }
887 TeletextKey.blue = TeletextKey(6422528) 888 TeletextKey.green = TeletextKey(6750208) 889 TeletextKey.index = TeletextKey(6881280) 890 TeletextKey.red = TeletextKey(7471104) 891 TeletextKey.yellow = TeletextKey(7929856)
892 893 -class VideoLogoOption(_Enum):
894 '''Option values for libvlc_video_{get,set}_logo_{int,string}. 895 ''' 896 _enum_names_ = { 897 0: 'logo_enable', 898 1: 'logo_file', 899 2: 'logo_x', 900 3: 'logo_y', 901 4: 'logo_delay', 902 5: 'logo_repeat', 903 6: 'logo_opacity', 904 7: 'logo_position', 905 }
906 VideoLogoOption.logo_delay = VideoLogoOption(4) 907 VideoLogoOption.logo_enable = VideoLogoOption(0) 908 VideoLogoOption.logo_file = VideoLogoOption(1) 909 VideoLogoOption.logo_opacity = VideoLogoOption(6) 910 VideoLogoOption.logo_position = VideoLogoOption(7) 911 VideoLogoOption.logo_repeat = VideoLogoOption(5) 912 VideoLogoOption.logo_x = VideoLogoOption(2) 913 VideoLogoOption.logo_y = VideoLogoOption(3)
914 915 -class VideoAdjustOption(_Enum):
916 '''Option values for libvlc_video_{get,set}_adjust_{int,float,bool}. 917 ''' 918 _enum_names_ = { 919 0: 'Enable', 920 1: 'Contrast', 921 2: 'Brightness', 922 3: 'Hue', 923 4: 'Saturation', 924 5: 'Gamma', 925 }
926 VideoAdjustOption.Brightness = VideoAdjustOption(2) 927 VideoAdjustOption.Contrast = VideoAdjustOption(1) 928 VideoAdjustOption.Enable = VideoAdjustOption(0) 929 VideoAdjustOption.Gamma = VideoAdjustOption(5) 930 VideoAdjustOption.Hue = VideoAdjustOption(3) 931 VideoAdjustOption.Saturation = VideoAdjustOption(4)
932 933 -class AudioOutputDeviceTypes(_Enum):
934 '''Audio device types. 935 ''' 936 _enum_names_ = { 937 -1: 'Error', 938 1: 'Mono', 939 2: 'Stereo', 940 4: '_2F2R', 941 5: '_3F2R', 942 6: '_5_1', 943 7: '_6_1', 944 8: '_7_1', 945 10: 'SPDIF', 946 }
947 AudioOutputDeviceTypes.Error = AudioOutputDeviceTypes(-1) 948 AudioOutputDeviceTypes.Mono = AudioOutputDeviceTypes(1) 949 AudioOutputDeviceTypes.SPDIF = AudioOutputDeviceTypes(10) 950 AudioOutputDeviceTypes.Stereo = AudioOutputDeviceTypes(2) 951 AudioOutputDeviceTypes._2F2R = AudioOutputDeviceTypes(4) 952 AudioOutputDeviceTypes._3F2R = AudioOutputDeviceTypes(5) 953 AudioOutputDeviceTypes._5_1 = AudioOutputDeviceTypes(6) 954 AudioOutputDeviceTypes._6_1 = AudioOutputDeviceTypes(7) 955 AudioOutputDeviceTypes._7_1 = AudioOutputDeviceTypes(8)
956 957 -class AudioOutputChannel(_Enum):
958 '''Audio channels. 959 ''' 960 _enum_names_ = { 961 -1: 'Error', 962 1: 'Stereo', 963 2: 'RStereo', 964 3: 'Left', 965 4: 'Right', 966 5: 'Dolbys', 967 }
968 AudioOutputChannel.Dolbys = AudioOutputChannel(5) 969 AudioOutputChannel.Error = AudioOutputChannel(-1) 970 AudioOutputChannel.Left = AudioOutputChannel(3) 971 AudioOutputChannel.RStereo = AudioOutputChannel(2) 972 AudioOutputChannel.Right = AudioOutputChannel(4) 973 AudioOutputChannel.Stereo = AudioOutputChannel(1)
974 975 -class MediaPlayerRole(_Enum):
976 '''Media player roles. 977 \version libvlc 3.0.0 and later. 978 see \ref libvlc_media_player_set_role(). 979 ''' 980 _enum_names_ = { 981 0: '_None', 982 1: 'Music', 983 2: 'Video', 984 3: 'Communication', 985 4: 'Game', 986 5: 'Notification', 987 6: 'Animation', 988 7: 'Production', 989 8: 'Accessibility', 990 9: 'Test', 991 }
992 MediaPlayerRole.Accessibility = MediaPlayerRole(8) 993 MediaPlayerRole.Animation = MediaPlayerRole(6) 994 MediaPlayerRole.Communication = MediaPlayerRole(3) 995 MediaPlayerRole.Game = MediaPlayerRole(4) 996 MediaPlayerRole.Music = MediaPlayerRole(1) 997 MediaPlayerRole.Notification = MediaPlayerRole(5) 998 MediaPlayerRole.Production = MediaPlayerRole(7) 999 MediaPlayerRole.Test = MediaPlayerRole(9) 1000 MediaPlayerRole.Video = MediaPlayerRole(2) 1001 MediaPlayerRole._None = MediaPlayerRole(0)
1002 1003 -class PlaybackMode(_Enum):
1004 '''Defines playback modes for playlist. 1005 ''' 1006 _enum_names_ = { 1007 0: 'default', 1008 1: 'loop', 1009 2: 'repeat', 1010 }
1011 PlaybackMode.default = PlaybackMode(0) 1012 PlaybackMode.loop = PlaybackMode(1) 1013 PlaybackMode.repeat = PlaybackMode(2)
1014 1015 # End of generated enum types # 1016 1017 # From libvlc_structures.h 1018 1019 -class AudioOutput(_Cstruct):
1020
1021 - def __str__(self):
1022 return '%s(%s:%s)' % (self.__class__.__name__, self.name, self.description)
1023 1024 AudioOutput._fields_ = [ # recursive struct 1025 ('name', ctypes.c_char_p), 1026 ('description', ctypes.c_char_p), 1027 ('next', ctypes.POINTER(AudioOutput)), 1028 ]
1029 1030 -class LogMessage(_Cstruct):
1031 _fields_ = [ 1032 ('size', ctypes.c_uint ), 1033 ('severity', ctypes.c_int ), 1034 ('type', ctypes.c_char_p), 1035 ('name', ctypes.c_char_p), 1036 ('header', ctypes.c_char_p), 1037 ('message', ctypes.c_char_p), 1038 ] 1039
1040 - def __init__(self):
1041 super(LogMessage, self).__init__() 1042 self.size = ctypes.sizeof(self)
1043
1044 - def __str__(self):
1045 return '%s(%d:%s): %s' % (self.__class__.__name__, self.severity, self.type, self.message)
1046
1047 -class MediaEvent(_Cstruct):
1048 _fields_ = [ 1049 ('media_name', ctypes.c_char_p), 1050 ('instance_name', ctypes.c_char_p), 1051 ]
1052
1053 -class MediaStats(_Cstruct):
1054 _fields_ = [ 1055 ('read_bytes', ctypes.c_int ), 1056 ('input_bitrate', ctypes.c_float), 1057 ('demux_read_bytes', ctypes.c_int ), 1058 ('demux_bitrate', ctypes.c_float), 1059 ('demux_corrupted', ctypes.c_int ), 1060 ('demux_discontinuity', ctypes.c_int ), 1061 ('decoded_video', ctypes.c_int ), 1062 ('decoded_audio', ctypes.c_int ), 1063 ('displayed_pictures', ctypes.c_int ), 1064 ('lost_pictures', ctypes.c_int ), 1065 ('played_abuffers', ctypes.c_int ), 1066 ('lost_abuffers', ctypes.c_int ), 1067 ('sent_packets', ctypes.c_int ), 1068 ('sent_bytes', ctypes.c_int ), 1069 ('send_bitrate', ctypes.c_float), 1070 ]
1071
1072 -class MediaTrackInfo(_Cstruct):
1073 _fields_ = [ 1074 ('codec', ctypes.c_uint32), 1075 ('id', ctypes.c_int ), 1076 ('type', TrackType ), 1077 ('profile', ctypes.c_int ), 1078 ('level', ctypes.c_int ), 1079 ('channels_or_height', ctypes.c_uint ), 1080 ('rate_or_width', ctypes.c_uint ), 1081 ]
1082
1083 -class AudioTrack(_Cstruct):
1084 _fields_ = [ 1085 ('channels', ctypes.c_uint), 1086 ('rate', ctypes.c_uint), 1087 ]
1088
1089 -class VideoTrack(_Cstruct):
1090 _fields_ = [ 1091 ('height', ctypes.c_uint), 1092 ('width', ctypes.c_uint), 1093 ('sar_num', ctypes.c_uint), 1094 ('sar_den', ctypes.c_uint), 1095 ('frame_rate_num', ctypes.c_uint), 1096 ('frame_rate_den', ctypes.c_uint), 1097 ]
1098
1099 -class SubtitleTrack(_Cstruct):
1100 _fields_ = [ 1101 ('encoding', ctypes.c_char_p), 1102 ]
1103
1104 -class MediaTrackTracks(ctypes.Union):
1105 _fields_ = [ 1106 ('audio', ctypes.POINTER(AudioTrack)), 1107 ('video', ctypes.POINTER(VideoTrack)), 1108 ('subtitle', ctypes.POINTER(SubtitleTrack)), 1109 ]
1110
1111 -class MediaTrack(_Cstruct):
1112 _anonymous_ = ("u",) 1113 _fields_ = [ 1114 ('codec', ctypes.c_uint32), 1115 ('original_fourcc', ctypes.c_uint32), 1116 ('id', ctypes.c_int ), 1117 ('type', TrackType ), 1118 ('profile', ctypes.c_int ), 1119 ('level', ctypes.c_int ), 1120 1121 ('u', MediaTrackTracks), 1122 ('bitrate', ctypes.c_uint), 1123 ('language', ctypes.c_char_p), 1124 ('description', ctypes.c_char_p), 1125 ]
1126
1127 -class PlaylistItem(_Cstruct):
1128 _fields_ = [ 1129 ('id', ctypes.c_int ), 1130 ('uri', ctypes.c_char_p), 1131 ('name', ctypes.c_char_p), 1132 ] 1133
1134 - def __str__(self):
1135 return '%s #%d %s (uri %s)' % (self.__class__.__name__, self.id, self.name, self.uri)
1136
1137 -class Rectangle(_Cstruct):
1138 _fields_ = [ 1139 ('top', ctypes.c_int), 1140 ('left', ctypes.c_int), 1141 ('bottom', ctypes.c_int), 1142 ('right', ctypes.c_int), 1143 ]
1144
1145 -class TrackDescription(_Cstruct):
1146
1147 - def __str__(self):
1148 return '%s(%d:%s)' % (self.__class__.__name__, self.id, self.name)
1149 1150 TrackDescription._fields_ = [ # recursive struct 1151 ('id', ctypes.c_int ), 1152 ('name', ctypes.c_char_p), 1153 ('next', ctypes.POINTER(TrackDescription)), 1154 ]
1155 1156 -def track_description_list(head):
1157 """Convert a TrackDescription linked list to a Python list (and release the former). 1158 """ 1159 r = [] 1160 if head: 1161 item = head 1162 while item: 1163 item = item.contents 1164 r.append((item.id, item.name)) 1165 item = item.next 1166 try: 1167 libvlc_track_description_release(head) 1168 except NameError: 1169 libvlc_track_description_list_release(head) 1170 1171 return r
1172
1173 -class EventUnion(ctypes.Union):
1174 _fields_ = [ 1175 ('meta_type', ctypes.c_uint ), 1176 ('new_child', ctypes.c_uint ), 1177 ('new_duration', ctypes.c_longlong), 1178 ('new_status', ctypes.c_int ), 1179 ('media', ctypes.c_void_p ), 1180 ('new_state', ctypes.c_uint ), 1181 # FIXME: Media instance 1182 ('new_cache', ctypes.c_float ), 1183 ('new_position', ctypes.c_float ), 1184 ('new_time', ctypes.c_longlong), 1185 ('new_title', ctypes.c_int ), 1186 ('new_seekable', ctypes.c_longlong), 1187 ('new_pausable', ctypes.c_longlong), 1188 ('new_scrambled', ctypes.c_longlong), 1189 ('new_count', ctypes.c_longlong), 1190 # FIXME: Skipped MediaList and MediaListView... 1191 ('filename', ctypes.c_char_p ), 1192 ('new_length', ctypes.c_longlong), 1193 ('media_event', MediaEvent ), 1194 ]
1195
1196 -class Event(_Cstruct):
1197 _fields_ = [ 1198 ('type', EventType ), 1199 ('object', ctypes.c_void_p), 1200 ('u', EventUnion ), 1201 ]
1202
1203 -class ModuleDescription(_Cstruct):
1204
1205 - def __str__(self):
1206 return '%s %s (%s)' % (self.__class__.__name__, self.shortname, self.name)
1207 1208 ModuleDescription._fields_ = [ # recursive struct 1209 ('name', ctypes.c_char_p), 1210 ('shortname', ctypes.c_char_p), 1211 ('longname', ctypes.c_char_p), 1212 ('help', ctypes.c_char_p), 1213 ('next', ctypes.POINTER(ModuleDescription)), 1214 ]
1215 1216 -def module_description_list(head):
1217 """Convert a ModuleDescription linked list to a Python list (and release the former). 1218 """ 1219 r = [] 1220 if head: 1221 item = head 1222 while item: 1223 item = item.contents 1224 r.append((item.name, item.shortname, item.longname, item.help)) 1225 item = item.next 1226 libvlc_module_description_list_release(head) 1227 return r
1228
1229 -class AudioOutputDevice(_Cstruct):
1230
1231 - def __str__(self):
1232 return '%s(%d:%s)' % (self.__class__.__name__, self.id, self.name)
1233 1234 AudioOutputDevice._fields_ = [ # recursive struct 1235 ('next', ctypes.POINTER(AudioOutputDevice)), 1236 ('device', ctypes.c_char_p ), 1237 ('description', ctypes.c_char_p), 1238 ]
1239 1240 -class TitleDescription(_Cstruct):
1241 _fields_ = [ 1242 ('duration', ctypes.c_longlong), 1243 ('name', ctypes.c_char_p), 1244 ('menu', ctypes.c_bool), 1245 ]
1246
1247 -class ChapterDescription(_Cstruct):
1248 _fields_ = [ 1249 ('time_offset', ctypes.c_longlong), 1250 ('duration', ctypes.c_longlong), 1251 ('name', ctypes.c_char_p), 1252 ]
1253
1254 -class VideoViewpoint(_Cstruct):
1255 _fields_ = [ 1256 ('yaw', ctypes.c_float), 1257 ('pitch', ctypes.c_float), 1258 ('roll', ctypes.c_float), 1259 ('field_of_view', ctypes.c_float), 1260 ]
1261
1262 -class MediaDiscovererDescription(_Cstruct):
1263 _fields_ = [ 1264 ('name', ctypes.c_char_p), 1265 ('longname', ctypes.c_char_p), 1266 ('cat', MediaDiscovererCategory), 1267 ] 1268
1269 - def __str__(self):
1270 return '%s %s (%d) - %s' % (self.__class__.__name__, self.name, self.cat, self.longname)
1271 1272 # This struct depends on the MediaSlaveType enum that is defined only 1273 # in > 2.2 1274 if 'MediaSlaveType' in locals():
1275 - class MediaSlave(_Cstruct):
1276 _fields_ = [ 1277 ('psz_uri', ctypes.c_char_p), 1278 ('i_type', MediaSlaveType), 1279 ('i_priority', ctypes.c_uint) 1280 ]
1281
1282 -class RDDescription(_Cstruct):
1283 _fields_ = [ 1284 ('name', ctypes.c_char_p), 1285 ('longname', ctypes.c_char_p) 1286 ]
1287
1288 1289 -class MediaThumbnailRequest:
1290 - def __new__(cls, *args):
1291 if len(args) == 1 and isinstance(args[0], _Ints): 1292 return _Constructor(cls, args[0])
1293
1294 -class Direct3dDeviceSetup(_Cstruct):
1295 _fields_ = [ 1296 ('device_context', ctypes.c_void_p), 1297 ]
1298
1299 -class Direct3dDeviceCfg(_Cstruct):
1300 _fields_ = [ 1301 ('hardware_decoding', ctypes.c_bool), 1302 ]
1303
1304 -class Direct3dCfg(_Cstruct):
1305 _fields_ = [ 1306 ('width', ctypes.c_uint), 1307 ('height', ctypes.c_uint), 1308 ('bitdepth', ctypes.c_uint), 1309 ('full_range', ctypes.c_bool), 1310 # FIXME: should be references to enums 1311 ('colorspace', ctypes.c_uint), 1312 ('primaries', ctypes.c_uint), 1313 ('transfer', ctypes.c_uint), 1314 ]
1315
1316 -class VideoOutputCfg(_Cstruct):
1317 _fields_ = [ 1318 ('surface_format', ctypes.c_int), 1319 ('full_range', ctypes.c_bool), 1320 # FIXME: should be references to enums 1321 ('colorspace', ctypes.c_uint), 1322 ('primaries', ctypes.c_uint), 1323 ('transfer', ctypes.c_uint), 1324 ]
1325
1326 -class Direct3dHdr10Metadata(_Cstruct):
1327 _fields_ = [ 1328 ('RedPrimary ', ctypes.c_uint16 * 2), 1329 ('GreenPrimary', ctypes.c_uint16 * 2), 1330 ('BluePrimary', ctypes.c_uint16 * 2), 1331 ('WhitePoint', ctypes.c_uint16 * 2), 1332 ('MaxMasteringLuminance', ctypes.c_uint), 1333 ('MinMasteringLuminance', ctypes.c_uint), 1334 ('MaxContentLightLevel', ctypes.c_uint16), 1335 ('MaxFrameAverageLightLevel', ctypes.c_uint16), 1336 ]
1337
1338 -class VideoSetupDeviceCfg(_Cstruct):
1339 _fields_ = [ 1340 ('hardware_decoding', ctypes.c_bool), 1341 ]
1342
1343 -class VideoSetupDeviceInfo(_Cstruct):
1344 # FIXME: this is normally a union for D3D11/D3D9. We only define 1345 # the mapping for d3d11 here 1346 _fields_ = [ 1347 ('device_context', ctypes.c_void_p), 1348 ]
1349
1350 -class VideoRenderCfg(_Cstruct):
1351 _fields_ = [ 1352 ('width', ctypes.c_uint), 1353 ('height', ctypes.c_uint), 1354 ('bitdepth', ctypes.c_uint), 1355 ('full_range', ctypes.c_bool), 1356 # FIXME: should be references to enums 1357 ('colorspace', ctypes.c_uint), 1358 ('primaries', ctypes.c_uint), 1359 ('transfer', ctypes.c_uint), 1360 ('device', ctypes.c_void_p), 1361 ]
1362
1363 # Generated callback definitions # 1364 -class Callback(ctypes.c_void_p):
1365 """Callback function notification. 1366 @param p_event: the event triggering the callback. 1367 """ 1368 pass
1369 -class LogCb(ctypes.c_void_p):
1370 """Callback prototype for LibVLC log message handler. 1371 @param data: data pointer as given to L{libvlc_log_set}(). 1372 @param level: message level (@ref L{LogLevel}). 1373 @param ctx: message context (meta-information about the message). 1374 @param fmt: printf() format string (as defined by ISO C11). 1375 @param args: variable argument list for the format @note Log message handlers B{must} be thread-safe. @warning The message context pointer, the format string parameters and the variable arguments are only valid until the callback returns. 1376 """ 1377 pass
1378 -class MediaOpenCb(ctypes.c_void_p):
1379 """Callback prototype to open a custom bitstream input media. 1380 The same media item can be opened multiple times. Each time, this callback 1381 is invoked. It should allocate and initialize any instance-specific 1382 resources, then store them in *datap. The instance resources can be freed 1383 in the @ref libvlc_media_close_cb callback. 1384 @param opaque: private pointer as passed to L{libvlc_media_new_callbacks}(). 1385 @return: datap storage space for a private data pointer, sizep byte length of the bitstream or UINT64_MAX if unknown. 1386 """ 1387 pass
1388 -class MediaReadCb(ctypes.c_void_p):
1389 """Callback prototype to read data from a custom bitstream input media. 1390 @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. 1391 @param buf: start address of the buffer to read data into. 1392 @param len: bytes length of the buffer. 1393 @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. 1394 """ 1395 pass
1396 -class MediaSeekCb(ctypes.c_void_p):
1397 """Callback prototype to seek a custom bitstream input media. 1398 @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. 1399 @param offset: absolute byte offset to seek to. 1400 @return: 0 on success, -1 on error. 1401 """ 1402 pass
1403 -class MediaCloseCb(ctypes.c_void_p):
1404 """Callback prototype to close a custom bitstream input media. 1405 @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. 1406 """ 1407 pass
1408 -class VideoLockCb(ctypes.c_void_p):
1409 """Callback prototype to allocate and lock a picture buffer. 1410 Whenever a new video frame needs to be decoded, the lock callback is 1411 invoked. Depending on the video chroma, one or three pixel planes of 1412 adequate dimensions must be returned via the second parameter. Those 1413 planes must be aligned on 32-bytes boundaries. 1414 @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN]. 1415 @param planes: start address of the pixel planes (LibVLC allocates the array of void pointers, this callback must initialize the array) [OUT]. 1416 @return: a private pointer for the display and unlock callbacks to identify the picture buffers. 1417 """ 1418 pass
1419 -class VideoUnlockCb(ctypes.c_void_p):
1420 """Callback prototype to unlock a picture buffer. 1421 When the video frame decoding is complete, the unlock callback is invoked. 1422 This callback might not be needed at all. It is only an indication that the 1423 application can now read the pixel values if it needs to. 1424 @note: A picture buffer is unlocked after the picture is decoded, 1425 but before the picture is displayed. 1426 @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN]. 1427 @param picture: private pointer returned from the @ref libvlc_video_lock_cb callback [IN]. 1428 @param planes: pixel planes as defined by the @ref libvlc_video_lock_cb callback (this parameter is only for convenience) [IN]. 1429 """ 1430 pass
1431 -class VideoDisplayCb(ctypes.c_void_p):
1432 """Callback prototype to display a picture. 1433 When the video frame needs to be shown, as determined by the media playback 1434 clock, the display callback is invoked. 1435 @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN]. 1436 @param picture: private pointer returned from the @ref libvlc_video_lock_cb callback [IN]. 1437 """ 1438 pass
1439 -class VideoFormatCb(ctypes.c_void_p):
1440 """Callback prototype to configure picture buffers format. 1441 This callback gets the format of the video as output by the video decoder 1442 and the chain of video filters (if any). It can opt to change any parameter 1443 as it needs. In that case, LibVLC will attempt to convert the video format 1444 (rescaling and chroma conversion) but these operations can be CPU intensive. 1445 @param opaque: pointer to the private pointer passed to L{libvlc_video_set_callbacks}() [IN/OUT]. 1446 @param chroma: pointer to the 4 bytes video format identifier [IN/OUT]. 1447 @param width: pointer to the pixel width [IN/OUT]. 1448 @param height: pointer to the pixel height [IN/OUT]. 1449 @param pitches: table of scanline pitches in bytes for each pixel plane (the table is allocated by LibVLC) [OUT]. 1450 @return: lines table of scanlines count for each plane. 1451 """ 1452 pass
1453 -class VideoCleanupCb(ctypes.c_void_p):
1454 """Callback prototype to configure picture buffers format. 1455 @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() (and possibly modified by @ref libvlc_video_format_cb) [IN]. 1456 """ 1457 pass
1458 -class AudioPlayCb(ctypes.c_void_p):
1459 """Callback prototype for audio playback. 1460 The LibVLC media player decodes and post-processes the audio signal 1461 asynchronously (in an internal thread). Whenever audio samples are ready 1462 to be queued to the output, this callback is invoked. 1463 The number of samples provided per invocation may depend on the file format, 1464 the audio coding algorithm, the decoder plug-in, the post-processing 1465 filters and timing. Application must not assume a certain number of samples. 1466 The exact format of audio samples is determined by L{libvlc_audio_set_format}() 1467 or L{libvlc_audio_set_format_callbacks}() as is the channels layout. 1468 Note that the number of samples is per channel. For instance, if the audio 1469 track sampling rate is 48000 Hz, then 1200 samples represent 25 milliseconds 1470 of audio signal - regardless of the number of audio channels. 1471 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1472 @param samples: pointer to a table of audio samples to play back [IN]. 1473 @param count: number of audio samples to play back. 1474 @param pts: expected play time stamp (see libvlc_delay()). 1475 """ 1476 pass
1477 -class AudioPauseCb(ctypes.c_void_p):
1478 """Callback prototype for audio pause. 1479 LibVLC invokes this callback to pause audio playback. 1480 @note: The pause callback is never called if the audio is already paused. 1481 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1482 @param pts: time stamp of the pause request (should be elapsed already). 1483 """ 1484 pass
1485 -class AudioResumeCb(ctypes.c_void_p):
1486 """Callback prototype for audio resumption. 1487 LibVLC invokes this callback to resume audio playback after it was 1488 previously paused. 1489 @note: The resume callback is never called if the audio is not paused. 1490 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1491 @param pts: time stamp of the resumption request (should be elapsed already). 1492 """ 1493 pass
1494 -class AudioFlushCb(ctypes.c_void_p):
1495 """Callback prototype for audio buffer flush. 1496 LibVLC invokes this callback if it needs to discard all pending buffers and 1497 stop playback as soon as possible. This typically occurs when the media is 1498 stopped. 1499 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1500 """ 1501 pass
1502 -class AudioDrainCb(ctypes.c_void_p):
1503 """Callback prototype for audio buffer drain. 1504 LibVLC may invoke this callback when the decoded audio track is ending. 1505 There will be no further decoded samples for the track, but playback should 1506 nevertheless continue until all already pending buffers are rendered. 1507 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1508 """ 1509 pass
1510 -class AudioSetVolumeCb(ctypes.c_void_p):
1511 """Callback prototype for audio volume change. 1512 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1513 @param volume: software volume (1. = nominal, 0. = mute). 1514 @param mute: muted flag. 1515 """ 1516 pass
1517 -class AudioSetupCb(ctypes.c_void_p):
1518 """Callback prototype to setup the audio playback. 1519 This is called when the media player needs to create a new audio output. 1520 @param opaque: pointer to the data pointer passed to L{libvlc_audio_set_callbacks}() [IN/OUT]. 1521 @param format: 4 bytes sample format [IN/OUT]. 1522 @param rate: sample rate [IN/OUT]. 1523 @param channels: channels count [IN/OUT]. 1524 @return: 0 on success, anything else to skip audio playback. 1525 """ 1526 pass
1527 -class AudioCleanupCb(ctypes.c_void_p):
1528 """Callback prototype for audio playback cleanup. 1529 This is called when the media player no longer needs an audio output. 1530 @param opaque: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1531 """ 1532 pass
1533 -class CallbackDecorators(object):
1534 "Class holding various method decorators for callback functions." 1535 Callback = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p) 1536 Callback.__doc__ = '''Callback function notification. 1537 @param p_event: the event triggering the callback. 1538 ''' 1539 LogCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int, Log_ptr, ctypes.c_char_p, ctypes.c_void_p) 1540 LogCb.__doc__ = '''Callback prototype for LibVLC log message handler. 1541 @param data: data pointer as given to L{libvlc_log_set}(). 1542 @param level: message level (@ref L{LogLevel}). 1543 @param ctx: message context (meta-information about the message). 1544 @param fmt: printf() format string (as defined by ISO C11). 1545 @param args: variable argument list for the format @note Log message handlers B{must} be thread-safe. @warning The message context pointer, the format string parameters and the variable arguments are only valid until the callback returns. 1546 ''' 1547 MediaOpenCb = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(ctypes.c_uint64)) 1548 MediaOpenCb.__doc__ = '''Callback prototype to open a custom bitstream input media. 1549 The same media item can be opened multiple times. Each time, this callback 1550 is invoked. It should allocate and initialize any instance-specific 1551 resources, then store them in *datap. The instance resources can be freed 1552 in the @ref libvlc_media_close_cb callback. 1553 @param opaque: private pointer as passed to L{libvlc_media_new_callbacks}(). 1554 @return: datap storage space for a private data pointer, sizep byte length of the bitstream or UINT64_MAX if unknown. 1555 ''' 1556 MediaReadCb = ctypes.CFUNCTYPE(ctypes.c_ssize_t, ctypes.c_void_p, ctypes.POINTER(ctypes.c_char), ctypes.c_size_t) 1557 MediaReadCb.__doc__ = '''Callback prototype to read data from a custom bitstream input media. 1558 @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. 1559 @param buf: start address of the buffer to read data into. 1560 @param len: bytes length of the buffer. 1561 @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. 1562 ''' 1563 MediaSeekCb = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_uint64) 1564 MediaSeekCb.__doc__ = '''Callback prototype to seek a custom bitstream input media. 1565 @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. 1566 @param offset: absolute byte offset to seek to. 1567 @return: 0 on success, -1 on error. 1568 ''' 1569 MediaCloseCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p) 1570 MediaCloseCb.__doc__ = '''Callback prototype to close a custom bitstream input media. 1571 @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. 1572 ''' 1573 VideoLockCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)) 1574 VideoLockCb.__doc__ = '''Callback prototype to allocate and lock a picture buffer. 1575 Whenever a new video frame needs to be decoded, the lock callback is 1576 invoked. Depending on the video chroma, one or three pixel planes of 1577 adequate dimensions must be returned via the second parameter. Those 1578 planes must be aligned on 32-bytes boundaries. 1579 @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN]. 1580 @param planes: start address of the pixel planes (LibVLC allocates the array of void pointers, this callback must initialize the array) [OUT]. 1581 @return: a private pointer for the display and unlock callbacks to identify the picture buffers. 1582 ''' 1583 VideoUnlockCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)) 1584 VideoUnlockCb.__doc__ = '''Callback prototype to unlock a picture buffer. 1585 When the video frame decoding is complete, the unlock callback is invoked. 1586 This callback might not be needed at all. It is only an indication that the 1587 application can now read the pixel values if it needs to. 1588 @note: A picture buffer is unlocked after the picture is decoded, 1589 but before the picture is displayed. 1590 @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN]. 1591 @param picture: private pointer returned from the @ref libvlc_video_lock_cb callback [IN]. 1592 @param planes: pixel planes as defined by the @ref libvlc_video_lock_cb callback (this parameter is only for convenience) [IN]. 1593 ''' 1594 VideoDisplayCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p) 1595 VideoDisplayCb.__doc__ = '''Callback prototype to display a picture. 1596 When the video frame needs to be shown, as determined by the media playback 1597 clock, the display callback is invoked. 1598 @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN]. 1599 @param picture: private pointer returned from the @ref libvlc_video_lock_cb callback [IN]. 1600 ''' 1601 VideoFormatCb = ctypes.CFUNCTYPE(ctypes.c_uint, ctypes.POINTER(ctypes.c_void_p), ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)) 1602 VideoFormatCb.__doc__ = '''Callback prototype to configure picture buffers format. 1603 This callback gets the format of the video as output by the video decoder 1604 and the chain of video filters (if any). It can opt to change any parameter 1605 as it needs. In that case, LibVLC will attempt to convert the video format 1606 (rescaling and chroma conversion) but these operations can be CPU intensive. 1607 @param opaque: pointer to the private pointer passed to L{libvlc_video_set_callbacks}() [IN/OUT]. 1608 @param chroma: pointer to the 4 bytes video format identifier [IN/OUT]. 1609 @param width: pointer to the pixel width [IN/OUT]. 1610 @param height: pointer to the pixel height [IN/OUT]. 1611 @param pitches: table of scanline pitches in bytes for each pixel plane (the table is allocated by LibVLC) [OUT]. 1612 @return: lines table of scanlines count for each plane. 1613 ''' 1614 VideoCleanupCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p) 1615 VideoCleanupCb.__doc__ = '''Callback prototype to configure picture buffers format. 1616 @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() (and possibly modified by @ref libvlc_video_format_cb) [IN]. 1617 ''' 1618 AudioPlayCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint, ctypes.c_int64) 1619 AudioPlayCb.__doc__ = '''Callback prototype for audio playback. 1620 The LibVLC media player decodes and post-processes the audio signal 1621 asynchronously (in an internal thread). Whenever audio samples are ready 1622 to be queued to the output, this callback is invoked. 1623 The number of samples provided per invocation may depend on the file format, 1624 the audio coding algorithm, the decoder plug-in, the post-processing 1625 filters and timing. Application must not assume a certain number of samples. 1626 The exact format of audio samples is determined by L{libvlc_audio_set_format}() 1627 or L{libvlc_audio_set_format_callbacks}() as is the channels layout. 1628 Note that the number of samples is per channel. For instance, if the audio 1629 track sampling rate is 48000 Hz, then 1200 samples represent 25 milliseconds 1630 of audio signal - regardless of the number of audio channels. 1631 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1632 @param samples: pointer to a table of audio samples to play back [IN]. 1633 @param count: number of audio samples to play back. 1634 @param pts: expected play time stamp (see libvlc_delay()). 1635 ''' 1636 AudioPauseCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64) 1637 AudioPauseCb.__doc__ = '''Callback prototype for audio pause. 1638 LibVLC invokes this callback to pause audio playback. 1639 @note: The pause callback is never called if the audio is already paused. 1640 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1641 @param pts: time stamp of the pause request (should be elapsed already). 1642 ''' 1643 AudioResumeCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64) 1644 AudioResumeCb.__doc__ = '''Callback prototype for audio resumption. 1645 LibVLC invokes this callback to resume audio playback after it was 1646 previously paused. 1647 @note: The resume callback is never called if the audio is not paused. 1648 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1649 @param pts: time stamp of the resumption request (should be elapsed already). 1650 ''' 1651 AudioFlushCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64) 1652 AudioFlushCb.__doc__ = '''Callback prototype for audio buffer flush. 1653 LibVLC invokes this callback if it needs to discard all pending buffers and 1654 stop playback as soon as possible. This typically occurs when the media is 1655 stopped. 1656 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1657 ''' 1658 AudioDrainCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p) 1659 AudioDrainCb.__doc__ = '''Callback prototype for audio buffer drain. 1660 LibVLC may invoke this callback when the decoded audio track is ending. 1661 There will be no further decoded samples for the track, but playback should 1662 nevertheless continue until all already pending buffers are rendered. 1663 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1664 ''' 1665 AudioSetVolumeCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_float, ctypes.c_bool) 1666 AudioSetVolumeCb.__doc__ = '''Callback prototype for audio volume change. 1667 @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1668 @param volume: software volume (1. = nominal, 0. = mute). 1669 @param mute: muted flag. 1670 ''' 1671 AudioSetupCb = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.POINTER(ctypes.c_void_p), ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)) 1672 AudioSetupCb.__doc__ = '''Callback prototype to setup the audio playback. 1673 This is called when the media player needs to create a new audio output. 1674 @param opaque: pointer to the data pointer passed to L{libvlc_audio_set_callbacks}() [IN/OUT]. 1675 @param format: 4 bytes sample format [IN/OUT]. 1676 @param rate: sample rate [IN/OUT]. 1677 @param channels: channels count [IN/OUT]. 1678 @return: 0 on success, anything else to skip audio playback. 1679 ''' 1680 AudioCleanupCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p) 1681 AudioCleanupCb.__doc__ = '''Callback prototype for audio playback cleanup. 1682 This is called when the media player no longer needs an audio output. 1683 @param opaque: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. 1684 '''
1685 cb = CallbackDecorators
1686 # End of generated enum types # 1687 1688 # End of header.py # 1689 -class AudioEqualizer(_Ctype):
1690 '''Create a new default equalizer, with all frequency values zeroed. 1691 1692 The new equalizer can subsequently be applied to a media player by invoking 1693 L{MediaPlayer.set_equalizer}. 1694 The returned handle should be freed via libvlc_audio_equalizer_release() when 1695 it is no longer needed. 1696 ''' 1697
1698 - def __new__(cls, *args):
1699 if len(args) == 1 and isinstance(args[0], _Ints): 1700 return _Constructor(cls, args[0]) 1701 return libvlc_audio_equalizer_new()
1702 1703
1704 - def release(self):
1705 '''Release a previously created equalizer instance. 1706 The equalizer was previously created by using L{new}() or 1707 L{new_from_preset}(). 1708 It is safe to invoke this method with a None p_equalizer parameter for no effect. 1709 @version: LibVLC 2.2.0 or later. 1710 ''' 1711 return libvlc_audio_equalizer_release(self)
1712 1713
1714 - def set_preamp(self, f_preamp):
1715 '''Set a new pre-amplification value for an equalizer. 1716 The new equalizer settings are subsequently applied to a media player by invoking 1717 L{media_player_set_equalizer}(). 1718 The supplied amplification value will be clamped to the -20.0 to +20.0 range. 1719 @param f_preamp: preamp value (-20.0 to 20.0 Hz). 1720 @return: zero on success, -1 on error. 1721 @version: LibVLC 2.2.0 or later. 1722 ''' 1723 return libvlc_audio_equalizer_set_preamp(self, f_preamp)
1724 1725
1726 - def get_preamp(self):
1727 '''Get the current pre-amplification value from an equalizer. 1728 @return: preamp value (Hz). 1729 @version: LibVLC 2.2.0 or later. 1730 ''' 1731 return libvlc_audio_equalizer_get_preamp(self)
1732 1733
1734 - def set_amp_at_index(self, f_amp, u_band):
1735 '''Set a new amplification value for a particular equalizer frequency band. 1736 The new equalizer settings are subsequently applied to a media player by invoking 1737 L{media_player_set_equalizer}(). 1738 The supplied amplification value will be clamped to the -20.0 to +20.0 range. 1739 @param f_amp: amplification value (-20.0 to 20.0 Hz). 1740 @param u_band: index, counting from zero, of the frequency band to set. 1741 @return: zero on success, -1 on error. 1742 @version: LibVLC 2.2.0 or later. 1743 ''' 1744 return libvlc_audio_equalizer_set_amp_at_index(self, f_amp, u_band)
1745 1746
1747 - def get_amp_at_index(self, u_band):
1748 '''Get the amplification value for a particular equalizer frequency band. 1749 @param u_band: index, counting from zero, of the frequency band to get. 1750 @return: amplification value (Hz); NaN if there is no such frequency band. 1751 @version: LibVLC 2.2.0 or later. 1752 ''' 1753 return libvlc_audio_equalizer_get_amp_at_index(self, u_band)
1754
1755 -class EventManager(_Ctype):
1756 '''Create an event manager with callback handler. 1757 1758 This class interposes the registration and handling of 1759 event notifications in order to (a) remove the need for 1760 decorating each callback functions with the decorator 1761 '@callbackmethod', (b) allow any number of positional 1762 and/or keyword arguments to the callback (in addition 1763 to the Event instance) and (c) to preserve the Python 1764 objects such that the callback and argument objects 1765 remain alive (i.e. are not garbage collected) until 1766 B{after} the notification has been unregistered. 1767 1768 @note: Only a single notification can be registered 1769 for each event type in an EventManager instance. 1770 1771 ''' 1772 1773 _callback_handler = None 1774 _callbacks = {} 1775
1776 - def __new__(cls, ptr=_internal_guard):
1777 if ptr == _internal_guard: 1778 raise VLCException("(INTERNAL) ctypes class.\nYou should get a reference to EventManager through the MediaPlayer.event_manager() method.") 1779 return _Constructor(cls, ptr)
1780
1781 - def event_attach(self, eventtype, callback, *args, **kwds):
1782 """Register an event notification. 1783 1784 @param eventtype: the desired event type to be notified about. 1785 @param callback: the function to call when the event occurs. 1786 @param args: optional positional arguments for the callback. 1787 @param kwds: optional keyword arguments for the callback. 1788 @return: 0 on success, ENOMEM on error. 1789 1790 @note: The callback function must have at least one argument, 1791 an Event instance. Any other, optional positional and keyword 1792 arguments are in B{addition} to the first one. Warning: libvlc 1793 is not reentrant, i.e. you cannot call libvlc functions from 1794 an event handler. They must be called from the main 1795 application thread. 1796 """ 1797 if not isinstance(eventtype, EventType): 1798 raise VLCException("%s required: %r" % ('EventType', eventtype)) 1799 if not hasattr(callback, '__call__'): # callable() 1800 raise VLCException("%s required: %r" % ('callable', callback)) 1801 # check that the callback expects arguments 1802 if not any(getargspec(callback)[:2]): # list(...) 1803 raise VLCException("%s required: %r" % ('argument', callback)) 1804 1805 if self._callback_handler is None: 1806 _called_from_ctypes = ctypes.CFUNCTYPE(None, ctypes.POINTER(Event), ctypes.c_void_p) 1807 @_called_from_ctypes 1808 def _callback_handler(event, k): 1809 """(INTERNAL) handle callback call from ctypes. 1810 1811 @note: We cannot simply make this an EventManager 1812 method since ctypes does not prepend self as the 1813 first parameter, hence this closure. 1814 """ 1815 try: # retrieve Python callback and arguments 1816 call, args, kwds = self._callbacks[k] 1817 except KeyError: # detached? 1818 pass 1819 else: 1820 # deref event.contents to simplify callback code 1821 call(event.contents, *args, **kwds)
1822 self._callback_handler = _callback_handler 1823 self._callbacks = {} 1824 1825 k = eventtype.value 1826 r = libvlc_event_attach(self, k, self._callback_handler, k) 1827 if not r: 1828 self._callbacks[k] = (callback, args, kwds) 1829 return r
1830
1831 - def event_detach(self, eventtype):
1832 """Unregister an event notification. 1833 1834 @param eventtype: the event type notification to be removed. 1835 """ 1836 if not isinstance(eventtype, EventType): 1837 raise VLCException("%s required: %r" % ('EventType', eventtype)) 1838 1839 k = eventtype.value 1840 if k in self._callbacks: 1841 del self._callbacks[k] # remove, regardless of libvlc return value 1842 libvlc_event_detach(self, k, self._callback_handler, k)
1843
1844 1845 -class Instance(_Ctype):
1846 '''Create a new Instance instance. 1847 1848 It may take as parameter either: 1849 - a string 1850 - a list of strings as first parameters 1851 - the parameters given as the constructor parameters (must be strings) 1852 1853 ''' 1854
1855 - def __new__(cls, *args):
1856 if len(args) == 1: 1857 # Only 1 arg. It is either a C pointer, or an arg string, 1858 # or a tuple. 1859 i = args[0] 1860 if isinstance(i, _Ints): 1861 return _Constructor(cls, i) 1862 elif isinstance(i, basestring): 1863 args = i.strip().split() 1864 elif isinstance(i, _Seqs): 1865 args = list(i) 1866 else: 1867 raise VLCException('Instance %r' % (args,)) 1868 else: 1869 args = list(args) 1870 1871 if not args: # no parameters passed 1872 args = ['vlc'] 1873 elif args[0] != 'vlc': 1874 args.insert(0, 'vlc') 1875 1876 if plugin_path is not None: 1877 # set plugin_path if detected, win32 and MacOS, 1878 # if the user did not specify it itself. 1879 os.environ.setdefault('VLC_PLUGIN_PATH', plugin_path) 1880 1881 if PYTHON3: 1882 args = [ str_to_bytes(a) for a in args ] 1883 return libvlc_new(len(args), args)
1884
1885 - def media_player_new(self, uri=None):
1886 """Create a new MediaPlayer instance. 1887 1888 @param uri: an optional URI to play in the player as a str, bytes or PathLike object. 1889 """ 1890 p = libvlc_media_player_new(self) 1891 if uri: 1892 p.set_media(self.media_new(uri)) 1893 p._instance = self 1894 return p
1895
1896 - def media_list_player_new(self):
1897 """Create a new MediaListPlayer instance. 1898 """ 1899 p = libvlc_media_list_player_new(self) 1900 p._instance = self 1901 return p
1902
1903 - def media_new(self, mrl, *options):
1904 """Create a new Media instance. 1905 1906 If mrl contains a colon (:) preceded by more than 1 letter, it 1907 will be treated as a URL. Else, it will be considered as a 1908 local path. If you need more control, directly use 1909 media_new_location/media_new_path methods. 1910 1911 Options can be specified as supplementary string parameters, 1912 but note that many options cannot be set at the media level, 1913 and rather at the Instance level. For instance, the marquee 1914 filter must be specified when creating the vlc.Instance or 1915 vlc.MediaPlayer. 1916 1917 Alternatively, options can be added to the media using the 1918 Media.add_options method (with the same limitation). 1919 1920 @param mrl: A str, bytes or PathLike object 1921 @param options: optional media option=value strings 1922 """ 1923 mrl = try_fspath(mrl) 1924 if ':' in mrl and mrl.index(':') > 1: 1925 # Assume it is a URL 1926 m = libvlc_media_new_location(self, str_to_bytes(mrl)) 1927 else: 1928 # Else it should be a local path. 1929 m = libvlc_media_new_path(self, str_to_bytes(os.path.normpath(mrl))) 1930 for o in options: 1931 libvlc_media_add_option(m, str_to_bytes(o)) 1932 m._instance = self 1933 return m
1934
1935 - def media_new_path(self, path):
1936 """Create a media for a certain file path. 1937 See L{media_release}. 1938 @param path: A str, byte, or PathLike object representing a local filesystem path. 1939 @return: the newly created media or None on error. 1940 """ 1941 path = try_fspath(path) 1942 return libvlc_media_new_path(self, str_to_bytes(path))
1943
1944 - def media_list_new(self, mrls=None):
1945 """Create a new MediaList instance. 1946 @param mrls: optional list of MRL strings, bytes, or PathLike objects. 1947 """ 1948 l = libvlc_media_list_new(self) 1949 # We should take the lock, but since we did not leak the 1950 # reference, nobody else can access it. 1951 if mrls: 1952 for m in mrls: 1953 l.add_media(m) 1954 l._instance = self 1955 return l
1956
1958 """Enumerate the defined audio output devices. 1959 1960 @return: list of dicts {name:, description:, devices:} 1961 """ 1962 r = [] 1963 head = libvlc_audio_output_list_get(self) 1964 if head: 1965 i = head 1966 while i: 1967 i = i.contents 1968 r.append({'name': i.name, 'description': i.description}) 1969 i = i.next 1970 libvlc_audio_output_list_release(head) 1971 return r
1972
1973 - def audio_filter_list_get(self):
1974 """Returns a list of available audio filters. 1975 1976 """ 1977 return module_description_list(libvlc_audio_filter_list_get(self))
1978
1979 - def video_filter_list_get(self):
1980 """Returns a list of available video filters. 1981 1982 """ 1983 return module_description_list(libvlc_video_filter_list_get(self))
1984 1985 1986
1987 - def release(self):
1988 '''Decrement the reference count of a libvlc instance, and destroy it 1989 if it reaches zero. 1990 ''' 1991 return libvlc_release(self)
1992 1993
1994 - def retain(self):
1995 '''Increments the reference count of a libvlc instance. 1996 The initial reference count is 1 after L{new}() returns. 1997 ''' 1998 return libvlc_retain(self)
1999 2000
2001 - def add_intf(self, name):
2002 '''Try to start a user interface for the libvlc instance. 2003 @param name: interface name, or None for default. 2004 @return: 0 on success, -1 on error. 2005 ''' 2006 return libvlc_add_intf(self, str_to_bytes(name))
2007 2008
2009 - def set_user_agent(self, name, http):
2010 '''Sets the application name. LibVLC passes this as the user agent string 2011 when a protocol requires it. 2012 @param name: human-readable application name, e.g. "FooBar player 1.2.3". 2013 @param http: HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0". 2014 @version: LibVLC 1.1.1 or later. 2015 ''' 2016 return libvlc_set_user_agent(self, str_to_bytes(name), str_to_bytes(http))
2017 2018
2019 - def set_app_id(self, id, version, icon):
2020 '''Sets some meta-information about the application. 2021 See also L{set_user_agent}(). 2022 @param id: Java-style application identifier, e.g. "com.acme.foobar". 2023 @param version: application version numbers, e.g. "1.2.3". 2024 @param icon: application icon name, e.g. "foobar". 2025 @version: LibVLC 2.1.0 or later. 2026 ''' 2027 return libvlc_set_app_id(self, str_to_bytes(id), str_to_bytes(version), str_to_bytes(icon))
2028 2029
2030 - def log_unset(self):
2031 '''Unsets the logging callback. 2032 This function deregisters the logging callback for a LibVLC instance. 2033 This is rarely needed as the callback is implicitly unset when the instance 2034 is destroyed. 2035 @note: This function will wait for any pending callbacks invocation to 2036 complete (causing a deadlock if called from within the callback). 2037 @version: LibVLC 2.1.0 or later. 2038 ''' 2039 return libvlc_log_unset(self)
2040 2041
2042 - def log_set(self, cb, data):
2043 '''Sets the logging callback for a LibVLC instance. 2044 This function is thread-safe: it will wait for any pending callbacks 2045 invocation to complete. 2046 @param data: opaque data pointer for the callback function @note Some log messages (especially debug) are emitted by LibVLC while is being initialized. These messages cannot be captured with this interface. @warning A deadlock may occur if this function is called from the callback. 2047 @param p_instance: libvlc instance. 2048 @version: LibVLC 2.1.0 or later. 2049 ''' 2050 return libvlc_log_set(self, cb, data)
2051 2052
2053 - def log_set_file(self, stream):
2054 '''Sets up logging to a file. 2055 @param stream: FILE pointer opened for writing (the FILE pointer must remain valid until L{log_unset}()). 2056 @version: LibVLC 2.1.0 or later. 2057 ''' 2058 return libvlc_log_set_file(self, stream)
2059 2060
2061 - def media_discoverer_new(self, psz_name):
2062 '''Create a media discoverer object by name. 2063 After this object is created, you should attach to media_list events in 2064 order to be notified of new items discovered. 2065 You need to call L{media_discoverer_start}() in order to start the 2066 discovery. 2067 See L{media_discoverer_media_list} 2068 See L{media_discoverer_event_manager} 2069 See L{media_discoverer_start}. 2070 @param psz_name: service name; use L{media_discoverer_list_get}() to get a list of the discoverer names available in this libVLC instance. 2071 @return: media discover object or None in case of error. 2072 @version: LibVLC 3.0.0 or later. 2073 ''' 2074 return libvlc_media_discoverer_new(self, str_to_bytes(psz_name))
2075 2076
2077 - def media_discoverer_list_get(self, i_cat, ppp_services):
2078 '''Get media discoverer services by category. 2079 @param i_cat: category of services to fetch. 2080 @param ppp_services: address to store an allocated array of media discoverer services (must be freed with L{media_discoverer_list_release}() by the caller) [OUT]. 2081 @return: the number of media discoverer services (0 on error). 2082 @version: LibVLC 3.0.0 and later. 2083 ''' 2084 return libvlc_media_discoverer_list_get(self, i_cat, ppp_services)
2085 2086
2087 - def media_library_new(self):
2088 '''Create an new Media Library object. 2089 @return: a new object or None on error. 2090 ''' 2091 return libvlc_media_library_new(self)
2092 2093
2094 - def vlm_release(self):
2095 '''Release the vlm instance related to the given L{Instance}. 2096 ''' 2097 return libvlc_vlm_release(self)
2098 2099
2100 - def vlm_add_broadcast(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop):
2101 '''Add a broadcast, with one input. 2102 @param psz_name: the name of the new broadcast. 2103 @param psz_input: the input MRL. 2104 @param psz_output: the output MRL (the parameter to the "sout" variable). 2105 @param i_options: number of additional options. 2106 @param ppsz_options: additional options. 2107 @param b_enabled: boolean for enabling the new broadcast. 2108 @param b_loop: Should this broadcast be played in loop ? 2109 @return: 0 on success, -1 on error. 2110 ''' 2111 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)
2112 2113
2114 - def vlm_add_vod(self, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux):
2115 '''Add a vod, with one input. 2116 @param psz_name: the name of the new vod media. 2117 @param psz_input: the input MRL. 2118 @param i_options: number of additional options. 2119 @param ppsz_options: additional options. 2120 @param b_enabled: boolean for enabling the new vod. 2121 @param psz_mux: the muxer of the vod media. 2122 @return: 0 on success, -1 on error. 2123 ''' 2124 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))
2125 2126
2127 - def vlm_del_media(self, psz_name):
2128 '''Delete a media (VOD or broadcast). 2129 @param psz_name: the media to delete. 2130 @return: 0 on success, -1 on error. 2131 ''' 2132 return libvlc_vlm_del_media(self, str_to_bytes(psz_name))
2133 2134
2135 - def vlm_set_enabled(self, psz_name, b_enabled):
2136 '''Enable or disable a media (VOD or broadcast). 2137 @param psz_name: the media to work on. 2138 @param b_enabled: the new status. 2139 @return: 0 on success, -1 on error. 2140 ''' 2141 return libvlc_vlm_set_enabled(self, str_to_bytes(psz_name), b_enabled)
2142 2143
2144 - def vlm_set_output(self, psz_name, psz_output):
2145 '''Set the output for a media. 2146 @param psz_name: the media to work on. 2147 @param psz_output: the output MRL (the parameter to the "sout" variable). 2148 @return: 0 on success, -1 on error. 2149 ''' 2150 return libvlc_vlm_set_output(self, str_to_bytes(psz_name), str_to_bytes(psz_output))
2151 2152
2153 - def vlm_set_input(self, psz_name, psz_input):
2154 '''Set a media's input MRL. This will delete all existing inputs and 2155 add the specified one. 2156 @param psz_name: the media to work on. 2157 @param psz_input: the input MRL. 2158 @return: 0 on success, -1 on error. 2159 ''' 2160 return libvlc_vlm_set_input(self, str_to_bytes(psz_name), str_to_bytes(psz_input))
2161 2162
2163 - def vlm_add_input(self, psz_name, psz_input):
2164 '''Add a media's input MRL. This will add the specified one. 2165 @param psz_name: the media to work on. 2166 @param psz_input: the input MRL. 2167 @return: 0 on success, -1 on error. 2168 ''' 2169 return libvlc_vlm_add_input(self, str_to_bytes(psz_name), str_to_bytes(psz_input))
2170 2171
2172 - def vlm_set_loop(self, psz_name, b_loop):
2173 '''Set a media's loop status. 2174 @param psz_name: the media to work on. 2175 @param b_loop: the new status. 2176 @return: 0 on success, -1 on error. 2177 ''' 2178 return libvlc_vlm_set_loop(self, str_to_bytes(psz_name), b_loop)
2179 2180
2181 - def vlm_set_mux(self, psz_name, psz_mux):
2182 '''Set a media's vod muxer. 2183 @param psz_name: the media to work on. 2184 @param psz_mux: the new muxer. 2185 @return: 0 on success, -1 on error. 2186 ''' 2187 return libvlc_vlm_set_mux(self, str_to_bytes(psz_name), str_to_bytes(psz_mux))
2188 2189
2190 - def vlm_change_media(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop):
2191 '''Edit the parameters of a media. This will delete all existing inputs and 2192 add the specified one. 2193 @param psz_name: the name of the new broadcast. 2194 @param psz_input: the input MRL. 2195 @param psz_output: the output MRL (the parameter to the "sout" variable). 2196 @param i_options: number of additional options. 2197 @param ppsz_options: additional options. 2198 @param b_enabled: boolean for enabling the new broadcast. 2199 @param b_loop: Should this broadcast be played in loop ? 2200 @return: 0 on success, -1 on error. 2201 ''' 2202 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)
2203 2204
2205 - def vlm_play_media(self, psz_name):
2206 '''Play the named broadcast. 2207 @param psz_name: the name of the broadcast. 2208 @return: 0 on success, -1 on error. 2209 ''' 2210 return libvlc_vlm_play_media(self, str_to_bytes(psz_name))
2211 2212
2213 - def vlm_stop_media(self, psz_name):
2214 '''Stop the named broadcast. 2215 @param psz_name: the name of the broadcast. 2216 @return: 0 on success, -1 on error. 2217 ''' 2218 return libvlc_vlm_stop_media(self, str_to_bytes(psz_name))
2219 2220
2221 - def vlm_pause_media(self, psz_name):
2222 '''Pause the named broadcast. 2223 @param psz_name: the name of the broadcast. 2224 @return: 0 on success, -1 on error. 2225 ''' 2226 return libvlc_vlm_pause_media(self, str_to_bytes(psz_name))
2227 2228
2229 - def vlm_seek_media(self, psz_name, f_percentage):
2230 '''Seek in the named broadcast. 2231 @param psz_name: the name of the broadcast. 2232 @param f_percentage: the percentage to seek to. 2233 @return: 0 on success, -1 on error. 2234 ''' 2235 return libvlc_vlm_seek_media(self, str_to_bytes(psz_name), f_percentage)
2236 2237
2238 - def vlm_show_media(self, psz_name):
2239 '''Return information about the named media as a JSON 2240 string representation. 2241 This function is mainly intended for debugging use, 2242 if you want programmatic access to the state of 2243 a vlm_media_instance_t, please use the corresponding 2244 libvlc_vlm_get_media_instance_xxx -functions. 2245 Currently there are no such functions available for 2246 vlm_media_t though. 2247 @param psz_name: the name of the media, if the name is an empty string, all media is described. 2248 @return: string with information about named media, or None on error. 2249 ''' 2250 return libvlc_vlm_show_media(self, str_to_bytes(psz_name))
2251 2252
2253 - def vlm_get_media_instance_position(self, psz_name, i_instance):
2254 '''Get vlm_media instance position by name or instance id. 2255 @param psz_name: name of vlm media instance. 2256 @param i_instance: instance id. 2257 @return: position as float or -1. on error. 2258 ''' 2259 return libvlc_vlm_get_media_instance_position(self, str_to_bytes(psz_name), i_instance)
2260 2261
2262 - def vlm_get_media_instance_time(self, psz_name, i_instance):
2263 '''Get vlm_media instance time by name or instance id. 2264 @param psz_name: name of vlm media instance. 2265 @param i_instance: instance id. 2266 @return: time as integer or -1 on error. 2267 ''' 2268 return libvlc_vlm_get_media_instance_time(self, str_to_bytes(psz_name), i_instance)
2269 2270
2271 - def vlm_get_media_instance_length(self, psz_name, i_instance):
2272 '''Get vlm_media instance length by name or instance id. 2273 @param psz_name: name of vlm media instance. 2274 @param i_instance: instance id. 2275 @return: length of media item or -1 on error. 2276 ''' 2277 return libvlc_vlm_get_media_instance_length(self, str_to_bytes(psz_name), i_instance)
2278 2279
2280 - def vlm_get_media_instance_rate(self, psz_name, i_instance):
2281 '''Get vlm_media instance playback rate by name or instance id. 2282 @param psz_name: name of vlm media instance. 2283 @param i_instance: instance id. 2284 @return: playback rate or -1 on error. 2285 ''' 2286 return libvlc_vlm_get_media_instance_rate(self, str_to_bytes(psz_name), i_instance)
2287 2288
2289 - def vlm_get_media_instance_title(self, psz_name, i_instance):
2290 '''Get vlm_media instance title number by name or instance id. 2291 @param psz_name: name of vlm media instance. 2292 @param i_instance: instance id. 2293 @return: title as number or -1 on error. 2294 @bug: will always return 0. 2295 ''' 2296 return libvlc_vlm_get_media_instance_title(self, str_to_bytes(psz_name), i_instance)
2297 2298
2299 - def vlm_get_media_instance_chapter(self, psz_name, i_instance):
2300 '''Get vlm_media instance chapter number by name or instance id. 2301 @param psz_name: name of vlm media instance. 2302 @param i_instance: instance id. 2303 @return: chapter as number or -1 on error. 2304 @bug: will always return 0. 2305 ''' 2306 return libvlc_vlm_get_media_instance_chapter(self, str_to_bytes(psz_name), i_instance)
2307 2308
2309 - def vlm_get_media_instance_seekable(self, psz_name, i_instance):
2310 '''Is libvlc instance seekable ? 2311 @param psz_name: name of vlm media instance. 2312 @param i_instance: instance id. 2313 @return: 1 if seekable, 0 if not, -1 if media does not exist. 2314 @bug: will always return 0. 2315 ''' 2316 return libvlc_vlm_get_media_instance_seekable(self, str_to_bytes(psz_name), i_instance)
2317 2318 @memoize_parameterless
2319 - def vlm_get_event_manager(self):
2320 '''Get libvlc_event_manager from a vlm media. 2321 The p_event_manager is immutable, so you don't have to hold the lock. 2322 @return: libvlc_event_manager. 2323 ''' 2324 return libvlc_vlm_get_event_manager(self)
2325 2326
2327 - def media_new_location(self, psz_mrl):
2328 '''Create a media with a certain given media resource location, 2329 for instance a valid URL. 2330 @note: To refer to a local file with this function, 2331 the file://... URI syntax B{must} be used (see IETF RFC3986). 2332 We recommend using L{media_new_path}() instead when dealing with 2333 local files. 2334 See L{media_release}. 2335 @param psz_mrl: the media location. 2336 @return: the newly created media or None on error. 2337 ''' 2338 return libvlc_media_new_location(self, str_to_bytes(psz_mrl))
2339 2340
2341 - def media_new_fd(self, fd):
2342 '''Create a media for an already open file descriptor. 2343 The file descriptor shall be open for reading (or reading and writing). 2344 Regular file descriptors, pipe read descriptors and character device 2345 descriptors (including TTYs) are supported on all platforms. 2346 Block device descriptors are supported where available. 2347 Directory descriptors are supported on systems that provide fdopendir(). 2348 Sockets are supported on all platforms where they are file descriptors, 2349 i.e. all except Windows. 2350 @note: This library will B{not} automatically close the file descriptor 2351 under any circumstance. Nevertheless, a file descriptor can usually only be 2352 rendered once in a media player. To render it a second time, the file 2353 descriptor should probably be rewound to the beginning with lseek(). 2354 See L{media_release}. 2355 @param fd: open file descriptor. 2356 @return: the newly created media or None on error. 2357 @version: LibVLC 1.1.5 and later. 2358 ''' 2359 return libvlc_media_new_fd(self, fd)
2360 2361
2362 - def media_new_callbacks(self, open_cb, read_cb, seek_cb, close_cb, opaque):
2363 '''Create a media with custom callbacks to read the data from. 2364 @param open_cb: callback to open the custom bitstream input media. 2365 @param read_cb: callback to read data (must not be None). 2366 @param seek_cb: callback to seek, or None if seeking is not supported. 2367 @param close_cb: callback to close the media, or None if unnecessary. 2368 @param opaque: data pointer for the open callback. 2369 @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}. 2370 @version: LibVLC 3.0.0 and later. 2371 ''' 2372 return libvlc_media_new_callbacks(self, open_cb, read_cb, seek_cb, close_cb, opaque)
2373 2374
2375 - def media_new_as_node(self, psz_name):
2376 '''Create a media as an empty node with a given name. 2377 See L{media_release}. 2378 @param psz_name: the name of the node. 2379 @return: the new empty media or None on error. 2380 ''' 2381 return libvlc_media_new_as_node(self, str_to_bytes(psz_name))
2382 2383
2384 - def renderer_discoverer_new(self, psz_name):
2385 '''Create a renderer discoverer object by name 2386 After this object is created, you should attach to events in order to be 2387 notified of the discoverer events. 2388 You need to call L{renderer_discoverer_start}() in order to start the 2389 discovery. 2390 See L{renderer_discoverer_event_manager}() 2391 See L{renderer_discoverer_start}(). 2392 @param psz_name: service name; use L{renderer_discoverer_list_get}() to get a list of the discoverer names available in this libVLC instance. 2393 @return: media discover object or None in case of error. 2394 @version: LibVLC 3.0.0 or later. 2395 ''' 2396 return libvlc_renderer_discoverer_new(self, str_to_bytes(psz_name))
2397 2398
2399 - def renderer_discoverer_list_get(self, ppp_services):
2400 '''Get media discoverer services 2401 See libvlc_renderer_list_release(). 2402 @param ppp_services: address to store an allocated array of renderer discoverer services (must be freed with libvlc_renderer_list_release() by the caller) [OUT]. 2403 @return: the number of media discoverer services (0 on error). 2404 @version: LibVLC 3.0.0 and later. 2405 ''' 2406 return libvlc_renderer_discoverer_list_get(self, ppp_services)
2407 2408
2409 - def audio_output_device_count(self, psz_audio_output):
2410 '''Backward compatibility stub. Do not use in new code. 2411 \deprecated Use L{audio_output_device_list_get}() instead. 2412 @return: always 0. 2413 ''' 2414 return libvlc_audio_output_device_count(self, str_to_bytes(psz_audio_output))
2415 2416
2417 - def audio_output_device_longname(self, psz_output, i_device):
2418 '''Backward compatibility stub. Do not use in new code. 2419 \deprecated Use L{audio_output_device_list_get}() instead. 2420 @return: always None. 2421 ''' 2422 return libvlc_audio_output_device_longname(self, str_to_bytes(psz_output), i_device)
2423 2424
2425 - def audio_output_device_id(self, psz_audio_output, i_device):
2426 '''Backward compatibility stub. Do not use in new code. 2427 \deprecated Use L{audio_output_device_list_get}() instead. 2428 @return: always None. 2429 ''' 2430 return libvlc_audio_output_device_id(self, str_to_bytes(psz_audio_output), i_device)
2431 2432
2433 - def media_discoverer_new_from_name(self, psz_name):
2434 '''\deprecated Use L{media_discoverer_new}() and L{media_discoverer_start}(). 2435 ''' 2436 return libvlc_media_discoverer_new_from_name(self, str_to_bytes(psz_name))
2437 2438
2439 - def wait(self):
2440 '''Waits until an interface causes the instance to exit. 2441 You should start at least one interface first, using L{add_intf}(). 2442 ''' 2443 return libvlc_wait(self)
2444 2445
2446 - def get_log_verbosity(self):
2447 '''Always returns minus one. 2448 This function is only provided for backward compatibility. 2449 @return: always -1. 2450 ''' 2451 return libvlc_get_log_verbosity(self)
2452 2453
2454 - def set_log_verbosity(self, level):
2455 '''This function does nothing. 2456 It is only provided for backward compatibility. 2457 @param level: ignored. 2458 ''' 2459 return libvlc_set_log_verbosity(self, level)
2460 2461
2462 - def log_open(self):
2463 '''This function does nothing useful. 2464 It is only provided for backward compatibility. 2465 @return: an unique pointer or None on error. 2466 ''' 2467 return libvlc_log_open(self)
2468 2469
2470 - def playlist_play(self, i_id, i_options, ppsz_options):
2471 '''Start playing (if there is any item in the playlist). 2472 Additionnal playlist item options can be specified for addition to the 2473 item before it is played. 2474 @param i_id: the item to play. If this is a negative number, the next item will be selected. Otherwise, the item with the given ID will be played. 2475 @param i_options: the number of options to add to the item. 2476 @param ppsz_options: the options to add to the item. 2477 ''' 2478 return libvlc_playlist_play(self, i_id, i_options, ppsz_options)
2479 2480
2481 - def audio_output_list_get(self):
2482 '''Gets the list of available audio output modules. 2483 @return: list of available audio outputs. It must be freed with In case of error, None is returned. 2484 ''' 2485 return libvlc_audio_output_list_get(self)
2486 2487
2488 - def audio_output_device_list_get(self, aout):
2489 '''Gets a list of audio output devices for a given audio output module, 2490 See L{audio_output_device_set}(). 2491 @note: Not all audio outputs support this. In particular, an empty (None) 2492 list of devices does B{not} imply that the specified audio output does 2493 not work. 2494 @note: The list might not be exhaustive. 2495 @warning: Some audio output devices in the list might not actually work in 2496 some circumstances. By default, it is recommended to not specify any 2497 explicit audio device. 2498 @param aout: audio output name (as returned by L{audio_output_list_get}()). 2499 @return: A None-terminated linked list of potential audio output devices. It must be freed with L{audio_output_device_list_release}(). 2500 @version: LibVLC 2.1.0 or later. 2501 ''' 2502 return libvlc_audio_output_device_list_get(self, str_to_bytes(aout))
2503
2504 -class LogIterator(_Ctype):
2505 '''Create a new VLC log iterator. 2506 2507 ''' 2508
2509 - def __new__(cls, ptr=_internal_guard):
2510 '''(INTERNAL) ctypes wrapper constructor. 2511 ''' 2512 return _Constructor(cls, ptr)
2513
2514 - def __iter__(self):
2515 return self
2516
2517 - def next(self):
2518 if self.has_next(): 2519 b = LogMessage() 2520 i = libvlc_log_iterator_next(self, b) 2521 return i.contents 2522 raise StopIteration
2523
2524 - def __next__(self):
2525 return self.next()
2526 2527 2528
2529 - def free(self):
2530 '''Frees memory allocated by L{log_get_iterator}(). 2531 ''' 2532 return libvlc_log_iterator_free(self)
2533 2534
2535 - def has_next(self):
2536 '''Always returns zero. 2537 This function is only provided for backward compatibility. 2538 @return: always zero. 2539 ''' 2540 return libvlc_log_iterator_has_next(self)
2541
2542 -class Media(_Ctype):
2543 '''Create a new Media instance. 2544 2545 Usage: Media(MRL, *options) 2546 2547 See vlc.Instance.media_new documentation for details. 2548 2549 ''' 2550
2551 - def __new__(cls, *args):
2552 if args: 2553 i = args[0] 2554 if isinstance(i, _Ints): 2555 return _Constructor(cls, i) 2556 if isinstance(i, Instance): 2557 return i.media_new(*args[1:]) 2558 2559 o = get_default_instance().media_new(*args) 2560 return o
2561
2562 - def get_instance(self):
2563 return getattr(self, '_instance', None)
2564
2565 - def add_options(self, *options):
2566 """Add a list of options to the media. 2567 2568 Options must be written without the double-dash. Warning: most 2569 audio and video options, such as text renderer, have no 2570 effects on an individual media. These options must be set at 2571 the vlc.Instance or vlc.MediaPlayer instanciation. 2572 2573 @param options: optional media option=value strings 2574 """ 2575 for o in options: 2576 self.add_option(o)
2577
2578 - def tracks_get(self):
2579 """Get media descriptor's elementary streams description 2580 Note, you need to call L{parse}() or play the media at least once 2581 before calling this function. 2582 Not doing this will result in an empty array. 2583 The result must be freed with L{tracks_release}. 2584 @version: LibVLC 2.1.0 and later. 2585 """ 2586 mediaTrack_pp = ctypes.POINTER(MediaTrack)() 2587 n = libvlc_media_tracks_get(self, ctypes.byref(mediaTrack_pp)) 2588 info = ctypes.cast(mediaTrack_pp, ctypes.POINTER(ctypes.POINTER(MediaTrack) * n)) 2589 try: 2590 contents = info.contents 2591 except ValueError: 2592 # Media not parsed, no info. 2593 return None 2594 tracks = ( contents[i].contents for i in range(len(contents)) ) 2595 # libvlc_media_tracks_release(mediaTrack_pp, n) 2596 return tracks
2597 2598 2599
2600 - def add_option(self, psz_options):
2601 '''Add an option to the media. 2602 This option will be used to determine how the media_player will 2603 read the media. This allows to use VLC's advanced 2604 reading/streaming options on a per-media basis. 2605 @note: The options are listed in 'vlc --long-help' from the command line, 2606 e.g. "-sout-all". Keep in mind that available options and their semantics 2607 vary across LibVLC versions and builds. 2608 @warning: Not all options affects L{Media} objects: 2609 Specifically, due to architectural issues most audio and video options, 2610 such as text renderer options, have no effects on an individual media. 2611 These options must be set through L{new}() instead. 2612 @param psz_options: the options (as a string). 2613 ''' 2614 return libvlc_media_add_option(self, str_to_bytes(psz_options))
2615 2616
2617 - def add_option_flag(self, psz_options, i_flags):
2618 '''Add an option to the media with configurable flags. 2619 This option will be used to determine how the media_player will 2620 read the media. This allows to use VLC's advanced 2621 reading/streaming options on a per-media basis. 2622 The options are detailed in vlc --long-help, for instance 2623 "--sout-all". Note that all options are not usable on medias: 2624 specifically, due to architectural issues, video-related options 2625 such as text renderer options cannot be set on a single media. They 2626 must be set on the whole libvlc instance instead. 2627 @param psz_options: the options (as a string). 2628 @param i_flags: the flags for this option. 2629 ''' 2630 return libvlc_media_add_option_flag(self, str_to_bytes(psz_options), i_flags)
2631 2632
2633 - def retain(self):
2634 '''Retain a reference to a media descriptor object (L{Media}). Use 2635 L{release}() to decrement the reference count of a 2636 media descriptor object. 2637 ''' 2638 return libvlc_media_retain(self)
2639 2640
2641 - def release(self):
2642 '''Decrement the reference count of a media descriptor object. If the 2643 reference count is 0, then L{release}() will release the 2644 media descriptor object. It will send out an libvlc_MediaFreed event 2645 to all listeners. If the media descriptor object has been released it 2646 should not be used again. 2647 ''' 2648 return libvlc_media_release(self)
2649 2650
2651 - def get_mrl(self):
2652 '''Get the media resource locator (mrl) from a media descriptor object. 2653 @return: string with mrl of media descriptor object. 2654 ''' 2655 return libvlc_media_get_mrl(self)
2656 2657
2658 - def duplicate(self):
2659 '''Duplicate a media descriptor object. 2660 ''' 2661 return libvlc_media_duplicate(self)
2662 2663
2664 - def get_meta(self, e_meta):
2665 '''Read the meta of the media. 2666 If the media has not yet been parsed this will return None. 2667 See L{parse} 2668 See L{parse_with_options} 2669 See libvlc_MediaMetaChanged. 2670 @param e_meta: the meta to read. 2671 @return: the media's meta. 2672 ''' 2673 return libvlc_media_get_meta(self, e_meta)
2674 2675
2676 - def set_meta(self, e_meta, psz_value):
2677 '''Set the meta of the media (this function will not save the meta, call 2678 L{save_meta} in order to save the meta). 2679 @param e_meta: the meta to write. 2680 @param psz_value: the media's meta. 2681 ''' 2682 return libvlc_media_set_meta(self, e_meta, str_to_bytes(psz_value))
2683 2684
2685 - def save_meta(self):
2686 '''Save the meta previously set. 2687 @return: true if the write operation was successful. 2688 ''' 2689 return libvlc_media_save_meta(self)
2690 2691
2692 - def get_state(self):
2693 '''Get current state of media descriptor object. Possible media states are 2694 libvlc_NothingSpecial=0, libvlc_Opening, libvlc_Playing, libvlc_Paused, 2695 libvlc_Stopped, libvlc_Ended, libvlc_Error. 2696 See L{State}. 2697 @return: state of media descriptor object. 2698 ''' 2699 return libvlc_media_get_state(self)
2700 2701
2702 - def get_stats(self, p_stats):
2703 '''Get the current statistics about the media. 2704 @param p_stats:: structure that contain the statistics about the media (this structure must be allocated by the caller). 2705 @return: true if the statistics are available, false otherwise \libvlc_return_bool. 2706 ''' 2707 return libvlc_media_get_stats(self, p_stats)
2708 2709
2710 - def subitems(self):
2711 '''Get subitems of media descriptor object. This will increment 2712 the reference count of supplied media descriptor object. Use 2713 L{list_release}() to decrement the reference counting. 2714 @return: list of media descriptor subitems or None. 2715 ''' 2716 return libvlc_media_subitems(self)
2717 2718 @memoize_parameterless
2719 - def event_manager(self):
2720 '''Get event manager from media descriptor object. 2721 NOTE: this function doesn't increment reference counting. 2722 @return: event manager object. 2723 ''' 2724 return libvlc_media_event_manager(self)
2725 2726
2727 - def get_duration(self):
2728 '''Get duration (in ms) of media descriptor object item. 2729 @return: duration of media item or -1 on error. 2730 ''' 2731 return libvlc_media_get_duration(self)
2732 2733
2734 - def parse_with_options(self, parse_flag, timeout):
2735 '''Parse the media asynchronously with options. 2736 This fetches (local or network) art, meta data and/or tracks information. 2737 This method is the extended version of L{parse_with_options}(). 2738 To track when this is over you can listen to libvlc_MediaParsedChanged 2739 event. However if this functions returns an error, you will not receive any 2740 events. 2741 It uses a flag to specify parse options (see L{MediaParseFlag}). All 2742 these flags can be combined. By default, media is parsed if it's a local 2743 file. 2744 @note: Parsing can be aborted with L{parse_stop}(). 2745 See libvlc_MediaParsedChanged 2746 See L{get_meta} 2747 See L{tracks_get} 2748 See L{get_parsed_status} 2749 See L{MediaParseFlag}. 2750 @param parse_flag: parse options: 2751 @param timeout: maximum time allowed to preparse the media. If -1, the default "preparse-timeout" option will be used as a timeout. If 0, it will wait indefinitely. If > 0, the timeout will be used (in milliseconds). 2752 @return: -1 in case of error, 0 otherwise. 2753 @version: LibVLC 3.0.0 or later. 2754 ''' 2755 return libvlc_media_parse_with_options(self, parse_flag, timeout)
2756 2757
2758 - def parse_stop(self):
2759 '''Stop the parsing of the media 2760 When the media parsing is stopped, the libvlc_MediaParsedChanged event will 2761 be sent with the libvlc_media_parsed_status_timeout status. 2762 See L{parse_with_options}. 2763 @version: LibVLC 3.0.0 or later. 2764 ''' 2765 return libvlc_media_parse_stop(self)
2766 2767
2768 - def get_parsed_status(self):
2769 '''Get Parsed status for media descriptor object. 2770 See libvlc_MediaParsedChanged 2771 See L{MediaParsedStatus}. 2772 @return: a value of the L{MediaParsedStatus} enum. 2773 @version: LibVLC 3.0.0 or later. 2774 ''' 2775 return libvlc_media_get_parsed_status(self)
2776 2777
2778 - def set_user_data(self, p_new_user_data):
2779 '''Sets media descriptor's user_data. user_data is specialized data 2780 accessed by the host application, VLC.framework uses it as a pointer to 2781 an native object that references a L{Media} pointer. 2782 @param p_new_user_data: pointer to user data. 2783 ''' 2784 return libvlc_media_set_user_data(self, p_new_user_data)
2785 2786
2787 - def get_user_data(self):
2788 '''Get media descriptor's user_data. user_data is specialized data 2789 accessed by the host application, VLC.framework uses it as a pointer to 2790 an native object that references a L{Media} pointer. 2791 ''' 2792 return libvlc_media_get_user_data(self)
2793 2794
2795 - def get_type(self):
2796 '''Get the media type of the media descriptor object. 2797 @return: media type. 2798 @version: LibVLC 3.0.0 and later. See L{MediaType}. 2799 ''' 2800 return libvlc_media_get_type(self)
2801 2802
2803 - def slaves_add(self, i_type, i_priority, psz_uri):
2804 '''Add a slave to the current media. 2805 A slave is an external input source that may contains an additional subtitle 2806 track (like a .srt) or an additional audio track (like a .ac3). 2807 @note: This function must be called before the media is parsed (via 2808 L{parse_with_options}()) or before the media is played (via 2809 L{player_play}()). 2810 @param i_type: subtitle or audio. 2811 @param i_priority: from 0 (low priority) to 4 (high priority). 2812 @param psz_uri: Uri of the slave (should contain a valid scheme). 2813 @return: 0 on success, -1 on error. 2814 @version: LibVLC 3.0.0 and later. 2815 ''' 2816 return libvlc_media_slaves_add(self, i_type, i_priority, str_to_bytes(psz_uri))
2817 2818
2819 - def slaves_clear(self):
2820 '''Clear all slaves previously added by L{slaves_add}() or 2821 internally. 2822 @version: LibVLC 3.0.0 and later. 2823 ''' 2824 return libvlc_media_slaves_clear(self)
2825 2826
2827 - def slaves_get(self, ppp_slaves):
2828 '''Get a media descriptor's slave list 2829 The list will contain slaves parsed by VLC or previously added by 2830 L{slaves_add}(). The typical use case of this function is to save 2831 a list of slave in a database for a later use. 2832 @param ppp_slaves: address to store an allocated array of slaves (must be freed with L{slaves_release}()) [OUT]. 2833 @return: the number of slaves (zero on error). 2834 @version: LibVLC 3.0.0 and later. See L{slaves_add}. 2835 ''' 2836 return libvlc_media_slaves_get(self, ppp_slaves)
2837 2838
2839 - def parse(self):
2840 '''Parse a media. 2841 This fetches (local) art, meta data and tracks information. 2842 The method is synchronous. 2843 \deprecated This function could block indefinitely. 2844 Use L{parse_with_options}() instead 2845 See L{parse_with_options} 2846 See L{get_meta} 2847 See L{get_tracks_info}. 2848 ''' 2849 return libvlc_media_parse(self)
2850 2851
2852 - def parse_async(self):
2853 '''Parse a media. 2854 This fetches (local) art, meta data and tracks information. 2855 The method is the asynchronous of L{parse}(). 2856 To track when this is over you can listen to libvlc_MediaParsedChanged 2857 event. However if the media was already parsed you will not receive this 2858 event. 2859 \deprecated You can't be sure to receive the libvlc_MediaParsedChanged 2860 event (you can wait indefinitely for this event). 2861 Use L{parse_with_options}() instead 2862 See L{parse} 2863 See libvlc_MediaParsedChanged 2864 See L{get_meta} 2865 See L{get_tracks_info}. 2866 ''' 2867 return libvlc_media_parse_async(self)
2868 2869
2870 - def is_parsed(self):
2871 '''Return true is the media descriptor object is parsed 2872 \deprecated This can return true in case of failure. 2873 Use L{get_parsed_status}() instead 2874 See libvlc_MediaParsedChanged. 2875 @return: true if media object has been parsed otherwise it returns false \libvlc_return_bool. 2876 ''' 2877 return libvlc_media_is_parsed(self)
2878 2879
2880 - def get_tracks_info(self):
2881 '''Get media descriptor's elementary streams description 2882 Note, you need to call L{parse}() or play the media at least once 2883 before calling this function. 2884 Not doing this will result in an empty array. 2885 \deprecated Use L{tracks_get}() instead. 2886 @param tracks: address to store an allocated array of Elementary Streams descriptions (must be freed by the caller) [OUT]. 2887 @return: the number of Elementary Streams. 2888 ''' 2889 return libvlc_media_get_tracks_info(self)
2890 2891
2892 - def player_new_from_media(self):
2893 '''Create a Media Player object from a Media. 2894 @return: a new media player object, or None on error. 2895 ''' 2896 return libvlc_media_player_new_from_media(self)
2897
2898 -class MediaDiscoverer(_Ctype):
2899 '''N/A 2900 ''' 2901
2902 - def __new__(cls, ptr=_internal_guard):
2903 '''(INTERNAL) ctypes wrapper constructor. 2904 ''' 2905 return _Constructor(cls, ptr)
2906
2907 - def start(self):
2908 '''Start media discovery. 2909 To stop it, call L{stop}() or 2910 L{list_release}() directly. 2911 See L{stop}. 2912 @return: -1 in case of error, 0 otherwise. 2913 @version: LibVLC 3.0.0 or later. 2914 ''' 2915 return libvlc_media_discoverer_start(self)
2916 2917
2918 - def stop(self):
2919 '''Stop media discovery. 2920 See L{start}. 2921 @version: LibVLC 3.0.0 or later. 2922 ''' 2923 return libvlc_media_discoverer_stop(self)
2924 2925
2926 - def release(self):
2927 '''Release media discover object. If the reference count reaches 0, then 2928 the object will be released. 2929 ''' 2930 return libvlc_media_discoverer_release(self)
2931 2932
2933 - def media_list(self):
2934 '''Get media service discover media list. 2935 @return: list of media items. 2936 ''' 2937 return libvlc_media_discoverer_media_list(self)
2938 2939
2940 - def is_running(self):
2941 '''Query if media service discover object is running. 2942 @return: true if running, false if not \libvlc_return_bool. 2943 ''' 2944 return libvlc_media_discoverer_is_running(self)
2945 2946
2947 - def localized_name(self):
2948 '''Get media service discover object its localized name. 2949 \deprecated Useless, use L{list_get}() to get the 2950 longname of the service discovery. 2951 @return: localized name or None if the media_discoverer is not started. 2952 ''' 2953 return libvlc_media_discoverer_localized_name(self)
2954 2955 @memoize_parameterless
2956 - def event_manager(self):
2957 '''Get event manager from media service discover object. 2958 \deprecated Useless, media_discoverer events are only triggered when calling 2959 L{start}() and L{stop}(). 2960 @return: event manager object. 2961 ''' 2962 return libvlc_media_discoverer_event_manager(self)
2963
2964 -class MediaLibrary(_Ctype):
2965 '''N/A 2966 ''' 2967
2968 - def __new__(cls, ptr=_internal_guard):
2969 '''(INTERNAL) ctypes wrapper constructor. 2970 ''' 2971 return _Constructor(cls, ptr)
2972
2973 - def release(self):
2974 '''Release media library object. This functions decrements the 2975 reference count of the media library object. If it reaches 0, 2976 then the object will be released. 2977 ''' 2978 return libvlc_media_library_release(self)
2979 2980
2981 - def retain(self):
2982 '''Retain a reference to a media library object. This function will 2983 increment the reference counting for this object. Use 2984 L{release}() to decrement the reference count. 2985 ''' 2986 return libvlc_media_library_retain(self)
2987 2988
2989 - def load(self):
2990 '''Load media library. 2991 @return: 0 on success, -1 on error. 2992 ''' 2993 return libvlc_media_library_load(self)
2994 2995
2996 - def media_list(self):
2997 '''Get media library subitems. 2998 @return: media list subitems. 2999 ''' 3000 return libvlc_media_library_media_list(self)
3001
3002 -class MediaList(_Ctype):
3003 '''Create a new MediaList instance. 3004 3005 Usage: MediaList(list_of_MRLs) 3006 3007 See vlc.Instance.media_list_new documentation for details. 3008 3009 ''' 3010
3011 - def __new__(cls, *args):
3012 if args: 3013 i = args[0] 3014 if isinstance(i, _Ints): 3015 return _Constructor(cls, i) 3016 if isinstance(i, Instance): 3017 return i.media_list_new(*args[1:]) 3018 3019 o = get_default_instance().media_list_new(*args) 3020 return o
3021
3022 - def get_instance(self):
3023 return getattr(self, '_instance', None)
3024
3025 - def add_media(self, mrl):
3026 """Add media instance to media list. 3027 3028 The L{lock} should be held upon entering this function. 3029 @param mrl: a media instance or a MRL. 3030 @return: 0 on success, -1 if the media list is read-only. 3031 """ 3032 mrl = try_fspath(mrl) 3033 if isinstance(mrl, basestring): 3034 mrl = (self.get_instance() or get_default_instance()).media_new(mrl) 3035 return libvlc_media_list_add_media(self, mrl)
3036 3037 3038
3039 - def release(self):
3040 '''Release media list created with L{new}(). 3041 ''' 3042 return libvlc_media_list_release(self)
3043 3044
3045 - def retain(self):
3046 '''Retain reference to a media list. 3047 ''' 3048 return libvlc_media_list_retain(self)
3049 3050
3051 - def set_media(self, p_md):
3052 '''Associate media instance with this media list instance. 3053 If another media instance was present it will be released. 3054 The L{lock} should NOT be held upon entering this function. 3055 @param p_md: media instance to add. 3056 ''' 3057 return libvlc_media_list_set_media(self, p_md)
3058 3059
3060 - def media(self):
3061 '''Get media instance from this media list instance. This action will increase 3062 the refcount on the media instance. 3063 The L{lock} should NOT be held upon entering this function. 3064 @return: media instance. 3065 ''' 3066 return libvlc_media_list_media(self)
3067 3068
3069 - def insert_media(self, p_md, i_pos):
3070 '''Insert media instance in media list on a position 3071 The L{lock} should be held upon entering this function. 3072 @param p_md: a media instance. 3073 @param i_pos: position in array where to insert. 3074 @return: 0 on success, -1 if the media list is read-only. 3075 ''' 3076 return libvlc_media_list_insert_media(self, p_md, i_pos)
3077 3078
3079 - def remove_index(self, i_pos):
3080 '''Remove media instance from media list on a position 3081 The L{lock} should be held upon entering this function. 3082 @param i_pos: position in array where to insert. 3083 @return: 0 on success, -1 if the list is read-only or the item was not found. 3084 ''' 3085 return libvlc_media_list_remove_index(self, i_pos)
3086 3087
3088 - def count(self):
3089 '''Get count on media list items 3090 The L{lock} should be held upon entering this function. 3091 @return: number of items in media list. 3092 ''' 3093 return libvlc_media_list_count(self)
3094
3095 - def __len__(self):
3096 return libvlc_media_list_count(self)
3097 3098
3099 - def item_at_index(self, i_pos):
3100 '''List media instance in media list at a position 3101 The L{lock} should be held upon entering this function. 3102 @param i_pos: position in array where to insert. 3103 @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. 3104 ''' 3105 return libvlc_media_list_item_at_index(self, i_pos)
3106
3107 - def __getitem__(self, i):
3108 return libvlc_media_list_item_at_index(self, i)
3109
3110 - def __iter__(self):
3111 for i in range(len(self)): 3112 yield self[i]
3113 3114
3115 - def index_of_item(self, p_md):
3116 '''Find index position of List media instance in media list. 3117 Warning: the function will return the first matched position. 3118 The L{lock} should be held upon entering this function. 3119 @param p_md: media instance. 3120 @return: position of media instance or -1 if media not found. 3121 ''' 3122 return libvlc_media_list_index_of_item(self, p_md)
3123 3124
3125 - def is_readonly(self):
3126 '''This indicates if this media list is read-only from a user point of view. 3127 @return: 1 on readonly, 0 on readwrite \libvlc_return_bool. 3128 ''' 3129 return libvlc_media_list_is_readonly(self)
3130 3131
3132 - def lock(self):
3133 '''Get lock on media list items. 3134 ''' 3135 return libvlc_media_list_lock(self)
3136 3137
3138 - def unlock(self):
3139 '''Release lock on media list items 3140 The L{lock} should be held upon entering this function. 3141 ''' 3142 return libvlc_media_list_unlock(self)
3143 3144 @memoize_parameterless
3145 - def event_manager(self):
3146 '''Get libvlc_event_manager from this media list instance. 3147 The p_event_manager is immutable, so you don't have to hold the lock. 3148 @return: libvlc_event_manager. 3149 ''' 3150 return libvlc_media_list_event_manager(self)
3151
3152 -class MediaListPlayer(_Ctype):
3153 '''Create a new MediaListPlayer instance. 3154 3155 It may take as parameter either: 3156 - a vlc.Instance 3157 - nothing 3158 3159 ''' 3160
3161 - def __new__(cls, arg=None):
3162 if arg is None: 3163 i = get_default_instance() 3164 elif isinstance(arg, Instance): 3165 i = arg 3166 elif isinstance(arg, _Ints): 3167 return _Constructor(cls, arg) 3168 else: 3169 raise TypeError('MediaListPlayer %r' % (arg,)) 3170 3171 return i.media_list_player_new()
3172
3173 - def get_instance(self):
3174 """Return the associated Instance. 3175 """ 3176 return self._instance #PYCHOK expected
3177 3178 3179
3180 - def release(self):
3181 '''Release a media_list_player after use 3182 Decrement the reference count of a media player object. If the 3183 reference count is 0, then L{release}() will 3184 release the media player object. If the media player object 3185 has been released, then it should not be used again. 3186 ''' 3187 return libvlc_media_list_player_release(self)
3188 3189
3190 - def retain(self):
3191 '''Retain a reference to a media player list object. Use 3192 L{release}() to decrement reference count. 3193 ''' 3194 return libvlc_media_list_player_retain(self)
3195 3196 @memoize_parameterless
3197 - def event_manager(self):
3198 '''Return the event manager of this media_list_player. 3199 @return: the event manager. 3200 ''' 3201 return libvlc_media_list_player_event_manager(self)
3202 3203
3204 - def set_media_player(self, p_mi):
3205 '''Replace media player in media_list_player with this instance. 3206 @param p_mi: media player instance. 3207 ''' 3208 return libvlc_media_list_player_set_media_player(self, p_mi)
3209 3210
3211 - def get_media_player(self):
3212 '''Get media player of the media_list_player instance. 3213 @return: media player instance @note the caller is responsible for releasing the returned instance. 3214 ''' 3215 return libvlc_media_list_player_get_media_player(self)
3216 3217
3218 - def set_media_list(self, p_mlist):
3219 '''Set the media list associated with the player. 3220 @param p_mlist: list of media. 3221 ''' 3222 return libvlc_media_list_player_set_media_list(self, p_mlist)
3223 3224
3225 - def play(self):
3226 '''Play media list. 3227 ''' 3228 return libvlc_media_list_player_play(self)
3229 3230
3231 - def pause(self):
3232 '''Toggle pause (or resume) media list. 3233 ''' 3234 return libvlc_media_list_player_pause(self)
3235 3236
3237 - def set_pause(self, do_pause):
3238 '''Pause or resume media list. 3239 @param do_pause: play/resume if zero, pause if non-zero. 3240 @version: LibVLC 3.0.0 or later. 3241 ''' 3242 return libvlc_media_list_player_set_pause(self, do_pause)
3243 3244
3245 - def is_playing(self):
3246 '''Is media list playing? 3247 @return: true for playing and false for not playing \libvlc_return_bool. 3248 ''' 3249 return libvlc_media_list_player_is_playing(self)
3250 3251
3252 - def get_state(self):
3253 '''Get current libvlc_state of media list player. 3254 @return: L{State} for media list player. 3255 ''' 3256 return libvlc_media_list_player_get_state(self)
3257 3258
3259 - def play_item_at_index(self, i_index):
3260 '''Play media list item at position index. 3261 @param i_index: index in media list to play. 3262 @return: 0 upon success -1 if the item wasn't found. 3263 ''' 3264 return libvlc_media_list_player_play_item_at_index(self, i_index)
3265
3266 - def __getitem__(self, i):
3268
3269 - def __iter__(self):
3270 for i in range(len(self)): 3271 yield self[i]
3272 3273
3274 - def play_item(self, p_md):
3275 '''Play the given media item. 3276 @param p_md: the media instance. 3277 @return: 0 upon success, -1 if the media is not part of the media list. 3278 ''' 3279 return libvlc_media_list_player_play_item(self, p_md)
3280 3281
3282 - def stop(self):
3283 '''Stop playing media list. 3284 ''' 3285 return libvlc_media_list_player_stop(self)
3286 3287
3288 - def next(self):
3289 '''Play next item from media list. 3290 @return: 0 upon success -1 if there is no next item. 3291 ''' 3292 return libvlc_media_list_player_next(self)
3293 3294
3295 - def previous(self):
3296 '''Play previous item from media list. 3297 @return: 0 upon success -1 if there is no previous item. 3298 ''' 3299 return libvlc_media_list_player_previous(self)
3300 3301
3302 - def set_playback_mode(self, e_mode):
3303 '''Sets the playback mode for the playlist. 3304 @param e_mode: playback mode specification. 3305 ''' 3306 return libvlc_media_list_player_set_playback_mode(self, e_mode)
3307
3308 -class MediaPlayer(_Ctype):
3309 '''Create a new MediaPlayer instance. 3310 3311 It may take as parameter either: 3312 - a string (media URI), options... In this case, a vlc.Instance will be created. 3313 - a vlc.Instance, a string (media URI), options... 3314 3315 ''' 3316
3317 - def __new__(cls, *args):
3318 if len(args) == 1 and isinstance(args[0], _Ints): 3319 return _Constructor(cls, args[0]) 3320 3321 if args and isinstance(args[0], Instance): 3322 instance = args[0] 3323 args = args[1:] 3324 else: 3325 instance = get_default_instance() 3326 3327 o = instance.media_player_new() 3328 if args: 3329 o.set_media(instance.media_new(*args)) 3330 return o
3331
3332 - def get_instance(self):
3333 """Return the associated Instance. 3334 """ 3335 return self._instance #PYCHOK expected
3336
3337 - def set_mrl(self, mrl, *options):
3338 """Set the MRL to play. 3339 3340 Warning: most audio and video options, such as text renderer, 3341 have no effects on an individual media. These options must be 3342 set at the vlc.Instance or vlc.MediaPlayer instanciation. 3343 3344 @param mrl: The MRL 3345 @param options: optional media option=value strings 3346 @return: the Media object 3347 """ 3348 m = self.get_instance().media_new(mrl, *options) 3349 self.set_media(m) 3350 return m
3351
3352 - def video_get_spu_description(self):
3353 """Get the description of available video subtitles. 3354 """ 3355 return track_description_list(libvlc_video_get_spu_description(self))
3356
3358 """Get the description of available video tracks. 3359 """ 3360 return track_description_list(libvlc_video_get_track_description(self))
3361
3363 """Get the description of available audio tracks. 3364 """ 3365 return track_description_list(libvlc_audio_get_track_description(self))
3366
3368 '''Get the full description of available titles. 3369 @return: the titles list 3370 @version: LibVLC 3.0.0 and later. 3371 ''' 3372 titleDescription_pp = ctypes.POINTER(TitleDescription)() 3373 n = libvlc_media_player_get_full_title_descriptions(self, ctypes.byref(titleDescription_pp)) 3374 info = ctypes.cast(titleDescription_pp, ctypes.POINTER(ctypes.POINTER(TitleDescription) * n)) 3375 try: 3376 contents = info.contents 3377 except ValueError: 3378 # Media not parsed, no info. 3379 return None 3380 descr = ( contents[i].contents for i in range(len(contents)) ) 3381 return descr
3382
3383 - def get_full_chapter_descriptions(self, i_chapters_of_title):
3384 '''Get the full description of available chapters. 3385 @param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1). 3386 @return: the chapters list 3387 @version: LibVLC 3.0.0 and later. 3388 ''' 3389 chapterDescription_pp = ctypes.POINTER(ChapterDescription)() 3390 n = libvlc_media_player_get_full_chapter_descriptions(self, ctypes.byref(chapterDescription_pp)) 3391 info = ctypes.cast(chapterDescription_pp, ctypes.POINTER(ctypes.POINTER(ChapterDescription) * n)) 3392 try: 3393 contents = info.contents 3394 except ValueError: 3395 # Media not parsed, no info. 3396 return None 3397 descr = ( contents[i].contents for i in range(len(contents)) ) 3398 return descr
3399
3400 - def video_get_size(self, num=0):
3401 """Get the video size in pixels as 2-tuple (width, height). 3402 3403 @param num: video number (default 0). 3404 """ 3405 r = libvlc_video_get_size(self, num) 3406 if isinstance(r, tuple) and len(r) == 2: 3407 return r 3408 else: 3409 raise VLCException('invalid video number (%s)' % (num,))
3410
3411 - def set_hwnd(self, drawable):
3412 """Set a Win32/Win64 API window handle (HWND). 3413 3414 Specify where the media player should render its video 3415 output. If LibVLC was built without Win32/Win64 API output 3416 support, then this has no effects. 3417 3418 @param drawable: windows handle of the drawable. 3419 """ 3420 if not isinstance(drawable, ctypes.c_void_p): 3421 drawable = ctypes.c_void_p(int(drawable)) 3422 libvlc_media_player_set_hwnd(self, drawable)
3423
3424 - def video_get_width(self, num=0):
3425 """Get the width of a video in pixels. 3426 3427 @param num: video number (default 0). 3428 """ 3429 return self.video_get_size(num)[0]
3430
3431 - def video_get_height(self, num=0):
3432 """Get the height of a video in pixels. 3433 3434 @param num: video number (default 0). 3435 """ 3436 return self.video_get_size(num)[1]
3437
3438 - def video_get_cursor(self, num=0):
3439 """Get the mouse pointer coordinates over a video as 2-tuple (x, y). 3440 3441 Coordinates are expressed in terms of the decoded video resolution, 3442 B{not} in terms of pixels on the screen/viewport. To get the 3443 latter, you must query your windowing system directly. 3444 3445 Either coordinate may be negative or larger than the corresponding 3446 size of the video, if the cursor is outside the rendering area. 3447 3448 @warning: The coordinates may be out-of-date if the pointer is not 3449 located on the video rendering area. LibVLC does not track the 3450 mouse pointer if the latter is outside the video widget. 3451 3452 @note: LibVLC does not support multiple mouse pointers (but does 3453 support multiple input devices sharing the same pointer). 3454 3455 @param num: video number (default 0). 3456 """ 3457 r = libvlc_video_get_cursor(self, num) 3458 if isinstance(r, tuple) and len(r) == 2: 3459 return r 3460 raise VLCException('invalid video number (%s)' % (num,))
3461 3462 3463
3464 - def get_fps(self):
3465 '''Get movie fps rate 3466 This function is provided for backward compatibility. It cannot deal with 3467 multiple video tracks. In LibVLC versions prior to 3.0, it would also fail 3468 if the file format did not convey the frame rate explicitly. 3469 \deprecated Consider using L{media_tracks_get}() instead. 3470 @return: frames per second (fps) for this playing movie, or 0 if unspecified. 3471 ''' 3472 return libvlc_media_player_get_fps(self)
3473 3474
3475 - def set_agl(self, drawable):
3476 '''\deprecated Use L{set_nsobject}() instead. 3477 ''' 3478 return libvlc_media_player_set_agl(self, drawable)
3479 3480
3481 - def get_agl(self):
3482 '''\deprecated Use L{get_nsobject}() instead. 3483 ''' 3484 return libvlc_media_player_get_agl(self)
3485 3486
3488 '''Get the description of available titles. 3489 @return: list containing description of available titles. It must be freed with L{track_description_list_release}(). 3490 ''' 3491 return libvlc_video_get_title_description(self)
3492 3493
3494 - def video_get_chapter_description(self, i_title):
3495 '''Get the description of available chapters for specific title. 3496 @param i_title: selected title. 3497 @return: list containing description of available chapter for title i_title. It must be freed with L{track_description_list_release}(). 3498 ''' 3499 return libvlc_video_get_chapter_description(self, i_title)
3500 3501
3502 - def video_set_subtitle_file(self, psz_subtitle):
3503 '''Set new video subtitle file. 3504 \deprecated Use L{add_slave}() instead. 3505 @param psz_subtitle: new video subtitle file. 3506 @return: the success status (boolean). 3507 ''' 3508 return libvlc_video_set_subtitle_file(self, str_to_bytes(psz_subtitle))
3509 3510
3511 - def toggle_teletext(self):
3512 '''Toggle teletext transparent status on video output. 3513 \deprecated use L{video_set_teletext}() instead. 3514 ''' 3515 return libvlc_toggle_teletext(self)
3516 3517
3518 - def release(self):
3519 '''Release a media_player after use 3520 Decrement the reference count of a media player object. If the 3521 reference count is 0, then L{release}() will 3522 release the media player object. If the media player object 3523 has been released, then it should not be used again. 3524 ''' 3525 return libvlc_media_player_release(self)
3526 3527
3528 - def retain(self):
3529 '''Retain a reference to a media player object. Use 3530 L{release}() to decrement reference count. 3531 ''' 3532 return libvlc_media_player_retain(self)
3533 3534
3535 - def set_media(self, p_md):
3536 '''Set the media that will be used by the media_player. If any, 3537 previous md will be released. 3538 @param p_md: the Media. Afterwards the p_md can be safely destroyed. 3539 ''' 3540 return libvlc_media_player_set_media(self, p_md)
3541 3542
3543 - def get_media(self):
3544 '''Get the media used by the media_player. 3545 @return: the media associated with p_mi, or None if no media is associated. 3546 ''' 3547 return libvlc_media_player_get_media(self)
3548 3549 @memoize_parameterless
3550 - def event_manager(self):
3551 '''Get the Event Manager from which the media player send event. 3552 @return: the event manager associated with p_mi. 3553 ''' 3554 return libvlc_media_player_event_manager(self)
3555 3556
3557 - def is_playing(self):
3558 '''is_playing. 3559 @return: 1 if the media player is playing, 0 otherwise \libvlc_return_bool. 3560 ''' 3561 return libvlc_media_player_is_playing(self)
3562 3563
3564 - def play(self):
3565 '''Play. 3566 @return: 0 if playback started (and was already started), or -1 on error. 3567 ''' 3568 return libvlc_media_player_play(self)
3569 3570
3571 - def set_pause(self, do_pause):
3572 '''Pause or resume (no effect if there is no media). 3573 @param do_pause: play/resume if zero, pause if non-zero. 3574 @version: LibVLC 1.1.1 or later. 3575 ''' 3576 return libvlc_media_player_set_pause(self, do_pause)
3577 3578
3579 - def pause(self):
3580 '''Toggle pause (no effect if there is no media). 3581 ''' 3582 return libvlc_media_player_pause(self)
3583 3584
3585 - def stop(self):
3586 '''Stop (no effect if there is no media). 3587 ''' 3588 return libvlc_media_player_stop(self)
3589 3590
3591 - def set_renderer(self, p_item):
3592 '''Set a renderer to the media player 3593 @note: must be called before the first call of L{play}() to 3594 take effect. 3595 See L{renderer_discoverer_new}. 3596 @param p_item: an item discovered by L{renderer_discoverer_start}(). 3597 @return: 0 on success, -1 on error. 3598 @version: LibVLC 3.0.0 or later. 3599 ''' 3600 return libvlc_media_player_set_renderer(self, p_item)
3601 3602
3603 - def video_set_callbacks(self, lock, unlock, display, opaque):
3604 '''Set callbacks and private data to render decoded video to a custom area 3605 in memory. 3606 Use L{video_set_format}() or L{video_set_format_callbacks}() 3607 to configure the decoded format. 3608 @warning: Rendering video into custom memory buffers is considerably less 3609 efficient than rendering in a custom window as normal. 3610 For optimal perfomances, VLC media player renders into a custom window, and 3611 does not use this function and associated callbacks. It is B{highly 3612 recommended} that other LibVLC-based application do likewise. 3613 To embed video in a window, use libvlc_media_player_set_xid() or equivalent 3614 depending on the operating system. 3615 If window embedding does not fit the application use case, then a custom 3616 LibVLC video output display plugin is required to maintain optimal video 3617 rendering performances. 3618 The following limitations affect performance: 3619 - Hardware video decoding acceleration will either be disabled completely, 3620 or require (relatively slow) copy from video/DSP memory to main memory. 3621 - Sub-pictures (subtitles, on-screen display, etc.) must be blent into the 3622 main picture by the CPU instead of the GPU. 3623 - Depending on the video format, pixel format conversion, picture scaling, 3624 cropping and/or picture re-orientation, must be performed by the CPU 3625 instead of the GPU. 3626 - Memory copying is required between LibVLC reference picture buffers and 3627 application buffers (between lock and unlock callbacks). 3628 @param lock: callback to lock video memory (must not be None). 3629 @param unlock: callback to unlock video memory (or None if not needed). 3630 @param display: callback to display video (or None if not needed). 3631 @param opaque: private pointer for the three callbacks (as first parameter). 3632 @version: LibVLC 1.1.1 or later. 3633 ''' 3634 return libvlc_video_set_callbacks(self, lock, unlock, display, opaque)
3635 3636
3637 - def video_set_format(self, chroma, width, height, pitch):
3638 '''Set decoded video chroma and dimensions. 3639 This only works in combination with L{video_set_callbacks}(), 3640 and is mutually exclusive with L{video_set_format_callbacks}(). 3641 @param chroma: a four-characters string identifying the chroma (e.g. "RV32" or "YUYV"). 3642 @param width: pixel width. 3643 @param height: pixel height. 3644 @param pitch: line pitch (in bytes). 3645 @version: LibVLC 1.1.1 or later. 3646 @bug: All pixel planes are expected to have the same pitch. To use the YCbCr color space with chrominance subsampling, consider using L{video_set_format_callbacks}() instead. 3647 ''' 3648 return libvlc_video_set_format(self, str_to_bytes(chroma), width, height, pitch)
3649 3650
3651 - def video_set_format_callbacks(self, setup, cleanup):
3652 '''Set decoded video chroma and dimensions. This only works in combination with 3653 L{video_set_callbacks}(). 3654 @param setup: callback to select the video format (cannot be None). 3655 @param cleanup: callback to release any allocated resources (or None). 3656 @version: LibVLC 2.0.0 or later. 3657 ''' 3658 return libvlc_video_set_format_callbacks(self, setup, cleanup)
3659 3660
3661 - def set_nsobject(self, drawable):
3662 '''Set the NSView handler where the media player should render its video output. 3663 Use the vout called "macosx". 3664 The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding 3665 protocol: 3666 @code.m 3667 \@protocol VLCOpenGLVideoViewEmbedding <NSObject> 3668 - (void)addVoutSubview:(NSView *)view; 3669 - (void)removeVoutSubview:(NSView *)view; 3670 \@end 3671 @endcode 3672 Or it can be an NSView object. 3673 If you want to use it along with Qt see the QMacCocoaViewContainer. Then 3674 the following code should work: 3675 @code.mm 3676 3677 NSView *video = [[NSView alloc] init]; 3678 QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent); 3679 L{set_nsobject}(mp, video); 3680 [video release]; 3681 3682 @endcode 3683 You can find a live example in VLCVideoView in VLCKit.framework. 3684 @param drawable: the drawable that is either an NSView or an object following the VLCOpenGLVideoViewEmbedding protocol. 3685 ''' 3686 return libvlc_media_player_set_nsobject(self, drawable)
3687 3688
3689 - def get_nsobject(self):
3690 '''Get the NSView handler previously set with L{set_nsobject}(). 3691 @return: the NSView handler or 0 if none where set. 3692 ''' 3693 return libvlc_media_player_get_nsobject(self)
3694 3695
3696 - def set_xwindow(self, drawable):
3697 '''Set an X Window System drawable where the media player should render its 3698 video output. The call takes effect when the playback starts. If it is 3699 already started, it might need to be stopped before changes apply. 3700 If LibVLC was built without X11 output support, then this function has no 3701 effects. 3702 By default, LibVLC will capture input events on the video rendering area. 3703 Use L{video_set_mouse_input}() and L{video_set_key_input}() to 3704 disable that and deliver events to the parent window / to the application 3705 instead. By design, the X11 protocol delivers input events to only one 3706 recipient. 3707 @warning 3708 The application must call the XInitThreads() function from Xlib before 3709 L{new}(), and before any call to XOpenDisplay() directly or via any 3710 other library. Failure to call XInitThreads() will seriously impede LibVLC 3711 performance. Calling XOpenDisplay() before XInitThreads() will eventually 3712 crash the process. That is a limitation of Xlib. 3713 @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. 3714 @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. 3715 ''' 3716 return libvlc_media_player_set_xwindow(self, drawable)
3717 3718
3719 - def get_xwindow(self):
3720 '''Get the X Window System window identifier previously set with 3721 L{set_xwindow}(). Note that this will return the identifier 3722 even if VLC is not currently using it (for instance if it is playing an 3723 audio-only input). 3724 @return: an X window ID, or 0 if none where set. 3725 ''' 3726 return libvlc_media_player_get_xwindow(self)
3727 3728
3729 - def get_hwnd(self):
3730 '''Get the Windows API window handle (HWND) previously set with 3731 L{set_hwnd}(). The handle will be returned even if LibVLC 3732 is not currently outputting any video to it. 3733 @return: a window handle or None if there are none. 3734 ''' 3735 return libvlc_media_player_get_hwnd(self)
3736 3737
3738 - def set_android_context(self, p_awindow_handler):
3739 '''Set the android context. 3740 @param p_awindow_handler: org.videolan.libvlc.AWindow jobject owned by the org.videolan.libvlc.MediaPlayer class from the libvlc-android project. 3741 @version: LibVLC 3.0.0 and later. 3742 ''' 3743 return libvlc_media_player_set_android_context(self, p_awindow_handler)
3744 3745
3746 - def set_evas_object(self, p_evas_object):
3747 '''Set the EFL Evas Object. 3748 @param p_evas_object: a valid EFL Evas Object (Evas_Object). 3749 @return: -1 if an error was detected, 0 otherwise. 3750 @version: LibVLC 3.0.0 and later. 3751 ''' 3752 return libvlc_media_player_set_evas_object(self, p_evas_object)
3753 3754
3755 - def audio_set_callbacks(self, play, pause, resume, flush, drain, opaque):
3756 '''Sets callbacks and private data for decoded audio. 3757 Use L{audio_set_format}() or L{audio_set_format_callbacks}() 3758 to configure the decoded audio format. 3759 @note: The audio callbacks override any other audio output mechanism. 3760 If the callbacks are set, LibVLC will B{not} output audio in any way. 3761 @param play: callback to play audio samples (must not be None). 3762 @param pause: callback to pause playback (or None to ignore). 3763 @param resume: callback to resume playback (or None to ignore). 3764 @param flush: callback to flush audio buffers (or None to ignore). 3765 @param drain: callback to drain audio buffers (or None to ignore). 3766 @param opaque: private pointer for the audio callbacks (as first parameter). 3767 @version: LibVLC 2.0.0 or later. 3768 ''' 3769 return libvlc_audio_set_callbacks(self, play, pause, resume, flush, drain, opaque)
3770 3771
3772 - def audio_set_volume_callback(self, set_volume):
3773 '''Set callbacks and private data for decoded audio. This only works in 3774 combination with L{audio_set_callbacks}(). 3775 Use L{audio_set_format}() or L{audio_set_format_callbacks}() 3776 to configure the decoded audio format. 3777 @param set_volume: callback to apply audio volume, or None to apply volume in software. 3778 @version: LibVLC 2.0.0 or later. 3779 ''' 3780 return libvlc_audio_set_volume_callback(self, set_volume)
3781 3782
3783 - def audio_set_format_callbacks(self, setup, cleanup):
3784 '''Sets decoded audio format via callbacks. 3785 This only works in combination with L{audio_set_callbacks}(). 3786 @param setup: callback to select the audio format (cannot be None). 3787 @param cleanup: callback to release any allocated resources (or None). 3788 @version: LibVLC 2.0.0 or later. 3789 ''' 3790 return libvlc_audio_set_format_callbacks(self, setup, cleanup)
3791 3792
3793 - def audio_set_format(self, format, rate, channels):
3794 '''Sets a fixed decoded audio format. 3795 This only works in combination with L{audio_set_callbacks}(), 3796 and is mutually exclusive with L{audio_set_format_callbacks}(). 3797 @param format: a four-characters string identifying the sample format (e.g. "S16N" or "f32l"). 3798 @param rate: sample rate (expressed in Hz). 3799 @param channels: channels count. 3800 @version: LibVLC 2.0.0 or later. 3801 ''' 3802 return libvlc_audio_set_format(self, str_to_bytes(format), rate, channels)
3803 3804
3805 - def get_length(self):
3806 '''Get the current movie length (in ms). 3807 @return: the movie length (in ms), or -1 if there is no media. 3808 ''' 3809 return libvlc_media_player_get_length(self)
3810 3811
3812 - def get_time(self):
3813 '''Get the current movie time (in ms). 3814 @return: the movie time (in ms), or -1 if there is no media. 3815 ''' 3816 return libvlc_media_player_get_time(self)
3817 3818
3819 - def set_time(self, i_time):
3820 '''Set the movie time (in ms). This has no effect if no media is being played. 3821 Not all formats and protocols support this. 3822 @param i_time: the movie time (in ms). 3823 ''' 3824 return libvlc_media_player_set_time(self, i_time)
3825 3826
3827 - def get_position(self):
3828 '''Get movie position as percentage between 0.0 and 1.0. 3829 @return: movie position, or -1. in case of error. 3830 ''' 3831 return libvlc_media_player_get_position(self)
3832 3833
3834 - def set_position(self, f_pos):
3835 '''Set movie position as percentage between 0.0 and 1.0. 3836 This has no effect if playback is not enabled. 3837 This might not work depending on the underlying input format and protocol. 3838 @param f_pos: the position. 3839 ''' 3840 return libvlc_media_player_set_position(self, f_pos)
3841 3842
3843 - def set_chapter(self, i_chapter):
3844 '''Set movie chapter (if applicable). 3845 @param i_chapter: chapter number to play. 3846 ''' 3847 return libvlc_media_player_set_chapter(self, i_chapter)
3848 3849
3850 - def get_chapter(self):
3851 '''Get movie chapter. 3852 @return: chapter number currently playing, or -1 if there is no media. 3853 ''' 3854 return libvlc_media_player_get_chapter(self)
3855 3856
3857 - def get_chapter_count(self):
3858 '''Get movie chapter count. 3859 @return: number of chapters in movie, or -1. 3860 ''' 3861 return libvlc_media_player_get_chapter_count(self)
3862 3863
3864 - def will_play(self):
3865 '''Is the player able to play. 3866 @return: boolean \libvlc_return_bool. 3867 ''' 3868 return libvlc_media_player_will_play(self)
3869 3870
3871 - def get_chapter_count_for_title(self, i_title):
3872 '''Get title chapter count. 3873 @param i_title: title. 3874 @return: number of chapters in title, or -1. 3875 ''' 3876 return libvlc_media_player_get_chapter_count_for_title(self, i_title)
3877 3878
3879 - def set_title(self, i_title):
3880 '''Set movie title. 3881 @param i_title: title number to play. 3882 ''' 3883 return libvlc_media_player_set_title(self, i_title)
3884 3885
3886 - def get_title(self):
3887 '''Get movie title. 3888 @return: title number currently playing, or -1. 3889 ''' 3890 return libvlc_media_player_get_title(self)
3891 3892
3893 - def get_title_count(self):
3894 '''Get movie title count. 3895 @return: title number count, or -1. 3896 ''' 3897 return libvlc_media_player_get_title_count(self)
3898 3899
3900 - def previous_chapter(self):
3901 '''Set previous chapter (if applicable). 3902 ''' 3903 return libvlc_media_player_previous_chapter(self)
3904 3905
3906 - def next_chapter(self):
3907 '''Set next chapter (if applicable). 3908 ''' 3909 return libvlc_media_player_next_chapter(self)
3910 3911
3912 - def get_rate(self):
3913 '''Get the requested movie play rate. 3914 @warning: Depending on the underlying media, the requested rate may be 3915 different from the real playback rate. 3916 @return: movie play rate. 3917 ''' 3918 return libvlc_media_player_get_rate(self)
3919 3920
3921 - def set_rate(self, rate):
3922 '''Set movie play rate. 3923 @param rate: movie play rate to set. 3924 @return: -1 if an error was detected, 0 otherwise (but even then, it might not actually work depending on the underlying media protocol). 3925 ''' 3926 return libvlc_media_player_set_rate(self, rate)
3927 3928
3929 - def get_state(self):
3930 '''Get current movie state. 3931 @return: the current state of the media player (playing, paused, ...) See L{State}. 3932 ''' 3933 return libvlc_media_player_get_state(self)
3934 3935
3936 - def has_vout(self):
3937 '''How many video outputs does this media player have? 3938 @return: the number of video outputs. 3939 ''' 3940 return libvlc_media_player_has_vout(self)
3941 3942
3943 - def is_seekable(self):
3944 '''Is this media player seekable? 3945 @return: true if the media player can seek \libvlc_return_bool. 3946 ''' 3947 return libvlc_media_player_is_seekable(self)
3948 3949
3950 - def can_pause(self):
3951 '''Can this media player be paused? 3952 @return: true if the media player can pause \libvlc_return_bool. 3953 ''' 3954 return libvlc_media_player_can_pause(self)
3955 3956
3957 - def program_scrambled(self):
3958 '''Check if the current program is scrambled. 3959 @return: true if the current program is scrambled \libvlc_return_bool. 3960 @version: LibVLC 2.2.0 or later. 3961 ''' 3962 return libvlc_media_player_program_scrambled(self)
3963 3964
3965 - def next_frame(self):
3966 '''Display the next frame (if supported). 3967 ''' 3968 return libvlc_media_player_next_frame(self)
3969 3970
3971 - def navigate(self, navigate):
3972 '''Navigate through DVD Menu. 3973 @param navigate: the Navigation mode. 3974 @version: libVLC 2.0.0 or later. 3975 ''' 3976 return libvlc_media_player_navigate(self, navigate)
3977 3978
3979 - def set_video_title_display(self, position, timeout):
3980 '''Set if, and how, the video title will be shown when media is played. 3981 @param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed. 3982 @param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable). 3983 @version: libVLC 2.1.0 or later. 3984 ''' 3985 return libvlc_media_player_set_video_title_display(self, position, timeout)
3986 3987
3988 - def add_slave(self, i_type, psz_uri, b_select):
3989 '''Add a slave to the current media player. 3990 @note: If the player is playing, the slave will be added directly. This call 3991 will also update the slave list of the attached L{Media}. 3992 @param i_type: subtitle or audio. 3993 @param psz_uri: Uri of the slave (should contain a valid scheme). 3994 @param b_select: True if this slave should be selected when it's loaded. 3995 @return: 0 on success, -1 on error. 3996 @version: LibVLC 3.0.0 and later. See L{media_slaves_add}. 3997 ''' 3998 return libvlc_media_player_add_slave(self, i_type, str_to_bytes(psz_uri), b_select)
3999 4000
4001 - def toggle_fullscreen(self):
4002 '''Toggle fullscreen status on non-embedded video outputs. 4003 @warning: The same limitations applies to this function 4004 as to L{set_fullscreen}(). 4005 ''' 4006 return libvlc_toggle_fullscreen(self)
4007 4008
4009 - def set_fullscreen(self, b_fullscreen):
4010 '''Enable or disable fullscreen. 4011 @warning: With most window managers, only a top-level windows can be in 4012 full-screen mode. Hence, this function will not operate properly if 4013 L{set_xwindow}() was used to embed the video in a 4014 non-top-level window. In that case, the embedding window must be reparented 4015 to the root window B{before} fullscreen mode is enabled. You will want 4016 to reparent it back to its normal parent when disabling fullscreen. 4017 @param b_fullscreen: boolean for fullscreen status. 4018 ''' 4019 return libvlc_set_fullscreen(self, b_fullscreen)
4020 4021
4022 - def get_fullscreen(self):
4023 '''Get current fullscreen status. 4024 @return: the fullscreen status (boolean) \libvlc_return_bool. 4025 ''' 4026 return libvlc_get_fullscreen(self)
4027 4028
4029 - def video_set_key_input(self, on):
4030 '''Enable or disable key press events handling, according to the LibVLC hotkeys 4031 configuration. By default and for historical reasons, keyboard events are 4032 handled by the LibVLC video widget. 4033 @note: On X11, there can be only one subscriber for key press and mouse 4034 click events per window. If your application has subscribed to those events 4035 for the X window ID of the video widget, then LibVLC will not be able to 4036 handle key presses and mouse clicks in any case. 4037 @warning: This function is only implemented for X11 and Win32 at the moment. 4038 @param on: true to handle key press events, false to ignore them. 4039 ''' 4040 return libvlc_video_set_key_input(self, on)
4041 4042
4043 - def video_set_mouse_input(self, on):
4044 '''Enable or disable mouse click events handling. By default, those events are 4045 handled. This is needed for DVD menus to work, as well as a few video 4046 filters such as "puzzle". 4047 See L{video_set_key_input}(). 4048 @warning: This function is only implemented for X11 and Win32 at the moment. 4049 @param on: true to handle mouse click events, false to ignore them. 4050 ''' 4051 return libvlc_video_set_mouse_input(self, on)
4052 4053
4054 - def video_get_scale(self):
4055 '''Get the current video scaling factor. 4056 See also L{video_set_scale}(). 4057 @return: the currently configured zoom factor, or 0. if the video is set to fit to the output window/drawable automatically. 4058 ''' 4059 return libvlc_video_get_scale(self)
4060 4061
4062 - def video_set_scale(self, f_factor):
4063 '''Set the video scaling factor. That is the ratio of the number of pixels on 4064 screen to the number of pixels in the original decoded video in each 4065 dimension. Zero is a special value; it will adjust the video to the output 4066 window/drawable (in windowed mode) or the entire screen. 4067 Note that not all video outputs support scaling. 4068 @param f_factor: the scaling factor, or zero. 4069 ''' 4070 return libvlc_video_set_scale(self, f_factor)
4071 4072
4073 - def video_get_aspect_ratio(self):
4074 '''Get current video aspect ratio. 4075 @return: the video aspect ratio or None if unspecified (the result must be released with free() or L{free}()). 4076 ''' 4077 return libvlc_video_get_aspect_ratio(self)
4078 4079
4080 - def video_set_aspect_ratio(self, psz_aspect):
4081 '''Set new video aspect ratio. 4082 @param psz_aspect: new video aspect-ratio or None to reset to default @note Invalid aspect ratios are ignored. 4083 ''' 4084 return libvlc_video_set_aspect_ratio(self, str_to_bytes(psz_aspect))
4085 4086
4087 - def video_update_viewpoint(self, p_viewpoint, b_absolute):
4088 '''Update the video viewpoint information. 4089 @note: It is safe to call this function before the media player is started. 4090 @param p_viewpoint: video viewpoint allocated via L{video_new_viewpoint}(). 4091 @param b_absolute: if true replace the old viewpoint with the new one. If false, increase/decrease it. 4092 @return: -1 in case of error, 0 otherwise @note the values are set asynchronously, it will be used by the next frame displayed. 4093 @version: LibVLC 3.0.0 and later. 4094 ''' 4095 return libvlc_video_update_viewpoint(self, p_viewpoint, b_absolute)
4096 4097
4098 - def video_get_spu(self):
4099 '''Get current video subtitle. 4100 @return: the video subtitle selected, or -1 if none. 4101 ''' 4102 return libvlc_video_get_spu(self)
4103 4104
4105 - def video_get_spu_count(self):
4106 '''Get the number of available video subtitles. 4107 @return: the number of available video subtitles. 4108 ''' 4109 return libvlc_video_get_spu_count(self)
4110 4111
4112 - def video_set_spu(self, i_spu):
4113 '''Set new video subtitle. 4114 @param i_spu: video subtitle track to select (i_id from track description). 4115 @return: 0 on success, -1 if out of range. 4116 ''' 4117 return libvlc_video_set_spu(self, i_spu)
4118 4119
4120 - def video_get_spu_delay(self):
4121 '''Get the current subtitle delay. Positive values means subtitles are being 4122 displayed later, negative values earlier. 4123 @return: time (in microseconds) the display of subtitles is being delayed. 4124 @version: LibVLC 2.0.0 or later. 4125 ''' 4126 return libvlc_video_get_spu_delay(self)
4127 4128
4129 - def video_set_spu_delay(self, i_delay):
4130 '''Set the subtitle delay. This affects the timing of when the subtitle will 4131 be displayed. Positive values result in subtitles being displayed later, 4132 while negative values will result in subtitles being displayed earlier. 4133 The subtitle delay will be reset to zero each time the media changes. 4134 @param i_delay: time (in microseconds) the display of subtitles should be delayed. 4135 @return: 0 on success, -1 on error. 4136 @version: LibVLC 2.0.0 or later. 4137 ''' 4138 return libvlc_video_set_spu_delay(self, i_delay)
4139 4140
4141 - def video_get_crop_geometry(self):
4142 '''Get current crop filter geometry. 4143 @return: the crop filter geometry or None if unset. 4144 ''' 4145 return libvlc_video_get_crop_geometry(self)
4146 4147
4148 - def video_set_crop_geometry(self, psz_geometry):
4149 '''Set new crop filter geometry. 4150 @param psz_geometry: new crop filter geometry (None to unset). 4151 ''' 4152 return libvlc_video_set_crop_geometry(self, str_to_bytes(psz_geometry))
4153 4154
4155 - def video_get_teletext(self):
4156 '''Get current teletext page requested or 0 if it's disabled. 4157 Teletext is disabled by default, call L{video_set_teletext}() to enable 4158 it. 4159 @return: the current teletext page requested. 4160 ''' 4161 return libvlc_video_get_teletext(self)
4162 4163
4164 - def video_set_teletext(self, i_page):
4165 '''Set new teletext page to retrieve. 4166 This function can also be used to send a teletext key. 4167 @param i_page: teletex page number requested. This value can be 0 to disable teletext, a number in the range ]0;1000[ to show the requested page, or a \ref L{TeletextKey}. 100 is the default teletext page. 4168 ''' 4169 return libvlc_video_set_teletext(self, i_page)
4170 4171
4172 - def video_get_track_count(self):
4173 '''Get number of available video tracks. 4174 @return: the number of available video tracks (int). 4175 ''' 4176 return libvlc_video_get_track_count(self)
4177 4178
4179 - def video_get_track(self):
4180 '''Get current video track. 4181 @return: the video track ID (int) or -1 if no active input. 4182 ''' 4183 return libvlc_video_get_track(self)
4184 4185
4186 - def video_set_track(self, i_track):
4187 '''Set video track. 4188 @param i_track: the track ID (i_id field from track description). 4189 @return: 0 on success, -1 if out of range. 4190 ''' 4191 return libvlc_video_set_track(self, i_track)
4192 4193
4194 - def video_take_snapshot(self, num, psz_filepath, i_width, i_height):
4195 '''Take a snapshot of the current video window. 4196 If i_width AND i_height is 0, original size is used. 4197 If i_width XOR i_height is 0, original aspect-ratio is preserved. 4198 @param num: number of video output (typically 0 for the first/only one). 4199 @param psz_filepath: the path of a file or a folder to save the screenshot into. 4200 @param i_width: the snapshot's width. 4201 @param i_height: the snapshot's height. 4202 @return: 0 on success, -1 if the video was not found. 4203 ''' 4204 return libvlc_video_take_snapshot(self, num, str_to_bytes(psz_filepath), i_width, i_height)
4205 4206
4207 - def video_set_deinterlace(self, psz_mode):
4208 '''Enable or disable deinterlace filter. 4209 @param psz_mode: type of deinterlace filter, None to disable. 4210 ''' 4211 return libvlc_video_set_deinterlace(self, str_to_bytes(psz_mode))
4212 4213
4214 - def video_get_marquee_int(self, option):
4215 '''Get an integer marquee option value. 4216 @param option: marq option to get See libvlc_video_marquee_int_option_t. 4217 ''' 4218 return libvlc_video_get_marquee_int(self, option)
4219 4220
4221 - def video_get_marquee_string(self, option):
4222 '''Get a string marquee option value. 4223 @param option: marq option to get See libvlc_video_marquee_string_option_t. 4224 ''' 4225 return libvlc_video_get_marquee_string(self, option)
4226 4227
4228 - def video_set_marquee_int(self, option, i_val):
4229 '''Enable, disable or set an integer marquee option 4230 Setting libvlc_marquee_Enable has the side effect of enabling (arg !0) 4231 or disabling (arg 0) the marq filter. 4232 @param option: marq option to set See libvlc_video_marquee_int_option_t. 4233 @param i_val: marq option value. 4234 ''' 4235 return libvlc_video_set_marquee_int(self, option, i_val)
4236 4237
4238 - def video_set_marquee_string(self, option, psz_text):
4239 '''Set a marquee string option. 4240 @param option: marq option to set See libvlc_video_marquee_string_option_t. 4241 @param psz_text: marq option value. 4242 ''' 4243 return libvlc_video_set_marquee_string(self, option, str_to_bytes(psz_text))
4244 4245
4246 - def video_get_logo_int(self, option):
4247 '''Get integer logo option. 4248 @param option: logo option to get, values of L{VideoLogoOption}. 4249 ''' 4250 return libvlc_video_get_logo_int(self, option)
4251 4252
4253 - def video_set_logo_int(self, option, value):
4254 '''Set logo option as integer. Options that take a different type value 4255 are ignored. 4256 Passing libvlc_logo_enable as option value has the side effect of 4257 starting (arg !0) or stopping (arg 0) the logo filter. 4258 @param option: logo option to set, values of L{VideoLogoOption}. 4259 @param value: logo option value. 4260 ''' 4261 return libvlc_video_set_logo_int(self, option, value)
4262 4263
4264 - def video_set_logo_string(self, option, psz_value):
4265 '''Set logo option as string. Options that take a different type value 4266 are ignored. 4267 @param option: logo option to set, values of L{VideoLogoOption}. 4268 @param psz_value: logo option value. 4269 ''' 4270 return libvlc_video_set_logo_string(self, option, str_to_bytes(psz_value))
4271 4272
4273 - def video_get_adjust_int(self, option):
4274 '''Get integer adjust option. 4275 @param option: adjust option to get, values of L{VideoAdjustOption}. 4276 @version: LibVLC 1.1.1 and later. 4277 ''' 4278 return libvlc_video_get_adjust_int(self, option)
4279 4280
4281 - def video_set_adjust_int(self, option, value):
4282 '''Set adjust option as integer. Options that take a different type value 4283 are ignored. 4284 Passing libvlc_adjust_enable as option value has the side effect of 4285 starting (arg !0) or stopping (arg 0) the adjust filter. 4286 @param option: adust option to set, values of L{VideoAdjustOption}. 4287 @param value: adjust option value. 4288 @version: LibVLC 1.1.1 and later. 4289 ''' 4290 return libvlc_video_set_adjust_int(self, option, value)
4291 4292
4293 - def video_get_adjust_float(self, option):
4294 '''Get float adjust option. 4295 @param option: adjust option to get, values of L{VideoAdjustOption}. 4296 @version: LibVLC 1.1.1 and later. 4297 ''' 4298 return libvlc_video_get_adjust_float(self, option)
4299 4300
4301 - def video_set_adjust_float(self, option, value):
4302 '''Set adjust option as float. Options that take a different type value 4303 are ignored. 4304 @param option: adust option to set, values of L{VideoAdjustOption}. 4305 @param value: adjust option value. 4306 @version: LibVLC 1.1.1 and later. 4307 ''' 4308 return libvlc_video_set_adjust_float(self, option, value)
4309 4310
4311 - def audio_output_set(self, psz_name):
4312 '''Selects an audio output module. 4313 @note: Any change will take be effect only after playback is stopped and 4314 restarted. Audio output cannot be changed while playing. 4315 @param psz_name: name of audio output, use psz_name of See L{AudioOutput}. 4316 @return: 0 if function succeeded, -1 on error. 4317 ''' 4318 return libvlc_audio_output_set(self, str_to_bytes(psz_name))
4319 4320
4321 - def audio_output_device_enum(self):
4322 '''Gets a list of potential audio output devices, 4323 See L{audio_output_device_set}(). 4324 @note: Not all audio outputs support enumerating devices. 4325 The audio output may be functional even if the list is empty (None). 4326 @note: The list may not be exhaustive. 4327 @warning: Some audio output devices in the list might not actually work in 4328 some circumstances. By default, it is recommended to not specify any 4329 explicit audio device. 4330 @return: A None-terminated linked list of potential audio output devices. It must be freed with L{audio_output_device_list_release}(). 4331 @version: LibVLC 2.2.0 or later. 4332 ''' 4333 return libvlc_audio_output_device_enum(self)
4334 4335
4336 - def audio_output_device_set(self, module, device_id):
4337 '''Configures an explicit audio output device. 4338 If the module paramater is None, audio output will be moved to the device 4339 specified by the device identifier string immediately. This is the 4340 recommended usage. 4341 A list of adequate potential device strings can be obtained with 4342 L{audio_output_device_enum}(). 4343 However passing None is supported in LibVLC version 2.2.0 and later only; 4344 in earlier versions, this function would have no effects when the module 4345 parameter was None. 4346 If the module parameter is not None, the device parameter of the 4347 corresponding audio output, if it exists, will be set to the specified 4348 string. Note that some audio output modules do not have such a parameter 4349 (notably MMDevice and PulseAudio). 4350 A list of adequate potential device strings can be obtained with 4351 L{audio_output_device_list_get}(). 4352 @note: This function does not select the specified audio output plugin. 4353 L{audio_output_set}() is used for that purpose. 4354 @warning: The syntax for the device parameter depends on the audio output. 4355 Some audio output modules require further parameters (e.g. a channels map 4356 in the case of ALSA). 4357 @param module: If None, current audio output module. if non-None, name of audio output module. 4358 @param device_id: device identifier string. 4359 @return: Nothing. Errors are ignored (this is a design bug). 4360 ''' 4361 return libvlc_audio_output_device_set(self, str_to_bytes(module), str_to_bytes(device_id))
4362 4363
4364 - def audio_output_device_get(self):
4365 '''Get the current audio output device identifier. 4366 This complements L{audio_output_device_set}(). 4367 @warning: The initial value for the current audio output device identifier 4368 may not be set or may be some unknown value. A LibVLC application should 4369 compare this value against the known device identifiers (e.g. those that 4370 were previously retrieved by a call to L{audio_output_device_enum} or 4371 L{audio_output_device_list_get}) to find the current audio output device. 4372 It is possible that the selected audio output device changes (an external 4373 change) without a call to L{audio_output_device_set}. That may make this 4374 method unsuitable to use if a LibVLC application is attempting to track 4375 dynamic audio device changes as they happen. 4376 @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}()). 4377 @version: LibVLC 3.0.0 or later. 4378 ''' 4379 return libvlc_audio_output_device_get(self)
4380 4381
4382 - def audio_toggle_mute(self):
4383 '''Toggle mute status. 4384 ''' 4385 return libvlc_audio_toggle_mute(self)
4386 4387
4388 - def audio_get_mute(self):
4389 '''Get current mute status. 4390 @return: the mute status (boolean) if defined, -1 if undefined/unapplicable. 4391 ''' 4392 return libvlc_audio_get_mute(self)
4393 4394
4395 - def audio_set_mute(self, status):
4396 '''Set mute status. 4397 @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. 4398 ''' 4399 return libvlc_audio_set_mute(self, status)
4400 4401
4402 - def audio_get_volume(self):
4403 '''Get current software audio volume. 4404 @return: the software volume in percents (0 = mute, 100 = nominal / 0dB). 4405 ''' 4406 return libvlc_audio_get_volume(self)
4407 4408
4409 - def audio_set_volume(self, i_volume):
4410 '''Set current software audio volume. 4411 @param i_volume: the volume in percents (0 = mute, 100 = 0dB). 4412 @return: 0 if the volume was set, -1 if it was out of range. 4413 ''' 4414 return libvlc_audio_set_volume(self, i_volume)
4415 4416
4417 - def audio_get_track_count(self):
4418 '''Get number of available audio tracks. 4419 @return: the number of available audio tracks (int), or -1 if unavailable. 4420 ''' 4421 return libvlc_audio_get_track_count(self)
4422 4423
4424 - def audio_get_track(self):
4425 '''Get current audio track. 4426 @return: the audio track ID or -1 if no active input. 4427 ''' 4428 return libvlc_audio_get_track(self)
4429 4430
4431 - def audio_set_track(self, i_track):
4432 '''Set current audio track. 4433 @param i_track: the track ID (i_id field from track description). 4434 @return: 0 on success, -1 on error. 4435 ''' 4436 return libvlc_audio_set_track(self, i_track)
4437 4438
4439 - def audio_get_channel(self):
4440 '''Get current audio channel. 4441 @return: the audio channel See L{AudioOutputChannel}. 4442 ''' 4443 return libvlc_audio_get_channel(self)
4444 4445
4446 - def audio_set_channel(self, channel):
4447 '''Set current audio channel. 4448 @param channel: the audio channel, See L{AudioOutputChannel}. 4449 @return: 0 on success, -1 on error. 4450 ''' 4451 return libvlc_audio_set_channel(self, channel)
4452 4453
4454 - def audio_get_delay(self):
4455 '''Get current audio delay. 4456 @return: the audio delay (microseconds). 4457 @version: LibVLC 1.1.1 or later. 4458 ''' 4459 return libvlc_audio_get_delay(self)
4460 4461
4462 - def audio_set_delay(self, i_delay):
4463 '''Set current audio delay. The audio delay will be reset to zero each time the media changes. 4464 @param i_delay: the audio delay (microseconds). 4465 @return: 0 on success, -1 on error. 4466 @version: LibVLC 1.1.1 or later. 4467 ''' 4468 return libvlc_audio_set_delay(self, i_delay)
4469 4470
4471 - def set_equalizer(self, p_equalizer):
4472 '''Apply new equalizer settings to a media player. 4473 The equalizer is first created by invoking L{audio_equalizer_new}() or 4474 L{audio_equalizer_new_from_preset}(). 4475 It is possible to apply new equalizer settings to a media player whether the media 4476 player is currently playing media or not. 4477 Invoking this method will immediately apply the new equalizer settings to the audio 4478 output of the currently playing media if there is any. 4479 If there is no currently playing media, the new equalizer settings will be applied 4480 later if and when new media is played. 4481 Equalizer settings will automatically be applied to subsequently played media. 4482 To disable the equalizer for a media player invoke this method passing None for the 4483 p_equalizer parameter. 4484 The media player does not keep a reference to the supplied equalizer so it is safe 4485 for an application to release the equalizer reference any time after this method 4486 returns. 4487 @param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player. 4488 @return: zero on success, -1 on error. 4489 @version: LibVLC 2.2.0 or later. 4490 ''' 4491 return libvlc_media_player_set_equalizer(self, p_equalizer)
4492 4493
4494 - def get_role(self):
4495 '''Gets the media role. 4496 @return: the media player role (\ref libvlc_media_player_role_t). 4497 @version: LibVLC 3.0.0 and later. 4498 ''' 4499 return libvlc_media_player_get_role(self)
4500 4501
4502 - def set_role(self, role):
4503 '''Sets the media role. 4504 @param role: the media player role (\ref libvlc_media_player_role_t). 4505 @return: 0 on success, -1 on error. 4506 ''' 4507 return libvlc_media_player_set_role(self, role)
4508
4509 -class Renderer(_Ctype):
4510 '''N/A 4511 ''' 4512
4513 - def __new__(cls, ptr=_internal_guard):
4514 '''(INTERNAL) ctypes wrapper constructor. 4515 ''' 4516 return _Constructor(cls, ptr)
4517
4518 - def hold(self):
4519 '''Hold a renderer item, i.e. creates a new reference 4520 This functions need to called from the libvlc_RendererDiscovererItemAdded 4521 callback if the libvlc user wants to use this item after. (for display or 4522 for passing it to the mediaplayer for example). 4523 @return: the current item. 4524 @version: LibVLC 3.0.0 or later. 4525 ''' 4526 return libvlc_renderer_item_hold(self)
4527 4528
4529 - def release(self):
4530 '''Releases a renderer item, i.e. decrements its reference counter. 4531 @version: LibVLC 3.0.0 or later. 4532 ''' 4533 return libvlc_renderer_item_release(self)
4534 4535
4536 - def name(self):
4537 '''Get the human readable name of a renderer item. 4538 @return: the name of the item (can't be None, must *not* be freed). 4539 @version: LibVLC 3.0.0 or later. 4540 ''' 4541 return libvlc_renderer_item_name(self)
4542 4543
4544 - def type(self):
4545 '''Get the type (not translated) of a renderer item. For now, the type can only 4546 be "chromecast" ("upnp", "airplay" may come later). 4547 @return: the type of the item (can't be None, must *not* be freed). 4548 @version: LibVLC 3.0.0 or later. 4549 ''' 4550 return libvlc_renderer_item_type(self)
4551 4552
4553 - def icon_uri(self):
4554 '''Get the icon uri of a renderer item. 4555 @return: the uri of the item's icon (can be None, must *not* be freed). 4556 @version: LibVLC 3.0.0 or later. 4557 ''' 4558 return libvlc_renderer_item_icon_uri(self)
4559 4560
4561 - def flags(self):
4562 '''Get the flags of a renderer item 4563 See LIBVLC_RENDERER_CAN_AUDIO 4564 See LIBVLC_RENDERER_CAN_VIDEO. 4565 @return: bitwise flag: capabilities of the renderer, see. 4566 @version: LibVLC 3.0.0 or later. 4567 ''' 4568 return libvlc_renderer_item_flags(self)
4569
4570 -class RendererDiscoverer(_Ctype):
4571 '''N/A 4572 ''' 4573
4574 - def __new__(cls, ptr=_internal_guard):
4575 '''(INTERNAL) ctypes wrapper constructor. 4576 ''' 4577 return _Constructor(cls, ptr)
4578
4579 - def release(self):
4580 '''Release a renderer discoverer object. 4581 @version: LibVLC 3.0.0 or later. 4582 ''' 4583 return libvlc_renderer_discoverer_release(self)
4584 4585
4586 - def start(self):
4587 '''Start renderer discovery 4588 To stop it, call L{stop}() or 4589 L{release}() directly. 4590 See L{stop}(). 4591 @return: -1 in case of error, 0 otherwise. 4592 @version: LibVLC 3.0.0 or later. 4593 ''' 4594 return libvlc_renderer_discoverer_start(self)
4595 4596
4597 - def stop(self):
4598 '''Stop renderer discovery. 4599 See L{start}(). 4600 @version: LibVLC 3.0.0 or later. 4601 ''' 4602 return libvlc_renderer_discoverer_stop(self)
4603 4604 @memoize_parameterless
4605 - def event_manager(self):
4606 '''Get the event manager of the renderer discoverer 4607 The possible events to attach are @ref libvlc_RendererDiscovererItemAdded 4608 and @ref libvlc_RendererDiscovererItemDeleted. 4609 The @ref L{Renderer} struct passed to event callbacks is owned by 4610 VLC, users should take care of holding/releasing this struct for their 4611 internal usage. 4612 See libvlc_event_t.u.renderer_discoverer_item_added.item 4613 See libvlc_event_t.u.renderer_discoverer_item_removed.item. 4614 @return: a valid event manager (can't fail). 4615 @version: LibVLC 3.0.0 or later. 4616 ''' 4617 return libvlc_renderer_discoverer_event_manager(self)
4618
4619 4620 # LibVLC __version__ functions # 4621 4622 -def libvlc_clearerr():
4623 '''Clears the LibVLC error status for the current thread. This is optional. 4624 By default, the error status is automatically overridden when a new error 4625 occurs, and destroyed when the thread exits. 4626 ''' 4627 f = _Cfunctions.get('libvlc_clearerr', None) or \ 4628 _Cfunction('libvlc_clearerr', (), None, 4629 None) 4630 return f()
4631
4632 -def libvlc_vprinterr(fmt, ap):
4633 '''Sets the LibVLC error status and message for the current thread. 4634 Any previous error is overridden. 4635 @param fmt: the format string. 4636 @param ap: the arguments. 4637 @return: a nul terminated string in any case. 4638 ''' 4639 f = _Cfunctions.get('libvlc_vprinterr', None) or \ 4640 _Cfunction('libvlc_vprinterr', ((1,), (1,),), None, 4641 ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p) 4642 return f(fmt, ap)
4643
4644 -def libvlc_new(argc, argv):
4645 '''Create and initialize a libvlc instance. 4646 This functions accept a list of "command line" arguments similar to the 4647 main(). These arguments affect the LibVLC instance default configuration. 4648 @note 4649 LibVLC may create threads. Therefore, any thread-unsafe process 4650 initialization must be performed before calling L{libvlc_new}(). In particular 4651 and where applicable: 4652 - setlocale() and textdomain(), 4653 - setenv(), unsetenv() and putenv(), 4654 - with the X11 display system, XInitThreads() 4655 (see also L{libvlc_media_player_set_xwindow}()) and 4656 - on Microsoft Windows, SetErrorMode(). 4657 - sigprocmask() shall never be invoked; pthread_sigmask() can be used. 4658 On POSIX systems, the SIGCHLD signal B{must not} be ignored, i.e. the 4659 signal handler must set to SIG_DFL or a function pointer, not SIG_IGN. 4660 Also while LibVLC is active, the wait() function shall not be called, and 4661 any call to waitpid() shall use a strictly positive value for the first 4662 parameter (i.e. the PID). Failure to follow those rules may lead to a 4663 deadlock or a busy loop. 4664 Also on POSIX systems, it is recommended that the SIGPIPE signal be blocked, 4665 even if it is not, in principles, necessary, e.g.: 4666 @code 4667 @endcode 4668 On Microsoft Windows Vista/2008, the process error mode 4669 SEM_FAILCRITICALERRORS flag B{must} be set before using LibVLC. 4670 On later versions, that is optional and unnecessary. 4671 Also on Microsoft Windows (Vista and any later version), setting the default 4672 DLL directories to SYSTEM32 exclusively is strongly recommended for 4673 security reasons: 4674 @code 4675 @endcode. 4676 @param argc: the number of arguments (should be 0). 4677 @param argv: list of arguments (should be None). 4678 @return: the libvlc instance or None in case of error. 4679 @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. 4680 ''' 4681 f = _Cfunctions.get('libvlc_new', None) or \ 4682 _Cfunction('libvlc_new', ((1,), (1,),), class_result(Instance), 4683 ctypes.c_void_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p)) 4684 return f(argc, argv)
4685
4686 -def libvlc_release(p_instance):
4687 '''Decrement the reference count of a libvlc instance, and destroy it 4688 if it reaches zero. 4689 @param p_instance: the instance to destroy. 4690 ''' 4691 f = _Cfunctions.get('libvlc_release', None) or \ 4692 _Cfunction('libvlc_release', ((1,),), None, 4693 None, Instance) 4694 return f(p_instance)
4695
4696 -def libvlc_retain(p_instance):
4697 '''Increments the reference count of a libvlc instance. 4698 The initial reference count is 1 after L{libvlc_new}() returns. 4699 @param p_instance: the instance to reference. 4700 ''' 4701 f = _Cfunctions.get('libvlc_retain', None) or \ 4702 _Cfunction('libvlc_retain', ((1,),), None, 4703 None, Instance) 4704 return f(p_instance)
4705
4706 -def libvlc_add_intf(p_instance, name):
4707 '''Try to start a user interface for the libvlc instance. 4708 @param p_instance: the instance. 4709 @param name: interface name, or None for default. 4710 @return: 0 on success, -1 on error. 4711 ''' 4712 f = _Cfunctions.get('libvlc_add_intf', None) or \ 4713 _Cfunction('libvlc_add_intf', ((1,), (1,),), None, 4714 ctypes.c_int, Instance, ctypes.c_char_p) 4715 return f(p_instance, name)
4716
4717 -def libvlc_set_user_agent(p_instance, name, http):
4718 '''Sets the application name. LibVLC passes this as the user agent string 4719 when a protocol requires it. 4720 @param p_instance: LibVLC instance. 4721 @param name: human-readable application name, e.g. "FooBar player 1.2.3". 4722 @param http: HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0". 4723 @version: LibVLC 1.1.1 or later. 4724 ''' 4725 f = _Cfunctions.get('libvlc_set_user_agent', None) or \ 4726 _Cfunction('libvlc_set_user_agent', ((1,), (1,), (1,),), None, 4727 None, Instance, ctypes.c_char_p, ctypes.c_char_p) 4728 return f(p_instance, name, http)
4729
4730 -def libvlc_set_app_id(p_instance, id, version, icon):
4731 '''Sets some meta-information about the application. 4732 See also L{libvlc_set_user_agent}(). 4733 @param p_instance: LibVLC instance. 4734 @param id: Java-style application identifier, e.g. "com.acme.foobar". 4735 @param version: application version numbers, e.g. "1.2.3". 4736 @param icon: application icon name, e.g. "foobar". 4737 @version: LibVLC 2.1.0 or later. 4738 ''' 4739 f = _Cfunctions.get('libvlc_set_app_id', None) or \ 4740 _Cfunction('libvlc_set_app_id', ((1,), (1,), (1,), (1,),), None, 4741 None, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p) 4742 return f(p_instance, id, version, icon)
4743
4744 -def libvlc_get_version():
4745 '''Retrieve libvlc version. 4746 Example: "1.1.0-git The Luggage". 4747 @return: a string containing the libvlc version. 4748 ''' 4749 f = _Cfunctions.get('libvlc_get_version', None) or \ 4750 _Cfunction('libvlc_get_version', (), None, 4751 ctypes.c_char_p) 4752 return f()
4753
4754 -def libvlc_get_compiler():
4755 '''Retrieve libvlc compiler version. 4756 Example: "gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)". 4757 @return: a string containing the libvlc compiler version. 4758 ''' 4759 f = _Cfunctions.get('libvlc_get_compiler', None) or \ 4760 _Cfunction('libvlc_get_compiler', (), None, 4761 ctypes.c_char_p) 4762 return f()
4763
4764 -def libvlc_get_changeset():
4765 '''Retrieve libvlc changeset. 4766 Example: "aa9bce0bc4". 4767 @return: a string containing the libvlc changeset. 4768 ''' 4769 f = _Cfunctions.get('libvlc_get_changeset', None) or \ 4770 _Cfunction('libvlc_get_changeset', (), None, 4771 ctypes.c_char_p) 4772 return f()
4773
4774 -def libvlc_free(ptr):
4775 '''Frees an heap allocation returned by a LibVLC function. 4776 If you know you're using the same underlying C run-time as the LibVLC 4777 implementation, then you can call ANSI C free() directly instead. 4778 @param ptr: the pointer. 4779 ''' 4780 f = _Cfunctions.get('libvlc_free', None) or \ 4781 _Cfunction('libvlc_free', ((1,),), None, 4782 None, ctypes.c_void_p) 4783 return f(ptr)
4784
4785 -def libvlc_event_attach(p_event_manager, i_event_type, f_callback, user_data):
4786 '''Register for an event notification. 4787 @param p_event_manager: the event manager to which you want to attach to. Generally it is obtained by vlc_my_object_event_manager() where my_object is the object you want to listen to. 4788 @param i_event_type: the desired event to which we want to listen. 4789 @param f_callback: the function to call when i_event_type occurs. 4790 @param user_data: user provided data to carry with the event. 4791 @return: 0 on success, ENOMEM on error. 4792 ''' 4793 f = _Cfunctions.get('libvlc_event_attach', None) or \ 4794 _Cfunction('libvlc_event_attach', ((1,), (1,), (1,), (1,),), None, 4795 ctypes.c_int, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p) 4796 return f(p_event_manager, i_event_type, f_callback, user_data)
4797
4798 -def libvlc_event_detach(p_event_manager, i_event_type, f_callback, p_user_data):
4799 '''Unregister an event notification. 4800 @param p_event_manager: the event manager. 4801 @param i_event_type: the desired event to which we want to unregister. 4802 @param f_callback: the function to call when i_event_type occurs. 4803 @param p_user_data: user provided data to carry with the event. 4804 ''' 4805 f = _Cfunctions.get('libvlc_event_detach', None) or \ 4806 _Cfunction('libvlc_event_detach', ((1,), (1,), (1,), (1,),), None, 4807 None, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p) 4808 return f(p_event_manager, i_event_type, f_callback, p_user_data)
4809
4810 -def libvlc_event_type_name(event_type):
4811 '''Get an event's type name. 4812 @param event_type: the desired event. 4813 ''' 4814 f = _Cfunctions.get('libvlc_event_type_name', None) or \ 4815 _Cfunction('libvlc_event_type_name', ((1,),), None, 4816 ctypes.c_char_p, ctypes.c_uint) 4817 return f(event_type)
4818
4819 -def libvlc_log_get_context(ctx):
4820 '''Gets log message debug infos. 4821 This function retrieves self-debug information about a log message: 4822 - the name of the VLC module emitting the message, 4823 - the name of the source code module (i.e. file) and 4824 - the line number within the source code module. 4825 The returned module name and file name will be None if unknown. 4826 The returned line number will similarly be zero if unknown. 4827 @param ctx: message context (as passed to the @ref libvlc_log_cb callback). 4828 @return: module module name storage (or None), file source code file name storage (or None), line source code file line number storage (or None). 4829 @version: LibVLC 2.1.0 or later. 4830 ''' 4831 f = _Cfunctions.get('libvlc_log_get_context', None) or \ 4832 _Cfunction('libvlc_log_get_context', ((1,), (2,), (2,), (2,),), None, 4833 None, Log_ptr, ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_uint)) 4834 return f(ctx)
4835
4836 -def libvlc_log_get_object(ctx, id):
4837 '''Gets log message info. 4838 This function retrieves meta-information about a log message: 4839 - the type name of the VLC object emitting the message, 4840 - the object header if any, and 4841 - a temporaly-unique object identifier. 4842 This information is mainly meant for B{manual} troubleshooting. 4843 The returned type name may be "generic" if unknown, but it cannot be None. 4844 The returned header will be None if unset; in current versions, the header 4845 is used to distinguish for VLM inputs. 4846 The returned object ID will be zero if the message is not associated with 4847 any VLC object. 4848 @param ctx: message context (as passed to the @ref libvlc_log_cb callback). 4849 @return: name object name storage (or None), header object header (or None), line source code file line number storage (or None). 4850 @version: LibVLC 2.1.0 or later. 4851 ''' 4852 f = _Cfunctions.get('libvlc_log_get_object', None) or \ 4853 _Cfunction('libvlc_log_get_object', ((1,), (2,), (2,), (1,),), None, 4854 None, Log_ptr, ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_uint)) 4855 return f(ctx, id)
4856
4857 -def libvlc_log_unset(p_instance):
4858 '''Unsets the logging callback. 4859 This function deregisters the logging callback for a LibVLC instance. 4860 This is rarely needed as the callback is implicitly unset when the instance 4861 is destroyed. 4862 @note: This function will wait for any pending callbacks invocation to 4863 complete (causing a deadlock if called from within the callback). 4864 @param p_instance: libvlc instance. 4865 @version: LibVLC 2.1.0 or later. 4866 ''' 4867 f = _Cfunctions.get('libvlc_log_unset', None) or \ 4868 _Cfunction('libvlc_log_unset', ((1,),), None, 4869 None, Instance) 4870 return f(p_instance)
4871
4872 -def libvlc_log_set(p_instance, cb, data):
4873 '''Sets the logging callback for a LibVLC instance. 4874 This function is thread-safe: it will wait for any pending callbacks 4875 invocation to complete. 4876 @param cb: callback function pointer. 4877 @param data: opaque data pointer for the callback function @note Some log messages (especially debug) are emitted by LibVLC while is being initialized. These messages cannot be captured with this interface. @warning A deadlock may occur if this function is called from the callback. 4878 @param p_instance: libvlc instance. 4879 @version: LibVLC 2.1.0 or later. 4880 ''' 4881 f = _Cfunctions.get('libvlc_log_set', None) or \ 4882 _Cfunction('libvlc_log_set', ((1,), (1,), (1,),), None, 4883 None, Instance, LogCb, ctypes.c_void_p) 4884 return f(p_instance, cb, data)
4885
4886 -def libvlc_log_set_file(p_instance, stream):
4887 '''Sets up logging to a file. 4888 @param p_instance: libvlc instance. 4889 @param stream: FILE pointer opened for writing (the FILE pointer must remain valid until L{libvlc_log_unset}()). 4890 @version: LibVLC 2.1.0 or later. 4891 ''' 4892 f = _Cfunctions.get('libvlc_log_set_file', None) or \ 4893 _Cfunction('libvlc_log_set_file', ((1,), (1,),), None, 4894 None, Instance, FILE_ptr) 4895 return f(p_instance, stream)
4896
4897 -def libvlc_module_description_list_release(p_list):
4898 '''Release a list of module descriptions. 4899 @param p_list: the list to be released. 4900 ''' 4901 f = _Cfunctions.get('libvlc_module_description_list_release', None) or \ 4902 _Cfunction('libvlc_module_description_list_release', ((1,),), None, 4903 None, ctypes.POINTER(ModuleDescription)) 4904 return f(p_list)
4905
4906 -def libvlc_audio_filter_list_get(p_instance):
4907 '''Returns a list of audio filters that are available. 4908 @param p_instance: libvlc instance. 4909 @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}. 4910 ''' 4911 f = _Cfunctions.get('libvlc_audio_filter_list_get', None) or \ 4912 _Cfunction('libvlc_audio_filter_list_get', ((1,),), None, 4913 ctypes.POINTER(ModuleDescription), Instance) 4914 return f(p_instance)
4915
4916 -def libvlc_video_filter_list_get(p_instance):
4917 '''Returns a list of video filters that are available. 4918 @param p_instance: libvlc instance. 4919 @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}. 4920 ''' 4921 f = _Cfunctions.get('libvlc_video_filter_list_get', None) or \ 4922 _Cfunction('libvlc_video_filter_list_get', ((1,),), None, 4923 ctypes.POINTER(ModuleDescription), Instance) 4924 return f(p_instance)
4925
4926 -def libvlc_clock():
4927 '''Return the current time as defined by LibVLC. The unit is the microsecond. 4928 Time increases monotonically (regardless of time zone changes and RTC 4929 adjustements). 4930 The origin is arbitrary but consistent across the whole system 4931 (e.g. the system uptim, the time since the system was booted). 4932 @note: On systems that support it, the POSIX monotonic clock is used. 4933 ''' 4934 f = _Cfunctions.get('libvlc_clock', None) or \ 4935 _Cfunction('libvlc_clock', (), None, 4936 ctypes.c_int64) 4937 return f()
4938
4939 -def libvlc_media_discoverer_new(p_inst, psz_name):
4940 '''Create a media discoverer object by name. 4941 After this object is created, you should attach to media_list events in 4942 order to be notified of new items discovered. 4943 You need to call L{libvlc_media_discoverer_start}() in order to start the 4944 discovery. 4945 See L{libvlc_media_discoverer_media_list} 4946 See L{libvlc_media_discoverer_event_manager} 4947 See L{libvlc_media_discoverer_start}. 4948 @param p_inst: libvlc instance. 4949 @param psz_name: service name; use L{libvlc_media_discoverer_list_get}() to get a list of the discoverer names available in this libVLC instance. 4950 @return: media discover object or None in case of error. 4951 @version: LibVLC 3.0.0 or later. 4952 ''' 4953 f = _Cfunctions.get('libvlc_media_discoverer_new', None) or \ 4954 _Cfunction('libvlc_media_discoverer_new', ((1,), (1,),), class_result(MediaDiscoverer), 4955 ctypes.c_void_p, Instance, ctypes.c_char_p) 4956 return f(p_inst, psz_name)
4957
4958 -def libvlc_media_discoverer_start(p_mdis):
4959 '''Start media discovery. 4960 To stop it, call L{libvlc_media_discoverer_stop}() or 4961 L{libvlc_media_discoverer_list_release}() directly. 4962 See L{libvlc_media_discoverer_stop}. 4963 @param p_mdis: media discover object. 4964 @return: -1 in case of error, 0 otherwise. 4965 @version: LibVLC 3.0.0 or later. 4966 ''' 4967 f = _Cfunctions.get('libvlc_media_discoverer_start', None) or \ 4968 _Cfunction('libvlc_media_discoverer_start', ((1,),), None, 4969 ctypes.c_int, MediaDiscoverer) 4970 return f(p_mdis)
4971
4972 -def libvlc_media_discoverer_stop(p_mdis):
4973 '''Stop media discovery. 4974 See L{libvlc_media_discoverer_start}. 4975 @param p_mdis: media discover object. 4976 @version: LibVLC 3.0.0 or later. 4977 ''' 4978 f = _Cfunctions.get('libvlc_media_discoverer_stop', None) or \ 4979 _Cfunction('libvlc_media_discoverer_stop', ((1,),), None, 4980 None, MediaDiscoverer) 4981 return f(p_mdis)
4982
4983 -def libvlc_media_discoverer_release(p_mdis):
4984 '''Release media discover object. If the reference count reaches 0, then 4985 the object will be released. 4986 @param p_mdis: media service discover object. 4987 ''' 4988 f = _Cfunctions.get('libvlc_media_discoverer_release', None) or \ 4989 _Cfunction('libvlc_media_discoverer_release', ((1,),), None, 4990 None, MediaDiscoverer) 4991 return f(p_mdis)
4992
4993 -def libvlc_media_discoverer_media_list(p_mdis):
4994 '''Get media service discover media list. 4995 @param p_mdis: media service discover object. 4996 @return: list of media items. 4997 ''' 4998 f = _Cfunctions.get('libvlc_media_discoverer_media_list', None) or \ 4999 _Cfunction('libvlc_media_discoverer_media_list', ((1,),), class_result(MediaList), 5000 ctypes.c_void_p, MediaDiscoverer) 5001 return f(p_mdis)
5002
5003 -def libvlc_media_discoverer_is_running(p_mdis):
5004 '''Query if media service discover object is running. 5005 @param p_mdis: media service discover object. 5006 @return: true if running, false if not \libvlc_return_bool. 5007 ''' 5008 f = _Cfunctions.get('libvlc_media_discoverer_is_running', None) or \ 5009 _Cfunction('libvlc_media_discoverer_is_running', ((1,),), None, 5010 ctypes.c_int, MediaDiscoverer) 5011 return f(p_mdis)
5012
5013 -def libvlc_media_discoverer_list_get(p_inst, i_cat, ppp_services):
5014 '''Get media discoverer services by category. 5015 @param p_inst: libvlc instance. 5016 @param i_cat: category of services to fetch. 5017 @param ppp_services: address to store an allocated array of media discoverer services (must be freed with L{libvlc_media_discoverer_list_release}() by the caller) [OUT]. 5018 @return: the number of media discoverer services (0 on error). 5019 @version: LibVLC 3.0.0 and later. 5020 ''' 5021 f = _Cfunctions.get('libvlc_media_discoverer_list_get', None) or \ 5022 _Cfunction('libvlc_media_discoverer_list_get', ((1,), (1,), (1,),), None, 5023 ctypes.c_size_t, Instance, MediaDiscovererCategory, ctypes.POINTER(ctypes.POINTER(MediaDiscovererDescription))) 5024 return f(p_inst, i_cat, ppp_services)
5025
5026 -def libvlc_media_discoverer_list_release(pp_services, i_count):
5027 '''Release an array of media discoverer services. 5028 @param pp_services: array to release. 5029 @param i_count: number of elements in the array. 5030 @version: LibVLC 3.0.0 and later. See L{libvlc_media_discoverer_list_get}(). 5031 ''' 5032 f = _Cfunctions.get('libvlc_media_discoverer_list_release', None) or \ 5033 _Cfunction('libvlc_media_discoverer_list_release', ((1,), (1,),), None, 5034 None, ctypes.POINTER(MediaDiscovererDescription), ctypes.c_size_t) 5035 return f(pp_services, i_count)
5036
5037 -def libvlc_dialog_set_context(p_id, p_context):
5038 '''Associate an opaque pointer with the dialog id. 5039 @version: LibVLC 3.0.0 and later. 5040 ''' 5041 f = _Cfunctions.get('libvlc_dialog_set_context', None) or \ 5042 _Cfunction('libvlc_dialog_set_context', ((1,), (1,),), None, 5043 None, ctypes.c_void_p, ctypes.c_void_p) 5044 return f(p_id, p_context)
5045
5046 -def libvlc_dialog_get_context(p_id):
5047 '''Return the opaque pointer associated with the dialog id. 5048 @version: LibVLC 3.0.0 and later. 5049 ''' 5050 f = _Cfunctions.get('libvlc_dialog_get_context', None) or \ 5051 _Cfunction('libvlc_dialog_get_context', ((1,),), None, 5052 ctypes.c_void_p, ctypes.c_void_p) 5053 return f(p_id)
5054
5055 -def libvlc_dialog_post_login(p_id, psz_username, psz_password, b_store):
5056 '''Post a login answer 5057 After this call, p_id won't be valid anymore 5058 See libvlc_dialog_cbs.pf_display_login. 5059 @param p_id: id of the dialog. 5060 @param psz_username: valid and non empty string. 5061 @param psz_password: valid string (can be empty). 5062 @param b_store: if true, store the credentials. 5063 @return: 0 on success, or -1 on error. 5064 @version: LibVLC 3.0.0 and later. 5065 ''' 5066 f = _Cfunctions.get('libvlc_dialog_post_login', None) or \ 5067 _Cfunction('libvlc_dialog_post_login', ((1,), (1,), (1,), (1,),), None, 5068 ctypes.c_int, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_bool) 5069 return f(p_id, psz_username, psz_password, b_store)
5070
5071 -def libvlc_dialog_post_action(p_id, i_action):
5072 '''Post a question answer 5073 After this call, p_id won't be valid anymore 5074 See libvlc_dialog_cbs.pf_display_question. 5075 @param p_id: id of the dialog. 5076 @param i_action: 1 for action1, 2 for action2. 5077 @return: 0 on success, or -1 on error. 5078 @version: LibVLC 3.0.0 and later. 5079 ''' 5080 f = _Cfunctions.get('libvlc_dialog_post_action', None) or \ 5081 _Cfunction('libvlc_dialog_post_action', ((1,), (1,),), None, 5082 ctypes.c_int, ctypes.c_void_p, ctypes.c_int) 5083 return f(p_id, i_action)
5084
5085 -def libvlc_dialog_dismiss(p_id):
5086 '''Dismiss a dialog 5087 After this call, p_id won't be valid anymore 5088 See libvlc_dialog_cbs.pf_cancel. 5089 @param p_id: id of the dialog. 5090 @return: 0 on success, or -1 on error. 5091 @version: LibVLC 3.0.0 and later. 5092 ''' 5093 f = _Cfunctions.get('libvlc_dialog_dismiss', None) or \ 5094 _Cfunction('libvlc_dialog_dismiss', ((1,),), None, 5095 ctypes.c_int, ctypes.c_void_p) 5096 return f(p_id)
5097
5098 -def libvlc_media_library_new(p_instance):
5099 '''Create an new Media Library object. 5100 @param p_instance: the libvlc instance. 5101 @return: a new object or None on error. 5102 ''' 5103 f = _Cfunctions.get('libvlc_media_library_new', None) or \ 5104 _Cfunction('libvlc_media_library_new', ((1,),), class_result(MediaLibrary), 5105 ctypes.c_void_p, Instance) 5106 return f(p_instance)
5107
5108 -def libvlc_media_library_release(p_mlib):
5109 '''Release media library object. This functions decrements the 5110 reference count of the media library object. If it reaches 0, 5111 then the object will be released. 5112 @param p_mlib: media library object. 5113 ''' 5114 f = _Cfunctions.get('libvlc_media_library_release', None) or \ 5115 _Cfunction('libvlc_media_library_release', ((1,),), None, 5116 None, MediaLibrary) 5117 return f(p_mlib)
5118
5119 -def libvlc_media_library_retain(p_mlib):
5120 '''Retain a reference to a media library object. This function will 5121 increment the reference counting for this object. Use 5122 L{libvlc_media_library_release}() to decrement the reference count. 5123 @param p_mlib: media library object. 5124 ''' 5125 f = _Cfunctions.get('libvlc_media_library_retain', None) or \ 5126 _Cfunction('libvlc_media_library_retain', ((1,),), None, 5127 None, MediaLibrary) 5128 return f(p_mlib)
5129
5130 -def libvlc_media_library_load(p_mlib):
5131 '''Load media library. 5132 @param p_mlib: media library object. 5133 @return: 0 on success, -1 on error. 5134 ''' 5135 f = _Cfunctions.get('libvlc_media_library_load', None) or \ 5136 _Cfunction('libvlc_media_library_load', ((1,),), None, 5137 ctypes.c_int, MediaLibrary) 5138 return f(p_mlib)
5139
5140 -def libvlc_media_library_media_list(p_mlib):
5141 '''Get media library subitems. 5142 @param p_mlib: media library object. 5143 @return: media list subitems. 5144 ''' 5145 f = _Cfunctions.get('libvlc_media_library_media_list', None) or \ 5146 _Cfunction('libvlc_media_library_media_list', ((1,),), class_result(MediaList), 5147 ctypes.c_void_p, MediaLibrary) 5148 return f(p_mlib)
5149
5150 -def libvlc_vlm_release(p_instance):
5151 '''Release the vlm instance related to the given L{Instance}. 5152 @param p_instance: the instance. 5153 ''' 5154 f = _Cfunctions.get('libvlc_vlm_release', None) or \ 5155 _Cfunction('libvlc_vlm_release', ((1,),), None, 5156 None, Instance) 5157 return f(p_instance)
5158
5159 -def libvlc_vlm_add_broadcast(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop):
5160 '''Add a broadcast, with one input. 5161 @param p_instance: the instance. 5162 @param psz_name: the name of the new broadcast. 5163 @param psz_input: the input MRL. 5164 @param psz_output: the output MRL (the parameter to the "sout" variable). 5165 @param i_options: number of additional options. 5166 @param ppsz_options: additional options. 5167 @param b_enabled: boolean for enabling the new broadcast. 5168 @param b_loop: Should this broadcast be played in loop ? 5169 @return: 0 on success, -1 on error. 5170 ''' 5171 f = _Cfunctions.get('libvlc_vlm_add_broadcast', None) or \ 5172 _Cfunction('libvlc_vlm_add_broadcast', ((1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),), None, 5173 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p), ctypes.c_int, ctypes.c_int) 5174 return f(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop)
5175
5176 -def libvlc_vlm_add_vod(p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux):
5177 '''Add a vod, with one input. 5178 @param p_instance: the instance. 5179 @param psz_name: the name of the new vod media. 5180 @param psz_input: the input MRL. 5181 @param i_options: number of additional options. 5182 @param ppsz_options: additional options. 5183 @param b_enabled: boolean for enabling the new vod. 5184 @param psz_mux: the muxer of the vod media. 5185 @return: 0 on success, -1 on error. 5186 ''' 5187 f = _Cfunctions.get('libvlc_vlm_add_vod', None) or \ 5188 _Cfunction('libvlc_vlm_add_vod', ((1,), (1,), (1,), (1,), (1,), (1,), (1,),), None, 5189 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p), ctypes.c_int, ctypes.c_char_p) 5190 return f(p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux)
5191
5192 -def libvlc_vlm_del_media(p_instance, psz_name):
5193 '''Delete a media (VOD or broadcast). 5194 @param p_instance: the instance. 5195 @param psz_name: the media to delete. 5196 @return: 0 on success, -1 on error. 5197 ''' 5198 f = _Cfunctions.get('libvlc_vlm_del_media', None) or \ 5199 _Cfunction('libvlc_vlm_del_media', ((1,), (1,),), None, 5200 ctypes.c_int, Instance, ctypes.c_char_p) 5201 return f(p_instance, psz_name)
5202
5203 -def libvlc_vlm_set_enabled(p_instance, psz_name, b_enabled):
5204 '''Enable or disable a media (VOD or broadcast). 5205 @param p_instance: the instance. 5206 @param psz_name: the media to work on. 5207 @param b_enabled: the new status. 5208 @return: 0 on success, -1 on error. 5209 ''' 5210 f = _Cfunctions.get('libvlc_vlm_set_enabled', None) or \ 5211 _Cfunction('libvlc_vlm_set_enabled', ((1,), (1,), (1,),), None, 5212 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) 5213 return f(p_instance, psz_name, b_enabled)
5214
5215 -def libvlc_vlm_set_output(p_instance, psz_name, psz_output):
5216 '''Set the output for a media. 5217 @param p_instance: the instance. 5218 @param psz_name: the media to work on. 5219 @param psz_output: the output MRL (the parameter to the "sout" variable). 5220 @return: 0 on success, -1 on error. 5221 ''' 5222 f = _Cfunctions.get('libvlc_vlm_set_output', None) or \ 5223 _Cfunction('libvlc_vlm_set_output', ((1,), (1,), (1,),), None, 5224 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) 5225 return f(p_instance, psz_name, psz_output)
5226
5227 -def libvlc_vlm_set_input(p_instance, psz_name, psz_input):
5228 '''Set a media's input MRL. This will delete all existing inputs and 5229 add the specified one. 5230 @param p_instance: the instance. 5231 @param psz_name: the media to work on. 5232 @param psz_input: the input MRL. 5233 @return: 0 on success, -1 on error. 5234 ''' 5235 f = _Cfunctions.get('libvlc_vlm_set_input', None) or \ 5236 _Cfunction('libvlc_vlm_set_input', ((1,), (1,), (1,),), None, 5237 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) 5238 return f(p_instance, psz_name, psz_input)
5239
5240 -def libvlc_vlm_add_input(p_instance, psz_name, psz_input):
5241 '''Add a media's input MRL. This will add the specified one. 5242 @param p_instance: the instance. 5243 @param psz_name: the media to work on. 5244 @param psz_input: the input MRL. 5245 @return: 0 on success, -1 on error. 5246 ''' 5247 f = _Cfunctions.get('libvlc_vlm_add_input', None) or \ 5248 _Cfunction('libvlc_vlm_add_input', ((1,), (1,), (1,),), None, 5249 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) 5250 return f(p_instance, psz_name, psz_input)
5251
5252 -def libvlc_vlm_set_loop(p_instance, psz_name, b_loop):
5253 '''Set a media's loop status. 5254 @param p_instance: the instance. 5255 @param psz_name: the media to work on. 5256 @param b_loop: the new status. 5257 @return: 0 on success, -1 on error. 5258 ''' 5259 f = _Cfunctions.get('libvlc_vlm_set_loop', None) or \ 5260 _Cfunction('libvlc_vlm_set_loop', ((1,), (1,), (1,),), None, 5261 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) 5262 return f(p_instance, psz_name, b_loop)
5263
5264 -def libvlc_vlm_set_mux(p_instance, psz_name, psz_mux):
5265 '''Set a media's vod muxer. 5266 @param p_instance: the instance. 5267 @param psz_name: the media to work on. 5268 @param psz_mux: the new muxer. 5269 @return: 0 on success, -1 on error. 5270 ''' 5271 f = _Cfunctions.get('libvlc_vlm_set_mux', None) or \ 5272 _Cfunction('libvlc_vlm_set_mux', ((1,), (1,), (1,),), None, 5273 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) 5274 return f(p_instance, psz_name, psz_mux)
5275
5276 -def libvlc_vlm_change_media(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop):
5277 '''Edit the parameters of a media. This will delete all existing inputs and 5278 add the specified one. 5279 @param p_instance: the instance. 5280 @param psz_name: the name of the new broadcast. 5281 @param psz_input: the input MRL. 5282 @param psz_output: the output MRL (the parameter to the "sout" variable). 5283 @param i_options: number of additional options. 5284 @param ppsz_options: additional options. 5285 @param b_enabled: boolean for enabling the new broadcast. 5286 @param b_loop: Should this broadcast be played in loop ? 5287 @return: 0 on success, -1 on error. 5288 ''' 5289 f = _Cfunctions.get('libvlc_vlm_change_media', None) or \ 5290 _Cfunction('libvlc_vlm_change_media', ((1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),), None, 5291 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p), ctypes.c_int, ctypes.c_int) 5292 return f(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop)
5293
5294 -def libvlc_vlm_play_media(p_instance, psz_name):
5295 '''Play the named broadcast. 5296 @param p_instance: the instance. 5297 @param psz_name: the name of the broadcast. 5298 @return: 0 on success, -1 on error. 5299 ''' 5300 f = _Cfunctions.get('libvlc_vlm_play_media', None) or \ 5301 _Cfunction('libvlc_vlm_play_media', ((1,), (1,),), None, 5302 ctypes.c_int, Instance, ctypes.c_char_p) 5303 return f(p_instance, psz_name)
5304
5305 -def libvlc_vlm_stop_media(p_instance, psz_name):
5306 '''Stop the named broadcast. 5307 @param p_instance: the instance. 5308 @param psz_name: the name of the broadcast. 5309 @return: 0 on success, -1 on error. 5310 ''' 5311 f = _Cfunctions.get('libvlc_vlm_stop_media', None) or \ 5312 _Cfunction('libvlc_vlm_stop_media', ((1,), (1,),), None, 5313 ctypes.c_int, Instance, ctypes.c_char_p) 5314 return f(p_instance, psz_name)
5315
5316 -def libvlc_vlm_pause_media(p_instance, psz_name):
5317 '''Pause the named broadcast. 5318 @param p_instance: the instance. 5319 @param psz_name: the name of the broadcast. 5320 @return: 0 on success, -1 on error. 5321 ''' 5322 f = _Cfunctions.get('libvlc_vlm_pause_media', None) or \ 5323 _Cfunction('libvlc_vlm_pause_media', ((1,), (1,),), None, 5324 ctypes.c_int, Instance, ctypes.c_char_p) 5325 return f(p_instance, psz_name)
5326
5327 -def libvlc_vlm_seek_media(p_instance, psz_name, f_percentage):
5328 '''Seek in the named broadcast. 5329 @param p_instance: the instance. 5330 @param psz_name: the name of the broadcast. 5331 @param f_percentage: the percentage to seek to. 5332 @return: 0 on success, -1 on error. 5333 ''' 5334 f = _Cfunctions.get('libvlc_vlm_seek_media', None) or \ 5335 _Cfunction('libvlc_vlm_seek_media', ((1,), (1,), (1,),), None, 5336 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_float) 5337 return f(p_instance, psz_name, f_percentage)
5338
5339 -def libvlc_vlm_show_media(p_instance, psz_name):
5340 '''Return information about the named media as a JSON 5341 string representation. 5342 This function is mainly intended for debugging use, 5343 if you want programmatic access to the state of 5344 a vlm_media_instance_t, please use the corresponding 5345 libvlc_vlm_get_media_instance_xxx -functions. 5346 Currently there are no such functions available for 5347 vlm_media_t though. 5348 @param p_instance: the instance. 5349 @param psz_name: the name of the media, if the name is an empty string, all media is described. 5350 @return: string with information about named media, or None on error. 5351 ''' 5352 f = _Cfunctions.get('libvlc_vlm_show_media', None) or \ 5353 _Cfunction('libvlc_vlm_show_media', ((1,), (1,),), string_result, 5354 ctypes.c_void_p, Instance, ctypes.c_char_p) 5355 return f(p_instance, psz_name)
5356
5357 -def libvlc_vlm_get_media_instance_position(p_instance, psz_name, i_instance):
5358 '''Get vlm_media instance position by name or instance id. 5359 @param p_instance: a libvlc instance. 5360 @param psz_name: name of vlm media instance. 5361 @param i_instance: instance id. 5362 @return: position as float or -1. on error. 5363 ''' 5364 f = _Cfunctions.get('libvlc_vlm_get_media_instance_position', None) or \ 5365 _Cfunction('libvlc_vlm_get_media_instance_position', ((1,), (1,), (1,),), None, 5366 ctypes.c_float, Instance, ctypes.c_char_p, ctypes.c_int) 5367 return f(p_instance, psz_name, i_instance)
5368
5369 -def libvlc_vlm_get_media_instance_time(p_instance, psz_name, i_instance):
5370 '''Get vlm_media instance time by name or instance id. 5371 @param p_instance: a libvlc instance. 5372 @param psz_name: name of vlm media instance. 5373 @param i_instance: instance id. 5374 @return: time as integer or -1 on error. 5375 ''' 5376 f = _Cfunctions.get('libvlc_vlm_get_media_instance_time', None) or \ 5377 _Cfunction('libvlc_vlm_get_media_instance_time', ((1,), (1,), (1,),), None, 5378 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) 5379 return f(p_instance, psz_name, i_instance)
5380
5381 -def libvlc_vlm_get_media_instance_length(p_instance, psz_name, i_instance):
5382 '''Get vlm_media instance length by name or instance id. 5383 @param p_instance: a libvlc instance. 5384 @param psz_name: name of vlm media instance. 5385 @param i_instance: instance id. 5386 @return: length of media item or -1 on error. 5387 ''' 5388 f = _Cfunctions.get('libvlc_vlm_get_media_instance_length', None) or \ 5389 _Cfunction('libvlc_vlm_get_media_instance_length', ((1,), (1,), (1,),), None, 5390 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) 5391 return f(p_instance, psz_name, i_instance)
5392
5393 -def libvlc_vlm_get_media_instance_rate(p_instance, psz_name, i_instance):
5394 '''Get vlm_media instance playback rate by name or instance id. 5395 @param p_instance: a libvlc instance. 5396 @param psz_name: name of vlm media instance. 5397 @param i_instance: instance id. 5398 @return: playback rate or -1 on error. 5399 ''' 5400 f = _Cfunctions.get('libvlc_vlm_get_media_instance_rate', None) or \ 5401 _Cfunction('libvlc_vlm_get_media_instance_rate', ((1,), (1,), (1,),), None, 5402 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) 5403 return f(p_instance, psz_name, i_instance)
5404
5405 -def libvlc_vlm_get_media_instance_title(p_instance, psz_name, i_instance):
5406 '''Get vlm_media instance title number by name or instance id. 5407 @param p_instance: a libvlc instance. 5408 @param psz_name: name of vlm media instance. 5409 @param i_instance: instance id. 5410 @return: title as number or -1 on error. 5411 @bug: will always return 0. 5412 ''' 5413 f = _Cfunctions.get('libvlc_vlm_get_media_instance_title', None) or \ 5414 _Cfunction('libvlc_vlm_get_media_instance_title', ((1,), (1,), (1,),), None, 5415 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) 5416 return f(p_instance, psz_name, i_instance)
5417
5418 -def libvlc_vlm_get_media_instance_chapter(p_instance, psz_name, i_instance):
5419 '''Get vlm_media instance chapter number by name or instance id. 5420 @param p_instance: a libvlc instance. 5421 @param psz_name: name of vlm media instance. 5422 @param i_instance: instance id. 5423 @return: chapter as number or -1 on error. 5424 @bug: will always return 0. 5425 ''' 5426 f = _Cfunctions.get('libvlc_vlm_get_media_instance_chapter', None) or \ 5427 _Cfunction('libvlc_vlm_get_media_instance_chapter', ((1,), (1,), (1,),), None, 5428 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) 5429 return f(p_instance, psz_name, i_instance)
5430
5431 -def libvlc_vlm_get_media_instance_seekable(p_instance, psz_name, i_instance):
5432 '''Is libvlc instance seekable ? 5433 @param p_instance: a libvlc instance. 5434 @param psz_name: name of vlm media instance. 5435 @param i_instance: instance id. 5436 @return: 1 if seekable, 0 if not, -1 if media does not exist. 5437 @bug: will always return 0. 5438 ''' 5439 f = _Cfunctions.get('libvlc_vlm_get_media_instance_seekable', None) or \ 5440 _Cfunction('libvlc_vlm_get_media_instance_seekable', ((1,), (1,), (1,),), None, 5441 ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) 5442 return f(p_instance, psz_name, i_instance)
5443
5444 -def libvlc_vlm_get_event_manager(p_instance):
5445 '''Get libvlc_event_manager from a vlm media. 5446 The p_event_manager is immutable, so you don't have to hold the lock. 5447 @param p_instance: a libvlc instance. 5448 @return: libvlc_event_manager. 5449 ''' 5450 f = _Cfunctions.get('libvlc_vlm_get_event_manager', None) or \ 5451 _Cfunction('libvlc_vlm_get_event_manager', ((1,),), class_result(EventManager), 5452 ctypes.c_void_p, Instance) 5453 return f(p_instance)
5454
5455 -def libvlc_media_new_location(p_instance, psz_mrl):
5456 '''Create a media with a certain given media resource location, 5457 for instance a valid URL. 5458 @note: To refer to a local file with this function, 5459 the file://... URI syntax B{must} be used (see IETF RFC3986). 5460 We recommend using L{libvlc_media_new_path}() instead when dealing with 5461 local files. 5462 See L{libvlc_media_release}. 5463 @param p_instance: the instance. 5464 @param psz_mrl: the media location. 5465 @return: the newly created media or None on error. 5466 ''' 5467 f = _Cfunctions.get('libvlc_media_new_location', None) or \ 5468 _Cfunction('libvlc_media_new_location', ((1,), (1,),), class_result(Media), 5469 ctypes.c_void_p, Instance, ctypes.c_char_p) 5470 return f(p_instance, psz_mrl)
5471
5472 -def libvlc_media_new_path(p_instance, path):
5473 '''Create a media for a certain file path. 5474 See L{libvlc_media_release}. 5475 @param p_instance: the instance. 5476 @param path: local filesystem path. 5477 @return: the newly created media or None on error. 5478 ''' 5479 f = _Cfunctions.get('libvlc_media_new_path', None) or \ 5480 _Cfunction('libvlc_media_new_path', ((1,), (1,),), class_result(Media), 5481 ctypes.c_void_p, Instance, ctypes.c_char_p) 5482 return f(p_instance, path)
5483
5484 -def libvlc_media_new_fd(p_instance, fd):
5485 '''Create a media for an already open file descriptor. 5486 The file descriptor shall be open for reading (or reading and writing). 5487 Regular file descriptors, pipe read descriptors and character device 5488 descriptors (including TTYs) are supported on all platforms. 5489 Block device descriptors are supported where available. 5490 Directory descriptors are supported on systems that provide fdopendir(). 5491 Sockets are supported on all platforms where they are file descriptors, 5492 i.e. all except Windows. 5493 @note: This library will B{not} automatically close the file descriptor 5494 under any circumstance. Nevertheless, a file descriptor can usually only be 5495 rendered once in a media player. To render it a second time, the file 5496 descriptor should probably be rewound to the beginning with lseek(). 5497 See L{libvlc_media_release}. 5498 @param p_instance: the instance. 5499 @param fd: open file descriptor. 5500 @return: the newly created media or None on error. 5501 @version: LibVLC 1.1.5 and later. 5502 ''' 5503 f = _Cfunctions.get('libvlc_media_new_fd', None) or \ 5504 _Cfunction('libvlc_media_new_fd', ((1,), (1,),), class_result(Media), 5505 ctypes.c_void_p, Instance, ctypes.c_int) 5506 return f(p_instance, fd)
5507
5508 -def libvlc_media_new_callbacks(instance, open_cb, read_cb, seek_cb, close_cb, opaque):
5509 '''Create a media with custom callbacks to read the data from. 5510 @param instance: LibVLC instance. 5511 @param open_cb: callback to open the custom bitstream input media. 5512 @param read_cb: callback to read data (must not be None). 5513 @param seek_cb: callback to seek, or None if seeking is not supported. 5514 @param close_cb: callback to close the media, or None if unnecessary. 5515 @param opaque: data pointer for the open callback. 5516 @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}. 5517 @version: LibVLC 3.0.0 and later. 5518 ''' 5519 f = _Cfunctions.get('libvlc_media_new_callbacks', None) or \ 5520 _Cfunction('libvlc_media_new_callbacks', ((1,), (1,), (1,), (1,), (1,), (1,),), class_result(Media), 5521 ctypes.c_void_p, Instance, MediaOpenCb, MediaReadCb, MediaSeekCb, MediaCloseCb, ctypes.c_void_p) 5522 return f(instance, open_cb, read_cb, seek_cb, close_cb, opaque)
5523
5524 -def libvlc_media_new_as_node(p_instance, psz_name):
5525 '''Create a media as an empty node with a given name. 5526 See L{libvlc_media_release}. 5527 @param p_instance: the instance. 5528 @param psz_name: the name of the node. 5529 @return: the new empty media or None on error. 5530 ''' 5531 f = _Cfunctions.get('libvlc_media_new_as_node', None) or \ 5532 _Cfunction('libvlc_media_new_as_node', ((1,), (1,),), class_result(Media), 5533 ctypes.c_void_p, Instance, ctypes.c_char_p) 5534 return f(p_instance, psz_name)
5535
5536 -def libvlc_media_add_option(p_md, psz_options):
5537 '''Add an option to the media. 5538 This option will be used to determine how the media_player will 5539 read the media. This allows to use VLC's advanced 5540 reading/streaming options on a per-media basis. 5541 @note: The options are listed in 'vlc --long-help' from the command line, 5542 e.g. "-sout-all". Keep in mind that available options and their semantics 5543 vary across LibVLC versions and builds. 5544 @warning: Not all options affects L{Media} objects: 5545 Specifically, due to architectural issues most audio and video options, 5546 such as text renderer options, have no effects on an individual media. 5547 These options must be set through L{libvlc_new}() instead. 5548 @param p_md: the media descriptor. 5549 @param psz_options: the options (as a string). 5550 ''' 5551 f = _Cfunctions.get('libvlc_media_add_option', None) or \ 5552 _Cfunction('libvlc_media_add_option', ((1,), (1,),), None, 5553 None, Media, ctypes.c_char_p) 5554 return f(p_md, psz_options)
5555
5556 -def libvlc_media_add_option_flag(p_md, psz_options, i_flags):
5557 '''Add an option to the media with configurable flags. 5558 This option will be used to determine how the media_player will 5559 read the media. This allows to use VLC's advanced 5560 reading/streaming options on a per-media basis. 5561 The options are detailed in vlc --long-help, for instance 5562 "--sout-all". Note that all options are not usable on medias: 5563 specifically, due to architectural issues, video-related options 5564 such as text renderer options cannot be set on a single media. They 5565 must be set on the whole libvlc instance instead. 5566 @param p_md: the media descriptor. 5567 @param psz_options: the options (as a string). 5568 @param i_flags: the flags for this option. 5569 ''' 5570 f = _Cfunctions.get('libvlc_media_add_option_flag', None) or \ 5571 _Cfunction('libvlc_media_add_option_flag', ((1,), (1,), (1,),), None, 5572 None, Media, ctypes.c_char_p, ctypes.c_uint) 5573 return f(p_md, psz_options, i_flags)
5574
5575 -def libvlc_media_retain(p_md):
5576 '''Retain a reference to a media descriptor object (L{Media}). Use 5577 L{libvlc_media_release}() to decrement the reference count of a 5578 media descriptor object. 5579 @param p_md: the media descriptor. 5580 ''' 5581 f = _Cfunctions.get('libvlc_media_retain', None) or \ 5582 _Cfunction('libvlc_media_retain', ((1,),), None, 5583 None, Media) 5584 return f(p_md)
5585
5586 -def libvlc_media_release(p_md):
5587 '''Decrement the reference count of a media descriptor object. If the 5588 reference count is 0, then L{libvlc_media_release}() will release the 5589 media descriptor object. It will send out an libvlc_MediaFreed event 5590 to all listeners. If the media descriptor object has been released it 5591 should not be used again. 5592 @param p_md: the media descriptor. 5593 ''' 5594 f = _Cfunctions.get('libvlc_media_release', None) or \ 5595 _Cfunction('libvlc_media_release', ((1,),), None, 5596 None, Media) 5597 return f(p_md)
5598
5599 -def libvlc_media_get_mrl(p_md):
5600 '''Get the media resource locator (mrl) from a media descriptor object. 5601 @param p_md: a media descriptor object. 5602 @return: string with mrl of media descriptor object. 5603 ''' 5604 f = _Cfunctions.get('libvlc_media_get_mrl', None) or \ 5605 _Cfunction('libvlc_media_get_mrl', ((1,),), string_result, 5606 ctypes.c_void_p, Media) 5607 return f(p_md)
5608
5609 -def libvlc_media_duplicate(p_md):
5610 '''Duplicate a media descriptor object. 5611 @param p_md: a media descriptor object. 5612 ''' 5613 f = _Cfunctions.get('libvlc_media_duplicate', None) or \ 5614 _Cfunction('libvlc_media_duplicate', ((1,),), class_result(Media), 5615 ctypes.c_void_p, Media) 5616 return f(p_md)
5617
5618 -def libvlc_media_get_meta(p_md, e_meta):
5619 '''Read the meta of the media. 5620 If the media has not yet been parsed this will return None. 5621 See L{libvlc_media_parse} 5622 See L{libvlc_media_parse_with_options} 5623 See libvlc_MediaMetaChanged. 5624 @param p_md: the media descriptor. 5625 @param e_meta: the meta to read. 5626 @return: the media's meta. 5627 ''' 5628 f = _Cfunctions.get('libvlc_media_get_meta', None) or \ 5629 _Cfunction('libvlc_media_get_meta', ((1,), (1,),), string_result, 5630 ctypes.c_void_p, Media, Meta) 5631 return f(p_md, e_meta)
5632
5633 -def libvlc_media_set_meta(p_md, e_meta, psz_value):
5634 '''Set the meta of the media (this function will not save the meta, call 5635 L{libvlc_media_save_meta} in order to save the meta). 5636 @param p_md: the media descriptor. 5637 @param e_meta: the meta to write. 5638 @param psz_value: the media's meta. 5639 ''' 5640 f = _Cfunctions.get('libvlc_media_set_meta', None) or \ 5641 _Cfunction('libvlc_media_set_meta', ((1,), (1,), (1,),), None, 5642 None, Media, Meta, ctypes.c_char_p) 5643 return f(p_md, e_meta, psz_value)
5644
5645 -def libvlc_media_save_meta(p_md):
5646 '''Save the meta previously set. 5647 @param p_md: the media desriptor. 5648 @return: true if the write operation was successful. 5649 ''' 5650 f = _Cfunctions.get('libvlc_media_save_meta', None) or \ 5651 _Cfunction('libvlc_media_save_meta', ((1,),), None, 5652 ctypes.c_int, Media) 5653 return f(p_md)
5654
5655 -def libvlc_media_get_state(p_md):
5656 '''Get current state of media descriptor object. Possible media states are 5657 libvlc_NothingSpecial=0, libvlc_Opening, libvlc_Playing, libvlc_Paused, 5658 libvlc_Stopped, libvlc_Ended, libvlc_Error. 5659 See L{State}. 5660 @param p_md: a media descriptor object. 5661 @return: state of media descriptor object. 5662 ''' 5663 f = _Cfunctions.get('libvlc_media_get_state', None) or \ 5664 _Cfunction('libvlc_media_get_state', ((1,),), None, 5665 State, Media) 5666 return f(p_md)
5667
5668 -def libvlc_media_get_stats(p_md, p_stats):
5669 '''Get the current statistics about the media. 5670 @param p_md:: media descriptor object. 5671 @param p_stats:: structure that contain the statistics about the media (this structure must be allocated by the caller). 5672 @return: true if the statistics are available, false otherwise \libvlc_return_bool. 5673 ''' 5674 f = _Cfunctions.get('libvlc_media_get_stats', None) or \ 5675 _Cfunction('libvlc_media_get_stats', ((1,), (1,),), None, 5676 ctypes.c_int, Media, ctypes.POINTER(MediaStats)) 5677 return f(p_md, p_stats)
5678
5679 -def libvlc_media_subitems(p_md):
5680 '''Get subitems of media descriptor object. This will increment 5681 the reference count of supplied media descriptor object. Use 5682 L{libvlc_media_list_release}() to decrement the reference counting. 5683 @param p_md: media descriptor object. 5684 @return: list of media descriptor subitems or None. 5685 ''' 5686 f = _Cfunctions.get('libvlc_media_subitems', None) or \ 5687 _Cfunction('libvlc_media_subitems', ((1,),), class_result(MediaList), 5688 ctypes.c_void_p, Media) 5689 return f(p_md)
5690
5691 -def libvlc_media_event_manager(p_md):
5692 '''Get event manager from media descriptor object. 5693 NOTE: this function doesn't increment reference counting. 5694 @param p_md: a media descriptor object. 5695 @return: event manager object. 5696 ''' 5697 f = _Cfunctions.get('libvlc_media_event_manager', None) or \ 5698 _Cfunction('libvlc_media_event_manager', ((1,),), class_result(EventManager), 5699 ctypes.c_void_p, Media) 5700 return f(p_md)
5701
5702 -def libvlc_media_get_duration(p_md):
5703 '''Get duration (in ms) of media descriptor object item. 5704 @param p_md: media descriptor object. 5705 @return: duration of media item or -1 on error. 5706 ''' 5707 f = _Cfunctions.get('libvlc_media_get_duration', None) or \ 5708 _Cfunction('libvlc_media_get_duration', ((1,),), None, 5709 ctypes.c_longlong, Media) 5710 return f(p_md)
5711
5712 -def libvlc_media_parse_with_options(p_md, parse_flag, timeout):
5713 '''Parse the media asynchronously with options. 5714 This fetches (local or network) art, meta data and/or tracks information. 5715 This method is the extended version of L{libvlc_media_parse_with_options}(). 5716 To track when this is over you can listen to libvlc_MediaParsedChanged 5717 event. However if this functions returns an error, you will not receive any 5718 events. 5719 It uses a flag to specify parse options (see L{MediaParseFlag}). All 5720 these flags can be combined. By default, media is parsed if it's a local 5721 file. 5722 @note: Parsing can be aborted with L{libvlc_media_parse_stop}(). 5723 See libvlc_MediaParsedChanged 5724 See L{libvlc_media_get_meta} 5725 See L{libvlc_media_tracks_get} 5726 See L{libvlc_media_get_parsed_status} 5727 See L{MediaParseFlag}. 5728 @param p_md: media descriptor object. 5729 @param parse_flag: parse options: 5730 @param timeout: maximum time allowed to preparse the media. If -1, the default "preparse-timeout" option will be used as a timeout. If 0, it will wait indefinitely. If > 0, the timeout will be used (in milliseconds). 5731 @return: -1 in case of error, 0 otherwise. 5732 @version: LibVLC 3.0.0 or later. 5733 ''' 5734 f = _Cfunctions.get('libvlc_media_parse_with_options', None) or \ 5735 _Cfunction('libvlc_media_parse_with_options', ((1,), (1,), (1,),), None, 5736 ctypes.c_int, Media, MediaParseFlag, ctypes.c_int) 5737 return f(p_md, parse_flag, timeout)
5738
5739 -def libvlc_media_parse_stop(p_md):
5740 '''Stop the parsing of the media 5741 When the media parsing is stopped, the libvlc_MediaParsedChanged event will 5742 be sent with the libvlc_media_parsed_status_timeout status. 5743 See L{libvlc_media_parse_with_options}. 5744 @param p_md: media descriptor object. 5745 @version: LibVLC 3.0.0 or later. 5746 ''' 5747 f = _Cfunctions.get('libvlc_media_parse_stop', None) or \ 5748 _Cfunction('libvlc_media_parse_stop', ((1,),), None, 5749 None, Media) 5750 return f(p_md)
5751
5752 -def libvlc_media_get_parsed_status(p_md):
5753 '''Get Parsed status for media descriptor object. 5754 See libvlc_MediaParsedChanged 5755 See L{MediaParsedStatus}. 5756 @param p_md: media descriptor object. 5757 @return: a value of the L{MediaParsedStatus} enum. 5758 @version: LibVLC 3.0.0 or later. 5759 ''' 5760 f = _Cfunctions.get('libvlc_media_get_parsed_status', None) or \ 5761 _Cfunction('libvlc_media_get_parsed_status', ((1,),), None, 5762 MediaParsedStatus, Media) 5763 return f(p_md)
5764
5765 -def libvlc_media_set_user_data(p_md, p_new_user_data):
5766 '''Sets media descriptor's user_data. user_data is specialized data 5767 accessed by the host application, VLC.framework uses it as a pointer to 5768 an native object that references a L{Media} pointer. 5769 @param p_md: media descriptor object. 5770 @param p_new_user_data: pointer to user data. 5771 ''' 5772 f = _Cfunctions.get('libvlc_media_set_user_data', None) or \ 5773 _Cfunction('libvlc_media_set_user_data', ((1,), (1,),), None, 5774 None, Media, ctypes.c_void_p) 5775 return f(p_md, p_new_user_data)
5776
5777 -def libvlc_media_get_user_data(p_md):
5778 '''Get media descriptor's user_data. user_data is specialized data 5779 accessed by the host application, VLC.framework uses it as a pointer to 5780 an native object that references a L{Media} pointer. 5781 @param p_md: media descriptor object. 5782 ''' 5783 f = _Cfunctions.get('libvlc_media_get_user_data', None) or \ 5784 _Cfunction('libvlc_media_get_user_data', ((1,),), None, 5785 ctypes.c_void_p, Media) 5786 return f(p_md)
5787
5788 -def libvlc_media_tracks_get(p_md, tracks):
5789 '''Get media descriptor's elementary streams description 5790 Note, you need to call L{libvlc_media_parse}() or play the media at least once 5791 before calling this function. 5792 Not doing this will result in an empty array. 5793 @param p_md: media descriptor object. 5794 @param tracks: address to store an allocated array of Elementary Streams descriptions (must be freed with L{libvlc_media_tracks_release}. 5795 @return: the number of Elementary Streams (zero on error). 5796 @version: LibVLC 2.1.0 and later. 5797 ''' 5798 f = _Cfunctions.get('libvlc_media_tracks_get', None) or \ 5799 _Cfunction('libvlc_media_tracks_get', ((1,), (1,),), None, 5800 ctypes.c_uint, Media, ctypes.POINTER(ctypes.POINTER(MediaTrack))) 5801 return f(p_md, tracks)
5802
5803 -def libvlc_media_get_codec_description(i_type, i_codec):
5804 '''Get codec description from media elementary stream. 5805 @param i_type: i_type from L{MediaTrack}. 5806 @param i_codec: i_codec or i_original_fourcc from L{MediaTrack}. 5807 @return: codec description. 5808 @version: LibVLC 3.0.0 and later. See L{MediaTrack}. 5809 ''' 5810 f = _Cfunctions.get('libvlc_media_get_codec_description', None) or \ 5811 _Cfunction('libvlc_media_get_codec_description', ((1,), (1,),), None, 5812 ctypes.c_char_p, TrackType, ctypes.c_uint32) 5813 return f(i_type, i_codec)
5814
5815 -def libvlc_media_tracks_release(p_tracks, i_count):
5816 '''Release media descriptor's elementary streams description array. 5817 @param p_tracks: tracks info array to release. 5818 @param i_count: number of elements in the array. 5819 @version: LibVLC 2.1.0 and later. 5820 ''' 5821 f = _Cfunctions.get('libvlc_media_tracks_release', None) or \ 5822 _Cfunction('libvlc_media_tracks_release', ((1,), (1,),), None, 5823 None, ctypes.POINTER(MediaTrack), ctypes.c_uint) 5824 return f(p_tracks, i_count)
5825
5826 -def libvlc_media_get_type(p_md):
5827 '''Get the media type of the media descriptor object. 5828 @param p_md: media descriptor object. 5829 @return: media type. 5830 @version: LibVLC 3.0.0 and later. See L{MediaType}. 5831 ''' 5832 f = _Cfunctions.get('libvlc_media_get_type', None) or \ 5833 _Cfunction('libvlc_media_get_type', ((1,),), None, 5834 MediaType, Media) 5835 return f(p_md)
5836
5837 -def libvlc_media_slaves_add(p_md, i_type, i_priority, psz_uri):
5838 '''Add a slave to the current media. 5839 A slave is an external input source that may contains an additional subtitle 5840 track (like a .srt) or an additional audio track (like a .ac3). 5841 @note: This function must be called before the media is parsed (via 5842 L{libvlc_media_parse_with_options}()) or before the media is played (via 5843 L{libvlc_media_player_play}()). 5844 @param p_md: media descriptor object. 5845 @param i_type: subtitle or audio. 5846 @param i_priority: from 0 (low priority) to 4 (high priority). 5847 @param psz_uri: Uri of the slave (should contain a valid scheme). 5848 @return: 0 on success, -1 on error. 5849 @version: LibVLC 3.0.0 and later. 5850 ''' 5851 f = _Cfunctions.get('libvlc_media_slaves_add', None) or \ 5852 _Cfunction('libvlc_media_slaves_add', ((1,), (1,), (1,), (1,),), None, 5853 ctypes.c_int, Media, MediaSlaveType, ctypes.c_uint, ctypes.c_char_p) 5854 return f(p_md, i_type, i_priority, psz_uri)
5855
5856 -def libvlc_media_slaves_clear(p_md):
5857 '''Clear all slaves previously added by L{libvlc_media_slaves_add}() or 5858 internally. 5859 @param p_md: media descriptor object. 5860 @version: LibVLC 3.0.0 and later. 5861 ''' 5862 f = _Cfunctions.get('libvlc_media_slaves_clear', None) or \ 5863 _Cfunction('libvlc_media_slaves_clear', ((1,),), None, 5864 None, Media) 5865 return f(p_md)
5866
5867 -def libvlc_media_slaves_get(p_md, ppp_slaves):
5868 '''Get a media descriptor's slave list 5869 The list will contain slaves parsed by VLC or previously added by 5870 L{libvlc_media_slaves_add}(). The typical use case of this function is to save 5871 a list of slave in a database for a later use. 5872 @param p_md: media descriptor object. 5873 @param ppp_slaves: address to store an allocated array of slaves (must be freed with L{libvlc_media_slaves_release}()) [OUT]. 5874 @return: the number of slaves (zero on error). 5875 @version: LibVLC 3.0.0 and later. See L{libvlc_media_slaves_add}. 5876 ''' 5877 f = _Cfunctions.get('libvlc_media_slaves_get', None) or \ 5878 _Cfunction('libvlc_media_slaves_get', ((1,), (1,),), None, 5879 ctypes.c_uint, Media, ctypes.POINTER(ctypes.POINTER(MediaSlave))) 5880 return f(p_md, ppp_slaves)
5881
5882 -def libvlc_media_slaves_release(pp_slaves, i_count):
5883 '''Release a media descriptor's slave list. 5884 @param pp_slaves: slave array to release. 5885 @param i_count: number of elements in the array. 5886 @version: LibVLC 3.0.0 and later. 5887 ''' 5888 f = _Cfunctions.get('libvlc_media_slaves_release', None) or \ 5889 _Cfunction('libvlc_media_slaves_release', ((1,), (1,),), None, 5890 None, ctypes.POINTER(MediaSlave), ctypes.c_uint) 5891 return f(pp_slaves, i_count)
5892
5893 -def libvlc_renderer_item_hold(p_item):
5894 '''Hold a renderer item, i.e. creates a new reference 5895 This functions need to called from the libvlc_RendererDiscovererItemAdded 5896 callback if the libvlc user wants to use this item after. (for display or 5897 for passing it to the mediaplayer for example). 5898 @return: the current item. 5899 @version: LibVLC 3.0.0 or later. 5900 ''' 5901 f = _Cfunctions.get('libvlc_renderer_item_hold', None) or \ 5902 _Cfunction('libvlc_renderer_item_hold', ((1,),), class_result(Renderer), 5903 ctypes.c_void_p, Renderer) 5904 return f(p_item)
5905
5906 -def libvlc_renderer_item_release(p_item):
5907 '''Releases a renderer item, i.e. decrements its reference counter. 5908 @version: LibVLC 3.0.0 or later. 5909 ''' 5910 f = _Cfunctions.get('libvlc_renderer_item_release', None) or \ 5911 _Cfunction('libvlc_renderer_item_release', ((1,),), None, 5912 None, Renderer) 5913 return f(p_item)
5914
5915 -def libvlc_renderer_item_name(p_item):
5916 '''Get the human readable name of a renderer item. 5917 @return: the name of the item (can't be None, must *not* be freed). 5918 @version: LibVLC 3.0.0 or later. 5919 ''' 5920 f = _Cfunctions.get('libvlc_renderer_item_name', None) or \ 5921 _Cfunction('libvlc_renderer_item_name', ((1,),), None, 5922 ctypes.c_char_p, Renderer) 5923 return f(p_item)
5924
5925 -def libvlc_renderer_item_type(p_item):
5926 '''Get the type (not translated) of a renderer item. For now, the type can only 5927 be "chromecast" ("upnp", "airplay" may come later). 5928 @return: the type of the item (can't be None, must *not* be freed). 5929 @version: LibVLC 3.0.0 or later. 5930 ''' 5931 f = _Cfunctions.get('libvlc_renderer_item_type', None) or \ 5932 _Cfunction('libvlc_renderer_item_type', ((1,),), None, 5933 ctypes.c_char_p, Renderer) 5934 return f(p_item)
5935
5936 -def libvlc_renderer_item_icon_uri(p_item):
5937 '''Get the icon uri of a renderer item. 5938 @return: the uri of the item's icon (can be None, must *not* be freed). 5939 @version: LibVLC 3.0.0 or later. 5940 ''' 5941 f = _Cfunctions.get('libvlc_renderer_item_icon_uri', None) or \ 5942 _Cfunction('libvlc_renderer_item_icon_uri', ((1,),), None, 5943 ctypes.c_char_p, Renderer) 5944 return f(p_item)
5945
5946 -def libvlc_renderer_item_flags(p_item):
5947 '''Get the flags of a renderer item 5948 See LIBVLC_RENDERER_CAN_AUDIO 5949 See LIBVLC_RENDERER_CAN_VIDEO. 5950 @return: bitwise flag: capabilities of the renderer, see. 5951 @version: LibVLC 3.0.0 or later. 5952 ''' 5953 f = _Cfunctions.get('libvlc_renderer_item_flags', None) or \ 5954 _Cfunction('libvlc_renderer_item_flags', ((1,),), None, 5955 ctypes.c_int, Renderer) 5956 return f(p_item)
5957
5958 -def libvlc_renderer_discoverer_new(p_inst, psz_name):
5959 '''Create a renderer discoverer object by name 5960 After this object is created, you should attach to events in order to be 5961 notified of the discoverer events. 5962 You need to call L{libvlc_renderer_discoverer_start}() in order to start the 5963 discovery. 5964 See L{libvlc_renderer_discoverer_event_manager}() 5965 See L{libvlc_renderer_discoverer_start}(). 5966 @param p_inst: libvlc instance. 5967 @param psz_name: service name; use L{libvlc_renderer_discoverer_list_get}() to get a list of the discoverer names available in this libVLC instance. 5968 @return: media discover object or None in case of error. 5969 @version: LibVLC 3.0.0 or later. 5970 ''' 5971 f = _Cfunctions.get('libvlc_renderer_discoverer_new', None) or \ 5972 _Cfunction('libvlc_renderer_discoverer_new', ((1,), (1,),), class_result(RendererDiscoverer), 5973 ctypes.c_void_p, Instance, ctypes.c_char_p) 5974 return f(p_inst, psz_name)
5975
5976 -def libvlc_renderer_discoverer_release(p_rd):
5977 '''Release a renderer discoverer object. 5978 @param p_rd: renderer discoverer object. 5979 @version: LibVLC 3.0.0 or later. 5980 ''' 5981 f = _Cfunctions.get('libvlc_renderer_discoverer_release', None) or \ 5982 _Cfunction('libvlc_renderer_discoverer_release', ((1,),), None, 5983 None, RendererDiscoverer) 5984 return f(p_rd)
5985
5986 -def libvlc_renderer_discoverer_start(p_rd):
5987 '''Start renderer discovery 5988 To stop it, call L{libvlc_renderer_discoverer_stop}() or 5989 L{libvlc_renderer_discoverer_release}() directly. 5990 See L{libvlc_renderer_discoverer_stop}(). 5991 @param p_rd: renderer discoverer object. 5992 @return: -1 in case of error, 0 otherwise. 5993 @version: LibVLC 3.0.0 or later. 5994 ''' 5995 f = _Cfunctions.get('libvlc_renderer_discoverer_start', None) or \ 5996 _Cfunction('libvlc_renderer_discoverer_start', ((1,),), None, 5997 ctypes.c_int, RendererDiscoverer) 5998 return f(p_rd)
5999
6000 -def libvlc_renderer_discoverer_stop(p_rd):
6001 '''Stop renderer discovery. 6002 See L{libvlc_renderer_discoverer_start}(). 6003 @param p_rd: renderer discoverer object. 6004 @version: LibVLC 3.0.0 or later. 6005 ''' 6006 f = _Cfunctions.get('libvlc_renderer_discoverer_stop', None) or \ 6007 _Cfunction('libvlc_renderer_discoverer_stop', ((1,),), None, 6008 None, RendererDiscoverer) 6009 return f(p_rd)
6010
6011 -def libvlc_renderer_discoverer_event_manager(p_rd):
6012 '''Get the event manager of the renderer discoverer 6013 The possible events to attach are @ref libvlc_RendererDiscovererItemAdded 6014 and @ref libvlc_RendererDiscovererItemDeleted. 6015 The @ref L{Renderer} struct passed to event callbacks is owned by 6016 VLC, users should take care of holding/releasing this struct for their 6017 internal usage. 6018 See libvlc_event_t.u.renderer_discoverer_item_added.item 6019 See libvlc_event_t.u.renderer_discoverer_item_removed.item. 6020 @return: a valid event manager (can't fail). 6021 @version: LibVLC 3.0.0 or later. 6022 ''' 6023 f = _Cfunctions.get('libvlc_renderer_discoverer_event_manager', None) or \ 6024 _Cfunction('libvlc_renderer_discoverer_event_manager', ((1,),), class_result(EventManager), 6025 ctypes.c_void_p, RendererDiscoverer) 6026 return f(p_rd)
6027
6028 -def libvlc_renderer_discoverer_list_get(p_inst, ppp_services):
6029 '''Get media discoverer services 6030 See libvlc_renderer_list_release(). 6031 @param p_inst: libvlc instance. 6032 @param ppp_services: address to store an allocated array of renderer discoverer services (must be freed with libvlc_renderer_list_release() by the caller) [OUT]. 6033 @return: the number of media discoverer services (0 on error). 6034 @version: LibVLC 3.0.0 and later. 6035 ''' 6036 f = _Cfunctions.get('libvlc_renderer_discoverer_list_get', None) or \ 6037 _Cfunction('libvlc_renderer_discoverer_list_get', ((1,), (1,),), None, 6038 ctypes.c_size_t, Instance, ctypes.POINTER(ctypes.POINTER(RDDescription))) 6039 return f(p_inst, ppp_services)
6040
6041 -def libvlc_renderer_discoverer_list_release(pp_services, i_count):
6042 '''Release an array of media discoverer services 6043 See L{libvlc_renderer_discoverer_list_get}(). 6044 @param pp_services: array to release. 6045 @param i_count: number of elements in the array. 6046 @version: LibVLC 3.0.0 and later. 6047 ''' 6048 f = _Cfunctions.get('libvlc_renderer_discoverer_list_release', None) or \ 6049 _Cfunction('libvlc_renderer_discoverer_list_release', ((1,), (1,),), None, 6050 None, ctypes.POINTER(RDDescription), ctypes.c_size_t) 6051 return f(pp_services, i_count)
6052
6053 -def libvlc_media_list_new(p_instance):
6054 '''Create an empty media list. 6055 @param p_instance: libvlc instance. 6056 @return: empty media list, or None on error. 6057 ''' 6058 f = _Cfunctions.get('libvlc_media_list_new', None) or \ 6059 _Cfunction('libvlc_media_list_new', ((1,),), class_result(MediaList), 6060 ctypes.c_void_p, Instance) 6061 return f(p_instance)
6062
6063 -def libvlc_media_list_release(p_ml):
6064 '''Release media list created with L{libvlc_media_list_new}(). 6065 @param p_ml: a media list created with L{libvlc_media_list_new}(). 6066 ''' 6067 f = _Cfunctions.get('libvlc_media_list_release', None) or \ 6068 _Cfunction('libvlc_media_list_release', ((1,),), None, 6069 None, MediaList) 6070 return f(p_ml)
6071
6072 -def libvlc_media_list_retain(p_ml):
6073 '''Retain reference to a media list. 6074 @param p_ml: a media list created with L{libvlc_media_list_new}(). 6075 ''' 6076 f = _Cfunctions.get('libvlc_media_list_retain', None) or \ 6077 _Cfunction('libvlc_media_list_retain', ((1,),), None, 6078 None, MediaList) 6079 return f(p_ml)
6080
6081 -def libvlc_media_list_set_media(p_ml, p_md):
6082 '''Associate media instance with this media list instance. 6083 If another media instance was present it will be released. 6084 The L{libvlc_media_list_lock} should NOT be held upon entering this function. 6085 @param p_ml: a media list instance. 6086 @param p_md: media instance to add. 6087 ''' 6088 f = _Cfunctions.get('libvlc_media_list_set_media', None) or \ 6089 _Cfunction('libvlc_media_list_set_media', ((1,), (1,),), None, 6090 None, MediaList, Media) 6091 return f(p_ml, p_md)
6092
6093 -def libvlc_media_list_media(p_ml):
6094 '''Get media instance from this media list instance. This action will increase 6095 the refcount on the media instance. 6096 The L{libvlc_media_list_lock} should NOT be held upon entering this function. 6097 @param p_ml: a media list instance. 6098 @return: media instance. 6099 ''' 6100 f = _Cfunctions.get('libvlc_media_list_media', None) or \ 6101 _Cfunction('libvlc_media_list_media', ((1,),), class_result(Media), 6102 ctypes.c_void_p, MediaList) 6103 return f(p_ml)
6104
6105 -def libvlc_media_list_add_media(p_ml, p_md):
6106 '''Add media instance to media list 6107 The L{libvlc_media_list_lock} should be held upon entering this function. 6108 @param p_ml: a media list instance. 6109 @param p_md: a media instance. 6110 @return: 0 on success, -1 if the media list is read-only. 6111 ''' 6112 f = _Cfunctions.get('libvlc_media_list_add_media', None) or \ 6113 _Cfunction('libvlc_media_list_add_media', ((1,), (1,),), None, 6114 ctypes.c_int, MediaList, Media) 6115 return f(p_ml, p_md)
6116
6117 -def libvlc_media_list_insert_media(p_ml, p_md, i_pos):
6118 '''Insert media instance in media list on a position 6119 The L{libvlc_media_list_lock} should be held upon entering this function. 6120 @param p_ml: a media list instance. 6121 @param p_md: a media instance. 6122 @param i_pos: position in array where to insert. 6123 @return: 0 on success, -1 if the media list is read-only. 6124 ''' 6125 f = _Cfunctions.get('libvlc_media_list_insert_media', None) or \ 6126 _Cfunction('libvlc_media_list_insert_media', ((1,), (1,), (1,),), None, 6127 ctypes.c_int, MediaList, Media, ctypes.c_int) 6128 return f(p_ml, p_md, i_pos)
6129
6130 -def libvlc_media_list_remove_index(p_ml, i_pos):
6131 '''Remove media instance from media list on a position 6132 The L{libvlc_media_list_lock} should be held upon entering this function. 6133 @param p_ml: a media list instance. 6134 @param i_pos: position in array where to insert. 6135 @return: 0 on success, -1 if the list is read-only or the item was not found. 6136 ''' 6137 f = _Cfunctions.get('libvlc_media_list_remove_index', None) or \ 6138 _Cfunction('libvlc_media_list_remove_index', ((1,), (1,),), None, 6139 ctypes.c_int, MediaList, ctypes.c_int) 6140 return f(p_ml, i_pos)
6141
6142 -def libvlc_media_list_count(p_ml):
6143 '''Get count on media list items 6144 The L{libvlc_media_list_lock} should be held upon entering this function. 6145 @param p_ml: a media list instance. 6146 @return: number of items in media list. 6147 ''' 6148 f = _Cfunctions.get('libvlc_media_list_count', None) or \ 6149 _Cfunction('libvlc_media_list_count', ((1,),), None, 6150 ctypes.c_int, MediaList) 6151 return f(p_ml)
6152
6153 -def libvlc_media_list_item_at_index(p_ml, i_pos):
6154 '''List media instance in media list at a position 6155 The L{libvlc_media_list_lock} should be held upon entering this function. 6156 @param p_ml: a media list instance. 6157 @param i_pos: position in array where to insert. 6158 @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. 6159 ''' 6160 f = _Cfunctions.get('libvlc_media_list_item_at_index', None) or \ 6161 _Cfunction('libvlc_media_list_item_at_index', ((1,), (1,),), class_result(Media), 6162 ctypes.c_void_p, MediaList, ctypes.c_int) 6163 return f(p_ml, i_pos)
6164
6165 -def libvlc_media_list_index_of_item(p_ml, p_md):
6166 '''Find index position of List media instance in media list. 6167 Warning: the function will return the first matched position. 6168 The L{libvlc_media_list_lock} should be held upon entering this function. 6169 @param p_ml: a media list instance. 6170 @param p_md: media instance. 6171 @return: position of media instance or -1 if media not found. 6172 ''' 6173 f = _Cfunctions.get('libvlc_media_list_index_of_item', None) or \ 6174 _Cfunction('libvlc_media_list_index_of_item', ((1,), (1,),), None, 6175 ctypes.c_int, MediaList, Media) 6176 return f(p_ml, p_md)
6177
6178 -def libvlc_media_list_is_readonly(p_ml):
6179 '''This indicates if this media list is read-only from a user point of view. 6180 @param p_ml: media list instance. 6181 @return: 1 on readonly, 0 on readwrite \libvlc_return_bool. 6182 ''' 6183 f = _Cfunctions.get('libvlc_media_list_is_readonly', None) or \ 6184 _Cfunction('libvlc_media_list_is_readonly', ((1,),), None, 6185 ctypes.c_int, MediaList) 6186 return f(p_ml)
6187
6188 -def libvlc_media_list_lock(p_ml):
6189 '''Get lock on media list items. 6190 @param p_ml: a media list instance. 6191 ''' 6192 f = _Cfunctions.get('libvlc_media_list_lock', None) or \ 6193 _Cfunction('libvlc_media_list_lock', ((1,),), None, 6194 None, MediaList) 6195 return f(p_ml)
6196
6197 -def libvlc_media_list_unlock(p_ml):
6198 '''Release lock on media list items 6199 The L{libvlc_media_list_lock} should be held upon entering this function. 6200 @param p_ml: a media list instance. 6201 ''' 6202 f = _Cfunctions.get('libvlc_media_list_unlock', None) or \ 6203 _Cfunction('libvlc_media_list_unlock', ((1,),), None, 6204 None, MediaList) 6205 return f(p_ml)
6206
6207 -def libvlc_media_list_event_manager(p_ml):
6208 '''Get libvlc_event_manager from this media list instance. 6209 The p_event_manager is immutable, so you don't have to hold the lock. 6210 @param p_ml: a media list instance. 6211 @return: libvlc_event_manager. 6212 ''' 6213 f = _Cfunctions.get('libvlc_media_list_event_manager', None) or \ 6214 _Cfunction('libvlc_media_list_event_manager', ((1,),), class_result(EventManager), 6215 ctypes.c_void_p, MediaList) 6216 return f(p_ml)
6217
6218 -def libvlc_media_player_get_fps(p_mi):
6219 '''Get movie fps rate 6220 This function is provided for backward compatibility. It cannot deal with 6221 multiple video tracks. In LibVLC versions prior to 3.0, it would also fail 6222 if the file format did not convey the frame rate explicitly. 6223 \deprecated Consider using L{libvlc_media_tracks_get}() instead. 6224 @param p_mi: the Media Player. 6225 @return: frames per second (fps) for this playing movie, or 0 if unspecified. 6226 ''' 6227 f = _Cfunctions.get('libvlc_media_player_get_fps', None) or \ 6228 _Cfunction('libvlc_media_player_get_fps', ((1,),), None, 6229 ctypes.c_float, MediaPlayer) 6230 return f(p_mi)
6231
6232 -def libvlc_media_player_set_agl(p_mi, drawable):
6233 '''\deprecated Use L{libvlc_media_player_set_nsobject}() instead. 6234 ''' 6235 f = _Cfunctions.get('libvlc_media_player_set_agl', None) or \ 6236 _Cfunction('libvlc_media_player_set_agl', ((1,), (1,),), None, 6237 None, MediaPlayer, ctypes.c_uint32) 6238 return f(p_mi, drawable)
6239
6240 -def libvlc_media_player_get_agl(p_mi):
6241 '''\deprecated Use L{libvlc_media_player_get_nsobject}() instead. 6242 ''' 6243 f = _Cfunctions.get('libvlc_media_player_get_agl', None) or \ 6244 _Cfunction('libvlc_media_player_get_agl', ((1,),), None, 6245 ctypes.c_uint32, MediaPlayer) 6246 return f(p_mi)
6247
6248 -def libvlc_track_description_release(p_track_description):
6249 '''\deprecated Use L{libvlc_track_description_list_release}() instead. 6250 ''' 6251 f = _Cfunctions.get('libvlc_track_description_release', None) or \ 6252 _Cfunction('libvlc_track_description_release', ((1,),), None, 6253 None, ctypes.POINTER(TrackDescription)) 6254 return f(p_track_description)
6255
6256 -def libvlc_video_get_height(p_mi):
6257 '''Get current video height. 6258 \deprecated Use L{libvlc_video_get_size}() instead. 6259 @param p_mi: the media player. 6260 @return: the video pixel height or 0 if not applicable. 6261 ''' 6262 f = _Cfunctions.get('libvlc_video_get_height', None) or \ 6263 _Cfunction('libvlc_video_get_height', ((1,),), None, 6264 ctypes.c_int, MediaPlayer) 6265 return f(p_mi)
6266
6267 -def libvlc_video_get_width(p_mi):
6268 '''Get current video width. 6269 \deprecated Use L{libvlc_video_get_size}() instead. 6270 @param p_mi: the media player. 6271 @return: the video pixel width or 0 if not applicable. 6272 ''' 6273 f = _Cfunctions.get('libvlc_video_get_width', None) or \ 6274 _Cfunction('libvlc_video_get_width', ((1,),), None, 6275 ctypes.c_int, MediaPlayer) 6276 return f(p_mi)
6277
6278 -def libvlc_video_get_title_description(p_mi):
6279 '''Get the description of available titles. 6280 @param p_mi: the media player. 6281 @return: list containing description of available titles. It must be freed with L{libvlc_track_description_list_release}(). 6282 ''' 6283 f = _Cfunctions.get('libvlc_video_get_title_description', None) or \ 6284 _Cfunction('libvlc_video_get_title_description', ((1,),), None, 6285 ctypes.POINTER(TrackDescription), MediaPlayer) 6286 return f(p_mi)
6287
6288 -def libvlc_video_get_chapter_description(p_mi, i_title):
6289 '''Get the description of available chapters for specific title. 6290 @param p_mi: the media player. 6291 @param i_title: selected title. 6292 @return: list containing description of available chapter for title i_title. It must be freed with L{libvlc_track_description_list_release}(). 6293 ''' 6294 f = _Cfunctions.get('libvlc_video_get_chapter_description', None) or \ 6295 _Cfunction('libvlc_video_get_chapter_description', ((1,), (1,),), None, 6296 ctypes.POINTER(TrackDescription), MediaPlayer, ctypes.c_int) 6297 return f(p_mi, i_title)
6298
6299 -def libvlc_video_set_subtitle_file(p_mi, psz_subtitle):
6300 '''Set new video subtitle file. 6301 \deprecated Use L{libvlc_media_player_add_slave}() instead. 6302 @param p_mi: the media player. 6303 @param psz_subtitle: new video subtitle file. 6304 @return: the success status (boolean). 6305 ''' 6306 f = _Cfunctions.get('libvlc_video_set_subtitle_file', None) or \ 6307 _Cfunction('libvlc_video_set_subtitle_file', ((1,), (1,),), None, 6308 ctypes.c_int, MediaPlayer, ctypes.c_char_p) 6309 return f(p_mi, psz_subtitle)
6310
6311 -def libvlc_toggle_teletext(p_mi):
6312 '''Toggle teletext transparent status on video output. 6313 \deprecated use L{libvlc_video_set_teletext}() instead. 6314 @param p_mi: the media player. 6315 ''' 6316 f = _Cfunctions.get('libvlc_toggle_teletext', None) or \ 6317 _Cfunction('libvlc_toggle_teletext', ((1,),), None, 6318 None, MediaPlayer) 6319 return f(p_mi)
6320
6321 -def libvlc_audio_output_device_count(p_instance, psz_audio_output):
6322 '''Backward compatibility stub. Do not use in new code. 6323 \deprecated Use L{libvlc_audio_output_device_list_get}() instead. 6324 @return: always 0. 6325 ''' 6326 f = _Cfunctions.get('libvlc_audio_output_device_count', None) or \ 6327 _Cfunction('libvlc_audio_output_device_count', ((1,), (1,),), None, 6328 ctypes.c_int, Instance, ctypes.c_char_p) 6329 return f(p_instance, psz_audio_output)
6330
6331 -def libvlc_audio_output_device_longname(p_instance, psz_output, i_device):
6332 '''Backward compatibility stub. Do not use in new code. 6333 \deprecated Use L{libvlc_audio_output_device_list_get}() instead. 6334 @return: always None. 6335 ''' 6336 f = _Cfunctions.get('libvlc_audio_output_device_longname', None) or \ 6337 _Cfunction('libvlc_audio_output_device_longname', ((1,), (1,), (1,),), string_result, 6338 ctypes.c_void_p, Instance, ctypes.c_char_p, ctypes.c_int) 6339 return f(p_instance, psz_output, i_device)
6340
6341 -def libvlc_audio_output_device_id(p_instance, psz_audio_output, i_device):
6342 '''Backward compatibility stub. Do not use in new code. 6343 \deprecated Use L{libvlc_audio_output_device_list_get}() instead. 6344 @return: always None. 6345 ''' 6346 f = _Cfunctions.get('libvlc_audio_output_device_id', None) or \ 6347 _Cfunction('libvlc_audio_output_device_id', ((1,), (1,), (1,),), string_result, 6348 ctypes.c_void_p, Instance, ctypes.c_char_p, ctypes.c_int) 6349 return f(p_instance, psz_audio_output, i_device)
6350
6351 -def libvlc_media_parse(p_md):
6352 '''Parse a media. 6353 This fetches (local) art, meta data and tracks information. 6354 The method is synchronous. 6355 \deprecated This function could block indefinitely. 6356 Use L{libvlc_media_parse_with_options}() instead 6357 See L{libvlc_media_parse_with_options} 6358 See L{libvlc_media_get_meta} 6359 See L{libvlc_media_get_tracks_info}. 6360 @param p_md: media descriptor object. 6361 ''' 6362 f = _Cfunctions.get('libvlc_media_parse', None) or \ 6363 _Cfunction('libvlc_media_parse', ((1,),), None, 6364 None, Media) 6365 return f(p_md)
6366
6367 -def libvlc_media_parse_async(p_md):
6368 '''Parse a media. 6369 This fetches (local) art, meta data and tracks information. 6370 The method is the asynchronous of L{libvlc_media_parse}(). 6371 To track when this is over you can listen to libvlc_MediaParsedChanged 6372 event. However if the media was already parsed you will not receive this 6373 event. 6374 \deprecated You can't be sure to receive the libvlc_MediaParsedChanged 6375 event (you can wait indefinitely for this event). 6376 Use L{libvlc_media_parse_with_options}() instead 6377 See L{libvlc_media_parse} 6378 See libvlc_MediaParsedChanged 6379 See L{libvlc_media_get_meta} 6380 See L{libvlc_media_get_tracks_info}. 6381 @param p_md: media descriptor object. 6382 ''' 6383 f = _Cfunctions.get('libvlc_media_parse_async', None) or \ 6384 _Cfunction('libvlc_media_parse_async', ((1,),), None, 6385 None, Media) 6386 return f(p_md)
6387
6388 -def libvlc_media_is_parsed(p_md):
6389 '''Return true is the media descriptor object is parsed 6390 \deprecated This can return true in case of failure. 6391 Use L{libvlc_media_get_parsed_status}() instead 6392 See libvlc_MediaParsedChanged. 6393 @param p_md: media descriptor object. 6394 @return: true if media object has been parsed otherwise it returns false \libvlc_return_bool. 6395 ''' 6396 f = _Cfunctions.get('libvlc_media_is_parsed', None) or \ 6397 _Cfunction('libvlc_media_is_parsed', ((1,),), None, 6398 ctypes.c_int, Media) 6399 return f(p_md)
6400
6401 -def libvlc_media_get_tracks_info(p_md):
6402 '''Get media descriptor's elementary streams description 6403 Note, you need to call L{libvlc_media_parse}() or play the media at least once 6404 before calling this function. 6405 Not doing this will result in an empty array. 6406 \deprecated Use L{libvlc_media_tracks_get}() instead. 6407 @param p_md: media descriptor object. 6408 @param tracks: address to store an allocated array of Elementary Streams descriptions (must be freed by the caller) [OUT]. 6409 @return: the number of Elementary Streams. 6410 ''' 6411 f = _Cfunctions.get('libvlc_media_get_tracks_info', None) or \ 6412 _Cfunction('libvlc_media_get_tracks_info', ((1,), (2,),), None, 6413 ctypes.c_int, Media, ctypes.POINTER(ctypes.c_void_p)) 6414 return f(p_md)
6415
6416 -def libvlc_media_discoverer_new_from_name(p_inst, psz_name):
6417 '''\deprecated Use L{libvlc_media_discoverer_new}() and L{libvlc_media_discoverer_start}(). 6418 ''' 6419 f = _Cfunctions.get('libvlc_media_discoverer_new_from_name', None) or \ 6420 _Cfunction('libvlc_media_discoverer_new_from_name', ((1,), (1,),), class_result(MediaDiscoverer), 6421 ctypes.c_void_p, Instance, ctypes.c_char_p) 6422 return f(p_inst, psz_name)
6423
6424 -def libvlc_media_discoverer_localized_name(p_mdis):
6425 '''Get media service discover object its localized name. 6426 \deprecated Useless, use L{libvlc_media_discoverer_list_get}() to get the 6427 longname of the service discovery. 6428 @param p_mdis: media discover object. 6429 @return: localized name or None if the media_discoverer is not started. 6430 ''' 6431 f = _Cfunctions.get('libvlc_media_discoverer_localized_name', None) or \ 6432 _Cfunction('libvlc_media_discoverer_localized_name', ((1,),), string_result, 6433 ctypes.c_void_p, MediaDiscoverer) 6434 return f(p_mdis)
6435
6436 -def libvlc_media_discoverer_event_manager(p_mdis):
6437 '''Get event manager from media service discover object. 6438 \deprecated Useless, media_discoverer events are only triggered when calling 6439 L{libvlc_media_discoverer_start}() and L{libvlc_media_discoverer_stop}(). 6440 @param p_mdis: media service discover object. 6441 @return: event manager object. 6442 ''' 6443 f = _Cfunctions.get('libvlc_media_discoverer_event_manager', None) or \ 6444 _Cfunction('libvlc_media_discoverer_event_manager', ((1,),), class_result(EventManager), 6445 ctypes.c_void_p, MediaDiscoverer) 6446 return f(p_mdis)
6447
6448 -def libvlc_wait(p_instance):
6449 '''Waits until an interface causes the instance to exit. 6450 You should start at least one interface first, using L{libvlc_add_intf}(). 6451 @param p_instance: the instance @warning This function wastes one thread doing basically nothing. libvlc_set_exit_handler() should be used instead. 6452 ''' 6453 f = _Cfunctions.get('libvlc_wait', None) or \ 6454 _Cfunction('libvlc_wait', ((1,),), None, 6455 None, Instance) 6456 return f(p_instance)
6457
6458 -def libvlc_get_log_verbosity(p_instance):
6459 '''Always returns minus one. 6460 This function is only provided for backward compatibility. 6461 @param p_instance: ignored. 6462 @return: always -1. 6463 ''' 6464 f = _Cfunctions.get('libvlc_get_log_verbosity', None) or \ 6465 _Cfunction('libvlc_get_log_verbosity', ((1,),), None, 6466 ctypes.c_uint, Instance) 6467 return f(p_instance)
6468
6469 -def libvlc_set_log_verbosity(p_instance, level):
6470 '''This function does nothing. 6471 It is only provided for backward compatibility. 6472 @param p_instance: ignored. 6473 @param level: ignored. 6474 ''' 6475 f = _Cfunctions.get('libvlc_set_log_verbosity', None) or \ 6476 _Cfunction('libvlc_set_log_verbosity', ((1,), (1,),), None, 6477 None, Instance, ctypes.c_uint) 6478 return f(p_instance, level)
6479
6480 -def libvlc_log_open(p_instance):
6481 '''This function does nothing useful. 6482 It is only provided for backward compatibility. 6483 @param p_instance: libvlc instance. 6484 @return: an unique pointer or None on error. 6485 ''' 6486 f = _Cfunctions.get('libvlc_log_open', None) or \ 6487 _Cfunction('libvlc_log_open', ((1,),), None, 6488 Log_ptr, Instance) 6489 return f(p_instance)
6490
6491 -def libvlc_log_close(p_log):
6492 '''Frees memory allocated by L{libvlc_log_open}(). 6493 @param p_log: libvlc log instance or None. 6494 ''' 6495 f = _Cfunctions.get('libvlc_log_close', None) or \ 6496 _Cfunction('libvlc_log_close', ((1,),), None, 6497 None, Log_ptr) 6498 return f(p_log)
6499
6500 -def libvlc_log_count(p_log):
6501 '''Always returns zero. 6502 This function is only provided for backward compatibility. 6503 @param p_log: ignored. 6504 @return: always zero. 6505 ''' 6506 f = _Cfunctions.get('libvlc_log_count', None) or \ 6507 _Cfunction('libvlc_log_count', ((1,),), None, 6508 ctypes.c_uint, Log_ptr) 6509 return f(p_log)
6510
6511 -def libvlc_log_clear(p_log):
6512 '''This function does nothing. 6513 It is only provided for backward compatibility. 6514 @param p_log: ignored. 6515 ''' 6516 f = _Cfunctions.get('libvlc_log_clear', None) or \ 6517 _Cfunction('libvlc_log_clear', ((1,),), None, 6518 None, Log_ptr) 6519 return f(p_log)
6520
6521 -def libvlc_log_get_iterator(p_log):
6522 '''This function does nothing useful. 6523 It is only provided for backward compatibility. 6524 @param p_log: ignored. 6525 @return: an unique pointer or None on error or if the parameter was None. 6526 ''' 6527 f = _Cfunctions.get('libvlc_log_get_iterator', None) or \ 6528 _Cfunction('libvlc_log_get_iterator', ((1,),), class_result(LogIterator), 6529 ctypes.c_void_p, Log_ptr) 6530 return f(p_log)
6531
6532 -def libvlc_log_iterator_free(p_iter):
6533 '''Frees memory allocated by L{libvlc_log_get_iterator}(). 6534 @param p_iter: libvlc log iterator or None. 6535 ''' 6536 f = _Cfunctions.get('libvlc_log_iterator_free', None) or \ 6537 _Cfunction('libvlc_log_iterator_free', ((1,),), None, 6538 None, LogIterator) 6539 return f(p_iter)
6540
6541 -def libvlc_log_iterator_has_next(p_iter):
6542 '''Always returns zero. 6543 This function is only provided for backward compatibility. 6544 @param p_iter: ignored. 6545 @return: always zero. 6546 ''' 6547 f = _Cfunctions.get('libvlc_log_iterator_has_next', None) or \ 6548 _Cfunction('libvlc_log_iterator_has_next', ((1,),), None, 6549 ctypes.c_int, LogIterator) 6550 return f(p_iter)
6551
6552 -def libvlc_log_iterator_next(p_iter, p_buf):
6553 '''Always returns None. 6554 This function is only provided for backward compatibility. 6555 @param p_iter: libvlc log iterator or None. 6556 @param p_buf: ignored. 6557 @return: always None. 6558 ''' 6559 f = _Cfunctions.get('libvlc_log_iterator_next', None) or \ 6560 _Cfunction('libvlc_log_iterator_next', ((1,), (1,),), None, 6561 ctypes.POINTER(LogMessage), LogIterator, ctypes.POINTER(LogMessage)) 6562 return f(p_iter, p_buf)
6563
6564 -def libvlc_playlist_play(p_instance, i_id, i_options, ppsz_options):
6565 '''Start playing (if there is any item in the playlist). 6566 Additionnal playlist item options can be specified for addition to the 6567 item before it is played. 6568 @param p_instance: the playlist instance. 6569 @param i_id: the item to play. If this is a negative number, the next item will be selected. Otherwise, the item with the given ID will be played. 6570 @param i_options: the number of options to add to the item. 6571 @param ppsz_options: the options to add to the item. 6572 ''' 6573 f = _Cfunctions.get('libvlc_playlist_play', None) or \ 6574 _Cfunction('libvlc_playlist_play', ((1,), (1,), (1,), (1,),), None, 6575 None, Instance, ctypes.c_int, ctypes.c_int, ListPOINTER(ctypes.c_char_p)) 6576 return f(p_instance, i_id, i_options, ppsz_options)
6577
6578 -def libvlc_media_player_new(p_libvlc_instance):
6579 '''Create an empty Media Player object. 6580 @param p_libvlc_instance: the libvlc instance in which the Media Player should be created. 6581 @return: a new media player object, or None on error. 6582 ''' 6583 f = _Cfunctions.get('libvlc_media_player_new', None) or \ 6584 _Cfunction('libvlc_media_player_new', ((1,),), class_result(MediaPlayer), 6585 ctypes.c_void_p, Instance) 6586 return f(p_libvlc_instance)
6587
6588 -def libvlc_media_player_new_from_media(p_md):
6589 '''Create a Media Player object from a Media. 6590 @param p_md: the media. Afterwards the p_md can be safely destroyed. 6591 @return: a new media player object, or None on error. 6592 ''' 6593 f = _Cfunctions.get('libvlc_media_player_new_from_media', None) or \ 6594 _Cfunction('libvlc_media_player_new_from_media', ((1,),), class_result(MediaPlayer), 6595 ctypes.c_void_p, Media) 6596 return f(p_md)
6597
6598 -def libvlc_media_player_release(p_mi):
6599 '''Release a media_player after use 6600 Decrement the reference count of a media player object. If the 6601 reference count is 0, then L{libvlc_media_player_release}() will 6602 release the media player object. If the media player object 6603 has been released, then it should not be used again. 6604 @param p_mi: the Media Player to free. 6605 ''' 6606 f = _Cfunctions.get('libvlc_media_player_release', None) or \ 6607 _Cfunction('libvlc_media_player_release', ((1,),), None, 6608 None, MediaPlayer) 6609 return f(p_mi)
6610
6611 -def libvlc_media_player_retain(p_mi):
6612 '''Retain a reference to a media player object. Use 6613 L{libvlc_media_player_release}() to decrement reference count. 6614 @param p_mi: media player object. 6615 ''' 6616 f = _Cfunctions.get('libvlc_media_player_retain', None) or \ 6617 _Cfunction('libvlc_media_player_retain', ((1,),), None, 6618 None, MediaPlayer) 6619 return f(p_mi)
6620
6621 -def libvlc_media_player_set_media(p_mi, p_md):
6622 '''Set the media that will be used by the media_player. If any, 6623 previous md will be released. 6624 @param p_mi: the Media Player. 6625 @param p_md: the Media. Afterwards the p_md can be safely destroyed. 6626 ''' 6627 f = _Cfunctions.get('libvlc_media_player_set_media', None) or \ 6628 _Cfunction('libvlc_media_player_set_media', ((1,), (1,),), None, 6629 None, MediaPlayer, Media) 6630 return f(p_mi, p_md)
6631
6632 -def libvlc_media_player_get_media(p_mi):
6633 '''Get the media used by the media_player. 6634 @param p_mi: the Media Player. 6635 @return: the media associated with p_mi, or None if no media is associated. 6636 ''' 6637 f = _Cfunctions.get('libvlc_media_player_get_media', None) or \ 6638 _Cfunction('libvlc_media_player_get_media', ((1,),), class_result(Media), 6639 ctypes.c_void_p, MediaPlayer) 6640 return f(p_mi)
6641
6642 -def libvlc_media_player_event_manager(p_mi):
6643 '''Get the Event Manager from which the media player send event. 6644 @param p_mi: the Media Player. 6645 @return: the event manager associated with p_mi. 6646 ''' 6647 f = _Cfunctions.get('libvlc_media_player_event_manager', None) or \ 6648 _Cfunction('libvlc_media_player_event_manager', ((1,),), class_result(EventManager), 6649 ctypes.c_void_p, MediaPlayer) 6650 return f(p_mi)
6651
6652 -def libvlc_media_player_is_playing(p_mi):
6653 '''is_playing. 6654 @param p_mi: the Media Player. 6655 @return: 1 if the media player is playing, 0 otherwise \libvlc_return_bool. 6656 ''' 6657 f = _Cfunctions.get('libvlc_media_player_is_playing', None) or \ 6658 _Cfunction('libvlc_media_player_is_playing', ((1,),), None, 6659 ctypes.c_int, MediaPlayer) 6660 return f(p_mi)
6661
6662 -def libvlc_media_player_play(p_mi):
6663 '''Play. 6664 @param p_mi: the Media Player. 6665 @return: 0 if playback started (and was already started), or -1 on error. 6666 ''' 6667 f = _Cfunctions.get('libvlc_media_player_play', None) or \ 6668 _Cfunction('libvlc_media_player_play', ((1,),), None, 6669 ctypes.c_int, MediaPlayer) 6670 return f(p_mi)
6671
6672 -def libvlc_media_player_set_pause(mp, do_pause):
6673 '''Pause or resume (no effect if there is no media). 6674 @param mp: the Media Player. 6675 @param do_pause: play/resume if zero, pause if non-zero. 6676 @version: LibVLC 1.1.1 or later. 6677 ''' 6678 f = _Cfunctions.get('libvlc_media_player_set_pause', None) or \ 6679 _Cfunction('libvlc_media_player_set_pause', ((1,), (1,),), None, 6680 None, MediaPlayer, ctypes.c_int) 6681 return f(mp, do_pause)
6682
6683 -def libvlc_media_player_pause(p_mi):
6684 '''Toggle pause (no effect if there is no media). 6685 @param p_mi: the Media Player. 6686 ''' 6687 f = _Cfunctions.get('libvlc_media_player_pause', None) or \ 6688 _Cfunction('libvlc_media_player_pause', ((1,),), None, 6689 None, MediaPlayer) 6690 return f(p_mi)
6691
6692 -def libvlc_media_player_stop(p_mi):
6693 '''Stop (no effect if there is no media). 6694 @param p_mi: the Media Player. 6695 ''' 6696 f = _Cfunctions.get('libvlc_media_player_stop', None) or \ 6697 _Cfunction('libvlc_media_player_stop', ((1,),), None, 6698 None, MediaPlayer) 6699 return f(p_mi)
6700
6701 -def libvlc_media_player_set_renderer(p_mi, p_item):
6702 '''Set a renderer to the media player 6703 @note: must be called before the first call of L{libvlc_media_player_play}() to 6704 take effect. 6705 See L{libvlc_renderer_discoverer_new}. 6706 @param p_mi: the Media Player. 6707 @param p_item: an item discovered by L{libvlc_renderer_discoverer_start}(). 6708 @return: 0 on success, -1 on error. 6709 @version: LibVLC 3.0.0 or later. 6710 ''' 6711 f = _Cfunctions.get('libvlc_media_player_set_renderer', None) or \ 6712 _Cfunction('libvlc_media_player_set_renderer', ((1,), (1,),), None, 6713 ctypes.c_int, MediaPlayer, Renderer) 6714 return f(p_mi, p_item)
6715
6716 -def libvlc_video_set_callbacks(mp, lock, unlock, display, opaque):
6717 '''Set callbacks and private data to render decoded video to a custom area 6718 in memory. 6719 Use L{libvlc_video_set_format}() or L{libvlc_video_set_format_callbacks}() 6720 to configure the decoded format. 6721 @warning: Rendering video into custom memory buffers is considerably less 6722 efficient than rendering in a custom window as normal. 6723 For optimal perfomances, VLC media player renders into a custom window, and 6724 does not use this function and associated callbacks. It is B{highly 6725 recommended} that other LibVLC-based application do likewise. 6726 To embed video in a window, use libvlc_media_player_set_xid() or equivalent 6727 depending on the operating system. 6728 If window embedding does not fit the application use case, then a custom 6729 LibVLC video output display plugin is required to maintain optimal video 6730 rendering performances. 6731 The following limitations affect performance: 6732 - Hardware video decoding acceleration will either be disabled completely, 6733 or require (relatively slow) copy from video/DSP memory to main memory. 6734 - Sub-pictures (subtitles, on-screen display, etc.) must be blent into the 6735 main picture by the CPU instead of the GPU. 6736 - Depending on the video format, pixel format conversion, picture scaling, 6737 cropping and/or picture re-orientation, must be performed by the CPU 6738 instead of the GPU. 6739 - Memory copying is required between LibVLC reference picture buffers and 6740 application buffers (between lock and unlock callbacks). 6741 @param mp: the media player. 6742 @param lock: callback to lock video memory (must not be None). 6743 @param unlock: callback to unlock video memory (or None if not needed). 6744 @param display: callback to display video (or None if not needed). 6745 @param opaque: private pointer for the three callbacks (as first parameter). 6746 @version: LibVLC 1.1.1 or later. 6747 ''' 6748 f = _Cfunctions.get('libvlc_video_set_callbacks', None) or \ 6749 _Cfunction('libvlc_video_set_callbacks', ((1,), (1,), (1,), (1,), (1,),), None, 6750 None, MediaPlayer, VideoLockCb, VideoUnlockCb, VideoDisplayCb, ctypes.c_void_p) 6751 return f(mp, lock, unlock, display, opaque)
6752
6753 -def libvlc_video_set_format(mp, chroma, width, height, pitch):
6754 '''Set decoded video chroma and dimensions. 6755 This only works in combination with L{libvlc_video_set_callbacks}(), 6756 and is mutually exclusive with L{libvlc_video_set_format_callbacks}(). 6757 @param mp: the media player. 6758 @param chroma: a four-characters string identifying the chroma (e.g. "RV32" or "YUYV"). 6759 @param width: pixel width. 6760 @param height: pixel height. 6761 @param pitch: line pitch (in bytes). 6762 @version: LibVLC 1.1.1 or later. 6763 @bug: All pixel planes are expected to have the same pitch. To use the YCbCr color space with chrominance subsampling, consider using L{libvlc_video_set_format_callbacks}() instead. 6764 ''' 6765 f = _Cfunctions.get('libvlc_video_set_format', None) or \ 6766 _Cfunction('libvlc_video_set_format', ((1,), (1,), (1,), (1,), (1,),), None, 6767 None, MediaPlayer, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint) 6768 return f(mp, chroma, width, height, pitch)
6769
6770 -def libvlc_video_set_format_callbacks(mp, setup, cleanup):
6771 '''Set decoded video chroma and dimensions. This only works in combination with 6772 L{libvlc_video_set_callbacks}(). 6773 @param mp: the media player. 6774 @param setup: callback to select the video format (cannot be None). 6775 @param cleanup: callback to release any allocated resources (or None). 6776 @version: LibVLC 2.0.0 or later. 6777 ''' 6778 f = _Cfunctions.get('libvlc_video_set_format_callbacks', None) or \ 6779 _Cfunction('libvlc_video_set_format_callbacks', ((1,), (1,), (1,),), None, 6780 None, MediaPlayer, VideoFormatCb, VideoCleanupCb) 6781 return f(mp, setup, cleanup)
6782
6783 -def libvlc_media_player_set_nsobject(p_mi, drawable):
6784 '''Set the NSView handler where the media player should render its video output. 6785 Use the vout called "macosx". 6786 The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding 6787 protocol: 6788 @code.m 6789 \@protocol VLCOpenGLVideoViewEmbedding <NSObject> 6790 - (void)addVoutSubview:(NSView *)view; 6791 - (void)removeVoutSubview:(NSView *)view; 6792 \@end 6793 @endcode 6794 Or it can be an NSView object. 6795 If you want to use it along with Qt see the QMacCocoaViewContainer. Then 6796 the following code should work: 6797 @code.mm 6798 6799 NSView *video = [[NSView alloc] init]; 6800 QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent); 6801 L{libvlc_media_player_set_nsobject}(mp, video); 6802 [video release]; 6803 6804 @endcode 6805 You can find a live example in VLCVideoView in VLCKit.framework. 6806 @param p_mi: the Media Player. 6807 @param drawable: the drawable that is either an NSView or an object following the VLCOpenGLVideoViewEmbedding protocol. 6808 ''' 6809 f = _Cfunctions.get('libvlc_media_player_set_nsobject', None) or \ 6810 _Cfunction('libvlc_media_player_set_nsobject', ((1,), (1,),), None, 6811 None, MediaPlayer, ctypes.c_void_p) 6812 return f(p_mi, drawable)
6813
6814 -def libvlc_media_player_get_nsobject(p_mi):
6815 '''Get the NSView handler previously set with L{libvlc_media_player_set_nsobject}(). 6816 @param p_mi: the Media Player. 6817 @return: the NSView handler or 0 if none where set. 6818 ''' 6819 f = _Cfunctions.get('libvlc_media_player_get_nsobject', None) or \ 6820 _Cfunction('libvlc_media_player_get_nsobject', ((1,),), None, 6821 ctypes.c_void_p, MediaPlayer) 6822 return f(p_mi)
6823
6824 -def libvlc_media_player_set_xwindow(p_mi, drawable):
6825 '''Set an X Window System drawable where the media player should render its 6826 video output. The call takes effect when the playback starts. If it is 6827 already started, it might need to be stopped before changes apply. 6828 If LibVLC was built without X11 output support, then this function has no 6829 effects. 6830 By default, LibVLC will capture input events on the video rendering area. 6831 Use L{libvlc_video_set_mouse_input}() and L{libvlc_video_set_key_input}() to 6832 disable that and deliver events to the parent window / to the application 6833 instead. By design, the X11 protocol delivers input events to only one 6834 recipient. 6835 @warning 6836 The application must call the XInitThreads() function from Xlib before 6837 L{libvlc_new}(), and before any call to XOpenDisplay() directly or via any 6838 other library. Failure to call XInitThreads() will seriously impede LibVLC 6839 performance. Calling XOpenDisplay() before XInitThreads() will eventually 6840 crash the process. That is a limitation of Xlib. 6841 @param p_mi: media player. 6842 @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. 6843 @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. 6844 ''' 6845 f = _Cfunctions.get('libvlc_media_player_set_xwindow', None) or \ 6846 _Cfunction('libvlc_media_player_set_xwindow', ((1,), (1,),), None, 6847 None, MediaPlayer, ctypes.c_uint32) 6848 return f(p_mi, drawable)
6849
6850 -def libvlc_media_player_get_xwindow(p_mi):
6851 '''Get the X Window System window identifier previously set with 6852 L{libvlc_media_player_set_xwindow}(). Note that this will return the identifier 6853 even if VLC is not currently using it (for instance if it is playing an 6854 audio-only input). 6855 @param p_mi: the Media Player. 6856 @return: an X window ID, or 0 if none where set. 6857 ''' 6858 f = _Cfunctions.get('libvlc_media_player_get_xwindow', None) or \ 6859 _Cfunction('libvlc_media_player_get_xwindow', ((1,),), None, 6860 ctypes.c_uint32, MediaPlayer) 6861 return f(p_mi)
6862
6863 -def libvlc_media_player_set_hwnd(p_mi, drawable):
6864 '''Set a Win32/Win64 API window handle (HWND) where the media player should 6865 render its video output. If LibVLC was built without Win32/Win64 API output 6866 support, then this has no effects. 6867 @param p_mi: the Media Player. 6868 @param drawable: windows handle of the drawable. 6869 ''' 6870 f = _Cfunctions.get('libvlc_media_player_set_hwnd', None) or \ 6871 _Cfunction('libvlc_media_player_set_hwnd', ((1,), (1,),), None, 6872 None, MediaPlayer, ctypes.c_void_p) 6873 return f(p_mi, drawable)
6874
6875 -def libvlc_media_player_get_hwnd(p_mi):
6876 '''Get the Windows API window handle (HWND) previously set with 6877 L{libvlc_media_player_set_hwnd}(). The handle will be returned even if LibVLC 6878 is not currently outputting any video to it. 6879 @param p_mi: the Media Player. 6880 @return: a window handle or None if there are none. 6881 ''' 6882 f = _Cfunctions.get('libvlc_media_player_get_hwnd', None) or \ 6883 _Cfunction('libvlc_media_player_get_hwnd', ((1,),), None, 6884 ctypes.c_void_p, MediaPlayer) 6885 return f(p_mi)
6886
6887 -def libvlc_media_player_set_android_context(p_mi, p_awindow_handler):
6888 '''Set the android context. 6889 @param p_mi: the media player. 6890 @param p_awindow_handler: org.videolan.libvlc.AWindow jobject owned by the org.videolan.libvlc.MediaPlayer class from the libvlc-android project. 6891 @version: LibVLC 3.0.0 and later. 6892 ''' 6893 f = _Cfunctions.get('libvlc_media_player_set_android_context', None) or \ 6894 _Cfunction('libvlc_media_player_set_android_context', ((1,), (1,),), None, 6895 None, MediaPlayer, ctypes.c_void_p) 6896 return f(p_mi, p_awindow_handler)
6897
6898 -def libvlc_media_player_set_evas_object(p_mi, p_evas_object):
6899 '''Set the EFL Evas Object. 6900 @param p_mi: the media player. 6901 @param p_evas_object: a valid EFL Evas Object (Evas_Object). 6902 @return: -1 if an error was detected, 0 otherwise. 6903 @version: LibVLC 3.0.0 and later. 6904 ''' 6905 f = _Cfunctions.get('libvlc_media_player_set_evas_object', None) or \ 6906 _Cfunction('libvlc_media_player_set_evas_object', ((1,), (1,),), None, 6907 ctypes.c_int, MediaPlayer, ctypes.c_void_p) 6908 return f(p_mi, p_evas_object)
6909
6910 -def libvlc_audio_set_callbacks(mp, play, pause, resume, flush, drain, opaque):
6911 '''Sets callbacks and private data for decoded audio. 6912 Use L{libvlc_audio_set_format}() or L{libvlc_audio_set_format_callbacks}() 6913 to configure the decoded audio format. 6914 @note: The audio callbacks override any other audio output mechanism. 6915 If the callbacks are set, LibVLC will B{not} output audio in any way. 6916 @param mp: the media player. 6917 @param play: callback to play audio samples (must not be None). 6918 @param pause: callback to pause playback (or None to ignore). 6919 @param resume: callback to resume playback (or None to ignore). 6920 @param flush: callback to flush audio buffers (or None to ignore). 6921 @param drain: callback to drain audio buffers (or None to ignore). 6922 @param opaque: private pointer for the audio callbacks (as first parameter). 6923 @version: LibVLC 2.0.0 or later. 6924 ''' 6925 f = _Cfunctions.get('libvlc_audio_set_callbacks', None) or \ 6926 _Cfunction('libvlc_audio_set_callbacks', ((1,), (1,), (1,), (1,), (1,), (1,), (1,),), None, 6927 None, MediaPlayer, AudioPlayCb, AudioPauseCb, AudioResumeCb, AudioFlushCb, AudioDrainCb, ctypes.c_void_p) 6928 return f(mp, play, pause, resume, flush, drain, opaque)
6929
6930 -def libvlc_audio_set_volume_callback(mp, set_volume):
6931 '''Set callbacks and private data for decoded audio. This only works in 6932 combination with L{libvlc_audio_set_callbacks}(). 6933 Use L{libvlc_audio_set_format}() or L{libvlc_audio_set_format_callbacks}() 6934 to configure the decoded audio format. 6935 @param mp: the media player. 6936 @param set_volume: callback to apply audio volume, or None to apply volume in software. 6937 @version: LibVLC 2.0.0 or later. 6938 ''' 6939 f = _Cfunctions.get('libvlc_audio_set_volume_callback', None) or \ 6940 _Cfunction('libvlc_audio_set_volume_callback', ((1,), (1,),), None, 6941 None, MediaPlayer, AudioSetVolumeCb) 6942 return f(mp, set_volume)
6943
6944 -def libvlc_audio_set_format_callbacks(mp, setup, cleanup):
6945 '''Sets decoded audio format via callbacks. 6946 This only works in combination with L{libvlc_audio_set_callbacks}(). 6947 @param mp: the media player. 6948 @param setup: callback to select the audio format (cannot be None). 6949 @param cleanup: callback to release any allocated resources (or None). 6950 @version: LibVLC 2.0.0 or later. 6951 ''' 6952 f = _Cfunctions.get('libvlc_audio_set_format_callbacks', None) or \ 6953 _Cfunction('libvlc_audio_set_format_callbacks', ((1,), (1,), (1,),), None, 6954 None, MediaPlayer, AudioSetupCb, AudioCleanupCb) 6955 return f(mp, setup, cleanup)
6956
6957 -def libvlc_audio_set_format(mp, format, rate, channels):
6958 '''Sets a fixed decoded audio format. 6959 This only works in combination with L{libvlc_audio_set_callbacks}(), 6960 and is mutually exclusive with L{libvlc_audio_set_format_callbacks}(). 6961 @param mp: the media player. 6962 @param format: a four-characters string identifying the sample format (e.g. "S16N" or "f32l"). 6963 @param rate: sample rate (expressed in Hz). 6964 @param channels: channels count. 6965 @version: LibVLC 2.0.0 or later. 6966 ''' 6967 f = _Cfunctions.get('libvlc_audio_set_format', None) or \ 6968 _Cfunction('libvlc_audio_set_format', ((1,), (1,), (1,), (1,),), None, 6969 None, MediaPlayer, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint) 6970 return f(mp, format, rate, channels)
6971
6972 -def libvlc_media_player_get_length(p_mi):
6973 '''Get the current movie length (in ms). 6974 @param p_mi: the Media Player. 6975 @return: the movie length (in ms), or -1 if there is no media. 6976 ''' 6977 f = _Cfunctions.get('libvlc_media_player_get_length', None) or \ 6978 _Cfunction('libvlc_media_player_get_length', ((1,),), None, 6979 ctypes.c_longlong, MediaPlayer) 6980 return f(p_mi)
6981
6982 -def libvlc_media_player_get_time(p_mi):
6983 '''Get the current movie time (in ms). 6984 @param p_mi: the Media Player. 6985 @return: the movie time (in ms), or -1 if there is no media. 6986 ''' 6987 f = _Cfunctions.get('libvlc_media_player_get_time', None) or \ 6988 _Cfunction('libvlc_media_player_get_time', ((1,),), None, 6989 ctypes.c_longlong, MediaPlayer) 6990 return f(p_mi)
6991
6992 -def libvlc_media_player_set_time(p_mi, i_time):
6993 '''Set the movie time (in ms). This has no effect if no media is being played. 6994 Not all formats and protocols support this. 6995 @param p_mi: the Media Player. 6996 @param i_time: the movie time (in ms). 6997 ''' 6998 f = _Cfunctions.get('libvlc_media_player_set_time', None) or \ 6999 _Cfunction('libvlc_media_player_set_time', ((1,), (1,),), None, 7000 None, MediaPlayer, ctypes.c_longlong) 7001 return f(p_mi, i_time)
7002
7003 -def libvlc_media_player_get_position(p_mi):
7004 '''Get movie position as percentage between 0.0 and 1.0. 7005 @param p_mi: the Media Player. 7006 @return: movie position, or -1. in case of error. 7007 ''' 7008 f = _Cfunctions.get('libvlc_media_player_get_position', None) or \ 7009 _Cfunction('libvlc_media_player_get_position', ((1,),), None, 7010 ctypes.c_float, MediaPlayer) 7011 return f(p_mi)
7012
7013 -def libvlc_media_player_set_position(p_mi, f_pos):
7014 '''Set movie position as percentage between 0.0 and 1.0. 7015 This has no effect if playback is not enabled. 7016 This might not work depending on the underlying input format and protocol. 7017 @param p_mi: the Media Player. 7018 @param f_pos: the position. 7019 ''' 7020 f = _Cfunctions.get('libvlc_media_player_set_position', None) or \ 7021 _Cfunction('libvlc_media_player_set_position', ((1,), (1,),), None, 7022 None, MediaPlayer, ctypes.c_float) 7023 return f(p_mi, f_pos)
7024
7025 -def libvlc_media_player_set_chapter(p_mi, i_chapter):
7026 '''Set movie chapter (if applicable). 7027 @param p_mi: the Media Player. 7028 @param i_chapter: chapter number to play. 7029 ''' 7030 f = _Cfunctions.get('libvlc_media_player_set_chapter', None) or \ 7031 _Cfunction('libvlc_media_player_set_chapter', ((1,), (1,),), None, 7032 None, MediaPlayer, ctypes.c_int) 7033 return f(p_mi, i_chapter)
7034
7035 -def libvlc_media_player_get_chapter(p_mi):
7036 '''Get movie chapter. 7037 @param p_mi: the Media Player. 7038 @return: chapter number currently playing, or -1 if there is no media. 7039 ''' 7040 f = _Cfunctions.get('libvlc_media_player_get_chapter', None) or \ 7041 _Cfunction('libvlc_media_player_get_chapter', ((1,),), None, 7042 ctypes.c_int, MediaPlayer) 7043 return f(p_mi)
7044
7045 -def libvlc_media_player_get_chapter_count(p_mi):
7046 '''Get movie chapter count. 7047 @param p_mi: the Media Player. 7048 @return: number of chapters in movie, or -1. 7049 ''' 7050 f = _Cfunctions.get('libvlc_media_player_get_chapter_count', None) or \ 7051 _Cfunction('libvlc_media_player_get_chapter_count', ((1,),), None, 7052 ctypes.c_int, MediaPlayer) 7053 return f(p_mi)
7054
7055 -def libvlc_media_player_will_play(p_mi):
7056 '''Is the player able to play. 7057 @param p_mi: the Media Player. 7058 @return: boolean \libvlc_return_bool. 7059 ''' 7060 f = _Cfunctions.get('libvlc_media_player_will_play', None) or \ 7061 _Cfunction('libvlc_media_player_will_play', ((1,),), None, 7062 ctypes.c_int, MediaPlayer) 7063 return f(p_mi)
7064
7065 -def libvlc_media_player_get_chapter_count_for_title(p_mi, i_title):
7066 '''Get title chapter count. 7067 @param p_mi: the Media Player. 7068 @param i_title: title. 7069 @return: number of chapters in title, or -1. 7070 ''' 7071 f = _Cfunctions.get('libvlc_media_player_get_chapter_count_for_title', None) or \ 7072 _Cfunction('libvlc_media_player_get_chapter_count_for_title', ((1,), (1,),), None, 7073 ctypes.c_int, MediaPlayer, ctypes.c_int) 7074 return f(p_mi, i_title)
7075
7076 -def libvlc_media_player_set_title(p_mi, i_title):
7077 '''Set movie title. 7078 @param p_mi: the Media Player. 7079 @param i_title: title number to play. 7080 ''' 7081 f = _Cfunctions.get('libvlc_media_player_set_title', None) or \ 7082 _Cfunction('libvlc_media_player_set_title', ((1,), (1,),), None, 7083 None, MediaPlayer, ctypes.c_int) 7084 return f(p_mi, i_title)
7085
7086 -def libvlc_media_player_get_title(p_mi):
7087 '''Get movie title. 7088 @param p_mi: the Media Player. 7089 @return: title number currently playing, or -1. 7090 ''' 7091 f = _Cfunctions.get('libvlc_media_player_get_title', None) or \ 7092 _Cfunction('libvlc_media_player_get_title', ((1,),), None, 7093 ctypes.c_int, MediaPlayer) 7094 return f(p_mi)
7095
7096 -def libvlc_media_player_get_title_count(p_mi):
7097 '''Get movie title count. 7098 @param p_mi: the Media Player. 7099 @return: title number count, or -1. 7100 ''' 7101 f = _Cfunctions.get('libvlc_media_player_get_title_count', None) or \ 7102 _Cfunction('libvlc_media_player_get_title_count', ((1,),), None, 7103 ctypes.c_int, MediaPlayer) 7104 return f(p_mi)
7105
7106 -def libvlc_media_player_previous_chapter(p_mi):
7107 '''Set previous chapter (if applicable). 7108 @param p_mi: the Media Player. 7109 ''' 7110 f = _Cfunctions.get('libvlc_media_player_previous_chapter', None) or \ 7111 _Cfunction('libvlc_media_player_previous_chapter', ((1,),), None, 7112 None, MediaPlayer) 7113 return f(p_mi)
7114
7115 -def libvlc_media_player_next_chapter(p_mi):
7116 '''Set next chapter (if applicable). 7117 @param p_mi: the Media Player. 7118 ''' 7119 f = _Cfunctions.get('libvlc_media_player_next_chapter', None) or \ 7120 _Cfunction('libvlc_media_player_next_chapter', ((1,),), None, 7121 None, MediaPlayer) 7122 return f(p_mi)
7123
7124 -def libvlc_media_player_get_rate(p_mi):
7125 '''Get the requested movie play rate. 7126 @warning: Depending on the underlying media, the requested rate may be 7127 different from the real playback rate. 7128 @param p_mi: the Media Player. 7129 @return: movie play rate. 7130 ''' 7131 f = _Cfunctions.get('libvlc_media_player_get_rate', None) or \ 7132 _Cfunction('libvlc_media_player_get_rate', ((1,),), None, 7133 ctypes.c_float, MediaPlayer) 7134 return f(p_mi)
7135
7136 -def libvlc_media_player_set_rate(p_mi, rate):
7137 '''Set movie play rate. 7138 @param p_mi: the Media Player. 7139 @param rate: movie play rate to set. 7140 @return: -1 if an error was detected, 0 otherwise (but even then, it might not actually work depending on the underlying media protocol). 7141 ''' 7142 f = _Cfunctions.get('libvlc_media_player_set_rate', None) or \ 7143 _Cfunction('libvlc_media_player_set_rate', ((1,), (1,),), None, 7144 ctypes.c_int, MediaPlayer, ctypes.c_float) 7145 return f(p_mi, rate)
7146
7147 -def libvlc_media_player_get_state(p_mi):
7148 '''Get current movie state. 7149 @param p_mi: the Media Player. 7150 @return: the current state of the media player (playing, paused, ...) See L{State}. 7151 ''' 7152 f = _Cfunctions.get('libvlc_media_player_get_state', None) or \ 7153 _Cfunction('libvlc_media_player_get_state', ((1,),), None, 7154 State, MediaPlayer) 7155 return f(p_mi)
7156
7157 -def libvlc_media_player_has_vout(p_mi):
7158 '''How many video outputs does this media player have? 7159 @param p_mi: the media player. 7160 @return: the number of video outputs. 7161 ''' 7162 f = _Cfunctions.get('libvlc_media_player_has_vout', None) or \ 7163 _Cfunction('libvlc_media_player_has_vout', ((1,),), None, 7164 ctypes.c_uint, MediaPlayer) 7165 return f(p_mi)
7166
7167 -def libvlc_media_player_is_seekable(p_mi):
7168 '''Is this media player seekable? 7169 @param p_mi: the media player. 7170 @return: true if the media player can seek \libvlc_return_bool. 7171 ''' 7172 f = _Cfunctions.get('libvlc_media_player_is_seekable', None) or \ 7173 _Cfunction('libvlc_media_player_is_seekable', ((1,),), None, 7174 ctypes.c_int, MediaPlayer) 7175 return f(p_mi)
7176
7177 -def libvlc_media_player_can_pause(p_mi):
7178 '''Can this media player be paused? 7179 @param p_mi: the media player. 7180 @return: true if the media player can pause \libvlc_return_bool. 7181 ''' 7182 f = _Cfunctions.get('libvlc_media_player_can_pause', None) or \ 7183 _Cfunction('libvlc_media_player_can_pause', ((1,),), None, 7184 ctypes.c_int, MediaPlayer) 7185 return f(p_mi)
7186
7187 -def libvlc_media_player_program_scrambled(p_mi):
7188 '''Check if the current program is scrambled. 7189 @param p_mi: the media player. 7190 @return: true if the current program is scrambled \libvlc_return_bool. 7191 @version: LibVLC 2.2.0 or later. 7192 ''' 7193 f = _Cfunctions.get('libvlc_media_player_program_scrambled', None) or \ 7194 _Cfunction('libvlc_media_player_program_scrambled', ((1,),), None, 7195 ctypes.c_int, MediaPlayer) 7196 return f(p_mi)
7197
7198 -def libvlc_media_player_next_frame(p_mi):
7199 '''Display the next frame (if supported). 7200 @param p_mi: the media player. 7201 ''' 7202 f = _Cfunctions.get('libvlc_media_player_next_frame', None) or \ 7203 _Cfunction('libvlc_media_player_next_frame', ((1,),), None, 7204 None, MediaPlayer) 7205 return f(p_mi)
7206
7207 -def libvlc_media_player_navigate(p_mi, navigate):
7208 '''Navigate through DVD Menu. 7209 @param p_mi: the Media Player. 7210 @param navigate: the Navigation mode. 7211 @version: libVLC 2.0.0 or later. 7212 ''' 7213 f = _Cfunctions.get('libvlc_media_player_navigate', None) or \ 7214 _Cfunction('libvlc_media_player_navigate', ((1,), (1,),), None, 7215 None, MediaPlayer, ctypes.c_uint) 7216 return f(p_mi, navigate)
7217
7218 -def libvlc_media_player_set_video_title_display(p_mi, position, timeout):
7219 '''Set if, and how, the video title will be shown when media is played. 7220 @param p_mi: the media player. 7221 @param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed. 7222 @param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable). 7223 @version: libVLC 2.1.0 or later. 7224 ''' 7225 f = _Cfunctions.get('libvlc_media_player_set_video_title_display', None) or \ 7226 _Cfunction('libvlc_media_player_set_video_title_display', ((1,), (1,), (1,),), None, 7227 None, MediaPlayer, Position, ctypes.c_uint) 7228 return f(p_mi, position, timeout)
7229
7230 -def libvlc_media_player_add_slave(p_mi, i_type, psz_uri, b_select):
7231 '''Add a slave to the current media player. 7232 @note: If the player is playing, the slave will be added directly. This call 7233 will also update the slave list of the attached L{Media}. 7234 @param p_mi: the media player. 7235 @param i_type: subtitle or audio. 7236 @param psz_uri: Uri of the slave (should contain a valid scheme). 7237 @param b_select: True if this slave should be selected when it's loaded. 7238 @return: 0 on success, -1 on error. 7239 @version: LibVLC 3.0.0 and later. See L{libvlc_media_slaves_add}. 7240 ''' 7241 f = _Cfunctions.get('libvlc_media_player_add_slave', None) or \ 7242 _Cfunction('libvlc_media_player_add_slave', ((1,), (1,), (1,), (1,),), None, 7243 ctypes.c_int, MediaPlayer, MediaSlaveType, ctypes.c_char_p, ctypes.c_bool) 7244 return f(p_mi, i_type, psz_uri, b_select)
7245
7246 -def libvlc_track_description_list_release(p_track_description):
7247 '''Release (free) L{TrackDescription}. 7248 @param p_track_description: the structure to release. 7249 ''' 7250 f = _Cfunctions.get('libvlc_track_description_list_release', None) or \ 7251 _Cfunction('libvlc_track_description_list_release', ((1,),), None, 7252 None, ctypes.POINTER(TrackDescription)) 7253 return f(p_track_description)
7254
7255 -def libvlc_toggle_fullscreen(p_mi):
7256 '''Toggle fullscreen status on non-embedded video outputs. 7257 @warning: The same limitations applies to this function 7258 as to L{libvlc_set_fullscreen}(). 7259 @param p_mi: the media player. 7260 ''' 7261 f = _Cfunctions.get('libvlc_toggle_fullscreen', None) or \ 7262 _Cfunction('libvlc_toggle_fullscreen', ((1,),), None, 7263 None, MediaPlayer) 7264 return f(p_mi)
7265
7266 -def libvlc_set_fullscreen(p_mi, b_fullscreen):
7267 '''Enable or disable fullscreen. 7268 @warning: With most window managers, only a top-level windows can be in 7269 full-screen mode. Hence, this function will not operate properly if 7270 L{libvlc_media_player_set_xwindow}() was used to embed the video in a 7271 non-top-level window. In that case, the embedding window must be reparented 7272 to the root window B{before} fullscreen mode is enabled. You will want 7273 to reparent it back to its normal parent when disabling fullscreen. 7274 @param p_mi: the media player. 7275 @param b_fullscreen: boolean for fullscreen status. 7276 ''' 7277 f = _Cfunctions.get('libvlc_set_fullscreen', None) or \ 7278 _Cfunction('libvlc_set_fullscreen', ((1,), (1,),), None, 7279 None, MediaPlayer, ctypes.c_int) 7280 return f(p_mi, b_fullscreen)
7281
7282 -def libvlc_get_fullscreen(p_mi):
7283 '''Get current fullscreen status. 7284 @param p_mi: the media player. 7285 @return: the fullscreen status (boolean) \libvlc_return_bool. 7286 ''' 7287 f = _Cfunctions.get('libvlc_get_fullscreen', None) or \ 7288 _Cfunction('libvlc_get_fullscreen', ((1,),), None, 7289 ctypes.c_int, MediaPlayer) 7290 return f(p_mi)
7291
7292 -def libvlc_video_set_key_input(p_mi, on):
7293 '''Enable or disable key press events handling, according to the LibVLC hotkeys 7294 configuration. By default and for historical reasons, keyboard events are 7295 handled by the LibVLC video widget. 7296 @note: On X11, there can be only one subscriber for key press and mouse 7297 click events per window. If your application has subscribed to those events 7298 for the X window ID of the video widget, then LibVLC will not be able to 7299 handle key presses and mouse clicks in any case. 7300 @warning: This function is only implemented for X11 and Win32 at the moment. 7301 @param p_mi: the media player. 7302 @param on: true to handle key press events, false to ignore them. 7303 ''' 7304 f = _Cfunctions.get('libvlc_video_set_key_input', None) or \ 7305 _Cfunction('libvlc_video_set_key_input', ((1,), (1,),), None, 7306 None, MediaPlayer, ctypes.c_uint) 7307 return f(p_mi, on)
7308
7309 -def libvlc_video_set_mouse_input(p_mi, on):
7310 '''Enable or disable mouse click events handling. By default, those events are 7311 handled. This is needed for DVD menus to work, as well as a few video 7312 filters such as "puzzle". 7313 See L{libvlc_video_set_key_input}(). 7314 @warning: This function is only implemented for X11 and Win32 at the moment. 7315 @param p_mi: the media player. 7316 @param on: true to handle mouse click events, false to ignore them. 7317 ''' 7318 f = _Cfunctions.get('libvlc_video_set_mouse_input', None) or \ 7319 _Cfunction('libvlc_video_set_mouse_input', ((1,), (1,),), None, 7320 None, MediaPlayer, ctypes.c_uint) 7321 return f(p_mi, on)
7322
7323 -def libvlc_video_get_size(p_mi, num):
7324 '''Get the pixel dimensions of a video. 7325 @param p_mi: media player. 7326 @param num: number of the video (starting from, and most commonly 0). 7327 @return: px pixel width, py pixel height. 7328 ''' 7329 f = _Cfunctions.get('libvlc_video_get_size', None) or \ 7330 _Cfunction('libvlc_video_get_size', ((1,), (1,), (2,), (2,),), None, 7331 ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)) 7332 return f(p_mi, num)
7333
7334 -def libvlc_video_get_cursor(p_mi, num):
7335 '''Get the mouse pointer coordinates over a video. 7336 Coordinates are expressed in terms of the decoded video resolution, 7337 B{not} in terms of pixels on the screen/viewport (to get the latter, 7338 you can query your windowing system directly). 7339 Either of the coordinates may be negative or larger than the corresponding 7340 dimension of the video, if the cursor is outside the rendering area. 7341 @warning: The coordinates may be out-of-date if the pointer is not located 7342 on the video rendering area. LibVLC does not track the pointer if it is 7343 outside of the video widget. 7344 @note: LibVLC does not support multiple pointers (it does of course support 7345 multiple input devices sharing the same pointer) at the moment. 7346 @param p_mi: media player. 7347 @param num: number of the video (starting from, and most commonly 0). 7348 @return: px abscissa, py ordinate. 7349 ''' 7350 f = _Cfunctions.get('libvlc_video_get_cursor', None) or \ 7351 _Cfunction('libvlc_video_get_cursor', ((1,), (1,), (2,), (2,),), None, 7352 ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)) 7353 return f(p_mi, num)
7354
7355 -def libvlc_video_get_scale(p_mi):
7356 '''Get the current video scaling factor. 7357 See also L{libvlc_video_set_scale}(). 7358 @param p_mi: the media player. 7359 @return: the currently configured zoom factor, or 0. if the video is set to fit to the output window/drawable automatically. 7360 ''' 7361 f = _Cfunctions.get('libvlc_video_get_scale', None) or \ 7362 _Cfunction('libvlc_video_get_scale', ((1,),), None, 7363 ctypes.c_float, MediaPlayer) 7364 return f(p_mi)
7365
7366 -def libvlc_video_set_scale(p_mi, f_factor):
7367 '''Set the video scaling factor. That is the ratio of the number of pixels on 7368 screen to the number of pixels in the original decoded video in each 7369 dimension. Zero is a special value; it will adjust the video to the output 7370 window/drawable (in windowed mode) or the entire screen. 7371 Note that not all video outputs support scaling. 7372 @param p_mi: the media player. 7373 @param f_factor: the scaling factor, or zero. 7374 ''' 7375 f = _Cfunctions.get('libvlc_video_set_scale', None) or \ 7376 _Cfunction('libvlc_video_set_scale', ((1,), (1,),), None, 7377 None, MediaPlayer, ctypes.c_float) 7378 return f(p_mi, f_factor)
7379
7380 -def libvlc_video_get_aspect_ratio(p_mi):
7381 '''Get current video aspect ratio. 7382 @param p_mi: the media player. 7383 @return: the video aspect ratio or None if unspecified (the result must be released with free() or L{libvlc_free}()). 7384 ''' 7385 f = _Cfunctions.get('libvlc_video_get_aspect_ratio', None) or \ 7386 _Cfunction('libvlc_video_get_aspect_ratio', ((1,),), string_result, 7387 ctypes.c_void_p, MediaPlayer) 7388 return f(p_mi)
7389
7390 -def libvlc_video_set_aspect_ratio(p_mi, psz_aspect):
7391 '''Set new video aspect ratio. 7392 @param p_mi: the media player. 7393 @param psz_aspect: new video aspect-ratio or None to reset to default @note Invalid aspect ratios are ignored. 7394 ''' 7395 f = _Cfunctions.get('libvlc_video_set_aspect_ratio', None) or \ 7396 _Cfunction('libvlc_video_set_aspect_ratio', ((1,), (1,),), None, 7397 None, MediaPlayer, ctypes.c_char_p) 7398 return f(p_mi, psz_aspect)
7399
7400 -def libvlc_video_new_viewpoint():
7401 '''Create a video viewpoint structure. 7402 @return: video viewpoint or None (the result must be released with free() or L{libvlc_free}()). 7403 @version: LibVLC 3.0.0 and later. 7404 ''' 7405 f = _Cfunctions.get('libvlc_video_new_viewpoint', None) or \ 7406 _Cfunction('libvlc_video_new_viewpoint', (), None, 7407 ctypes.POINTER(VideoViewpoint)) 7408 return f()
7409
7410 -def libvlc_video_update_viewpoint(p_mi, p_viewpoint, b_absolute):
7411 '''Update the video viewpoint information. 7412 @note: It is safe to call this function before the media player is started. 7413 @param p_mi: the media player. 7414 @param p_viewpoint: video viewpoint allocated via L{libvlc_video_new_viewpoint}(). 7415 @param b_absolute: if true replace the old viewpoint with the new one. If false, increase/decrease it. 7416 @return: -1 in case of error, 0 otherwise @note the values are set asynchronously, it will be used by the next frame displayed. 7417 @version: LibVLC 3.0.0 and later. 7418 ''' 7419 f = _Cfunctions.get('libvlc_video_update_viewpoint', None) or \ 7420 _Cfunction('libvlc_video_update_viewpoint', ((1,), (1,), (1,),), None, 7421 ctypes.c_int, MediaPlayer, ctypes.POINTER(VideoViewpoint), ctypes.c_bool) 7422 return f(p_mi, p_viewpoint, b_absolute)
7423
7424 -def libvlc_video_get_spu(p_mi):
7425 '''Get current video subtitle. 7426 @param p_mi: the media player. 7427 @return: the video subtitle selected, or -1 if none. 7428 ''' 7429 f = _Cfunctions.get('libvlc_video_get_spu', None) or \ 7430 _Cfunction('libvlc_video_get_spu', ((1,),), None, 7431 ctypes.c_int, MediaPlayer) 7432 return f(p_mi)
7433
7434 -def libvlc_video_get_spu_count(p_mi):
7435 '''Get the number of available video subtitles. 7436 @param p_mi: the media player. 7437 @return: the number of available video subtitles. 7438 ''' 7439 f = _Cfunctions.get('libvlc_video_get_spu_count', None) or \ 7440 _Cfunction('libvlc_video_get_spu_count', ((1,),), None, 7441 ctypes.c_int, MediaPlayer) 7442 return f(p_mi)
7443
7444 -def libvlc_video_get_spu_description(p_mi):
7445 '''Get the description of available video subtitles. 7446 @param p_mi: the media player. 7447 @return: list containing description of available video subtitles. It must be freed with L{libvlc_track_description_list_release}(). 7448 ''' 7449 f = _Cfunctions.get('libvlc_video_get_spu_description', None) or \ 7450 _Cfunction('libvlc_video_get_spu_description', ((1,),), None, 7451 ctypes.POINTER(TrackDescription), MediaPlayer) 7452 return f(p_mi)
7453
7454 -def libvlc_video_set_spu(p_mi, i_spu):
7455 '''Set new video subtitle. 7456 @param p_mi: the media player. 7457 @param i_spu: video subtitle track to select (i_id from track description). 7458 @return: 0 on success, -1 if out of range. 7459 ''' 7460 f = _Cfunctions.get('libvlc_video_set_spu', None) or \ 7461 _Cfunction('libvlc_video_set_spu', ((1,), (1,),), None, 7462 ctypes.c_int, MediaPlayer, ctypes.c_int) 7463 return f(p_mi, i_spu)
7464
7465 -def libvlc_video_get_spu_delay(p_mi):
7466 '''Get the current subtitle delay. Positive values means subtitles are being 7467 displayed later, negative values earlier. 7468 @param p_mi: media player. 7469 @return: time (in microseconds) the display of subtitles is being delayed. 7470 @version: LibVLC 2.0.0 or later. 7471 ''' 7472 f = _Cfunctions.get('libvlc_video_get_spu_delay', None) or \ 7473 _Cfunction('libvlc_video_get_spu_delay', ((1,),), None, 7474 ctypes.c_int64, MediaPlayer) 7475 return f(p_mi)
7476
7477 -def libvlc_video_set_spu_delay(p_mi, i_delay):
7478 '''Set the subtitle delay. This affects the timing of when the subtitle will 7479 be displayed. Positive values result in subtitles being displayed later, 7480 while negative values will result in subtitles being displayed earlier. 7481 The subtitle delay will be reset to zero each time the media changes. 7482 @param p_mi: media player. 7483 @param i_delay: time (in microseconds) the display of subtitles should be delayed. 7484 @return: 0 on success, -1 on error. 7485 @version: LibVLC 2.0.0 or later. 7486 ''' 7487 f = _Cfunctions.get('libvlc_video_set_spu_delay', None) or \ 7488 _Cfunction('libvlc_video_set_spu_delay', ((1,), (1,),), None, 7489 ctypes.c_int, MediaPlayer, ctypes.c_int64) 7490 return f(p_mi, i_delay)
7491
7492 -def libvlc_media_player_get_full_title_descriptions(p_mi, titles):
7493 '''Get the full description of available titles. 7494 @param p_mi: the media player. 7495 @param titles: address to store an allocated array of title descriptions descriptions (must be freed with L{libvlc_title_descriptions_release}() by the caller) [OUT]. 7496 @return: the number of titles (-1 on error). 7497 @version: LibVLC 3.0.0 and later. 7498 ''' 7499 f = _Cfunctions.get('libvlc_media_player_get_full_title_descriptions', None) or \ 7500 _Cfunction('libvlc_media_player_get_full_title_descriptions', ((1,), (1,),), None, 7501 ctypes.c_int, MediaPlayer, ctypes.POINTER(ctypes.POINTER(TitleDescription))) 7502 return f(p_mi, titles)
7503
7504 -def libvlc_title_descriptions_release(p_titles, i_count):
7505 '''Release a title description. 7506 @param p_titles: title description array to release. 7507 @param i_count: number of title descriptions to release. 7508 @version: LibVLC 3.0.0 and later. 7509 ''' 7510 f = _Cfunctions.get('libvlc_title_descriptions_release', None) or \ 7511 _Cfunction('libvlc_title_descriptions_release', ((1,), (1,),), None, 7512 None, ctypes.POINTER(TitleDescription), ctypes.c_uint) 7513 return f(p_titles, i_count)
7514
7515 -def libvlc_media_player_get_full_chapter_descriptions(p_mi, i_chapters_of_title, pp_chapters):
7516 '''Get the full description of available chapters. 7517 @param p_mi: the media player. 7518 @param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1). 7519 @param pp_chapters: address to store an allocated array of chapter descriptions descriptions (must be freed with L{libvlc_chapter_descriptions_release}() by the caller) [OUT]. 7520 @return: the number of chapters (-1 on error). 7521 @version: LibVLC 3.0.0 and later. 7522 ''' 7523 f = _Cfunctions.get('libvlc_media_player_get_full_chapter_descriptions', None) or \ 7524 _Cfunction('libvlc_media_player_get_full_chapter_descriptions', ((1,), (1,), (1,),), None, 7525 ctypes.c_int, MediaPlayer, ctypes.c_int, ctypes.POINTER(ctypes.POINTER(ChapterDescription))) 7526 return f(p_mi, i_chapters_of_title, pp_chapters)
7527
7528 -def libvlc_chapter_descriptions_release(p_chapters, i_count):
7529 '''Release a chapter description. 7530 @param p_chapters: chapter description array to release. 7531 @param i_count: number of chapter descriptions to release. 7532 @version: LibVLC 3.0.0 and later. 7533 ''' 7534 f = _Cfunctions.get('libvlc_chapter_descriptions_release', None) or \ 7535 _Cfunction('libvlc_chapter_descriptions_release', ((1,), (1,),), None, 7536 None, ctypes.POINTER(ChapterDescription), ctypes.c_uint) 7537 return f(p_chapters, i_count)
7538
7539 -def libvlc_video_get_crop_geometry(p_mi):
7540 '''Get current crop filter geometry. 7541 @param p_mi: the media player. 7542 @return: the crop filter geometry or None if unset. 7543 ''' 7544 f = _Cfunctions.get('libvlc_video_get_crop_geometry', None) or \ 7545 _Cfunction('libvlc_video_get_crop_geometry', ((1,),), string_result, 7546 ctypes.c_void_p, MediaPlayer) 7547 return f(p_mi)
7548
7549 -def libvlc_video_set_crop_geometry(p_mi, psz_geometry):
7550 '''Set new crop filter geometry. 7551 @param p_mi: the media player. 7552 @param psz_geometry: new crop filter geometry (None to unset). 7553 ''' 7554 f = _Cfunctions.get('libvlc_video_set_crop_geometry', None) or \ 7555 _Cfunction('libvlc_video_set_crop_geometry', ((1,), (1,),), None, 7556 None, MediaPlayer, ctypes.c_char_p) 7557 return f(p_mi, psz_geometry)
7558
7559 -def libvlc_video_get_teletext(p_mi):
7560 '''Get current teletext page requested or 0 if it's disabled. 7561 Teletext is disabled by default, call L{libvlc_video_set_teletext}() to enable 7562 it. 7563 @param p_mi: the media player. 7564 @return: the current teletext page requested. 7565 ''' 7566 f = _Cfunctions.get('libvlc_video_get_teletext', None) or \ 7567 _Cfunction('libvlc_video_get_teletext', ((1,),), None, 7568 ctypes.c_int, MediaPlayer) 7569 return f(p_mi)
7570
7571 -def libvlc_video_set_teletext(p_mi, i_page):
7572 '''Set new teletext page to retrieve. 7573 This function can also be used to send a teletext key. 7574 @param p_mi: the media player. 7575 @param i_page: teletex page number requested. This value can be 0 to disable teletext, a number in the range ]0;1000[ to show the requested page, or a \ref L{TeletextKey}. 100 is the default teletext page. 7576 ''' 7577 f = _Cfunctions.get('libvlc_video_set_teletext', None) or \ 7578 _Cfunction('libvlc_video_set_teletext', ((1,), (1,),), None, 7579 None, MediaPlayer, ctypes.c_int) 7580 return f(p_mi, i_page)
7581
7582 -def libvlc_video_get_track_count(p_mi):
7583 '''Get number of available video tracks. 7584 @param p_mi: media player. 7585 @return: the number of available video tracks (int). 7586 ''' 7587 f = _Cfunctions.get('libvlc_video_get_track_count', None) or \ 7588 _Cfunction('libvlc_video_get_track_count', ((1,),), None, 7589 ctypes.c_int, MediaPlayer) 7590 return f(p_mi)
7591
7592 -def libvlc_video_get_track_description(p_mi):
7593 '''Get the description of available video tracks. 7594 @param p_mi: media player. 7595 @return: list with description of available video tracks, or None on error. It must be freed with L{libvlc_track_description_list_release}(). 7596 ''' 7597 f = _Cfunctions.get('libvlc_video_get_track_description', None) or \ 7598 _Cfunction('libvlc_video_get_track_description', ((1,),), None, 7599 ctypes.POINTER(TrackDescription), MediaPlayer) 7600 return f(p_mi)
7601
7602 -def libvlc_video_get_track(p_mi):
7603 '''Get current video track. 7604 @param p_mi: media player. 7605 @return: the video track ID (int) or -1 if no active input. 7606 ''' 7607 f = _Cfunctions.get('libvlc_video_get_track', None) or \ 7608 _Cfunction('libvlc_video_get_track', ((1,),), None, 7609 ctypes.c_int, MediaPlayer) 7610 return f(p_mi)
7611
7612 -def libvlc_video_set_track(p_mi, i_track):
7613 '''Set video track. 7614 @param p_mi: media player. 7615 @param i_track: the track ID (i_id field from track description). 7616 @return: 0 on success, -1 if out of range. 7617 ''' 7618 f = _Cfunctions.get('libvlc_video_set_track', None) or \ 7619 _Cfunction('libvlc_video_set_track', ((1,), (1,),), None, 7620 ctypes.c_int, MediaPlayer, ctypes.c_int) 7621 return f(p_mi, i_track)
7622
7623 -def libvlc_video_take_snapshot(p_mi, num, psz_filepath, i_width, i_height):
7624 '''Take a snapshot of the current video window. 7625 If i_width AND i_height is 0, original size is used. 7626 If i_width XOR i_height is 0, original aspect-ratio is preserved. 7627 @param p_mi: media player instance. 7628 @param num: number of video output (typically 0 for the first/only one). 7629 @param psz_filepath: the path of a file or a folder to save the screenshot into. 7630 @param i_width: the snapshot's width. 7631 @param i_height: the snapshot's height. 7632 @return: 0 on success, -1 if the video was not found. 7633 ''' 7634 f = _Cfunctions.get('libvlc_video_take_snapshot', None) or \ 7635 _Cfunction('libvlc_video_take_snapshot', ((1,), (1,), (1,), (1,), (1,),), None, 7636 ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint) 7637 return f(p_mi, num, psz_filepath, i_width, i_height)
7638
7639 -def libvlc_video_set_deinterlace(p_mi, psz_mode):
7640 '''Enable or disable deinterlace filter. 7641 @param p_mi: libvlc media player. 7642 @param psz_mode: type of deinterlace filter, None to disable. 7643 ''' 7644 f = _Cfunctions.get('libvlc_video_set_deinterlace', None) or \ 7645 _Cfunction('libvlc_video_set_deinterlace', ((1,), (1,),), None, 7646 None, MediaPlayer, ctypes.c_char_p) 7647 return f(p_mi, psz_mode)
7648
7649 -def libvlc_video_get_marquee_int(p_mi, option):
7650 '''Get an integer marquee option value. 7651 @param p_mi: libvlc media player. 7652 @param option: marq option to get See libvlc_video_marquee_int_option_t. 7653 ''' 7654 f = _Cfunctions.get('libvlc_video_get_marquee_int', None) or \ 7655 _Cfunction('libvlc_video_get_marquee_int', ((1,), (1,),), None, 7656 ctypes.c_int, MediaPlayer, ctypes.c_uint) 7657 return f(p_mi, option)
7658
7659 -def libvlc_video_get_marquee_string(p_mi, option):
7660 '''Get a string marquee option value. 7661 @param p_mi: libvlc media player. 7662 @param option: marq option to get See libvlc_video_marquee_string_option_t. 7663 ''' 7664 f = _Cfunctions.get('libvlc_video_get_marquee_string', None) or \ 7665 _Cfunction('libvlc_video_get_marquee_string', ((1,), (1,),), string_result, 7666 ctypes.c_void_p, MediaPlayer, ctypes.c_uint) 7667 return f(p_mi, option)
7668
7669 -def libvlc_video_set_marquee_int(p_mi, option, i_val):
7670 '''Enable, disable or set an integer marquee option 7671 Setting libvlc_marquee_Enable has the side effect of enabling (arg !0) 7672 or disabling (arg 0) the marq filter. 7673 @param p_mi: libvlc media player. 7674 @param option: marq option to set See libvlc_video_marquee_int_option_t. 7675 @param i_val: marq option value. 7676 ''' 7677 f = _Cfunctions.get('libvlc_video_set_marquee_int', None) or \ 7678 _Cfunction('libvlc_video_set_marquee_int', ((1,), (1,), (1,),), None, 7679 None, MediaPlayer, ctypes.c_uint, ctypes.c_int) 7680 return f(p_mi, option, i_val)
7681
7682 -def libvlc_video_set_marquee_string(p_mi, option, psz_text):
7683 '''Set a marquee string option. 7684 @param p_mi: libvlc media player. 7685 @param option: marq option to set See libvlc_video_marquee_string_option_t. 7686 @param psz_text: marq option value. 7687 ''' 7688 f = _Cfunctions.get('libvlc_video_set_marquee_string', None) or \ 7689 _Cfunction('libvlc_video_set_marquee_string', ((1,), (1,), (1,),), None, 7690 None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p) 7691 return f(p_mi, option, psz_text)
7692
7693 -def libvlc_video_get_logo_int(p_mi, option):
7694 '''Get integer logo option. 7695 @param p_mi: libvlc media player instance. 7696 @param option: logo option to get, values of L{VideoLogoOption}. 7697 ''' 7698 f = _Cfunctions.get('libvlc_video_get_logo_int', None) or \ 7699 _Cfunction('libvlc_video_get_logo_int', ((1,), (1,),), None, 7700 ctypes.c_int, MediaPlayer, ctypes.c_uint) 7701 return f(p_mi, option)
7702
7703 -def libvlc_video_set_logo_int(p_mi, option, value):
7704 '''Set logo option as integer. Options that take a different type value 7705 are ignored. 7706 Passing libvlc_logo_enable as option value has the side effect of 7707 starting (arg !0) or stopping (arg 0) the logo filter. 7708 @param p_mi: libvlc media player instance. 7709 @param option: logo option to set, values of L{VideoLogoOption}. 7710 @param value: logo option value. 7711 ''' 7712 f = _Cfunctions.get('libvlc_video_set_logo_int', None) or \ 7713 _Cfunction('libvlc_video_set_logo_int', ((1,), (1,), (1,),), None, 7714 None, MediaPlayer, ctypes.c_uint, ctypes.c_int) 7715 return f(p_mi, option, value)
7716
7717 -def libvlc_video_set_logo_string(p_mi, option, psz_value):
7718 '''Set logo option as string. Options that take a different type value 7719 are ignored. 7720 @param p_mi: libvlc media player instance. 7721 @param option: logo option to set, values of L{VideoLogoOption}. 7722 @param psz_value: logo option value. 7723 ''' 7724 f = _Cfunctions.get('libvlc_video_set_logo_string', None) or \ 7725 _Cfunction('libvlc_video_set_logo_string', ((1,), (1,), (1,),), None, 7726 None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p) 7727 return f(p_mi, option, psz_value)
7728
7729 -def libvlc_video_get_adjust_int(p_mi, option):
7730 '''Get integer adjust option. 7731 @param p_mi: libvlc media player instance. 7732 @param option: adjust option to get, values of L{VideoAdjustOption}. 7733 @version: LibVLC 1.1.1 and later. 7734 ''' 7735 f = _Cfunctions.get('libvlc_video_get_adjust_int', None) or \ 7736 _Cfunction('libvlc_video_get_adjust_int', ((1,), (1,),), None, 7737 ctypes.c_int, MediaPlayer, ctypes.c_uint) 7738 return f(p_mi, option)
7739
7740 -def libvlc_video_set_adjust_int(p_mi, option, value):
7741 '''Set adjust option as integer. Options that take a different type value 7742 are ignored. 7743 Passing libvlc_adjust_enable as option value has the side effect of 7744 starting (arg !0) or stopping (arg 0) the adjust filter. 7745 @param p_mi: libvlc media player instance. 7746 @param option: adust option to set, values of L{VideoAdjustOption}. 7747 @param value: adjust option value. 7748 @version: LibVLC 1.1.1 and later. 7749 ''' 7750 f = _Cfunctions.get('libvlc_video_set_adjust_int', None) or \ 7751 _Cfunction('libvlc_video_set_adjust_int', ((1,), (1,), (1,),), None, 7752 None, MediaPlayer, ctypes.c_uint, ctypes.c_int) 7753 return f(p_mi, option, value)
7754
7755 -def libvlc_video_get_adjust_float(p_mi, option):
7756 '''Get float adjust option. 7757 @param p_mi: libvlc media player instance. 7758 @param option: adjust option to get, values of L{VideoAdjustOption}. 7759 @version: LibVLC 1.1.1 and later. 7760 ''' 7761 f = _Cfunctions.get('libvlc_video_get_adjust_float', None) or \ 7762 _Cfunction('libvlc_video_get_adjust_float', ((1,), (1,),), None, 7763 ctypes.c_float, MediaPlayer, ctypes.c_uint) 7764 return f(p_mi, option)
7765
7766 -def libvlc_video_set_adjust_float(p_mi, option, value):
7767 '''Set adjust option as float. Options that take a different type value 7768 are ignored. 7769 @param p_mi: libvlc media player instance. 7770 @param option: adust option to set, values of L{VideoAdjustOption}. 7771 @param value: adjust option value. 7772 @version: LibVLC 1.1.1 and later. 7773 ''' 7774 f = _Cfunctions.get('libvlc_video_set_adjust_float', None) or \ 7775 _Cfunction('libvlc_video_set_adjust_float', ((1,), (1,), (1,),), None, 7776 None, MediaPlayer, ctypes.c_uint, ctypes.c_float) 7777 return f(p_mi, option, value)
7778
7779 -def libvlc_audio_output_list_get(p_instance):
7780 '''Gets the list of available audio output modules. 7781 @param p_instance: libvlc instance. 7782 @return: list of available audio outputs. It must be freed with In case of error, None is returned. 7783 ''' 7784 f = _Cfunctions.get('libvlc_audio_output_list_get', None) or \ 7785 _Cfunction('libvlc_audio_output_list_get', ((1,),), None, 7786 ctypes.POINTER(AudioOutput), Instance) 7787 return f(p_instance)
7788
7789 -def libvlc_audio_output_list_release(p_list):
7790 '''Frees the list of available audio output modules. 7791 @param p_list: list with audio outputs for release. 7792 ''' 7793 f = _Cfunctions.get('libvlc_audio_output_list_release', None) or \ 7794 _Cfunction('libvlc_audio_output_list_release', ((1,),), None, 7795 None, ctypes.POINTER(AudioOutput)) 7796 return f(p_list)
7797
7798 -def libvlc_audio_output_set(p_mi, psz_name):
7799 '''Selects an audio output module. 7800 @note: Any change will take be effect only after playback is stopped and 7801 restarted. Audio output cannot be changed while playing. 7802 @param p_mi: media player. 7803 @param psz_name: name of audio output, use psz_name of See L{AudioOutput}. 7804 @return: 0 if function succeeded, -1 on error. 7805 ''' 7806 f = _Cfunctions.get('libvlc_audio_output_set', None) or \ 7807 _Cfunction('libvlc_audio_output_set', ((1,), (1,),), None, 7808 ctypes.c_int, MediaPlayer, ctypes.c_char_p) 7809 return f(p_mi, psz_name)
7810
7811 -def libvlc_audio_output_device_enum(mp):
7812 '''Gets a list of potential audio output devices, 7813 See L{libvlc_audio_output_device_set}(). 7814 @note: Not all audio outputs support enumerating devices. 7815 The audio output may be functional even if the list is empty (None). 7816 @note: The list may not be exhaustive. 7817 @warning: Some audio output devices in the list might not actually work in 7818 some circumstances. By default, it is recommended to not specify any 7819 explicit audio device. 7820 @param mp: media player. 7821 @return: A None-terminated linked list of potential audio output devices. It must be freed with L{libvlc_audio_output_device_list_release}(). 7822 @version: LibVLC 2.2.0 or later. 7823 ''' 7824 f = _Cfunctions.get('libvlc_audio_output_device_enum', None) or \ 7825 _Cfunction('libvlc_audio_output_device_enum', ((1,),), None, 7826 ctypes.POINTER(AudioOutputDevice), MediaPlayer) 7827 return f(mp)
7828
7829 -def libvlc_audio_output_device_list_get(p_instance, aout):
7830 '''Gets a list of audio output devices for a given audio output module, 7831 See L{libvlc_audio_output_device_set}(). 7832 @note: Not all audio outputs support this. In particular, an empty (None) 7833 list of devices does B{not} imply that the specified audio output does 7834 not work. 7835 @note: The list might not be exhaustive. 7836 @warning: Some audio output devices in the list might not actually work in 7837 some circumstances. By default, it is recommended to not specify any 7838 explicit audio device. 7839 @param p_instance: libvlc instance. 7840 @param aout: audio output name (as returned by L{libvlc_audio_output_list_get}()). 7841 @return: A None-terminated linked list of potential audio output devices. It must be freed with L{libvlc_audio_output_device_list_release}(). 7842 @version: LibVLC 2.1.0 or later. 7843 ''' 7844 f = _Cfunctions.get('libvlc_audio_output_device_list_get', None) or \ 7845 _Cfunction('libvlc_audio_output_device_list_get', ((1,), (1,),), None, 7846 ctypes.POINTER(AudioOutputDevice), Instance, ctypes.c_char_p) 7847 return f(p_instance, aout)
7848
7849 -def libvlc_audio_output_device_list_release(p_list):
7850 '''Frees a list of available audio output devices. 7851 @param p_list: list with audio outputs for release. 7852 @version: LibVLC 2.1.0 or later. 7853 ''' 7854 f = _Cfunctions.get('libvlc_audio_output_device_list_release', None) or \ 7855 _Cfunction('libvlc_audio_output_device_list_release', ((1,),), None, 7856 None, ctypes.POINTER(AudioOutputDevice)) 7857 return f(p_list)
7858
7859 -def libvlc_audio_output_device_set(mp, module, device_id):
7860 '''Configures an explicit audio output device. 7861 If the module paramater is None, audio output will be moved to the device 7862 specified by the device identifier string immediately. This is the 7863 recommended usage. 7864 A list of adequate potential device strings can be obtained with 7865 L{libvlc_audio_output_device_enum}(). 7866 However passing None is supported in LibVLC version 2.2.0 and later only; 7867 in earlier versions, this function would have no effects when the module 7868 parameter was None. 7869 If the module parameter is not None, the device parameter of the 7870 corresponding audio output, if it exists, will be set to the specified 7871 string. Note that some audio output modules do not have such a parameter 7872 (notably MMDevice and PulseAudio). 7873 A list of adequate potential device strings can be obtained with 7874 L{libvlc_audio_output_device_list_get}(). 7875 @note: This function does not select the specified audio output plugin. 7876 L{libvlc_audio_output_set}() is used for that purpose. 7877 @warning: The syntax for the device parameter depends on the audio output. 7878 Some audio output modules require further parameters (e.g. a channels map 7879 in the case of ALSA). 7880 @param mp: media player. 7881 @param module: If None, current audio output module. if non-None, name of audio output module. 7882 @param device_id: device identifier string. 7883 @return: Nothing. Errors are ignored (this is a design bug). 7884 ''' 7885 f = _Cfunctions.get('libvlc_audio_output_device_set', None) or \ 7886 _Cfunction('libvlc_audio_output_device_set', ((1,), (1,), (1,),), None, 7887 None, MediaPlayer, ctypes.c_char_p, ctypes.c_char_p) 7888 return f(mp, module, device_id)
7889
7890 -def libvlc_audio_output_device_get(mp):
7891 '''Get the current audio output device identifier. 7892 This complements L{libvlc_audio_output_device_set}(). 7893 @warning: The initial value for the current audio output device identifier 7894 may not be set or may be some unknown value. A LibVLC application should 7895 compare this value against the known device identifiers (e.g. those that 7896 were previously retrieved by a call to L{libvlc_audio_output_device_enum} or 7897 L{libvlc_audio_output_device_list_get}) to find the current audio output device. 7898 It is possible that the selected audio output device changes (an external 7899 change) without a call to L{libvlc_audio_output_device_set}. That may make this 7900 method unsuitable to use if a LibVLC application is attempting to track 7901 dynamic audio device changes as they happen. 7902 @param mp: media player. 7903 @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}()). 7904 @version: LibVLC 3.0.0 or later. 7905 ''' 7906 f = _Cfunctions.get('libvlc_audio_output_device_get', None) or \ 7907 _Cfunction('libvlc_audio_output_device_get', ((1,),), string_result, 7908 ctypes.c_void_p, MediaPlayer) 7909 return f(mp)
7910
7911 -def libvlc_audio_toggle_mute(p_mi):
7912 '''Toggle mute status. 7913 @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}(). 7914 ''' 7915 f = _Cfunctions.get('libvlc_audio_toggle_mute', None) or \ 7916 _Cfunction('libvlc_audio_toggle_mute', ((1,),), None, 7917 None, MediaPlayer) 7918 return f(p_mi)
7919
7920 -def libvlc_audio_get_mute(p_mi):
7921 '''Get current mute status. 7922 @param p_mi: media player. 7923 @return: the mute status (boolean) if defined, -1 if undefined/unapplicable. 7924 ''' 7925 f = _Cfunctions.get('libvlc_audio_get_mute', None) or \ 7926 _Cfunction('libvlc_audio_get_mute', ((1,),), None, 7927 ctypes.c_int, MediaPlayer) 7928 return f(p_mi)
7929
7930 -def libvlc_audio_set_mute(p_mi, status):
7931 '''Set mute status. 7932 @param p_mi: media player. 7933 @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. 7934 ''' 7935 f = _Cfunctions.get('libvlc_audio_set_mute', None) or \ 7936 _Cfunction('libvlc_audio_set_mute', ((1,), (1,),), None, 7937 None, MediaPlayer, ctypes.c_int) 7938 return f(p_mi, status)
7939
7940 -def libvlc_audio_get_volume(p_mi):
7941 '''Get current software audio volume. 7942 @param p_mi: media player. 7943 @return: the software volume in percents (0 = mute, 100 = nominal / 0dB). 7944 ''' 7945 f = _Cfunctions.get('libvlc_audio_get_volume', None) or \ 7946 _Cfunction('libvlc_audio_get_volume', ((1,),), None, 7947 ctypes.c_int, MediaPlayer) 7948 return f(p_mi)
7949
7950 -def libvlc_audio_set_volume(p_mi, i_volume):
7951 '''Set current software audio volume. 7952 @param p_mi: media player. 7953 @param i_volume: the volume in percents (0 = mute, 100 = 0dB). 7954 @return: 0 if the volume was set, -1 if it was out of range. 7955 ''' 7956 f = _Cfunctions.get('libvlc_audio_set_volume', None) or \ 7957 _Cfunction('libvlc_audio_set_volume', ((1,), (1,),), None, 7958 ctypes.c_int, MediaPlayer, ctypes.c_int) 7959 return f(p_mi, i_volume)
7960
7961 -def libvlc_audio_get_track_count(p_mi):
7962 '''Get number of available audio tracks. 7963 @param p_mi: media player. 7964 @return: the number of available audio tracks (int), or -1 if unavailable. 7965 ''' 7966 f = _Cfunctions.get('libvlc_audio_get_track_count', None) or \ 7967 _Cfunction('libvlc_audio_get_track_count', ((1,),), None, 7968 ctypes.c_int, MediaPlayer) 7969 return f(p_mi)
7970
7971 -def libvlc_audio_get_track_description(p_mi):
7972 '''Get the description of available audio tracks. 7973 @param p_mi: media player. 7974 @return: list with description of available audio tracks, or None. It must be freed with L{libvlc_track_description_list_release}(). 7975 ''' 7976 f = _Cfunctions.get('libvlc_audio_get_track_description', None) or \ 7977 _Cfunction('libvlc_audio_get_track_description', ((1,),), None, 7978 ctypes.POINTER(TrackDescription), MediaPlayer) 7979 return f(p_mi)
7980
7981 -def libvlc_audio_get_track(p_mi):
7982 '''Get current audio track. 7983 @param p_mi: media player. 7984 @return: the audio track ID or -1 if no active input. 7985 ''' 7986 f = _Cfunctions.get('libvlc_audio_get_track', None) or \ 7987 _Cfunction('libvlc_audio_get_track', ((1,),), None, 7988 ctypes.c_int, MediaPlayer) 7989 return f(p_mi)
7990
7991 -def libvlc_audio_set_track(p_mi, i_track):
7992 '''Set current audio track. 7993 @param p_mi: media player. 7994 @param i_track: the track ID (i_id field from track description). 7995 @return: 0 on success, -1 on error. 7996 ''' 7997 f = _Cfunctions.get('libvlc_audio_set_track', None) or \ 7998 _Cfunction('libvlc_audio_set_track', ((1,), (1,),), None, 7999 ctypes.c_int, MediaPlayer, ctypes.c_int) 8000 return f(p_mi, i_track)
8001
8002 -def libvlc_audio_get_channel(p_mi):
8003 '''Get current audio channel. 8004 @param p_mi: media player. 8005 @return: the audio channel See L{AudioOutputChannel}. 8006 ''' 8007 f = _Cfunctions.get('libvlc_audio_get_channel', None) or \ 8008 _Cfunction('libvlc_audio_get_channel', ((1,),), None, 8009 ctypes.c_int, MediaPlayer) 8010 return f(p_mi)
8011
8012 -def libvlc_audio_set_channel(p_mi, channel):
8013 '''Set current audio channel. 8014 @param p_mi: media player. 8015 @param channel: the audio channel, See L{AudioOutputChannel}. 8016 @return: 0 on success, -1 on error. 8017 ''' 8018 f = _Cfunctions.get('libvlc_audio_set_channel', None) or \ 8019 _Cfunction('libvlc_audio_set_channel', ((1,), (1,),), None, 8020 ctypes.c_int, MediaPlayer, ctypes.c_int) 8021 return f(p_mi, channel)
8022
8023 -def libvlc_audio_get_delay(p_mi):
8024 '''Get current audio delay. 8025 @param p_mi: media player. 8026 @return: the audio delay (microseconds). 8027 @version: LibVLC 1.1.1 or later. 8028 ''' 8029 f = _Cfunctions.get('libvlc_audio_get_delay', None) or \ 8030 _Cfunction('libvlc_audio_get_delay', ((1,),), None, 8031 ctypes.c_int64, MediaPlayer) 8032 return f(p_mi)
8033
8034 -def libvlc_audio_set_delay(p_mi, i_delay):
8035 '''Set current audio delay. The audio delay will be reset to zero each time the media changes. 8036 @param p_mi: media player. 8037 @param i_delay: the audio delay (microseconds). 8038 @return: 0 on success, -1 on error. 8039 @version: LibVLC 1.1.1 or later. 8040 ''' 8041 f = _Cfunctions.get('libvlc_audio_set_delay', None) or \ 8042 _Cfunction('libvlc_audio_set_delay', ((1,), (1,),), None, 8043 ctypes.c_int, MediaPlayer, ctypes.c_int64) 8044 return f(p_mi, i_delay)
8045
8046 -def libvlc_audio_equalizer_get_preset_count():
8047 '''Get the number of equalizer presets. 8048 @return: number of presets. 8049 @version: LibVLC 2.2.0 or later. 8050 ''' 8051 f = _Cfunctions.get('libvlc_audio_equalizer_get_preset_count', None) or \ 8052 _Cfunction('libvlc_audio_equalizer_get_preset_count', (), None, 8053 ctypes.c_uint) 8054 return f()
8055
8056 -def libvlc_audio_equalizer_get_preset_name(u_index):
8057 '''Get the name of a particular equalizer preset. 8058 This name can be used, for example, to prepare a preset label or menu in a user 8059 interface. 8060 @param u_index: index of the preset, counting from zero. 8061 @return: preset name, or None if there is no such preset. 8062 @version: LibVLC 2.2.0 or later. 8063 ''' 8064 f = _Cfunctions.get('libvlc_audio_equalizer_get_preset_name', None) or \ 8065 _Cfunction('libvlc_audio_equalizer_get_preset_name', ((1,),), None, 8066 ctypes.c_char_p, ctypes.c_uint) 8067 return f(u_index)
8068
8069 -def libvlc_audio_equalizer_get_band_count():
8070 '''Get the number of distinct frequency bands for an equalizer. 8071 @return: number of frequency bands. 8072 @version: LibVLC 2.2.0 or later. 8073 ''' 8074 f = _Cfunctions.get('libvlc_audio_equalizer_get_band_count', None) or \ 8075 _Cfunction('libvlc_audio_equalizer_get_band_count', (), None, 8076 ctypes.c_uint) 8077 return f()
8078
8079 -def libvlc_audio_equalizer_get_band_frequency(u_index):
8080 '''Get a particular equalizer band frequency. 8081 This value can be used, for example, to create a label for an equalizer band control 8082 in a user interface. 8083 @param u_index: index of the band, counting from zero. 8084 @return: equalizer band frequency (Hz), or -1 if there is no such band. 8085 @version: LibVLC 2.2.0 or later. 8086 ''' 8087 f = _Cfunctions.get('libvlc_audio_equalizer_get_band_frequency', None) or \ 8088 _Cfunction('libvlc_audio_equalizer_get_band_frequency', ((1,),), None, 8089 ctypes.c_float, ctypes.c_uint) 8090 return f(u_index)
8091
8092 -def libvlc_audio_equalizer_new():
8093 '''Create a new default equalizer, with all frequency values zeroed. 8094 The new equalizer can subsequently be applied to a media player by invoking 8095 L{libvlc_media_player_set_equalizer}(). 8096 The returned handle should be freed via L{libvlc_audio_equalizer_release}() when 8097 it is no longer needed. 8098 @return: opaque equalizer handle, or None on error. 8099 @version: LibVLC 2.2.0 or later. 8100 ''' 8101 f = _Cfunctions.get('libvlc_audio_equalizer_new', None) or \ 8102 _Cfunction('libvlc_audio_equalizer_new', (), class_result(AudioEqualizer), 8103 ctypes.c_void_p) 8104 return f()
8105
8106 -def libvlc_audio_equalizer_new_from_preset(u_index):
8107 '''Create a new equalizer, with initial frequency values copied from an existing 8108 preset. 8109 The new equalizer can subsequently be applied to a media player by invoking 8110 L{libvlc_media_player_set_equalizer}(). 8111 The returned handle should be freed via L{libvlc_audio_equalizer_release}() when 8112 it is no longer needed. 8113 @param u_index: index of the preset, counting from zero. 8114 @return: opaque equalizer handle, or None on error. 8115 @version: LibVLC 2.2.0 or later. 8116 ''' 8117 f = _Cfunctions.get('libvlc_audio_equalizer_new_from_preset', None) or \ 8118 _Cfunction('libvlc_audio_equalizer_new_from_preset', ((1,),), class_result(AudioEqualizer), 8119 ctypes.c_void_p, ctypes.c_uint) 8120 return f(u_index)
8121
8122 -def libvlc_audio_equalizer_release(p_equalizer):
8123 '''Release a previously created equalizer instance. 8124 The equalizer was previously created by using L{libvlc_audio_equalizer_new}() or 8125 L{libvlc_audio_equalizer_new_from_preset}(). 8126 It is safe to invoke this method with a None p_equalizer parameter for no effect. 8127 @param p_equalizer: opaque equalizer handle, or None. 8128 @version: LibVLC 2.2.0 or later. 8129 ''' 8130 f = _Cfunctions.get('libvlc_audio_equalizer_release', None) or \ 8131 _Cfunction('libvlc_audio_equalizer_release', ((1,),), None, 8132 None, AudioEqualizer) 8133 return f(p_equalizer)
8134
8135 -def libvlc_audio_equalizer_set_preamp(p_equalizer, f_preamp):
8136 '''Set a new pre-amplification value for an equalizer. 8137 The new equalizer settings are subsequently applied to a media player by invoking 8138 L{libvlc_media_player_set_equalizer}(). 8139 The supplied amplification value will be clamped to the -20.0 to +20.0 range. 8140 @param p_equalizer: valid equalizer handle, must not be None. 8141 @param f_preamp: preamp value (-20.0 to 20.0 Hz). 8142 @return: zero on success, -1 on error. 8143 @version: LibVLC 2.2.0 or later. 8144 ''' 8145 f = _Cfunctions.get('libvlc_audio_equalizer_set_preamp', None) or \ 8146 _Cfunction('libvlc_audio_equalizer_set_preamp', ((1,), (1,),), None, 8147 ctypes.c_int, AudioEqualizer, ctypes.c_float) 8148 return f(p_equalizer, f_preamp)
8149
8150 -def libvlc_audio_equalizer_get_preamp(p_equalizer):
8151 '''Get the current pre-amplification value from an equalizer. 8152 @param p_equalizer: valid equalizer handle, must not be None. 8153 @return: preamp value (Hz). 8154 @version: LibVLC 2.2.0 or later. 8155 ''' 8156 f = _Cfunctions.get('libvlc_audio_equalizer_get_preamp', None) or \ 8157 _Cfunction('libvlc_audio_equalizer_get_preamp', ((1,),), None, 8158 ctypes.c_float, AudioEqualizer) 8159 return f(p_equalizer)
8160
8161 -def libvlc_audio_equalizer_set_amp_at_index(p_equalizer, f_amp, u_band):
8162 '''Set a new amplification value for a particular equalizer frequency band. 8163 The new equalizer settings are subsequently applied to a media player by invoking 8164 L{libvlc_media_player_set_equalizer}(). 8165 The supplied amplification value will be clamped to the -20.0 to +20.0 range. 8166 @param p_equalizer: valid equalizer handle, must not be None. 8167 @param f_amp: amplification value (-20.0 to 20.0 Hz). 8168 @param u_band: index, counting from zero, of the frequency band to set. 8169 @return: zero on success, -1 on error. 8170 @version: LibVLC 2.2.0 or later. 8171 ''' 8172 f = _Cfunctions.get('libvlc_audio_equalizer_set_amp_at_index', None) or \ 8173 _Cfunction('libvlc_audio_equalizer_set_amp_at_index', ((1,), (1,), (1,),), None, 8174 ctypes.c_int, AudioEqualizer, ctypes.c_float, ctypes.c_uint) 8175 return f(p_equalizer, f_amp, u_band)
8176
8177 -def libvlc_audio_equalizer_get_amp_at_index(p_equalizer, u_band):
8178 '''Get the amplification value for a particular equalizer frequency band. 8179 @param p_equalizer: valid equalizer handle, must not be None. 8180 @param u_band: index, counting from zero, of the frequency band to get. 8181 @return: amplification value (Hz); NaN if there is no such frequency band. 8182 @version: LibVLC 2.2.0 or later. 8183 ''' 8184 f = _Cfunctions.get('libvlc_audio_equalizer_get_amp_at_index', None) or \ 8185 _Cfunction('libvlc_audio_equalizer_get_amp_at_index', ((1,), (1,),), None, 8186 ctypes.c_float, AudioEqualizer, ctypes.c_uint) 8187 return f(p_equalizer, u_band)
8188
8189 -def libvlc_media_player_set_equalizer(p_mi, p_equalizer):
8190 '''Apply new equalizer settings to a media player. 8191 The equalizer is first created by invoking L{libvlc_audio_equalizer_new}() or 8192 L{libvlc_audio_equalizer_new_from_preset}(). 8193 It is possible to apply new equalizer settings to a media player whether the media 8194 player is currently playing media or not. 8195 Invoking this method will immediately apply the new equalizer settings to the audio 8196 output of the currently playing media if there is any. 8197 If there is no currently playing media, the new equalizer settings will be applied 8198 later if and when new media is played. 8199 Equalizer settings will automatically be applied to subsequently played media. 8200 To disable the equalizer for a media player invoke this method passing None for the 8201 p_equalizer parameter. 8202 The media player does not keep a reference to the supplied equalizer so it is safe 8203 for an application to release the equalizer reference any time after this method 8204 returns. 8205 @param p_mi: opaque media player handle. 8206 @param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player. 8207 @return: zero on success, -1 on error. 8208 @version: LibVLC 2.2.0 or later. 8209 ''' 8210 f = _Cfunctions.get('libvlc_media_player_set_equalizer', None) or \ 8211 _Cfunction('libvlc_media_player_set_equalizer', ((1,), (1,),), None, 8212 ctypes.c_int, MediaPlayer, AudioEqualizer) 8213 return f(p_mi, p_equalizer)
8214
8215 -def libvlc_media_player_get_role(p_mi):
8216 '''Gets the media role. 8217 @param p_mi: media player. 8218 @return: the media player role (\ref libvlc_media_player_role_t). 8219 @version: LibVLC 3.0.0 and later. 8220 ''' 8221 f = _Cfunctions.get('libvlc_media_player_get_role', None) or \ 8222 _Cfunction('libvlc_media_player_get_role', ((1,),), None, 8223 ctypes.c_int, MediaPlayer) 8224 return f(p_mi)
8225
8226 -def libvlc_media_player_set_role(p_mi, role):
8227 '''Sets the media role. 8228 @param p_mi: media player. 8229 @param role: the media player role (\ref libvlc_media_player_role_t). 8230 @return: 0 on success, -1 on error. 8231 ''' 8232 f = _Cfunctions.get('libvlc_media_player_set_role', None) or \ 8233 _Cfunction('libvlc_media_player_set_role', ((1,), (1,),), None, 8234 ctypes.c_int, MediaPlayer, ctypes.c_uint) 8235 return f(p_mi, role)
8236
8237 -def libvlc_media_list_player_new(p_instance):
8238 '''Create new media_list_player. 8239 @param p_instance: libvlc instance. 8240 @return: media list player instance or None on error. 8241 ''' 8242 f = _Cfunctions.get('libvlc_media_list_player_new', None) or \ 8243 _Cfunction('libvlc_media_list_player_new', ((1,),), class_result(MediaListPlayer), 8244 ctypes.c_void_p, Instance) 8245 return f(p_instance)
8246
8247 -def libvlc_media_list_player_release(p_mlp):
8248 '''Release a media_list_player after use 8249 Decrement the reference count of a media player object. If the 8250 reference count is 0, then L{libvlc_media_list_player_release}() will 8251 release the media player object. If the media player object 8252 has been released, then it should not be used again. 8253 @param p_mlp: media list player instance. 8254 ''' 8255 f = _Cfunctions.get('libvlc_media_list_player_release', None) or \ 8256 _Cfunction('libvlc_media_list_player_release', ((1,),), None, 8257 None, MediaListPlayer) 8258 return f(p_mlp)
8259
8260 -def libvlc_media_list_player_retain(p_mlp):
8261 '''Retain a reference to a media player list object. Use 8262 L{libvlc_media_list_player_release}() to decrement reference count. 8263 @param p_mlp: media player list object. 8264 ''' 8265 f = _Cfunctions.get('libvlc_media_list_player_retain', None) or \ 8266 _Cfunction('libvlc_media_list_player_retain', ((1,),), None, 8267 None, MediaListPlayer) 8268 return f(p_mlp)
8269
8270 -def libvlc_media_list_player_event_manager(p_mlp):
8271 '''Return the event manager of this media_list_player. 8272 @param p_mlp: media list player instance. 8273 @return: the event manager. 8274 ''' 8275 f = _Cfunctions.get('libvlc_media_list_player_event_manager', None) or \ 8276 _Cfunction('libvlc_media_list_player_event_manager', ((1,),), class_result(EventManager), 8277 ctypes.c_void_p, MediaListPlayer) 8278 return f(p_mlp)
8279
8280 -def libvlc_media_list_player_set_media_player(p_mlp, p_mi):
8281 '''Replace media player in media_list_player with this instance. 8282 @param p_mlp: media list player instance. 8283 @param p_mi: media player instance. 8284 ''' 8285 f = _Cfunctions.get('libvlc_media_list_player_set_media_player', None) or \ 8286 _Cfunction('libvlc_media_list_player_set_media_player', ((1,), (1,),), None, 8287 None, MediaListPlayer, MediaPlayer) 8288 return f(p_mlp, p_mi)
8289
8290 -def libvlc_media_list_player_get_media_player(p_mlp):
8291 '''Get media player of the media_list_player instance. 8292 @param p_mlp: media list player instance. 8293 @return: media player instance @note the caller is responsible for releasing the returned instance. 8294 ''' 8295 f = _Cfunctions.get('libvlc_media_list_player_get_media_player', None) or \ 8296 _Cfunction('libvlc_media_list_player_get_media_player', ((1,),), class_result(MediaPlayer), 8297 ctypes.c_void_p, MediaListPlayer) 8298 return f(p_mlp)
8299
8300 -def libvlc_media_list_player_set_media_list(p_mlp, p_mlist):
8301 '''Set the media list associated with the player. 8302 @param p_mlp: media list player instance. 8303 @param p_mlist: list of media. 8304 ''' 8305 f = _Cfunctions.get('libvlc_media_list_player_set_media_list', None) or \ 8306 _Cfunction('libvlc_media_list_player_set_media_list', ((1,), (1,),), None, 8307 None, MediaListPlayer, MediaList) 8308 return f(p_mlp, p_mlist)
8309
8310 -def libvlc_media_list_player_play(p_mlp):
8311 '''Play media list. 8312 @param p_mlp: media list player instance. 8313 ''' 8314 f = _Cfunctions.get('libvlc_media_list_player_play', None) or \ 8315 _Cfunction('libvlc_media_list_player_play', ((1,),), None, 8316 None, MediaListPlayer) 8317 return f(p_mlp)
8318
8319 -def libvlc_media_list_player_pause(p_mlp):
8320 '''Toggle pause (or resume) media list. 8321 @param p_mlp: media list player instance. 8322 ''' 8323 f = _Cfunctions.get('libvlc_media_list_player_pause', None) or \ 8324 _Cfunction('libvlc_media_list_player_pause', ((1,),), None, 8325 None, MediaListPlayer) 8326 return f(p_mlp)
8327
8328 -def libvlc_media_list_player_set_pause(p_mlp, do_pause):
8329 '''Pause or resume media list. 8330 @param p_mlp: media list player instance. 8331 @param do_pause: play/resume if zero, pause if non-zero. 8332 @version: LibVLC 3.0.0 or later. 8333 ''' 8334 f = _Cfunctions.get('libvlc_media_list_player_set_pause', None) or \ 8335 _Cfunction('libvlc_media_list_player_set_pause', ((1,), (1,),), None, 8336 None, MediaListPlayer, ctypes.c_int) 8337 return f(p_mlp, do_pause)
8338
8339 -def libvlc_media_list_player_is_playing(p_mlp):
8340 '''Is media list playing? 8341 @param p_mlp: media list player instance. 8342 @return: true for playing and false for not playing \libvlc_return_bool. 8343 ''' 8344 f = _Cfunctions.get('libvlc_media_list_player_is_playing', None) or \ 8345 _Cfunction('libvlc_media_list_player_is_playing', ((1,),), None, 8346 ctypes.c_int, MediaListPlayer) 8347 return f(p_mlp)
8348
8349 -def libvlc_media_list_player_get_state(p_mlp):
8350 '''Get current libvlc_state of media list player. 8351 @param p_mlp: media list player instance. 8352 @return: L{State} for media list player. 8353 ''' 8354 f = _Cfunctions.get('libvlc_media_list_player_get_state', None) or \ 8355 _Cfunction('libvlc_media_list_player_get_state', ((1,),), None, 8356 State, MediaListPlayer) 8357 return f(p_mlp)
8358
8359 -def libvlc_media_list_player_play_item_at_index(p_mlp, i_index):
8360 '''Play media list item at position index. 8361 @param p_mlp: media list player instance. 8362 @param i_index: index in media list to play. 8363 @return: 0 upon success -1 if the item wasn't found. 8364 ''' 8365 f = _Cfunctions.get('libvlc_media_list_player_play_item_at_index', None) or \ 8366 _Cfunction('libvlc_media_list_player_play_item_at_index', ((1,), (1,),), None, 8367 ctypes.c_int, MediaListPlayer, ctypes.c_int) 8368 return f(p_mlp, i_index)
8369
8370 -def libvlc_media_list_player_play_item(p_mlp, p_md):
8371 '''Play the given media item. 8372 @param p_mlp: media list player instance. 8373 @param p_md: the media instance. 8374 @return: 0 upon success, -1 if the media is not part of the media list. 8375 ''' 8376 f = _Cfunctions.get('libvlc_media_list_player_play_item', None) or \ 8377 _Cfunction('libvlc_media_list_player_play_item', ((1,), (1,),), None, 8378 ctypes.c_int, MediaListPlayer, Media) 8379 return f(p_mlp, p_md)
8380
8381 -def libvlc_media_list_player_stop(p_mlp):
8382 '''Stop playing media list. 8383 @param p_mlp: media list player instance. 8384 ''' 8385 f = _Cfunctions.get('libvlc_media_list_player_stop', None) or \ 8386 _Cfunction('libvlc_media_list_player_stop', ((1,),), None, 8387 None, MediaListPlayer) 8388 return f(p_mlp)
8389
8390 -def libvlc_media_list_player_next(p_mlp):
8391 '''Play next item from media list. 8392 @param p_mlp: media list player instance. 8393 @return: 0 upon success -1 if there is no next item. 8394 ''' 8395 f = _Cfunctions.get('libvlc_media_list_player_next', None) or \ 8396 _Cfunction('libvlc_media_list_player_next', ((1,),), None, 8397 ctypes.c_int, MediaListPlayer) 8398 return f(p_mlp)
8399
8400 -def libvlc_media_list_player_previous(p_mlp):
8401 '''Play previous item from media list. 8402 @param p_mlp: media list player instance. 8403 @return: 0 upon success -1 if there is no previous item. 8404 ''' 8405 f = _Cfunctions.get('libvlc_media_list_player_previous', None) or \ 8406 _Cfunction('libvlc_media_list_player_previous', ((1,),), None, 8407 ctypes.c_int, MediaListPlayer) 8408 return f(p_mlp)
8409
8410 -def libvlc_media_list_player_set_playback_mode(p_mlp, e_mode):
8411 '''Sets the playback mode for the playlist. 8412 @param p_mlp: media list player instance. 8413 @param e_mode: playback mode specification. 8414 ''' 8415 f = _Cfunctions.get('libvlc_media_list_player_set_playback_mode', None) or \ 8416 _Cfunction('libvlc_media_list_player_set_playback_mode', ((1,), (1,),), None, 8417 None, MediaListPlayer, PlaybackMode) 8418 return f(p_mlp, e_mode)
8419
8420 8421 # 5 function(s) blacklisted: 8422 # libvlc_audio_output_get_device_type 8423 # libvlc_audio_output_set_device_type 8424 # libvlc_dialog_set_callbacks 8425 # libvlc_printerr 8426 # libvlc_set_exit_handler 8427 8428 # 39 function(s) not wrapped as methods: 8429 # libvlc_audio_equalizer_get_band_count 8430 # libvlc_audio_equalizer_get_band_frequency 8431 # libvlc_audio_equalizer_get_preset_count 8432 # libvlc_audio_equalizer_get_preset_name 8433 # libvlc_audio_equalizer_new 8434 # libvlc_audio_equalizer_new_from_preset 8435 # libvlc_audio_output_device_list_release 8436 # libvlc_audio_output_list_release 8437 # libvlc_chapter_descriptions_release 8438 # libvlc_clearerr 8439 # libvlc_clock 8440 # libvlc_dialog_dismiss 8441 # libvlc_dialog_get_context 8442 # libvlc_dialog_post_action 8443 # libvlc_dialog_post_login 8444 # libvlc_dialog_set_context 8445 # libvlc_event_type_name 8446 # libvlc_free 8447 # libvlc_get_changeset 8448 # libvlc_get_compiler 8449 # libvlc_get_version 8450 # libvlc_log_clear 8451 # libvlc_log_close 8452 # libvlc_log_count 8453 # libvlc_log_get_context 8454 # libvlc_log_get_iterator 8455 # libvlc_log_get_object 8456 # libvlc_media_discoverer_list_release 8457 # libvlc_media_get_codec_description 8458 # libvlc_media_slaves_release 8459 # libvlc_media_tracks_release 8460 # libvlc_module_description_list_release 8461 # libvlc_new 8462 # libvlc_renderer_discoverer_list_release 8463 # libvlc_title_descriptions_release 8464 # libvlc_track_description_list_release 8465 # libvlc_track_description_release 8466 # libvlc_video_new_viewpoint 8467 # libvlc_vprinterr 8468 8469 # Start of footer.py # 8470 8471 # Backward compatibility 8472 -def callbackmethod(callback):
8473 """Now obsolete @callbackmethod decorator.""" 8474 return callback
8475 8476 # libvlc_free is not present in some versions of libvlc. If it is not 8477 # in the library, then emulate it by calling libc.free 8478 if not hasattr(dll, 'libvlc_free'): 8479 # need to find the free function in the C runtime. This is 8480 # platform specific. 8481 # For Linux and MacOSX 8482 libc_path = find_library('c') 8483 if libc_path: 8484 libc = ctypes.CDLL(libc_path) 8485 libvlc_free = libc.free 8486 else:
8487 # On win32, it is impossible to guess the proper lib to call 8488 # (msvcrt, mingw...). Just ignore the call: it will memleak, 8489 # but not prevent to run the application. 8490 - def libvlc_free(p):
8491 pass
8492 8493 # ensure argtypes is right, because default type of int won't 8494 # work on 64-bit systems 8495 libvlc_free.argtypes = [ ctypes.c_void_p ]
8496 8497 # Version functions 8498 -def _dot2int(v):
8499 '''(INTERNAL) Convert 'i.i.i[.i]' str to int. 8500 ''' 8501 t = [int(i) for i in v.split('.')] 8502 if len(t) == 3: 8503 if t[2] < 100: 8504 t.append(0) 8505 else: # 100 is arbitrary 8506 t[2:4] = divmod(t[2], 100) 8507 elif len(t) != 4: 8508 raise ValueError('"i.i.i[.i]": %r' % (v,)) 8509 if min(t) < 0 or max(t) > 255: 8510 raise ValueError('[0..255]: %r' % (v,)) 8511 i = t.pop(0) 8512 while t: 8513 i = (i << 8) + t.pop(0) 8514 return i
8515
8516 -def hex_version():
8517 """Return the version of these bindings in hex or 0 if unavailable. 8518 """ 8519 try: 8520 return _dot2int(__version__) 8521 except (NameError, ValueError): 8522 return 0
8523
8524 -def libvlc_hex_version():
8525 """Return the libvlc version in hex or 0 if unavailable. 8526 """ 8527 try: 8528 return _dot2int(bytes_to_str(libvlc_get_version()).split()[0]) 8529 except ValueError: 8530 return 0
8531
8532 -def debug_callback(event, *args, **kwds):
8533 '''Example callback, useful for debugging. 8534 ''' 8535 l = ['event %s' % (event.type,)] 8536 if args: 8537 l.extend(map(str, args)) 8538 if kwds: 8539 l.extend(sorted('%s=%s' % t for t in kwds.items())) 8540 print('Debug callback (%s)' % ', '.join(l))
8541 8542 8543 if __name__ == '__main__': 8544 logging.basicConfig(level=logging.DEBUG) 8545 try: 8546 from msvcrt import getch 8547 except ImportError: 8548 import termios 8549 import tty
8550 8551 - def getch(): # getchar(), getc(stdin) #PYCHOK flake
8552 fd = sys.stdin.fileno() 8553 old = termios.tcgetattr(fd) 8554 try: 8555 tty.setraw(fd) 8556 ch = sys.stdin.read(1) 8557 finally: 8558 termios.tcsetattr(fd, termios.TCSADRAIN, old) 8559 return ch 8560
8561 - def end_callback(event):
8562 print('End of media stream (event %s)' % event.type) 8563 sys.exit(0)
8564 8565 echo_position = False
8566 - def pos_callback(event, player):
8567 if echo_position: 8568 sys.stdout.write('\r%s to %.2f%% (%.2f%%)' % (event.type, 8569 event.u.new_position * 100, 8570 player.get_position() * 100)) 8571 sys.stdout.flush()
8572 8593 8604 8605 if '-h' in sys.argv[:2] or '--help' in sys.argv[:2]: 8606 print('Usage: %s [options] <movie_filename>' % sys.argv[0]) 8607 print('Once launched, type ? for help.') 8608 print('') 8609 8610 elif '-v' in sys.argv[:2] or '--version' in sys.argv[:2]: 8611 print_version() 8612 print_python() 8613 print('') 8614 8615 else: 8616 movie = os.path.expanduser(sys.argv.pop()) 8617 if not os.access(movie, os.R_OK): 8618 print('Error: %s file not readable' % movie) 8619 sys.exit(1) 8620 8621 # Need --sub-source=marq in order to use marquee below 8622 instance = Instance(["--sub-source=marq"] + sys.argv[1:]) 8623 try: 8624 media = instance.media_new(movie) 8625 except (AttributeError, NameError) as e: 8626 print('%s: %s (%s %s vs LibVLC %s)' % (e.__class__.__name__, e, 8627 sys.argv[0], __version__, 8628 libvlc_get_version())) 8629 sys.exit(1) 8630 player = instance.media_player_new() 8631 player.set_media(media) 8632 player.play() 8633 8634 # Some marquee examples. Marquee requires '--sub-source marq' in the 8635 # Instance() call above, see <http://www.videolan.org/doc/play-howto/en/ch04.html> 8636 player.video_set_marquee_int(VideoMarqueeOption.Enable, 1) 8637 player.video_set_marquee_int(VideoMarqueeOption.Size, 24) # pixels 8638 player.video_set_marquee_int(VideoMarqueeOption.Position, Position.Bottom) 8639 if False: # only one marquee can be specified 8640 player.video_set_marquee_int(VideoMarqueeOption.Timeout, 5000) # millisec, 0==forever 8641 t = media.get_mrl() # movie 8642 else: # update marquee text periodically 8643 player.video_set_marquee_int(VideoMarqueeOption.Timeout, 0) # millisec, 0==forever 8644 player.video_set_marquee_int(VideoMarqueeOption.Refresh, 1000) # millisec (or sec?) 8645 ##t = '$L / $D or $P at $T' 8646 t = '%Y-%m-%d %H:%M:%S' 8647 player.video_set_marquee_string(VideoMarqueeOption.Text, str_to_bytes(t)) 8648 8649 # Some event manager examples. Note, the callback can be any Python 8650 # callable and does not need to be decorated. Optionally, specify 8651 # any number of positional and/or keyword arguments to be passed 8652 # to the callback (in addition to the first one, an Event instance). 8653 event_manager = player.event_manager() 8654 event_manager.event_attach(EventType.MediaPlayerEndReached, end_callback) 8655 event_manager.event_attach(EventType.MediaPlayerPositionChanged, pos_callback, player)
8656 8657 - def mspf():
8658 """Milliseconds per frame""" 8659 return int(1000 // (player.get_fps() or 25))
8660 8679
8680 - def sec_forward():
8681 """Go forward one sec""" 8682 player.set_time(player.get_time() + 1000)
8683
8684 - def sec_backward():
8685 """Go backward one sec""" 8686 player.set_time(player.get_time() - 1000)
8687
8688 - def frame_forward():
8689 """Go forward one frame""" 8690 player.set_time(player.get_time() + mspf())
8691
8692 - def frame_backward():
8693 """Go backward one frame""" 8694 player.set_time(player.get_time() - mspf())
8695 8703
8704 - def quit_app():
8705 """Stop and exit""" 8706 sys.exit(0)
8707
8708 - def toggle_echo_position():
8709 """Toggle echoing of media position""" 8710 global echo_position 8711 echo_position = not echo_position
8712 8713 keybindings = { 8714 ' ': player.pause, 8715 '+': sec_forward, 8716 '-': sec_backward, 8717 '.': frame_forward, 8718 ',': frame_backward, 8719 'f': player.toggle_fullscreen, 8720 'i': print_info, 8721 'p': toggle_echo_position, 8722 'q': quit_app, 8723 '?': print_help, 8724 } 8725 8726 print('Press q to quit, ? to get help.%s' % os.linesep) 8727 while True: 8728 k = getch() 8729 print('> %s' % k) 8730 if k in keybindings: 8731 keybindings[k]() 8732 elif k.isdigit(): 8733 # jump to fraction of the movie. 8734 player.set_position(float('0.'+k)) 8735