././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1728311982.7532592 python_vlc-3.0.21203/0000755000175200017520000000000014700771257014151 5ustar00oaubertoaubert././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1728311801.0 python_vlc-3.0.21203/COPYING0000644000175200017520000006364214700770771015217 0ustar00oaubertoaubert GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1728311801.0 python_vlc-3.0.21203/MANIFEST.in0000644000175200017520000000020314700770771015702 0ustar00oaubertoaubertinclude setup.py include vlc.py include COPYING MANIFEST.in README.module include distribute_setup.py recursive-include examples * ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1728311982.7532592 python_vlc-3.0.21203/PKG-INFO0000644000175200017520000000776514700771257015265 0ustar00oaubertoaubertMetadata-Version: 2.1 Name: python-vlc Version: 3.0.21203 Summary: VLC bindings for python. Author-email: Olivier Aubert Maintainer-email: Olivier Aubert License: LGPL-2.1+ Project-URL: Homepage, https://wiki.videolan.org/PythonBinding Project-URL: Documentation, https://www.olivieraubert.net/vlc/python-ctypes/doc/ Project-URL: Repository, https://github.com/oaubert/python-vlc.git Project-URL: Alternate repository, https://git.videolan.org/?p=vlc/bindings/python.git;a=summary Project-URL: Bug Tracker, https://github.com/oaubert/python-vlc/issues Keywords: vlc,video Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+) Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: POSIX :: Linux Classifier: Operating System :: POSIX :: Other Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Multimedia Classifier: Topic :: Multimedia :: Sound/Audio Classifier: Topic :: Multimedia :: Video Description-Content-Type: text/x-rst License-File: COPYING Python ctypes-based bindings for libvlc ======================================= The bindings use ctypes to directly call the libvlc dynamic lib, and the code is generated from the include files defining the public API. The same module should be compatible with various versions of libvlc 3.*. However, there may be incompatible changes between major versions. Installing the module --------------------- You can install the module through PyPI: pip install python-vlc Using the module ---------------- The module offers two ways of accessing the API - a raw access to all exported methods, and more convenient wrapper classes. Using wrapper classes +++++++++++++++++++++ Most major structures of the libvlc API (Instance, Media, MediaPlayer, etc) are wrapped as classes, with shorter method names and some adaptations to provide a more pythonic API: >>> import vlc >>> player = vlc.MediaPlayer('file:///tmp/foo.avi') >>> player.play() >>> player.get_instance() # returns the corresponding instance In this case, a default ``vlc.Instance`` will be instanciated and stored in ``vlc._default_instance``. It will be used to instanciate the various classes (``Media``, ``MediaList``, ``MediaPlayer``, etc). You also can use wrapper methods closer to the original libvlc API: >>> import vlc >>> instance = vlc.Instance('--no-audio', '--fullscreen') >>> player = instance.media_player_new() >>> player.audio_get_volume() 50 >>> media = instance.media_new('file:///tmp/foo.avi') >>> media.get_mrl() 'file:///tmp/foo.avi' >>> player.set_media(m) >>> player.play() Using raw access ++++++++++++++++ Libvlc methods are available as attributes of the vlc module (as vlc.libvlc_*). Use their docstring (any introspective shell like ipython is your friend) to explore them, or refer to the online documentation at https://olivieraubert.net/vlc/python-ctypes/ >>> import vlc >>> vlc.libvlc_get_version() '3.0.0-rc2 Vetinari' >>> exc = vlc.VLCException() >>> instance = vlc.libvlc_new(0, [], exc) >>> instance >>> vlc.libvlc_audio_get_volume(instance, exc) 50 Example code ++++++++++++ You can find [example files](https://github.com/oaubert/python-vlc/tree/master/examples) in the repository. Note that the ``vlc.py`` module can itself be invoked as an application using its own features, which also serves as a API usage example. See the [end of the module](https://github.com/oaubert/python-vlc/blob/master/generated/3.0/vlc.py#L12525) after the line ``if __name__ == "__main__":`` License ------- The generated module is licensed, like libvlc, under the GNU Lesser General Public License 2.1 or later. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1728311801.0 python_vlc-3.0.21203/README.module0000644000175200017520000000527314700770771016324 0ustar00oaubertoaubertPython ctypes-based bindings for libvlc ======================================= The bindings use ctypes to directly call the libvlc dynamic lib, and the code is generated from the include files defining the public API. The same module should be compatible with various versions of libvlc 3.*. However, there may be incompatible changes between major versions. Installing the module --------------------- You can install the module through PyPI: pip install python-vlc Using the module ---------------- The module offers two ways of accessing the API - a raw access to all exported methods, and more convenient wrapper classes. Using wrapper classes +++++++++++++++++++++ Most major structures of the libvlc API (Instance, Media, MediaPlayer, etc) are wrapped as classes, with shorter method names and some adaptations to provide a more pythonic API: >>> import vlc >>> player = vlc.MediaPlayer('file:///tmp/foo.avi') >>> player.play() >>> player.get_instance() # returns the corresponding instance In this case, a default ``vlc.Instance`` will be instanciated and stored in ``vlc._default_instance``. It will be used to instanciate the various classes (``Media``, ``MediaList``, ``MediaPlayer``, etc). You also can use wrapper methods closer to the original libvlc API: >>> import vlc >>> instance = vlc.Instance('--no-audio', '--fullscreen') >>> player = instance.media_player_new() >>> player.audio_get_volume() 50 >>> media = instance.media_new('file:///tmp/foo.avi') >>> media.get_mrl() 'file:///tmp/foo.avi' >>> player.set_media(m) >>> player.play() Using raw access ++++++++++++++++ Libvlc methods are available as attributes of the vlc module (as vlc.libvlc_*). Use their docstring (any introspective shell like ipython is your friend) to explore them, or refer to the online documentation at https://olivieraubert.net/vlc/python-ctypes/ >>> import vlc >>> vlc.libvlc_get_version() '3.0.0-rc2 Vetinari' >>> exc = vlc.VLCException() >>> instance = vlc.libvlc_new(0, [], exc) >>> instance >>> vlc.libvlc_audio_get_volume(instance, exc) 50 Example code ++++++++++++ You can find [example files](https://github.com/oaubert/python-vlc/tree/master/examples) in the repository. Note that the ``vlc.py`` module can itself be invoked as an application using its own features, which also serves as a API usage example. See the [end of the module](https://github.com/oaubert/python-vlc/blob/master/generated/3.0/vlc.py#L12525) after the line ``if __name__ == "__main__":`` License ------- The generated module is licensed, like libvlc, under the GNU Lesser General Public License 2.1 or later. ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1728311982.749259 python_vlc-3.0.21203/examples/0000755000175200017520000000000014700771257015767 5ustar00oaubertoaubert././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1681918170.0 python_vlc-3.0.21203/examples/cocoavlc.py0000755000175200017520000006531214420004332020122 0ustar00oaubertoaubert#!/usr/bin/env python # -*- coding: utf-8 -*- # Example of using PyCocoa to create a # window, table and an application menu to run a video using VLC on macOS. # The Python-VLC binding and the # corresponding VLC App, see . # PyCocoa version 21.11.02 or later must be installed (on macOS Monterey) # This VLC player has been tested with VLC 3.0.10-16, 3.0.6-8, 3.0.4, # 3.0.1-2, 2.2.8 and 2.2.6 and the compatible vlc.py Python-VLC binding # using 64-bit Python 3.10.0, 3.9.6, 3.9.0-1, 3.8.10, 3.8.6, 3.7.0-4, # 3.6.4-5 and 2.7.14-18 on macOS 12.0.1 Monterey, 11.5.2-6.1 Big Sur # (aka 10.16), 10.15.6 Catalina, 10.14.6 Mojave and 10.13.4-6 High Sierra. # This player does not work with PyPy nor with Intel(R) # Python . # Python 3.10.0, 3.9.6 and macOS' Python 2.7.16 run on Apple Silicon # (C{arm64} I{natively}), all other Python versions run on Intel (C{x86_64}) # or I{emulated} Intel (C{"arm64_x86_64"}, see function C{pycocoa.machine}). # MIT License # # Copyright (C) 2017-2021 -- mrJean1 at Gmail -- All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. def _PyPI(package): return 'see ' % (package,) __all__ = ('AppVLC',) # PYCHOK expected __version__ = '22.12.14' try: import vlc except ImportError: raise ImportError('no %s, %s' % ('vlc.py', _PyPI('Python-VLC'))) try: from pycocoa import __name__ as _pycocoa_, \ __version__ as _pycocoa_version except ImportError: raise ImportError('no %s, %s' % (_pycocoa_, _PyPI('PyCocoa'))) if _pycocoa_version < '21.11.04': # __version__ raise ImportError('%s %s or later required, %s' % ( _pycocoa_, '21.11.04', _PyPI('PyCocoa'))) del _PyPI # all imports listed explicitly to help PyChecker from pycocoa import App, app_title, aspect_ratio, bytes2str, closeTables, \ get_printer, Item, ItemSeparator, machine, MediaWindow, Menu, \ OpenPanel, printf, str2bytes, Table, z1000str, zSIstr from os.path import basename, getsize, isfile, splitext from platform import architecture, mac_ver import sys from threading import Thread from time import sleep, strftime, strptime try: from urllib import unquote as mrl_unquote # Python 2 except ImportError: from urllib.parse import unquote as mrl_unquote # Python 3+ _Adjust = vlc.VideoAdjustOption # Enum # _Adjust3 = {_Adjust.Brightness: (0, 1, 2), _Adjust.Contrast: (0, 1, 2), _Adjust.Gamma: (0.01, 1, 10), _Adjust.Hue: (-180, 0, 180), _Adjust.Saturation: (0, 1, 3)} _AppleSi = machine().startswith('arm64') _Argv0 = splitext(basename(__file__))[0] _Movies = '.m4v', '.mov', '.mp4' # lower-case file types for movies, videos _PNG = '.png' # snapshot always .png, even if .jpg or .tiff specified _Python = sys.version.split()[0], architecture()[0] # PYCHOK false _Select = 'Select a video file from the panel' _VLC_3_ = vlc.__version__.split('.')[0] > '2' and \ bytes2str(vlc.libvlc_get_version().split(b'.')[0]) > '2' # class _Color(object): # PYCHOK expected Aqua = 0x00FFFF Black = 0x000000 Blue = 0x0000FF Fuchsia = 0xFF00FF Gray = 0x808080 Green = 0x008000 Lime = 0x00FF00 Maroon = 0x800000 Navy = 0x000080 Olive = 0x808000 Purple = 0x800080 Red = 0xFF0000 Silver = 0xC0C0C0 Teal = 0x008080 White = 0xFFFFFF Yellow = 0xFFFF00 _Color = _Color() # PYCHOK enum-like def _fstrz(f, n=1, x=''): # format float, strip trailing decimal zeros and point return _fstrz0(f, n).rstrip('.') + x def _fstrz0(f, n=1, x=''): # format float, strip trailing decimal zeros t = '%.*f' % (n, f) return t.rstrip('0') + x def _fstrz1(f, n=1, x=''): # format float, strip trailing decimal zeros, except one t = _fstrz0(f, n) if t.endswith('.'): t += '0' return t + x def _macOS(sep=None): # get macOS version and extended platform.machine t = 'macOS', mac_ver()[0], machine() return sep.join(t) if sep else t def _mspf(fps): # convert frames per second to frame length in millisecs per frame return 1000.0 / (fps or 25) def _ms2str(ms): # convert milliseconds to seconds string return _fstrz1(max(ms, 0) * 0.001, 3, ' s') def _ratio2str(by, *w_h): # aspect ratio as string return by.join(map(str, (w_h + ('-', '-'))[:2])) class AppVLC(App): '''The application with callback methods for C{app..._}, C{menu..._} and C{window..._} events. Set things up inside the C{.__init__} and C{.appLauched_} methods, start by calling the C{.run} method. ''' adjustr = '' marquee = None media = None logostr = '' player = None raiser = False rate = 0.0 # rate vs normal scale = 0.0 # video size / window size sized = None # video (width, height) Snapshot = Item('Snapshot', key='s', alt=True) snapshot = _PNG # default: .png, .jpg or .tiff snapshots = 0 Toggle = None video = None window = None zoomX = 1.0 # zoom factor, >= 1.0 def __init__(self, video=None, # video file name adjustr='', # vlc.VideoAdjustOption logostr='', # vlc.VideoLogoOption marquee=False, # vlc.VideoMarqueeOption raiser=False, # re-raise errors snapshot=_PNG, # png, other formats title='AppVLC'): # window title super(AppVLC, self).__init__(raiser=raiser, title=title) self.adjustr = adjustr self.logostr = logostr self.marquee = marquee # self.media = None self.raiser = raiser self.Toggle = Item('Play', self.menuToggle_, key='p', ctrl=True) self.video = video if snapshot != AppVLC.snapshot: self.snapshot = '.' + snapshot.lstrip('.').lower() if self.snapshot in (_PNG,): # only .PNG works, using .JPG ... # ... or .TIFF is OK, but the snapshot image is always .PNG self.player = vlc.MediaPlayer() # elif self.snapshot in (_JPG, _PNG, _TIFF): # XXX doesn't work # i = vlc.Instance('--snapshot-format', self.snapshot[1:]) # --verbose 2 # self.player = i.media_player_new() else: raise ValueError('invalid %s format: %r' % ('snapshot', snapshot)) def appLaunched_(self, app): super(AppVLC, self).appLaunched_(app) self.window = MediaWindow(title=self.video or self.title) if self.player and self.video and isfile(self.video): # the VLC player on macOS needs an ObjC NSView self.media = self.player.set_mrl(self.video) self.player.set_nsobject(self.window.NSview) # if this window is on an external screen, # move it to the built-in screen, aka 0 # if not self.window.screen.isBuiltIn: # self.window.screen = 0 # == BuiltIn if self.adjustr: # preset video options for o in self.adjustr.lower().split(','): o, v = o.strip().split('=') o = getattr(_Adjust, o.capitalize(), None) if o is not None: self._VLCadjust(o, value=v) if self.marquee: # set up marquee self._VLCmarquee() if self.logostr: # show logo self._VLClogo(self.logostr) menu = Menu('VLC') menu.append( # the action/method name for each item # is string 'menu' + item.title + '_', # without any spaces and trailing dots, # see function pycocoa.title2action. Item('Open...', key='o'), ItemSeparator(), self.Toggle, # Play >< Pause Item('Rewind', key='r', ctrl=True), ItemSeparator(), Item('Info', key='i'), Item('Close', key='w'), ItemSeparator(), Item('Zoom In', key='+', shift=True), Item('Zoom Out', key='-'), ItemSeparator(), Item('Faster', key='>', shift=True), Item('Slower', key='<', shift=True)) if _VLC_3_: menu.append( ItemSeparator(), Item('Brighter', key='b', shift=True), Item('Darker', key='d', shift=True)) menu.append( ItemSeparator(), Item('Normal 1X', key='='), ItemSeparator(), Item('Audio Filters', self.menuFilters_, key='a', shift=True), Item('Video Filters', self.menuFilters_, key='v', shift=True), ItemSeparator(), self.Snapshot) self.append(menu) self.menuPlay_(None) self.window.front() def menuBrighter_(self, item): self._brightness(item, +0.1) def menuClose_(self, item): # PYCHOK expected # close window(s) from menu Cmd+W # printf('%s %r', 'close_', item) if not closeTables(): self.terminate() def menuDarker_(self, item): self._brightness(item, -0.1) def menuFaster_(self, item): self._rate(item, 1.25) def menuFilters_(self, item): try: self.menuPause_(item) # display a table of audio/video filters t = Table(' Name:150:bold', ' Short:150:Center:center', ' Long:300', 'Help') i = self.player.get_instance() b = item.title.split()[0] for f in sorted(i.audio_filter_list_get() if b == 'Audio' else i.video_filter_list_get()): while f and not f[-1]: # "rstrip" None f = f[:-1] t.append(*map(bytes2str, f)) t.display('VLC %s Filters' % (b,), width=800) except Exception as x: if self.raiser: raise printf('%s', x, nl=1, nt=1) def menuInfo_(self, item): try: self.menuPause_(item) # display Python, vlc, libVLC, media info table p = self.player m = p.get_media() t = Table(' Name:bold', ' Value:200:Center:center', ' Alt:100') t.append(_Argv0, __version__, '20' + __version__) t.append('PyCocoa', _pycocoa_version, '20' + _pycocoa_version) t.append('Python', *_Python) t.append(*_macOS()) x = 'built-in' if self.window.screen.isBuiltIn else 'external' t.append('screen', x, str(self.window.screen.displayID)) t.separator() t.append('vlc.py', vlc.__version__, hex(vlc.hex_version())) b = ' '.join(vlc.build_date.split()[:5]) t.append('built', strftime('%x', strptime(b, '%c')), vlc.build_date) t.separator() t.append('libVLC', bytes2str(vlc.libvlc_get_version()), hex(vlc.libvlc_hex_version())) t.append('libVLC', *bytes2str(vlc.libvlc_get_compiler()).split(None, 1)) t.separator() f = mrl_unquote(bytes2str(m.get_mrl())) t.append('media', basename(f), f) if f.lower().startswith('file://'): z = getsize(f[7:]) t.append('size', z1000str(z), zSIstr(z)) t.append('state', str(p.get_state())) f = max(p.get_position(), 0) t.append('position/length', _fstrz(f * 100, 2), _ms2str(p.get_length())) f = map(_ms2str, (p.get_time(), m.get_duration())) t.append('time/duration', *f) t.append('track/count', z1000str(p.video_get_track()), z1000str(p.video_get_track_count())) t.separator() f = p.get_fps() t.append('fps/mspf', _fstrz(f, 5), _fstrz(_mspf(f), 3, ' ms')) r = p.get_rate() t.append('rate', r, '%s%%' % (int(r * 100),)) a, b = p.video_get_size(0) # num=0 w, h = map(int, self.window.frame.size.size) t.append('video size', _ratio2str('x', a, b), _ratio2str('x', w, h)) r = _ratio2str(':', *aspect_ratio(a, b)) # p.video_get_aspect_ratio() t.append('aspect ratio', r, _ratio2str(':', *self.window.ratio)) t.append('scale', _fstrz1(p.video_get_scale(), 3), _fstrz(self.zoomX, 2, 'X')) t.separator() def VLCadjustr3(f, option): # get option value lo, _, hi = _Adjust3[option] v = f(option) p = max(0, (v - lo)) * 100.0 / (hi - lo) n = str(option).split('.')[-1] # 'VideoAdjustOption.Xyz' return n.lower(), _fstrz1(v, 2), _fstrz(p, 1, '%') f = self.player.video_get_adjust_float t.append(*VLCadjustr3(f, _Adjust.Brightness)) t.append(*VLCadjustr3(f, _Adjust.Contrast)) t.append(*VLCadjustr3(f, _Adjust.Gamma)) t.append(*VLCadjustr3(f, _Adjust.Hue)) t.append(*VLCadjustr3(f, _Adjust.Saturation)) t.separator() s = vlc.MediaStats() # re-use single MediaStats instance? if m.get_stats(s): def Kops2bpstr2(bitrate): # convert Ko/s to bits/sec # bitrates are conventionally in kilo-octets-per-sec return zSIstr(bitrate * 8000, B='bps', K=1000).split() t.append('media read', *zSIstr(s.read_bytes).split()) t.append('input bitrate', *Kops2bpstr2(s.input_bitrate)) if s.input_bitrate > 0: # XXX approximate caching, based # on b = s.read_bytes - s.demux_read_bytes t.append('input caching', _ms2str(b / s.input_bitrate), zSIstr(b)) t.append('demux read', *zSIstr(s.demux_read_bytes).split()) t.append('stream bitrate', *Kops2bpstr2(s.demux_bitrate)) t.append('video decoded', z1000str(s.decoded_video), 'blocks') t.append('video played', z1000str(s.displayed_pictures), 'frames') t.append('video lost', z1000str(s.lost_pictures), 'frames') t.append('audio decoded', z1000str(s.decoded_audio), 'blocks') t.append('audio played', z1000str(s.played_abuffers), 'buffers') t.append('audio lost', z1000str(s.lost_abuffers), 'buffers') t.display('Python, VLC & Media Information', width=500) except Exception as x: if self.raiser: raise printf('%s', x, nl=1, nt=1) def menuNormal1X_(self, item): # set rate and zoom to 1X self._brightness(item) # self._contrast(item) # self._gamma(item) # self._hue(item) self._rate(item) # self._saturation(item) self._zoom(item) def menuOpen_(self, item): # stop the current video and show # the panel to select another video self.menuPause_(item) self.badge.label = 'O' v = OpenPanel(_Select).pick(_Movies) if v: self.window.title = self.video = v self.player.set_mrl(v) self._reset() def menuPause_(self, item, pause=False): # PYCHOK expected # note, .player.pause() pauses and un-pauses the video, # .player.stop() stops the video and blanks the window if pause or self.player.is_playing(): self.player.pause() self.badge.label = 'S' # stopped self.Toggle.title = 'Play' # item.title = 'Play' def menuPlay_(self, item_or_None): # PYCHOK expected self.player.play() self._resizer() self.badge.label = 'P' # Playing self.Toggle.title = 'Pause' # item.title = 'Pause' def menuRewind_(self, item): # PYCHOK expected self.player.set_position(0.0) self.player.set_time(0.0) # note, can't re-play once at the end # self.menuPlay_() self.badge.label = 'R' self._reset() def menuSlower_(self, item): self._rate(item, 0.80) def menuSnapshot_(self, item): # PYCHOK expected w = self.lastWindow if w: self.snapshots += 1 s = '-'.join((_Argv0, 'snapshot%d' % (self.snapshots,), w.__class__.__name__)) if isinstance(w, MediaWindow): self.player.video_take_snapshot(0, s + self.snapshot, 0, 0) elif get_printer: # in PyCocoa 18.08.04+ get_printer().printView(w.PMview, toPDF=s + '.pdf') def menuToggle_(self, item): # toggle between Pause and Play if self.player.is_playing(): self.menuPause_(item, pause=True) else: self.menuPlay_(item) def menuZoomIn_(self, item): self._zoom(item, 1.25) def menuZoomOut_(self, item): self._zoom(item, 0.80) def windowClose_(self, window): # quit or click of window close button if window is self.window: self.terminate() self.Snapshot.isEnabled = False super(AppVLC, self).windowClose_(window) def windowLast_(self, window): self.Snapshot.isEnabled = window.isPrintable or isinstance(window, MediaWindow) super(AppVLC, self).windowLast_(window) def windowResize_(self, window): if window is self.window: self._reset(True) super(AppVLC, self).windowResize_(window) def windowScreen_(self, window, change): if window is self.window: self._reset(True) super(AppVLC, self).windowScreen_(window, change) def _brightness(self, unused, fraction=0): # change brightness self._VLCadjust(_Adjust.Brightness, fraction) def _contrast(self, unused, fraction=0): # change contrast self._VLCadjust(_Adjust.Contrast, fraction) def _gamma(self, unused, fraction=0): # change gamma self._VLCadjust(_Adjust.Gamma, fraction) def _hue(self, unused, fraction=0): # change hue self._VLCadjust(_Adjust.Hue, fraction) def _rate(self, unused, factor=0): # change the video rate p = self.player r = p.get_rate() * factor r = max(0.2, min(10.0, r)) if r > 0 else 1.0 p.set_rate(r) self.rate = r def _reset(self, resize=False): self.zoomX = 1 self.sized = None if resize: Thread(target=self._sizer).start() def _resizer(self): # adjust aspect ratio and marquee height if self.sized: # window's contents' aspect ratio self.window.ratio = self.sized else: Thread(target=self._sizer).start() def _saturation(self, unused, fraction=0): # change saturation self._VLCadjust(_Adjust.Saturation, fraction) def _sizer(self, secs=0.25): # asynchronously while True: # the first call(s) returns (0, 0), # subsequent calls return (w, h) a, b = self.player.video_get_size(0) if b > 0 and a > 0: w = self.window # set window's contents' aspect ratio w.ratio = self.sized = a, b # get video scale factor self.scale = float(w.frame.width) / a self._wiggle() break elif secs > 0.001: sleep(secs) else: # one-shot break def _VLCadjust(self, option, fraction=0, value=None): # adjust a video option like brightness, contrast, etc. p = self.player # # note, .Enable must be set to 1, but once is sufficient p.video_set_adjust_int(_Adjust.Enable, 1) try: lo, v, hi = _Adjust3[option] if fraction: if value is None: v = p.video_get_adjust_float(option) else: v = float(value) v += fraction * (hi - lo) v = float(max(lo, min(hi, v))) p.video_set_adjust_float(option, v) except (KeyError, ValueError): pass def _VLClogo(self, logostr): # add a video logo, example "python cocoavlc.py -logo # cone-altglass2.png\;cone-icon-small.png ..." p = self.player g = vlc.VideoLogoOption # Enum # p.video_set_logo_int(g.enable, 1) p.video_set_logo_int(g.position, vlc.Position.Center) p.video_set_logo_int(g.opacity, 128) # 0-255 # p.video_set_logo_int(g.delay, 1000) # millisec # p.video_set_logo_int(g.repeat, -1) # forever p.video_set_logo_string(g.file, logostr) def _VLCmarquee(self, size=36): # put video marquee at the bottom-center p = self.player m = vlc.VideoMarqueeOption # Enum # p.video_set_marquee_int(m.Enable, 1) p.video_set_marquee_int(m.Size, int(size)) # pixels p.video_set_marquee_int(m.Position, vlc.Position.Bottom) p.video_set_marquee_int(m.Opacity, 255) # 0-255 p.video_set_marquee_int(m.Color, _Color.Yellow) p.video_set_marquee_int(m.Timeout, 0) # millisec, 0==forever p.video_set_marquee_int(m.Refresh, 1000) # millisec (or sec?) p.video_set_marquee_string(m.Text, str2bytes('%Y-%m-%d %T %z')) def _wiggle(self): # wiggle the video to fill the window p = self.player s = p.video_get_scale() p.video_set_scale(0.0 if s else self.scale) p.video_set_scale(s) def _zoom(self, unused, factor=0): # zoom the video in/out, see tkvlc.py p = self.player x = self.zoomX * factor if x > 1: s = x else: # not below 1X s, x = 0.0, 1.0 p.video_set_scale(s) self.scale = s self.zoomX = x if __name__ == '__main__': # MCCABE 24 def _Adjustr(): a = [] # get adjust default values for n in _Adjust._enum_names_.values(): try: _, d, _ = _Adjust3[getattr(_Adjust, n)] a.append('%s=%s' % (n, d)) except KeyError: # ignore .Enable pass return ','.join(sorted(a)) _adjustr = '' _argv0 = basename(sys.argv[0]) # _Title _Argv0 = splitext(_argv0)[0] _logostr = '' _marquee = False _raiser = False _snapshot = AppVLC.snapshot # default _timeout = None _title = splitext(_argv0)[0] _video = None args = sys.argv[1:] while args and args[0].startswith('-'): o = args.pop(0) t = o.lower() if t in ('-h', '--help'): u = ('-h|--help', '-adjust %s' % (_Adjustr(),)) if _VLC_3_: # requires VLC 3+ and libvlc 3+ u += ('-logo [\\;...]', '-marquee') u += ('-raiser', '-snapshot-format jpg|png|tiff', '-timeout ', '-title ', '-v|--version', '') printf('usage: [%s]', '] ['.join(u), argv0=_argv0) sys.exit(0) elif '-adjust'.startswith(t) and len(t) > 1 and args: _adjustr = args.pop(0) elif '-logo'.startswith(t) and len(t) > 1 and args and _VLC_3_: _logostr = args.pop(0) elif '-marquee'.startswith(t) and len(t) > 1 and _VLC_3_: _marquee = True elif '-raiser'.startswith(t) and len(t) > 1: _raiser = True elif '-snapshot-format'.startswith(t) and len(t) > 1 and args: _snapshot = args.pop(0) elif '-timeout'.startswith(t) and len(t) > 3 and args: _timeout = args.pop(0) elif '-title'.startswith(t) and len(t) > 3 and args: _title = args.pop(0).strip() elif t in ('-v', '--version'): # Print version of this cocoavlc.py, PyCocoa, etc. print('%s: %s (%s %s %s)' % (basename(__file__), __version__, _pycocoa_, _pycocoa_version, _macOS(sep=' '))) try: vlc.print_version() # PYCHOK expected vlc.print_python() # PYCHOK expected except AttributeError: pass sys.exit(0) else: printf('invalid option: %s', o, argv0=_argv0) sys.exit(1) if _raiser: # get traceback at SIG- faults or ... try: # ... use: python3 -X faulthandler ... import faulthandler faulthandler.enable() except ImportError: # not in Python 3.3- pass if args: _video = args.pop(0) else: printf('- %s', _Select.lower(), argv0=_argv0, nl=1, nt=1) app_title(_title) # App.title when there's no App yet _video = OpenPanel('Select a video file').pick(_Movies) if _video: app = AppVLC(video=_video, adjustr=_adjustr, logostr=_logostr, marquee=_marquee, raiser=_raiser, snapshot=_snapshot, title=_title) app.run(timeout=_timeout) # never returns ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1583249774.0 python_vlc-3.0.21203/examples/glsurface.py0000755000175200017520000001021013627474556020322 0ustar00oaubertoaubert#! /usr/bin/env python3 # # GlSurface example code for VLC Python bindings # Copyright (C) 2020 Daniël van Adrichem # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # """VLC GlSurface example """ import time import ctypes from threading import Lock import numpy as np from OpenGL.GL import (GL_TEXTURE_2D, glTexSubImage2D, glTexImage2D, GL_BGR, GL_RGB, GL_UNSIGNED_BYTE) import vlc class Surface(object): """A lockable image buffer """ def __init__(self, w, h): self._width = w self._height = h # size in bytes when RV32 *4 or RV24 * 3 self._row_size = self._width * 3 self._buf_size = self._height * self._row_size # allocate buffer self._buf1 = np.zeros(self._buf_size, dtype=np.ubyte) # get pointer to buffer self._buf_p = self._buf1.ctypes.data_as(ctypes.c_void_p) self._lock = Lock() def update_gl(self): # with self._lock: glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, self._width, self._height, GL_BGR, GL_UNSIGNED_BYTE, self._buf1) def create_texture_gl(self): glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, self._width, # width self._height, # height 0, GL_BGR, GL_UNSIGNED_BYTE, None) @property def width(self): return self._width @property def height(self): return self._height @property def row_size(self): return self._row_size @property def buf(self): return self._buf1 @property def buf_pointer(self): return self._buf_p def lock(self): self._lock.acquire() def unlock(self): self._lock.release() def __enter__(self, *args): return self._lock.__enter__(*args) def __exit__(self, *args): return self._lock.__exit__(*args) def get_libvlc_lock_callback(self): @vlc.VideoLockCb def _cb(opaque, planes): self._lock.acquire() planes[0] = self._buf_p return _cb def get_libvlc_unlock_callback(self): @vlc.VideoUnlockCb def _cb(opaque, picta, planes): self._lock.release() return _cb if __name__ == '__main__': import sys player = vlc.MediaPlayer(sys.argv[1]) # play and stop so video_get_size gets a correct value # setting all callbacks to None prevents a window being created on play player.video_set_callbacks(None, None, None, None) # play and stop so video_get_size gets a correct value player.play() time.sleep(1) player.stop() w, h = player.video_get_size() surface = Surface(w, h) # need to keep a reference to the CFUNCTYPEs or else it will get GCed _lock_cb = surface.get_libvlc_lock_callback() _unlock_cb = surface.get_libvlc_unlock_callback() player.video_set_callbacks(_lock_cb, _unlock_cb, None, None) player.video_set_format( "RV24", surface.width, surface.height, surface.row_size) # this starts populating the surface's buf with pixels, from another thread player.play() # in main thread, where gl context is current: # FIXME: add some code to embed the surface + a mainloop # v.surface.update_gl() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1633684471.0 python_vlc-3.0.21203/examples/gtk2vlc.py0000755000175200017520000001233614130005767017716 0ustar00oaubertoaubert#! /usr/bin/env python3 # # gtk example/widget for VLC Python bindings # Copyright (C) 2009-2010 the VideoLAN team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # """VLC Gtk Widget classes + example application. This module provides two helper classes, to ease the embedding of a VLC component inside a pygtk application. VLCWidget is a simple VLC widget. DecoratedVLCWidget provides simple player controls. When called as an application, it behaves as a video player. $Id$ """ import gtk gtk.gdk.threads_init() import sys import vlc from gettext import gettext as _ # Create a single vlc.Instance() to be shared by (possible) multiple players. instance = vlc.Instance() class VLCWidget(gtk.DrawingArea): """Simple VLC widget. Its player can be controlled through the 'player' attribute, which is a vlc.MediaPlayer() instance. """ def __init__(self, *p): gtk.DrawingArea.__init__(self) self.player = instance.media_player_new() def handle_embed(*args): if sys.platform == 'win32': self.player.set_hwnd(self.window.handle) else: self.player.set_xwindow(self.window.xid) return True self.connect("map", handle_embed) self.set_size_request(320, 200) class DecoratedVLCWidget(gtk.VBox): """Decorated VLC widget. VLC widget decorated with a player control toolbar. Its player can be controlled through the 'player' attribute, which is a Player instance. """ def __init__(self, *p): gtk.VBox.__init__(self) self._vlc_widget = VLCWidget(*p) self.player = self._vlc_widget.player self.pack_start(self._vlc_widget, expand=True) self._toolbar = self.get_player_control_toolbar() self.pack_start(self._toolbar, expand=False) def get_player_control_toolbar(self): """Return a player control toolbar """ tb = gtk.Toolbar() tb.set_style(gtk.TOOLBAR_ICONS) for text, tooltip, stock, callback in ( (_("Play"), _("Play"), gtk.STOCK_MEDIA_PLAY, lambda b: self.player.play()), (_("Pause"), _("Pause"), gtk.STOCK_MEDIA_PAUSE, lambda b: self.player.pause()), (_("Stop"), _("Stop"), gtk.STOCK_MEDIA_STOP, lambda b: self.player.stop()), ): b=gtk.ToolButton(stock) b.set_tooltip_text(tooltip) b.connect("clicked", callback) tb.insert(b, -1) tb.show_all() return tb class VideoPlayer: """Example simple video player. """ def __init__(self): self.vlc = DecoratedVLCWidget() def main(self, fname): self.vlc.player.set_media(instance.media_new(fname)) w = gtk.Window() w.add(self.vlc) w.show_all() w.connect("destroy", gtk.main_quit) gtk.main() class MultiVideoPlayer: """Example multi-video player. It plays multiple files side-by-side, with per-view and global controls. """ def main(self, filenames): # Build main window window=gtk.Window() mainbox=gtk.VBox() videos=gtk.HBox() window.add(mainbox) mainbox.add(videos) # Create VLC widgets for fname in filenames: v = DecoratedVLCWidget() v.player.set_media(instance.media_new(fname)) videos.add(v) # Create global toolbar tb = gtk.Toolbar() tb.set_style(gtk.TOOLBAR_ICONS) def execute(b, methodname): """Execute the given method on all VLC widgets. """ for v in videos.get_children(): getattr(v.player, methodname)() return True for text, tooltip, stock, callback, arg in ( (_("Play"), _("Global play"), gtk.STOCK_MEDIA_PLAY, execute, "play"), (_("Pause"), _("Global pause"), gtk.STOCK_MEDIA_PAUSE, execute, "pause"), (_("Stop"), _("Global stop"), gtk.STOCK_MEDIA_STOP, execute, "stop"), ): b = gtk.ToolButton(stock) b.set_tooltip_text(tooltip) b.connect("clicked", callback, arg) tb.insert(b, -1) mainbox.pack_start(tb, expand=False) window.show_all() window.connect("destroy", gtk.main_quit) gtk.main() if __name__ == '__main__': if not sys.argv[1:]: print('You must provide at least 1 movie filename') sys.exit(1) if len(sys.argv[1:]) == 1: # Only 1 file. Simple interface p=VideoPlayer() p.main(sys.argv[1]) else: # Multiple files. p=MultiVideoPlayer() p.main(sys.argv[1:]) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1681918170.0 python_vlc-3.0.21203/examples/gtkvlc.py0000755000175200017520000001563714420004332017630 0ustar00oaubertoaubert#! /usr/bin/env python3 # # gtk3 example/widget for VLC Python bindings # Copyright (C) 2017 Olivier Aubert # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # """VLC Gtk3 Widget classes + example application. This module provides two helper classes, to ease the embedding of a VLC component inside a pygtk application. VLCWidget is a simple VLC widget. DecoratedVLCWidget provides simple player controls. When called as an application, it behaves as a video player. """ import gi gi.require_version('Gdk', '3.0') gi.require_version('Gtk', '3.0') from gi.repository import Gdk from gi.repository import Gtk Gdk.threads_init () import sys import ctypes import vlc from gettext import gettext as _ # Create a single vlc.Instance() to be shared by (possible) multiple players. if 'linux' in sys.platform: # Inform libvlc that Xlib is not initialized for threads instance = vlc.Instance("--no-xlib") else: instance = vlc.Instance() def get_window_pointer(window): """ Use the window.__gpointer__ PyCapsule to get the C void* pointer to the window """ # get the c gpointer of the gdk window ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.c_void_p ctypes.pythonapi.PyCapsule_GetPointer.argtypes = [ctypes.py_object] return ctypes.pythonapi.PyCapsule_GetPointer(window.__gpointer__, None) class VLCWidget(Gtk.DrawingArea): """Simple VLC widget. Its player can be controlled through the 'player' attribute, which is a vlc.MediaPlayer() instance. """ __gtype_name__ = 'VLCWidget' def __init__(self, *p): Gtk.DrawingArea.__init__(self) self.player = instance.media_player_new() def handle_embed(*args): if sys.platform == 'win32': # get the win32 handle gdkdll = ctypes.CDLL('libgdk-3-0.dll') handle = gdkdll.gdk_win32_window_get_handle(get_window_pointer(self.get_window())) self.player.set_hwnd(handle) elif sys.platform == 'darwin': # get the nsview pointer. NB need to manually specify function signature gdkdll = ctypes.CDLL('libgdk-3.0.dll') get_nsview = gdkdll.gdk_quaerz_window_get_nsview get_nsview.restype, get_nsview.argtypes = [ctypes.c_void_p], ctypes.c_void_p self.player.set_nsobject(get_nsview(get_window_pointer(self.get_window()))) else: self.player.set_xwindow(self.get_window().get_xid()) return True self.connect("realize", handle_embed) self.set_size_request(320, 200) class DecoratedVLCWidget(Gtk.VBox): """Decorated VLC widget. VLC widget decorated with a player control toolbar. Its player can be controlled through the 'player' attribute, which is a Player instance. """ __gtype_name__ = 'DecoratedVLCWidget' def __init__(self, *p): super(DecoratedVLCWidget, self).__init__() self._vlc_widget = VLCWidget(*p) self.player = self._vlc_widget.player self.add(self._vlc_widget) self._toolbar = self.get_player_control_toolbar() self.pack_start(self._toolbar, False, False, 0) self.show_all() def get_player_control_toolbar(self): """Return a player control toolbar """ tb = Gtk.Toolbar.new() for text, tooltip, iconname, callback in ( (_("Play"), _("Play"), 'gtk-media-play', lambda b: self.player.play()), (_("Pause"), _("Pause"), 'gtk-media-pause', lambda b: self.player.pause()), (_("Stop"), _("Stop"), 'gtk-media-stop', lambda b: self.player.stop()), (_("Quit"), _("Quit"), 'gtk-quit', Gtk.main_quit), ): i = Gtk.Image.new_from_icon_name(iconname, Gtk.IconSize.MENU) b = Gtk.ToolButton.new(i, text) b.set_tooltip_text(tooltip) b.connect("clicked", callback) tb.insert(b, -1) return tb class VideoPlayer: """Example simple video player. """ def __init__(self): self.vlc = DecoratedVLCWidget() def main(self, fname): self.vlc.player.set_media(instance.media_new(fname)) w = Gtk.Window() w.add(self.vlc) w.show_all() w.connect("destroy", Gtk.main_quit) Gtk.main() class MultiVideoPlayer: """Example multi-video player. It plays multiple files side-by-side, with per-view and global controls. """ def main(self, filenames): # Build main window window=Gtk.Window() mainbox=Gtk.VBox() videos=Gtk.HBox() window.add(mainbox) mainbox.add(videos) # Create VLC widgets for fname in filenames: v = DecoratedVLCWidget() v.player.set_media(instance.media_new(fname)) videos.add(v) # Create global toolbar tb = Gtk.Toolbar.new() def execute(b, methodname): """Execute the given method on all VLC widgets. """ for v in videos.get_children(): getattr(v.player, methodname)() return True for text, tooltip, iconname, callback, arg in ( (_("Play"), _("Global play"), 'gtk-media-play', execute, "play"), (_("Pause"), _("Global pause"), 'gtk-media-pause', execute, "pause"), (_("Stop"), _("Global stop"), 'gtk-media-stop', execute, "stop"), (_("Quit"), _("Quit"), 'gtk-quit', Gtk.main_quit, None), ): i = Gtk.Image.new_from_icon_name(iconname, Gtk.IconSize.MENU) b = Gtk.ToolButton.new(i, text) b.set_tooltip_text(tooltip) b.connect("clicked", callback, arg) tb.insert(b, -1) mainbox.pack_start(tb, False, False, 0) window.show_all() window.connect("destroy", Gtk.main_quit) Gtk.main() if __name__ == '__main__': if not sys.argv[1:]: print('You must provide at least 1 movie filename') sys.exit(1) if len(sys.argv[1:]) == 1: # Only 1 file. Simple interface p=VideoPlayer() from evaluator import Evaluator e = Evaluator(globals(), locals()) e.popup() p.main(sys.argv[1]) else: # Multiple files. p=MultiVideoPlayer() p.main(sys.argv[1:]) instance.release() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1592294997.0 python_vlc-3.0.21203/examples/play_buffer.py0000755000175200017520000001627713672077125020657 0ustar00oaubertoaubert#!/usr/bin/env python3 # Author: A.Invernizzi (@albestro on GitHub) # Date: Jun 03, 2020 # MIT License # # Copyright (C) 2020 -- A. Invernizzi, @albestro on github # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. """ Example usage of VLC API function `libvlc_media_new_callbacks` This function allows to create a VLC media `libvlc_media_t` specifying custom callbacks where the user can define how to manage and read the stream of data. The general use case for this is when you have data in memory and you want to play it (e.g. audio stream from a web radio). In this example, we are going to read playable data from files in a specified folder. In case you would want to read from a file, it is not the best way to do it, but for the sake of this example we are going to read data into memory from files. The example tries to highlight the separation of concerns between the callbacks and the application logic, so it would hopefully make clear how to integrate the VLC API with existing libraries. In particular, we have two main parts: - StreamProvider: which is a class that implements the logic; "scrape" a folder for files with a specific extensions, and provide methods that retrieves data. - VLC callabacks that uses a StreamProvider object """ import argparse import ctypes import os import vlc class StreamProviderDir(object): def __init__(self, rootpath, file_ext): self._media_files = [] self._rootpath = rootpath self._file_ext = file_ext self._index = 0 def open(self): """ this function is responsible of opening the media. it could have been done in the __init__, but it is just an example in this case it scan the specified folder, but it could also scan a remote url or whatever you prefer. """ print("read file list") for entry in os.listdir(self._rootpath): if os.path.splitext(entry)[1] == f".{self._file_ext}": self._media_files.append(os.path.join(self._rootpath, entry)) self._media_files.sort() print("playlist:") for index, media_file in enumerate(self._media_files): print(f"[{index}] {media_file}") def release_resources(self): """ In this example this function is just a placeholder, in a more complex example this may release resources after the usage, e.g. closing the socket from where we retrieved media data """ print("releasing stream provider") def seek(self, offset): """ Again, a placeholder, not useful for the example """ print(f"requested seek with offset={offset}") def get_data(self): """ It reads the current file in the list and returns the binary data In this example it reads from file, but it could have downloaded data from an url """ print(f"reading file [{self._index}] ", end='') if self._index == len(self._media_files): print("file list is over") return b'' print(f"{self._media_files[self._index]}") with open(self._media_files[self._index], 'rb') as stream: data = stream.read() self._index = self._index + 1 return data # HERE THERE ARE THE CALLBACKS USED BY THE MEDIA CREATED IN THE "MAIN" # a callback in its simplest form is a python function decorated with the specific @vlc.CallbackDecorators.* @vlc.CallbackDecorators.MediaOpenCb def media_open_cb(opaque, data_pointer, size_pointer): print("OPEN", opaque, data_pointer, size_pointer) stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value stream_provider.open() data_pointer.contents.value = opaque size_pointer.value = 1 ** 64 - 1 return 0 @vlc.CallbackDecorators.MediaReadCb def media_read_cb(opaque, buffer, length): print("READ", opaque, buffer, length) stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value new_data = stream_provider.get_data() bytes_read = len(new_data) if bytes_read > 0: buffer_array = ctypes.cast(buffer, ctypes.POINTER(ctypes.c_char * bytes_read)) for index, b in enumerate(new_data): buffer_array.contents[index] = ctypes.c_char(b) print(f"just read f{bytes_read}B") return bytes_read @vlc.CallbackDecorators.MediaSeekCb def media_seek_cb(opaque, offset): print("SEEK", opaque, offset) stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value stream_provider.seek(offset) return 0 @vlc.CallbackDecorators.MediaCloseCb def media_close_cb(opaque): print("CLOSE", opaque) stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value stream_provider.release_resources() # MAIN if __name__ == '__main__': parser = argparse.ArgumentParser( description='play files found in specified media folder (in alphabetic order)', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument( 'media_folder', help='where to find files to play') parser.add_argument( '--extension', default='ts', help='file extension of the files to play') args = parser.parse_args() # helper object acting as media data provider # it is just to highlight how the opaque pointer in the callback can be used # and that the logic can be isolated from the callbacks stream_provider = StreamProviderDir(args.media_folder, args.extension) # these two lines to highlight how to pass a python object using ctypes # it is verbose, but you can see the steps required stream_provider_obj = ctypes.py_object(stream_provider) stream_provider_ptr = ctypes.byref(stream_provider_obj) # create an instance of vlc instance = vlc.Instance() # setup the callbacks for the media media = instance.media_new_callbacks( media_open_cb, media_read_cb, media_seek_cb, media_close_cb, stream_provider_ptr) player = media.player_new_from_media() # play/stop player.play() input("press enter to quit") player.stop() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1668596128.0 python_vlc-3.0.21203/examples/psgvlc.py0000644000175200017520000001277714335140640017643 0ustar00oaubertoaubert#! /usr/bin/env python3 # -*- coding: utf-8 -*- u'''Bare Bones VLC Media Player Demo with Playlist. 1 - Originally the Demo_Media_Player_VLC_Based.py duplicated from and modified to work and showing videos on recent macOS versions. 2 - This script uses PySimpleGUI under its LGPL3+ stipulations. 3 - You will need to install the Python bindings for VLC, for example using pip: python3 -m pip install python-vlc 4 - You need the VLC player itself from . 5 - On macOS, you also need to get tkvlc.py from this location to get video and audio. 6 - On macOS, the video plays full-frame, overwriting the buttons. 7 - Original by Israel Dryer, modified to be a PySimpleGUI Demo Program and a python-vlc example for you to customize. Uses the VLC player to playback local media files (and YouTube streams). ''' import sys if sys.version_info[0] < 3: # Python 3.4+ only sys.exit('%s requires Python 3.4 or later' % (sys.argv[0],)) # import Tkinter as tk import PySimpleGUI as sg import vlc __all__ = ('libtk',) __version__ = '22.11.07' # mrJean1 at Gmail _Load_ = 'Load' _Next_ = 'Next' _Path_ = 'Media URL or local path:' _Pause_ = 'Pause' _Play_ = 'Play' _Prev_ = 'Previous' _Stop_ = 'Stop' # GUI definition & setup sg.theme('DarkBlue') def Bn(name): # a PySimpleGUI "User Defined Element" (see docs) return sg.Button(name, size=(8, 1), pad=(1, 1)) layout = [[sg.Input(default_text=_Path_, size=(40, 1), key='-VIDEO_PATH-'), sg.Button(_Load_)], [sg.Frame('', [], size=(300, 170), key='-VID_OUT-')], # was [sg.Image('', ...)], [Bn(_Prev_), Bn(_Play_), Bn(_Next_), Bn(_Pause_), Bn(_Stop_)], [sg.Text('Load media to start', key='-MESSAGE_AREA-')]] window = sg.Window('PySimpleGUI VLC Player', layout, element_justification='center', finalize=True, resizable=True) window['-VID_OUT-'].expand(True, True) # type: sg.Element # Media Player Setup inst = vlc.Instance() list_player = inst.media_list_player_new() media_list = inst.media_list_new([]) list_player.set_media_list(media_list) player = list_player.get_media_player() # tell VLC where to render the video(s) tk_id = window['-VID_OUT-'].Widget.winfo_id() libtk = '' if sg.running_linux(): player.set_xwindow(tk_id) elif sg.running_windows(): player.set_hwnd(tk_id) elif sg.running_mac(): try: from tkvlc import _GetNSView, libtk ns = _GetNSView(tk_id) except ImportError: ns = None libtk = 'none, install tkvlc.py from examples' if ns: # drawable NSview player.set_nsobject(ns) else: # no video, only audio player.set_xwindow(tk_id) else: # running trinket, etc. player.set_hwnd(tk_id) # TBD if __name__ == '__main__': # MCCABE 20 if len(sys.argv) > 1: if sys.argv[1].lower() in ('-v', '--version'): # show all versions, this vlc.py, libvlc, etc. (sample output on macOS): # ... # % python3 ./psgvlc.py -v # psgvlc.py: 22.11.06 # tkinter: 8.6 # libTk: /Library/Frameworks/Python.framework/Versions/3.11/lib/libtk8.6.dylib # vlc.py: 3.0.12119 (Mon May 31 18:25:17 2021 3.0.12) # libVLC: 3.0.16 Vetinari (0x3001000) # plugins: /Applications/VLC.app/Contents/MacOS/plugins # Python: 3.11.0 (64bit) macOS 13.0 arm64 for t in ((sys.argv[0], __version__), (sg.tk.__name__, sg.tk.TkVersion), ('libTk', libtk)): print('{}: {}'.format(*t)) try: vlc.print_version() vlc.print_python() except AttributeError: pass sys.exit(0) if sys.argv[1]: media_list.add_media(sys.argv[1]) list_player.set_media_list(media_list) # The Event Loop while True: # run with a timeout so that current location can be updated event, values = window.read(timeout=1000) if event == sg.WIN_CLOSED: break if event == _Pause_: list_player.pause() elif event == _Stop_: list_player.stop() elif event == _Next_: list_player.next() list_player.play() elif event == _Prev_: list_player.previous() # first call causes current video to start over list_player.previous() # second call moves back 1 video from current list_player.play() elif event == _Play_: list_player.play() elif event == _Load_: path = values['-VIDEO_PATH-'] if path and _Path_ not in path: media_list.add_media(path) list_player.set_media_list(media_list) window['-VIDEO_PATH-'].update(_Path_) # only add a legit submit # update elapsed time if a video loaded and playing if player.is_playing(): text = '{:02d}:{:02d}'.format(*divmod(player.get_time() // 1000, 60)) + ' / ' + \ '{:02d}:{:02d}'.format(*divmod(player.get_length() // 1000, 60)) if sg.running_mac(): print('{}: {}'.format(sys.argv[0], text)) elif not media_list.count(): text = 'Load media to start' else: text = 'Ready to play media' window['-MESSAGE_AREA-'].update(text) window.close() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1633684490.0 python_vlc-3.0.21203/examples/pyobjcvlc.py0000644000175200017520000003674514130006012020324 0ustar00oaubertoaubert#! /usr/bin/env python3 # -*- coding: utf-8 -*- # License at the end of this file. This module is equivalent to # PyCocoa/test/simple_VLCplayer.py but based on PyObjC instead # of PyCocoa . Until macOS # release Catalina, macOS' Python includes PyObjC. # See also a more comprehensive VLC player example cocoavlc.py # # This VLC player has only been tested with VLC 2.2.8 and 3.0.8, # and a compatible vlc.py # binding using Python 2.7.10 with macOS' PyObjC 2.5.1 and Python # 3.7.4 with PyObjC 5.2b1 on macOS 10.13.6 High Sierra or 10.14.6 # Mojave, all in 64-bit only. This player has not been tested # on iOS, nor with PyPy and Intel(R) Python. from os.path import basename # PYCHOK expected from platform import architecture, mac_ver # PYCHOK false import sys _argv0 = basename(__file__) if not sys.platform.startswith('darwin'): raise ImportError('%s only supported on %s' % (_argv0, 'macOS')) class _ImportError(ImportError): # PYCHOK expected def __init__(self, package, PyPI): PyPI = '' % (PyPI,) t = 'no module %s, see %s' % (package, PyPI) ImportError.__init__(self, t) try: # PYCHOK expected from objc import __version__ as __PyObjC__ except ImportError: raise _ImportError('objc', 'PyObjC') # the imports listed explicitly to help PyChecker from Cocoa import NSAlternateKeyMask, NSApplication, \ NSBackingStoreBuffered, NSBundle, \ NSCommandKeyMask, NSControlKeyMask, \ NSMakeRect, NSMenu, NSMenuItem, \ NSObject, \ NSScreen, NSShiftKeyMask, NSSize, \ NSView, NSWindow try: from Cocoa import NSWindowStyleMaskClosable, NSWindowStyleMaskMiniaturizable, \ NSWindowStyleMaskResizable, NSWindowStyleMaskTitled except ImportError: # previously, NSWindowStyleMaskXxx was named NSXxxWindowMask from Cocoa import NSClosableWindowMask as NSWindowStyleMaskClosable, \ NSMiniaturizableWindowMask as NSWindowStyleMaskMiniaturizable, \ NSResizableWindowMask as NSWindowStyleMaskResizable, \ NSTitledWindowMask as NSWindowStyleMaskTitled NSStr = bytes if sys.version_info.major < 3 else str NSWindowStyleMaskUsual = NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable \ | NSWindowStyleMaskResizable | NSWindowStyleMaskTitled __all__ = ('simpleVLCplay',) __version__ = '19.09.27' try: # all imports listed explicitly to help PyChecker from math import gcd # Python 3+ except ImportError: try: from fractions import gcd # Python 2- except ImportError: def gcd(a, b): a, b = abs(a), abs(b) if a < b: a, b = b, a while b: a, b = b, (a % b) return a def mspf(fps): '''Convert frames per second to frame length in millisecs. ''' return 1000.0 / (fps or 25) def nsBundleRename(title, match='Python'): '''Change the bundle title if the current title matches. @param title: New bundle title (C{str}). @keyword match: Optional, previous title to match (C{str}). @return: The previous bundle title (C{str}) or None. @note: Used to mimick C{NSApplication.setTitle_(ns_title)}, the application name shown in the menu bar. ''' # # ns = NSBundle.bundleWithPath_(os.path.abspath(match)) p, ns = None, NSBundle.mainBundle() if ns: ns = ns.localizedInfoDictionary() or ns.infoDictionary() if ns: k = NSStr('CFBundleName') p = ns.objectForKey_(k) or None if title and match in (p, '', None): # can't be empty ns.setObject_forKey_(NSStr(title), k) return p def printf(fmt, *args, **kwds): # argv0='', nl=0, nt=0 '''Formatted print I{fmt % args} with optional keywords. @param fmt: Print-like format (C{str}). @param args: Optional arguments to include (I{all positional}). @keyword argv0: Optional prefix (C{str}). @keyword nl: Number of leading blank lines (C{int}). @keyword nt: Number of trailing blank lines (C{int}). ''' a = kwds.get('argv0', _argv0) t = (fmt % args) if args else fmt nl = '\n' * kwds.get('nl', 0) nt = '\n' * kwds.get('nt', 0) print(''.join((nl, a, ' ', t, nt))) def terminating(app, timeout): '''Terminate C{app} after C{timeout} seconds. @param app: The application (C{NSApplication} instance). @patam timeout: Time in seconds (C{float}). ''' try: secs = float(timeout) except (TypeError, ValueError): secs = 0 if secs > 0: from threading import Thread def _t(): from time import sleep sleep(secs + 0.5) app.terminate_() Thread(target=_t).start() class _NSDelegate(NSObject): '''(INTERNAL) Delegate for NSApplication and NSWindow, handling PyObjC events, notifications and callbacks. ''' app = None # NSApplication NSItem = None # NSMenuItem player = None # vlc.MediaPlayer ratio = 2 # aspect_ratio calls title = '' # top-level menu title video = None # video file name window = None # main NSWindow def applicationDidFinishLaunching_(self, notification): # the VLC player needs an NSView object self.window, view = _Window2(title=self.video or self.title) # set the window's delegate to the app's to # make method .windowWillClose_ work, see # self.window.setDelegate_(self) # pass viewable to VLC player, see PyObjC Generated types ... # self.player.set_nsobject(view.__c_void_p__()) menu = NSMenu.alloc().init() # create main menu menu.addItem_(_MenuItem('Full ' + 'Screen', 'enterFullScreenMode:', 'f', ctrl=True)) # Ctrl-Cmd-F, Esc to exit menu.addItem_(_MenuItem('Info', 'info:', 'i')) menu.addItem_(_MenuItemSeparator()) self.NSitem = _MenuItem('Pause', 'toggle:', 'p', ctrl=True) # Ctrl-Cmd-P menu.addItem_(self.NSitem) menu.addItem_(_MenuItem('Rewind', 'rewind:', 'r', ctrl=True)) # Ctrl-Cmd-R menu.addItem_(_MenuItemSeparator()) menu.addItem_(_MenuItem('Hide ' + self.title, 'hide:', 'h')) # Cmd-H, implied menu.addItem_(_MenuItem('Hide Others', 'hideOtherApplications:', 'h', alt=True)) # Alt-Cmd-H menu.addItem_(_MenuItem('Show All', 'unhideAllApplications:')) # no key menu.addItem_(_MenuItemSeparator()) menu.addItem_(_MenuItem('Quit ' + self.title, 'terminate:', 'q')) # Cmd-Q subMenu = NSMenuItem.alloc().init() subMenu.setSubmenu_(menu) menuBar = NSMenu.alloc().init() menuBar.addItem_(subMenu) self.app.setMainMenu_(menuBar) self.player.play() # adjust the contents' aspect ratio self.windowDidResize_(None) def info_(self, notification): try: p = self.player if p.is_playing(): p.pause() m = p.get_media() v = sys.modules[p.__class__.__module__] # import vlc b = v.bytes_to_str printf(__version__, nl=1) # print Python, vlc, libVLC, media info printf('PyObjC %s', __PyObjC__, nl=1) printf('Python %s %s', sys.version.split()[0], architecture()[0]) printf('macOS %s', ' '.join(mac_ver()[0:3:2]), nt=1) printf('vlc.py %s (%#x)', v.__version__, v.hex_version()) printf('built: %s', v.build_date) printf('libVLC %s (%#x)', b(v.libvlc_get_version()), v.libvlc_hex_version()) printf('libVLC %s', b(v.libvlc_get_compiler()), nt=1) printf('media: %s', b(m.get_mrl())) printf('state: %s', p.get_state()) printf('track/count: %s/%s', p.video_get_track(), p.video_get_track_count()) printf('time/duration: %s/%s ms', p.get_time(), m.get_duration()) printf('position/length: %.2f%%/%s ms', p.get_position() * 100.0, p.get_length()) f = p.get_fps() printf('fps: %.3f (%.3f ms)', f, mspf(f)) printf('rate: %s', p.get_rate()) w, h = p.video_get_size(0) printf('video size: %sx%s', w, h) r = gcd(w, h) or '' if r and w and h: r = ' (%s:%s)' % (w // r, h // r) printf('aspect ratio: %s%s', p.video_get_aspect_ratio(), r) printf('scale: %.3f', p.video_get_scale()) o = p.get_nsobject() # for macOS only printf('nsobject: %r (%#x)', o, o, nt=1) except Exception as x: printf('%r', x, nl=1, nt=1) def rewind_(self, notification): self.player.set_position(0.0) # can't re-play once at the end # self.player.play() def toggle_(self, notification): # toggle between Pause and Play if self.player.is_playing(): # note, .pause() pauses and un-pauses the video, # .stop() stops the video and blanks the window self.player.pause() t = 'Play' else: self.player.play() t = 'Pause' self.NSitem.setTitle_(NSStr(t)) def windowDidResize_(self, notification): if self.window and self.ratio: # get and maintain the aspect ratio # (the first player.video_get_size() # call returns (0, 0), subsequent # calls return (w, h) correctly) w, h = self.player.video_get_size(0) r = gcd(w, h) if r and w and h: r = NSSize(w // r , h // r) self.window.setContentAspectRatio_(r) self.ratio -= 1 def windowWillClose_(self, notification): self.app.terminate_(self) def _MenuItem(label, action=None, key='', alt=False, cmd=True, ctrl=False, shift=False): '''New NS menu item with action and optional shortcut key. ''' # ns = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_( NSStr(label), NSStr(action), NSStr(key)) if key: mask = 0 if alt: mask |= NSAlternateKeyMask if cmd: mask |= NSCommandKeyMask if ctrl: mask |= NSControlKeyMask if shift: mask |= NSShiftKeyMask # NSAlphaShiftKeyMask if mask: ns.setKeyEquivalentModifierMask_(mask) return ns def _MenuItemSeparator(): '''A menu separator item. ''' return NSMenuItem.separatorItem() def _Window2(title=_argv0, fraction=0.5): '''Create the main NS window and the drawable NS view. ''' frame = NSScreen.mainScreen().frame() if 0.1 < fraction < 1.0: # use the lower left quarter of the screen size as frame w = int(frame.size.width * fraction + 0.5) h = int(frame.size.height * w / frame.size.width) frame = NSMakeRect(frame.origin.x + 10, frame.origin.y + 10, w, h) window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_( frame, NSWindowStyleMaskUsual, NSBackingStoreBuffered, False) # or 0 window.setTitle_(NSStr(title)) # create the drawable_nsobject NSView for vlc.py, see vlc.MediaPlayer.set_nsobject() # for an alternate NSView object with protocol VLCOpenGLVideoViewEmbedding # # view = NSView.alloc().initWithFrame_(frame) window.setContentView_(view) # force the video/window aspect ratio, adjusted # above when the window is/has been resized window.setContentAspectRatio_(frame.size) window.makeKeyAndOrderFront_(None) return window, view def simpleVLCplay(player, title=_argv0, video='', timeout=None): '''Create a minimal NS application, drawable window and basic menu for the given VLC player (with media) and start the player. @note: This function never returns, but the VLC player and other Python thread(s) do run. ''' if not player: raise ValueError('%s invalid: %r' % ('player', player)) app = NSApplication.sharedApplication() nsBundleRename(NSStr(title)) # top-level menu title dlg = _NSDelegate.alloc().init() dlg.app = app dlg.player = player dlg.title = title or _argv0 dlg.video = video or basename(player.get_media().get_mrl()) app.setDelegate_(dlg) terminating(app, timeout) app.run() # never returns if __name__ == '__main__': try: import vlc except ImportError: raise _ImportError('vlc', 'Python-VLC') _argv0 = _name = basename(sys.argv[0]) _timeout = None args = sys.argv[1:] while args and args[0].startswith('-'): o = args.pop(0) t = o.lower() if t in ('-h', '--help'): printf('usage: [-h|--help] [-name "%s"] [-timeout ] %s', _name, '') sys.exit(0) elif args and len(t) > 1 and '-name'.startswith(t): _name = args.pop(0) elif args and len(t) > 1 and '-timeout'.startswith(t): _timeout = args.pop(0) elif t in ('-v', '--version'): print('%s: %s (%s %s)' % (basename(__file__), __version__, 'PyObjC', __PyObjC__)) try: vlc.print_version() vlc.print_python() except AttributeError: pass sys.exit(0) else: printf('invalid option: %s', o) sys.exit(1) if not args: printf('missing %s', '') sys.exit(1) # create a VLC player and play the video p = vlc.MediaPlayer(args.pop(0)) simpleVLCplay(p, title=_name, timeout=_timeout) # never returns # MIT License # # Copyright (C) 2017-2020 -- mrJean1 at Gmail -- All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included # in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1633684496.0 python_vlc-3.0.21203/examples/pyqt5vlc.py0000644000175200017520000001723214130006020020105 0ustar00oaubertoaubert#! /usr/bin/env python3 # # PyQt5 example for VLC Python bindings # Copyright (C) 2009-2010 the VideoLAN team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # """ A simple example for VLC python bindings using PyQt5. Author: Saveliy Yusufov, Columbia University, sy2685@columbia.edu Date: 25 December 2018 """ import platform import os import sys from PyQt5 import QtWidgets, QtGui, QtCore import vlc class Player(QtWidgets.QMainWindow): """A simple Media Player using VLC and Qt """ def __init__(self, master=None): QtWidgets.QMainWindow.__init__(self, master) self.setWindowTitle("Media Player") # Create a basic vlc instance self.instance = vlc.Instance() self.media = None # Create an empty vlc media player self.mediaplayer = self.instance.media_player_new() self.create_ui() self.is_paused = False def create_ui(self): """Set up the user interface, signals & slots """ self.widget = QtWidgets.QWidget(self) self.setCentralWidget(self.widget) # In this widget, the video will be drawn if platform.system() == "Darwin": # for MacOS self.videoframe = QtWidgets.QMacCocoaViewContainer(0) else: self.videoframe = QtWidgets.QFrame() self.palette = self.videoframe.palette() self.palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.positionslider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self) self.positionslider.setToolTip("Position") self.positionslider.setMaximum(1000) self.positionslider.sliderMoved.connect(self.set_position) self.positionslider.sliderPressed.connect(self.set_position) self.hbuttonbox = QtWidgets.QHBoxLayout() self.playbutton = QtWidgets.QPushButton("Play") self.hbuttonbox.addWidget(self.playbutton) self.playbutton.clicked.connect(self.play_pause) self.stopbutton = QtWidgets.QPushButton("Stop") self.hbuttonbox.addWidget(self.stopbutton) self.stopbutton.clicked.connect(self.stop) self.hbuttonbox.addStretch(1) self.volumeslider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self) self.volumeslider.setMaximum(100) self.volumeslider.setValue(self.mediaplayer.audio_get_volume()) self.volumeslider.setToolTip("Volume") self.hbuttonbox.addWidget(self.volumeslider) self.volumeslider.valueChanged.connect(self.set_volume) self.vboxlayout = QtWidgets.QVBoxLayout() self.vboxlayout.addWidget(self.videoframe) self.vboxlayout.addWidget(self.positionslider) self.vboxlayout.addLayout(self.hbuttonbox) self.widget.setLayout(self.vboxlayout) menu_bar = self.menuBar() # File menu file_menu = menu_bar.addMenu("File") # Add actions to file menu open_action = QtWidgets.QAction("Load Video", self) close_action = QtWidgets.QAction("Close App", self) file_menu.addAction(open_action) file_menu.addAction(close_action) open_action.triggered.connect(self.open_file) close_action.triggered.connect(sys.exit) self.timer = QtCore.QTimer(self) self.timer.setInterval(100) self.timer.timeout.connect(self.update_ui) def play_pause(self): """Toggle play/pause status """ if self.mediaplayer.is_playing(): self.mediaplayer.pause() self.playbutton.setText("Play") self.is_paused = True self.timer.stop() else: if self.mediaplayer.play() == -1: self.open_file() return self.mediaplayer.play() self.playbutton.setText("Pause") self.timer.start() self.is_paused = False def stop(self): """Stop player """ self.mediaplayer.stop() self.playbutton.setText("Play") def open_file(self): """Open a media file in a MediaPlayer """ dialog_txt = "Choose Media File" filename = QtWidgets.QFileDialog.getOpenFileName(self, dialog_txt, os.path.expanduser('~')) if not filename: return # getOpenFileName returns a tuple, so use only the actual file name self.media = self.instance.media_new(filename[0]) # Put the media in the media player self.mediaplayer.set_media(self.media) # Parse the metadata of the file self.media.parse() # Set the title of the track as window title self.setWindowTitle(self.media.get_meta(0)) # The media player has to be 'connected' to the QFrame (otherwise the # video would be displayed in it's own window). This is platform # specific, so we must give the ID of the QFrame (or similar object) to # vlc. Different platforms have different functions for this if platform.system() == "Linux": # for Linux using the X Server self.mediaplayer.set_xwindow(int(self.videoframe.winId())) elif platform.system() == "Windows": # for Windows self.mediaplayer.set_hwnd(int(self.videoframe.winId())) elif platform.system() == "Darwin": # for MacOS self.mediaplayer.set_nsobject(int(self.videoframe.winId())) self.play_pause() def set_volume(self, volume): """Set the volume """ self.mediaplayer.audio_set_volume(volume) def set_position(self): """Set the movie position according to the position slider. """ # The vlc MediaPlayer needs a float value between 0 and 1, Qt uses # integer variables, so you need a factor; the higher the factor, the # more precise are the results (1000 should suffice). # Set the media position to where the slider was dragged self.timer.stop() pos = self.positionslider.value() self.mediaplayer.set_position(pos / 1000.0) self.timer.start() def update_ui(self): """Updates the user interface""" # Set the slider's position to its corresponding media position # Note that the setValue function only takes values of type int, # so we must first convert the corresponding media position. media_pos = int(self.mediaplayer.get_position() * 1000) self.positionslider.setValue(media_pos) # No need to call this function if nothing is played if not self.mediaplayer.is_playing(): self.timer.stop() # After the video finished, the play button stills shows "Pause", # which is not the desired behavior of a media player. # This fixes that "bug". if not self.is_paused: self.stop() def main(): """Entry point for our simple vlc player """ app = QtWidgets.QApplication(sys.argv) player = Player() player.show() player.resize(640, 480) sys.exit(app.exec_()) if __name__ == "__main__": main() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1633684501.0 python_vlc-3.0.21203/examples/qtvlc.py0000755000175200017520000001645714130006025017467 0ustar00oaubertoaubert#! /usr/bin/env python3 # # Qt example for VLC Python bindings # Copyright (C) 2009-2010 the VideoLAN team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # import sys import os.path import vlc from PyQt4 import QtGui, QtCore try: unicode # Python 2 except NameError: unicode = str # Python 3 class Player(QtGui.QMainWindow): """A simple Media Player using VLC and Qt """ def __init__(self, master=None): QtGui.QMainWindow.__init__(self, master) self.setWindowTitle("Media Player") # creating a basic vlc instance self.instance = vlc.Instance() # creating an empty vlc media player self.mediaplayer = self.instance.media_player_new() self.createUI() self.isPaused = False def createUI(self): """Set up the user interface, signals & slots """ self.widget = QtGui.QWidget(self) self.setCentralWidget(self.widget) # In this widget, the video will be drawn if sys.platform == "darwin": # for MacOS self.videoframe = QtGui.QMacCocoaViewContainer(0) else: self.videoframe = QtGui.QFrame() self.palette = self.videoframe.palette() self.palette.setColor (QtGui.QPalette.Window, QtGui.QColor(0,0,0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.positionslider = QtGui.QSlider(QtCore.Qt.Horizontal, self) self.positionslider.setToolTip("Position") self.positionslider.setMaximum(1000) self.connect(self.positionslider, QtCore.SIGNAL("sliderMoved(int)"), self.setPosition) self.hbuttonbox = QtGui.QHBoxLayout() self.playbutton = QtGui.QPushButton("Play") self.hbuttonbox.addWidget(self.playbutton) self.connect(self.playbutton, QtCore.SIGNAL("clicked()"), self.PlayPause) self.stopbutton = QtGui.QPushButton("Stop") self.hbuttonbox.addWidget(self.stopbutton) self.connect(self.stopbutton, QtCore.SIGNAL("clicked()"), self.Stop) self.hbuttonbox.addStretch(1) self.volumeslider = QtGui.QSlider(QtCore.Qt.Horizontal, self) self.volumeslider.setMaximum(100) self.volumeslider.setValue(self.mediaplayer.audio_get_volume()) self.volumeslider.setToolTip("Volume") self.hbuttonbox.addWidget(self.volumeslider) self.connect(self.volumeslider, QtCore.SIGNAL("valueChanged(int)"), self.setVolume) self.vboxlayout = QtGui.QVBoxLayout() self.vboxlayout.addWidget(self.videoframe) self.vboxlayout.addWidget(self.positionslider) self.vboxlayout.addLayout(self.hbuttonbox) self.widget.setLayout(self.vboxlayout) open = QtGui.QAction("&Open", self) self.connect(open, QtCore.SIGNAL("triggered()"), self.OpenFile) exit = QtGui.QAction("&Exit", self) self.connect(exit, QtCore.SIGNAL("triggered()"), sys.exit) menubar = self.menuBar() filemenu = menubar.addMenu("&File") filemenu.addAction(open) filemenu.addSeparator() filemenu.addAction(exit) self.timer = QtCore.QTimer(self) self.timer.setInterval(200) self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.updateUI) def PlayPause(self): """Toggle play/pause status """ if self.mediaplayer.is_playing(): self.mediaplayer.pause() self.playbutton.setText("Play") self.isPaused = True else: if self.mediaplayer.play() == -1: self.OpenFile() return self.mediaplayer.play() self.playbutton.setText("Pause") self.timer.start() self.isPaused = False def Stop(self): """Stop player """ self.mediaplayer.stop() self.playbutton.setText("Play") def OpenFile(self, filename=None): """Open a media file in a MediaPlayer """ if filename is None: filename = QtGui.QFileDialog.getOpenFileName(self, "Open File", os.path.expanduser('~')) if not filename: return # create the media if sys.version < '3': filename = unicode(filename) self.media = self.instance.media_new(filename) # put the media in the media player self.mediaplayer.set_media(self.media) # parse the metadata of the file self.media.parse() # set the title of the track as window title self.setWindowTitle(self.media.get_meta(0)) # the media player has to be 'connected' to the QFrame # (otherwise a video would be displayed in it's own window) # this is platform specific! # you have to give the id of the QFrame (or similar object) to # vlc, different platforms have different functions for this if sys.platform.startswith('linux'): # for Linux using the X Server self.mediaplayer.set_xwindow(self.videoframe.winId()) elif sys.platform == "win32": # for Windows self.mediaplayer.set_hwnd(self.videoframe.winId()) elif sys.platform == "darwin": # for MacOS self.mediaplayer.set_nsobject(self.videoframe.winId()) self.PlayPause() def setVolume(self, Volume): """Set the volume """ self.mediaplayer.audio_set_volume(Volume) def setPosition(self, position): """Set the position """ # setting the position to where the slider was dragged self.mediaplayer.set_position(position / 1000.0) # the vlc MediaPlayer needs a float value between 0 and 1, Qt # uses integer variables, so you need a factor; the higher the # factor, the more precise are the results # (1000 should be enough) def updateUI(self): """updates the user interface""" # setting the slider to the desired position self.positionslider.setValue(self.mediaplayer.get_position() * 1000) if not self.mediaplayer.is_playing(): # no need to call this function if nothing is played self.timer.stop() if not self.isPaused: # after the video finished, the play button stills shows # "Pause", not the desired behavior of a media player # this will fix it self.Stop() if __name__ == "__main__": app = QtGui.QApplication(sys.argv) player = Player() player.show() player.resize(640, 480) if sys.argv[1:]: player.OpenFile(sys.argv[1]) sys.exit(app.exec_()) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1681918170.0 python_vlc-3.0.21203/examples/tkvlc.py0000755000175200017520000014146114420004332017454 0ustar00oaubertoaubert#! /usr/bin/env python3 # -*- coding: utf-8 -*- # tkinter example for VLC Python bindings # Copyright (C) 2015 the VideoLAN team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # '''A simple example for VLC python bindings using tkinter. Author: Patrick Fay Date: 23-09-2015 ''' # Tested with VLC 3.0.16, 3.0.12, 3.0.11, 3.0.10, 3.0.8 and 3.0.6 with # the compatible vlc.py Python-VLC binding, Python 3.11.0, 3.10.0, 3.9.0 # and 3.7.4 and with tkinter/Tk 8.6.9 on macOS 13.0.1 (amd64 M1), 11.6.1 # (10.16 amd64 M1), 11.0.1 (10.16 x86-64) and 10.13.6 and with VLC 3.0.18, # Python 3.11.0 and tkinter/Tk 8.6.9 on Windows 10, all in 64-bit only. __version__ = '22.12.28' # mrJean1 at Gmail import sys try: # Python 3.4+ only import tkinter as Tk from tkinter import TclError, ttk # PYCHOK ttk = Tk.ttk from tkinter.filedialog import askopenfilename from tkinter.messagebox import showerror except ImportError: sys.exit('%s requires Python 3.4 or later' % (sys.argv[0],)) # import Tkinter as Tk; ttk = Tk import os import time import vlc _isMacOS = sys.platform.startswith('darwin') _isLinux = sys.platform.startswith('linux') _isWindows = sys.platform.startswith('win') _ANCHORED = 'Anchored' _BANNER_H = 32 if _isMacOS else 64 _BUTTONS = 'Buttons' _DISABLED = ( Tk.DISABLED,) _ENABLED = ('!' + Tk.DISABLED,) _FULL_OFF = 'Full Off' _FULL_SCREEN = 'Full Screen' # see _Tk_Menu.add_item and .bind_shortcut below # _KEY_SYMBOL = {'~': 'asciitilde', '`': 'grave', '!': 'exclam', '@': 'at', '#': 'numbersign', '$': 'dollar', '%': 'percent', '^': 'asciicirum', '&': 'ampersand', '*': 'asterisk', '(': 'parenleft', ')': 'parenright', '_': 'underscore', '-': 'minus', '+': 'plus', '=': 'equal', '{': 'braceleft', '}': 'braceright', '[': 'bracketleft', ']': 'bracketright', '|': 'bar', '\\': 'backslash', ':': 'colon', ';': 'semicolon', '"': 'quotedbl', "'": 'apostrophe', '<': 'less', '>': 'greater', ',': 'comma', '.': 'period', '?': 'question', '/': 'slash', ' ': 'space', '\b': 'BackSpace', # S! '\n': 'KP_Enter', '\r': 'Return', '\f': 'Next', '\v': 'Prior', '\t': 'Tab'} # '\a': 'space'? # see definition of specialAccelerators in _MAC_ACCEL = {' ': 'Space', '\b': 'Backspace', # s! '\n': 'Enter', '\r': 'Return', '\f': 'PageDown', '\v': 'PageUp', '\t': 'Tab', # 'BackTab', 'Eject'? 'Prior': 'PageUp', 'Next': 'PageDown'} _MIN_W = 420 _MOD_ALT = 1 << 17 # alt key down? _MOD_CMD = 1 << 3 # command key down _MOD_CTRL = 1 << 2 # ctrl key down _MOD_LOCK = 1 << 1 # caps lock down _MOD_SHIFT = 1 << 0 # shift key down _OPACITY = 'Opacity %s%%' _TAB_X = 32 _T_CONFIGURE = Tk.EventType.Configure _T_KEY = Tk.EventType.Key # KeyPress _TICK_MS = 100 # millisecs per time tick _Tk_Canvas = Tk.Canvas _Tk_Frame = ttk.Frame _Tk_Toplevel = Tk.Toplevel _Tk_Version = Tk.TkVersion _UN_ANCHORED = 'Un-' + _ANCHORED _VOLUME = 'Volume' _TKVLC_LIBTK_PATH = 'TKVLC_LIBTK_PATH' if _isMacOS: # MCCABE 14 from ctypes import cdll, c_void_p from ctypes.util import find_library as _find # libtk = cdll.LoadLibrary(ctypes.util.find_library('tk')) # returns (None or) the tk library /usr/lib/libtk.dylib # from macOS, but we need the tkX.Y library bundled with # Python 3+ or one matching the version of tkinter # Homebrew-built Python, Tcl/Tk, etc. are installed in # different places, usually something like (/usr/- or) # /opt/local/Cellar/tcl-tk/8.6.11_1/lib/libtk8.6.dylib, # found by command line `find /opt -name libtk8.6.dylib` def _find_lib(name, *paths): assert os.path.sep == '/' # 1. built into Python for p in (getattr(sys, 'base_prefix', ''), sys.prefix): if p: yield p + '/lib/' + name # 2. from ctypes.find_library, env variable for p in paths: if p: # is not None p = os.path.expanduser(p) yield p if not p.endswith(name): yield p + '/' + name # 3. the Homebrew basement from glob import iglob for t in ('/opt', '/usr'): t += '/local/Cellar/tcl-tk/*/lib/' + name for p in iglob(t): yield p try: env = os.environ.get(_TKVLC_LIBTK_PATH, '') lib = 'libtk%s.dylib' % (_Tk_Version,) for libtk in _find_lib(lib, _find(lib), *env.split(os.pathsep)): if libtk and lib in libtk and os.access(libtk, os.F_OK): break else: # not found anywhere if env: # bad env? t = 'no %s in %%s=%r' % (lib, env) else: # env not set, suggest t = 'no %s found, use %%s to set a path' % (lib,) raise NameError(t % (_TKVLC_LIBTK_PATH,)) lib = cdll.LoadLibrary(libtk) # _GetNSView = lib.TkMacOSXDrawableView is the # proper function to call, but that is non-public # (in Tk source file macosx/TkMacOSXSubwindows.c) # Fortunately, lib.TkMacOSXGetRootControl calls # lib.TkMacOSXDrawableView and returns the NSView _GetNSView = lib.TkMacOSXGetRootControl # C signature: void *_GetNSView(void *drawable) to get # the Cocoa/Obj-C NSWindow.contentView attribute, the # drawable NSView object of the (drawable) NSWindow _GetNSView.restype = c_void_p _GetNSView.argtypes = (c_void_p,) except (NameError, OSError) as x: # lib, image or symbol not found libtk = str(x) # imported by examples/psgvlc.py def _GetNSView(unused): # imported by examples/psgvlc.py return None del cdll, c_void_p, env, _find, lib Cmd_ = 'Command+' # bind key modifier, aka Meta_L # With Python 3.9+ on macOS (only!), accelerator keys specified # with the Shift modifier invoke the callback (command) twice, # once without and once with a Key (or KeyPress) event: hold the # former as a pseudo Key event possibly absorbed by the actual # Key event about 1 millisec later. With Python 3.8- on macOS, # Shift accelerator keys do not work at all: do not define any # Shift accelerator keys in that case _3_9 = sys.version_info[:2] >= (3, 9) else: # Windows OK, untested on *nix, Xwindows libtk = 'N/A' Cmd_ = 'Ctrl+' # bind key modifier: Control! _3_9 = True def _fullscreen(panel, *full): # get/set a panel full-screen or -off f = panel.attributes('-fullscreen') # or .wm_attributes if full: panel.attributes('-fullscreen', bool(full[0])) panel.update_idletasks() return f def _geometry(panel, g_w, *h_x_y): # set a panel geometry to C{g} or C{w, h, x, y}. if h_x_y: t = '+'.join(map(str, h_x_y)) g = 'x'.join((str(g_w), t)) else: g = g_w panel.geometry(g) # update geometry, then ... g, *t = _geometry5(panel) # ... get actual ... panel._g = g # ... as a C{str} and 4 C{int}s # == panel.winfo_width(), _height(), _x(), _y() panel._whxy = tuple(map(int, t)) return g def _geometry1(panel): # get a panel geometry as C{str} panel.update_idletasks() return panel.geometry() def _geometry5(panel): # get a panel geometry as 5-tuple of C{str}s g = _geometry1(panel) # '+-x' means absolute -x z, x, y = g.split('+') w, h = z.split('x') return g, w, h, x, y def _hms(tensecs, secs=''): # format a time (in 1/10-secs) as h:mm:ss.s s = tensecs * 0.1 if s < 60: t = '%3.1f%s' % (s, secs) else: m, s = divmod(s, 60) if m < 60: t = '%d:%04.1f' % (int(m), s) else: h, m = divmod(m, 60) t = '%d:%02d:%04.1f' % (int(h), int(m), s) return t def _underline2(c, label='', underline=-1, **cfg): # update cfg with C{underline=index} or remove C{underline=.} u = label.find(c) if c and label else underline if u >= 0: cfg.update(underline=u) else: # no underlining c = '' cfg.update(label=label) return c, cfg class _Tk_Button(ttk.Button): '''A C{_Tk_Button} with a label, inlieu of text. ''' def __init__(self, frame, **kwds): cfg = self._cfg(**kwds) ttk.Button.__init__(self, frame, **cfg) def _cfg(self, label=None, **kwds): if label is None: cfg = kwds else: cfg = dict(text=label) cfg.update(kwds) return cfg def config(self, **kwds): cfg = self._cfg(**kwds) ttk.Button.config(self, **cfg) def disabled(self, *disable): '''Dis-/enable this button. ''' # p = self.instate(_DISABLED) if disable: self.state(_DISABLED if disable[0] else _ENABLED) return bool(p) class _Tk_Item(object): '''A re-configurable C{_Tk_Menu} item. ''' def __init__(self, menu, label='', key='', under='', **kwds): '''New menu item. ''' self.menu = menu self.idx = menu.index(label) self.key = key # <...> self._cfg_d = dict(label=label, **kwds) self._dis_d = False self._under = under # lower case def config(self, **kwds): '''Reconfigure this menu item. ''' cfg = self._cfg_d.copy() cfg.update(kwds) if self._under: # update underlining _, cfg = _underline2(self._under, **cfg) self.menu.entryconfig(self.idx, **cfg) def disabled(self, *disable): '''Dis-/enable this menu item. ''' # p = self._dis_d if disable: self._dis_d = d = bool(disable[0]) self.config(state=Tk.DISABLED if d else Tk.NORMAL) return p class _Tk_Menu(Tk.Menu): '''C{Tk.Menu} extended with an C{.add_shortcut} method. Note, make C{Command-key} shortcuts on macOS work like C{Control-key} shotcuts on X-/Windows using a *single* character shortcut. Other modifiers like Shift- and Option- passed thru, unmodified. ''' _shortcuts_entries = None # {}, see .bind_shortcuts_to _shortcuts_widgets = () def __init__(self, master=None, **kwds): # remove dashed line from X-/Windows tearoff menus # like idlelib.editor.EditorWindow.createmenubar # or use root.option_add('*tearOff', False) Off? # as per Tk.Menu.__init__(self, master, tearoff=False, **kwds) def add_item(self, label='', command=None, key='', **kwds): '''C{Tk.menu.add_command} extended with shortcut key accelerator, underline and binding and returning a C{_Tk_Item} instance instead of an C{item} index. If needed use modifiers like Shift- and Alt_ or Option- before the *single* shortcut key character. Do NOT include the Command- or Control- modifier, instead use the platform-specific Cmd_, like Cmd_ + key. Also, do NOT enclose the key in <...> brackets since those are handled here as needed for the shortcut binding. ''' assert callable(command), 'command=%r' % (command,) return self._Item(Tk.Menu.add_command, key, label, command=command, **kwds) def add_menu(self, label='', menu=None, key='', **kwds): # untested '''C{Tk.menu.add_cascade} extended with shortcut key accelerator, underline and binding and returning a C{_Tk_Item} instance instead of an C{item} index. ''' assert isinstance(menu, _Tk_Menu), 'menu=%r' % (menu,) return self._Item(Tk.Menu.add_cascade, key, label, menu=menu, **kwds) def bind_shortcut(self, key='', command=None, label='', **unused): '''Bind shortcut key "". ''' # C{Accelerator} modifiers on macOS are Command-, # Ctrl-, Option- and Shift-, but for .bind[_all] use # , , and # with a shortcut key name or character (replaced # with its _KEY_SYMBOL if non-alphanumeric) # # if key and callable(command) and self._shortcuts_widgets: for w in self._shortcuts_widgets: w.bind(key, command) if label: # remember the key in this menu idx = self.index(label) self._shortcuts_entries[idx] = key # The Tk modifier for macOS' Command key is called Meta # with Meta_L and Meta_R for the left and right keyboard # keys. Similarly for macOS' Option key, the modifier # name Alt with Alt_L and Alt_R. Previously, there were # only the Meta_L and Alt_L keys/modifiers. See also # def bind_shortcuts_to(self, *widgets): '''Set widget(s) to bind shortcut keys to, usually the root and/or Toplevel widgets. ''' self._shortcuts_entries = {} self._shortcuts_widgets = widgets def entryconfig(self, idx, command=None, **kwds): # PYCHOK signature '''Update a menu item and the shortcut key binding if the menu item command is being changed. Note, C{idx} is the item's index in the menu, see C{_Tk_Item} above. ''' if command is None: # XXX postcommand for sub-menu Tk.Menu.entryconfig(self, idx, **kwds) elif callable(command): # adjust the shortcut key binding Tk.Menu.entryconfig(self, idx, command=command, **kwds) key = self._shortcuts_entries.get(idx, None) if key is not None: for w in self._shortcuts_widgets: w.bind(key, command) def _Item(self, add_, key, label, **kwds): # Add and bind a menu item or sub~menu with an # optional accelerator key (not <..> enclosed) # or underline letter (preceded by underscore), # see . cfg = dict(label=label) if key: # Use '+' sign, like key = "Ctrl+Shift+X" if key.startswith('<') and key.endswith('>'): c = '' # pass as-is, e.g. <> else: c = '+' # split into modifiers and char if key.endswith(c): m = key.rstrip(c).split(c) else: m = key.split(c) c = m.pop() for k in ('Key', 'KeyPress', 'KeyRelease'): while k in m: m.remove(k) # adjust accelerator key for specials like KP_1, # PageDown and PageUp (on macOS, see function # ParseAccelerator in and definition # of specialAccelerators in ) a = _MAC_ACCEL.get(c, c) if _isMacOS else c if a.upper().startswith('KP_'): a = a[3:] # accelerator strings are only used for display # ('+' or '-' OK, ' ' space isn't for macOS) cfg.update(accelerator='+'.join(m + [a])) # replace key with Tk keysymb, allow F1 thru F35 # (F19 on macOS) and because shortcut keys are # case-sensitive, use lower-case unless specified # as an upper-case letter with Shift+ modifier s = _KEY_SYMBOL.get(c, c) if len(s) == 1 and s.isupper() \ and 'Shift' not in m: s = s.lower() # default to single key down case if len(c) == 1: m.append('Key') # == KeyPress # replace Ctrl modifier with Tk Control while 'Ctrl' in m: m[m.index('Ctrl')] = 'Control' # for .bind_shortcut/.bind key = '<' + '-'.join(m + [s]) + '>' if _isMacOS or len(c) != 1 or not c.isalnum(): c = '' # no underlining else: # only Windows? c, cfg = _underline2(c, **cfg) else: # like idlelib, underline char after ... c, u = '', label.find('_') # ... underscore if u >= 0: # ... and remove underscore label = label[:u] + label[u+1:] cfg.update(label=label) if u < len(label) and not _isMacOS: # c = label[u] cfg.update(underline=u) if kwds: # may still override accelerator ... cfg.update(kwds) # ... and underline add_(self, **cfg) # first _add then ... self.bind_shortcut(key, **cfg) # ... bind return _Tk_Item(self, key=key, under=c, **cfg) class _Tk_Slider(Tk.Scale): '''Scale with some add'l attributres ''' _var = None def __init__(self, frame, to=1, **kwds): if isinstance(to, int): f, v = 0, Tk.IntVar() else: f, v = 0.0, Tk.DoubleVar() cfg = dict(from_=f, to=to, orient=Tk.HORIZONTAL, showvalue=0, variable=v) cfg.update(kwds) Tk.Scale.__init__(self, frame, **cfg) self._var = v def set(self, value): # doesn't move the slider self._var.set(value) Tk.Scale.set(self, value) class Player(_Tk_Frame): '''The main window handling with events, etc. ''' _anchored = True # under the video panel _BUTTON_H = _BANNER_H _debugs = 0 _isFull = '' # or geometry _length = 0 # length time ticks _lengthstr = '' # length h:m:s _muted = False _opacity = 90 if _isMacOS else 100 # percent _opaque = False _rate = 0.0 _ratestr = '' _scaleX = 1 _scaleXstr = '' _sliding = False _snapshots = 0 _stopped = None _title = 'tkVLCplayer' _volume = 50 # percent def __init__(self, parent, title='', video='', debug=False): # PYCHOK called! _Tk_Frame.__init__(self, parent) self.debug = bool(debug) self.parent = parent # == root self.video = os.path.expanduser(video) if title: self._title = str(title) parent.title(self._title) # parent.iconname(self._title) # set up tickers to avoid None error def _pass(): pass self._tick_a = self.after(1, _pass) self._tick_c = self.after(2, _pass) self._tick_r = self.after(3, _pass) self._tick_s = self.after(4, _pass) # .after_idle self._tick_t = self.after(5, _pass) self._tick_z = self.after(6, _pass) # panels to play videos and hold buttons, sliders, # created *before* the File menu to be able to bind # the shortcuts keys to both windows/panels. self.videoPanel = v = self._VideoPanel() self._bind_events(v) # or parent self.buttonsPanel = b = self._ButtonsPanel() self._bind_events(b) mb = _Tk_Menu(self.parent) # menu bar parent.config(menu=mb) # self.menuBar = mb # macOS shortcuts m = _Tk_Menu(mb) # Video menu, shortcuts to both panels m.bind_shortcuts_to(v, b) m.add_item('Open...', self.OnOpen, key=Cmd_ + 'O') m.add_separator() self.playItem = m.add_item('Play', self.OnPlay, key=Cmd_ + 'P') # Play/Pause m.add_item('Stop', self.OnStop, key=Cmd_ + '\b') # BackSpace m.add_separator() m.add_item('Zoom In', self.OnZoomIn, key=(Cmd_ + 'Shift++') if _3_9 else '') m.add_item('Zoom Out', self.OnZoomOut, key=(Cmd_ + '-') if _3_9 else '') m.add_separator() m.add_item('Faster', self.OnFaster, key=(Cmd_ + 'Shift+>') if _3_9 else '') m.add_item('Slower', self.OnSlower, key=(Cmd_ + 'Shift+<') if _3_9 else '') m.add_separator() m.add_item('Normal 1X', self.OnNormal, key=Cmd_ + '=') m.add_separator() self.muteItem = m.add_item('Mute', self.OnMute, key=Cmd_ + 'M') m.add_separator() m.add_item('Snapshot', self.OnSnapshot, key=Cmd_ + 'T') m.add_separator() self.fullItem = m.add_item(_FULL_SCREEN, self.OnFull, key=Cmd_ + 'F') m.add_separator() m.add_item('Close', self.OnClose, key=Cmd_ + 'W') mb.add_cascade(menu=m, label='Video') # self.videoMenu = m m = _Tk_Menu(mb) # Video menu, shortcuts to both panels m.bind_shortcuts_to(v, b) self.anchorItem = m.add_item(_UN_ANCHORED, self.OnAnchor, key=Cmd_ + 'A') m.add_separator() self.opaqueItem = m.add_item(_OPACITY % (self._opacity,), self.OnOpacity, key=Cmd_ + 'Y') m.add_item('Normal 100%', self.OnOpacity100) mb.add_cascade(menu=m, label=_BUTTONS) # self.buttonsMenu = m if _isMacOS and self.debug: # Special macOS "windows" menu # "Providing a Window Menu" # XXX Which (virtual) events are generated other than Configure? m = _Tk_Menu(mb, name='window') # must be name='window' mb.add_cascade(menu=m, label='Windows') # VLC player args = ['--no-xlib'] if _isLinux else [] self.Instance = vlc.Instance(args) self.player = self.Instance.media_player_new() b.update_idletasks() v.update_idletasks() if self.video: # play video for a second, adjusting the panel self._play(self.video) self.after(1000, self.OnPause) # elif _isMacOS: # # self._stopped = True # self._set_opacity() self.OnTick() # set up the timer # Keep the video panel at least as wide as the buttons panel # and move it down enough to put the buttons panel above it. self._BUTTON_H = d = b.winfo_height() b.minsize(width=_MIN_W, height=d) v.minsize(width=_MIN_W, height=0) _, w, h, _, y = _geometry5(v) y = int(y) + d + _BANNER_H _geometry(v, w, h, _TAB_X, y) self._anchorPanels() self._set_volume() def _anchorPanels(self, video=False): # Put the buttons panel under the video # or the video panel above the buttons if self._anchored and not self._isFull: self._debug(self._anchorPanels) v = self.videoPanel if _isMacOS and _fullscreen(v): # macOS green button full-screen? _fullscreen(v, False) self.OnFull() else: b = self.buttonsPanel v.update_idletasks() b.update_idletasks() h = v.winfo_height() d = h + _BANNER_H # vertical delta if video: # move/adjust video panel w = b.winfo_width() # same as ... x = b.winfo_x() # ... buttons y = b.winfo_y() - d # ... and above g = v else: # move/adjust buttons panel h = b.winfo_height() # unchanged if h > self._BUTTON_H and _fullscreen(b): # macOS green button full-screen? _fullscreen(b, False) h = self._BUTTON_H w = v.winfo_width() # unchanged x = v.winfo_x() # same as the video y = v.winfo_y() + d # below the video g = b # _g = g._g _geometry(g, max(w, _MIN_W), h, x, y) if video: # and g._g != _g: self._set_aspect_ratio(True) def _bind_events(self, panel): # set up handlers for several events try: p = panel p_ = p.protocol except AttributeError: p = p.master # == p.parent p_ = p.protocol if _isWindows: # OK for macOS p_('WM_DELETE_WINDOW', self.OnClose) # Event Types p.bind('', self.OnConfigure) # window resize, position, etc. # needed on macOS to catch window close events p.bind('', self.OnClose) # window half-dead # p.bind('', self.OnActive) # window activated # p.bind('', self.OffActive) # window deactivated p.bind('', self.OnFocus) # getting keyboard focus # p.bind('', self.OffFocus) # losing keyboard focus # p.bind('', self.OnReturn) # highlighted button if _isMacOS: p.bind('', self.OnClose) # p.bind('', self.OnReturn) # highlighted button # attrs holding the most recently set _geometry ... assert not hasattr(panel, '_g') panel._g = '' # ... as a sC{str} and ... assert not hasattr(panel, '_whxy') panel._whxy = () # ... 4-tuple of C{ints}s def _ButtonsPanel(self): # create panel with buttons and sliders b = _Tk_Toplevel(self.parent, name='buttons') t = '%s - %s' % (self._title, _BUTTONS) b.title(t) # '' removes the window banner b.resizable(True, False) f = _Tk_Frame(b) # button are too small on Windows if width is given p = _Tk_Button(f, label='Play', command=self.OnPlay) # width=len('Pause'), underline=0 s = _Tk_Button(f, label='Stop', command=self.OnStop) m = _Tk_Button(f, label='Mute', command=self.OnMute) # width=len('Unmute'), underline=0 q = _Tk_Slider(f, command=self.OnPercent, to=100, label=_VOLUME) # length=170 p.pack(side=Tk.LEFT, padx=8) s.pack(side=Tk.LEFT) m.pack(side=Tk.LEFT, padx=8) q.pack(fill=Tk.X, padx=4, expand=1) f.pack(side=Tk.BOTTOM, fill=Tk.X) f = _Tk_Frame(b) # new frame? t = _Tk_Slider(f, command=self.OnTime, to=1000, # millisecs length=_MIN_W) # label='Time' t.pack(side=Tk.BOTTOM, fill=Tk.X, expand=1) f.pack(side=Tk.BOTTOM, fill=Tk.X) # # # b.attributes('-topmost', 1) # self.videoPanel.update() # needed to ... # # b.overrideredirect(True) # ignore the panel b.update_idletasks() self.muteButton = m self.playButton = p self.timeSlider = t self.percentSlider = q return b def _debug(self, where, *event, **kwds): # Print where an event is are handled. if self.debug: self._debugs += 1 d = dict(anchored=self._anchored, isFull=bool(self._isFull), opacity=self._opacity, opaque=self._opaque, stopped=self._stopped, volume=self._volume) p = self.player if p and p.get_media(): d.update(playing=p.is_playing(), rate=p.get_rate(), scale=p.video_get_scale(), scaleX=self._scaleX) try: # final OnClose may throw TclError d.update(Buttons=_geometry1(self.buttonsPanel)) d.update( Video=_geometry1(self.videoPanel)) if event: # an event event = event[0] d.update(event=event) w = str(event.widget) # d.update(widget=type(event.widget)) # may fail d.update(Widget={'.': 'Video', '.buttons': _BUTTONS}.get(w, w)) except (AttributeError, TclError): pass d.update(kwds) d = ', '.join('%s=%s' % t for t in sorted(d.items())) print('%4s: %s %s' % (self._debugs, where.__name__, d)) def _frontmost(self): # Move panels to the front ... temporarily. for p in (self.videoPanel, self.buttonsPanel): p.attributes('-topmost', True) p.update_idletasks() p.attributes('-topmost', False) try: # no Toplevel.force_focus p.force_focus() except AttributeError: pass def OnAnchor(self, *unused): '''Toggle anchoring of the panels. ''' self._debug(self.OnAnchor) self._anchored = not self._anchored if self._anchored: self._anchorPanels() a = _UN_ANCHORED else: # move the buttons panel to the top-left b = self.buttonsPanel h = b.winfo_height() # unchanged _geometry(b, _MIN_W, h, _TAB_X, _BANNER_H) a = _ANCHORED self.anchorItem.config(label=a) def OnClose(self, *event): '''Closes the window(s) and quit. ''' self._debug(self.OnClose, *event) # print('_quit: bye') self.after_cancel(self._tick_a) self.after_cancel(self._tick_c) self.after_cancel(self._tick_r) self.after_cancel(self._tick_s) self.after_cancel(self._tick_t) self.after_cancel(self._tick_z) v = self.videoPanel v.update_idletasks() self.quit() # stops .mainloop def OnConfigure(self, event): '''Some widget configuration changed. ''' w, T = event.widget, event.type # int if T == _T_CONFIGURE and w.winfo_toplevel() is w: # i.e. w is videoFrame/Panel or buttonsPanel if w is self.videoPanel: a = self._set_aspect_ratio # force=True elif w is self.buttonsPanel and self._anchored: a = self._anchorPanels # video=True else: a = None # prevent endless, recursive onConfigure events due to changing # the buttons- and videoPanel geometry, especially on Windows if a and w._whxy != (event.width, event.height, event.x, event.y): self.after_cancel(self._tick_c) self._debug(self.OnConfigure, event) self._tick_c = self.after(250, a, True) def OnFaster(self, *event): '''Speed the video up by 25%. ''' self._set_rate(1.25, *event) self._debug(self.OnFaster) def OnFocus(self, *unused): '''Got the keyboard focus. ''' self._debug(self.OnFocus) self._frontmost() # self._set_aspect_ratio() # self._wiggle() def OnFull(self, *unused): '''Toggle full/off screen. ''' self._debug(self.OnFull) # # self.after_cancel(self._tick_t) v = self.videoPanel if not _fullscreen(v): self._isFull = _geometry1(v) _fullscreen(v, True) # or .wm_attributes v.bind('', self.OnFull) f = _FULL_OFF else: _fullscreen(v, False) v.unbind('') _geometry(v, self._isFull) self._isFull = '' self._anchorPanels() f = _FULL_SCREEN self.fullItem.config(label=f) def OnMute(self, *unused): '''Mute/Unmute audio. ''' if self._stopped or self._opaque: return # button.disabled self._debug(self.OnMute) # audio un/mute may be unreliable, see vlc.py docs. self._muted = m = not self._muted # self.player.audio_get_mute() self.player.audio_set_mute(m) u = 'Unmute' if m else 'Mute' # i = u.index('m' if m else 'M') # 2 if m else 0 self.muteItem.config(label=u) self.muteButton.config(label=u) # width=len(u), underline=i self.OnPercent() # re-label the slider def OnNormal(self, *unused): '''Normal speed and 1X zoom. ''' self._frontmost() self._set_rate(0.0) self._set_zoom(0.0) # self._wiggle() self._set_aspect_ratio(True) self._debug(self.OnNormal) def OnOpacity(self, *unused): '''Use the percent slider to adjust the opacity. ''' self.muteButton.disabled(True) # greyed out? self.muteItem.disabled(True) # greyed out? self._opaque = True self._set_opacity() self._debug(self.OnOpacity) def OnOpacity100(self, *unused): '''Set the opacity to 100%. ''' self._frontmost() self._set_opacity(100) self._debug(self.OnOpacity100) def OnOpen(self, *unused): '''Show the file dialog to choose a video, then play it. ''' self._debug(self.OnOpen) self._reset() # XXX ... +[CATransaction synchronize] called within transaction v = askopenfilename(initialdir=os.path.expanduser('~'), title='Choose a video', filetypes=(('all files', '*.*'), ('mp4 files', '*.mp4'), ('mov files', '*.mov'))) self._play(os.path.expanduser(v)) self._set_aspect_ratio(True) def OnPause(self, *unused): '''Toggle between Pause and Play. ''' self._debug(self.OnPause) p = self.player if p.get_media(): self._pause_play(not p.is_playing()) # self._wiggle() p.pause() # toggles def OnPercent(self, *unused): '''Percent slider changed, adjust the opacity or volume. ''' self._debug(self.OnPercent) s = max(0, min(100, self.percentSlider.get())) if self._opaque or self._stopped: self._set_opacity(s) else: self._set_volume(s) def OnPlay(self, *unused): '''Play video, if there's no video to play or playing, show a Tk.FileDialog to select one ''' self._debug(self.OnPlay) p = self.player m = p.get_media() if not m: if self.video: self._play(self.video) self.video = '' else: self.OnOpen() elif p.play(): # == -1, play failed self._showError('play ' + repr(m)) else: self._pause_play(True) if _isMacOS: self._wiggle() def OnSlower(self, *event): '''Slow the video down by 20%. ''' self._set_rate(0.80, *event) self._debug(self.OnSlower) def OnSnapshot(self, *unused): '''Take a snapshot and save it (as .PNG only). ''' p = self.player if p and p.get_media(): self._snapshots += 1 S = 'Snapshot%s' % (self._snapshots,) s = '%s-%s.PNG' % (self._title, S) # PNG only if p.video_take_snapshot(0, s, 0, 0): self._showError('take ' + S) def OnStop(self, *unused): '''Stop the player, clear panel, etc. ''' self._debug(self.OnStop) self._reset() def OnTick(self): '''Udate the time slider with the video time. ''' p = self.player if p: s = self.timeSlider if self._length > 0: if not self._sliding: # see .OnTime t = max(0, p.get_time() // _TICK_MS) if t != s.get(): s.set(t) self._set_buttons_title(t) else: # get video length in millisecs t = p.get_length() if t > 0: self._length = t = max(1, t // _TICK_MS) self._lengthstr = _hms(t, secs=' secs') s.config(to=t) # tickinterval=t / 5) # re-start the 1/4-second timer self._tick_t = self.after(250, self.OnTick) def OnTime(self, *unused): '''Time slider has been moved by user. ''' if self.player and self._length: self._sliding = True # slider moving, see .OnTick self.after_cancel(self._tick_s) t = self.timeSlider.get() self._tick_s = self.after_idle(self._set_time, t * _TICK_MS) self._set_buttons_title(t) self._debug(self.OnTime, tensecs=t) def OnZoomIn(self, *event): '''Zoom in by 25%. ''' self._set_zoom(1.25, *event) self._debug(self.OnZoomIn) def OnZoomOut(self, *event): '''Zoom out by 20%. ''' self._set_zoom(0.80, *event) self._debug(self.OnZoomOut) def _pause_play(self, playing): # re-label menu item and button, adjust callbacks p = 'Pause' if playing else 'Play' c = self.OnPlay if playing is None else self.OnPause # PYCHOK attr self.playButton.config(label=p, command=c) self.playItem.config(label=p, command=c) self.muteButton.disabled(False) self.muteItem.disabled(False) self._stopped = self._opaque = False self._set_buttons_title() self._set_opacity() # no re-label self._set_volume() self._set_aspect_ratio(True) def _play(self, video): # helper for OnOpen and OnPlay if os.path.isfile(video): # Creation m = self.Instance.media_new(str(video)) # unicode p = self.player p.set_media(m) t = '%s - %s' % (self._title, os.path.basename(video)) self.videoPanel.title(t) # self.buttonsPanel.title(t) # get the window handle for VLC to render the video h = self.videoCanvas.winfo_id() # .winfo_visualid()? if _isWindows: p.set_hwnd(h) elif _isMacOS: # (1) the handle on macOS *must* be an NSView # (2) the video fills the entire panel, covering # all frames, buttons, sliders, etc. inside it ns = _GetNSView(h) if ns: p.set_nsobject(ns) else: # no libtk: no video, only audio p.set_xwindow(h) else: # *nix, Xwindows p.set_xwindow(h) # fails on Windows self.OnPlay(None) def _reset(self): # stop playing, clear panel p = self.player if p: p.stop() self.timeSlider.set(0) self._pause_play(None) self._sliding = False self._stopped = True self.OnOpacity() def _set_aspect_ratio(self, force=False): # set the video panel aspect ratio and re-anchor p = self.player if p and not self._isFull: v = self.videoPanel g, w, h, x, y = _geometry5(v) if force or g != v._g: # update self.after_cancel(self._tick_a) a, b = p.video_get_size(0) # often (0, 0) if b > 0 and a > 0: # adjust the video panel ... if a > b: # ... landscape height h = round(float(w) * b / a) else: # ... or portrait width w = round(float(h) * a / a) _g = _geometry(v, w, h, x, y) self._debug(self._set_aspect_ratio, a=a, b=b) if self._anchored and (force or _g != g): self._anchorPanels() # redo periodically since (1) player.video_get_size() # only returns non-zero width and height after playing # for a while and (2) avoid too frequent updates during # manual resizing of the video panel self._tick_a = self.after(500, self._set_aspect_ratio) def _set_buttons_title(self, *tensecs): # set the buttons panel title T, s = self._length, self._lengthstr if s and T: t = tensecs[0] if tensecs else self.timeSlider.get() t = _hms(t) if t < T else s t = '%s - %s / %s%s%s' % (self._title, t, s, self._scaleXstr, self._ratestr) else: # reset panel title t = '%s - %s' % (self._title, _BUTTONS) self._length = 0 # self._lengthstr = '' self.buttonsPanel.title(t) def _set_opacity(self, *percent): # 100% fully opaque # set and re-label the opacity, panels and menu item if percent: self._opacity = p = percent[0] else: p = self._opacity a = max(0.2, min(1, p * 1e-2)) self.videoPanel.attributes('-alpha', a if self._stopped else 1) self.buttonsPanel.attributes('-alpha', a) # if _isMacOS: # # self.buttonsPanel.attributes('-transparent', a) s = _OPACITY % (p,) self.opaqueItem.config(label=s) if self._opaque or self._stopped: self._set_percent(p, label=s) def _set_percent(self, percent, **cfg): # set and re-label the slider self.percentSlider.config(**cfg) self.percentSlider.set(percent) def _set_rate(self, factor, *event): # change the video rate p = self.player self.after_cancel(self._tick_r) if not event: # delay the menu event as a false key event ... # ... and possibly overwritten by the actual key event self._tick_r = self.after(3, self._set_rate, factor, False) elif p: r = p.get_rate() * factor if r > 0: r = max(0.2, min(10.0, r)) t = ' - %d%%' % (int(r * 100),) else: r, t = 1.0, '' p.set_rate(r) self._rate = r self._ratestr = t self._set_buttons_title() def _set_time(self, millisecs): # set player to time p = self.player if p: p.set_time(millisecs) self._sliding = False # see .OnTick def _set_volume(self, *volume): # set and re-label the volume if volume: self._volume = v = volume[0] else: v = self._volume m = ' (Muted)' if self._muted else '' V = '%s %s%%' % (_VOLUME, v) self._set_percent(v, label=V + m) p = self.player if p and p.is_playing() and not self._stopped: # .audio_set_volume returns 0 on success, -1 otherwise, # e.g. if the player is stopped or doesn't have media if p.audio_set_volume(v): # and p.get_media(): self._showError('set ' + V) def _set_zoom(self, factor, *event): # zoom the video in/out, see cocoavlc.py p = self.player self.after_cancel(self._tick_z) if not event: # delay the menu event as a false key event ... # ... and possibly overwritten by the actual key event self._tick_z = self.after(3, self._set_zoom, factor, False) elif p: x = self._scaleX * factor if x > 1: s = x t = ' - %.1fX' % (x,) else: x, s, t = 1, 0.0, '' p.video_set_scale(s) # self.videoPanel.update_idletasks() self._scaleX = x self._scaleXstr = t self._set_buttons_title() def _showError(self, verb): '''Display a simple error dialog. ''' t = 'Unable to %s' % (verb,) showerror(self._title, t) # sys.exit(t) def _VideoPanel(self): # create panel to play video v = _Tk_Frame(self.parent) c = _Tk_Canvas(v) # takefocus=True c.pack(fill=Tk.BOTH, expand=1) v.pack(fill=Tk.BOTH, expand=1) v.update_idletasks() self.videoCanvas = c self.videoFrame = v # root is used for updates, NOT ... return self.parent # ... the frame def _wiggle(self, d=4): # wiggle the video to fill the window on macOS if not self._isFull: v = self.videoPanel g, w, h, x, y = _geometry5(v) w = int(w) + d # x = int(x) - d # h = int(h) + d if _geometry(v, w, h, x, y) != g: self.after_idle(_geometry, v, g) if d > 1: # repeat a few times self.after(100, self._wiggle, d - 1) def print_version(name=''): # imported by psgvlc.py # show all versions, this module, tkinter, libtk, vlc.py, libvlc, etc. # sample output on macOS: # % python3 ./tkvlc.py -v # tkvlc.py: 22.12.28 # tkinter: 8.6 # libTk: /Library/Frameworks/Python.framework/Versions/3.11/lib/libtk8.6.dylib # is_TK: aqua, isAquaTk, isCocoaTk # vlc.py: 3.0.12119 (Mon May 31 18:25:17 2021 3.0.12) # libVLC: 3.0.16 Vetinari (0x3001000) # plugins: /Applications/VLC.app/Contents/MacOS/plugins # Python: 3.11.0 (64bit) macOS 13.0.1 arm64 # sample output on Windows: # PS C: python3 .\tkvlc.py -v # tkvlc.py: 22.12.28 # tkinter: 8.6 # libTk: N/A # is_TK: win32 # vlc.py: 3.0.12119 (Mon May 31 18:25:17 2021 3.0.12) # libVLC: 3.0.18 Vetinari (0x3001200) # plugins: C:\Program Files\VideoLAN\VLC # Python: 3.11.0 (64bit) Windows 10 # see or private property r = Tk.Tk() t = r.tk.call('tk', 'windowingsystem'), # r._windowingsystem r.destroy() if _isMacOS: try: from idlelib import macosx m = macosx.__dict__ t += tuple(sorted(n for n, t in m.items() if n.startswith('is') and n.endswith('Tk') and callable(t) and t())) except ImportError: # Python 10: no test.support ... pass t = ', '.join(t) or 'N/A' n = os.path.basename(name or __file__) for t in ((n, __version__), (Tk.__name__, _Tk_Version), ('libTk', libtk), ('is_Tk', t)): print('%s: %s' % t) try: vlc.print_version() vlc.print_python() except AttributeError: try: os.system(sys.executable + ' -m vlc -v') except OSError: pass if __name__ == '__main__': # MCCABE 13 _argv0 = sys.argv[0] _debug = False _video = '' while len(sys.argv) > 1: arg = sys.argv.pop(1) if arg in ('-v', '--version'): print_version() sys.exit(0) elif '-debug'.startswith(arg) and len(arg) > 3: _debug = True elif arg.startswith('-'): print('usage: %s [-v | --version] [-debug] []' % (_argv0,)) sys.exit(1) elif arg: # video file _video = os.path.expanduser(arg) if not os.path.isfile(_video): print('%s error, no such file: %r' % (_argv0, arg)) sys.exit(1) root = Tk.Tk() # create a Tk.App() player = Player(root, video=_video, debug=_debug) if _isWindows: # see function _test() at the bottom of ... # root.iconify() root.update() root.deiconify() root.mainloop() # forever root.destroy() # this is necessary on Windows to avoid ... # ... Fatal Python Error: PyEval_RestoreThread: NULL tstate else: root.mainloop() # forever ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1728311982.7532592 python_vlc-3.0.21203/examples/video_sync/0000755000175200017520000000000014700771257020131 5ustar00oaubertoaubert././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1588158710.0 python_vlc-3.0.21203/examples/video_sync/README.md0000644000175200017520000000251113652260366021406 0ustar00oaubertoaubert## Video Synchronization with python-vlc Each video player is launched as a separate process. `main.py` is the entry point into the program. It creates the "main" video player with all of its respective controls. The main video player is started alongside a multithreaded server that "broadcasts" signals (e.g. play, pause, stop, and etc.) and the current time of the video player, to all client/slave videos. Specifically, this is accomplished by putting the current time or the signal of the main video player into a `queue` (FIFO). The multithreaded server gets the value from the queue and sends the value to each connected client. In a somewhat similar fashion, each "slave" video player is launched as a separate process, along with a client. The client has a `data_receiver` thread that continuously listens for data, receives data, parses the data, and puts the data into a `queue` that is specific to that "slave" video player. The "slave" video player gets the value from the queue and updates itself in accordance with that value. In order to facilitate interprocess communication, UNIX domain sockets are used to send and receive data. For the time being, Windows users have to use TCP/IP sockets. Note: for the sake of clarity, the figure only shows the case of 3 client/slave videos. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1588158710.0 python_vlc-3.0.21203/examples/video_sync/figure.png0000644000175200017520000006774713652260366022144 0ustar00oaubertoaubert‰PNG  IHDRmµÉçÎtEXtmxfile%3Cmxfile%20modified%3D%222020-02-28T17%3A12%3A02.453Z%22%20host%3D%22www.draw.io%22%20agent%3D%22Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010.15%3B%20rv%3A73.0)%20Gecko%2F20100101%20Firefox%2F73.0%22%20etag%3D%22arcVWWq0BAOvchrxFECu%22%20version%3D%2212.7.9%22%20type%3D%22google%22%3E%3Cdiagram%20id%3D%22Ht1M8jgEwFfnCIfOTk4-%22%20name%3D%22Page-1%22%3E7VvbkqM2EP0aP44LJG5%2B3PF4MqmaJFPl1GazbzLItrKAXFi%2B7ddHAnER4DFZs2BP8MugRhJS9%2Bnu04IZwWlw%2FCVCm%2FVv1MP%2BCGjecQSfRgDowNL5HyE5JRLHtBPBKiKe7JQL5uQ7lkJNSnfEw1ulI6PUZ2SjCl0ahthligxFET2o3ZbUV5%2B6QStcEcxd5FelfxGPreUugJ3LXzBZrdMn69YkuROgtLPcyXaNPHooiOBsBKcRpSy5Co5T7AvlpXpJxj2fuZstLMIhazLg4ffPk9nu15eX8OuRmOF39HUJHnQgF8dO6Y6xxxUgmzRia7qiIfJnufQxorvQw2JajbfyPq%2BUbrhQ58J%2FMGMnaU20Y5SL1izw5V18JOxL4fpvMdXYlK0nAZ4HMLbT9kk%2BSTTecEQCzHCUykIWnb4UG4XJRDOeLbuZzZVsW%2Bz1rDqlaEt3kYvf0SGUsETRCrN3%2BhmZ0bm3YMp3EZ34uAj7iJG9ug4kYbvK%2BuWW5RfSuP%2FB0HKRe%2BTv5JMqht%2ByiH7LUC5sQ3fMJyGeZr4lNOeh7TozPvLJKuTXLteasEnRyksaMgkBhzc5%2FjfiOjiuRKgYY7IZB3i75R40XSP%2BBD7ucY8jRrj3vaIF9t%2FoljBCxfwLyhgNeAdf3HhE7rdVjMIp9WkULx8u419hjk9ybUyg8nFJfL%2FQ2zOx4xliWfGuC3ccsICWJXa%2FQS5hAjBWjhgxOT6%2Bj5mqjeUAqMlYIIOhCQRQY8khDy562mtdCCxpFGkdGKZ5oxFAK7u%2FwNMzCogvBC%2FY32Nh5tuIAUbDGACtK4OAHPpGCV9iBixrAlRgwQxY6STJ0uS4EmayhVwBI2uAUXcwAvDnwMhU4xOwtW5BZN8LiH4UK2fB1wOIjGtBdFXeMRoQEskY3BNnIV5MLw5rwvCcJ2YhP3AeoZpykWDhdZEJMqbwR8JlUm6isoGl42LXrWMDWvxrJ%2F0blqO4lzGpS%2F9WTfZ3flb2T8usO%2FC4Hyb%2FspJQ%2FDBuladr0QftpnygTxe0Ky74mRfbtIKIguVU%2FwipcKiyM2maPXmyUq5eIPFZkXCO5QfE82KE1VP4SrFRqDB4IXumXtkKGh%2Bu%2Foyx%2BWDJYYX1Pse%2FmgqFrwsHaDPex1ppJQToQM2wxsSsqwBATQwo5%2BLWYACMPmJAi86mm01p0xnjdONu6TKHGrzPGnxSqsF5vu29Bk93MUTiDiOxZpeAAG8gFN%2FNYcztUi%2FQ9Dw2icd9ZQPQ4ET2QrWDtpvEuZbkKOyfp4U8QKSpBCrBFGrVYPFpNnMe34%2FGLbidXT5igHXh1%2BmyBgJWxRJTn2B5xFG0B982U01wMQpLUSVgluNqFnDrbK56uGLlkk3bsFA5LtYmSKPL%2FAh7eUvVYkyCTWMS7Pcl0fCW6AYZ6i28JYLV47qBoXbNUG%2FhsAAODPX6bGA1zQa9Hg%2FCKi%2F6PzLU%2BlP6ThkqrJ7UDgz1UoLslqFO7pyhptq6%2FNaw1zPUdJkDQ70lhmo7%2FTNUYzhD7Z%2Bh2mb%2FDNXo5bDgYzFUo%2FE3rVo9QDrKBsMZqmz3zVCN6vnAwFAvJchOGarpVCw0xxHf5T1Y6Oxnc%2B2bzrDVj7RMqPVrOKsB5c1Vp59RbsGauc6AVhvjFNVv0iwzT5iHEDvtqNqaqF5i2XVeYtaxh8wE7au7yiM%2FiLrLp4n6LWgbfFRtl8F9G%2BpuQJg%2Bhrr1Wk7Umrp5M%2F%2FPveTz9%2Fz%2FH%2BHsXw%3D%3D%3C%2Fdiagram%3E%3C%2Fmxfile%3EÍòé. IDATxœìÝùw…½÷ñ翸¿?¿Ü?Àœ–ž›œ– i MRxØÊ¥…BKZ–Û-K IhS $Ф@K !$˜$$dßœm¼Ä²ãxS<–¬q¼L,[¶ìÏóCjcI–mI3Ò¼_ç|Àò0ãGÒÛiþÈ“ÿãöJÑ È¢7D' oˆN0+¶m˲¬”ã8NÚåâñxÚå,Ëšñ:ãñxÚåÇI»œmÛ×™i[gºN7öO¦uzmÿdZ§û'Ó:½¶¦Zg¡÷O)ý›öÚþ™j½½½r'ãÏ”oD'H++‰(‘H¤ýÓ4eFÊÉôDÊqœ´Ë†‘q»2­3Ó0˲Ò.gšfÆufÚÖ™®Óý“i^Û?™ÖéÆþÉ´N¯íŸ©ÖYèýSJÿ¦½¶2­3‰¤Ü/SÅj®`‚D"¡H$¢`0˜|’ÒÓÓ“öû½öÌkOP‰N¢Óý3Õ: ½Jéß´×öÏLÿMŒëÌ%¢Hºöªf(RMMͤ''‘HÄíÍÌã8ÉS‘Ç6 lýD'4ù/éMMM²m;㩵€âTÈûv¢HúæÔ¯––W?pà®H$2å‡MÑ ’xUü-'ßfašfNþIt$]ûããõo·¨©©Q,›Õÿ“èÀGb±¯f¦ôíË­LuÝÓLˆN|bü”©`0Hx¦‹ÅT]] ÏL—ÏÊ„èÀ‰DÖ×Ý`ÜxxÎæ–D'%îÛÁ9›S¤þ3Û·f”¸P(Dp\CtPÂzzz’ÁÙÒÒâöæ|ˆè „E"UWW+ðáAW”¸x<>ëk¬J6Ð$:ÓÒÓÓ£@ ˲¦ü^¢0-¦iÊ0 ÕÔÔLùj'Ñ ˜Çq’T7Õ«D'`ÚÆ_í ¿èLÛõ—åÊôuD'%ÄqƒAE"·7àÕÕÕ2 C¡P(í÷”P($Ã0T]]íö¦| ¥¥E†a¨©©)í÷”`08åƒ?¹ÇùôZü"‘H$ß[Ã鵯 :(×|½ã8no’ˆNJÆõŸ"€W”˲ˆN€ç”ˆx<®H$"Û¶ÝÞ’ˆN@Þ€³m[¦iª··7åíD'`ÆÆ?S ¦¼èÌÑ È¢7D'>‹Åä8Žb±˜Û›ð¢Ÿ0MS†aÈ4M·7à#D'>AtÜÇå8ŽFFFRÞNtP"ˆN€”¢àED'%‚èxÑ @‰ :^DtP"B¡LÓT(r{SH":yCtfÌqY–¥”·€³,K†a(¦¼èÌÑ È¢7D' oˆN|Â4M†!Ó4ÝÞ€øÑ pƒmÛ2MS½½½)o':(D'À‹ˆNJÑ ð"¢€At¼ˆè D/":(D'À‹ˆNJD,“ã8ŠÅbno ID' oˆNÀŒY–%Ã0FSÞNtfŒèä Ñ È¢7D'>aÛ¶,Ë’mÛnoÊŒ8C}êìN;ÎP_Æå3-›N»Üàp,írƒÃé/?“θΙþ¬Sýœà5D'>aš¦ ÃišnoÊŒô DÕ~å’šì )çro«â£Ãi'ÝrMöõÇûÒ.ˆ¤].:I»\¼/ã:3mëåÞ֔˴ئÂ}!·L Ñ €O{tJRØéP \™rL»^ѸvÒ-Wªc #ír-ý—Ò.×Ò)íré·5®Ì¸­¦]Ÿz}Wy¥@щÇãrG###)o':(¥±ÑÁŒ±Vês5qÕíC9GtP"ˆÎâ¢@)":(ÅÉ!õį¨3f¹D'àžêŽA—™BNG_êÓbs…è D{t†ûBjŒÖMùÞÍR¢~60<ª…µ«lm3ãÂl¬êÍÛ±%:(¡PH¦i**ÎO?%:‰NøÛ¾‹W]¯ëgîúVý|kÇ„¯Íû Mwo éŽCš»¾uÒ2÷oé(ȶåc|”¿Ç¢xÑItÂßNµÅ\¯ëgiy§$é§Ÿ^N~íXKLuá!]èŠëOGì ßÿdy§ÂNÂõížé<°µ#oÇ–èžà÷èìŠÈŒj81äö¡\áµè,[Û,{ ¡ªz“ÿ=42¦ÕÇ»õô®°m¼v*ðßYZq(ª?ëžÏìkÙ® ¯ˆ.-ïÔk‡¢)_%u{fŽãȲ, ¤¼èžà÷èlé¿$³«Vá¾â<=˜-/Fç–Ú~µ÷«lm³^9Ð¥áÑ1Í]ߪ†®¸V±õüÞ.I­W†%)¡¾uô¨?>¦Ö+×–¯êTÿИ:ûGó\xÎ&:-Ë’aŠF£)o':€'D'üÍ‹Ñyÿ–k!vÿ–k‰éx˵mÎ#ÍÚÓà¨lm³þQÙ«°“Ðs_E”“ûÜÒÿî‰H’^Ú-Nç}Ж\~õñn×>¢ø ÑItÂß¼ek›ÕÔ=¬í~ Œéù½]¢ór߈ֺ¢²µÍzi—ÂNBŸT÷itLªíRmçá!½®G=±ÑäÿódkLÛý®ÿlD'ðØè ëñGtîðjt®;uE’Ô?4–üÚxt–»<¨¹ë[uèÒ€ÂNBO–wêêð˜ml×âm–:ûG´x›¥±1éÉòNýôÓËê‰ê™Ýa×6¢LK,“ã8ŠÅbnoÊŒD'üË«Ñ9ïƒ6ŽI_¿ye2Ø×Êö~¾µCí½×ÞÏ94ríýšek›u´9¦ÄصŸkÿ¿/³©¦OC#c“ö6zëò0D'ÈŠiš2 C¦iº½)3Ftð/¯Fg6sÇÇ¡”±:ÿí¾6w}«ç>@ˆèY#:‹{ˆNø]1Gg) —LS":‹®&®º}×ÅS!:(DgñÑ ?;ÕÓÂízlG'ãÂ`JDgñÑ ?;ÕÓc;:µáìÆ…!:À”Š=:{¢ õ¶¨¹ç¢ëñGt…GtÀãŠ=:Ã}!5FëdÚõ®ÇÑ ÑItäÑItÂ߈N¢ ¯ˆN¢þFtotÆãq9Ž£‘‘‘”·ÀüíN«Z{.ªg õÅÕRçft¾SqEËF]Ÿ•G좌N˲d†¢ÑÔ÷_D'ð¿GgKÿ%™]µ ÷…Ü>×»¢‹áZ™ç}?ÁŽ*-ÇÜ>$®p+:_Ø×¥ï½×âúu2ÇgáÆv¢ ˆNFgÏÕ¨êÚ+Õ½,ËçÓiÖIs¿/UÑ´ßíCSpnEçÂí®‡æ·ç…}]D'@® '†Ô¿¢Î˜åz…ÑëVMëuwwû~"ÑNi<"Û¶eÛ¶êZ«TÓ^áö!*(¢ó›qc?Àb£ƒ®ÇÑYÃ#Cªl>¡h4ÊD£:ÓxDá˾VÙT¡Æp­Û‡ª`ˆN¢x\(’iš …Š7Zò]±.Û/(:u=.‰Îk;j5©³³Ó÷s¡å¼Úêêêš4ëw*><èöá*¢“ègš¦ ÃišnoJFñx\†a¤¼-ѹm×v•••iÑí‹´`á­Y¿FѸ­ç^z^*裭õÖ{oOëÿyðô!¨:ItfH$tæÌ™”·ÅG†tîâ1]¾|™¹|Y§.TGgH‘HdÒT^¬Pc¤t^íIû{AtÀãŠ%:ÛÛÛ5oÞ<-Y²DçΛp[®£³úbÊÊÊtôÜ1Eã¶:K‹n_¤“5zî¥çõõÉýjínÓ¥®æä2u-õjínKþ·ÙaÊr:UÙP¥hÜVx ¢?­þ“Öüm:¯†s¶­]CÙƒQ '†\:2¹÷ãÿX·ß~»vïÞ=á둾Õ6Vª­­Í÷c^ ªêâ©´¯‚6‡.ꄹץ#˜{cccºå–[tÏ=÷hÿþ‰–DtotN…è DKtJÒk¯½¦²²²d|ž={VRî£sÝë´äñ%¾Ö¹¤æ®ædtŽ¿ÒÙÚݦ'–þRýòš3gŽvìÛ©hÜÖœ9sôÀChÉãKôÀC¨º±FwÜõÿtï}÷ê|SmN·÷jâªËG&·víÚ¥ÿú¯ÿÒ÷¿ÿ}Ý~ûíÚµk—$©ÍnÔù†J577û~jªTÕ˜>:ÛB­ÚW»Ýå#™[›6mÒ7Þ¨›nºIwß}·¾þúkIÅ?ü°=¯—Y!:ð©íÛ·kñâÅZ²dINçÑGÍÉÜsÏ=úÙÏ~¦§žzJË—/÷ô¼øâ‹š7ožÊÊÊTVV¦›nºIO=õTΣóµU¯%O§ýö|;:7±E«Þ|]áˆNNkÑí‹’ÑYeV+·õðc¨¢¦BkÖ¯Ñ?7ÿ3§ÛÛ2ê ­X±¢¤fÁ‚Éãóë _Û±o§öÙ3):¿ì÷Ztû"-y|‰–<¾D¿úͯ’ш(·õôoŸÖá3‡ó= ƒ%3‡ÖøÃdXüä'?ÑîÝ»eZµªª?—·ßÓbšsu§TsñlÚ÷{†.‡ôÕù­’¤þþ~×i.fÏž=úïÿþo•••é?øîºë.øà¤O°ÌGtFã×>½öÎ{îÔÍónVYYY2¿ýéµãïé¼ïþûtó¼›µçÈž´Ñùå]ºuþ­2.Dg½½½Z²dÉ„Ø×‹êTàˆjkk}?Õç«u¸fÚÛÛSÎù‹†Î6qáæG$ÑÃ?²œœ¡>·EAt\iÕ±s‡tîÜ9ßÏɳÇu²öZZZ&LðbŽ^Ø=õÎ,¥ã3Ó÷{[tÚ¶-Ó4ÕÛÛ›òv¢€,ùå÷èlé¿$³«Vá¾Û‡¢`ηžÑ±S‡uúôißÏÁÓ{uºîø„Ë©ì­Þ¢Áá·SÁ”btŽÏ³{"Ó:å¶Ø¢Ó²,†¡h4šòv¢€,ùEtú/:Ç4¦3Gt¬âˆ***|?‡N}%£þ´ššš´ÿüçê¹Úíö!*¨RΕGìi¯ƒèÀ§ˆÎüꈪ½§YÍ=]@¢³°ÎšGuØøJ‡Œ=¾Ÿ¯Œí:Pû…l§ÓíÃRp¥ïT\™ñû:‰N|ŠèÌ¿Øè ëñGtº£°‡ù÷ôÅüõ ç¸RŠÎÙ~‚-Ñ €Oy=:c±˜ÇQ,s{SfŒèôot¥ËFsr­N¢Ÿòztš¦)Ã0<½S!:‰NøW1GçêãÝ3úÿ`¢3ÿüíN«Z®4ªg õ“6 Ôct¾SqE‹·[9‹ÍbNÇqdY–RÚ2Ñ @–ˆÎüóstFã¶®&®º}×[t.-Ïê}›¥S!:ÈÑ™D'Ñ ÿ*¦èÌ÷øÑ™D'Ñ ÿ":‰N|è̯p_HÑ:™v½ëñGt…GtøÑ™_D'Ñ #:‰N|ÏëÑYìˆN¢þFtøÑ™_D'Ñ #:¿™¥åᢊN.™@Žùå÷èlé¿$³«Vá¾Û‡p…[Ñyßæ×#óÛ³úxwQE§eY2 CÑhêë d‰èÌ/¢“è„¿¹ïT\ Ï…Û=1/ìë*ø> :ð¢3¿ˆN¢þæVt2D'žAtæ×pbH=ñ+êŒY® Ñ ÑItà{DgþÅF]?¢pÑItà{^Îb¿N§Dtð3¢“èÀ÷ˆÎü#:‰NøÑY¼ÑiÛ¶LÓToooÊÛ‰N²Dt柟£³k("{0ªáÄÛ‡p…ëÎO.»_~œ•Gl--ïÌÛ±%:ÈÑ™~ŽÎhÜÖÕÄU·àªå‡¢zôs‹)ðüb‡¥ªŽÁ¼W¢€,ùGtJÑ @–ˆÎür†úv:Ôî´ºD'äÑ @–ˆÎü ÷…Ô­S0Z«–þKÉéФ´ŽŽ ß{ýL¯é–›Í:;:Ò.×5ɸN¢@©":È’×£3‹ÉqÅb1·7eFÂ}!]²ƒ vÕL˜H,¬Þ‘¾”rÚ&}ÿø\ºÒv¹Þ‘¾´ËÍf!§-ír‘X8ã:{GúKç±€LˆN²äõè,vá¾ZíÆI38œ>Äz»S.Ój7Nyé‘tËÍf½ƒÝi—Že\'”*¢€,LfY– ÃP4My;Ñ @–ˆN&#:È¢€ÉˆNr„è`2¢€!:˜Œè G¼¶m˲,Ù¶íö¦|„è G¼¦iÊ0 Oo# ôäÑ Àdñx\Žãhdd$åíD'Y":˜>¢€,LÑ @–ˆN¦è KD'ÓGt%¯Gg(’iš …Bno ID'YòztàED'Y":˜ÌqY–¥”·d‰è`2˲d†¢ÑhÊÛ‰N²Dt0Ñ @ŽLFt#D'“äÑ ÀdD'9âõè4MS†axz¥‡è GˆN&³m[¦iª··7åíD'Y":˜>¢€,LÑ @–ˆN¦è KD'ÓGt%¢€é#:È’×£/":ÈÑ Àdñx\Žãhdd$åíD'Y":˜Ì²,†¡h4šòv¢€,LFt#D'“äÑ ÀdD'9Bt0Ñ @Žx=:C¡LÓT(r{S>Bt#^Îñ}/o# ôäH±DgMMÛ›ð¡ÑÑÑ”_':ÈR±D§ano ID'Yòztöôô$£3»½9H":Èš×£3'£³§§ÇíÍ@Ñ @Ö¼’T]]-Ã0dY–Û›€$¢€¬Ct†B!E"Åb1·7ID'Y+†è ‰Ä”ßCt%¢€oŒ–@0Ìx† Ñ @–ˆN¾ …’`—éO¢€,|£¦¦F†a¨¥¥%ã÷d‰èàšH$’|•ÓqœŒßKt¥bŒÎD"Á'Ùr*‘H$_åÌæq‘è KÅ‘HD555 Y}º Ù°,+ëW9%¢€¬[töôô$ŸX–åöæJD,“išS¾—sÑ @–Š-:%©©©)žœf È¥lÏ¢!:ÈR1Fg"‘Puuµ ÃPMMâñ¸Û›ð¢€,ctJ’ã8ÉW;ƒÁ ïïÑ @–Š5:%ɶm¢à ¢€,stJ×>màLG(šõgd©Ø£€l%‰ä‡ÑÍö,¢€,?ˆÅb ƒÉÏ0M“è J9:Çá“mÀ牄B¡P26 ÃP(šõÿ—è K¥‰DB5552 C­­­¼ï|êúମ®VOOONþ¿D'Y*Õèt'y-Ïñëy¶¶¶Êq·7 P@ñx\†a¨©©)§€$:ÈR©F§tíÕΖ–– §T¿P:¦z+E>ÞjAt¥RŽÎqñx\¡P(ùÊg¦÷òÄãqY–¥ÞÞ^9Ž3i2Iõýã“é¯ëñx<írS}¤¦uf‹ÅÒ.—éÉY"‘ÈË:ÝØ?™Öéµý“inìŸLëôÚþÉ´N7öO¦uzmÿLµÎBïéÚe²Æ§µµU¦i&Ïf)4¢€,ù!:¯gÛvÆ'`ŽãLzeôúÉ$Ór™ž¼Y–•v¹©ŽÍL·uü‰Zª±,+/û'Ó:ÝØ?™Öéµý“inìŸLëôÚþÉ´N7öO¦uzmÿLµÎBÖ9ÛënNÑ @–üS‰D"%ó,¯EÑItºñ;Ktot™¦©––Y–5å««ù@t%¢€é#:ÈÑ Àôd‰è`úˆN²Dt0}D'Y":˜>¢€,LÑ @–ˆN¦è KD'ÓGt%¢€é#:ÈÑ Àôd‰è`úˆN²Dt0}D'Y":˜>OE§ã8i'‘H¤].§].‹¥].‘Hd\g&±X,írñx|FëÌ´­n쟩ÖYèý3Õ:½¶2­Óý“i^Û?™ÖéÆþÉ´N¯íŸ|ßçùÑ™÷iܧåkÿð<Î?ÏãŠéß´×öO6ëÌôóBÁ¢süÎÄ0Œ´“iY˲Ò.—éÉã8×™‰iši—³,kFëœê‰L¡÷ÏTë,ôþ™j^Û?™ÖéÆþÉ´N¯íŸLëtcÿdZ§×öO¡îóLÓ”eYSÞ¯—¿FgoooÆÛ¹Oã>-_û‡çqþyWLÿ¦½¶2­Ó¶í ßÔÚÚ*Û¶3Æj®å5:‰„"‘ˆ‚Á  ÃPMMMÆïçΊ;+¢“;ó©Öéµ;s¯í7îóB¡PÆeK‰Ÿ¢Ó¶mµ¶¶ª¦¦†û´ã>Í÷i<ãßôTëôÚþ™é¿é@ q¹”—èŒÇ㨮Ÿ©^æxÏøéK===²,KMMMª®®žò¹Ô”zt& Ù¶­@ 0­'5ï? ײ,µ´´$ïã ùGãœGg"‘HùW†H$RЗpùç·?$–ztŽŸ™tý_ÁC¡ïŽ3”ºx<^ü§×¶´´È0 µ´´šàc–e•T°”ztŽŸúeš¦¯^ÁLÔÓÓ#Û¶söÿËKt& b|®§§G†qíýü‘HÄíÍɉRNɯ^&J$É·I655åä“o=uÉ@é°m;ù¾OÃ0ÔÚÚêúG¶Ï–¢ào±XlÂÛ-À¬ÿ 9ãè,ö'€ü‹Ç㸂Á`Q?~”Bt&‰¢>€üK$ …BÉÇïšššY…猢3‹©¦¦&§çùJ×ø{ý‹=<‹=:‰„‚Á ‚Á Û›(×_糦¦fÆï÷Ÿvtާaª®®.Ú'€ÂºþCæŠU1Gçxpfs :Æ9Ž£êêêYf;­èŒÇã‚“LG±‡N1Gçõ/æð^,›Õ‹ÓŠNþB ð³bN˲N€k²ŽÎëßHZ*}ÀtctŽ_{süú›ZVÑyýû@šššò½MxR1Fçø«œ|À-Ó:½6‰ð€ð­bŒNéÚ«¼-à–_§€\°m[@@ñxÜíM™R±F'¹‹ÅdšfV—Ñ$:®‰ÇãEõ7D'׌*z ˜ò{‰N€«Æ¯ßi†çßÂAtpÍõT7Õ«D'ÀU׿ÚiY–Û›“Ñ À7²}µ“踮©©)ëStÜDtð Û¶“8ŽÅbi¿/mtF"…B¡Œ  Ù>h¹­¢Óq555ɶmÏŸ® (n‰D"ùø …Ò~_Úè亜€BI$ª®®öü)¶Å¨V†; IDATã×å4 ÃíMøÀøÙJÁ`0í÷¤ŒÎë‹5›À`¶zzz<Ù”bˆÎñ÷×ðGc@!ds-è”ÑyýiN^@¡CtŽ?~G"·7Ii¢süÔœêêêBožåõè¼þãë§ú«3…’2:ÇÏËõò+…æõèìéé)škžü#etŽ¿¤¥¥¥À›€wy=:ù!€¥=½Ö²,NÍà:^NÇqdYð”´—Ly=:ð"¢à¡PH¦if¼À´›ˆN&³m[¦iª··7åíD'À3Æ?SÀ«aGt0Ùøg D£Ñ”·Ï :(>D' h¢P4ˆNŠÏŒ¢Óq9Ž£x<ž×àzDçìÄb19Ž£X,æö¦|dFÑ9~ai˲òºq\蜯ï?@i":EömY–%Û¶ÝÞ””ˆN&sG–ei`` åíD'Y":˜>¢€,LÑ @–ˆN¦è KD'ÓGt%¢€éK`2¯G'^Dt<#‹ÉqÅb1·7%%¢€Éâñ¸ÇÑÈÈHÊÛ‰N€gxýôP¢€É,Ë’aŠF£)o':žAtP|ˆN@Ñ :(>D' h¢P4ˆNŠÏŒ¢Ó4M™¦)Û¶óºq\èœP($Ó4 …ÜÞ€Ì(: Ãa²,+¯ÀõˆÎÙñúþ”&¢€!:˜>¢€,LÑ @–ˆN¦è KD'ÓGt%¢€éK–eɲ,9ŽSèíÀ³¼¶m˲,.yð””Ñ &óztàED'À3¼~z(Ñ Àd3ºN'n :(>D' h¢P4ˆNŠÑ (D'ÅgFÑÉ%Sn :g§Ø/™2œÒàp,í '†2.ŸiÙÑÑÑ´Ë%F‡Ó.—N»ÜèèhÆuÎôgê篙Qt†!Ã0dYV^7JM<×åË—UYY©Ã‡«¼¼\[·nÕǬýë_úðõiÓ&}öÙgÚ½{·Ž?®úúú¢„\#:gÇëûo*á¾ZlS-Ý©ÇêmÓèØhÚI·\K·©¸“v¹î®´Ëut¥]n îd\g¦mµzÛR.ÓÚݨp_ÈíCÓBt@]ºtI»wïÖ_ÞxCKùK-þùÏõÜÓOë/¯½ª­6hÓÚwôùú¿iׇêð§›ôõ¿6ªüý¿kÛ{ïêãwÞÑÇï®ÓŠ_ÔožxBþìgz}å ý}Ã?~<íw)‹ÅbrG±XæW‰ÜBtæ_ØéP \™rL»^ѸvÒ-Wªc #ír-ý—Ò.×Ò)íré·5®Ì¸­¦]Ÿr™&û‚zü÷o@q‹ÇãrG###)o':`š€Þ[·V?ð€^úíoõñš·uö‹Šœ=£á†àŒg0X§ÐÉã:¸éc½ûú*ýæ‰'´|Ù2mß¾]]]]nÿØÑY±ÑÁŒ±Vês5qÕíC9Gt@–vïÞ­ß,]ª•/½¤“Û·éj vV‘™ÍX§+´}ýßô›_þR+—/Wee¥Û»Á׈Îü#:‰N¥‡è€)œ8qBKZ¬/>üPÖ銼‡fº©Ù³K®y[+—/çþÙ%DgþD'€ÒS´Ñyº=¦…µ«lm3SàyñkNóƒüyÕ*­ûÓJõ¯v-6¿=Õ»¿Ô³K—jÇ矻½{|‡è̯p_HѺ)ß»YÊCtÂï^Úßåús]?ÎÂÚuª-Ÿ§2:MÓ”išžþ4Å·Y®œëçîM!Íû mÂ×~¾µCs×·ê§Ÿ^Nùýs×·º¾Ý3×ÜþòjttTKzH‡¹™éfïÇÿÒûë×»½«|ÅëÑ …dš¦B¡âüôS¢“è„¿l¹þ÷ú™»¾U?ßÚ1ákó>hÓÝ›BºããÔÏåïßÒQmËÇütSþ;RFg1xh›·h <¤£ÍßüCùé§—%I?Û£®«‰IßÞÒÊöëÛ=Ó9ÑêÍO–rattTÞ¿§^ÝL7_ò±¶oÞìö.ó ¯Gg±#:‰NøÛ©6oEçÒòNIšðÒ±–˜êÂCºÐןŽL|.ÿdy§ÂÎäçýÅ2líÈÛ±%:s4«wkhd,ùß«ze$4ïƒ6=¿÷Úis×·ê¥ý]z~o—‚]ñdtÎÿG»V±µøºWoç®oÕëG'~ÍKCt¢”=óë_«ëìY׃2ÛùÛë«T¾c‡Û»-'lÛ–eYž=Ó†èÌ/¢“è„¿y-:ËÖ6ËH裪ÞäŒiõñn=½+¬E¯½ÕïáÏ,­8ÕŸuOˆÎgv‡µì@ׄWD—–wêµCQOžñ8›ètG–ei` õÙDgŽfîúV Žé•׳½wX[jûõÌîpò•ÎF{Xýñ1E’¤•‡mýùX·GÆt©{XccÒk‡¢úÍ—aÅcºh+1&}RÝçúÏ÷í!:QªÊwîÔ¦µk\ÉéΓ>ª+W®¸½ûfÍëïI$:óËïÑÙÒIfW­Â}Åyz40[^ŒÎ-µýjïVÙÚf½r Kãcš»¾U ]q­:bëù½]“Z¯ KR2:C}#êèQ|L­W®-_Õ1¨þ¡1uö(6<æ¹ðœMtZ–%Ã0Ò^cœèÌáo‰éxK,yjíý[:’Ñy÷¿Ï‘žÿkÓÊö.ÚÃÚÝàhÉç–δÇtÞҾƫ*ö«lm³žßÛ¥îØ¨ë?Û·‡èD)rG¯¼ð¼ë9“©Þý¥Ö¯[çö.œ5¢Ó߈N¢þæÅè¼˵»K‡Žýû¹~ÙÚædtiОGek›õÊ^…„žû*¢Ä˜ôØç–þwODÒµHSò3`ºâZ}¼ÛõŸïú!:Sðbt>¿·KñʶúÕÔ}í/ãÑùêÁ¨bÃcÉïmïÖÊÃ¶ÆÆ$«DµC „‡´ë‚£öžáä/áý[:46&Ïý%„èD)ª¬¬Ô_^yÙõ€œÉô¯Ö£‹»½ gèô7¢“è„¿y1:ËÖ6«©{XÛýK¾mn<:/÷hÝ©+*[Û¬—öw)ì$ôIuŸFǤÚΡäsü÷Ïõ¨çº’N¶Æ´-ÐïúÏvý)x1:ËÖ6«hL’’¿|ãÑ9ïƒ6IOï 'Cråa[µCÚZ{í®<è¨<دò`¿Î´Ç4w}«¶Öö«¡+îúÏõí!:QŠv~þ¹6¯}Çõ€œéüú±Ç<û^Èlðóu:‰NøW£sÝ©ko_éK~m<:˃ŽÎ]ÔÜõ­:ti@a'¡'Ë;uuxL‹6¶kñ6Ký#Z¼ÍÒØ˜ôdy§~úéeõÄFõÌî°ë?ÛõCt¦àÕèü"دÑë^:zW8yn÷ÖÚ~%Ƥ±1idôÚû7ŸÙVÄIhlL²zø3K÷oéPS÷µóÂ[¯ {î²l-щҴjåJþt“ëñ8Óyýå—tìØ1·w㬠:‰Nø—W£sÞm“¾~óÊäø‡‚þ|k‡Ú{¯=o¹ö~ͲµÍ:ÚSâÚkQÚñªÊÖ6kSMŸ†FÆ46&ím¼êúÏõí)xt†!Ã0dYÖŒWœo^Îl~iS*{÷¦Ð¤¯"–‡èD)zâ¿Ðê—_r=g:·/X }ûö¹½g…蜯ï¿lD'ü˫љÍÜññäçòó>hK~žËøÌ]ßê¹·ÍÑ™B±Fg© щRôüï~§ß>ñ„ëñ8“é:wV·/X 3gθ½g% É4M…BÞ|ÒMtæÑIt¿Š9:Kaf¶mË4Mõöö¦¼èdf4D'JÑê7ÞгO<.£ü ×#rºóÎk¯ê·O>YôÑéuDgþù9:£q®Ó #:ÝÙDçTŠ::nlg\˜lh#:Q’V¿ñ†ÎîÜ¡§{TÁ¯÷¹’ÙÎßV®Ðö÷ÞÕ[|èÌ3¢3ÿˆN¢þuª-¦lhsý¹®_‡èLá¡mÚpö ãÂ<¶£“èDIÎÁ`žòWú|ý{®e¦ ÖiÅs¿Óž|¨á† ÑYDgþD'üëT[Líètý¹®_‡èLètoˆN”ªñèºÍkßÑŠç~§}?r=0¯ŸŽSúÇê¿èŧ~£êÝ_&¿NtæÑ™_=Q…z[ÔÜsÑõø#:Â#:Ý¢3¢Ó½!:Qª¾à Aµ;¦¿¿þººï>m{wÝ„È+䨕çthÓ&ýýõUúÍ£j÷¿_ݼ~ˆÎü#:ó+ÜRc´N¦]ïzü@áîNÁ£Óq9Ž£x<ž·ÏÑéÞ(U©¢s|®jõÕGÿÔŠçŸÓƒ÷Þ«·^yY_¼¿AU_–+jœÍyd¶?¦ã[·êóõÓ‹¿ùµð½»b…Îîü<í2Dgþy=:c±˜ÇQ,Vœ÷ÑD'Ñ #:Ý‚Gg1 :Ý¢¥*St^?±ú€Îìø\¿ý–V>ÿ¼žXü ~ùÐCzõŸÕšW_ÕÆ7W«üƒ÷UñÙvU|¶]çÊwªfÏ.]Øÿµ{÷¨j×—:³ósܾUǶnÖg{Oï¿ñºþòÒ‹ZýòKZüÓŸê·O<¡·_}U»>ü@æÁýY…*Ñ™^ÎbGtð7¢ÓÝ!:S :Ý¢¥*ÛèL5]çÎ*°wŽoݪòÞׯ7WëÿüY}ùe½þ‡ßkùï~«7þð½ú¿ÏjåóÏëÏ/þAo-{Eÿ\½Z›×¾£½?Ò™Ÿ«ñÐA ÔÕÎhJ!:½~z(Ñ™_~Îv§U­=Õ3úâê@©#:ÝÙD§eY2 CÑhêû/¢sš³x»åú5tÆç{ïµhå»àû ”£3êX ]ib®4ÉìªU_¬ÛíCRP³‰N/ Ñ™Dg~ù=:[ú/ÉìªU¸/äö¡(¸¡‘Aµ{à±Ï+s!\íö!q…[ѹòˆ­lhsý¹ýøÜ·ÙÎ!:Sp#:—ŒºþKøí¹ó“ËDgŽ´w_RsÄT[¸É÷s!T£3ëè…ÝŠ:Þý@±\#:ÝGtúÑéÏè¼:Ô¯Úö3j4»þøçö´†/êxÃWªo¯RM[…Û‡¦àÜŠÎ…Û]Nÿíqã…%¢3¢ó›!:g/Ò{YÁö]¹rÅ÷s9ܮʦêîîVww·Ž]øJW|rªÑé>¢Óßœ¡>…µ;­® ÑY±øUU5W¸þØç…é¾bë\Ó1uE»ÔÝÝ­ªæ“º®sûÑù͸±ˆÎˆN¢3WzlÚ®ý#ñû„#:ÓxxÒ×÷¶jT£nª¼#:ÝGt"6:èzü…166¦sÍG]ìóÊT]ªP»Õ2ákg.Vû•‹nª‚!:}–eɲ,9Ž3ãçÑItæÂØØ¨*›O¨³³“éìTUÓ)µv4«««kÂ4¶uúÒ!·WÞî#:gǶmY–%Û¶ÝÞ”ËWtvźl¿ èPÔõ¸$:¯¹ÔuAMí¦ë}^˜ ­ÛÎOzüíêêÒÁúK¸}¸ ‚èôYt†!Ã0dYÞ}/ÑItf+‘H(§¼Í¾Vmó9]¾|Ù÷ÓÒ~I§)‰¤œýuŸ)>2Tࣗ—.]Jùu¢Ó}Dçìx}ÿ]ïòåË)¿žèܶk»ÊÊÊ´èöEZ°pÖ¬_£hÜÖs/=¯ôÑÖzë½·§õÿ¹_­ÝmºÔÕœ\¦®¥^­ÝmÉÿ6;LYN§*ªÛ Dô§ÕÒš¿­QçÕpζµc C–’3ÔçґɽÛn»M?üð¤ûÛ®þÕ6U¹þØç…ilnPeãÉ´¿Mí¦N6îséæÞÕ«WuÛm·é‰'žP]ÝÄ÷¬Åñx\Žãhdd$åíDg¢3ßÁLtNí‘GÑ 7Ü Ûn»M¯¿þº:;;%I皎éâ¥F577û~Î^8¦Æ¶ iOý \ªTeëq—dnlÙ²E7Þx£n¾ùfýâ¿H>":1¢3wž~úi•••iþüùZ¶lY2>së>X§%/™ðµ¦È%5w5'£sü•ÎÖî6=±ô—z엿М9s´cßNEã¶æÌ™£z@K_¢z@Õ5ºã®ÿ§{ï»Wç›jsº½WW]>2¹õé§ŸêÆoÔ-·Ü¢Ç\UUU’¤6»QçÍJ×û¼0ÆU5žJûøÛjÑþÀç.ÉÜZ¿~½n¸áÍ›7OO=õ”€¤âŠÎ|?¿/¶èœ ÑY€è|§âZ¨}ï½–’‰Î5ŸŸÐ|P4³|ùrÍ;WeeeúÎw¾£… êwÞÑ™ÆÃºxñ"sñ¢NÖTs{“:::RNCs@ÛŽþÓõc™«¹å–[TVV¦²²2Ýzë­zä‘GŠ>:W/{E·Þz«~ò“Ÿäe-ZTùîw¿«ÿûÿ¯'ç?þã?ôôÓOkùòåžœ§žzJÏ>û¬V¬Xáú¿±©æ7ÞÐ~ð•••é†nТE‹´jÕªœGçk«^KžNûíùvtnþb‹V½ùºÂœÖ¢Û%£³Ê¬V4nëáÇQEM…Ö¬_£nþgN·5·U×Tçú±ÉçýíüùóµdÉ5Xçh¨qý±Ï cÔŸVmSeÚÇߎŽí;¿M#c#jkksýxæbÞ{ï½ ¿ ,ÐÒ¥K‹*:ÛÑ©e£y{•”èôˆbŠÎñåWïÖ}›;J":?>ÔáÇ‹fþú׿&ŸÜÜxãZ°`ÊËËu¢ák5440 :^»_[Í´ï7©¿t^»ÎlqýXæbvíÚ¥[o½5ù`wË-·hÅŠE}u™–,Y¢ßýîwE7Ï=÷\r}ôQÝ}÷Ý9{î¹''óŸÿùŸZ·nvìØáÉY·nÖ¬Y£7ºþïlªùÛßþ¦›o¾9y¿ü£ýHŸnùD=ñ+êŒY9‹¸õmÐÒg~=ák;öíÔž#{&Eçï—ý^‹n_¤%/Ñ’Ç—èW¿ùU2:ÃEã¶žþíÓ:|æpÞ¢³¥³Åõc“Ë)//OÞßÞpà ºå–[´jÕ*]è¨QUý9×û¼0FÝ)Õ\<›ñ=Ÿ{Îo–$E£Q×i.fÛ¶m“~/Þzë­¢‹ÎñåŸÝÉù+ŸD§Gct^ÿÿÉå_E܈Îb;½öŽ;îÐ÷¾÷=-\¸P_|ñEòëÆ¥ãª­;¯úúzßωó‡¼T«P(”rª/žUM蔋G1wÖ®]«ï|ç;š7ožV¯^­ÞÞ^Iœ^‹©qzmî<øàƒúîw¿«[o½U[¶l‘$…ûBjŒÖÉ´ësqÆCsæÌÑSŠêTí)-X¸@õmÁIÑùéÎÍZõæëŠÆm¿T«7Þz#]±®IÑùá¦ä<:KíôÚ5kÖL¸¿íë»ö~ÕË=-:S{ÒõÇ>/ŒQ{F§ë¦}ü½ÔzQ_>sùHæÖòåË“§×®[·.ù>þbÎ g¯äüÌF_D'—LÉotŽO®þ*BtfVYY©ÿøÇ*//Ÿt[£U«3Õ§T[[ëû©¨>¦ª†3i?èàtðˆš£\8‚¹å8Ž~úÓŸNxò3nºÑ¿TÇ© ×c“è,¯Gg±\2¥¡¡A·Ýv[26Çå#:£ñkŸ^{ç=wêæy×^YÅozíø{:ï»ÿ>Ý<ïfí9²'mt~y`—n«Œ Ñ™Æøýí_ÿú×I÷·ÝW#ª¨=âúcŸ¦ê|¥ŽÕ~öñ·îbN5pé(æ^WW—îºë.½÷Þ{œp[1GçøäêÌF_Dg1(…èÜp67!:3M{[o¬[ÇÏPuu5SS¥Õåjmm4-­ÍÚS³¹€G-¿R~}:ÑYþÁûºcÁݱ`Ο¯c[7>àõè,vùŠÎñ1;̬>mÖì0ÕáL}Šo‡cåüºŸ¥Rúû[I:^¿ÏýÇ>Ì‘ª½ºÐTŸò1øXÝ>…zš xÔò/§üz)DçõÝ0›3‰N(•èŸÙüU„蜣é„Μ=<­ÜÏsÄøZõçÕÒÒ2a*/œRUËI·UÞeWµšwÓMê3=³±Ø¢Ó¶m™¦™|ËÒ·Ó˜|Fçõë˜î/~¡÷C©Eg,îèÈù¯tæÌæÌí=÷¹š.]L~”{CÓí/±÷’¤“mtÆêºcÁýsõj…*Nh¸!¨Ë'¿T`ï=xï½zbñƒšwÓMjñ¸æÎ™£…óç«üý¿k¸!¨eÏ>£ÃŸnR¬. MkÞÖŸ^x^;6¬×£?ÿ™bõ]ØÿµΟ¯á† þüâ´íÝu*ÿïzkÙ+ŠÕØ»Gw,X æ£‡UVV–|å“èô¢3¿ˆNÿEgb4¡ÃçwëDÅ ×ÿ¼0ÎîVÀ¬QSS“Õ~©®~ï~¨g>”rtN÷ŒF¢Ó#J-:W±g|Þw¡÷C)F§$Ùýa­úZ_ÿÂ÷³çøçúâô'úêüß§”}t†ÏžVÍž]nj0X§ŠÏ¶kîœ9Šg5鍊ôÐ}÷é‰Åê‰ÅêÝ+´cÃz­[±<¹üÿÜu§j¿Ú£ùóæÉ®<§WžyZw,X\æ7>ªæ£‡õÐ}÷ùî=D§¿þ‹NéZxV4Ôžc;]üóÂ|yj³×ìVsWƒÛ‡¦àJ1:gúÙ-D§G”JtÎä/Dgþ8C}²NÆé”}5ìöá(¸l£Ó®<§…óç«õØQ 7Õ_[£ùóæ©áÀ×zéé§ut˧nêЦM*ÿï“¢sÓš·õà½÷ê…¥K5ÜÔοoÐ[Ë^ÑpCPÍGëíW— ;¢3ÿb£ƒ®ÇÑéûjØýÇ>ŒÕÛæöápE)EçLÎ^ô]t:Ž#ÇqÒ~²””Bt.-çäZ>D'Ó9½ö“·ßN¾ªy×¢Eɨ¬ýjþç®;õà½÷êŽ ÔrìˆvlX¯wW¬˜ðJiYY™NnßšŒØ¥KÑÏï¾[ónºIG·|Jtz4ì¼±XLŽã$¯yWŒˆNÿF'P Ñ9›³}㟤eYÞ=¼˜£sÙÁhN®ÏIt¹5ÝëtëÕz쨆‚õ¾¿TÛñcŠÕ¦§*’Ÿl;“!:óÏëÑéõý— ¢“è„st¾SqE‹·[9{~OtzD1FçêãÝ9ùËÑ äÇt£ÓkS ÑiÛ¶,Ë’mÛnoJJDgþD'ü«X£3Wg/st:Ž#˲Ò^›—è,@tæú/D'D'¦Bt柟£3·u5qÕíC¸¦Ø¢3×g/stN…è,@tæú/D'D'¦BtæÑIt¿Š):óýüžèôˆbŠÎ|Ñ äщ©ùGtð¯bŠÎ|ÑéD'Ñ äщ©ùå÷ëtð;¢“èô¢“èrèÄTˆÎü":‰NøÑé³è,D'Ñ äщ©x=:‹ÑItÂ߈N¢ÓsˆÎkó½÷ZˆN GˆN÷Åb19Ž£XÌ›÷1Dg~D'üèüf––‡‹*:ãñ¸ÇÑÈÈHÊÛ‰ÎiÌÊ#¶ë¿€ßž;?¹Lt9ò÷õëulËf×ãq¦ó—eËT__ïönœ¯ŸJtæ—ߣ“ëtÂïÜŠÎ;?¹ìúsúoÏÊ#vQE§eY2 CÑh4åíDç4çÙ=‘¼]g&ÁùNEá÷щRµ{÷nm|ó¯®ÇãLçñ‡R¿Û»qVˆN#:‰Nø›[ÑùN…wÂóÚô있+Ct¦àVt2D'JW]]Vüþ×ãq&Óuî¬~õ‹_¸½ gèô7¢“è„¿¹̵!:S :Ý¢¥jttTO/]ªžê*×#rº³ï_ÿÒ¦ýËí]8kD§¿ x)÷ÿ IDAT'†Ô¿¢Î˜åz@áîÑ™ÑéÞ(e§OŸÖ›¯½æzDNgbu=ø³Ÿ¹½ër‚èDltÐõø#:wîNÁ£Ó4M™¦)Û¶g¼â|#:Ý¢¥îý t|û6×c2Ûyýå—UWWçönË ¢svB¡LÓT(T¼ÑBtð/¢ÓÝ)xt†!Ã0dYÖŒWœoD§{CtÂ^|þyU}YîzPN5ï½¾J§Nžt{wå Ñ9;^ßÙ :‰NøÑéî)<»;¢ÕÇ»]?8~œû6w¨.<äö¯w«–/×þMŸ¸–©¦§ºJ¼ý¦Ž>ìönò¢3ÿü]CÙƒQ 'xŒ…?™Ñ¸îÛÌ KnÌêãÝZZÞ™·c[´ÑYyyP ?òÞ…\ý0ˤþ PŠ6ú©žyòWªÚõ¥ë¡9>Ûׯ×c<¬ÊÊJ·wïùççèŒÆm]M\uû®Zv êús]?ÎÂÚUÕ1˜·ãZ´Ñ …ÒÙÙ©U+Wê½ÕщÏÜy¯g×¹³úüý ZþòËÚºe‹Û»Ä·ˆÎü#:‰N¥‡è€,­}ç-yh±>^ûŽj÷ìQüB~CóÔçŸéW—é—?®­[·ª»»ÛíÝàkDg~9C} ;jwZ]?¢r‡è€iŠÅbÚ·oŸVüñúùÿü^{ám~÷]U|¶]—Ž’S{~FYÿõ^ß¶Uþòg=»t©~õÄúǨººÚíÿFtæW¸/¤Æhì:u t$§+Mi]C‘ ß{ýLu½ÏtËÍf]C‘ôËÅ£×It(U)£Ó²,Y–%Çq ½=Pt´sçN½õæ›zá¹çôðâõ«_<¦·_]+_zQyu™Ö,ÿ£6¾ùW½û§•zëµ×ôÆ+¯èøƒþ²b¹–,^¬_=þ¸^[¶LŸ|ò‰>¬ÎÎü½™3çõè´m[–eyú’g™„ûBº­W \9a¬uÇ»SN»Ó2éûÇçbw0írÝñî´ËÍfíNKÚ嬎ŒëìŽwëêÑ  ô¤ŒNÀìôôô¨©©Iuuuª¬¬TEE…Ž;¦cÇŽéÌ™3ª®®V0T[[›ó÷Æ}ä–×£³Ø…ûBjµ'ÍàpúËtõv§\¦ÕnœòÒ#é–›Í:{ÓŸ?8˸N(UD'À3B¡LÓT(äÍëLfÛ¶LÓToooÊÛ‰N€gxý=‰D'“Y–%Ã0¦¾´"Ñ ð ¢€âCtŠÑ @ñ!:Eƒè øÌ(:Ç‘ã8ŠÇãyÝ8®GtÎN,“ã8ŠÅÒò*¹6£è4 C†aȲ¬¼n×#:gÇëûPšˆN@Ñðú+uD'“Åãq9Ž£‘‘‘”·d‰è`úˆN²Dt0}D'Y":˜>¢€,L_Êè4MS¦iʶíBožåõè …B2MS¡PÈíM )et€É¼xÑ ð Û¶eY–gÏ´!:˜ÌqY–¥”·Ïðú{‰N&³,K†a(¦¼èxÑ @ñ!:Eƒè ø€¢AtP|ˆN@Ñ :(>3ŠNÃ0d†,ËÊëÆp=¢sv¼¾ÿ¥‰èP($Ó4 …ÜÞ””ˆN&³m[¦iþÿöîÿ9î»>ðøeJ¹™0Ôf&Ð$åËqW†)Óö2×–»¡w7å ÌAùRÊ5S.˜ƒ¤äR¸†’„– %„€Î&R¼Žì-[²×úXÒ~lÉþXk­µÒë~pµ±¢Õj%ïêóÙÝÇ#óþ!Z}ò~ë³ÑjŸ»ŸÏgcyy¹ãí¢z$:`ïD'ôHtÀÞ‰Nè‘耽Ð#Ñ {': G¢ö®ctæyyžG³Ù<èõ@i•=:FäyF£è¥@[Çè¶+{t@‰NJ£ì‡‡ŠNØ.MÓ¨T*Q¯×;Þ.:( Ñ ÃGt04D' Ñ ÀÐ0|D'CCtÀðÙWt¦iišFžç]ÜJtÞž,Ë"MÓȲ¬è¥0Fö•J%*•J¤i:ÐÅÀ­6£szzºè¥tTöè¬Õj¥ŽvFÓ¾¢sjjJtpàFäyÍf³è¥tTöèÜü£_­V‹^ c¤ÙlFžç±¶¶ÖñöŽÑ¹ùJóÌÌÌ ×CeX¢³R©½hëÓÓÓÏ€7({t.--µ£³Õj½ˆˆ.òJ)lUöèl6›í¿ß.@YtŒÎ<ÏÛ´ÆA¯ J©ìÑ111Ạ”JÇèlµZ155iš:<þÕ0DçÌÌLÌÌÌx§€ÒèÀvÃP6¢€ÂeYÕj5jµZÑKéJtÀëZ­Vûóµ»–):(ÜæçCOMM½”®D'¼naa¡}- nŸ±-:(T£ÑhÿÁʲ¬èåt%:àuÕjµýNg7¢€Bm~6ôÄÄDé/^':à¦,ËÚ//--uýÞž£³ÛÛ¥°·~D×0|ÄǰF§¿áôÛæ»œÕju×ïÝ5:[­V¤i:4OI’ Í»œÃKKKQ­VK®,Ãe³+•JOÑÕÓ;›O v;AöbóVÙÏåÜ4lÑyëŠ^#"Ïó¨V«=ÿMì):›ÍfLLLD¥Rª?¶”ß0½˜9lÑñú Ç“““]/g{Ñjµz>J©çs:o}µtvvvß‹€a5ŒÑyë ÇSSSCq3£eOW¯Ý¼Â ÃtGÃ[¯0èüNÚž¢³Õjµ?À{fff@K€rÖ茈¨Õjí‹6 Ó!Í ¿=Ng«ÕŠZ­6ˆµ0¢Z­ÖÐ\,¨›aŽÎˆ›nr^'{±´´tÛ§fì9:`/šÍfû(™aÿè­aNØ‹ÙÙÙ¾\@t00yžÇäädû|Âa?5Ct0šÍæ–Íœššº­S3ú½|8(£­Õjµ_ݯ-·f³éʶÄ–Œ§§§ËuxmžçíŸãëÖ?VÕjudþ&ŒrtV«Õ˜œœúC Ø¿™™™-/÷ëoB_£ó‹L’d$^Ù`oÒ4J¥µZm¤Þ=Õè\ZZÚò÷»Z­Fš¦®r 0f6ßDL’¤¯žëûáµY–EµZÝòÇkrrR|Œ‘V«5’WIÕ茈h4[Îß•ópØ›A4° eYÖ¾Za¥R‰¥¥¥¿·ÙlFžçG·WY[­ÖŽÛí¶³ƾæì¶ÖÝž`u[k·w†iÿt›³ˆýÓmβíŸÝæ<èý³ÛœeÛ?Ýæ,bÿt›³lû§×Ǽ4M#MÓH’$&''Ç2FF9:7åyÓÓÓ=E§Ç4ieÜ?žÇyWÆßéƒÞ?·Î¹°°išÆôôtLMMÅääd×íaàW¯m4»>1éôÊj/Ççy¾ãv•Je sn2ÖiìöD¤ÛZ»ýÚmβíŸns±ºÍY¶ý³Ûœ½v›³lû§ÛœEìŸns–mÿì÷1¯Z­vsCtnj6›±°°ÐõÿeiÓʸ<ó<®Œ¿Ó½v›ó F*ÅG¦x°ò`5¨ýãÁÊ´¢öϨ>A›˜˜ˆ$I"MÓ®G°ŒªqŠÎ^dYæ1ÍcZéöçqžÇ•ñwú ÷O§9“$‰Z­ ~½…RDç0và° ‡e jÿì6çAïŸÝæ,Ûþq(ÚàóFéB@·Ktnç1ÍcZÙöçqžÇ•ñwú ÷Ïæ¶eQŠè€a :`ïD'ôHtÀÞ‰Nè‘耽Ð#Ñ {': G¢öNt@D'ì耉NØ;Ñ =°w¢z$:`ïD'ôHtÀÞ‰Nè‘耽Ð#Ñ {': G¢³³F£yžwÍfsÇíZ­ÖŽÛåy¾ï9[­ÖŽÛ5›Í·k4]çì¶ÖýÎYÄþé6gÙöO·9‹Ø?Ýæ,ÛþÙm΃Þ?£ô;]¶ý³ÛœÝ~–ƒ": GãÝžÐDD$I•J¥ãHÓtÇíò<ßq»J¥²ï9»=yKÓtÇív»o»­u¿s±ºÍY¶ýÓmÎ"öO·9˶v›ó ÷Ï(ýN—mÿt›sii©ý}SSS1== »y¿‰NèÑ8Eg£ÑˆZ­Õju螀•í ªèEìŸÝæ<èý3J¿ÓeÛ?ûý®V«]çì'Ñ =‡èÌó¼ã“›nOjÊv¨YÙÅsx­Ãk‹Ø?»ÍyÐûg”~§Ë¶vû^ZZŠ4M#MÓ-ï333]çì'Ñ =õ蜞žÞš1==Y–•✠ú£—(ï'Ñ =õè̲¬}È•Ð_½¼ûº¢z4êÑq3<_­V«}>·S+öBt@Æ!:oF#&&&Ú§ZLMMÝö‘/¢z4 ÑéYvÓjµ¶\thjjê¶ÎУQˆÎ$Ibvv¶èe0Úá999¹ïðУaÎÙÙÙö“çnЋ͋ÌMLLˆN´aŽÎ[ƒó ?› €á—e™Ãkà ktn¾J-8(‚è€ ct6˜œœìÛ`¯D'ôh£³V«Ýö¹8p;D'ôh£3âæÕ]8€¢ˆNèѰF'ô[«ÕŠÙÙÙž^ÔÐ#Ñ 7MMME¥R‰jµºë÷ŠNè‘耛n½2únïvŠNè‘è€×U«ÕöÕÑ»Ð#Ñ ¯»õÝÎf³¹ã÷‰NèÑ0Dg£ÑˆZ­æãQ¸V«ÕŽÎ………¿Ot@†!:ÚO`Ц§§w=ÄVt@†!:“$‰J¥Rúu0ò<,Ë^ ý0 ѹù.gš¦E/"Bt@ÏÊyž·£3Ïó¢—!: gíV«èå@DˆNèYÙ£3MS tD'ô¨ìÑ™çy$I333E/ÚD'ô¨ìÑ e$: G¢¶Ëó<Ò4•••Ž·‹Nè‘è€í6¯)P¯×;Þ.: G¢¶Ð'¢¶Ð'¢¶Ð'¢¶Ð'eÎ$I¢R©”zŒÑ }":`»,Ë"I’X^^îx»è€‰NØ;Ñ =°w¢z$:`ïD'ôHtÀÞ‰Nè‘è€½У²G'”‘耉NØ®ÙlFžç±¶¶ÖñvÑ =°]š¦Q©T¢^¯w¼]t@D'l': OD'l': OD'l': OD'l': OʵZ-’$‰Z­VôR#¢ú¤ìÑ™$IT*•R¯€Ñ#: OD'ì耉NØ;Ñ =°w¢z$:`ïD'ôHtÀÞ‰NèQÙ£3˲HÓ4²,+z)Ð&: GeN(#Ñ =°]–e‘$I,//w¼]t@D'l—¦iT*•¨×ëoÐ#Ñ Û‰NèÑ Û‰NèÑ Û‰N蓲Gg£Ñˆ<Ï£Ñh½”}¹ÑZë7;Ž­Õ®ÛwÛv}}}ÇíZë7vÜ®µ~cÇíÖ×׻ιߟu·Ÿ lD'ôIÙ£3I’¨T*¥^c7óWj1›ÚqÌ_©uݾ۶Ý"pùú¥·[¾~iÇí®ßhts¿?ën?'@ÙˆNèÑ9x ×Ò¨.¼Üqœ¬¬™í8vÚ®ºðr¤¹·›¹zfÇíf®žÙq»´1×uÎnk=Y?Þq›3—NÆÒJç'me•çy¤i+++oÐ#Ñ9xù«1·2×q\l¤Qof;޶›[™‹Åf}ÇíWvÞnuaçíšõ®sv[ëÅFÚq›«k?ã`˜‰Nè‘è¼Æúõ®±6êãZëZÑw@߉Nè‘è<Ñ):Ñ#: G¢s°æ¯ÔâTýx$Ùk…ÇŸè„b|òÇ‹qèðYã€Ç=ß8/žÜ•ÏE'ôHt–茷_Ì6 ¯[Ç[œß}|nË×î|ø\¼ï[µx÷ßÕâ­ÎnÛæÍÈÚ1~ç[ƒ»r¶è€•=:‡èŒ·Ï•+:?òäňˆø¿¿ÐþÚó38>¿'›ñÏe[¾ÿŸ¼óy«ðuïw|ðñ¹Ý·¢z$:KtŠNÆ[Ù¢óÐ᳑­´â¯,·ÿ}um#îáR|ôóqï7ÏÇ¡Ãgãþ!Ï=[ÿõü¥-Ñù'?œO=³¸åÑŸüñbÌç­xtâJ¬oD»¸Ç.®Fu~5¾þÒR,5ÖÛÿÍ_Ì6â‰êÕÂ6Ñ %#:ëFk5–š—ãb#-<E'¼²FçW^¼WW7Ú_ÛŒÎ'§òxéÂõx냳ñ왕˜Ï[ñÇO^Œk76âÞožß{"‹W×â÷žHcc#⟼¿ó÷b©±òÃùÂ6Ñ %#:¯±~½ðøPŒ²F矋õˆïM½þÎäÔb3>ÿÓ,~÷ñ¹8¿|ó|ÎÕµ›çk:|6~v¶­›?×O_‹C‡ÏÆ·&¯ÄêÚFllD<}êZá?—è€*{tÖjµH’$jµáÑ):_eÎ^Æ»ÿ®Ö1VßñÈù-_{냳¥»€è€){t&I•J¥ÔkÜ茯aŽÎQ·Y–E’$±¼¼ÜñvÑ =ƒ7Îѹ¸ºÙõzÜh­}7@!DçðFçnD'ôHtÞ8Gg½™ÅµÖµ¢ï(Ì‹çñ¶‡ÎÅ=ß[xü‰N8x¢StÀ؃5¥§êÇ#É^+<þD'<Ñ):`ì•=:FäyF£è¥ì‹èŒ7Ñ):`ì•=:‡èŒ7Ñ):`ì‰ÎÁ÷èœ[™‹4¯E¾z¥è» !:‡7:Ó4J¥õz½ãí¢z$:kÜ£sæê™HÅü•ZÑwÅÛØØˆù«bþŠ1åBÌfãù8STtÞÿÂ¥¸ç›ç ÿœÌC‡ÏÆÛ:WXx‹N(Ñ9X¢s<£óÆÚjTf~§ç¦âtj¼pò騜ùyœZ¨}׸¢¢ó½^(<6ß8>ÿ\&:`‰ÎÁZZ©Çù¥³qvétá(:ÆÚú˜˜=—/_6._ŽWΉÚü¹¸téR¼xꙸ¸t®è»è@ey—óÖñ‘'çE'Œ#Ñ9xõë…ÇŸè<8¯Ìþ<æç£^¯ýxõìÑ8›žÞòµN<õ<-ún:0¢óõQÄ~PeÎ,Ë"MÓȲ¬è¥ìÛ ¢s±±SçOD}µ^x\ŠÎ›Î_:Óµ“1???öãôùñÚìͽ¸ÆOOûÙÏÆÜÜÖ'³Y>Õ3¯ÄùóçÇ~LÏžŠ—’v~ôÜTürú'Ý‹ýwéÒ¥xÏ{ÞõW‹‹‹[nÃÍf3ò<µµµŽ·‹Nè‘èìŸûî»/~ý×=îºë®xøá‡cuu5"ú_yø+q߇ïÛòµé…3qvñl;:7ß霽t.þÓGþ0>ô‡ÿ1î¸ãŽøîþ)êÍ,î¸ãŽøàï0îûð}ñÁßÿ`LœšŒwÿÛ÷Ä¿ÿ¿W§õu½×Z× ¾gúëk_ûZ¼ùÍoŽw¾ó[âóÂå³ñjR‰³gÏŽý8~êÕxùÔ‘¸xñbÇ1[›‰Wÿ±à{²¿¾ð…/įýÚ¯Å;ßùÎøâ¿ØŽÏaŠÎóÕѹ¢zôÛ¿ýÛñ™Ï|&zè¡]ÇßüÍßô<¾þõ¯÷e|îsŸ‹Ï}îsñ•¯|%¾÷½ï d<ùä“=ïÿû]Ç—¿üåøßø8tèP¼å-oiÇg¿£óÏ¿ðçíÃiß8ÞßþÞcñ…¿þ˘_Yˆ_V÷¾ëÞvt¾’LD½™Å|è?Ä‘É#ñÀƒÄß~ûoûºÖz3‹ÓµÓ»î»aO<ñDüæoþf:t(Þô¦7Å]wÝög'æ&ãØÉ‰8}úôØWNW§_êzøíÓÇõõõ¸xñbá÷i?Æ£>wÞyç–ÿ/>ûÙÏUt~è»ã¿>µo{èœèìè€ÍÎÎÆƒ>ØÓøÚ×¾6ñÕ¯~uÇñ©O}*>ýéOÇ<O<ñDÏãñÇïy<öØc}_úÒ—âmo{[;:ï¾ûî8üˆ¥æå¸ØHûq~ã¡øÈŸüç-_ûîþ)žzî©mÑùñO}<î}×½q߇ï‹û>|_üÑù£vtί,D½™ÅGÿûGã§¿úéÀ¢óÄ̉¾íã2ŒG}4Þþö··ãâ·~ë·â£ýhL]˜ˆÉ©—#I’±/1^=ýR\¸paÇñÏ“Åz¬Ç…  ¿Oû1yä‘-/FÜ}÷Ýñ‰O|bè¢ó¡£—ãËG.LJ¾{±ïï|ŠN ”†éðÚøÃñ–·¼%î¹çž8|øp\ºt)æ¯ÔâTýx$Ùk}‹¸Ê‰JÜqÇñÌ‹?‰új=^<öbÜ}ÏÝñÚ¹©mÑù÷ÿôíøÂ_ÿeÔ›Y¼zæX|ñK_lGçbcq[tþßo=Ò÷èµÃk~øáxó›ßwß}w|üãS§NEDÄlýt=ö‹˜ššûQ9ö«xéÄ Q«Õ:Ž3³Óñ/Õ(øžì¯ûï¿?Þô¦7Å=÷ÜŸþô§cvv6"†ëðÚ7®óþ.Åû¿=':w :`DÔjµH’$jµr_ý4I’xÇ;Þ‡ŽË—/·¿>ˆè¬7o^½ö½ÿî½ñö;o¾ã¶‹o¼zíæ9ïÿÀûãíw¾=žzî©£óûÏü îzÇ]Q9Q;h6›ñÞ÷¾7>ñ‰O´csÓbžÆ¯ª/ıcÇÆ~¼üêKqäø³;^hèÄÙjüüÔ ºûoyy9Þõ®wÅg>ó™8wîÜ–Û†9:7ǧ~RïË…‰D'ÀmZ^^ÞöµAEçæHæ’ž®6›Ì%1—ï~ˆï\žöýs?G):#bÛUk7­¯¯ÇóÇŸŽ‰‰ cb"ž}ù©89}"fgg·ŸO=³—NuÜÃêâÅ‹¿> ѹ9n÷|OÑ 0ƒŽÎ²ÅÕ…È®×ãFkµè»â@œY8??ú³¨T*c?^8úÓxiêHÌÌÌl?zõ;EßUf”¢ssì÷|Ïa‹Î<Ï#MÓXYYéx»èJaÜ£sæê™HÅü•rÝOÏÿç8zô¨qôh<óÒcêtuKpþôØ"]š-ún:0£½y±¡½žï9lÑ™¦iT*•¨×;ΰèJAtŽ_t6×Vãg¯þ(Ž9b9?:úÝ8yj*Μ9ÏWŸŽ3 å¿(X?jt>ttïïxŠN€ã«7ñ“‰Ä¿¼ðCã…Æ÷ùíøÅñŸFõÂÑ¢ïš7ŠÑù?~´¸¯s;E'À€4Ö¯¢óàµ6Ö"]ž5þuL/T‹¾K 1JÑùùç²ÛºŠ­èÑ9žÑ £û9StC#I’¨T*‘$Ã{˜èŒ¯aÎý^©VtCCt÷Œ»aÎOý¤~[ŸÉ9 Ñ™eY$IÒñ3˜#D'Œ Ñ9üãZëZÑwfØ¢óþ.ÝÖy›£»0"DçðÑÉ8¦èì÷;›¢ ¢sø‡èdœ StzˆN ”†=:—VêQ[ž‰³K§ ?Ñ OtŠN ä†=:ç¯ÔâTýx$Ùk…ǟ脃':E'PrF#òz¡ðÈ|ãøüsÙPEgš¦Q©T¢^ïüø%:€R÷蜹z&’Åc1¥Vô]…(*:?ÿ\6ð@ÙËø½ï¤¾D'0D§èd¼†èÆD¾z%æó¹8ŸÏ€¢žè×X¿^xü‰N(†è@ÉÕjµH’$jµáÑ):_¢St%—$IT*•H’¤è¥ì›èŒ/Ñ):€’Ã=æVæ"Ík‘¯^)ún€BL¦«…]¹uÜÇ—\Žûþ!Ø}+:`DˆÎá×Z׊¾  Pïþµ¸ç›ço{è\|÷µ«»_E'ŒÑ9üCt£HtÀˆöè¼ÑZ¥æå¸ØH ?Ñ Ð?¢FİGçü•Zœª“Ùñ˜[™kÅf}ÇH[\]Øò½·ŽÝâu§íngÎÅÕ…·kÖ»Î):Q%:`DdYišF–eE/e_6£³:ÿò–±dÆÌÕ3Û¾s$Ùk]£s§íngΙ«gºFn·9E'0ªD'P óWjqîÒ阽”l××Vbc‡–Ù¶ïß—Ïï¸ÝFlì¸Ýí̹ÜÈvÜîúÚJ×97b£è»` D'P 7Z«qýFcÛX__ßq›ÖúŽÛ\¿Ñˆ­Õ®óí´ÝíÌÙZ¿±ãvëëë]çVY–E’$±¼¼ÜñvÑ À¾¥i•J%êõzÇÛE'û&:Ñ ÀÀˆNF#ò2€"ˆNµZ-*•J$IRôR#¢ÆÄæýjµZôR#Íf3ò<ëׯw¼]tÀˆØŒÎJ¥RôR MtÀˆÈ²¬­V«èå@DˆNF£yž½ˆÑ #e3:Ó4-z)¢FJ’$‘$I,--½ˆÑ À‰Nö¬ÕjÅÔÔTÔjµh6›;~Ÿè`Ïn½jºè ¯¦¦¦¢R©D’$]¿Ot°'yž·ßå̲¬ë÷ŠNödó]Îjµºë÷ŠNQyž·?BúåÖs9w{—3BtÀÈJÓ´ý¤ÀçvÐ/Y–ÅÄÄDÏ/jŠNa›‡?MNNF«Õ*z9Œˆf³F£§ï0ÂFûÝΩ©)á À0ân=Ìvvv¶èå0fD'Œ™™™¨T*111Ñõ¼ ßD'Œ‰$Iz>ÿ"n^ ýv‰N¶YXXèË©¢€¶V«³³³íëÜî©¢pž'qópÚjµÚ×+Ÿ‹N ¦¦¦¢Z­ÆÒÒRÑK  µZ­›•J%fffúòQ[¢ÆÜÒÒÒ–'I’D–eE/ €–çyT*•¨V«}¹€Ð&Ñ ÄÒÒҖé*•JLNNF­V+zi ,Ëúòîæ­D'ЖeÙ–øœ™™Ùñ{[­Vߟ˜ÐF#ò<<Ïcyy9Ò4$I"I’_‹è¶i4133ÓõÏÍðvÝtÛ®Û!]išî¸ÝnO¤ö»Ö$IvÜ.MÓìŸns±ºÍY¶ýÓmÎ"öO·9˶ºÍYÄþé6gÙöÏnsôþÙm΃¾xœèöeuu5êõúŽ£›nÛ­­­í¸ÝÊÊÊŽÛ-//ï{În–——wÜneeeÇíÖÖÖ2gû§ÛœeÛ?Ýæ,bÿt›³lû§ÛœEìŸns–mÿì6çAïŸæ\^^Žk×®Åúúz×mûMt00¢€ Œè``D'óÿiù$Bǘ¥IEND®B`‚././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1633684670.0 python_vlc-3.0.21203/examples/video_sync/main.py0000644000175200017520000003461014130006276021420 0ustar00oaubertoaubert#! /usr/bin/env python3 # # PyQt5-based video-sync example for VLC Python bindings # Copyright (C) 2009-2010 the VideoLAN team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # """ A VLC python bindings player implemented with PyQt5 that is meant to be utilized as the "master" player that controls all "slave players". Author: Saveliy Yusufov, Columbia University, sy2685@columbia.edu Date: 25 January 2019 """ import platform import queue import os import subprocess import sys from PyQt5 import QtWidgets, QtGui, QtCore import vlc from network import Server class Player(QtWidgets.QMainWindow): """A "master" Media Player using VLC and Qt """ def __init__(self, master=None): QtWidgets.QMainWindow.__init__(self, master) self.setWindowTitle("Main Media Player") # Create a basic vlc instance self.instance = vlc.Instance() self.media = None # Create an empty vlc media player self.mediaplayer = self.instance.media_player_new() self.create_ui() self.data_queue = queue.Queue() self.is_paused = False self.timer = QtCore.QTimer(self) self.timer.setInterval(100) self.timer.timeout.connect(self.update_ui) self.timer.timeout.connect(self.update_time_label) def create_ui(self): """Set up the user interface, signals & slots """ self.widget = QtWidgets.QWidget(self) self.setCentralWidget(self.widget) # In this widget, the video will be drawn if platform.system() == "Darwin": # for MacOS self.videoframe = QtWidgets.QMacCocoaViewContainer(0) else: self.videoframe = QtWidgets.QFrame() self.palette = self.videoframe.palette() self.palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) # Create the time display self.timelabel = QtWidgets.QLabel("00:00:00", self) # Create the position slider (QSlider) self.positionslider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self) self.positionslider.setToolTip("Position") self.positionslider.setMaximum(1000) self.positionslider.sliderMoved.connect(self.set_position) # self.positionslider.sliderPressed.connect(self.set_position) self.positionslider.sliderMoved.connect(self.update_time_label) # Create the "previous frame" button self.previousframe = QtWidgets.QPushButton() self.previousframe.setFixedWidth(25) self.previousframe.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSkipBackward)) self.previousframe.clicked.connect(self.on_previous_frame) # Create the play button and connect it to the play/pause function self.playbutton = QtWidgets.QPushButton() self.playbutton.setFixedWidth(40) self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPlay)) self.playbutton.clicked.connect(self.play_pause) # Create the "next frame" button self.nextframe = QtWidgets.QPushButton() self.nextframe.setFixedWidth(25) self.nextframe.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSkipForward)) self.nextframe.clicked.connect(self.on_next_frame) # Create the "Playback rate" label self.pb_rate_label = QtWidgets.QLabel("Playback rate: {}x".format(self.mediaplayer.get_rate()), self) # Create the "decrease playback rate" button self.decr_pb_rate = QtWidgets.QPushButton() self.decr_pb_rate.setFixedWidth(30) self.decr_pb_rate.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSeekBackward)) self.decr_pb_rate.clicked.connect(self.decr_mov_play_rate) # Create the stop button and connect it to the stop function self.stopbutton = QtWidgets.QPushButton() self.stopbutton.setFixedWidth(30) self.stopbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaStop)) self.stopbutton.clicked.connect(self.stop) # Create the "increase playback rate" button self.incr_pb_rate = QtWidgets.QPushButton() self.incr_pb_rate.setFixedWidth(30) self.incr_pb_rate.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSeekForward)) self.incr_pb_rate.clicked.connect(self.incr_mov_play_rate) self.top_control_box = QtWidgets.QHBoxLayout() # Add the time and position slider to the 1st controls layout self.top_control_box.addWidget(self.timelabel) self.top_control_box.addWidget(self.positionslider) self.bottom_control_box = QtWidgets.QHBoxLayout() # Add the buttons to the 2nd controls layout self.bottom_control_box.addWidget(self.previousframe) self.bottom_control_box.addWidget(self.playbutton) self.bottom_control_box.addWidget(self.nextframe) self.bottom_control_box.addWidget(self.pb_rate_label) self.bottom_control_box.addWidget(self.decr_pb_rate) self.bottom_control_box.addWidget(self.stopbutton) self.bottom_control_box.addWidget(self.incr_pb_rate) self.vboxlayout = QtWidgets.QVBoxLayout() self.vboxlayout.addWidget(self.videoframe) self.vboxlayout.addLayout(self.top_control_box) self.vboxlayout.addLayout(self.bottom_control_box) self.widget.setLayout(self.vboxlayout) menu_bar = self.menuBar() # File menu file_menu = menu_bar.addMenu("File") # Create submenu to start new processes from file menu new_menu = QtWidgets.QMenu("Launch", self) file_menu.addMenu(new_menu) new_video_action = QtWidgets.QAction("New Video", self) new_menu.addAction(new_video_action) new_video_action.triggered.connect(on_new_video) # Create actions to load a new media file and to close the app open_action = QtWidgets.QAction("Load Video", self) close_action = QtWidgets.QAction("Close App", self) file_menu.addAction(open_action) file_menu.addAction(close_action) open_action.triggered.connect(self.open_file) close_action.triggered.connect(sys.exit) def play_pause(self): """Toggle play/pause status """ if self.mediaplayer.is_playing(): signal = 'p' self.mediaplayer.pause() self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPlay)) self.is_paused = True self.timer.stop() else: if self.mediaplayer.play() == -1: self.open_file() return signal = 'P' self.mediaplayer.play() self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPause)) self.timer.start() self.is_paused = False # Reset the queue & send the appropriate signal, i.e., play/pause self.data_queue.queue.clear() self.data_queue.put('d') self.data_queue.put(signal) def stop(self): """Stop player """ self.mediaplayer.stop() self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPlay)) # Reset the time label back to 00:00:00 time = QtCore.QTime(0, 0, 0, 0) self.timelabel.setText(time.toString()) # Reset the queue self.data_queue.queue.clear() self.data_queue.put('d') self.data_queue.put('S') # Reset the media position slider self.positionslider.setValue(0) self.timer.stop() def on_next_frame(self): """Go forward one frame. The Python VLC binding next_frame function causes a: "direct3d11 vout display error: SetThumbNailClip failed" error when next_frame is called while the video is playing, so we are using our own fucntion to get the next frame. """ # self.mediaplayer.next_frame() next_frame_time = self.mediaplayer.get_time() + self.mspf() # Reset the queue & put the next frame's time into the queue self.data_queue.queue.clear() self.data_queue.put('d') self.data_queue.put(next_frame_time) self.update_time_label() self.mediaplayer.set_time(next_frame_time) def on_previous_frame(self): """Go backward one frame""" next_frame_time = self.mediaplayer.get_time() - self.mspf() # Reset the queue & put the next frame's time into the queue self.data_queue.queue.clear() self.data_queue.put('d') self.data_queue.put(next_frame_time) self.update_time_label() self.mediaplayer.set_time(next_frame_time) def mspf(self): """Milliseconds per frame""" return int(1000 // (self.mediaplayer.get_fps() or 25)) def incr_mov_play_rate(self): """Increase the movie play rate by a factor of 2.""" if self.mediaplayer.get_rate() >= 64: return rate = self.mediaplayer.get_rate() * 2 result = self.mediaplayer.set_rate(rate) if result == 0: self.data_queue.queue.clear() self.data_queue.put('d') self.data_queue.put('>') self.update_pb_rate_label() def decr_mov_play_rate(self): """Decrease the movie play rate by a factor of 2.""" if self.mediaplayer.get_rate() <= 0.125: return rate = self.mediaplayer.get_rate() * 0.5 result = self.mediaplayer.set_rate(rate) if result == 0: self.data_queue.queue.clear() self.data_queue.put('d') self.data_queue.put('<') self.update_pb_rate_label() def open_file(self): """Open a media file in a MediaPlayer """ dialog_txt = "Choose Media File" filename = QtWidgets.QFileDialog.getOpenFileName(self, dialog_txt, os.path.expanduser('~')) if not filename[0]: return # getOpenFileName returns a tuple, so use only the actual file name self.media = self.instance.media_new(filename[0]) # Put the media in the media player self.mediaplayer.set_media(self.media) # Parse the metadata of the file self.media.parse() # Set the title of the track as window title self.setWindowTitle("Main Media Player: {}".format(self.media.get_meta(0))) # The media player has to be 'connected' to the QFrame (otherwise the # video would be displayed in it's own window). This is platform # specific, so we must give the ID of the QFrame (or similar object) to # vlc. Different platforms have different functions for this. if platform.system() == "Linux": # for Linux using the X Server self.mediaplayer.set_xwindow(int(self.videoframe.winId())) elif platform.system() == "Windows": # for Windows self.mediaplayer.set_hwnd(int(self.videoframe.winId())) elif platform.system() == "Darwin": # for MacOS self.mediaplayer.set_nsobject(int(self.videoframe.winId())) self.play_pause() def set_position(self): """Set the movie position according to the position slider. The vlc MediaPlayer needs a float value between 0 and 1, Qt uses integer variables, so you need a factor; the higher the factor, the more precise are the results (1000 should suffice). """ # Set the media position to where the slider was dragged self.timer.stop() pos = self.positionslider.value() if pos >= 0: self.data_queue.queue.clear() self.data_queue.put('d') current_time = self.mediaplayer.get_time() # If the player is stopped, do not attempt to send a -1!!! if current_time == -1: self.timer.start() return self.data_queue.put(current_time) self.mediaplayer.set_position(pos * .001) self.timer.start() def update_ui(self): """Updates the user interface""" # Set the slider's position to its corresponding media position # Note that the setValue function only takes values of type int, # so we must first convert the corresponding media position. media_pos = int(self.mediaplayer.get_position() * 1000) self.positionslider.setValue(media_pos) if media_pos >= 0 and self.mediaplayer.is_playing(): current_time = self.mediaplayer.get_time() self.data_queue.put(current_time) else: self.data_queue.queue.clear() # No need to call this function if nothing is played if not self.mediaplayer.is_playing(): self.timer.stop() # After the video finished, the play button stills shows "Pause", # which is not the desired behavior of a media player. # This fixes that "bug". if not self.is_paused: self.stop() def update_time_label(self): mtime = QtCore.QTime(0, 0, 0, 0) self.time = mtime.addMSecs(self.mediaplayer.get_time()) self.timelabel.setText(self.time.toString()) def update_pb_rate_label(self): self.pb_rate_label.setText("Playback rate: {}x".format(str(self.mediaplayer.get_rate()))) def on_new_video(): """Launches a new PyQt5-based "mini" media player """ if platform.system() == "Windows": subprocess.Popen(["python", "mini_player.py"], shell=True) else: subprocess.Popen(["python", "mini_player.py"]) def main(): """Entry point for our simple vlc player """ app = QtWidgets.QApplication(sys.argv) player = Player() _ = Server("localhost", 10000, player.data_queue) player.show() player.resize(640, 480) sys.exit(app.exec_()) if __name__ == "__main__": main() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1633684678.0 python_vlc-3.0.21203/examples/video_sync/mini_player.py0000644000175200017520000001254014130006306022774 0ustar00oaubertoaubert#! /usr/bin/env python3 # # PyQt5-based video-sync example for VLC Python bindings # Copyright (C) 2009-2010 the VideoLAN team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # """ This module contains a bare-bones VLC player class to play videos. Author: Saveliy Yusufov, Columbia University, sy2685@columbia.edu Date: 25 January 2019 """ import os import sys import queue import platform from PyQt5 import QtWidgets, QtGui, QtCore import vlc from network import Client class MiniPlayer(QtWidgets.QMainWindow): """Stripped-down PyQt5-based media player class to sync with "master" video. """ def __init__(self, data_queue, master=None): QtWidgets.QMainWindow.__init__(self, master) self.setWindowTitle("Mini Player") self.statusbar = self.statusBar() self.statusbar.showMessage("Ready") # Create a basic vlc instance self.instance = vlc.Instance() self.media = None # Create an empty vlc media player self.mediaplayer = self.instance.media_player_new() self.init_ui() self.open_file() self.timer = QtCore.QTimer(self) self.timer.setInterval(10) self.timer.timeout.connect(self.update_ui) self.data_queue = data_queue self.timer.start() def init_ui(self): """Set up the user interface """ self.widget = QtWidgets.QWidget(self) self.setCentralWidget(self.widget) # In this widget, the video will be drawn if platform.system() == "Darwin": # for MacOS self.videoframe = QtWidgets.QMacCocoaViewContainer(0) else: self.videoframe = QtWidgets.QFrame() self.palette = self.videoframe.palette() self.palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 0)) self.videoframe.setPalette(self.palette) self.videoframe.setAutoFillBackground(True) self.vboxlayout = QtWidgets.QVBoxLayout() self.vboxlayout.addWidget(self.videoframe) self.widget.setLayout(self.vboxlayout) def open_file(self): """Open a media file in a MediaPlayer """ dialog_txt = "Choose Media File" filename = QtWidgets.QFileDialog.getOpenFileName(self, dialog_txt, os.path.expanduser('~')) if not filename[0]: return # getOpenFileName returns a tuple, so use only the actual file name self.media = self.instance.media_new(filename[0]) # Put the media in the media player self.mediaplayer.set_media(self.media) # Parse the metadata of the file self.media.parse() # Set the title of the track as the window title self.setWindowTitle("{}".format(self.media.get_meta(0))) # The media player has to be 'connected' to the QFrame (otherwise the # video would be displayed in it's own window). This is platform # specific, so we must give the ID of the QFrame (or similar object) to # vlc. Different platforms have different functions for this if platform.system() == "Linux": # for Linux using the X Server self.mediaplayer.set_xwindow(int(self.videoframe.winId())) elif platform.system() == "Windows": # for Windows self.mediaplayer.set_hwnd(int(self.videoframe.winId())) elif platform.system() == "Darwin": # for MacOS self.mediaplayer.set_nsobject(int(self.videoframe.winId())) # Start playing the video as soon as it loads self.mediaplayer.play() def update_ui(self): self.update_statusbar() try: val = self.data_queue.get(block=False) except queue.Empty: return if val == '<': self.mediaplayer.set_rate(self.mediaplayer.get_rate() * 0.5) return if val == '>': self.mediaplayer.set_rate(self.mediaplayer.get_rate() * 2) return if val == 'P': self.mediaplayer.play() return if val == 'p': self.mediaplayer.pause() return if val == 'S': self.mediaplayer.stop() return val = int(val) if val != self.mediaplayer.get_time(): self.mediaplayer.set_time(val) def update_statusbar(self): mtime = QtCore.QTime(0, 0, 0, 0) time = mtime.addMSecs(self.mediaplayer.get_time()) self.statusbar.showMessage(time.toString()) def main(): """Entry point for our simple vlc player """ app = QtWidgets.QApplication(sys.argv) data_queue = queue.Queue() player = MiniPlayer(data_queue) player.show() player.resize(480, 480) _ = Client("localhost", 10000, data_queue) sys.exit(app.exec_()) if __name__ == "__main__": main() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1633684689.0 python_vlc-3.0.21203/examples/video_sync/network.py0000644000175200017520000001376014130006321022157 0ustar00oaubertoaubert# # PyQt5-based video-sync example for VLC Python bindings # Copyright (C) 2009-2010 the VideoLAN team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # """ The client/server classes that keep multiple VLC python bindings players synchronized. Author: Saveliy Yusufov, Columbia University, sy2685@columbia.edu Date: 25 January 2019 """ import os import platform import socket import sys import struct import threading import logging from concurrent import futures logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) logger.setLevel(logging.DEBUG) # create console handler and set level to debug ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) # create formatter formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) class Server: """Data sender server""" def __init__(self, host, port, data_queue): if platform.system() == "Windows": # Create a TCP/IP socket self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Bind the socket to the port logger.info("Server started on %s port %s", host, port) self.sock.bind((host, port)) else: server_address = "./uds_socket" # Make sure the socket does not already exist try: os.unlink(server_address) except OSError: if os.path.exists(server_address): raise # Create a UDS socket self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) # Bind the socket to the address logger.info("Server starting up on %s", server_address) self.sock.bind(server_address) # Listen for incoming connections self.sock.listen(5) self.clients = set() self.data_queue = data_queue listener_thread = threading.Thread(target=self.listen_for_clients, args=()) listener_thread.daemon = True listener_thread.start() def listen_for_clients(self): logger.info("Now listening for clients") t = threading.Thread(target=self.data_sender, args=()) t.daemon = True t.start() while True: client, _ = self.sock.accept() logger.info("Accepted Connection from: %s", client) self.clients.add(client) def data_sender(self): while True: data = self.data_queue.get() data = str(data).encode() msg = struct.pack(">I", len(data)) + data with futures.ThreadPoolExecutor(max_workers=5) as ex: for client in self.clients: ex.submit(self.sendall, client, msg) def sendall(self, client, data): """Wraps socket module's `sendall` function""" try: client.sendall(data) except socket.error: logger.exception("Connection to client: %s was broken!", client) client.close() self.clients.remove(client) class Client: """Data receiver client""" def __init__(self, address, port, data_queue): self.data_queue = data_queue if platform.system() == "Windows": # Create a TCP/IP socket self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the socket to the port where the server is listening logger.info("Connecting to %s port %s", address, port) self.sock.connect((address, port)) else: # Create a UDS socket self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) # Connect the socket to the port where the server is listening server_address = "./uds_socket" logger.info("New client connecting to %s", server_address) try: self.sock.connect(server_address) except socket.error: logger.exception() sys.exit(1) thread = threading.Thread(target=self.data_receiver, args=()) thread.daemon = True thread.start() def recv_all(self, size): """Helper function to recv `size` number of bytes, or return False""" data = bytearray() while (len(data) < size): packet = self.sock.recv(size - len(data)) if not packet: return False data.extend(packet) return data def recv_msg(self): """Receive the message size, n, and receive n bytes into a buffer""" raw_msg_size = self.recv_all(4) if not raw_msg_size: return False msg_size = struct.unpack(">I", raw_msg_size)[0] return self.recv_all(msg_size) def data_receiver(self): """Handles receiving, parsing, and queueing data""" logger.info("New data receiver thread started.") try: while True: raw_data = self.recv_msg() if raw_data: data = raw_data.decode() if 'd' in set(data): self.data_queue.queue.clear() continue else: self.data_queue.put(data) except: logger.exception("Closing socket: %s", self.sock) self.sock.close() return ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1633684510.0 python_vlc-3.0.21203/examples/wxvlc.py0000755000175200017520000002567014130006036017500 0ustar00oaubertoaubert#! /usr/bin/env python3 # -*- coding: utf-8 -*- # # # WX example for VLC Python bindings # Copyright (C) 2009-2010 the VideoLAN team # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. # """ A simple example for VLC python bindings using wxPython. Author: Michele Orrù Date: 23-11-2010 """ # Tested with Python 3.7.4, wxPython 4.0.6 on macOS 10.13.6 only. __version__ = '19.07.28' # mrJean1 at Gmail dot com # import external libraries import wx # 2.8 ... 4.0.6 import vlc # import standard libraries from os.path import basename, expanduser, isfile, join as joined import sys try: unicode # Python 2 except NameError: unicode = str # Python 3 class Player(wx.Frame): """The main window has to deal with events. """ def __init__(self, title='', video=''): wx.Frame.__init__(self, None, -1, title=title or 'wxVLC', pos=wx.DefaultPosition, size=(550, 500)) self.video = video # Menu Bar # File Menu self.frame_menubar = wx.MenuBar() self.file_menu = wx.Menu() self.file_menu.Append(1, "&Open...", "Open from file...") self.file_menu.AppendSeparator() self.file_menu.Append(2, "&Close", "Quit") self.Bind(wx.EVT_MENU, self.OnOpen, id=1) self.Bind(wx.EVT_MENU, self.OnExit, id=2) self.frame_menubar.Append(self.file_menu, "File") self.SetMenuBar(self.frame_menubar) # Panels # The first panel holds the video and it's all black self.videopanel = wx.Panel(self, -1) self.videopanel.SetBackgroundColour(wx.BLACK) # The second panel holds controls ctrlpanel = wx.Panel(self, -1) self.timeslider = wx.Slider(ctrlpanel, -1, 0, 0, 1000) self.timeslider.SetRange(0, 1000) self.pause = wx.Button(ctrlpanel, label="Pause") self.pause.Disable() self.play = wx.Button(ctrlpanel, label="Play") self.stop = wx.Button(ctrlpanel, label="Stop") self.stop.Disable() self.mute = wx.Button(ctrlpanel, label="Mute") self.volslider = wx.Slider(ctrlpanel, -1, 0, 0, 100, size=(100, -1)) # Bind controls to events self.Bind(wx.EVT_BUTTON, self.OnPlay, self.play) self.Bind(wx.EVT_BUTTON, self.OnPause, self.pause) self.Bind(wx.EVT_BUTTON, self.OnStop, self.stop) self.Bind(wx.EVT_BUTTON, self.OnMute, self.mute) self.Bind(wx.EVT_SLIDER, self.OnVolume, self.volslider) # Give a pretty layout to the controls ctrlbox = wx.BoxSizer(wx.VERTICAL) box1 = wx.BoxSizer(wx.HORIZONTAL) box2 = wx.BoxSizer(wx.HORIZONTAL) # box1 contains the timeslider box1.Add(self.timeslider, 1) # box2 contains some buttons and the volume controls box2.Add(self.play, flag=wx.RIGHT, border=5) box2.Add(self.pause) box2.Add(self.stop) box2.Add((-1, -1), 1) box2.Add(self.mute) box2.Add(self.volslider, flag=wx.TOP | wx.LEFT, border=5) # Merge box1 and box2 to the ctrlsizer ctrlbox.Add(box1, flag=wx.EXPAND | wx.BOTTOM, border=10) ctrlbox.Add(box2, 1, wx.EXPAND) ctrlpanel.SetSizer(ctrlbox) # Put everything togheter sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.videopanel, 1, flag=wx.EXPAND) sizer.Add(ctrlpanel, flag=wx.EXPAND | wx.BOTTOM | wx.TOP, border=10) self.SetSizer(sizer) self.SetMinSize((350, 300)) # finally create the timer, which updates the timeslider self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer) # VLC player controls self.Instance = vlc.Instance() self.player = self.Instance.media_player_new() def OnExit(self, evt): """Closes the window. """ self.Close() def OnOpen(self, evt): """Pop up a new dialow window to choose a file, then play the selected file. """ # if a file is already running, then stop it. self.OnStop(None) video = self.video if video: self.video = '' else: # Create a file dialog opened in the current home directory, # to show all kind of files, having as title "Choose a ...". dlg = wx.FileDialog(self, "Choose a video file", expanduser('~'), "", "*.*", wx.FD_OPEN) # XXX wx.OPEN if dlg.ShowModal() == wx.ID_OK: video = joined(dlg.GetDirectory(), dlg.GetFilename()) # finally destroy the dialog dlg.Destroy() if isfile(video): # Creation self.Media = self.Instance.media_new(unicode(video)) self.player.set_media(self.Media) # Report the title of the file chosen title = self.player.get_title() # if an error was encountred while retrieving the title, # otherwise use filename self.SetTitle("%s - %s" % (title if title != -1 else 'wxVLC', basename(video))) # set the window id where to render VLC's video output handle = self.videopanel.GetHandle() if sys.platform.startswith('linux'): # for Linux using the X Server self.player.set_xwindow(handle) elif sys.platform == "win32": # for Windows self.player.set_hwnd(handle) elif sys.platform == "darwin": # for MacOS self.player.set_nsobject(handle) self.OnPlay(None) # set the volume slider to the current volume self.volslider.SetValue(self.player.audio_get_volume() / 2) def OnPlay(self, evt): """Toggle the status to Play/Pause. If no file is loaded, open the dialog window. """ # check if there is a file to play, otherwise open a # wx.FileDialog to select a file if not self.player.get_media(): self.OnOpen(None) # Try to launch the media, if this fails display an error message elif self.player.play(): # == -1: self.errorDialog("Unable to play.") else: # adjust window to video aspect ratio # w, h = self.player.video_get_size() # if h > 0 and w > 0: # often (0, 0) # self.videopanel.... self.timer.Start(1000) # XXX millisecs self.play.Disable() self.pause.Enable() self.stop.Enable() def OnPause(self, evt): """Pause the player. """ if self.player.is_playing(): self.play.Enable() self.pause.Disable() else: self.play.Disable() self.pause.Enable() self.player.pause() def OnStop(self, evt): """Stop the player. """ self.player.stop() # reset the time slider self.timeslider.SetValue(0) self.timer.Stop() self.play.Enable() self.pause.Disable() self.stop.Disable() def OnTimer(self, evt): """Update the time slider according to the current movie time. """ # since the self.player.get_length can change while playing, # re-set the timeslider to the correct range. length = self.player.get_length() self.timeslider.SetRange(-1, length) # update the time on the slider time = self.player.get_time() self.timeslider.SetValue(time) def OnMute(self, evt): """Mute/Unmute according to the audio button. """ muted = self.player.audio_get_mute() self.player.audio_set_mute(not muted) self.mute.SetLabel("Mute" if muted else "Unmute") # update the volume slider; # since vlc volume range is in [0, 200], # and our volume slider has range [0, 100], just divide by 2. # self.volslider.SetValue(self.player.audio_get_volume() / 2) def OnVolume(self, evt): """Set the volume according to the volume sider. """ volume = self.volslider.GetValue() * 2 # vlc.MediaPlayer.audio_set_volume returns 0 if success, -1 otherwise if self.player.audio_set_volume(volume) == -1: self.errorDialog("Failed to set volume") def errorDialog(self, errormessage): """Display a simple error dialog. """ edialog = wx.MessageDialog(self, errormessage, 'Error', wx.OK| wx.ICON_ERROR) edialog.ShowModal() if __name__ == "__main__": _video = '' while len(sys.argv) > 1: arg = sys.argv.pop(1) if arg.lower() in ('-v', '--version'): # show all versions, sample output on macOS: # % python3 ./wxvlc.py -v # wxvlc.py: 19.07.28 (wx 4.0.6 osx-cocoa (phoenix) wxWidgets 3.0.5 _core.cpython-37m-darwin.so) # vlc.py: 3.0.6109 (Sun Mar 31 20:14:16 2019 3.0.6) # LibVLC version: 3.0.6 Vetinari (0x3000600) # LibVLC compiler: clang: warning: argument unused during compilation: '-mmacosx-version-min=10.7' [-Wunused-command-line-argument] # Plugin path: /Applications/VLC3.0.6.app/Contents/MacOS/plugins # Python: 3.7.4 (64bit) macOS 10.13.6 # Print version of this vlc.py and of the libvlc c = basename(str(wx._core).split()[-1].rstrip('>').strip("'").strip('"')) print('%s: %s (%s %s %s)' % (basename(__file__), __version__, wx.__name__, wx.version(), c)) try: vlc.print_version() vlc.print_python() except AttributeError: pass sys.exit(0) elif arg.startswith('-'): print('usage: %s [-v | --version] []' % (sys.argv[0],)) sys.exit(1) elif arg: # video file _video = expanduser(arg) if not isfile(_video): print('%s error: no such file: %r' % (sys.argv[0], arg)) sys.exit(1) # Create a wx.App(), which handles the windowing system event loop app = wx.App() # XXX wx.PySimpleApp() # Create the window containing our media player player = Player(video=_video) # show the player window centred player.Centre() player.Show() # run the application app.MainLoop() ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1728311801.0 python_vlc-3.0.21203/pyproject.toml0000644000175200017520000000272014700770771017066 0ustar00oaubertoaubert[build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] name = "python-vlc" dynamic = [ "version" ] authors = [ { name = "Olivier Aubert", email = "contact@olivieraubert.net" } ] maintainers = [ { name = "Olivier Aubert", email = "contact@olivieraubert.net" } ] readme = { file = "README.module", content-type = "text/x-rst" } license = { text = "LGPL-2.1+" } description = "VLC bindings for python." classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX :: Linux", "Operating System :: POSIX :: Other", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Multimedia", "Topic :: Multimedia :: Sound/Audio", "Topic :: Multimedia :: Video" ] keywords = ["vlc", "video"] [project.urls] Homepage = "https://wiki.videolan.org/PythonBinding" Documentation = "https://www.olivieraubert.net/vlc/python-ctypes/doc/" Repository = "https://github.com/oaubert/python-vlc.git" "Alternate repository" = "https://git.videolan.org/?p=vlc/bindings/python.git;a=summary" "Bug Tracker" = "https://github.com/oaubert/python-vlc/issues" [tool.setuptools.dynamic] version = {attr = "vlc.__version__"} ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1728311982.7532592 python_vlc-3.0.21203/python_vlc.egg-info/0000755000175200017520000000000014700771257020030 5ustar00oaubertoaubert././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1728311982.0 python_vlc-3.0.21203/python_vlc.egg-info/PKG-INFO0000644000175200017520000000776514700771256021143 0ustar00oaubertoaubertMetadata-Version: 2.1 Name: python-vlc Version: 3.0.21203 Summary: VLC bindings for python. Author-email: Olivier Aubert Maintainer-email: Olivier Aubert License: LGPL-2.1+ Project-URL: Homepage, https://wiki.videolan.org/PythonBinding Project-URL: Documentation, https://www.olivieraubert.net/vlc/python-ctypes/doc/ Project-URL: Repository, https://github.com/oaubert/python-vlc.git Project-URL: Alternate repository, https://git.videolan.org/?p=vlc/bindings/python.git;a=summary Project-URL: Bug Tracker, https://github.com/oaubert/python-vlc/issues Keywords: vlc,video Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+) Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: POSIX :: Linux Classifier: Operating System :: POSIX :: Other Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Multimedia Classifier: Topic :: Multimedia :: Sound/Audio Classifier: Topic :: Multimedia :: Video Description-Content-Type: text/x-rst License-File: COPYING Python ctypes-based bindings for libvlc ======================================= The bindings use ctypes to directly call the libvlc dynamic lib, and the code is generated from the include files defining the public API. The same module should be compatible with various versions of libvlc 3.*. However, there may be incompatible changes between major versions. Installing the module --------------------- You can install the module through PyPI: pip install python-vlc Using the module ---------------- The module offers two ways of accessing the API - a raw access to all exported methods, and more convenient wrapper classes. Using wrapper classes +++++++++++++++++++++ Most major structures of the libvlc API (Instance, Media, MediaPlayer, etc) are wrapped as classes, with shorter method names and some adaptations to provide a more pythonic API: >>> import vlc >>> player = vlc.MediaPlayer('file:///tmp/foo.avi') >>> player.play() >>> player.get_instance() # returns the corresponding instance In this case, a default ``vlc.Instance`` will be instanciated and stored in ``vlc._default_instance``. It will be used to instanciate the various classes (``Media``, ``MediaList``, ``MediaPlayer``, etc). You also can use wrapper methods closer to the original libvlc API: >>> import vlc >>> instance = vlc.Instance('--no-audio', '--fullscreen') >>> player = instance.media_player_new() >>> player.audio_get_volume() 50 >>> media = instance.media_new('file:///tmp/foo.avi') >>> media.get_mrl() 'file:///tmp/foo.avi' >>> player.set_media(m) >>> player.play() Using raw access ++++++++++++++++ Libvlc methods are available as attributes of the vlc module (as vlc.libvlc_*). Use their docstring (any introspective shell like ipython is your friend) to explore them, or refer to the online documentation at https://olivieraubert.net/vlc/python-ctypes/ >>> import vlc >>> vlc.libvlc_get_version() '3.0.0-rc2 Vetinari' >>> exc = vlc.VLCException() >>> instance = vlc.libvlc_new(0, [], exc) >>> instance >>> vlc.libvlc_audio_get_volume(instance, exc) 50 Example code ++++++++++++ You can find [example files](https://github.com/oaubert/python-vlc/tree/master/examples) in the repository. Note that the ``vlc.py`` module can itself be invoked as an application using its own features, which also serves as a API usage example. See the [end of the module](https://github.com/oaubert/python-vlc/blob/master/generated/3.0/vlc.py#L12525) after the line ``if __name__ == "__main__":`` License ------- The generated module is licensed, like libvlc, under the GNU Lesser General Public License 2.1 or later. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1728311982.0 python_vlc-3.0.21203/python_vlc.egg-info/SOURCES.txt0000644000175200017520000000107014700771256021711 0ustar00oaubertoaubertCOPYING MANIFEST.in README.module pyproject.toml vlc.py examples/cocoavlc.py examples/glsurface.py examples/gtk2vlc.py examples/gtkvlc.py examples/play_buffer.py examples/psgvlc.py examples/pyobjcvlc.py examples/pyqt5vlc.py examples/qtvlc.py examples/tkvlc.py examples/wxvlc.py examples/video_sync/README.md examples/video_sync/figure.png examples/video_sync/main.py examples/video_sync/mini_player.py examples/video_sync/network.py python_vlc.egg-info/PKG-INFO python_vlc.egg-info/SOURCES.txt python_vlc.egg-info/dependency_links.txt python_vlc.egg-info/top_level.txt././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1728311982.0 python_vlc-3.0.21203/python_vlc.egg-info/dependency_links.txt0000644000175200017520000000000114700771256024075 0ustar00oaubertoaubert ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1728311982.0 python_vlc-3.0.21203/python_vlc.egg-info/top_level.txt0000644000175200017520000000000414700771256022553 0ustar00oaubertoaubertvlc ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1728311982.7532592 python_vlc-3.0.21203/setup.cfg0000644000175200017520000000004614700771257015772 0ustar00oaubertoaubert[egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1728311974.0 python_vlc-3.0.21203/vlc.py0000644000175200017520000143472614700771246015326 0ustar00oaubertoaubert#! /usr/bin/python # -*- coding: utf-8 -*- # Python ctypes bindings for VLC # # Copyright (C) 2009-2017 the VideoLAN team # $Id: $ # # Authors: Olivier Aubert # Jean Brouwers # Geoff Salmon # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA """This module provides bindings for the LibVLC public API, see https://wiki.videolan.org/LibVLC. You can find the documentation and a README file with some examples at https://www.olivieraubert.net/vlc/python-ctypes/. Basically, the most important class is :class:`Instance`, which is used to create a libvlc instance. From this instance, you then create :class:`MediaPlayer` and :class:`MediaListPlayer` instances. Alternatively, you may create instances of the :class:`MediaPlayer` and :class:`MediaListPlayer` class directly and an instance of :class:`Instance` will be implicitly created. The latter can be obtained using the :meth:`MediaPlayer.get_instance` and :class:`MediaListPlayer`. """ import ctypes import functools # Used by EventManager in override.py import inspect as _inspect import logging import os import sys from ctypes.util import find_library logger = logging.getLogger(__name__) __version__ = "3.0.21203" __libvlc_version__ = "3.0.21" __generator_version__ = "2.3" build_date = "Mon Oct 7 16:39:34 2024 3.0.21" # The libvlc doc states that filenames are expected to be in UTF8, do # not rely on sys.getfilesystemencoding() which will be confused, # esp. on windows. DEFAULT_ENCODING = "utf-8" def str_to_bytes(s): """Translate string or bytes to bytes.""" if isinstance(s, str): return bytes(s, DEFAULT_ENCODING) else: return s def bytes_to_str(b): """Translate bytes to string.""" if isinstance(b, bytes): return b.decode(DEFAULT_ENCODING) else: return b def len_args(func): """Return number of positional arguments.""" return len(_inspect.signature(func).parameters) # Internal guard to prevent internal classes to be directly # instanciated. _internal_guard = object() def find_lib(): dll = None plugin_path = os.environ.get("PYTHON_VLC_MODULE_PATH", None) if "PYTHON_VLC_LIB_PATH" in os.environ: try: dll = ctypes.CDLL(os.environ["PYTHON_VLC_LIB_PATH"]) except OSError: logger.error( "Cannot load lib specified by PYTHON_VLC_LIB_PATH env. variable" ) sys.exit(1) if plugin_path and not os.path.isdir(plugin_path): logger.error("Invalid PYTHON_VLC_MODULE_PATH specified. Please fix.") sys.exit(1) if dll is not None: return dll, plugin_path if sys.platform.startswith("win"): libname = "libvlc.dll" p = find_library(libname) if p is None: try: # some registry settings # leaner than win32api, win32con import winreg as w for r in w.HKEY_LOCAL_MACHINE, w.HKEY_CURRENT_USER: try: r = w.OpenKey(r, "Software\\VideoLAN\\VLC") plugin_path, _ = w.QueryValueEx(r, "InstallDir") w.CloseKey(r) break except w.error: pass except ImportError: # no PyWin32 pass if plugin_path is None: # try some standard locations. programfiles = os.environ["ProgramFiles"] homedir = os.environ["HOMEDRIVE"] for p in ( "{programfiles}\\VideoLan{libname}", "{homedir}:\\VideoLan{libname}", "{programfiles}{libname}", "{homedir}:{libname}", ): p = p.format( homedir=homedir, programfiles=programfiles, libname="\\VLC\\" + libname, ) if os.path.exists(p): plugin_path = os.path.dirname(p) break if plugin_path is not None: # try loading # PyInstaller Windows fix if "PyInstallerCDLL" in ctypes.CDLL.__name__: ctypes.windll.kernel32.SetDllDirectoryW(None) p = os.getcwd() os.chdir(plugin_path) # if chdir failed, this will raise an exception dll = ctypes.CDLL(".\\" + libname) # restore cwd after dll has been loaded os.chdir(p) else: # may fail dll = ctypes.CDLL(".\\" + libname) else: plugin_path = os.path.dirname(p) dll = ctypes.CDLL(p) elif sys.platform.startswith("darwin"): # FIXME: should find a means to configure path d = "/Applications/VLC.app/Contents/MacOS/" c = d + "lib/libvlccore.dylib" p = d + "lib/libvlc.dylib" if os.path.exists(p) and os.path.exists(c): # pre-load libvlccore VLC 2.2.8+ ctypes.CDLL(c) dll = ctypes.CDLL(p) for p in ("modules", "plugins"): p = d + p if os.path.isdir(p): plugin_path = p break else: # hope, some [DY]LD_LIBRARY_PATH is set... # pre-load libvlccore VLC 2.2.8+ ctypes.CDLL("libvlccore.dylib") dll = ctypes.CDLL("libvlc.dylib") else: # All other OSes (linux, freebsd...) p = find_library("vlc") try: dll = ctypes.CDLL(p) except OSError: # may fail dll = None if dll is None: try: dll = ctypes.CDLL("libvlc.so.5") except: raise NotImplementedError("Cannot find libvlc lib") return (dll, plugin_path) # plugin_path used on win32 and MacOS in override.py dll, plugin_path = find_lib() class VLCException(Exception): """Exception raised by libvlc methods.""" pass try: _Ints = (int, long) except NameError: # no long in Python 3+ _Ints = int _Seqs = (list, tuple) # Used for handling *event_manager() methods. class memoize_parameterless(object): """Decorator. Caches a parameterless method's return value each time it is called. If called later with the same arguments, the cached value is returned (not reevaluated). Adapted from https://wiki.python.org/moin/PythonDecoratorLibrary. """ def __init__(self, func): self.func = func self._cache = {} def __call__(self, obj): try: return self._cache[obj] except KeyError: v = self._cache[obj] = self.func(obj) return v def __repr__(self): """Return the function's docstring.""" return self.func.__doc__ def __get__(self, obj, objtype): """Support instance methods.""" return functools.partial(self.__call__, obj) # Default instance. It is used to instanciate classes directly in the # OO-wrapper. _default_instance = None def get_default_instance(): """Returns the default :class:`Instance`.""" global _default_instance if _default_instance is None: _default_instance = Instance() return _default_instance def try_fspath(path): """Try calling ``os.fspath``. ``os.fspath`` is only available from py3.6. """ try: return os.fspath(path) except (AttributeError, TypeError): return path _Cfunctions = {} # from LibVLC __version__ _Globals = globals() # sys.modules[__name__].__dict__ def _Cfunction(name, flags, errcheck, *types): """(INTERNAL) New ctypes function binding.""" if hasattr(dll, name) and name in _Globals: p = ctypes.CFUNCTYPE(*types) f = p((name, dll), flags) if errcheck is not None: f.errcheck = errcheck # replace the Python function # in this module, but only when # running as python -O or -OO if __debug__: _Cfunctions[name] = f else: _Globals[name] = f return f raise NameError("no function %r" % (name,)) def _Cobject(cls, ctype): """(INTERNAL) New instance from ctypes.""" o = object.__new__(cls) o._as_parameter_ = ctype return o def _Constructor(cls, ptr=_internal_guard): """(INTERNAL) New wrapper from ctypes.""" if ptr == _internal_guard: raise VLCException( "(INTERNAL) ctypes class. You should get references for this class through methods of the LibVLC API." ) if ptr is None or ptr == 0: return None return _Cobject(cls, ctypes.c_void_p(ptr)) class _Cstruct(ctypes.Structure): """(INTERNAL) Base class for ctypes structures.""" _fields_ = [] # list of 2-tuples ('name', ctypes.) def __str__(self): l = [" %s:\t%s" % (n, getattr(self, n)) for n, _ in self._fields_] return "\n".join([self.__class__.__name__] + l) def __repr__(self): return "%s.%s" % (self.__class__.__module__, self) class _Ctype(object): """(INTERNAL) Base class for ctypes.""" @staticmethod def from_param(this): # not self """(INTERNAL) ctypes parameter conversion method.""" if this is None: return None return this._as_parameter_ class ListPOINTER(object): """Just like a POINTER but accept a list of etype elements as an argument.""" def __init__(self, etype): self.etype = etype def from_param(self, param): if isinstance(param, _Seqs): return (self.etype * len(param))(*param) else: return ctypes.POINTER(param) # errcheck functions for some native functions. def string_result(result, func, arguments): """Errcheck function. Returns a string and frees the original pointer. It assumes the result is a ``char*``. """ if result: # make a python string copy s = bytes_to_str(ctypes.string_at(result)) # free original string ptr libvlc_free(result) return s return None def class_result(classname): """Errcheck function. Returns a function that creates the specified class.""" def wrap_errcheck(result, func, arguments): if result is None: return None return classname(result) return wrap_errcheck # Wrapper for the opaque struct libvlc_log_t class Log(ctypes.Structure): pass Log_ptr = ctypes.POINTER(Log) # Wrapper for the opaque struct libvlc_media_thumbnail_request_t class MediaThumbnailRequest: def __new__(cls, *args): if len(args) == 1 and isinstance(args[0], _Ints): return _Constructor(cls, args[0]) # FILE* ctypes wrapper, copied from # https://svn.python.org/projects/ctypes/trunk/ctypeslib/ctypeslib/contrib/pythonhdr.py class FILE(ctypes.Structure): pass FILE_ptr = ctypes.POINTER(FILE) PyFile_FromFd = ctypes.pythonapi.PyFile_FromFd PyFile_FromFd.restype = ctypes.py_object PyFile_FromFd.argtypes = [ ctypes.c_int, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ] PyFile_AsFd = ctypes.pythonapi.PyObject_AsFileDescriptor PyFile_AsFd.restype = ctypes.c_int PyFile_AsFd.argtypes = [ctypes.py_object] def module_description_list(head): """Convert a ModuleDescription linked list to a Python list (and release the former).""" r = [] if head: item = head while item: item = item.contents r.append((item.name, item.shortname, item.longname, item.help)) item = item.next libvlc_module_description_list_release(head) return r def track_description_list(head): """Convert a TrackDescription linked list to a Python list (and release the former).""" r = [] if head: item = head while item: item = item.contents r.append((item.id, item.name)) item = item.next try: libvlc_track_description_release(head) except NameError: libvlc_track_description_list_release(head) return r class _Enum(ctypes.c_uint): """(INTERNAL) Base class""" _enum_names_ = {} def __str__(self): n = self._enum_names_.get(self.value, "") or ("FIXME_(%r)" % (self.value,)) return ".".join((self.__class__.__name__, n)) def __hash__(self): return self.value def __repr__(self): return ".".join((self.__class__.__module__, self.__str__())) def __eq__(self, other): return (isinstance(other, _Enum) and self.value == other.value) or ( isinstance(other, _Ints) and self.value == other ) def __ne__(self, other): return not self.__eq__(other) # Generated wrappers # class AudioEqualizer(_Ctype): """Create a new default equalizer, with all frequency values zeroed. The new equalizer can subsequently be applied to a media player by invoking :meth:`MediaPlayer.set_equalizer`. The returned handle should be freed via :meth:`release` when it is no longer needed. """ def __new__(cls, *args): if len(args) == 1 and isinstance(args[0], _Ints): return _Constructor(cls, args[0]) return libvlc_audio_equalizer_new() def get_amp_at_index(self, u_band): """Get the amplification value for a particular equalizer frequency band. :param u_band: index, counting from zero, of the frequency band to get. :return: amplification value (Hz); NaN if there is no such frequency band. :version: LibVLC 2.2.0 or later. """ return libvlc_audio_equalizer_get_amp_at_index(self, u_band) def get_preamp(self): """Get the current pre-amplification value from an equalizer. :return: preamp value (Hz). :version: LibVLC 2.2.0 or later. """ return libvlc_audio_equalizer_get_preamp(self) def release(self): """Release a previously created equalizer instance. The equalizer was previously created by using :func:`new` or :func:`new_from_preset`. It is safe to invoke this method with a None *p_equalizer* parameter for no effect. :version: LibVLC 2.2.0 or later. """ return libvlc_audio_equalizer_release(self) def set_amp_at_index(self, f_amp, u_band): """Set a new amplification value for a particular equalizer frequency band. The new equalizer settings are subsequently applied to a media player by invoking :func:`media_player_set_equalizer`. The supplied amplification value will be clamped to the -20.0 to +20.0 range. :param f_amp: amplification value (-20.0 to 20.0 Hz). :param u_band: index, counting from zero, of the frequency band to set. :return: zero on success, -1 on error. :version: LibVLC 2.2.0 or later. """ return libvlc_audio_equalizer_set_amp_at_index(self, f_amp, u_band) def set_preamp(self, f_preamp): """Set a new pre-amplification value for an equalizer. The new equalizer settings are subsequently applied to a media player by invoking :func:`media_player_set_equalizer`. The supplied amplification value will be clamped to the -20.0 to +20.0 range. :param f_preamp: preamp value (-20.0 to 20.0 Hz). :return: zero on success, -1 on error. :version: LibVLC 2.2.0 or later. """ return libvlc_audio_equalizer_set_preamp(self, f_preamp) class EventManager(_Ctype): """Create an event manager with callback handler. This class interposes the registration and handling of event notifications in order to (a) remove the need for decorating each callback functions with the decorator ``@callbackmethod``, (b) allow any number of positional and/or keyword arguments to the callback (in addition to the :class:`Event` instance) and (c) to preserve the Python objects such that the callback and argument objects remain alive (i.e. are not garbage collected) until **after** the notification has been unregistered. .. note:: Only a single notification can be registered for each event type in an :class:`EventManager` instance. """ _callback_handler = None _callbacks = {} def __new__(cls, ptr=_internal_guard): if ptr == _internal_guard: raise VLCException( "(INTERNAL) ctypes class.\nYou should get a reference to EventManager through the MediaPlayer.event_manager() method." ) return _Constructor(cls, ptr) def event_attach(self, eventtype, callback, *args, **kwds): """Register an event notification. :param eventtype: the desired event type to be notified about. :param callback: the function to call when the event occurs. :param args: optional positional arguments for the callback. :param kwds: optional keyword arguments for the callback. :return: 0 on success, ENOMEM on error. .. note:: The callback function must have at least one argument, an :class:`Event` instance. Any other, optional positional and keyword arguments are in **addition** to the first one. .. warning:: LibVLC is not reentrant, i.e. you cannot call libvlc functions from an event handler. They must be called from the main application thread. """ if not isinstance(eventtype, EventType): raise VLCException("%s required: %r" % ("EventType", eventtype)) if not hasattr(callback, "__call__"): # callable() raise VLCException("%s required: %r" % ("callable", callback)) # check that the callback expects arguments if len_args(callback) < 1: # list(...) raise VLCException("%s required: %r" % ("argument", callback)) if self._callback_handler is None: _called_from_ctypes = ctypes.CFUNCTYPE( None, ctypes.POINTER(Event), ctypes.c_void_p ) @_called_from_ctypes def _callback_handler(event, k): """(INTERNAL) handle callback call from ctypes. .. note:: We cannot simply make this an :class:`EventManager` method since ctypes does not prepend self as the first parameter, hence this closure. """ try: # retrieve Python callback and arguments call, args, kwds = self._callbacks[k] except KeyError: # detached? pass else: # deref event.contents to simplify callback code call(event.contents, *args, **kwds) self._callback_handler = _callback_handler self._callbacks = {} k = eventtype.value r = libvlc_event_attach(self, k, self._callback_handler, k) if not r: self._callbacks[k] = (callback, args, kwds) return r def event_detach(self, eventtype): """Unregister an event notification. :param eventtype: the event type notification to be removed. """ if not isinstance(eventtype, EventType): raise VLCException("%s required: %r" % ("EventType", eventtype)) k = eventtype.value if k in self._callbacks: del self._callbacks[k] # remove, regardless of libvlc return value libvlc_event_detach(self, k, self._callback_handler, k) class Instance(_Ctype): """It may take as parameter either: * a string * a list of strings as first parameters * the parameters given as the constructor parameters (must be strings) """ def __new__(cls, *args): if len(args) == 1: # Only 1 arg. It is either a C pointer, or an arg string, # or a tuple. i = args[0] if isinstance(i, _Ints): return _Constructor(cls, i) elif isinstance(i, str): args = i.strip().split() elif isinstance(i, _Seqs): args = list(i) else: raise VLCException("Instance %r" % (args,)) else: args = list(args) if not args: # no parameters passed args = ["vlc"] elif args[0] != "vlc": args.insert(0, "vlc") if plugin_path is not None: # set plugin_path if detected, win32 and MacOS, # if the user did not specify it itself. os.environ.setdefault("VLC_PLUGIN_PATH", plugin_path) args = [str_to_bytes(a) for a in args] return libvlc_new(len(args), args) def media_player_new(self, uri=None): """Create a new :class:`MediaPlayer` instance. :param uri: an optional URI to play in the player as a str, bytes or PathLike object. """ p = libvlc_media_player_new(self) if uri: p.set_media(self.media_new(uri)) p._instance = self return p def media_list_player_new(self): """Create a new :class:`MediaListPlayer` instance.""" p = libvlc_media_list_player_new(self) p._instance = self return p def media_new(self, mrl, *options): """Create a new :class:`Media` instance. If mrl contains a colon (:) preceded by more than 1 letter, it will be treated as a URL. Else, it will be considered as a local path. If you need more control, directly use :meth:`media_new_location` or :meth:`media_new_path`. Options can be specified as supplementary string parameters, but note that many options cannot be set at the media level, and rather at the :class:`Instance` level. For instance, the marquee filter must be specified when creating the :class:`Instance` or :class:`MediaPlayer`. Alternatively, options can be added to the media using the :meth:`Media.add_options` method (with the same limitation). :param mrl: A str, bytes or PathLike object :param options: optional media option=value strings """ mrl = try_fspath(mrl) if ":" in mrl and mrl.index(":") > 1: # Assume it is a URL if __version__ >= "4": m = libvlc_media_new_location(str_to_bytes(mrl)) else: m = libvlc_media_new_location(self, str_to_bytes(mrl)) else: # Else it should be a local path. m = self.media_new_path(str_to_bytes(os.path.normpath(mrl))) for o in options: libvlc_media_add_option(m, str_to_bytes(o)) m._instance = self return m def media_new_path(self, path): """Create a media for a certain file path. See :meth:`media_release`. :param path: A str, byte, or PathLike object representing a local filesystem path. :return: the newly created media or None on error. """ path = try_fspath(path) if __version__ >= "4": return libvlc_media_new_path(str_to_bytes(path)) else: return libvlc_media_new_path(self, str_to_bytes(path)) def media_list_new(self, mrls=None): """Create a new :class:`MediaList` instance. :param mrls: optional list of MRL strings, bytes, or PathLike objects. """ # API 3 vs 4: libvlc_media_list_new does not take any # parameter as input anymore. if len_args(libvlc_media_list_new) == 1: # API <= 3 l = libvlc_media_list_new(self) else: # API >= 4 l = libvlc_media_list_new() # We should take the lock, but since we did not leak the # reference, nobody else can access it. if mrls: for m in mrls: l.add_media(m) l._instance = self return l def audio_output_enumerate_devices(self): """Enumerate the defined audio output devices. :return: list of dicts {name:, description:, devices:} """ r = [] head = libvlc_audio_output_list_get(self) if head: i = head while i: i = i.contents r.append({"name": i.name, "description": i.description}) i = i.next libvlc_audio_output_list_release(head) return r def audio_filter_list_get(self): """Returns a list of available audio filters.""" return module_description_list(libvlc_audio_filter_list_get(self)) def video_filter_list_get(self): """Returns a list of available video filters.""" return module_description_list(libvlc_video_filter_list_get(self)) def add_intf(self, name): """Try to start a user interface for the libvlc instance. :param name: interface name, or None for default. :return: 0 on success, -1 on error. """ return libvlc_add_intf(self, str_to_bytes(name)) def audio_output_device_count(self, psz_audio_output): """Backward compatibility stub. Do not use in new code. .. warning:: **Deprecated!** Use :func:`audio_output_device_list_get` instead. :return: always 0. """ return libvlc_audio_output_device_count(self, str_to_bytes(psz_audio_output)) def audio_output_device_id(self, psz_audio_output, i_device): """Backward compatibility stub. Do not use in new code. .. warning:: **Deprecated!** Use :func:`audio_output_device_list_get` instead. :return: always None. """ return libvlc_audio_output_device_id( self, str_to_bytes(psz_audio_output), i_device ) def audio_output_device_list_get(self, aout): """Gets a list of audio output devices for a given audio output module, See :func:`audio_output_device_set`. .. note:: Not all audio outputs support this. In particular, an empty (None) list of devices does **not** imply that the specified audio output does not work. .. note:: The list might not be exhaustive. .. warning:: Some audio output devices in the list might not actually work in some circumstances. By default, it is recommended to not specify any explicit audio device. :param aout: audio output name. (as returned by libvlc_audio_output_list_get). :return: A None-terminated linked list of potential audio output devices. It must be freed with :func:`audio_output_device_list_release`. :version: LibVLC 2.1.0 or later. """ return libvlc_audio_output_device_list_get(self, str_to_bytes(aout)) def audio_output_device_longname(self, psz_output, i_device): """Backward compatibility stub. Do not use in new code. .. warning:: **Deprecated!** Use :func:`audio_output_device_list_get` instead. :return: always None. """ return libvlc_audio_output_device_longname( self, str_to_bytes(psz_output), i_device ) def audio_output_list_get(self): """Gets the list of available audio output modules. :return: list of available audio outputs. It must be freed with. See :func:`audio_output_list_release` See :class:`AudioOutput` . In case of error, None is returned. """ return libvlc_audio_output_list_get(self) def dialog_set_callbacks(self, p_cbs, p_data): """Register callbacks in order to handle VLC dialogs :param p_data: opaque pointer for the callback. :version: LibVLC 3.0.0 and later. """ return libvlc_dialog_set_callbacks(self, p_cbs, p_data) def get_log_verbosity(self): """Always returns minus one. This function is only provided for backward compatibility. :return: always -1. """ return libvlc_get_log_verbosity(self) def log_open(self): """This function does nothing useful. It is only provided for backward compatibility. :return: an unique pointer or None on error. """ return libvlc_log_open(self) def log_set(self, cb, data): """Sets the logging callback for a LibVLC instance. This function is thread-safe: it will wait for any pending callbacks invocation to complete. .. 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. :param data: opaque data pointer for the callback function. :param p_instance: libvlc instance. :version: LibVLC 2.1.0 or later. """ return libvlc_log_set(self, cb, data) def log_set_file(self, stream): """Sets up logging to a file. :param stream: FILE pointer opened for writing. (the FILE pointer must remain valid until libvlc_log_unset). :version: LibVLC 2.1.0 or later. """ return libvlc_log_set_file(self, stream) def log_unset(self): """Unsets the logging callback. This function deregisters the logging callback for a LibVLC instance. This is rarely needed as the callback is implicitly unset when the instance is destroyed. .. note:: This function will wait for any pending callbacks invocation to complete (causing a deadlock if called from within the callback). :version: LibVLC 2.1.0 or later. """ return libvlc_log_unset(self) def media_discoverer_list_get(self, i_cat, ppp_services): """Get media discoverer services by category :param i_cat: category of services to fetch. :param ppp_services: address to store an allocated array of media discoverer. services (must be freed with :func:`media_discoverer_list_release` by. the caller) [OUT]. :return: the number of media discoverer services (0 on error). :version: LibVLC 3.0.0 and later. """ return libvlc_media_discoverer_list_get(self, i_cat, ppp_services) def media_discoverer_new(self, psz_name): """Create a media discoverer object by name. After this object is created, you should attach to media_list events in order to be notified of new items discovered. You need to call :func:`media_discoverer_start` in order to start the discovery. See :func:`media_discoverer_media_list` See :func:`media_discoverer_event_manager` See :func:`media_discoverer_start` :param psz_name: service name; use :func:`media_discoverer_list_get` to get. a list of the discoverer names available in this libVLC instance. :return: media discover object or None in case of error. :version: LibVLC 3.0.0 or later. """ return libvlc_media_discoverer_new(self, str_to_bytes(psz_name)) def media_discoverer_new_from_name(self, psz_name): """.. warning:: **Deprecated!** Use :func:`media_discoverer_new` and :func:`media_discoverer_start`.""" return libvlc_media_discoverer_new_from_name(self, str_to_bytes(psz_name)) def media_library_new(self): """Create an new Media Library object :return: a new object or None on error. """ return libvlc_media_library_new(self) def media_new_as_node(self, psz_name): """Create a media as an empty node with a given name. See :func:`media_release` :param psz_name: the name of the node. :return: the new empty media or None on error. """ return libvlc_media_new_as_node(self, str_to_bytes(psz_name)) def media_new_callbacks(self, open_cb, read_cb, seek_cb, close_cb, opaque): """Create a media with custom callbacks to read the data from. .. 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 :func:`media_release` :param open_cb: callback to open the custom bitstream input media. :param read_cb: callback to read data (must not be None). :param seek_cb: callback to seek, or None if seeking is not supported. :param close_cb: callback to close the media, or None if unnecessary. :param opaque: data pointer for the open callback. :return: the newly created media or None on error. :version: LibVLC 3.0.0 and later. """ return libvlc_media_new_callbacks( self, open_cb, read_cb, seek_cb, close_cb, opaque ) def media_new_fd(self, fd): """Create a media for an already open file descriptor. The file descriptor shall be open for reading (or reading and writing). Regular file descriptors, pipe read descriptors and character device descriptors (including TTYs) are supported on all platforms. Block device descriptors are supported where available. Directory descriptors are supported on systems that provide fdopendir(). Sockets are supported on all platforms where they are file descriptors, i.e. all except Windows. .. note:: This library will **not** automatically close the file descriptor under any circumstance. Nevertheless, a file descriptor can usually only be rendered once in a media player. To render it a second time, the file descriptor should probably be rewound to the beginning with lseek(). See :func:`media_release` :param fd: open file descriptor. :return: the newly created media or None on error. :version: LibVLC 1.1.5 and later. """ return libvlc_media_new_fd(self, fd) def media_new_location(self, psz_mrl): """Create a media with a certain given media resource location, for instance a valid URL. .. note:: To refer to a local file with this function, the file://... URI syntax **must** be used (see IETF RFC3986). We recommend using :func:`media_new_path` instead when dealing with local files. See :func:`media_release` :param psz_mrl: the media location. :return: the newly created media or None on error. """ return libvlc_media_new_location(self, str_to_bytes(psz_mrl)) def playlist_play(self, i_id, i_options, ppsz_options): """Start playing (if there is any item in the playlist). Additionnal playlist item options can be specified for addition to the item before it is played. :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. :param i_options: the number of options to add to the item. :param ppsz_options: the options to add to the item. """ return libvlc_playlist_play(self, i_id, i_options, ppsz_options) def release(self): """Decrement the reference count of a libvlc instance, and destroy it if it reaches zero. """ return libvlc_release(self) def renderer_discoverer_list_get(self, ppp_services): """Get media discoverer services See libvlc_renderer_list_release :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]. :return: the number of media discoverer services (0 on error). :version: LibVLC 3.0.0 and later. """ return libvlc_renderer_discoverer_list_get(self, ppp_services) def renderer_discoverer_new(self, psz_name): """Create a renderer discoverer object by name After this object is created, you should attach to events in order to be notified of the discoverer events. You need to call :func:`renderer_discoverer_start` in order to start the discovery. See :func:`renderer_discoverer_event_manager` See :func:`renderer_discoverer_start` :param psz_name: service name; use :func:`renderer_discoverer_list_get` to. get a list of the discoverer names available in this libVLC instance. :return: media discover object or None in case of error. :version: LibVLC 3.0.0 or later. """ return libvlc_renderer_discoverer_new(self, str_to_bytes(psz_name)) def retain(self): """Increments the reference count of a libvlc instance. The initial reference count is 1 after :func:`new` returns. """ return libvlc_retain(self) def set_app_id(self, id, version, icon): """Sets some meta-information about the application. See also :func:`set_user_agent`. :param id: Java-style application identifier, e.g. "com.acme.foobar". :param version: application version numbers, e.g. "1.2.3". :param icon: application icon name, e.g. "foobar". :version: LibVLC 2.1.0 or later. """ return libvlc_set_app_id( self, str_to_bytes(id), str_to_bytes(version), str_to_bytes(icon) ) def set_exit_handler(self, cb, opaque): """Registers a callback for the LibVLC exit event. This is mostly useful if the VLC playlist and/or at least one interface are started with :func:`playlist_play` or :func:`add_intf` respectively. Typically, this function will wake up your application main loop (from another thread). .. note:: This function should be called before the playlist or interface are started. Otherwise, there is a small race condition: the exit event could be raised before the handler is registered. .. warning:: This function and :func:`wait` cannot be used at the same time. :param cb: callback to invoke when LibVLC wants to exit, or None to disable the exit handler (as by default). :param opaque: data pointer for the callback. """ return libvlc_set_exit_handler(self, cb, opaque) def set_log_verbosity(self, level): """This function does nothing. It is only provided for backward compatibility. :param level: ignored. """ return libvlc_set_log_verbosity(self, level) def set_user_agent(self, name, http): """Sets the application *name*. LibVLC passes this as the user agent string when a protocol requires it. :param name: human-readable application name, e.g. "FooBar player 1.2.3". :param http: HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0". :version: LibVLC 1.1.1 or later. """ return libvlc_set_user_agent(self, str_to_bytes(name), str_to_bytes(http)) def vlm_add_broadcast( self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop, ): """Add a broadcast, with one input. :param psz_name: the name of the new broadcast. :param psz_input: the input MRL. :param psz_output: the output MRL (the parameter to the "sout" variable). :param i_options: number of additional options. :param ppsz_options: additional options. :param b_enabled: boolean for enabling the new broadcast. :param b_loop: Should this broadcast be played in loop ? :return: 0 on success, -1 on error. """ return libvlc_vlm_add_broadcast( self, str_to_bytes(psz_name), str_to_bytes(psz_input), str_to_bytes(psz_output), i_options, ppsz_options, b_enabled, b_loop, ) def vlm_add_input(self, psz_name, psz_input): """Add a media's input MRL. This will add the specified one. :param psz_name: the media to work on. :param psz_input: the input MRL. :return: 0 on success, -1 on error. """ return libvlc_vlm_add_input( self, str_to_bytes(psz_name), str_to_bytes(psz_input) ) def vlm_add_vod( self, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux ): """Add a vod, with one input. :param psz_name: the name of the new vod media. :param psz_input: the input MRL. :param i_options: number of additional options. :param ppsz_options: additional options. :param b_enabled: boolean for enabling the new vod. :param psz_mux: the muxer of the vod media. :return: 0 on success, -1 on error. """ return libvlc_vlm_add_vod( self, str_to_bytes(psz_name), str_to_bytes(psz_input), i_options, ppsz_options, b_enabled, str_to_bytes(psz_mux), ) def vlm_change_media( self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop, ): """Edit the parameters of a media. This will delete all existing inputs and add the specified one. :param psz_name: the name of the new broadcast. :param psz_input: the input MRL. :param psz_output: the output MRL (the parameter to the "sout" variable). :param i_options: number of additional options. :param ppsz_options: additional options. :param b_enabled: boolean for enabling the new broadcast. :param b_loop: Should this broadcast be played in loop ? :return: 0 on success, -1 on error. """ return libvlc_vlm_change_media( self, str_to_bytes(psz_name), str_to_bytes(psz_input), str_to_bytes(psz_output), i_options, ppsz_options, b_enabled, b_loop, ) def vlm_del_media(self, psz_name): """Delete a media (VOD or broadcast). :param psz_name: the media to delete. :return: 0 on success, -1 on error. """ return libvlc_vlm_del_media(self, str_to_bytes(psz_name)) @memoize_parameterless def vlm_get_event_manager(self): """Get libvlc_event_manager from a vlm media. The p_event_manager is immutable, so you don't have to hold the lock :return: libvlc_event_manager. """ return libvlc_vlm_get_event_manager(self) def vlm_get_media_instance_length(self, psz_name, i_instance): """Get vlm_media instance length by name or instance id :param psz_name: name of vlm media instance. :param i_instance: instance id. :return: length of media item or -1 on error. """ return libvlc_vlm_get_media_instance_length( self, str_to_bytes(psz_name), i_instance ) def vlm_get_media_instance_position(self, psz_name, i_instance): """Get vlm_media instance position by name or instance id :param psz_name: name of vlm media instance. :param i_instance: instance id. :return: position as float or -1. on error. """ return libvlc_vlm_get_media_instance_position( self, str_to_bytes(psz_name), i_instance ) def vlm_get_media_instance_rate(self, psz_name, i_instance): """Get vlm_media instance playback rate by name or instance id :param psz_name: name of vlm media instance. :param i_instance: instance id. :return: playback rate or -1 on error. """ return libvlc_vlm_get_media_instance_rate( self, str_to_bytes(psz_name), i_instance ) def vlm_get_media_instance_time(self, psz_name, i_instance): """Get vlm_media instance time by name or instance id :param psz_name: name of vlm media instance. :param i_instance: instance id. :return: time as integer or -1 on error. """ return libvlc_vlm_get_media_instance_time( self, str_to_bytes(psz_name), i_instance ) def vlm_pause_media(self, psz_name): """Pause the named broadcast. :param psz_name: the name of the broadcast. :return: 0 on success, -1 on error. """ return libvlc_vlm_pause_media(self, str_to_bytes(psz_name)) def vlm_play_media(self, psz_name): """Play the named broadcast. :param psz_name: the name of the broadcast. :return: 0 on success, -1 on error. """ return libvlc_vlm_play_media(self, str_to_bytes(psz_name)) def vlm_release(self): """Release the vlm instance related to the given :class:`Instance`""" return libvlc_vlm_release(self) def vlm_seek_media(self, psz_name, f_percentage): """Seek in the named broadcast. :param psz_name: the name of the broadcast. :param f_percentage: the percentage to seek to. :return: 0 on success, -1 on error. """ return libvlc_vlm_seek_media(self, str_to_bytes(psz_name), f_percentage) def vlm_set_enabled(self, psz_name, b_enabled): """Enable or disable a media (VOD or broadcast). :param psz_name: the media to work on. :param b_enabled: the new status. :return: 0 on success, -1 on error. """ return libvlc_vlm_set_enabled(self, str_to_bytes(psz_name), b_enabled) def vlm_set_input(self, psz_name, psz_input): """Set a media's input MRL. This will delete all existing inputs and add the specified one. :param psz_name: the media to work on. :param psz_input: the input MRL. :return: 0 on success, -1 on error. """ return libvlc_vlm_set_input( self, str_to_bytes(psz_name), str_to_bytes(psz_input) ) def vlm_set_loop(self, psz_name, b_loop): """Set a media's loop status. :param psz_name: the media to work on. :param b_loop: the new status. :return: 0 on success, -1 on error. """ return libvlc_vlm_set_loop(self, str_to_bytes(psz_name), b_loop) def vlm_set_mux(self, psz_name, psz_mux): """Set a media's vod muxer. :param psz_name: the media to work on. :param psz_mux: the new muxer. :return: 0 on success, -1 on error. """ return libvlc_vlm_set_mux(self, str_to_bytes(psz_name), str_to_bytes(psz_mux)) def vlm_set_output(self, psz_name, psz_output): """Set the output for a media. :param psz_name: the media to work on. :param psz_output: the output MRL (the parameter to the "sout" variable). :return: 0 on success, -1 on error. """ return libvlc_vlm_set_output( self, str_to_bytes(psz_name), str_to_bytes(psz_output) ) def vlm_show_media(self, psz_name): """Return information about the named media as a JSON string representation. This function is mainly intended for debugging use, if you want programmatic access to the state of a vlm_media_instance_t, please use the corresponding libvlc_vlm_get_media_instance_xxx -functions. Currently there are no such functions available for vlm_media_t though. :param psz_name: the name of the media, if the name is an empty string, all media is described. :return: string with information about named media, or None on error. """ return libvlc_vlm_show_media(self, str_to_bytes(psz_name)) def vlm_stop_media(self, psz_name): """Stop the named broadcast. :param psz_name: the name of the broadcast. :return: 0 on success, -1 on error. """ return libvlc_vlm_stop_media(self, str_to_bytes(psz_name)) def wait(self): """Waits until an interface causes the instance to exit. You should start at least one interface first, using :func:`add_intf`. .. warning:: This function wastes one thread doing basically nothing. :func:`set_exit_handler` should be used instead. """ return libvlc_wait(self) class LogIterator(_Ctype): """Create a new VLC log iterator.""" def __new__(cls, ptr=_internal_guard): """(INTERNAL) ctypes wrapper constructor.""" return _Constructor(cls, ptr) def __iter__(self): return self def next(self): if self.has_next(): b = LogMessage() i = libvlc_log_iterator_next(self, b) return i.contents raise StopIteration def __next__(self): return self.next() def free(self): """Frees memory allocated by :func:`log_get_iterator`.""" return libvlc_log_iterator_free(self) def has_next(self): """Always returns zero. This function is only provided for backward compatibility. :return: always zero. """ return libvlc_log_iterator_has_next(self) class Media(_Ctype): """Usage: .. code-block:: python Media(MRL, *options) See :meth:`Instance.media_new` documentation for details. """ def __new__(cls, *args): if args: i = args[0] if isinstance(i, _Ints): return _Constructor(cls, i) if isinstance(i, Instance): return i.media_new(*args[1:]) o = get_default_instance().media_new(*args) return o def get_instance(self): return getattr(self, "_instance", None) def add_options(self, *options): """Add a list of options to the media. .. note:: Options must be written without the double-dash. .. warning:: Most audio and video options, such as text renderer, have no effects on an individual media. These options must be set at the :class:`Instance` or :class:`MediaPlayer` instanciation. :param options: optional media option=value strings """ for o in options: self.add_option(o) def tracks_get(self): """Get media descriptor's elementary streams description. .. note:: You need to call :meth:`parse` or play the media at least once before calling this function. Not doing this will result in an empty array. .. note:: The result must be freed with :meth:`tracks_release`. :version: LibVLC 2.1.0 and later. """ mediaTrack_pp = ctypes.POINTER(MediaTrack)() n = libvlc_media_tracks_get(self, ctypes.byref(mediaTrack_pp)) info = ctypes.cast( mediaTrack_pp, ctypes.POINTER(ctypes.POINTER(MediaTrack) * n) ) try: contents = info.contents except ValueError: # Media not parsed, no info. return None tracks = (contents[i].contents for i in range(len(contents))) # libvlc_media_tracks_release(mediaTrack_pp, n) return tracks def add_option(self, psz_options): """Add an option to the media. This option will be used to determine how the media_player will read the media. This allows to use VLC's advanced reading/streaming options on a per-media basis. .. note:: The options are listed in 'vlc --long-help' from the command line, e.g. "-sout-all". Keep in mind that available options and their semantics vary across LibVLC versions and builds. .. warning:: Not all options affects :class:`Media` objects: Specifically, due to architectural issues most audio and video options, such as text renderer options, have no effects on an individual media. These options must be set through :func:`new` instead. :param psz_options: the options (as a string). """ return libvlc_media_add_option(self, str_to_bytes(psz_options)) def add_option_flag(self, psz_options, i_flags): """Add an option to the media with configurable flags. This option will be used to determine how the media_player will read the media. This allows to use VLC's advanced reading/streaming options on a per-media basis. The options are detailed in vlc --long-help, for instance "--sout-all". Note that all options are not usable on medias: specifically, due to architectural issues, video-related options such as text renderer options cannot be set on a single media. They must be set on the whole libvlc instance instead. :param psz_options: the options (as a string). :param i_flags: the flags for this option. """ return libvlc_media_add_option_flag(self, str_to_bytes(psz_options), i_flags) def duplicate(self): """Duplicate a media descriptor object.""" return libvlc_media_duplicate(self) @memoize_parameterless def event_manager(self): """Get event manager from media descriptor object. NOTE: this function doesn't increment reference counting. :return: event manager object. """ return libvlc_media_event_manager(self) def get_duration(self): """Get duration (in ms) of media descriptor object item. :return: duration of media item or -1 on error. """ return libvlc_media_get_duration(self) def get_meta(self, e_meta): """Read the meta of the media. If the media has not yet been parsed this will return None. See :func:`parse` See :func:`parse_with_options` See libvlc_MediaMetaChanged :param e_meta: the meta to read. :return: the media's meta. """ return libvlc_media_get_meta(self, e_meta) def get_mrl(self): """Get the media resource locator (mrl) from a media descriptor object :return: string with mrl of media descriptor object. """ return libvlc_media_get_mrl(self) def get_parsed_status(self): """Get Parsed status for media descriptor object. See libvlc_MediaParsedChanged See :class:`MediaParsedStatus` :return: a value of the :class:`MediaParsedStatus` enum. :version: LibVLC 3.0.0 or later. """ return libvlc_media_get_parsed_status(self) def get_state(self): """Get current state of media descriptor object. Possible media states are libvlc_NothingSpecial=0, libvlc_Opening, libvlc_Playing, libvlc_Paused, libvlc_Stopped, libvlc_Ended, libvlc_Error. See :class:`State`. :return: state of media descriptor object. """ return libvlc_media_get_state(self) def get_stats(self, p_stats): """Get the current statistics about the media. :param p_stats:: structure that contain the statistics about the media. (this structure must be allocated by the caller). :return: true if the statistics are available, false otherwise. """ return libvlc_media_get_stats(self, p_stats) def get_tracks_info(self): """Get media descriptor's elementary streams description Note, you need to call :func:`parse` or play the media at least once before calling this function. Not doing this will result in an empty array. .. warning:: **Deprecated!** Use :func:`tracks_get` instead :param tracks: address to store an allocated array of Elementary Streams. descriptions (must be freed by the caller) [OUT]. :return: the number of Elementary Streams. """ return libvlc_media_get_tracks_info(self) def get_type(self): """Get the media type of the media descriptor object See :class:`MediaType` :return: media type. :version: LibVLC 3.0.0 and later. """ return libvlc_media_get_type(self) def get_user_data(self): """Get media descriptor's user_data. user_data is specialized data accessed by the host application, VLC.framework uses it as a pointer to an native object that references a :class:`Media` pointer """ return libvlc_media_get_user_data(self) def is_parsed(self): """Return true is the media descriptor object is parsed .. warning:: **Deprecated!** This can return true in case of failure. Use :func:`get_parsed_status` instead See libvlc_MediaParsedChanged :return: true if media object has been parsed otherwise it returns false. """ return libvlc_media_is_parsed(self) def parse(self): """Parse a media. This fetches (local) art, meta data and tracks information. The method is synchronous. .. warning:: **Deprecated!** This function could block indefinitely. Use :func:`parse_with_options` instead See :func:`parse_with_options` See :func:`get_meta` See :func:`get_tracks_info` """ return libvlc_media_parse(self) def parse_async(self): """Parse a media. This fetches (local) art, meta data and tracks information. The method is the asynchronous of :func:`parse`. To track when this is over you can listen to libvlc_MediaParsedChanged event. However if the media was already parsed you will not receive this event. .. warning:: **Deprecated!** You can't be sure to receive the libvlc_MediaParsedChanged event (you can wait indefinitely for this event). Use :func:`parse_with_options` instead See :func:`parse` See libvlc_MediaParsedChanged See :func:`get_meta` See :func:`get_tracks_info` """ return libvlc_media_parse_async(self) def parse_stop(self): """Stop the parsing of the media When the media parsing is stopped, the libvlc_MediaParsedChanged event will be sent with the libvlc_media_parsed_status_timeout status. See :func:`parse_with_options` :version: LibVLC 3.0.0 or later. """ return libvlc_media_parse_stop(self) def parse_with_options(self, parse_flag, timeout): """Parse the media asynchronously with options. This fetches (local or network) art, meta data and/or tracks information. This method is the extended version of :func:`parse_with_options`. To track when this is over you can listen to libvlc_MediaParsedChanged event. However if this functions returns an error, you will not receive any events. It uses a flag to specify parse options (see libvlc_media_parse_flag_t). All these flags can be combined. By default, media is parsed if it's a local file. .. note:: Parsing can be aborted with :func:`parse_stop`. See libvlc_MediaParsedChanged See :func:`get_meta` See :func:`tracks_get` See :func:`get_parsed_status` See :class:`MediaParseFlag` :param parse_flag: parse options: :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). :return: -1 in case of error, 0 otherwise. :version: LibVLC 3.0.0 or later. """ return libvlc_media_parse_with_options(self, parse_flag, timeout) def player_new_from_media(self): """Create a Media Player object from a Media destroyed. :return: a new media player object, or None on error. """ return libvlc_media_player_new_from_media(self) def release(self): """Decrement the reference count of a media descriptor object. If the reference count is 0, then :func:`release` will release the media descriptor object. It will send out an libvlc_MediaFreed event to all listeners. If the media descriptor object has been released it should not be used again. """ return libvlc_media_release(self) def retain(self): """Retain a reference to a media descriptor object (libvlc_media_t). Use :func:`release` to decrement the reference count of a media descriptor object. """ return libvlc_media_retain(self) def save_meta(self): """Save the meta previously set :return: true if the write operation was successful. """ return libvlc_media_save_meta(self) def set_meta(self, e_meta, psz_value): """Set the meta of the media (this function will not save the meta, call :func:`save_meta` in order to save the meta) :param e_meta: the meta to write. :param psz_value: the media's meta. """ return libvlc_media_set_meta(self, e_meta, str_to_bytes(psz_value)) def set_user_data(self, p_new_user_data): """Sets media descriptor's user_data. user_data is specialized data accessed by the host application, VLC.framework uses it as a pointer to an native object that references a :class:`Media` pointer :param p_new_user_data: pointer to user data. """ return libvlc_media_set_user_data(self, p_new_user_data) def slaves_add(self, i_type, i_priority, psz_uri): """Add a slave to the current media. A slave is an external input source that may contains an additional subtitle track (like a .srt) or an additional audio track (like a .ac3). .. note:: This function must be called before the media is parsed (via libvlc_media_parse_with_options) or before the media is played (via libvlc_media_player_play) :param i_type: subtitle or audio. :param i_priority: from 0 (low priority) to 4 (high priority). :param psz_uri: Uri of the slave (should contain a valid scheme). :return: 0 on success, -1 on error. :version: LibVLC 3.0.0 and later. """ return libvlc_media_slaves_add(self, i_type, i_priority, str_to_bytes(psz_uri)) def slaves_clear(self): """Clear all slaves previously added by :func:`slaves_add` or internally. :version: LibVLC 3.0.0 and later. """ return libvlc_media_slaves_clear(self) def slaves_get(self, ppp_slaves): """Get a media descriptor's slave list The list will contain slaves parsed by VLC or previously added by :func:`slaves_add`. The typical use case of this function is to save a list of slave in a database for a later use. See :func:`slaves_add` :param ppp_slaves: address to store an allocated array of slaves (must be. freed with libvlc_media_slaves_release) [OUT]. :return: the number of slaves (zero on error). :version: LibVLC 3.0.0 and later. """ return libvlc_media_slaves_get(self, ppp_slaves) def subitems(self): """Get subitems of media descriptor object. This will increment the reference count of supplied media descriptor object. Use :func:`list_release` to decrement the reference counting. :return: list of media descriptor subitems or None. """ return libvlc_media_subitems(self) class MediaDiscoverer(_Ctype): def __new__(cls, ptr=_internal_guard): """(INTERNAL) ctypes wrapper constructor.""" return _Constructor(cls, ptr) @memoize_parameterless def event_manager(self): """Get event manager from media service discover object. .. warning:: **Deprecated!** Useless, media_discoverer events are only triggered when calling :func:`start` and :func:`stop`. :return: event manager object. """ return libvlc_media_discoverer_event_manager(self) def is_running(self): """Query if media service discover object is running. :return: true if running, false if not. """ return libvlc_media_discoverer_is_running(self) def localized_name(self): """Get media service discover object its localized name. .. warning:: **Deprecated!** Useless, use :func:`list_get` to get the longname of the service discovery. :return: localized name or None if the media_discoverer is not started. """ return libvlc_media_discoverer_localized_name(self) def media_list(self): """Get media service discover media list. :return: list of media items. """ return libvlc_media_discoverer_media_list(self) def release(self): """Release media discover object. If the reference count reaches 0, then the object will be released. """ return libvlc_media_discoverer_release(self) def start(self): """Start media discovery. To stop it, call :func:`stop` or :func:`list_release` directly. See :func:`stop` :return: -1 in case of error, 0 otherwise. :version: LibVLC 3.0.0 or later. """ return libvlc_media_discoverer_start(self) def stop(self): """Stop media discovery. See :func:`start` :version: LibVLC 3.0.0 or later. """ return libvlc_media_discoverer_stop(self) class MediaLibrary(_Ctype): def __new__(cls, ptr=_internal_guard): """(INTERNAL) ctypes wrapper constructor.""" return _Constructor(cls, ptr) def load(self): """Load media library. :return: 0 on success, -1 on error. """ return libvlc_media_library_load(self) def media_list(self): """Get media library subitems. :return: media list subitems. """ return libvlc_media_library_media_list(self) def release(self): """Release media library object. This functions decrements the reference count of the media library object. If it reaches 0, then the object will be released. """ return libvlc_media_library_release(self) def retain(self): """Retain a reference to a media library object. This function will increment the reference counting for this object. Use :func:`release` to decrement the reference count. """ return libvlc_media_library_retain(self) class MediaList(_Ctype): """Usage: .. code-block:: python MediaList(list_of_MRLs) See :meth:`Instance.media_list_new` documentation for details. """ def __new__(cls, *args): if args: i = args[0] if isinstance(i, _Ints): return _Constructor(cls, i) if isinstance(i, Instance): return i.media_list_new(*args[1:]) o = get_default_instance().media_list_new(*args) return o def get_instance(self): return getattr(self, "_instance", None) def add_media(self, mrl): """Add :class:`Media` instance to media list. .. note:: The lock should be held upon entering this function. :param mrl: A :class:`Media` instance or a MRL. :return: 0 on success, -1 if the media list is read-only. """ mrl = try_fspath(mrl) if isinstance(mrl, str): mrl = (self.get_instance() or get_default_instance()).media_new(mrl) return libvlc_media_list_add_media(self, mrl) def count(self): """Get count on media list items The :func:`lock` should be held upon entering this function. :return: number of items in media list. """ return libvlc_media_list_count(self) def __len__(self): return libvlc_media_list_count(self) @memoize_parameterless def event_manager(self): """Get libvlc_event_manager from this media list instance. The p_event_manager is immutable, so you don't have to hold the lock :return: libvlc_event_manager. """ return libvlc_media_list_event_manager(self) def index_of_item(self, p_md): """Find index position of List media instance in media list. Warning: the function will return the first matched position. The :func:`lock` should be held upon entering this function. :param p_md: media instance. :return: position of media instance or -1 if media not found. """ return libvlc_media_list_index_of_item(self, p_md) def insert_media(self, p_md, i_pos): """Insert media instance in media list on a position The :func:`lock` should be held upon entering this function. :param p_md: a media instance. :param i_pos: position in array where to insert. :return: 0 on success, -1 if the media list is read-only. """ return libvlc_media_list_insert_media(self, p_md, i_pos) def is_readonly(self): """This indicates if this media list is read-only from a user point of view :return: 1 on readonly, 0 on readwrite. """ return libvlc_media_list_is_readonly(self) def item_at_index(self, i_pos): """List media instance in media list at a position The :func:`lock` should be held upon entering this function. :param i_pos: position in array where to insert. :return: media instance at position *i_pos*, or None if not found. In case of success, :func:`media_retain` is called to increase the refcount. on the media. """ return libvlc_media_list_item_at_index(self, i_pos) def __getitem__(self, i): return libvlc_media_list_item_at_index(self, i) def __iter__(self): for i in range(len(self)): yield self[i] def lock(self): """Get lock on media list items""" return libvlc_media_list_lock(self) def media(self): """Get media instance from this media list instance. This action will increase the refcount on the media instance. The :func:`lock` should NOT be held upon entering this function. :return: media instance. """ return libvlc_media_list_media(self) def release(self): """Release media list created with :func:`new`.""" return libvlc_media_list_release(self) def remove_index(self, i_pos): """Remove media instance from media list on a position The :func:`lock` should be held upon entering this function. :param i_pos: position in array where to insert. :return: 0 on success, -1 if the list is read-only or the item was not found. """ return libvlc_media_list_remove_index(self, i_pos) def retain(self): """Retain reference to a media list""" return libvlc_media_list_retain(self) def set_media(self, p_md): """Associate media instance with this media list instance. If another media instance was present it will be released. The :func:`lock` should NOT be held upon entering this function. :param p_md: media instance to add. """ return libvlc_media_list_set_media(self, p_md) def unlock(self): """Release lock on media list items The :func:`lock` should be held upon entering this function. """ return libvlc_media_list_unlock(self) class MediaListPlayer(_Ctype): """It may take as parameter either: * an :class:`Instance` * nothing """ def __new__(cls, arg=None): if arg is None: i = get_default_instance() elif isinstance(arg, Instance): i = arg elif isinstance(arg, _Ints): return _Constructor(cls, arg) else: raise TypeError("MediaListPlayer %r" % (arg,)) return i.media_list_player_new() def get_instance(self): """Return the associated :class:`Instance`.""" return self._instance @memoize_parameterless def event_manager(self): """Return the event manager of this media_list_player. :return: the event manager. """ return libvlc_media_list_player_event_manager(self) def get_media_player(self): """Get media player of the media_list_player instance. .. note:: the caller is responsible for releasing the returned instance. :return: media player instance. """ return libvlc_media_list_player_get_media_player(self) def get_state(self): """Get current libvlc_state of media list player :return: :class:`State` for media list player. """ return libvlc_media_list_player_get_state(self) def is_playing(self): """Is media list playing? :return: true for playing and false for not playing. """ return libvlc_media_list_player_is_playing(self) def next(self): """Play next item from media list :return: 0 upon success -1 if there is no next item. """ return libvlc_media_list_player_next(self) def pause(self): """Toggle pause (or resume) media list""" return libvlc_media_list_player_pause(self) def play(self): """Play media list""" return libvlc_media_list_player_play(self) def play_item(self, p_md): """Play the given media item :param p_md: the media instance. :return: 0 upon success, -1 if the media is not part of the media list. """ return libvlc_media_list_player_play_item(self, p_md) def play_item_at_index(self, i_index): """Play media list item at position index :param i_index: index in media list to play. :return: 0 upon success -1 if the item wasn't found. """ return libvlc_media_list_player_play_item_at_index(self, i_index) def __getitem__(self, i): return libvlc_media_list_player_play_item_at_index(self, i) def __iter__(self): for i in range(len(self)): yield self[i] def previous(self): """Play previous item from media list :return: 0 upon success -1 if there is no previous item. """ return libvlc_media_list_player_previous(self) def release(self): """Release a media_list_player after use Decrement the reference count of a media player object. If the reference count is 0, then :func:`release` will release the media player object. If the media player object has been released, then it should not be used again. """ return libvlc_media_list_player_release(self) def retain(self): """Retain a reference to a media player list object. Use :func:`release` to decrement reference count. """ return libvlc_media_list_player_retain(self) def set_media_list(self, p_mlist): """Set the media list associated with the player :param p_mlist: list of media. """ return libvlc_media_list_player_set_media_list(self, p_mlist) def set_media_player(self, p_mi): """Replace media player in media_list_player with this instance. :param p_mi: media player instance. """ return libvlc_media_list_player_set_media_player(self, p_mi) def set_pause(self, do_pause): """Pause or resume media list :param do_pause: play/resume if zero, pause if non-zero. :version: LibVLC 3.0.0 or later. """ return libvlc_media_list_player_set_pause(self, do_pause) def set_playback_mode(self, e_mode): """Sets the playback mode for the playlist :param e_mode: playback mode specification. """ return libvlc_media_list_player_set_playback_mode(self, e_mode) def stop(self): """Stop playing media list""" return libvlc_media_list_player_stop(self) class MediaPlayer(_Ctype): """It may take as parameter either: * a string (media URI), options... In this case, an :class:`Instance` will be created. * an :class:`Instance`, a string (media URI), options... """ def __new__(cls, *args): if len(args) == 1 and isinstance(args[0], _Ints): return _Constructor(cls, args[0]) if args and isinstance(args[0], Instance): instance = args[0] args = args[1:] else: instance = get_default_instance() o = instance.media_player_new() if args: o.set_media(instance.media_new(*args)) return o def get_instance(self): """Return the associated :class:`Instance`.""" return self._instance def set_mrl(self, mrl, *options): """Set the MRL to play. .. warning:: Most audio and video options, such as text renderer, have no effects on an individual media. These options must be set at the :class:`Instance` or :class:`MediaPlayer` instanciation. :param mrl: The MRL :param options: optional media option=value strings :return: the Media object """ m = self.get_instance().media_new(mrl, *options) self.set_media(m) return m def video_get_spu_description(self): """Get the description of available video subtitles.""" return track_description_list(libvlc_video_get_spu_description(self)) def video_get_track_description(self): """Get the description of available video tracks.""" return track_description_list(libvlc_video_get_track_description(self)) def audio_get_track_description(self): """Get the description of available audio tracks.""" return track_description_list(libvlc_audio_get_track_description(self)) def get_full_title_descriptions(self): """Get the full description of available titles. :return: The titles list. :version: LibVLC 3.0.0 and later. """ titleDescription_pp = ctypes.POINTER(TitleDescription)() n = libvlc_media_player_get_full_title_descriptions( self, ctypes.byref(titleDescription_pp) ) info = ctypes.cast( titleDescription_pp, ctypes.POINTER(ctypes.POINTER(TitleDescription) * n) ) try: contents = info.contents except ValueError: # Media not parsed, no info. return None descr = (contents[i].contents for i in range(len(contents))) return descr def get_full_chapter_descriptions(self, i_chapters_of_title): """Get the full description of available chapters. :param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1). :return: the chapters list :version: LibVLC 3.0.0 and later. """ chapterDescription_pp = ctypes.POINTER(ChapterDescription)() n = libvlc_media_player_get_full_chapter_descriptions( self, i_chapters_of_title, ctypes.byref(chapterDescription_pp) ) info = ctypes.cast( chapterDescription_pp, ctypes.POINTER(ctypes.POINTER(ChapterDescription) * n), ) try: contents = info.contents except ValueError: # Media not parsed, no info. return None descr = (contents[i].contents for i in range(len(contents))) return descr def video_get_size(self, num=0): """Get the video size in pixels as 2-tuple (width, height). :param num: video number (default 0). """ r = libvlc_video_get_size(self, num) if isinstance(r, tuple) and len(r) == 2: return r else: raise VLCException("invalid video number (%s)" % (num,)) def set_hwnd(self, drawable): """Set a Win32/Win64 API window handle (HWND). Specify where the media player should render its video output. If LibVLC was built without Win32/Win64 API output support, then this has no effects. :param drawable: windows handle of the drawable. """ if not isinstance(drawable, ctypes.c_void_p): drawable = ctypes.c_void_p(int(drawable)) libvlc_media_player_set_hwnd(self, drawable) def video_get_width(self, num=0): """Get the width of a video in pixels. :param num: video number (default 0). """ return self.video_get_size(num)[0] def video_get_height(self, num=0): """Get the height of a video in pixels. :param num: video number (default 0). """ return self.video_get_size(num)[1] def video_get_cursor(self, num=0): """Get the mouse pointer coordinates over a video as 2-tuple (x, y). Coordinates are expressed in terms of the decoded video resolution, **not** in terms of pixels on the screen/viewport. To get the latter, you must query your windowing system directly. Either coordinate may be negative or larger than the corresponding size of the video, if the cursor is outside the rendering area. .. warning:: The coordinates may be out-of-date if the pointer is not located on the video rendering area. LibVLC does not track the mouse pointer if the latter is outside the video widget. .. note:: LibVLC does not support multiple mouse pointers (but does support multiple input devices sharing the same pointer). :param num: video number (default 0). """ r = libvlc_video_get_cursor(self, num) if isinstance(r, tuple) and len(r) == 2: return r raise VLCException("invalid video number (%s)" % (num,)) def audio_get_channel(self): """Get current audio channel. :return: the audio channel See :class:`AudioOutputChannel`. """ return libvlc_audio_get_channel(self) def audio_get_delay(self): """Get current audio delay. :return: the audio delay (microseconds). :version: LibVLC 1.1.1 or later. """ return libvlc_audio_get_delay(self) def audio_get_mute(self): """Get current mute status. :return: the mute status (boolean) if defined, -1 if undefined/unapplicable. """ return libvlc_audio_get_mute(self) def audio_get_track(self): """Get current audio track. :return: the audio track ID or -1 if no active input. """ return libvlc_audio_get_track(self) def audio_get_track_count(self): """Get number of available audio tracks. :return: the number of available audio tracks (int), or -1 if unavailable. """ return libvlc_audio_get_track_count(self) def audio_get_volume(self): """Get current software audio volume. :return: the software volume in percents. (0 = mute, 100 = nominal / 0dB). """ return libvlc_audio_get_volume(self) def audio_output_device_enum(self): """Gets a list of potential audio output devices, See :func:`audio_output_device_set`. .. note:: Not all audio outputs support enumerating devices. The audio output may be functional even if the list is empty (None). .. note:: The list may not be exhaustive. .. warning:: Some audio output devices in the list might not actually work in some circumstances. By default, it is recommended to not specify any explicit audio device. :return: A None-terminated linked list of potential audio output devices. It must be freed with :func:`audio_output_device_list_release`. :version: LibVLC 2.2.0 or later. """ return libvlc_audio_output_device_enum(self) def audio_output_device_get(self): """Get the current audio output device identifier. This complements :func:`audio_output_device_set`. .. warning:: The initial value for the current audio output device identifier may not be set or may be some unknown value. A LibVLC application should compare this value against the known device identifiers (e.g. those that were previously retrieved by a call to :func:`audio_output_device_enum` or libvlc_audio_output_device_list_get) to find the current audio output device. It is possible that the selected audio output device changes (an external change) without a call to :func:`audio_output_device_set`. That may make this method unsuitable to use if a LibVLC application is attempting to track dynamic audio device changes as they happen. :return: the current audio output device identifier. None if no device is selected or in case of error. (the result must be released with free() or libvlc_free). :version: LibVLC 3.0.0 or later. """ return libvlc_audio_output_device_get(self) def audio_output_device_set(self, module, device_id): """Configures an explicit audio output device. If the *module* paramater is None, audio output will be moved to the device specified by the device identifier string immediately. This is the recommended usage. A list of adequate potential device strings can be obtained with :func:`audio_output_device_enum`. However passing None is supported in LibVLC version 2.2.0 and later only; in earlier versions, this function would have no effects when the module parameter was None. If the *module* parameter is not None, the device parameter of the corresponding audio output, if it exists, will be set to the specified string. Note that some audio output modules do not have such a parameter (notably MMDevice and PulseAudio). A list of adequate potential device strings can be obtained with :func:`audio_output_device_list_get`. .. note:: This function does not select the specified audio output plugin. :func:`audio_output_set` is used for that purpose. .. warning:: The syntax for the device parameter depends on the audio output. Some audio output modules require further parameters (e.g. a channels map in the case of ALSA). :param module: If None, current audio output module. if non-None, name of audio output module. (See libvlc_audio_output_t). :param device_id: device identifier string. :return: Nothing. Errors are ignored (this is a design bug). """ return libvlc_audio_output_device_set( self, str_to_bytes(module), str_to_bytes(device_id) ) def audio_output_get_device_type(self): """Stub for backward compatibility. :return: always -1. """ return libvlc_audio_output_get_device_type(self) def audio_output_set(self, psz_name): """Selects an audio output module. .. note:: Any change will take be effect only after playback is stopped and restarted. Audio output cannot be changed while playing. :param psz_name: name of audio output, use psz_name of See :class:`AudioOutput`. :return: 0 if function succeeded, -1 on error. """ return libvlc_audio_output_set(self, str_to_bytes(psz_name)) def audio_output_set_device_type(self, device_type): """Stub for backward compatibility.""" return libvlc_audio_output_set_device_type(self, device_type) def audio_set_callbacks(self, play, pause, resume, flush, drain, opaque): """Sets callbacks and private data for decoded audio. Use :func:`audio_set_format` or :func:`audio_set_format_callbacks` to configure the decoded audio format. .. note:: The audio callbacks override any other audio output mechanism. If the callbacks are set, LibVLC will **not** output audio in any way. :param play: callback to play audio samples (must not be None). :param pause: callback to pause playback (or None to ignore). :param resume: callback to resume playback (or None to ignore). :param flush: callback to flush audio buffers (or None to ignore). :param drain: callback to drain audio buffers (or None to ignore). :param opaque: private pointer for the audio callbacks (as first parameter). :version: LibVLC 2.0.0 or later. """ return libvlc_audio_set_callbacks( self, play, pause, resume, flush, drain, opaque ) def audio_set_channel(self, channel): """Set current audio *channel*. :param channel: the audio channel, See :class:`AudioOutputChannel`. :return: 0 on success, -1 on error. """ return libvlc_audio_set_channel(self, channel) def audio_set_delay(self, i_delay): """Set current audio delay. The audio delay will be reset to zero each time the media changes. :param i_delay: the audio delay (microseconds). :return: 0 on success, -1 on error. :version: LibVLC 1.1.1 or later. """ return libvlc_audio_set_delay(self, i_delay) def audio_set_format(self, format, rate, channels): """Sets a fixed decoded audio *format*. This only works in combination with :func:`audio_set_callbacks`, and is mutually exclusive with :func:`audio_set_format_callbacks`. :param format: a four-characters string identifying the sample format. (e.g. "S16N" or "f32l"). :param rate: sample rate (expressed in Hz). :param channels: channels count. :version: LibVLC 2.0.0 or later. """ return libvlc_audio_set_format(self, str_to_bytes(format), rate, channels) def audio_set_format_callbacks(self, setup, cleanup): """Sets decoded audio format via callbacks. This only works in combination with :func:`audio_set_callbacks`. :param setup: callback to select the audio format (cannot be None). :param cleanup: callback to release any allocated resources (or None). :version: LibVLC 2.0.0 or later. """ return libvlc_audio_set_format_callbacks(self, setup, cleanup) def audio_set_mute(self, status): """Set mute *status*. .. 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. :param status: If status is true then mute, otherwise unmute. """ return libvlc_audio_set_mute(self, status) def audio_set_track(self, i_track): """Set current audio track. :param i_track: the track ID (i_id field from track description). :return: 0 on success, -1 on error. """ return libvlc_audio_set_track(self, i_track) def audio_set_volume(self, i_volume): """Set current software audio volume. :param i_volume: the volume in percents (0 = mute, 100 = 0dB). :return: 0 if the volume was set, -1 if it was out of range. """ return libvlc_audio_set_volume(self, i_volume) def audio_set_volume_callback(self, set_volume): """Set callbacks and private data for decoded audio. This only works in combination with :func:`audio_set_callbacks`. Use :func:`audio_set_format` or :func:`audio_set_format_callbacks` to configure the decoded audio format. :param set_volume: callback to apply audio volume, or None to apply volume in software. :version: LibVLC 2.0.0 or later. """ return libvlc_audio_set_volume_callback(self, set_volume) def audio_toggle_mute(self): """Toggle mute status. .. 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 :func:`audio_set_mute`. """ return libvlc_audio_toggle_mute(self) def get_fullscreen(self): """Get current fullscreen status. :return: the fullscreen status (boolean). """ return libvlc_get_fullscreen(self) def add_slave(self, i_type, psz_uri, b_select): """Add a slave to the current media player. .. note:: If the player is playing, the slave will be added directly. This call will also update the slave list of the attached :class:`Media`. See :func:`media_slaves_add` :param i_type: subtitle or audio. :param psz_uri: Uri of the slave (should contain a valid scheme). :param b_select: True if this slave should be selected when it's loaded. :return: 0 on success, -1 on error. :version: LibVLC 3.0.0 and later. """ return libvlc_media_player_add_slave( self, i_type, str_to_bytes(psz_uri), b_select ) def can_pause(self): """Can this media player be paused? :return: true if the media player can pause. """ return libvlc_media_player_can_pause(self) @memoize_parameterless def event_manager(self): """Get the Event Manager from which the media player send event. :return: the event manager associated with p_mi. """ return libvlc_media_player_event_manager(self) def get_agl(self): """.. warning:: **Deprecated!** Use :func:`get_nsobject` instead.""" return libvlc_media_player_get_agl(self) def get_chapter(self): """Get movie chapter. :return: chapter number currently playing, or -1 if there is no media. """ return libvlc_media_player_get_chapter(self) def get_chapter_count(self): """Get movie chapter count :return: number of chapters in movie, or -1. """ return libvlc_media_player_get_chapter_count(self) def get_chapter_count_for_title(self, i_title): """Get title chapter count :param i_title: title. :return: number of chapters in title, or -1. """ return libvlc_media_player_get_chapter_count_for_title(self, i_title) def get_fps(self): """Get movie fps rate This function is provided for backward compatibility. It cannot deal with multiple video tracks. In LibVLC versions prior to 3.0, it would also fail if the file format did not convey the frame rate explicitly. .. warning:: **Deprecated!** Consider using :func:`media_tracks_get` instead. :return: frames per second (fps) for this playing movie, or 0 if unspecified. """ return libvlc_media_player_get_fps(self) def get_hwnd(self): """Get the Windows API window handle (HWND) previously set with :func:`set_hwnd`. The handle will be returned even if LibVLC is not currently outputting any video to it. :return: a window handle or None if there are none. """ return libvlc_media_player_get_hwnd(self) def get_length(self): """Get the current movie length (in ms). :return: the movie length (in ms), or -1 if there is no media. """ return libvlc_media_player_get_length(self) def get_media(self): """Get the media used by the media_player. :return: the media associated with *p_mi*, or None if no. media is associated. """ return libvlc_media_player_get_media(self) def get_nsobject(self): """Get the NSView handler previously set with :func:`set_nsobject`. :return: the NSView handler or 0 if none where set. """ return libvlc_media_player_get_nsobject(self) def get_position(self): """Get movie position as percentage between 0.0 and 1.0. :return: movie position, or -1. in case of error. """ return libvlc_media_player_get_position(self) def get_rate(self): """Get the requested movie play rate. .. warning:: Depending on the underlying media, the requested rate may be different from the real playback rate. :return: movie play rate. """ return libvlc_media_player_get_rate(self) def get_role(self): """Gets the media role. :return: the media player role (libvlc_media_player_role_t). :version: LibVLC 3.0.0 and later. """ return libvlc_media_player_get_role(self) def get_state(self): """Get current movie state :return: the current state of the media player (playing, paused, ...) See :class:`State`. """ return libvlc_media_player_get_state(self) def get_time(self): """Get the current movie time (in ms). :return: the movie time (in ms), or -1 if there is no media. """ return libvlc_media_player_get_time(self) def get_title(self): """Get movie title :return: title number currently playing, or -1. """ return libvlc_media_player_get_title(self) def get_title_count(self): """Get movie title count :return: title number count, or -1. """ return libvlc_media_player_get_title_count(self) def get_xwindow(self): """Get the X Window System window identifier previously set with :func:`set_xwindow`. Note that this will return the identifier even if VLC is not currently using it (for instance if it is playing an audio-only input). :return: an X window ID, or 0 if none where set. """ return libvlc_media_player_get_xwindow(self) def has_vout(self): """How many video outputs does this media player have? :return: the number of video outputs. """ return libvlc_media_player_has_vout(self) def is_playing(self): """is_playing :return: 1 if the media player is playing, 0 otherwise. """ return libvlc_media_player_is_playing(self) def is_seekable(self): """Is this media player seekable? :return: true if the media player can seek. """ return libvlc_media_player_is_seekable(self) def navigate(self, navigate): """Navigate through DVD Menu :param navigate: the Navigation mode. :version: libVLC 2.0.0 or later. """ return libvlc_media_player_navigate(self, navigate) def next_chapter(self): """Set next chapter (if applicable)""" return libvlc_media_player_next_chapter(self) def next_frame(self): """Display the next frame (if supported)""" return libvlc_media_player_next_frame(self) def pause(self): """Toggle pause (no effect if there is no media)""" return libvlc_media_player_pause(self) def play(self): """Play :return: 0 if playback started (and was already started), or -1 on error. """ return libvlc_media_player_play(self) def previous_chapter(self): """Set previous chapter (if applicable)""" return libvlc_media_player_previous_chapter(self) def program_scrambled(self): """Check if the current program is scrambled :return: true if the current program is scrambled. :version: LibVLC 2.2.0 or later. """ return libvlc_media_player_program_scrambled(self) def release(self): """Release a media_player after use Decrement the reference count of a media player object. If the reference count is 0, then :func:`release` will release the media player object. If the media player object has been released, then it should not be used again. """ return libvlc_media_player_release(self) def retain(self): """Retain a reference to a media player object. Use :func:`release` to decrement reference count. """ return libvlc_media_player_retain(self) def set_agl(self, drawable): """.. warning:: **Deprecated!** Use :func:`set_nsobject` instead.""" return libvlc_media_player_set_agl(self, drawable) def set_android_context(self, p_awindow_handler): """Set the android context. :param p_awindow_handler: org.videolan.libvlc.AWindow jobject owned by the. org.videolan.libvlc.MediaPlayer class from the libvlc-android project. :version: LibVLC 3.0.0 and later. """ return libvlc_media_player_set_android_context(self, p_awindow_handler) def set_chapter(self, i_chapter): """Set movie chapter (if applicable). :param i_chapter: chapter number to play. """ return libvlc_media_player_set_chapter(self, i_chapter) def set_equalizer(self, p_equalizer): """Apply new equalizer settings to a media player. The equalizer is first created by invoking :func:`audio_equalizer_new` or :func:`audio_equalizer_new_from_preset`. It is possible to apply new equalizer settings to a media player whether the media player is currently playing media or not. Invoking this method will immediately apply the new equalizer settings to the audio output of the currently playing media if there is any. If there is no currently playing media, the new equalizer settings will be applied later if and when new media is played. Equalizer settings will automatically be applied to subsequently played media. To disable the equalizer for a media player invoke this method passing None for the p_equalizer parameter. The media player does not keep a reference to the supplied equalizer so it is safe for an application to release the equalizer reference any time after this method returns. :param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player. :return: zero on success, -1 on error. :version: LibVLC 2.2.0 or later. """ return libvlc_media_player_set_equalizer(self, p_equalizer) def set_evas_object(self, p_evas_object): """Set the EFL Evas Object. :param p_evas_object: a valid EFL Evas Object (Evas_Object). :return: -1 if an error was detected, 0 otherwise. :version: LibVLC 3.0.0 and later. """ return libvlc_media_player_set_evas_object(self, p_evas_object) def set_media(self, p_md): """Set the media that will be used by the media_player. If any, previous md will be released. :param p_md: the Media. Afterwards the p_md can be safely. destroyed. """ return libvlc_media_player_set_media(self, p_md) def set_nsobject(self, drawable): """Set the NSView handler where the media player should render its video output. Use the vout called "macosx". The *drawable* is an NSObject that follow the VLCOpenGLVideoViewEmbedding protocol: .. code-block:: objectivec++ @protocol VLCOpenGLVideoViewEmbedding - (void)addVoutSubview:(NSView *)view; - (void)removeVoutSubview:(NSView *)view; @end Or it can be an NSView object. If you want to use it along with Qt see the QMacCocoaViewContainer. Then the following code should work: .. code-block:: objectivec++ NSView *video = [[NSView alloc] init]; QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent); libvlc_media_player_set_nsobject(mp, video); [video release]; You can find a live example in VLCVideoView in VLCKit.framework. :param drawable: the drawable that is either an NSView or an object following. the VLCOpenGLVideoViewEmbedding protocol. """ return libvlc_media_player_set_nsobject(self, drawable) def set_pause(self, do_pause): """Pause or resume (no effect if there is no media) :param do_pause: play/resume if zero, pause if non-zero. :version: LibVLC 1.1.1 or later. """ return libvlc_media_player_set_pause(self, do_pause) def set_position(self, f_pos): """Set movie position as percentage between 0.0 and 1.0. This has no effect if playback is not enabled. This might not work depending on the underlying input format and protocol. :param f_pos: the position. """ return libvlc_media_player_set_position(self, f_pos) def set_rate(self, rate): """Set movie play rate :param rate: movie play rate to set. :return: -1 if an error was detected, 0 otherwise (but even then, it might. not actually work depending on the underlying media protocol). """ return libvlc_media_player_set_rate(self, rate) def set_renderer(self, p_item): """Set a renderer to the media player .. note:: must be called before the first call of :func:`play` to take effect. See :func:`renderer_discoverer_new` :param p_item: an item discovered by :func:`renderer_discoverer_start`. :return: 0 on success, -1 on error. :version: LibVLC 3.0.0 or later. """ return libvlc_media_player_set_renderer(self, p_item) def set_role(self, role): """Sets the media *role*. :param role: the media player role (libvlc_media_player_role_t). :return: 0 on success, -1 on error. """ return libvlc_media_player_set_role(self, role) def set_time(self, i_time): """Set the movie time (in ms). This has no effect if no media is being played. Not all formats and protocols support this. :param i_time: the movie time (in ms). """ return libvlc_media_player_set_time(self, i_time) def set_title(self, i_title): """Set movie title :param i_title: title number to play. """ return libvlc_media_player_set_title(self, i_title) def set_video_title_display(self, position, timeout): """Set if, and how, the video title will be shown when media is played. :param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed. :param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable). :version: libVLC 2.1.0 or later. """ return libvlc_media_player_set_video_title_display(self, position, timeout) def set_xwindow(self, drawable): """Set an X Window System *drawable* where the media player should render its video output. The call takes effect when the playback starts. If it is already started, it might need to be stopped before changes apply. If LibVLC was built without X11 output support, then this function has no effects. By default, LibVLC will capture input events on the video rendering area. Use :func:`video_set_mouse_input` and :func:`video_set_key_input` to disable that and deliver events to the parent window / to the application instead. By design, the X11 protocol delivers input events to only one recipient. .. warning:: The application must call the XInitThreads() function from Xlib before :func:`new`, and before any call to XOpenDisplay() directly or via any other library. Failure to call XInitThreads() will seriously impede LibVLC performance. Calling XOpenDisplay() before XInitThreads() will eventually crash the process. That is a limitation of Xlib. .. note:: The specified identifier must correspond to an existing Input/Output class X11 window. Pixmaps are **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. :param drawable: X11 window ID. :bug: No more than one window handle per media player instance can be specified. If the media has multiple simultaneously active video tracks, extra tracks. will be rendered into external windows beyond the control of the. application. """ return libvlc_media_player_set_xwindow(self, drawable) def stop(self): """Stop (no effect if there is no media)""" return libvlc_media_player_stop(self) def will_play(self): """Is the player able to play :return: boolean. """ return libvlc_media_player_will_play(self) def set_fullscreen(self, b_fullscreen): """Enable or disable fullscreen. .. warning:: With most window managers, only a top-level windows can be in full-screen mode. Hence, this function will not operate properly if :func:`set_xwindow` was used to embed the video in a non-top-level window. In that case, the embedding window must be reparented to the root window **before** fullscreen mode is enabled. You will want to reparent it back to its normal parent when disabling fullscreen. :param b_fullscreen: boolean for fullscreen status. """ return libvlc_set_fullscreen(self, b_fullscreen) def toggle_fullscreen(self): """Toggle fullscreen status on non-embedded video outputs. .. warning:: The same limitations applies to this function as to :func:`set_fullscreen`. """ return libvlc_toggle_fullscreen(self) def toggle_teletext(self): """Toggle teletext transparent status on video output. .. warning:: **Deprecated!** use :func:`video_set_teletext` instead. """ return libvlc_toggle_teletext(self) def video_get_adjust_float(self, option): """Get float adjust *option*. :param option: adjust option to get, values of :class:`VideoAdjustOption`. :version: LibVLC 1.1.1 and later. """ return libvlc_video_get_adjust_float(self, option) def video_get_adjust_int(self, option): """Get integer adjust *option*. :param option: adjust option to get, values of :class:`VideoAdjustOption`. :version: LibVLC 1.1.1 and later. """ return libvlc_video_get_adjust_int(self, option) def video_get_aspect_ratio(self): """Get current video aspect ratio. :return: the video aspect ratio or None if unspecified. (the result must be released with free() or libvlc_free). """ return libvlc_video_get_aspect_ratio(self) def video_get_chapter_description(self, i_title): """Get the description of available chapters for specific title. :param i_title: selected title. :return: list containing description of available chapter for title *i_title*. It must be freed with :func:`track_description_list_release`. """ return libvlc_video_get_chapter_description(self, i_title) def video_get_crop_geometry(self): """Get current crop filter geometry. :return: the crop filter geometry or None if unset. """ return libvlc_video_get_crop_geometry(self) def video_get_logo_int(self, option): """Get integer logo *option*. :param option: logo option to get, values of :class:`VideoLogoOption`. """ return libvlc_video_get_logo_int(self, option) def video_get_marquee_int(self, option): """Get an integer marquee *option* value :param option: marq option to get See libvlc_video_marquee_int_option_t. """ return libvlc_video_get_marquee_int(self, option) def video_get_marquee_string(self, option): """Get a string marquee *option* value :param option: marq option to get See libvlc_video_marquee_string_option_t. """ return libvlc_video_get_marquee_string(self, option) def video_get_scale(self): """Get the current video scaling factor. See also :func:`video_set_scale`. :return: the currently configured zoom factor, or 0. if the video is set. to fit to the output window/drawable automatically. """ return libvlc_video_get_scale(self) def video_get_spu(self): """Get current video subtitle. :return: the video subtitle selected, or -1 if none. """ return libvlc_video_get_spu(self) def video_get_spu_count(self): """Get the number of available video subtitles. :return: the number of available video subtitles. """ return libvlc_video_get_spu_count(self) def video_get_spu_delay(self): """Get the current subtitle delay. Positive values means subtitles are being displayed later, negative values earlier. :return: time (in microseconds) the display of subtitles is being delayed. :version: LibVLC 2.0.0 or later. """ return libvlc_video_get_spu_delay(self) def video_get_teletext(self): """Get current teletext page requested or 0 if it's disabled. Teletext is disabled by default, call :func:`video_set_teletext` to enable it. :return: the current teletext page requested. """ return libvlc_video_get_teletext(self) def video_get_title_description(self): """Get the description of available titles. :return: list containing description of available titles. It must be freed with :func:`track_description_list_release`. """ return libvlc_video_get_title_description(self) def video_get_track(self): """Get current video track. :return: the video track ID (int) or -1 if no active input. """ return libvlc_video_get_track(self) def video_get_track_count(self): """Get number of available video tracks. :return: the number of available video tracks (int). """ return libvlc_video_get_track_count(self) def video_set_adjust_float(self, option, value): """Set adjust *option* as float. Options that take a different type value are ignored. :param option: adust option to set, values of :class:`VideoAdjustOption`. :param value: adjust option value. :version: LibVLC 1.1.1 and later. """ return libvlc_video_set_adjust_float(self, option, value) def video_set_adjust_int(self, option, value): """Set adjust *option* as integer. Options that take a different type value are ignored. Passing libvlc_adjust_enable as *option* *value* has the side effect of starting (arg !0) or stopping (arg 0) the adjust filter. :param option: adust option to set, values of :class:`VideoAdjustOption`. :param value: adjust option value. :version: LibVLC 1.1.1 and later. """ return libvlc_video_set_adjust_int(self, option, value) def video_set_aspect_ratio(self, psz_aspect): """Set new video aspect ratio. .. note:: Invalid aspect ratios are ignored. :param psz_aspect: new video aspect-ratio or None to reset to default. """ return libvlc_video_set_aspect_ratio(self, str_to_bytes(psz_aspect)) def video_set_callbacks(self, lock, unlock, display, opaque): """Set callbacks and private data to render decoded video to a custom area in memory. Use :func:`video_set_format` or :func:`video_set_format_callbacks` to configure the decoded format. .. warning:: Rendering video into custom memory buffers is considerably less efficient than rendering in a custom window as normal. For optimal perfomances, VLC media player renders into a custom window, and does not use this function and associated callbacks. It is **highly recommended** that other LibVLC-based application do likewise. To embed video in a window, use libvlc_media_player_set_xid or equivalent depending on the operating system. If window embedding does not fit the application use case, then a custom LibVLC video output *display* plugin is required to maintain optimal video rendering performances. The following limitations affect performance: * Hardware video decoding acceleration will either be disabled completely, or require (relatively slow) copy from video/DSP memory to main memory. * Sub-pictures (subtitles, on-screen *display*, etc.) must be blent into the main picture by the CPU instead of the GPU. * Depending on the video format, pixel format conversion, picture scaling, cropping and/or picture re-orientation, must be performed by the CPU instead of the GPU. * Memory copying is required between LibVLC reference picture buffers and application buffers (between *lock* and *unlock* callbacks). :param lock: callback to lock video memory (must not be None). :param unlock: callback to unlock video memory (or None if not needed). :param display: callback to display video (or None if not needed). :param opaque: private pointer for the three callbacks (as first parameter). :version: LibVLC 1.1.1 or later. """ return libvlc_video_set_callbacks(self, lock, unlock, display, opaque) def video_set_crop_geometry(self, psz_geometry): """Set new crop filter geometry. :param psz_geometry: new crop filter geometry (None to unset). """ return libvlc_video_set_crop_geometry(self, str_to_bytes(psz_geometry)) def video_set_deinterlace(self, psz_mode): """Enable or disable deinterlace filter :param psz_mode: type of deinterlace filter, None to disable. """ return libvlc_video_set_deinterlace(self, str_to_bytes(psz_mode)) def video_set_format(self, chroma, width, height, pitch): """Set decoded video *chroma* and dimensions. This only works in combination with :func:`video_set_callbacks`, and is mutually exclusive with :func:`video_set_format_callbacks`. :param chroma: a four-characters string identifying the chroma. (e.g. "RV32" or "YUYV"). :param width: pixel width. :param height: pixel height. :param pitch: line pitch (in bytes). :version: LibVLC 1.1.1 or later. :bug: All pixel planes are expected to have the same *pitch*. To use the YCbCr color space with chrominance subsampling, consider using :func:`video_set_format_callbacks` instead. """ return libvlc_video_set_format(self, str_to_bytes(chroma), width, height, pitch) def video_set_format_callbacks(self, setup, cleanup): """Set decoded video chroma and dimensions. This only works in combination with :func:`video_set_callbacks`. :param setup: callback to select the video format (cannot be None). :param cleanup: callback to release any allocated resources (or None). :version: LibVLC 2.0.0 or later. """ return libvlc_video_set_format_callbacks(self, setup, cleanup) def video_set_key_input(self, on): """Enable or disable key press events handling, according to the LibVLC hotkeys configuration. By default and for historical reasons, keyboard events are handled by the LibVLC video widget. .. note:: On X11, there can be only one subscriber for key press and mouse click events per window. If your application has subscribed to those events for the X window ID of the video widget, then LibVLC will not be able to handle key presses and mouse clicks in any case. .. warning:: This function is only implemented for X11 and Win32 at the moment. :param on: true to handle key press events, false to ignore them. """ return libvlc_video_set_key_input(self, on) def video_set_logo_int(self, option, value): """Set logo *option* as integer. Options that take a different type value are ignored. Passing libvlc_logo_enable as *option* *value* has the side effect of starting (arg !0) or stopping (arg 0) the logo filter. :param option: logo option to set, values of :class:`VideoLogoOption`. :param value: logo option value. """ return libvlc_video_set_logo_int(self, option, value) def video_set_logo_string(self, option, psz_value): """Set logo *option* as string. Options that take a different type value are ignored. :param option: logo option to set, values of :class:`VideoLogoOption`. :param psz_value: logo option value. """ return libvlc_video_set_logo_string(self, option, str_to_bytes(psz_value)) def video_set_marquee_int(self, option, i_val): """Enable, disable or set an integer marquee option Setting libvlc_marquee_Enable has the side effect of enabling (arg !0) or disabling (arg 0) the marq filter. :param option: marq option to set See libvlc_video_marquee_int_option_t. :param i_val: marq option value. """ return libvlc_video_set_marquee_int(self, option, i_val) def video_set_marquee_string(self, option, psz_text): """Set a marquee string option :param option: marq option to set See libvlc_video_marquee_string_option_t. :param psz_text: marq option value. """ return libvlc_video_set_marquee_string(self, option, str_to_bytes(psz_text)) def video_set_mouse_input(self, on): """Enable or disable mouse click events handling. By default, those events are handled. This is needed for DVD menus to work, as well as a few video filters such as "puzzle". See :func:`video_set_key_input`. .. warning:: This function is only implemented for X11 and Win32 at the moment. :param on: true to handle mouse click events, false to ignore them. """ return libvlc_video_set_mouse_input(self, on) def video_set_scale(self, f_factor): """Set the video scaling factor. That is the ratio of the number of pixels on screen to the number of pixels in the original decoded video in each dimension. Zero is a special value; it will adjust the video to the output window/drawable (in windowed mode) or the entire screen. Note that not all video outputs support scaling. :param f_factor: the scaling factor, or zero. """ return libvlc_video_set_scale(self, f_factor) def video_set_spu(self, i_spu): """Set new video subtitle. :param i_spu: video subtitle track to select (i_id from track description). :return: 0 on success, -1 if out of range. """ return libvlc_video_set_spu(self, i_spu) def video_set_spu_delay(self, i_delay): """Set the subtitle delay. This affects the timing of when the subtitle will be displayed. Positive values result in subtitles being displayed later, while negative values will result in subtitles being displayed earlier. The subtitle delay will be reset to zero each time the media changes. :param i_delay: time (in microseconds) the display of subtitles should be delayed. :return: 0 on success, -1 on error. :version: LibVLC 2.0.0 or later. """ return libvlc_video_set_spu_delay(self, i_delay) def video_set_subtitle_file(self, psz_subtitle): """Set new video subtitle file. .. warning:: **Deprecated!** Use :func:`add_slave` instead. :param psz_subtitle: new video subtitle file. :return: the success status (boolean). """ return libvlc_video_set_subtitle_file(self, str_to_bytes(psz_subtitle)) def video_set_teletext(self, i_page): """Set new teletext page to retrieve. This function can also be used to send a teletext key. :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. :class:`TeletextKey`. 100 is the default teletext page. """ return libvlc_video_set_teletext(self, i_page) def video_set_track(self, i_track): """Set video track. :param i_track: the track ID (i_id field from track description). :return: 0 on success, -1 if out of range. """ return libvlc_video_set_track(self, i_track) def video_take_snapshot(self, num, psz_filepath, i_width, i_height): """Take a snapshot of the current video window. If *i_width* AND *i_height* is 0, original size is used. If *i_width* XOR *i_height* is 0, original aspect-ratio is preserved. :param num: number of video output (typically 0 for the first/only one). :param psz_filepath: the path of a file or a folder to save the screenshot into. :param i_width: the snapshot's width. :param i_height: the snapshot's height. :return: 0 on success, -1 if the video was not found. """ return libvlc_video_take_snapshot( self, num, str_to_bytes(psz_filepath), i_width, i_height ) def video_update_viewpoint(self, p_viewpoint, b_absolute): """Update the video viewpoint information. .. note:: It is safe to call this function before the media player is started. .. note:: the values are set asynchronously, it will be used by the next frame displayed. :param p_viewpoint: video viewpoint allocated via :func:`video_new_viewpoint`. :param b_absolute: if true replace the old viewpoint with the new one. If. false, increase/decrease it. :return: -1 in case of error, 0 otherwise. :version: LibVLC 3.0.0 and later. """ return libvlc_video_update_viewpoint(self, p_viewpoint, b_absolute) class Renderer(_Ctype): def __new__(cls, ptr=_internal_guard): """(INTERNAL) ctypes wrapper constructor.""" return _Constructor(cls, ptr) def flags(self): """Get the flags of a renderer item See LIBVLC_RENDERER_CAN_AUDIO See LIBVLC_RENDERER_CAN_VIDEO :return: bitwise flag: capabilities of the renderer, see. :version: LibVLC 3.0.0 or later. """ return libvlc_renderer_item_flags(self) def hold(self): """Hold a renderer item, i.e. creates a new reference This functions need to called from the libvlc_RendererDiscovererItemAdded callback if the libvlc user wants to use this item after. (for display or for passing it to the mediaplayer for example). :return: the current item. :version: LibVLC 3.0.0 or later. """ return libvlc_renderer_item_hold(self) def icon_uri(self): """Get the icon uri of a renderer item :return: the uri of the item's icon (can be None, must *not* be freed). :version: LibVLC 3.0.0 or later. """ return libvlc_renderer_item_icon_uri(self) def name(self): """Get the human readable name of a renderer item :return: the name of the item (can't be None, must *not* be freed). :version: LibVLC 3.0.0 or later. """ return libvlc_renderer_item_name(self) def release(self): """Releases a renderer item, i.e. decrements its reference counter :version: LibVLC 3.0.0 or later. """ return libvlc_renderer_item_release(self) def type(self): """Get the type (not translated) of a renderer item. For now, the type can only be "chromecast" ("upnp", "airplay" may come later). :return: the type of the item (can't be None, must *not* be freed). :version: LibVLC 3.0.0 or later. """ return libvlc_renderer_item_type(self) class RendererDiscoverer(_Ctype): def __new__(cls, ptr=_internal_guard): """(INTERNAL) ctypes wrapper constructor.""" return _Constructor(cls, ptr) @memoize_parameterless def event_manager(self): """Get the event manager of the renderer discoverer The possible events to attach are libvlc_RendererDiscovererItemAdded and libvlc_RendererDiscovererItemDeleted. The :class:`Renderer` struct passed to event callbacks is owned by VLC, users should take care of holding/releasing this struct for their internal usage. See :class:`Event`.u.renderer_discoverer_item_added.item See :class:`Event`.u.renderer_discoverer_item_removed.item :return: a valid event manager (can't fail). :version: LibVLC 3.0.0 or later. """ return libvlc_renderer_discoverer_event_manager(self) def release(self): """Release a renderer discoverer object :version: LibVLC 3.0.0 or later. """ return libvlc_renderer_discoverer_release(self) def start(self): """Start renderer discovery To stop it, call :func:`stop` or :func:`release` directly. See :func:`stop` :return: -1 in case of error, 0 otherwise. :version: LibVLC 3.0.0 or later. """ return libvlc_renderer_discoverer_start(self) def stop(self): """Stop renderer discovery. See :func:`start` :version: LibVLC 3.0.0 or later. """ return libvlc_renderer_discoverer_stop(self) # End of generated wrappers # # Generated enum types # class AudioOutputChannel(_Enum): """Audio channels. Defined symbols: * ``vlc.AudioOutputChannel.Error`` * ``vlc.AudioOutputChannel.Stereo`` * ``vlc.AudioOutputChannel.RStereo`` * ``vlc.AudioOutputChannel.Left`` * ``vlc.AudioOutputChannel.Right`` * ``vlc.AudioOutputChannel.Dolbys`` """ _enum_names_ = { -1: "Error", 1: "Stereo", 2: "RStereo", 3: "Left", 4: "Right", 5: "Dolbys", } AudioOutputChannel.Dolbys = AudioOutputChannel(5) AudioOutputChannel.Error = AudioOutputChannel(-1) AudioOutputChannel.Left = AudioOutputChannel(3) AudioOutputChannel.RStereo = AudioOutputChannel(2) AudioOutputChannel.Right = AudioOutputChannel(4) AudioOutputChannel.Stereo = AudioOutputChannel(1) class AudioOutputDeviceTypes(_Enum): """Audio device types. Defined symbols: * ``vlc.AudioOutputDeviceTypes.Error`` * ``vlc.AudioOutputDeviceTypes.Mono`` * ``vlc.AudioOutputDeviceTypes.Stereo`` * ``vlc.AudioOutputDeviceTypes._2F2R`` * ``vlc.AudioOutputDeviceTypes._3F2R`` * ``vlc.AudioOutputDeviceTypes._5_1`` * ``vlc.AudioOutputDeviceTypes._6_1`` * ``vlc.AudioOutputDeviceTypes._7_1`` * ``vlc.AudioOutputDeviceTypes.SPDIF`` """ _enum_names_ = { -1: "Error", 1: "Mono", 2: "Stereo", 4: "_2F2R", 5: "_3F2R", 6: "_5_1", 7: "_6_1", 8: "_7_1", 10: "SPDIF", } AudioOutputDeviceTypes.Error = AudioOutputDeviceTypes(-1) AudioOutputDeviceTypes.Mono = AudioOutputDeviceTypes(1) AudioOutputDeviceTypes.SPDIF = AudioOutputDeviceTypes(10) AudioOutputDeviceTypes.Stereo = AudioOutputDeviceTypes(2) AudioOutputDeviceTypes._2F2R = AudioOutputDeviceTypes(4) AudioOutputDeviceTypes._3F2R = AudioOutputDeviceTypes(5) AudioOutputDeviceTypes._5_1 = AudioOutputDeviceTypes(6) AudioOutputDeviceTypes._6_1 = AudioOutputDeviceTypes(7) AudioOutputDeviceTypes._7_1 = AudioOutputDeviceTypes(8) class DialogQuestionType(_Enum): """ Defined symbols: * ``vlc.DialogQuestionType.DIALOG_QUESTION_NORMAL`` * ``vlc.DialogQuestionType.DIALOG_QUESTION_WARNING`` * ``vlc.DialogQuestionType.DIALOG_QUESTION_CRITICAL`` """ _enum_names_ = { 0: "DIALOG_QUESTION_NORMAL", 1: "DIALOG_QUESTION_WARNING", 2: "DIALOG_QUESTION_CRITICAL", } DialogQuestionType.DIALOG_QUESTION_CRITICAL = DialogQuestionType(2) DialogQuestionType.DIALOG_QUESTION_NORMAL = DialogQuestionType(0) DialogQuestionType.DIALOG_QUESTION_WARNING = DialogQuestionType(1) class EventType(_Enum): """Event types. Defined symbols: * ``vlc.EventType.MediaMetaChanged`` * ``vlc.EventType.MediaSubItemAdded`` * ``vlc.EventType.MediaDurationChanged`` * ``vlc.EventType.MediaParsedChanged`` * ``vlc.EventType.MediaFreed`` * ``vlc.EventType.MediaStateChanged`` * ``vlc.EventType.MediaSubItemTreeAdded`` * ``vlc.EventType.MediaPlayerMediaChanged`` * ``vlc.EventType.MediaPlayerNothingSpecial`` * ``vlc.EventType.MediaPlayerOpening`` * ``vlc.EventType.MediaPlayerBuffering`` * ``vlc.EventType.MediaPlayerPlaying`` * ``vlc.EventType.MediaPlayerPaused`` * ``vlc.EventType.MediaPlayerStopped`` * ``vlc.EventType.MediaPlayerForward`` * ``vlc.EventType.MediaPlayerBackward`` * ``vlc.EventType.MediaPlayerEndReached`` * ``vlc.EventType.MediaPlayerEncounteredError`` * ``vlc.EventType.MediaPlayerTimeChanged`` * ``vlc.EventType.MediaPlayerPositionChanged`` * ``vlc.EventType.MediaPlayerSeekableChanged`` * ``vlc.EventType.MediaPlayerPausableChanged`` * ``vlc.EventType.MediaPlayerTitleChanged`` * ``vlc.EventType.MediaPlayerSnapshotTaken`` * ``vlc.EventType.MediaPlayerLengthChanged`` * ``vlc.EventType.MediaPlayerVout`` * ``vlc.EventType.MediaPlayerScrambledChanged`` * ``vlc.EventType.MediaPlayerESAdded`` * ``vlc.EventType.MediaPlayerESDeleted`` * ``vlc.EventType.MediaPlayerESSelected`` * ``vlc.EventType.MediaPlayerCorked`` * ``vlc.EventType.MediaPlayerUncorked`` * ``vlc.EventType.MediaPlayerMuted`` * ``vlc.EventType.MediaPlayerUnmuted`` * ``vlc.EventType.MediaPlayerAudioVolume`` * ``vlc.EventType.MediaPlayerAudioDevice`` * ``vlc.EventType.MediaPlayerChapterChanged`` * ``vlc.EventType.MediaListItemAdded`` * ``vlc.EventType.MediaListWillAddItem`` * ``vlc.EventType.MediaListItemDeleted`` * ``vlc.EventType.MediaListWillDeleteItem`` * ``vlc.EventType.MediaListEndReached`` * ``vlc.EventType.MediaListViewItemAdded`` * ``vlc.EventType.MediaListViewWillAddItem`` * ``vlc.EventType.MediaListViewItemDeleted`` * ``vlc.EventType.MediaListViewWillDeleteItem`` * ``vlc.EventType.MediaListPlayerPlayed`` * ``vlc.EventType.MediaListPlayerNextItemSet`` * ``vlc.EventType.MediaListPlayerStopped`` * ``vlc.EventType.MediaDiscovererStarted`` .. warning:: **Deprecated!** Useless event, it will be triggered only when calling libvlc_media_discoverer_start() * ``vlc.EventType.MediaDiscovererEnded`` .. warning:: **Deprecated!** Useless event, it will be triggered only when calling libvlc_media_discoverer_stop() * ``vlc.EventType.RendererDiscovererItemAdded`` * ``vlc.EventType.RendererDiscovererItemDeleted`` * ``vlc.EventType.VlmMediaAdded`` * ``vlc.EventType.VlmMediaRemoved`` * ``vlc.EventType.VlmMediaChanged`` * ``vlc.EventType.VlmMediaInstanceStarted`` * ``vlc.EventType.VlmMediaInstanceStopped`` * ``vlc.EventType.VlmMediaInstanceStatusInit`` * ``vlc.EventType.VlmMediaInstanceStatusOpening`` * ``vlc.EventType.VlmMediaInstanceStatusPlaying`` * ``vlc.EventType.VlmMediaInstanceStatusPause`` * ``vlc.EventType.VlmMediaInstanceStatusEnd`` * ``vlc.EventType.VlmMediaInstanceStatusError`` """ _enum_names_ = { 0: "MediaMetaChanged", 1: "MediaSubItemAdded", 2: "MediaDurationChanged", 3: "MediaParsedChanged", 4: "MediaFreed", 5: "MediaStateChanged", 6: "MediaSubItemTreeAdded", 0x100: "MediaPlayerMediaChanged", 257: "MediaPlayerNothingSpecial", 258: "MediaPlayerOpening", 259: "MediaPlayerBuffering", 260: "MediaPlayerPlaying", 261: "MediaPlayerPaused", 262: "MediaPlayerStopped", 263: "MediaPlayerForward", 264: "MediaPlayerBackward", 265: "MediaPlayerEndReached", 266: "MediaPlayerEncounteredError", 267: "MediaPlayerTimeChanged", 268: "MediaPlayerPositionChanged", 269: "MediaPlayerSeekableChanged", 270: "MediaPlayerPausableChanged", 271: "MediaPlayerTitleChanged", 272: "MediaPlayerSnapshotTaken", 273: "MediaPlayerLengthChanged", 274: "MediaPlayerVout", 275: "MediaPlayerScrambledChanged", 276: "MediaPlayerESAdded", 277: "MediaPlayerESDeleted", 278: "MediaPlayerESSelected", 279: "MediaPlayerCorked", 280: "MediaPlayerUncorked", 281: "MediaPlayerMuted", 282: "MediaPlayerUnmuted", 283: "MediaPlayerAudioVolume", 284: "MediaPlayerAudioDevice", 285: "MediaPlayerChapterChanged", 0x200: "MediaListItemAdded", 513: "MediaListWillAddItem", 514: "MediaListItemDeleted", 515: "MediaListWillDeleteItem", 516: "MediaListEndReached", 0x300: "MediaListViewItemAdded", 769: "MediaListViewWillAddItem", 770: "MediaListViewItemDeleted", 771: "MediaListViewWillDeleteItem", 0x400: "MediaListPlayerPlayed", 1025: "MediaListPlayerNextItemSet", 1026: "MediaListPlayerStopped", 0x500: "MediaDiscovererStarted", 1281: "MediaDiscovererEnded", 1282: "RendererDiscovererItemAdded", 1283: "RendererDiscovererItemDeleted", 0x600: "VlmMediaAdded", 1537: "VlmMediaRemoved", 1538: "VlmMediaChanged", 1539: "VlmMediaInstanceStarted", 1540: "VlmMediaInstanceStopped", 1541: "VlmMediaInstanceStatusInit", 1542: "VlmMediaInstanceStatusOpening", 1543: "VlmMediaInstanceStatusPlaying", 1544: "VlmMediaInstanceStatusPause", 1545: "VlmMediaInstanceStatusEnd", 1546: "VlmMediaInstanceStatusError", } EventType.MediaDiscovererEnded = EventType(1281) EventType.MediaDiscovererStarted = EventType(0x500) EventType.MediaDurationChanged = EventType(2) EventType.MediaFreed = EventType(4) EventType.MediaListEndReached = EventType(516) EventType.MediaListItemAdded = EventType(0x200) EventType.MediaListItemDeleted = EventType(514) EventType.MediaListPlayerNextItemSet = EventType(1025) EventType.MediaListPlayerPlayed = EventType(0x400) EventType.MediaListPlayerStopped = EventType(1026) EventType.MediaListViewItemAdded = EventType(0x300) EventType.MediaListViewItemDeleted = EventType(770) EventType.MediaListViewWillAddItem = EventType(769) EventType.MediaListViewWillDeleteItem = EventType(771) EventType.MediaListWillAddItem = EventType(513) EventType.MediaListWillDeleteItem = EventType(515) EventType.MediaMetaChanged = EventType(0) EventType.MediaParsedChanged = EventType(3) EventType.MediaPlayerAudioDevice = EventType(284) EventType.MediaPlayerAudioVolume = EventType(283) EventType.MediaPlayerBackward = EventType(264) EventType.MediaPlayerBuffering = EventType(259) EventType.MediaPlayerChapterChanged = EventType(285) EventType.MediaPlayerCorked = EventType(279) EventType.MediaPlayerESAdded = EventType(276) EventType.MediaPlayerESDeleted = EventType(277) EventType.MediaPlayerESSelected = EventType(278) EventType.MediaPlayerEncounteredError = EventType(266) EventType.MediaPlayerEndReached = EventType(265) EventType.MediaPlayerForward = EventType(263) EventType.MediaPlayerLengthChanged = EventType(273) EventType.MediaPlayerMediaChanged = EventType(0x100) EventType.MediaPlayerMuted = EventType(281) EventType.MediaPlayerNothingSpecial = EventType(257) EventType.MediaPlayerOpening = EventType(258) EventType.MediaPlayerPausableChanged = EventType(270) EventType.MediaPlayerPaused = EventType(261) EventType.MediaPlayerPlaying = EventType(260) EventType.MediaPlayerPositionChanged = EventType(268) EventType.MediaPlayerScrambledChanged = EventType(275) EventType.MediaPlayerSeekableChanged = EventType(269) EventType.MediaPlayerSnapshotTaken = EventType(272) EventType.MediaPlayerStopped = EventType(262) EventType.MediaPlayerTimeChanged = EventType(267) EventType.MediaPlayerTitleChanged = EventType(271) EventType.MediaPlayerUncorked = EventType(280) EventType.MediaPlayerUnmuted = EventType(282) EventType.MediaPlayerVout = EventType(274) EventType.MediaStateChanged = EventType(5) EventType.MediaSubItemAdded = EventType(1) EventType.MediaSubItemTreeAdded = EventType(6) EventType.RendererDiscovererItemAdded = EventType(1282) EventType.RendererDiscovererItemDeleted = EventType(1283) EventType.VlmMediaAdded = EventType(0x600) EventType.VlmMediaChanged = EventType(1538) EventType.VlmMediaInstanceStarted = EventType(1539) EventType.VlmMediaInstanceStatusEnd = EventType(1545) EventType.VlmMediaInstanceStatusError = EventType(1546) EventType.VlmMediaInstanceStatusInit = EventType(1541) EventType.VlmMediaInstanceStatusOpening = EventType(1542) EventType.VlmMediaInstanceStatusPause = EventType(1544) EventType.VlmMediaInstanceStatusPlaying = EventType(1543) EventType.VlmMediaInstanceStopped = EventType(1540) EventType.VlmMediaRemoved = EventType(1537) class LogLevel(_Enum): """Logging messages level. .. note:: Future LibVLC versions may define new levels. Defined symbols: * ``vlc.LogLevel.DEBUG`` < Debug message * ``vlc.LogLevel.NOTICE`` < Important informational message * ``vlc.LogLevel.WARNING`` < Warning (potential error) message * ``vlc.LogLevel.ERROR`` < Error message """ _enum_names_ = { 0: "DEBUG", 2: "NOTICE", 3: "WARNING", 4: "ERROR", } LogLevel.DEBUG = LogLevel(0) LogLevel.ERROR = LogLevel(4) LogLevel.NOTICE = LogLevel(2) LogLevel.WARNING = LogLevel(3) class MediaDiscovererCategory(_Enum): """Category of a media discoverer See :func:`libvlc_media_discoverer_list_get`. Defined symbols: * ``vlc.MediaDiscovererCategory.devices`` devices, like portable music player * ``vlc.MediaDiscovererCategory.lan`` LAN/WAN services, like Upnp, SMB, or SAP * ``vlc.MediaDiscovererCategory.podcasts`` Podcasts * ``vlc.MediaDiscovererCategory.localdirs`` Local directories, like Video, Music or Pictures directories """ _enum_names_ = { 0: "devices", 1: "lan", 2: "podcasts", 3: "localdirs", } MediaDiscovererCategory.devices = MediaDiscovererCategory(0) MediaDiscovererCategory.lan = MediaDiscovererCategory(1) MediaDiscovererCategory.localdirs = MediaDiscovererCategory(3) MediaDiscovererCategory.podcasts = MediaDiscovererCategory(2) class MediaParseFlag(_Enum): """Parse flags used by :func:`libvlc_media_parse_with_options` See :func:`libvlc_media_parse_with_options`. Defined symbols: * ``vlc.MediaParseFlag.local`` Parse media if it's a local file * ``vlc.MediaParseFlag.network`` Parse media even if it's a network file * ``vlc.MediaParseFlag.fetch_local`` Fetch meta and covert art using local resources * ``vlc.MediaParseFlag.fetch_network`` Fetch meta and covert art using network resources * ``vlc.MediaParseFlag.do_interact`` Interact with the user (via libvlc_dialog_cbs) when preparsing this item (and not its sub items). Set this flag in order to receive a callback when the input is asking for credentials. """ _enum_names_ = { 0x0: "local", 0x1: "network", 0x2: "fetch_local", 0x4: "fetch_network", 0x8: "do_interact", } MediaParseFlag.do_interact = MediaParseFlag(0x8) MediaParseFlag.fetch_local = MediaParseFlag(0x2) MediaParseFlag.fetch_network = MediaParseFlag(0x4) MediaParseFlag.local = MediaParseFlag(0x0) MediaParseFlag.network = MediaParseFlag(0x1) class MediaParsedStatus(_Enum): """Parse status used sent by :func:`libvlc_media_parse_with_options` or returned by :func:`libvlc_media_get_parsed_status` See :func:`libvlc_media_parse_with_options` See :func:`libvlc_media_get_parsed_status`. Defined symbols: * ``vlc.MediaParsedStatus.skipped`` * ``vlc.MediaParsedStatus.failed`` * ``vlc.MediaParsedStatus.timeout`` * ``vlc.MediaParsedStatus.done`` """ _enum_names_ = { 1: "skipped", 2: "failed", 3: "timeout", 4: "done", } MediaParsedStatus.done = MediaParsedStatus(4) MediaParsedStatus.failed = MediaParsedStatus(2) MediaParsedStatus.skipped = MediaParsedStatus(1) MediaParsedStatus.timeout = MediaParsedStatus(3) class MediaPlayerRole(_Enum): """Media player roles. :version: LibVLC 3.0.0 and later. See :func:`libvlc_media_player_set_role`. Defined symbols: * ``vlc.MediaPlayerRole._None`` < Don't use a media player role * ``vlc.MediaPlayerRole.Music`` < Music (or radio) playback * ``vlc.MediaPlayerRole.Video`` < Video playback * ``vlc.MediaPlayerRole.Communication`` < Speech, real-time communication * ``vlc.MediaPlayerRole.Game`` < Video game * ``vlc.MediaPlayerRole.Notification`` < User interaction feedback * ``vlc.MediaPlayerRole.Animation`` < Embedded animation (e.g. in web page) * ``vlc.MediaPlayerRole.Production`` < Audio editting/production * ``vlc.MediaPlayerRole.Accessibility`` < Accessibility * ``vlc.MediaPlayerRole.Test`` Testing """ _enum_names_ = { 0: "_None", 1: "Music", 2: "Video", 3: "Communication", 4: "Game", 5: "Notification", 6: "Animation", 7: "Production", 8: "Accessibility", 9: "Test", } MediaPlayerRole.Accessibility = MediaPlayerRole(8) MediaPlayerRole.Animation = MediaPlayerRole(6) MediaPlayerRole.Communication = MediaPlayerRole(3) MediaPlayerRole.Game = MediaPlayerRole(4) MediaPlayerRole.Music = MediaPlayerRole(1) MediaPlayerRole.Notification = MediaPlayerRole(5) MediaPlayerRole.Production = MediaPlayerRole(7) MediaPlayerRole.Test = MediaPlayerRole(9) MediaPlayerRole.Video = MediaPlayerRole(2) MediaPlayerRole._None = MediaPlayerRole(0) class MediaSlaveType(_Enum): """Type of a media slave: subtitle or audio. Defined symbols: * ``vlc.MediaSlaveType.subtitle`` * ``vlc.MediaSlaveType.audio`` """ _enum_names_ = { 0: "subtitle", 1: "audio", } MediaSlaveType.audio = MediaSlaveType(1) MediaSlaveType.subtitle = MediaSlaveType(0) class MediaType(_Enum): """Media type See :func:`libvlc_media_get_type`. Defined symbols: * ``vlc.MediaType.unknown`` * ``vlc.MediaType.file`` * ``vlc.MediaType.directory`` * ``vlc.MediaType.disc`` * ``vlc.MediaType.stream`` * ``vlc.MediaType.playlist`` """ _enum_names_ = { 0: "unknown", 1: "file", 2: "directory", 3: "disc", 4: "stream", 5: "playlist", } MediaType.directory = MediaType(2) MediaType.disc = MediaType(3) MediaType.file = MediaType(1) MediaType.playlist = MediaType(5) MediaType.stream = MediaType(4) MediaType.unknown = MediaType(0) class Meta(_Enum): """Meta data types. Defined symbols: * ``vlc.Meta.Title`` * ``vlc.Meta.Artist`` * ``vlc.Meta.Genre`` * ``vlc.Meta.Copyright`` * ``vlc.Meta.Album`` * ``vlc.Meta.TrackNumber`` * ``vlc.Meta.Description`` * ``vlc.Meta.Rating`` * ``vlc.Meta.Date`` * ``vlc.Meta.Setting`` * ``vlc.Meta.URL`` * ``vlc.Meta.Language`` * ``vlc.Meta.NowPlaying`` * ``vlc.Meta.Publisher`` * ``vlc.Meta.EncodedBy`` * ``vlc.Meta.ArtworkURL`` * ``vlc.Meta.TrackID`` * ``vlc.Meta.TrackTotal`` * ``vlc.Meta.Director`` * ``vlc.Meta.Season`` * ``vlc.Meta.Episode`` * ``vlc.Meta.ShowName`` * ``vlc.Meta.Actors`` * ``vlc.Meta.AlbumArtist`` * ``vlc.Meta.DiscNumber`` * ``vlc.Meta.DiscTotal`` """ _enum_names_ = { 0: "Title", 1: "Artist", 2: "Genre", 3: "Copyright", 4: "Album", 5: "TrackNumber", 6: "Description", 7: "Rating", 8: "Date", 9: "Setting", 10: "URL", 11: "Language", 12: "NowPlaying", 13: "Publisher", 14: "EncodedBy", 15: "ArtworkURL", 16: "TrackID", 17: "TrackTotal", 18: "Director", 19: "Season", 20: "Episode", 21: "ShowName", 22: "Actors", 23: "AlbumArtist", 24: "DiscNumber", 25: "DiscTotal", } Meta.Actors = Meta(22) Meta.Album = Meta(4) Meta.AlbumArtist = Meta(23) Meta.Artist = Meta(1) Meta.ArtworkURL = Meta(15) Meta.Copyright = Meta(3) Meta.Date = Meta(8) Meta.Description = Meta(6) Meta.Director = Meta(18) Meta.DiscNumber = Meta(24) Meta.DiscTotal = Meta(25) Meta.EncodedBy = Meta(14) Meta.Episode = Meta(20) Meta.Genre = Meta(2) Meta.Language = Meta(11) Meta.NowPlaying = Meta(12) Meta.Publisher = Meta(13) Meta.Rating = Meta(7) Meta.Season = Meta(19) Meta.Setting = Meta(9) Meta.ShowName = Meta(21) Meta.Title = Meta(0) Meta.TrackID = Meta(16) Meta.TrackNumber = Meta(5) Meta.TrackTotal = Meta(17) Meta.URL = Meta(10) class NavigateMode(_Enum): """Navigation mode. Defined symbols: * ``vlc.NavigateMode.activate`` * ``vlc.NavigateMode.up`` * ``vlc.NavigateMode.down`` * ``vlc.NavigateMode.left`` * ``vlc.NavigateMode.right`` * ``vlc.NavigateMode.popup`` """ _enum_names_ = { 0: "activate", 1: "up", 2: "down", 3: "left", 4: "right", 5: "popup", } NavigateMode.activate = NavigateMode(0) NavigateMode.down = NavigateMode(2) NavigateMode.left = NavigateMode(3) NavigateMode.popup = NavigateMode(5) NavigateMode.right = NavigateMode(4) NavigateMode.up = NavigateMode(1) class PlaybackMode(_Enum): """Defines playback modes for playlist. Defined symbols: * ``vlc.PlaybackMode.default`` * ``vlc.PlaybackMode.loop`` * ``vlc.PlaybackMode.repeat`` """ _enum_names_ = { 0: "default", 1: "loop", 2: "repeat", } PlaybackMode.default = PlaybackMode(0) PlaybackMode.loop = PlaybackMode(1) PlaybackMode.repeat = PlaybackMode(2) class Position(_Enum): """Enumeration of values used to set position (e.g. of video title). Defined symbols: * ``vlc.Position.disable`` * ``vlc.Position.center`` * ``vlc.Position.left`` * ``vlc.Position.right`` * ``vlc.Position.top`` * ``vlc.Position.top_left`` * ``vlc.Position.top_right`` * ``vlc.Position.bottom`` * ``vlc.Position.bottom_left`` * ``vlc.Position.bottom_right`` """ _enum_names_ = { -1: "disable", 0: "center", 1: "left", 2: "right", 3: "top", 4: "top_left", 5: "top_right", 6: "bottom", 7: "bottom_left", 8: "bottom_right", } Position.bottom = Position(6) Position.bottom_left = Position(7) Position.bottom_right = Position(8) Position.center = Position(0) Position.disable = Position(-1) Position.left = Position(1) Position.right = Position(2) Position.top = Position(3) Position.top_left = Position(4) Position.top_right = Position(5) class State(_Enum): """Note the order of :class:`State` enum must match exactly the order of See mediacontrol_PlayerStatus, See input_state_e enums, and VideoLAN.LibVLC.State (at bindings/cil/src/media.cs). Expected states by web plugins are: IDLE/CLOSE=0, OPENING=1, PLAYING=3, PAUSED=4, STOPPING=5, ENDED=6, ERROR=7. Defined symbols: * ``vlc.State.NothingSpecial`` * ``vlc.State.Opening`` * ``vlc.State.Buffering`` * ``vlc.State.Playing`` * ``vlc.State.Paused`` * ``vlc.State.Stopped`` * ``vlc.State.Ended`` * ``vlc.State.Error`` """ _enum_names_ = { 0: "NothingSpecial", 1: "Opening", 2: "Buffering", 3: "Playing", 4: "Paused", 5: "Stopped", 6: "Ended", 7: "Error", } State.Buffering = State(2) State.Ended = State(6) State.Error = State(7) State.NothingSpecial = State(0) State.Opening = State(1) State.Paused = State(4) State.Playing = State(3) State.Stopped = State(5) class TeletextKey(_Enum): """Enumeration of teletext keys than can be passed via :func:`libvlc_video_set_teletext`. Defined symbols: * ``vlc.TeletextKey.red`` * ``vlc.TeletextKey.green`` * ``vlc.TeletextKey.yellow`` * ``vlc.TeletextKey.blue`` * ``vlc.TeletextKey.index`` """ _enum_names_ = { 7471104: "red", 6750208: "green", 7929856: "yellow", 6422528: "blue", 6881280: "index", } TeletextKey.blue = TeletextKey(6422528) TeletextKey.green = TeletextKey(6750208) TeletextKey.index = TeletextKey(6881280) TeletextKey.red = TeletextKey(7471104) TeletextKey.yellow = TeletextKey(7929856) class TrackType(_Enum): """ Defined symbols: * ``vlc.TrackType.unknown`` * ``vlc.TrackType.audio`` * ``vlc.TrackType.video`` * ``vlc.TrackType.ext`` """ _enum_names_ = { -1: "unknown", 0: "audio", 1: "video", 2: "ext", } TrackType.audio = TrackType(0) TrackType.ext = TrackType(2) TrackType.unknown = TrackType(-1) TrackType.video = TrackType(1) class VideoAdjustOption(_Enum): """option values for libvlc_video_get,set_adjust_int,float,bool. Defined symbols: * ``vlc.VideoAdjustOption.Enable`` * ``vlc.VideoAdjustOption.Contrast`` * ``vlc.VideoAdjustOption.Brightness`` * ``vlc.VideoAdjustOption.Hue`` * ``vlc.VideoAdjustOption.Saturation`` * ``vlc.VideoAdjustOption.Gamma`` """ _enum_names_ = { 0: "Enable", 1: "Contrast", 2: "Brightness", 3: "Hue", 4: "Saturation", 5: "Gamma", } VideoAdjustOption.Brightness = VideoAdjustOption(2) VideoAdjustOption.Contrast = VideoAdjustOption(1) VideoAdjustOption.Enable = VideoAdjustOption(0) VideoAdjustOption.Gamma = VideoAdjustOption(5) VideoAdjustOption.Hue = VideoAdjustOption(3) VideoAdjustOption.Saturation = VideoAdjustOption(4) class VideoLogoOption(_Enum): """option values for libvlc_video_get,set_logo_int,string. Defined symbols: * ``vlc.VideoLogoOption.logo_enable`` * ``vlc.VideoLogoOption.logo_file`` < string argument, "file,d,t;file,d,t;..." * ``vlc.VideoLogoOption.logo_x`` < string argument, "file,d,t;file,d,t;..." * ``vlc.VideoLogoOption.logo_y`` * ``vlc.VideoLogoOption.logo_delay`` * ``vlc.VideoLogoOption.logo_repeat`` * ``vlc.VideoLogoOption.logo_opacity`` * ``vlc.VideoLogoOption.logo_position`` """ _enum_names_ = { 0: "logo_enable", 1: "logo_file", 2: "logo_x", 3: "logo_y", 4: "logo_delay", 5: "logo_repeat", 6: "logo_opacity", 7: "logo_position", } VideoLogoOption.logo_delay = VideoLogoOption(4) VideoLogoOption.logo_enable = VideoLogoOption(0) VideoLogoOption.logo_file = VideoLogoOption(1) VideoLogoOption.logo_opacity = VideoLogoOption(6) VideoLogoOption.logo_position = VideoLogoOption(7) VideoLogoOption.logo_repeat = VideoLogoOption(5) VideoLogoOption.logo_x = VideoLogoOption(2) VideoLogoOption.logo_y = VideoLogoOption(3) class VideoMarqueeOption(_Enum): """Marq options definition. Defined symbols: * ``vlc.VideoMarqueeOption.Enable`` * ``vlc.VideoMarqueeOption.Text`` string argument * ``vlc.VideoMarqueeOption.Color`` string argument * ``vlc.VideoMarqueeOption.Opacity`` * ``vlc.VideoMarqueeOption.Position`` * ``vlc.VideoMarqueeOption.Refresh`` * ``vlc.VideoMarqueeOption.Size`` * ``vlc.VideoMarqueeOption.Timeout`` * ``vlc.VideoMarqueeOption.X`` * ``vlc.VideoMarqueeOption.Y`` """ _enum_names_ = { 0: "Enable", 1: "Text", 2: "Color", 3: "Opacity", 4: "Position", 5: "Refresh", 6: "Size", 7: "Timeout", 8: "X", 9: "Y", } VideoMarqueeOption.Color = VideoMarqueeOption(2) VideoMarqueeOption.Enable = VideoMarqueeOption(0) VideoMarqueeOption.Opacity = VideoMarqueeOption(3) VideoMarqueeOption.Position = VideoMarqueeOption(4) VideoMarqueeOption.Refresh = VideoMarqueeOption(5) VideoMarqueeOption.Size = VideoMarqueeOption(6) VideoMarqueeOption.Text = VideoMarqueeOption(1) VideoMarqueeOption.Timeout = VideoMarqueeOption(7) VideoMarqueeOption.X = VideoMarqueeOption(8) VideoMarqueeOption.Y = VideoMarqueeOption(9) class VideoOrient(_Enum): """ Defined symbols: * ``vlc.VideoOrient.top_left`` < Normal. Top line represents top, left column left. * ``vlc.VideoOrient.top_right`` < Flipped horizontally * ``vlc.VideoOrient.bottom_left`` < Flipped vertically * ``vlc.VideoOrient.bottom_right`` < Rotated 180 degrees * ``vlc.VideoOrient.left_top`` < Transposed * ``vlc.VideoOrient.left_bottom`` < Rotated 90 degrees clockwise (or 270 anti-clockwise) * ``vlc.VideoOrient.right_top`` < Rotated 90 degrees anti-clockwise * ``vlc.VideoOrient.right_bottom`` < Anti-transposed """ _enum_names_ = { 0: "top_left", 1: "top_right", 2: "bottom_left", 3: "bottom_right", 4: "left_top", 5: "left_bottom", 6: "right_top", 7: "right_bottom", } VideoOrient.bottom_left = VideoOrient(2) VideoOrient.bottom_right = VideoOrient(3) VideoOrient.left_bottom = VideoOrient(5) VideoOrient.left_top = VideoOrient(4) VideoOrient.right_bottom = VideoOrient(7) VideoOrient.right_top = VideoOrient(6) VideoOrient.top_left = VideoOrient(0) VideoOrient.top_right = VideoOrient(1) class VideoProjection(_Enum): """ Defined symbols: * ``vlc.VideoProjection.rectangular`` * ``vlc.VideoProjection.equirectangular`` < 360 spherical * ``vlc.VideoProjection.cubemap_layout_standard`` < 360 spherical """ _enum_names_ = { 0: "rectangular", 1: "equirectangular", 0x100: "cubemap_layout_standard", } VideoProjection.cubemap_layout_standard = VideoProjection(0x100) VideoProjection.equirectangular = VideoProjection(1) VideoProjection.rectangular = VideoProjection(0) # End of generated enum types # # Generated structs # class ModuleDescription(_Cstruct): """Description of a module.""" pass ModuleDescription._fields_ = ( ("name", ctypes.c_char_p), ("shortname", ctypes.c_char_p), ("longname", ctypes.c_char_p), ("help", ctypes.c_char_p), ("next", ctypes.POINTER(ModuleDescription)), ) class RdDescription(_Cstruct): """Renderer discoverer description See :func:`libvlc_renderer_discoverer_list_get`. """ pass RdDescription._fields_ = ( ("name", ctypes.c_char_p), ("longname", ctypes.c_char_p), ) class MediaStats(_Cstruct): pass MediaStats._fields_ = ( ("read_bytes", ctypes.c_int), ("input_bitrate", ctypes.c_float), ("demux_read_bytes", ctypes.c_int), ("demux_bitrate", ctypes.c_float), ("demux_corrupted", ctypes.c_int), ("demux_discontinuity", ctypes.c_int), ("decoded_video", ctypes.c_int), ("decoded_audio", ctypes.c_int), ("displayed_pictures", ctypes.c_int), ("lost_pictures", ctypes.c_int), ("played_abuffers", ctypes.c_int), ("lost_abuffers", ctypes.c_int), ("sent_packets", ctypes.c_int), ("sent_bytes", ctypes.c_int), ("send_bitrate", ctypes.c_float), ) class MediaTrackInfo(_Cstruct): class U(ctypes.Union): class Audio(_Cstruct): pass Audio._fields_ = ( ("channels", ctypes.c_uint), ("rate", ctypes.c_uint), ) class Video(_Cstruct): pass Video._fields_ = ( ("height", ctypes.c_uint), ("width", ctypes.c_uint), ) pass U._fields_ = ( ("audio", U.Audio), ("video", U.Video), ) pass MediaTrackInfo._fields_ = ( ("codec", ctypes.c_uint32), ("id", ctypes.c_int), ("type", TrackType), ("profile", ctypes.c_int), ("level", ctypes.c_int), ("u", MediaTrackInfo.U), ) class AudioTrack(_Cstruct): pass AudioTrack._fields_ = ( ("channels", ctypes.c_uint), ("rate", ctypes.c_uint), ) class VideoViewpoint(_Cstruct): """Viewpoint .. warning:: allocate using :func:`libvlc_video_new_viewpoint`. """ pass VideoViewpoint._fields_ = ( ("yaw", ctypes.c_float), ("pitch", ctypes.c_float), ("roll", ctypes.c_float), ("field_of_view", ctypes.c_float), ) class VideoTrack(_Cstruct): pass VideoTrack._fields_ = ( ("height", ctypes.c_uint), ("width", ctypes.c_uint), ("sar_num", ctypes.c_uint), ("sar_den", ctypes.c_uint), ("frame_rate_num", ctypes.c_uint), ("frame_rate_den", ctypes.c_uint), ("orientation", VideoOrient), ("projection", VideoProjection), ("pose", VideoViewpoint), ) class SubtitleTrack(_Cstruct): pass SubtitleTrack._fields_ = (("encoding", ctypes.c_char_p),) class MediaTrack(_Cstruct): pass MediaTrack._fields_ = ( ("codec", ctypes.c_uint32), ("original_fourcc", ctypes.c_uint32), ("id", ctypes.c_int), ("type", TrackType), ("profile", ctypes.c_int), ("level", ctypes.c_int), ("audio", ctypes.POINTER(AudioTrack)), ("video", ctypes.POINTER(VideoTrack)), ("subtitle", ctypes.POINTER(SubtitleTrack)), ("bitrate", ctypes.c_uint), ("language", ctypes.c_char_p), ("description", ctypes.c_char_p), ) class MediaSlave(_Cstruct): """A slave of a :class:`Media` See :func:`libvlc_media_slaves_get`. """ pass MediaSlave._fields_ = ( ("uri", ctypes.c_char_p), ("type", MediaSlaveType), ("priority", ctypes.c_uint), ) class TrackDescription(_Cstruct): """Description for video, audio tracks and subtitles. It contains id, name (description string) and pointer to next record. """ pass TrackDescription._fields_ = ( ("id", ctypes.c_int), ("name", ctypes.c_char_p), ("next", ctypes.POINTER(TrackDescription)), ) class TitleDescription(_Cstruct): pass TitleDescription._fields_ = ( ("duration", ctypes.c_int64), ("name", ctypes.c_char_p), ("flags", ctypes.c_uint), ) class ChapterDescription(_Cstruct): """Description for chapters.""" pass ChapterDescription._fields_ = ( ("time_offset", ctypes.c_int64), ("duration", ctypes.c_int64), ("name", ctypes.c_char_p), ) class AudioOutput(_Cstruct): """Description for audio output. It contains name, description and pointer to next record. """ pass AudioOutput._fields_ = ( ("name", ctypes.c_char_p), ("description", ctypes.c_char_p), ("next", ctypes.POINTER(AudioOutput)), ) class AudioOutputDevice(_Cstruct): """Description for audio output device.""" pass AudioOutputDevice._fields_ = ( ("next", ctypes.POINTER(AudioOutputDevice)), ("device", ctypes.c_char_p), ("description", ctypes.c_char_p), ) class MediaDiscovererDescription(_Cstruct): """Media discoverer description See :func:`libvlc_media_discoverer_list_get`. """ pass MediaDiscovererDescription._fields_ = ( ("name", ctypes.c_char_p), ("longname", ctypes.c_char_p), ("cat", MediaDiscovererCategory), ) class Event(_Cstruct): """A LibVLC event.""" class U(ctypes.Union): """< Object emitting the event.""" class MediaMetaChanged(_Cstruct): pass MediaMetaChanged._fields_ = (("meta_type", Meta),) class MediaSubitemAdded(_Cstruct): pass MediaSubitemAdded._fields_ = () class MediaDurationChanged(_Cstruct): pass MediaDurationChanged._fields_ = (("new_duration", ctypes.c_int64),) class MediaParsedChanged(_Cstruct): pass MediaParsedChanged._fields_ = (("new_status", ctypes.c_int),) class MediaFreed(_Cstruct): pass MediaFreed._fields_ = () class MediaStateChanged(_Cstruct): pass MediaStateChanged._fields_ = (("new_state", ctypes.c_int),) class MediaSubitemtreeAdded(_Cstruct): pass MediaSubitemtreeAdded._fields_ = () class MediaPlayerBuffering(_Cstruct): pass MediaPlayerBuffering._fields_ = (("new_cache", ctypes.c_float),) class MediaPlayerChapterChanged(_Cstruct): pass MediaPlayerChapterChanged._fields_ = (("new_chapter", ctypes.c_int),) class MediaPlayerPositionChanged(_Cstruct): pass MediaPlayerPositionChanged._fields_ = (("new_position", ctypes.c_float),) class MediaPlayerTimeChanged(_Cstruct): pass MediaPlayerTimeChanged._fields_ = (("new_time", ctypes.c_longlong),) class MediaPlayerTitleChanged(_Cstruct): pass MediaPlayerTitleChanged._fields_ = (("new_title", ctypes.c_int),) class MediaPlayerSeekableChanged(_Cstruct): pass MediaPlayerSeekableChanged._fields_ = (("new_seekable", ctypes.c_int),) class MediaPlayerPausableChanged(_Cstruct): pass MediaPlayerPausableChanged._fields_ = (("new_pausable", ctypes.c_int),) class MediaPlayerScrambledChanged(_Cstruct): pass MediaPlayerScrambledChanged._fields_ = (("new_scrambled", ctypes.c_int),) class MediaPlayerVout(_Cstruct): pass MediaPlayerVout._fields_ = (("new_count", ctypes.c_int),) class MediaListItemAdded(_Cstruct): pass MediaListItemAdded._fields_ = (("index", ctypes.c_int),) class MediaListWillAddItem(_Cstruct): pass MediaListWillAddItem._fields_ = (("index", ctypes.c_int),) class MediaListItemDeleted(_Cstruct): pass MediaListItemDeleted._fields_ = (("index", ctypes.c_int),) class MediaListWillDeleteItem(_Cstruct): pass MediaListWillDeleteItem._fields_ = (("index", ctypes.c_int),) class MediaListPlayerNextItemSet(_Cstruct): pass MediaListPlayerNextItemSet._fields_ = () class MediaPlayerSnapshotTaken(_Cstruct): pass MediaPlayerSnapshotTaken._fields_ = (("filename", ctypes.c_char_p),) class MediaPlayerLengthChanged(_Cstruct): pass MediaPlayerLengthChanged._fields_ = (("new_length", ctypes.c_longlong),) class VlmMediaEvent(_Cstruct): pass VlmMediaEvent._fields_ = ( ("media_name", ctypes.c_char_p), ("instance_name", ctypes.c_char_p), ) class MediaPlayerMediaChanged(_Cstruct): pass MediaPlayerMediaChanged._fields_ = () class MediaPlayerEsChanged(_Cstruct): pass MediaPlayerEsChanged._fields_ = ( ("type", TrackType), ("id", ctypes.c_int), ) class MediaPlayerAudioVolume(_Cstruct): pass MediaPlayerAudioVolume._fields_ = (("volume", ctypes.c_float),) class MediaPlayerAudioDevice(_Cstruct): pass MediaPlayerAudioDevice._fields_ = (("device", ctypes.c_char_p),) class RendererDiscovererItemAdded(_Cstruct): pass RendererDiscovererItemAdded._fields_ = () class RendererDiscovererItemDeleted(_Cstruct): pass RendererDiscovererItemDeleted._fields_ = () pass U._fields_ = ( ("media_meta_changed", U.MediaMetaChanged), ("media_subitem_added", U.MediaSubitemAdded), ("media_duration_changed", U.MediaDurationChanged), ("media_parsed_changed", U.MediaParsedChanged), ("media_freed", U.MediaFreed), ("media_state_changed", U.MediaStateChanged), ("media_subitemtree_added", U.MediaSubitemtreeAdded), ("media_player_buffering", U.MediaPlayerBuffering), ("media_player_chapter_changed", U.MediaPlayerChapterChanged), ("media_player_position_changed", U.MediaPlayerPositionChanged), ("media_player_time_changed", U.MediaPlayerTimeChanged), ("media_player_title_changed", U.MediaPlayerTitleChanged), ("media_player_seekable_changed", U.MediaPlayerSeekableChanged), ("media_player_pausable_changed", U.MediaPlayerPausableChanged), ("media_player_scrambled_changed", U.MediaPlayerScrambledChanged), ("media_player_vout", U.MediaPlayerVout), ("media_list_item_added", U.MediaListItemAdded), ("media_list_will_add_item", U.MediaListWillAddItem), ("media_list_item_deleted", U.MediaListItemDeleted), ("media_list_will_delete_item", U.MediaListWillDeleteItem), ("media_list_player_next_item_set", U.MediaListPlayerNextItemSet), ("media_player_snapshot_taken", U.MediaPlayerSnapshotTaken), ("media_player_length_changed", U.MediaPlayerLengthChanged), ("vlm_media_event", U.VlmMediaEvent), ("media_player_media_changed", U.MediaPlayerMediaChanged), ("media_player_es_changed", U.MediaPlayerEsChanged), ("media_player_audio_volume", U.MediaPlayerAudioVolume), ("media_player_audio_device", U.MediaPlayerAudioDevice), ("renderer_discoverer_item_added", U.RendererDiscovererItemAdded), ("renderer_discoverer_item_deleted", U.RendererDiscovererItemDeleted), ) pass class EventUnion(ctypes.Union): """A wrapper around the nested union :class:`Event.U` for backard compatibility.""" _fields_ = [ ("meta_type", ctypes.c_uint), ("new_child", ctypes.c_uint), ("new_duration", ctypes.c_longlong), ("new_status", ctypes.c_int), ("media", ctypes.c_void_p), ("new_state", ctypes.c_uint), # FIXME: Media instance ("new_cache", ctypes.c_float), ("new_position", ctypes.c_float), ("new_time", ctypes.c_longlong), ("new_title", ctypes.c_int), ("new_seekable", ctypes.c_longlong), ("new_pausable", ctypes.c_longlong), ("new_scrambled", ctypes.c_longlong), ("new_count", ctypes.c_longlong), # FIXME: Skipped MediaList and MediaListView... ("filename", ctypes.c_char_p), ("new_length", ctypes.c_longlong), ] Event._fields_ = ( ("type", EventType), ("obj", ctypes.c_void_p), ("u", EventUnion), ) class DialogCbs(_Cstruct): """Dialog callbacks to be implemented.""" PfDisplayError = ctypes.CFUNCTYPE( None, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p ) PfDisplayError.__doc__ = """Called when an error message needs to be displayed :param p_data: opaque pointer for the callback. :param psz_title: title of the dialog. :param psz_text: text of the dialog.""" PfDisplayLogin = ctypes.CFUNCTYPE( None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_bool, ) PfDisplayLogin.__doc__ = """Called when a login dialog needs to be displayed You can interact with this dialog by calling :func:`libvlc_dialog_post_login` to post an answer or :func:`libvlc_dialog_dismiss` to cancel this dialog. .. note:: to receive this callback, :class:`DialogCbs`.pf_cancel should not be None. :param p_data: opaque pointer for the callback. :param p_id: id used to interact with the dialog. :param psz_title: title of the dialog. :param psz_text: text of the dialog. :param psz_default_username: user name that should be set on the user form. :param b_ask_store: if true, ask the user if he wants to save the. credentials.""" PfDisplayQuestion = ctypes.CFUNCTYPE( None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, DialogQuestionType, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ) PfDisplayQuestion.__doc__ = """Called when a question dialog needs to be displayed You can interact with this dialog by calling :func:`libvlc_dialog_post_action` to post an answer or :func:`libvlc_dialog_dismiss` to cancel this dialog. .. note:: to receive this callback, :class:`DialogCbs`.pf_cancel should not be None. :param p_data: opaque pointer for the callback. :param p_id: id used to interact with the dialog. :param psz_title: title of the dialog. :param psz_text: text of the dialog. :param i_type: question type (or severity) of the dialog. :param psz_cancel: text of the cancel button. :param psz_action1: text of the first button, if None, don't display this. button. :param psz_action2: text of the second button, if None, don't display. this button.""" PfDisplayProgress = ctypes.CFUNCTYPE( None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_bool, ctypes.c_float, ctypes.c_char_p, ) PfDisplayProgress.__doc__ = """Called when a progress dialog needs to be displayed If cancellable (*psz_cancel* != None), you can cancel this dialog by calling :func:`libvlc_dialog_dismiss` .. note:: to receive this callback, :class:`DialogCbs`.pf_cancel and :class:`DialogCbs`.pf_update_progress should not be None. :param p_data: opaque pointer for the callback. :param p_id: id used to interact with the dialog. :param psz_title: title of the dialog. :param psz_text: text of the dialog. :param b_indeterminate: true if the progress dialog is indeterminate. :param f_position: initial position of the progress bar (between 0.0 and. 1.0). :param psz_cancel: text of the cancel button, if None the dialog is not. cancellable.""" PfCancel = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p) PfCancel.__doc__ = """Called when a displayed dialog needs to be cancelled The implementation must call :func:`libvlc_dialog_dismiss` to really release the dialog. :param p_data: opaque pointer for the callback. :param p_id: id of the dialog.""" PfUpdateProgress = ctypes.CFUNCTYPE( None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_float, ctypes.c_char_p ) PfUpdateProgress.__doc__ = """Called when a progress dialog needs to be updated :param p_data: opaque pointer for the callback. :param p_id: id of the dialog. :param f_position: osition of the progress bar (between 0.0 and 1.0). :param psz_text: new text of the progress dialog.""" pass DialogCbs._fields_ = ( ("pf_display_error", DialogCbs.PfDisplayError), ("pf_display_login", DialogCbs.PfDisplayLogin), ("pf_display_question", DialogCbs.PfDisplayQuestion), ("pf_display_progress", DialogCbs.PfDisplayProgress), ("pf_cancel", DialogCbs.PfCancel), ("pf_update_progress", DialogCbs.PfUpdateProgress), ) class LogMessage(_Cstruct): pass LogMessage._fields_ = ( ("severity", ctypes.c_int), ("type", ctypes.c_char_p), ("name", ctypes.c_char_p), ("header", ctypes.c_char_p), ("message", ctypes.c_char_p), ) # End of generated structs # # Generated callback definitions # class AudioCleanupCb(ctypes.c_void_p): """Callback prototype for audio playback cleanup. This is called when the media player no longer needs an audio output. :param opaque: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN]. """ pass class AudioDrainCb(ctypes.c_void_p): """Callback prototype for audio buffer drain. LibVLC may invoke this callback when the decoded audio track is ending. There will be no further decoded samples for the track, but playback should nevertheless continue until all already pending buffers are rendered. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN]. """ pass class AudioFlushCb(ctypes.c_void_p): """Callback prototype for audio buffer flush. LibVLC invokes this callback if it needs to discard all pending buffers and stop playback as soon as possible. This typically occurs when the media is stopped. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN]. """ pass class AudioPauseCb(ctypes.c_void_p): """Callback prototype for audio pause. LibVLC invokes this callback to pause audio playback. .. note:: The pause callback is never called if the audio is already paused. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN]. :param pts: time stamp of the pause request (should be elapsed already). """ pass class AudioPlayCb(ctypes.c_void_p): """Callback prototype for audio playback. The LibVLC media player decodes and post-processes the audio signal asynchronously (in an internal thread). Whenever audio *samples* are ready to be queued to the output, this callback is invoked. The number of *samples* provided per invocation may depend on the file format, the audio coding algorithm, the decoder plug-in, the post-processing filters and timing. Application must not assume a certain number of *samples*. The exact format of audio *samples* is determined by :func:`libvlc_audio_set_format` or :func:`libvlc_audio_set_format_callbacks` as is the channels layout. Note that the number of *samples* is per channel. For instance, if the audio track sampling rate is 48000 Hz, then 1200 *samples* represent 25 milliseconds of audio signal - regardless of the number of audio channels. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN]. :param samples: pointer to a table of audio samples to play back [IN]. :param count: number of audio samples to play back. :param pts: expected play time stamp (see libvlc_delay). """ pass class AudioResumeCb(ctypes.c_void_p): """Callback prototype for audio resumption. LibVLC invokes this callback to resume audio playback after it was previously paused. .. note:: The resume callback is never called if the audio is not paused. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN]. :param pts: time stamp of the resumption request (should be elapsed already). """ pass class AudioSetVolumeCb(ctypes.c_void_p): """Callback prototype for audio *volume* change. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN]. :param volume: software volume (1. = nominal, 0. = mute). :param mute: muted flag. """ pass class AudioSetupCb(ctypes.c_void_p): """Callback prototype to setup the audio playback. This is called when the media player needs to create a new audio output. :param opaque: pointer to the data pointer passed to. :func:`libvlc_audio_set_callbacks` [IN/OUT]. :param format: 4 bytes sample format [IN/OUT]. :param rate: sample rate [IN/OUT]. :param channels: channels count [IN/OUT]. :return: 0 on success, anything else to skip audio playback. """ pass class Callback(ctypes.c_void_p): """Callback function notification. :param p_event: the event triggering the callback. """ pass class LogCb(ctypes.c_void_p): """Callback prototype for LibVLC log message handler. .. note:: Log message handlers **must** be thread-safe. .. warning:: The message context pointer, the format string parameters and the variable arguments are only valid until the callback returns. :param data: data pointer as given to :func:`libvlc_log_set`. :param level: message level (libvlc_log_level). :param ctx: message context (meta-information about the message). :param fmt: printf() format string (as defined by ISO C11). :param args: variable argument list for the format. """ pass class MediaCloseCb(ctypes.c_void_p): """Callback prototype to close a custom bitstream input media. :param opaque: private pointer as set by the :class:`MediaOpenCb`. callback. """ pass class MediaOpenCb(ctypes.c_void_p): """Callback prototype to open a custom bitstream input media. The same media item can be opened multiple times. Each time, this callback is invoked. It should allocate and initialize any instance-specific resources, then store them in **datap*. The instance resources can be freed in the :class:`MediaCloseCb` callback. .. note:: For convenience, **datap* is initially None and **sizep* is initially 0. :param opaque: private pointer as passed to :func:`libvlc_media_new_callbacks`. :param datap: storage space for a private data pointer [OUT]. :param sizep: byte length of the bitstream or UINT64_MAX if unknown [OUT]. :return: 0 on success, non-zero on error. In case of failure, the other. callbacks will not be invoked and any value stored in **datap* and **sizep* is. discarded. """ pass class MediaReadCb(ctypes.c_void_p): """Callback prototype to read data from a custom bitstream input media. .. 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 :func:`libvlc_media_player_stop` will never return. :param opaque: private pointer as set by the :class:`MediaOpenCb`. callback. :param buf: start address of the buffer to read data into. :param len: bytes length of the buffer. :return: strictly positive number of bytes read, 0 on end-of-stream, or -1 on non-recoverable error. """ pass class MediaSeekCb(ctypes.c_void_p): """Callback prototype to seek a custom bitstream input media. :param opaque: private pointer as set by the :class:`MediaOpenCb`. callback. :param offset: absolute byte offset to seek to. :return: 0 on success, -1 on error. """ pass class VideoCleanupCb(ctypes.c_void_p): """Callback prototype to configure picture buffers format. :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks`. (and possibly modified by libvlc_video_format_cb) [IN]. """ pass class VideoDisplayCb(ctypes.c_void_p): """Callback prototype to display a *picture*. When the video frame needs to be shown, as determined by the media playback clock, the display callback is invoked. :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN]. :param picture: private pointer returned from the :class:`VideoLockCb`. callback [IN]. """ pass class VideoFormatCb(ctypes.c_void_p): """Callback prototype to configure picture buffers format. This callback gets the format of the video as output by the video decoder and the chain of video filters (if any). It can opt to change any parameter as it needs. In that case, LibVLC will attempt to convert the video format (rescaling and *chroma* conversion) but these operations can be CPU intensive. .. note:: For each pixels plane, the scanline pitch must be bigger than or equal to the number of bytes per pixel multiplied by the pixel *width*. Similarly, the number of scanlines must be bigger than of equal to the pixel *height*. Furthermore, we recommend that *pitches* and *lines* be multiple of 32 to not break assumptions that might be held by optimized code in the video decoders, video filters and/or video converters. :param opaque: pointer to the private pointer passed to. :func:`libvlc_video_set_callbacks` [IN/OUT]. :param chroma: pointer to the 4 bytes video format identifier [IN/OUT]. :param width: pointer to the pixel width [IN/OUT]. :param height: pointer to the pixel height [IN/OUT]. :param pitches: table of scanline pitches in bytes for each pixel plane. (the table is allocated by LibVLC) [OUT]. :param lines: table of scanlines count for each plane [OUT]. :return: the number of picture buffers allocated, 0 indicates failure. """ pass class VideoLockCb(ctypes.c_void_p): """Callback prototype to allocate and lock a picture buffer. Whenever a new video frame needs to be decoded, the lock callback is invoked. Depending on the video chroma, one or three pixel *planes* of adequate dimensions must be returned via the second parameter. Those planes must be aligned on 32-bytes boundaries. :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN]. :param planes: start address of the pixel planes (LibVLC allocates the array. of void pointers, this callback must initialize the array) [OUT]. :return: a private pointer for the display and unlock callbacks to identify. the picture buffers. """ pass class VideoUnlockCb(ctypes.c_void_p): """Callback prototype to unlock a *picture* buffer. When the video frame decoding is complete, the unlock callback is invoked. This callback might not be needed at all. It is only an indication that the application can now read the pixel values if it needs to. .. note:: A *picture* buffer is unlocked after the *picture* is decoded, but before the *picture* is displayed. :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN]. :param picture: private pointer returned from the :class:`VideoLockCb`. callback [IN]. :param planes: pixel planes as defined by the :class:`VideoLockCb`. callback (this parameter is only for convenience) [IN]. """ pass class CallbackDecorators(object): """Class holding various method decorators for callback functions.""" AudioCleanupCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p) AudioCleanupCb.__doc__ = """Callback prototype for audio playback cleanup. This is called when the media player no longer needs an audio output. :param opaque: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].""" AudioDrainCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p) AudioDrainCb.__doc__ = """Callback prototype for audio buffer drain. LibVLC may invoke this callback when the decoded audio track is ending. There will be no further decoded samples for the track, but playback should nevertheless continue until all already pending buffers are rendered. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].""" AudioFlushCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64) AudioFlushCb.__doc__ = """Callback prototype for audio buffer flush. LibVLC invokes this callback if it needs to discard all pending buffers and stop playback as soon as possible. This typically occurs when the media is stopped. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].""" AudioPauseCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64) AudioPauseCb.__doc__ = """Callback prototype for audio pause. LibVLC invokes this callback to pause audio playback. .. note:: The pause callback is never called if the audio is already paused. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN]. :param pts: time stamp of the pause request (should be elapsed already).""" AudioPlayCb = ctypes.CFUNCTYPE( None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint, ctypes.c_int64 ) AudioPlayCb.__doc__ = """Callback prototype for audio playback. The LibVLC media player decodes and post-processes the audio signal asynchronously (in an internal thread). Whenever audio *samples* are ready to be queued to the output, this callback is invoked. The number of *samples* provided per invocation may depend on the file format, the audio coding algorithm, the decoder plug-in, the post-processing filters and timing. Application must not assume a certain number of *samples*. The exact format of audio *samples* is determined by :func:`libvlc_audio_set_format` or :func:`libvlc_audio_set_format_callbacks` as is the channels layout. Note that the number of *samples* is per channel. For instance, if the audio track sampling rate is 48000 Hz, then 1200 *samples* represent 25 milliseconds of audio signal - regardless of the number of audio channels. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN]. :param samples: pointer to a table of audio samples to play back [IN]. :param count: number of audio samples to play back. :param pts: expected play time stamp (see libvlc_delay).""" AudioResumeCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64) AudioResumeCb.__doc__ = """Callback prototype for audio resumption. LibVLC invokes this callback to resume audio playback after it was previously paused. .. note:: The resume callback is never called if the audio is not paused. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN]. :param pts: time stamp of the resumption request (should be elapsed already).""" AudioSetVolumeCb = ctypes.CFUNCTYPE( None, ctypes.c_void_p, ctypes.c_float, ctypes.c_bool ) AudioSetVolumeCb.__doc__ = """Callback prototype for audio *volume* change. :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN]. :param volume: software volume (1. = nominal, 0. = mute). :param mute: muted flag.""" 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), ) AudioSetupCb.__doc__ = """Callback prototype to setup the audio playback. This is called when the media player needs to create a new audio output. :param opaque: pointer to the data pointer passed to. :func:`libvlc_audio_set_callbacks` [IN/OUT]. :param format: 4 bytes sample format [IN/OUT]. :param rate: sample rate [IN/OUT]. :param channels: channels count [IN/OUT]. :return: 0 on success, anything else to skip audio playback.""" Callback = ctypes.CFUNCTYPE(None, ctypes.POINTER(Event), ctypes.c_void_p) Callback.__doc__ = """Callback function notification. :param p_event: the event triggering the callback.""" LogCb = ctypes.CFUNCTYPE( None, ctypes.c_void_p, ctypes.c_int, Log_ptr, ctypes.c_char_p, ctypes.c_void_p ) LogCb.__doc__ = """Callback prototype for LibVLC log message handler. .. note:: Log message handlers **must** be thread-safe. .. warning:: The message context pointer, the format string parameters and the variable arguments are only valid until the callback returns. :param data: data pointer as given to :func:`libvlc_log_set`. :param level: message level (libvlc_log_level). :param ctx: message context (meta-information about the message). :param fmt: printf() format string (as defined by ISO C11). :param args: variable argument list for the format.""" MediaCloseCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p) MediaCloseCb.__doc__ = """Callback prototype to close a custom bitstream input media. :param opaque: private pointer as set by the :class:`MediaOpenCb`. callback.""" MediaOpenCb = ctypes.CFUNCTYPE( ctypes.c_int, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(ctypes.c_uint64), ) MediaOpenCb.__doc__ = """Callback prototype to open a custom bitstream input media. The same media item can be opened multiple times. Each time, this callback is invoked. It should allocate and initialize any instance-specific resources, then store them in **datap*. The instance resources can be freed in the :class:`MediaCloseCb` callback. .. note:: For convenience, **datap* is initially None and **sizep* is initially 0. :param opaque: private pointer as passed to :func:`libvlc_media_new_callbacks`. :param datap: storage space for a private data pointer [OUT]. :param sizep: byte length of the bitstream or UINT64_MAX if unknown [OUT]. :return: 0 on success, non-zero on error. In case of failure, the other. callbacks will not be invoked and any value stored in **datap* and **sizep* is. discarded.""" MediaReadCb = ctypes.CFUNCTYPE( ctypes.c_ssize_t, ctypes.c_void_p, ctypes.POINTER(ctypes.c_char), ctypes.c_size_t, ) MediaReadCb.__doc__ = """Callback prototype to read data from a custom bitstream input media. .. 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 :func:`libvlc_media_player_stop` will never return. :param opaque: private pointer as set by the :class:`MediaOpenCb`. callback. :param buf: start address of the buffer to read data into. :param len: bytes length of the buffer. :return: strictly positive number of bytes read, 0 on end-of-stream, or -1 on non-recoverable error.""" MediaSeekCb = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_uint64) MediaSeekCb.__doc__ = """Callback prototype to seek a custom bitstream input media. :param opaque: private pointer as set by the :class:`MediaOpenCb`. callback. :param offset: absolute byte offset to seek to. :return: 0 on success, -1 on error.""" VideoCleanupCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p) VideoCleanupCb.__doc__ = """Callback prototype to configure picture buffers format. :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks`. (and possibly modified by libvlc_video_format_cb) [IN].""" VideoDisplayCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p) VideoDisplayCb.__doc__ = """Callback prototype to display a *picture*. When the video frame needs to be shown, as determined by the media playback clock, the display callback is invoked. :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN]. :param picture: private pointer returned from the :class:`VideoLockCb`. callback [IN].""" 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), ) VideoFormatCb.__doc__ = """Callback prototype to configure picture buffers format. This callback gets the format of the video as output by the video decoder and the chain of video filters (if any). It can opt to change any parameter as it needs. In that case, LibVLC will attempt to convert the video format (rescaling and *chroma* conversion) but these operations can be CPU intensive. .. note:: For each pixels plane, the scanline pitch must be bigger than or equal to the number of bytes per pixel multiplied by the pixel *width*. Similarly, the number of scanlines must be bigger than of equal to the pixel *height*. Furthermore, we recommend that *pitches* and *lines* be multiple of 32 to not break assumptions that might be held by optimized code in the video decoders, video filters and/or video converters. :param opaque: pointer to the private pointer passed to. :func:`libvlc_video_set_callbacks` [IN/OUT]. :param chroma: pointer to the 4 bytes video format identifier [IN/OUT]. :param width: pointer to the pixel width [IN/OUT]. :param height: pointer to the pixel height [IN/OUT]. :param pitches: table of scanline pitches in bytes for each pixel plane. (the table is allocated by LibVLC) [OUT]. :param lines: table of scanlines count for each plane [OUT]. :return: the number of picture buffers allocated, 0 indicates failure.""" VideoLockCb = ctypes.CFUNCTYPE( ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p) ) VideoLockCb.__doc__ = """Callback prototype to allocate and lock a picture buffer. Whenever a new video frame needs to be decoded, the lock callback is invoked. Depending on the video chroma, one or three pixel *planes* of adequate dimensions must be returned via the second parameter. Those planes must be aligned on 32-bytes boundaries. :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN]. :param planes: start address of the pixel planes (LibVLC allocates the array. of void pointers, this callback must initialize the array) [OUT]. :return: a private pointer for the display and unlock callbacks to identify. the picture buffers.""" VideoUnlockCb = ctypes.CFUNCTYPE( None, ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p) ) VideoUnlockCb.__doc__ = """Callback prototype to unlock a *picture* buffer. When the video frame decoding is complete, the unlock callback is invoked. This callback might not be needed at all. It is only an indication that the application can now read the pixel values if it needs to. .. note:: A *picture* buffer is unlocked after the *picture* is decoded, but before the *picture* is displayed. :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN]. :param picture: private pointer returned from the :class:`VideoLockCb`. callback [IN]. :param planes: pixel planes as defined by the :class:`VideoLockCb`. callback (this parameter is only for convenience) [IN].""" cb = CallbackDecorators # End of generated callback definitions # # Generated functions # def libvlc_add_intf(p_instance, name): """Try to start a user interface for the libvlc instance. :param p_instance: the instance. :param name: interface name, or None for default. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_add_intf", None) or _Cfunction( "libvlc_add_intf", ( (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ) return f(p_instance, name) def libvlc_audio_equalizer_get_amp_at_index(p_equalizer, u_band): """Get the amplification value for a particular equalizer frequency band. :param p_equalizer: valid equalizer handle, must not be None. :param u_band: index, counting from zero, of the frequency band to get. :return: amplification value (Hz); NaN if there is no such frequency band. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_audio_equalizer_get_amp_at_index", None) or _Cfunction( "libvlc_audio_equalizer_get_amp_at_index", ( (1,), (1,), ), None, ctypes.c_float, AudioEqualizer, ctypes.c_uint, ) return f(p_equalizer, u_band) def libvlc_audio_equalizer_get_band_count(): """Get the number of distinct frequency bands for an equalizer. :return: number of frequency bands. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_audio_equalizer_get_band_count", None) or _Cfunction( "libvlc_audio_equalizer_get_band_count", (), None, ctypes.c_uint ) return f() def libvlc_audio_equalizer_get_band_frequency(u_index): """Get a particular equalizer band frequency. This value can be used, for example, to create a label for an equalizer band control in a user interface. :param u_index: index of the band, counting from zero. :return: equalizer band frequency (Hz), or -1 if there is no such band. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get( "libvlc_audio_equalizer_get_band_frequency", None ) or _Cfunction( "libvlc_audio_equalizer_get_band_frequency", ((1,),), None, ctypes.c_float, ctypes.c_uint, ) return f(u_index) def libvlc_audio_equalizer_get_preamp(p_equalizer): """Get the current pre-amplification value from an equalizer. :param p_equalizer: valid equalizer handle, must not be None. :return: preamp value (Hz). :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_audio_equalizer_get_preamp", None) or _Cfunction( "libvlc_audio_equalizer_get_preamp", ((1,),), None, ctypes.c_float, AudioEqualizer, ) return f(p_equalizer) def libvlc_audio_equalizer_get_preset_count(): """Get the number of equalizer presets. :return: number of presets. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_audio_equalizer_get_preset_count", None) or _Cfunction( "libvlc_audio_equalizer_get_preset_count", (), None, ctypes.c_uint ) return f() def libvlc_audio_equalizer_get_preset_name(u_index): """Get the name of a particular equalizer preset. This name can be used, for example, to prepare a preset label or menu in a user interface. :param u_index: index of the preset, counting from zero. :return: preset name, or None if there is no such preset. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_audio_equalizer_get_preset_name", None) or _Cfunction( "libvlc_audio_equalizer_get_preset_name", ((1,),), None, ctypes.c_char_p, ctypes.c_uint, ) return f(u_index) def libvlc_audio_equalizer_new(): """Create a new default equalizer, with all frequency values zeroed. The new equalizer can subsequently be applied to a media player by invoking :func:`libvlc_media_player_set_equalizer`. The returned handle should be freed via :func:`libvlc_audio_equalizer_release` when it is no longer needed. :return: opaque equalizer handle, or None on error. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_audio_equalizer_new", None) or _Cfunction( "libvlc_audio_equalizer_new", (), class_result(AudioEqualizer), ctypes.c_void_p ) return f() def libvlc_audio_equalizer_new_from_preset(u_index): """Create a new equalizer, with initial frequency values copied from an existing preset. The new equalizer can subsequently be applied to a media player by invoking :func:`libvlc_media_player_set_equalizer`. The returned handle should be freed via :func:`libvlc_audio_equalizer_release` when it is no longer needed. :param u_index: index of the preset, counting from zero. :return: opaque equalizer handle, or None on error. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_audio_equalizer_new_from_preset", None) or _Cfunction( "libvlc_audio_equalizer_new_from_preset", ((1,),), class_result(AudioEqualizer), ctypes.c_void_p, ctypes.c_uint, ) return f(u_index) def libvlc_audio_equalizer_release(p_equalizer): """Release a previously created equalizer instance. The equalizer was previously created by using :func:`libvlc_audio_equalizer_new` or :func:`libvlc_audio_equalizer_new_from_preset`. It is safe to invoke this method with a None *p_equalizer* parameter for no effect. :param p_equalizer: opaque equalizer handle, or None. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_audio_equalizer_release", None) or _Cfunction( "libvlc_audio_equalizer_release", ((1,),), None, None, AudioEqualizer ) return f(p_equalizer) def libvlc_audio_equalizer_set_amp_at_index(p_equalizer, f_amp, u_band): """Set a new amplification value for a particular equalizer frequency band. The new equalizer settings are subsequently applied to a media player by invoking :func:`libvlc_media_player_set_equalizer`. The supplied amplification value will be clamped to the -20.0 to +20.0 range. :param p_equalizer: valid equalizer handle, must not be None. :param f_amp: amplification value (-20.0 to 20.0 Hz). :param u_band: index, counting from zero, of the frequency band to set. :return: zero on success, -1 on error. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_audio_equalizer_set_amp_at_index", None) or _Cfunction( "libvlc_audio_equalizer_set_amp_at_index", ( (1,), (1,), (1,), ), None, ctypes.c_int, AudioEqualizer, ctypes.c_float, ctypes.c_uint, ) return f(p_equalizer, f_amp, u_band) def libvlc_audio_equalizer_set_preamp(p_equalizer, f_preamp): """Set a new pre-amplification value for an equalizer. The new equalizer settings are subsequently applied to a media player by invoking :func:`libvlc_media_player_set_equalizer`. The supplied amplification value will be clamped to the -20.0 to +20.0 range. :param p_equalizer: valid equalizer handle, must not be None. :param f_preamp: preamp value (-20.0 to 20.0 Hz). :return: zero on success, -1 on error. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_audio_equalizer_set_preamp", None) or _Cfunction( "libvlc_audio_equalizer_set_preamp", ( (1,), (1,), ), None, ctypes.c_int, AudioEqualizer, ctypes.c_float, ) return f(p_equalizer, f_preamp) def libvlc_audio_filter_list_get(p_instance): """Returns a list of audio filters that are available. See :class:`ModuleDescription` See :func:`libvlc_module_description_list_release`. :param p_instance: libvlc instance. :return: a list of module descriptions. It should be freed with :func:`libvlc_module_description_list_release`. In case of an error, None is returned. """ f = _Cfunctions.get("libvlc_audio_filter_list_get", None) or _Cfunction( "libvlc_audio_filter_list_get", ((1,),), None, ctypes.POINTER(ModuleDescription), Instance, ) return f(p_instance) def libvlc_audio_get_channel(p_mi): """Get current audio channel. :param p_mi: media player. :return: the audio channel See :class:`AudioOutputChannel`. """ f = _Cfunctions.get("libvlc_audio_get_channel", None) or _Cfunction( "libvlc_audio_get_channel", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_audio_get_delay(p_mi): """Get current audio delay. :param p_mi: media player. :return: the audio delay (microseconds). :version: LibVLC 1.1.1 or later. """ f = _Cfunctions.get("libvlc_audio_get_delay", None) or _Cfunction( "libvlc_audio_get_delay", ((1,),), None, ctypes.c_int64, MediaPlayer ) return f(p_mi) def libvlc_audio_get_mute(p_mi): """Get current mute status. :param p_mi: media player. :return: the mute status (boolean) if defined, -1 if undefined/unapplicable. """ f = _Cfunctions.get("libvlc_audio_get_mute", None) or _Cfunction( "libvlc_audio_get_mute", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_audio_get_track(p_mi): """Get current audio track. :param p_mi: media player. :return: the audio track ID or -1 if no active input. """ f = _Cfunctions.get("libvlc_audio_get_track", None) or _Cfunction( "libvlc_audio_get_track", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_audio_get_track_count(p_mi): """Get number of available audio tracks. :param p_mi: media player. :return: the number of available audio tracks (int), or -1 if unavailable. """ f = _Cfunctions.get("libvlc_audio_get_track_count", None) or _Cfunction( "libvlc_audio_get_track_count", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_audio_get_track_description(p_mi): """Get the description of available audio tracks. :param p_mi: media player. :return: list with description of available audio tracks, or None. It must be freed with :func:`libvlc_track_description_list_release`. """ f = _Cfunctions.get("libvlc_audio_get_track_description", None) or _Cfunction( "libvlc_audio_get_track_description", ((1,),), None, ctypes.POINTER(TrackDescription), MediaPlayer, ) return f(p_mi) def libvlc_audio_get_volume(p_mi): """Get current software audio volume. :param p_mi: media player. :return: the software volume in percents. (0 = mute, 100 = nominal / 0dB). """ f = _Cfunctions.get("libvlc_audio_get_volume", None) or _Cfunction( "libvlc_audio_get_volume", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_audio_output_device_count(p_instance, psz_audio_output): """Backward compatibility stub. Do not use in new code. .. warning:: **Deprecated!** Use :func:`libvlc_audio_output_device_list_get` instead. :return: always 0. """ f = _Cfunctions.get("libvlc_audio_output_device_count", None) or _Cfunction( "libvlc_audio_output_device_count", ( (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ) return f(p_instance, psz_audio_output) def libvlc_audio_output_device_enum(mp): """Gets a list of potential audio output devices, See :func:`libvlc_audio_output_device_set`. .. note:: Not all audio outputs support enumerating devices. The audio output may be functional even if the list is empty (None). .. note:: The list may not be exhaustive. .. warning:: Some audio output devices in the list might not actually work in some circumstances. By default, it is recommended to not specify any explicit audio device. :param mp: media player. :return: A None-terminated linked list of potential audio output devices. It must be freed with :func:`libvlc_audio_output_device_list_release`. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_audio_output_device_enum", None) or _Cfunction( "libvlc_audio_output_device_enum", ((1,),), None, ctypes.POINTER(AudioOutputDevice), MediaPlayer, ) return f(mp) def libvlc_audio_output_device_get(mp): """Get the current audio output device identifier. This complements :func:`libvlc_audio_output_device_set`. .. warning:: The initial value for the current audio output device identifier may not be set or may be some unknown value. A LibVLC application should compare this value against the known device identifiers (e.g. those that were previously retrieved by a call to :func:`libvlc_audio_output_device_enum` or libvlc_audio_output_device_list_get) to find the current audio output device. It is possible that the selected audio output device changes (an external change) without a call to :func:`libvlc_audio_output_device_set`. That may make this method unsuitable to use if a LibVLC application is attempting to track dynamic audio device changes as they happen. :param mp: media player. :return: the current audio output device identifier. None if no device is selected or in case of error. (the result must be released with free() or libvlc_free). :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_audio_output_device_get", None) or _Cfunction( "libvlc_audio_output_device_get", ((1,),), string_result, ctypes.c_void_p, MediaPlayer, ) return f(mp) def libvlc_audio_output_device_id(p_instance, psz_audio_output, i_device): """Backward compatibility stub. Do not use in new code. .. warning:: **Deprecated!** Use :func:`libvlc_audio_output_device_list_get` instead. :return: always None. """ f = _Cfunctions.get("libvlc_audio_output_device_id", None) or _Cfunction( "libvlc_audio_output_device_id", ( (1,), (1,), (1,), ), string_result, ctypes.c_void_p, Instance, ctypes.c_char_p, ctypes.c_int, ) return f(p_instance, psz_audio_output, i_device) def libvlc_audio_output_device_list_get(p_instance, aout): """Gets a list of audio output devices for a given audio output module, See :func:`libvlc_audio_output_device_set`. .. note:: Not all audio outputs support this. In particular, an empty (None) list of devices does **not** imply that the specified audio output does not work. .. note:: The list might not be exhaustive. .. warning:: Some audio output devices in the list might not actually work in some circumstances. By default, it is recommended to not specify any explicit audio device. :param p_instance: libvlc instance. :param aout: audio output name. (as returned by libvlc_audio_output_list_get). :return: A None-terminated linked list of potential audio output devices. It must be freed with :func:`libvlc_audio_output_device_list_release`. :version: LibVLC 2.1.0 or later. """ f = _Cfunctions.get("libvlc_audio_output_device_list_get", None) or _Cfunction( "libvlc_audio_output_device_list_get", ( (1,), (1,), ), None, ctypes.POINTER(AudioOutputDevice), Instance, ctypes.c_char_p, ) return f(p_instance, aout) def libvlc_audio_output_device_list_release(p_list): """Frees a list of available audio output devices. :param p_list: list with audio outputs for release. :version: LibVLC 2.1.0 or later. """ f = _Cfunctions.get("libvlc_audio_output_device_list_release", None) or _Cfunction( "libvlc_audio_output_device_list_release", ((1,),), None, None, ctypes.POINTER(AudioOutputDevice), ) return f(p_list) def libvlc_audio_output_device_longname(p_instance, psz_output, i_device): """Backward compatibility stub. Do not use in new code. .. warning:: **Deprecated!** Use :func:`libvlc_audio_output_device_list_get` instead. :return: always None. """ f = _Cfunctions.get("libvlc_audio_output_device_longname", None) or _Cfunction( "libvlc_audio_output_device_longname", ( (1,), (1,), (1,), ), string_result, ctypes.c_void_p, Instance, ctypes.c_char_p, ctypes.c_int, ) return f(p_instance, psz_output, i_device) def libvlc_audio_output_device_set(mp, module, device_id): """Configures an explicit audio output device. If the *module* paramater is None, audio output will be moved to the device specified by the device identifier string immediately. This is the recommended usage. A list of adequate potential device strings can be obtained with :func:`libvlc_audio_output_device_enum`. However passing None is supported in LibVLC version 2.2.0 and later only; in earlier versions, this function would have no effects when the module parameter was None. If the *module* parameter is not None, the device parameter of the corresponding audio output, if it exists, will be set to the specified string. Note that some audio output modules do not have such a parameter (notably MMDevice and PulseAudio). A list of adequate potential device strings can be obtained with :func:`libvlc_audio_output_device_list_get`. .. note:: This function does not select the specified audio output plugin. :func:`libvlc_audio_output_set` is used for that purpose. .. warning:: The syntax for the device parameter depends on the audio output. Some audio output modules require further parameters (e.g. a channels map in the case of ALSA). :param mp: media player. :param module: If None, current audio output module. if non-None, name of audio output module. (See libvlc_audio_output_t). :param device_id: device identifier string. :return: Nothing. Errors are ignored (this is a design bug). """ f = _Cfunctions.get("libvlc_audio_output_device_set", None) or _Cfunction( "libvlc_audio_output_device_set", ( (1,), (1,), (1,), ), None, None, MediaPlayer, ctypes.c_char_p, ctypes.c_char_p, ) return f(mp, module, device_id) def libvlc_audio_output_get_device_type(p_mi): """Stub for backward compatibility. :return: always -1. """ f = _Cfunctions.get("libvlc_audio_output_get_device_type", None) or _Cfunction( "libvlc_audio_output_get_device_type", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_audio_output_list_get(p_instance): """Gets the list of available audio output modules. :param p_instance: libvlc instance. :return: list of available audio outputs. It must be freed with. See :func:`libvlc_audio_output_list_release` See :class:`AudioOutput` . In case of error, None is returned. """ f = _Cfunctions.get("libvlc_audio_output_list_get", None) or _Cfunction( "libvlc_audio_output_list_get", ((1,),), None, ctypes.POINTER(AudioOutput), Instance, ) return f(p_instance) def libvlc_audio_output_list_release(p_list): """Frees the list of available audio output modules. :param p_list: list with audio outputs for release. """ f = _Cfunctions.get("libvlc_audio_output_list_release", None) or _Cfunction( "libvlc_audio_output_list_release", ((1,),), None, None, ctypes.POINTER(AudioOutput), ) return f(p_list) def libvlc_audio_output_set(p_mi, psz_name): """Selects an audio output module. .. note:: Any change will take be effect only after playback is stopped and restarted. Audio output cannot be changed while playing. :param p_mi: media player. :param psz_name: name of audio output, use psz_name of See :class:`AudioOutput`. :return: 0 if function succeeded, -1 on error. """ f = _Cfunctions.get("libvlc_audio_output_set", None) or _Cfunction( "libvlc_audio_output_set", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_char_p, ) return f(p_mi, psz_name) def libvlc_audio_output_set_device_type(p_mp, device_type): """Stub for backward compatibility.""" f = _Cfunctions.get("libvlc_audio_output_set_device_type", None) or _Cfunction( "libvlc_audio_output_set_device_type", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_int, ) return f(p_mp, device_type) def libvlc_audio_set_callbacks(mp, play, pause, resume, flush, drain, opaque): """Sets callbacks and private data for decoded audio. Use :func:`libvlc_audio_set_format` or :func:`libvlc_audio_set_format_callbacks` to configure the decoded audio format. .. note:: The audio callbacks override any other audio output mechanism. If the callbacks are set, LibVLC will **not** output audio in any way. :param mp: the media player. :param play: callback to play audio samples (must not be None). :param pause: callback to pause playback (or None to ignore). :param resume: callback to resume playback (or None to ignore). :param flush: callback to flush audio buffers (or None to ignore). :param drain: callback to drain audio buffers (or None to ignore). :param opaque: private pointer for the audio callbacks (as first parameter). :version: LibVLC 2.0.0 or later. """ f = _Cfunctions.get("libvlc_audio_set_callbacks", None) or _Cfunction( "libvlc_audio_set_callbacks", ( (1,), (1,), (1,), (1,), (1,), (1,), (1,), ), None, None, MediaPlayer, AudioPlayCb, AudioPauseCb, AudioResumeCb, AudioFlushCb, AudioDrainCb, ctypes.c_void_p, ) return f(mp, play, pause, resume, flush, drain, opaque) def libvlc_audio_set_channel(p_mi, channel): """Set current audio *channel*. :param p_mi: media player. :param channel: the audio channel, See :class:`AudioOutputChannel`. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_audio_set_channel", None) or _Cfunction( "libvlc_audio_set_channel", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_int, ) return f(p_mi, channel) def libvlc_audio_set_delay(p_mi, i_delay): """Set current audio delay. The audio delay will be reset to zero each time the media changes. :param p_mi: media player. :param i_delay: the audio delay (microseconds). :return: 0 on success, -1 on error. :version: LibVLC 1.1.1 or later. """ f = _Cfunctions.get("libvlc_audio_set_delay", None) or _Cfunction( "libvlc_audio_set_delay", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_int64, ) return f(p_mi, i_delay) def libvlc_audio_set_format(mp, format, rate, channels): """Sets a fixed decoded audio *format*. This only works in combination with :func:`libvlc_audio_set_callbacks`, and is mutually exclusive with :func:`libvlc_audio_set_format_callbacks`. :param mp: the media player. :param format: a four-characters string identifying the sample format. (e.g. "S16N" or "f32l"). :param rate: sample rate (expressed in Hz). :param channels: channels count. :version: LibVLC 2.0.0 or later. """ f = _Cfunctions.get("libvlc_audio_set_format", None) or _Cfunction( "libvlc_audio_set_format", ( (1,), (1,), (1,), (1,), ), None, None, MediaPlayer, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint, ) return f(mp, format, rate, channels) def libvlc_audio_set_format_callbacks(mp, setup, cleanup): """Sets decoded audio format via callbacks. This only works in combination with :func:`libvlc_audio_set_callbacks`. :param mp: the media player. :param setup: callback to select the audio format (cannot be None). :param cleanup: callback to release any allocated resources (or None). :version: LibVLC 2.0.0 or later. """ f = _Cfunctions.get("libvlc_audio_set_format_callbacks", None) or _Cfunction( "libvlc_audio_set_format_callbacks", ( (1,), (1,), (1,), ), None, None, MediaPlayer, AudioSetupCb, AudioCleanupCb, ) return f(mp, setup, cleanup) def libvlc_audio_set_mute(p_mi, status): """Set mute *status*. .. 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. :param p_mi: media player. :param status: If status is true then mute, otherwise unmute. """ f = _Cfunctions.get("libvlc_audio_set_mute", None) or _Cfunction( "libvlc_audio_set_mute", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_int, ) return f(p_mi, status) def libvlc_audio_set_track(p_mi, i_track): """Set current audio track. :param p_mi: media player. :param i_track: the track ID (i_id field from track description). :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_audio_set_track", None) or _Cfunction( "libvlc_audio_set_track", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_int, ) return f(p_mi, i_track) def libvlc_audio_set_volume(p_mi, i_volume): """Set current software audio volume. :param p_mi: media player. :param i_volume: the volume in percents (0 = mute, 100 = 0dB). :return: 0 if the volume was set, -1 if it was out of range. """ f = _Cfunctions.get("libvlc_audio_set_volume", None) or _Cfunction( "libvlc_audio_set_volume", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_int, ) return f(p_mi, i_volume) def libvlc_audio_set_volume_callback(mp, set_volume): """Set callbacks and private data for decoded audio. This only works in combination with :func:`libvlc_audio_set_callbacks`. Use :func:`libvlc_audio_set_format` or :func:`libvlc_audio_set_format_callbacks` to configure the decoded audio format. :param mp: the media player. :param set_volume: callback to apply audio volume, or None to apply volume in software. :version: LibVLC 2.0.0 or later. """ f = _Cfunctions.get("libvlc_audio_set_volume_callback", None) or _Cfunction( "libvlc_audio_set_volume_callback", ( (1,), (1,), ), None, None, MediaPlayer, AudioSetVolumeCb, ) return f(mp, set_volume) def libvlc_audio_toggle_mute(p_mi): """Toggle mute status. .. 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 :func:`libvlc_audio_set_mute`. :param p_mi: media player. """ f = _Cfunctions.get("libvlc_audio_toggle_mute", None) or _Cfunction( "libvlc_audio_toggle_mute", ((1,),), None, None, MediaPlayer ) return f(p_mi) def libvlc_chapter_descriptions_release(p_chapters, i_count): """Release a chapter description :param p_chapters: chapter description array to release. :param i_count: number of chapter descriptions to release. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_chapter_descriptions_release", None) or _Cfunction( "libvlc_chapter_descriptions_release", ( (1,), (1,), ), None, None, ctypes.POINTER(ctypes.POINTER(ChapterDescription)), ctypes.c_uint, ) return f(p_chapters, i_count) def libvlc_clearerr(): """Clears the LibVLC error status for the current thread. This is optional. By default, the error status is automatically overridden when a new error occurs, and destroyed when the thread exits. """ f = _Cfunctions.get("libvlc_clearerr", None) or _Cfunction( "libvlc_clearerr", (), None, None ) return f() def libvlc_clock(): """Return the current time as defined by LibVLC. The unit is the microsecond. Time increases monotonically (regardless of time zone changes and RTC adjustements). The origin is arbitrary but consistent across the whole system (e.g. the system uptim, the time since the system was booted). .. note:: On systems that support it, the POSIX monotonic clock is used. """ f = _Cfunctions.get("libvlc_clock", None) or _Cfunction( "libvlc_clock", (), None, ctypes.c_int64 ) return f() def libvlc_dialog_dismiss(p_id): """Dismiss a dialog After this call, *p_id* won't be valid anymore See :class:`DialogCbs`.pf_cancel :param p_id: id of the dialog. :return: 0 on success, or -1 on error. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_dialog_dismiss", None) or _Cfunction( "libvlc_dialog_dismiss", ((1,),), None, ctypes.c_int, ctypes.c_void_p ) return f(p_id) def libvlc_dialog_get_context(p_id): """Return the opaque pointer associated with the dialog id :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_dialog_get_context", None) or _Cfunction( "libvlc_dialog_get_context", ((1,),), None, ctypes.c_void_p, ctypes.c_void_p ) return f(p_id) def libvlc_dialog_post_action(p_id, i_action): """Post a question answer After this call, *p_id* won't be valid anymore See :class:`DialogCbs`.pf_display_question :param p_id: id of the dialog. :param i_action: 1 for action1, 2 for action2. :return: 0 on success, or -1 on error. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_dialog_post_action", None) or _Cfunction( "libvlc_dialog_post_action", ( (1,), (1,), ), None, ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ) return f(p_id, i_action) def libvlc_dialog_post_login(p_id, psz_username, psz_password, b_store): """Post a login answer After this call, *p_id* won't be valid anymore See :class:`DialogCbs`.pf_display_login :param p_id: id of the dialog. :param psz_username: valid and non empty string. :param psz_password: valid string (can be empty). :param b_store: if true, store the credentials. :return: 0 on success, or -1 on error. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_dialog_post_login", None) or _Cfunction( "libvlc_dialog_post_login", ( (1,), (1,), (1,), (1,), ), None, ctypes.c_int, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_bool, ) return f(p_id, psz_username, psz_password, b_store) def libvlc_dialog_set_callbacks(p_instance, p_cbs, p_data): """Register callbacks in order to handle VLC dialogs :param p_cbs: a pointer to callbacks, or None to unregister callbacks. :param p_data: opaque pointer for the callback. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_dialog_set_callbacks", None) or _Cfunction( "libvlc_dialog_set_callbacks", ( (1,), (1,), (1,), ), None, None, Instance, ctypes.POINTER(DialogCbs), ctypes.c_void_p, ) return f(p_instance, p_cbs, p_data) def libvlc_dialog_set_context(p_id, p_context): """Associate an opaque pointer with the dialog id :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_dialog_set_context", None) or _Cfunction( "libvlc_dialog_set_context", ( (1,), (1,), ), None, None, ctypes.c_void_p, ctypes.c_void_p, ) return f(p_id, p_context) def libvlc_errmsg(): """A human-readable error message for the last LibVLC error in the calling thread. The resulting string is valid until another error occurs (at least until the next LibVLC call). .. warning:: This will be None if there was no error. """ f = _Cfunctions.get("libvlc_errmsg", None) or _Cfunction( "libvlc_errmsg", (), None, ctypes.c_char_p ) return f() def libvlc_event_attach(p_event_manager, i_event_type, f_callback, user_data): """Register for an event notification. :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. :param i_event_type: the desired event to which we want to listen. :param f_callback: the function to call when i_event_type occurs. :param user_data: user provided data to carry with the event. :return: 0 on success, ENOMEM on error. """ f = _Cfunctions.get("libvlc_event_attach", None) or _Cfunction( "libvlc_event_attach", ( (1,), (1,), (1,), (1,), ), None, ctypes.c_int, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p, ) return f(p_event_manager, i_event_type, f_callback, user_data) def libvlc_event_detach(p_event_manager, i_event_type, f_callback, p_user_data): """Unregister an event notification. :param p_event_manager: the event manager. :param i_event_type: the desired event to which we want to unregister. :param f_callback: the function to call when i_event_type occurs. :param p_user_data: user provided data to carry with the event. """ f = _Cfunctions.get("libvlc_event_detach", None) or _Cfunction( "libvlc_event_detach", ( (1,), (1,), (1,), (1,), ), None, None, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p, ) return f(p_event_manager, i_event_type, f_callback, p_user_data) def libvlc_event_type_name(event_type): """Get an event's type name. :param event_type: the desired event. """ f = _Cfunctions.get("libvlc_event_type_name", None) or _Cfunction( "libvlc_event_type_name", ((1,),), None, ctypes.c_char_p, ctypes.c_uint ) return f(event_type) def libvlc_free(ptr): """Frees an heap allocation returned by a LibVLC function. If you know you're using the same underlying C run-time as the LibVLC implementation, then you can call ANSI C free() directly instead. :param ptr: the pointer. """ f = _Cfunctions.get("libvlc_free", None) or _Cfunction( "libvlc_free", ((1,),), None, None, ctypes.c_void_p ) return f(ptr) def libvlc_get_changeset(): """Retrieve libvlc changeset. Example: "aa9bce0bc4" :return: a string containing the libvlc changeset. """ f = _Cfunctions.get("libvlc_get_changeset", None) or _Cfunction( "libvlc_get_changeset", (), None, ctypes.c_char_p ) return f() def libvlc_get_compiler(): """Retrieve libvlc compiler version. Example: "gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)" :return: a string containing the libvlc compiler version. """ f = _Cfunctions.get("libvlc_get_compiler", None) or _Cfunction( "libvlc_get_compiler", (), None, ctypes.c_char_p ) return f() def libvlc_get_fullscreen(p_mi): """Get current fullscreen status. :param p_mi: the media player. :return: the fullscreen status (boolean). """ f = _Cfunctions.get("libvlc_get_fullscreen", None) or _Cfunction( "libvlc_get_fullscreen", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_get_log_verbosity(p_instance): """Always returns minus one. This function is only provided for backward compatibility. :param p_instance: ignored. :return: always -1. """ f = _Cfunctions.get("libvlc_get_log_verbosity", None) or _Cfunction( "libvlc_get_log_verbosity", ((1,),), None, ctypes.c_uint, Instance ) return f(p_instance) def libvlc_get_version(): """Retrieve libvlc version. Example: "1.1.0-git The Luggage" :return: a string containing the libvlc version. """ f = _Cfunctions.get("libvlc_get_version", None) or _Cfunction( "libvlc_get_version", (), None, ctypes.c_char_p ) return f() def libvlc_log_clear(p_log): """This function does nothing. It is only provided for backward compatibility. :param p_log: ignored. """ f = _Cfunctions.get("libvlc_log_clear", None) or _Cfunction( "libvlc_log_clear", ((1,),), None, None, Log_ptr ) return f(p_log) def libvlc_log_close(p_log): """Frees memory allocated by :func:`libvlc_log_open`. :param p_log: libvlc log instance or None. """ f = _Cfunctions.get("libvlc_log_close", None) or _Cfunction( "libvlc_log_close", ((1,),), None, None, Log_ptr ) return f(p_log) def libvlc_log_count(p_log): """Always returns zero. This function is only provided for backward compatibility. :param p_log: ignored. :return: always zero. """ f = _Cfunctions.get("libvlc_log_count", None) or _Cfunction( "libvlc_log_count", ((1,),), None, ctypes.c_uint, Log_ptr ) return f(p_log) def libvlc_log_get_context(ctx, module, file): """Gets log message debug infos. This function retrieves self-debug information about a log message: * the name of the VLC *module* emitting the message, * the name of the source code *module* (i.e. *file*) and * the *line* number within the source code *module*. The returned *module* name and *file* name will be None if unknown. The returned *line* number will similarly be zero if unknown. .. warning:: The returned *module* name and source code *file* name, if non-None, are only valid until the logging callback returns. :param ctx: message context (as passed to the :class:`LogCb` callback). :param module: module name storage (or None) [OUT]. :param file: source code file name storage (or None) [OUT]. :param line: source code file line number storage (or None) [OUT]. :version: LibVLC 2.1.0 or later. """ f = _Cfunctions.get("libvlc_log_get_context", None) or _Cfunction( "libvlc_log_get_context", ( (1,), (1,), (1,), (2,), ), None, None, Log_ptr, ListPOINTER(ctypes.c_char_p), ListPOINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_uint), ) return f(ctx, module, file) def libvlc_log_get_iterator(p_log): """This function does nothing useful. It is only provided for backward compatibility. :param p_log: ignored. :return: an unique pointer or None on error or if the parameter was None. """ f = _Cfunctions.get("libvlc_log_get_iterator", None) or _Cfunction( "libvlc_log_get_iterator", ((1,),), class_result(LogIterator), ctypes.c_void_p, Log_ptr, ) return f(p_log) def libvlc_log_get_object(ctx, name, header, id): """Gets log message info. This function retrieves meta-information about a log message: * the type *name* of the VLC object emitting the message, * the object *header* if any, and * a temporaly-unique object identifier. This information is mainly meant for **manual** troubleshooting. The returned type *name* may be "generic" if unknown, but it cannot be None. The returned *header* will be None if unset; in current versions, the header is used to distinguish for VLM inputs. The returned object ID will be zero if the message is not associated with any VLC object. .. warning:: The returned module *name* and source code file *name*, if non-None, are only valid until the logging callback returns. :param ctx: message context (as passed to the :class:`LogCb` callback). :param name: object name storage (or None) [OUT]. :param header: object header (or None) [OUT]. :param line: source code file line number storage (or None) [OUT]. :version: LibVLC 2.1.0 or later. """ f = _Cfunctions.get("libvlc_log_get_object", None) or _Cfunction( "libvlc_log_get_object", ( (1,), (1,), (1,), (1,), ), None, None, Log_ptr, ListPOINTER(ctypes.c_char_p), ListPOINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_uint), ) return f(ctx, name, header, id) def libvlc_log_iterator_free(p_iter): """Frees memory allocated by :func:`libvlc_log_get_iterator`. :param p_iter: libvlc log iterator or None. """ f = _Cfunctions.get("libvlc_log_iterator_free", None) or _Cfunction( "libvlc_log_iterator_free", ((1,),), None, None, LogIterator ) return f(p_iter) def libvlc_log_iterator_has_next(p_iter): """Always returns zero. This function is only provided for backward compatibility. :param p_iter: ignored. :return: always zero. """ f = _Cfunctions.get("libvlc_log_iterator_has_next", None) or _Cfunction( "libvlc_log_iterator_has_next", ((1,),), None, ctypes.c_int, LogIterator ) return f(p_iter) def libvlc_log_iterator_next(p_iter, p_buf): """Always returns None. This function is only provided for backward compatibility. :param p_iter: libvlc log iterator or None. :param p_buf: ignored. :return: always None. """ f = _Cfunctions.get("libvlc_log_iterator_next", None) or _Cfunction( "libvlc_log_iterator_next", ( (1,), (1,), ), None, ctypes.POINTER(LogMessage), LogIterator, ctypes.POINTER(LogMessage), ) return f(p_iter, p_buf) def libvlc_log_open(p_instance): """This function does nothing useful. It is only provided for backward compatibility. :param p_instance: libvlc instance. :return: an unique pointer or None on error. """ f = _Cfunctions.get("libvlc_log_open", None) or _Cfunction( "libvlc_log_open", ((1,),), None, Log_ptr, Instance ) return f(p_instance) def libvlc_log_set(p_instance, cb, data): """Sets the logging callback for a LibVLC instance. This function is thread-safe: it will wait for any pending callbacks invocation to complete. .. 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. :param cb: callback function pointer. :param data: opaque data pointer for the callback function. :param p_instance: libvlc instance. :version: LibVLC 2.1.0 or later. """ f = _Cfunctions.get("libvlc_log_set", None) or _Cfunction( "libvlc_log_set", ( (1,), (1,), (1,), ), None, None, Instance, LogCb, ctypes.c_void_p, ) return f(p_instance, cb, data) def libvlc_log_set_file(p_instance, stream): """Sets up logging to a file. :param p_instance: libvlc instance. :param stream: FILE pointer opened for writing. (the FILE pointer must remain valid until libvlc_log_unset). :version: LibVLC 2.1.0 or later. """ f = _Cfunctions.get("libvlc_log_set_file", None) or _Cfunction( "libvlc_log_set_file", ( (1,), (1,), ), None, None, Instance, FILE_ptr, ) return f(p_instance, stream) def libvlc_log_unset(p_instance): """Unsets the logging callback. This function deregisters the logging callback for a LibVLC instance. This is rarely needed as the callback is implicitly unset when the instance is destroyed. .. note:: This function will wait for any pending callbacks invocation to complete (causing a deadlock if called from within the callback). :param p_instance: libvlc instance. :version: LibVLC 2.1.0 or later. """ f = _Cfunctions.get("libvlc_log_unset", None) or _Cfunction( "libvlc_log_unset", ((1,),), None, None, Instance ) return f(p_instance) def libvlc_media_add_option(p_md, psz_options): """Add an option to the media. This option will be used to determine how the media_player will read the media. This allows to use VLC's advanced reading/streaming options on a per-media basis. .. note:: The options are listed in 'vlc --long-help' from the command line, e.g. "-sout-all". Keep in mind that available options and their semantics vary across LibVLC versions and builds. .. warning:: Not all options affects :class:`Media` objects: Specifically, due to architectural issues most audio and video options, such as text renderer options, have no effects on an individual media. These options must be set through :func:`libvlc_new` instead. :param p_md: the media descriptor. :param psz_options: the options (as a string). """ f = _Cfunctions.get("libvlc_media_add_option", None) or _Cfunction( "libvlc_media_add_option", ( (1,), (1,), ), None, None, Media, ctypes.c_char_p, ) return f(p_md, psz_options) def libvlc_media_add_option_flag(p_md, psz_options, i_flags): """Add an option to the media with configurable flags. This option will be used to determine how the media_player will read the media. This allows to use VLC's advanced reading/streaming options on a per-media basis. The options are detailed in vlc --long-help, for instance "--sout-all". Note that all options are not usable on medias: specifically, due to architectural issues, video-related options such as text renderer options cannot be set on a single media. They must be set on the whole libvlc instance instead. :param p_md: the media descriptor. :param psz_options: the options (as a string). :param i_flags: the flags for this option. """ f = _Cfunctions.get("libvlc_media_add_option_flag", None) or _Cfunction( "libvlc_media_add_option_flag", ( (1,), (1,), (1,), ), None, None, Media, ctypes.c_char_p, ctypes.c_uint, ) return f(p_md, psz_options, i_flags) def libvlc_media_discoverer_event_manager(p_mdis): """Get event manager from media service discover object. .. warning:: **Deprecated!** Useless, media_discoverer events are only triggered when calling :func:`libvlc_media_discoverer_start` and :func:`libvlc_media_discoverer_stop`. :param p_mdis: media service discover object. :return: event manager object. """ f = _Cfunctions.get("libvlc_media_discoverer_event_manager", None) or _Cfunction( "libvlc_media_discoverer_event_manager", ((1,),), class_result(EventManager), ctypes.c_void_p, MediaDiscoverer, ) return f(p_mdis) def libvlc_media_discoverer_is_running(p_mdis): """Query if media service discover object is running. :param p_mdis: media service discover object. :return: true if running, false if not. """ f = _Cfunctions.get("libvlc_media_discoverer_is_running", None) or _Cfunction( "libvlc_media_discoverer_is_running", ((1,),), None, ctypes.c_int, MediaDiscoverer, ) return f(p_mdis) def libvlc_media_discoverer_list_get(p_inst, i_cat, ppp_services): """Get media discoverer services by category :param p_inst: libvlc instance. :param i_cat: category of services to fetch. :param ppp_services: address to store an allocated array of media discoverer. services (must be freed with :func:`libvlc_media_discoverer_list_release` by. the caller) [OUT]. :return: the number of media discoverer services (0 on error). :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_discoverer_list_get", None) or _Cfunction( "libvlc_media_discoverer_list_get", ( (1,), (1,), (1,), ), None, ctypes.c_size_t, Instance, MediaDiscovererCategory, ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(MediaDiscovererDescription))), ) return f(p_inst, i_cat, ppp_services) def libvlc_media_discoverer_list_release(pp_services, i_count): """Release an array of media discoverer services See :func:`libvlc_media_discoverer_list_get` :param pp_services: array to release. :param i_count: number of elements in the array. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_discoverer_list_release", None) or _Cfunction( "libvlc_media_discoverer_list_release", ( (1,), (1,), ), None, None, ctypes.POINTER(ctypes.POINTER(MediaDiscovererDescription)), ctypes.c_size_t, ) return f(pp_services, i_count) def libvlc_media_discoverer_localized_name(p_mdis): """Get media service discover object its localized name. .. warning:: **Deprecated!** Useless, use :func:`libvlc_media_discoverer_list_get` to get the longname of the service discovery. :param p_mdis: media discover object. :return: localized name or None if the media_discoverer is not started. """ f = _Cfunctions.get("libvlc_media_discoverer_localized_name", None) or _Cfunction( "libvlc_media_discoverer_localized_name", ((1,),), string_result, ctypes.c_void_p, MediaDiscoverer, ) return f(p_mdis) def libvlc_media_discoverer_media_list(p_mdis): """Get media service discover media list. :param p_mdis: media service discover object. :return: list of media items. """ f = _Cfunctions.get("libvlc_media_discoverer_media_list", None) or _Cfunction( "libvlc_media_discoverer_media_list", ((1,),), class_result(MediaList), ctypes.c_void_p, MediaDiscoverer, ) return f(p_mdis) def libvlc_media_discoverer_new(p_inst, psz_name): """Create a media discoverer object by name. After this object is created, you should attach to media_list events in order to be notified of new items discovered. You need to call :func:`libvlc_media_discoverer_start` in order to start the discovery. See :func:`libvlc_media_discoverer_media_list` See :func:`libvlc_media_discoverer_event_manager` See :func:`libvlc_media_discoverer_start` :param p_inst: libvlc instance. :param psz_name: service name; use :func:`libvlc_media_discoverer_list_get` to get. a list of the discoverer names available in this libVLC instance. :return: media discover object or None in case of error. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_media_discoverer_new", None) or _Cfunction( "libvlc_media_discoverer_new", ( (1,), (1,), ), class_result(MediaDiscoverer), ctypes.c_void_p, Instance, ctypes.c_char_p, ) return f(p_inst, psz_name) def libvlc_media_discoverer_new_from_name(p_inst, psz_name): """.. warning:: **Deprecated!** Use :func:`libvlc_media_discoverer_new` and :func:`libvlc_media_discoverer_start`.""" f = _Cfunctions.get("libvlc_media_discoverer_new_from_name", None) or _Cfunction( "libvlc_media_discoverer_new_from_name", ( (1,), (1,), ), class_result(MediaDiscoverer), ctypes.c_void_p, Instance, ctypes.c_char_p, ) return f(p_inst, psz_name) def libvlc_media_discoverer_release(p_mdis): """Release media discover object. If the reference count reaches 0, then the object will be released. :param p_mdis: media service discover object. """ f = _Cfunctions.get("libvlc_media_discoverer_release", None) or _Cfunction( "libvlc_media_discoverer_release", ((1,),), None, None, MediaDiscoverer ) return f(p_mdis) def libvlc_media_discoverer_start(p_mdis): """Start media discovery. To stop it, call :func:`libvlc_media_discoverer_stop` or :func:`libvlc_media_discoverer_list_release` directly. See :func:`libvlc_media_discoverer_stop` :param p_mdis: media discover object. :return: -1 in case of error, 0 otherwise. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_media_discoverer_start", None) or _Cfunction( "libvlc_media_discoverer_start", ((1,),), None, ctypes.c_int, MediaDiscoverer ) return f(p_mdis) def libvlc_media_discoverer_stop(p_mdis): """Stop media discovery. See :func:`libvlc_media_discoverer_start` :param p_mdis: media discover object. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_media_discoverer_stop", None) or _Cfunction( "libvlc_media_discoverer_stop", ((1,),), None, None, MediaDiscoverer ) return f(p_mdis) def libvlc_media_duplicate(p_md): """Duplicate a media descriptor object. :param p_md: a media descriptor object. """ f = _Cfunctions.get("libvlc_media_duplicate", None) or _Cfunction( "libvlc_media_duplicate", ((1,),), class_result(Media), ctypes.c_void_p, Media ) return f(p_md) def libvlc_media_event_manager(p_md): """Get event manager from media descriptor object. NOTE: this function doesn't increment reference counting. :param p_md: a media descriptor object. :return: event manager object. """ f = _Cfunctions.get("libvlc_media_event_manager", None) or _Cfunction( "libvlc_media_event_manager", ((1,),), class_result(EventManager), ctypes.c_void_p, Media, ) return f(p_md) def libvlc_media_get_codec_description(i_type, i_codec): """Get codec description from media elementary stream See :class:`MediaTrack` :param i_type: i_type from :class:`MediaTrack`. :param i_codec: i_codec or i_original_fourcc from :class:`MediaTrack`. :return: codec description. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_get_codec_description", None) or _Cfunction( "libvlc_media_get_codec_description", ( (1,), (1,), ), None, ctypes.c_char_p, TrackType, ctypes.c_uint32, ) return f(i_type, i_codec) def libvlc_media_get_duration(p_md): """Get duration (in ms) of media descriptor object item. :param p_md: media descriptor object. :return: duration of media item or -1 on error. """ f = _Cfunctions.get("libvlc_media_get_duration", None) or _Cfunction( "libvlc_media_get_duration", ((1,),), None, ctypes.c_longlong, Media ) return f(p_md) def libvlc_media_get_meta(p_md, e_meta): """Read the meta of the media. If the media has not yet been parsed this will return None. See :func:`libvlc_media_parse` See :func:`libvlc_media_parse_with_options` See libvlc_MediaMetaChanged :param p_md: the media descriptor. :param e_meta: the meta to read. :return: the media's meta. """ f = _Cfunctions.get("libvlc_media_get_meta", None) or _Cfunction( "libvlc_media_get_meta", ( (1,), (1,), ), string_result, ctypes.c_void_p, Media, Meta, ) return f(p_md, e_meta) def libvlc_media_get_mrl(p_md): """Get the media resource locator (mrl) from a media descriptor object :param p_md: a media descriptor object. :return: string with mrl of media descriptor object. """ f = _Cfunctions.get("libvlc_media_get_mrl", None) or _Cfunction( "libvlc_media_get_mrl", ((1,),), string_result, ctypes.c_void_p, Media ) return f(p_md) def libvlc_media_get_parsed_status(p_md): """Get Parsed status for media descriptor object. See libvlc_MediaParsedChanged See :class:`MediaParsedStatus` :param p_md: media descriptor object. :return: a value of the :class:`MediaParsedStatus` enum. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_media_get_parsed_status", None) or _Cfunction( "libvlc_media_get_parsed_status", ((1,),), None, MediaParsedStatus, Media ) return f(p_md) def libvlc_media_get_state(p_md): """Get current state of media descriptor object. Possible media states are libvlc_NothingSpecial=0, libvlc_Opening, libvlc_Playing, libvlc_Paused, libvlc_Stopped, libvlc_Ended, libvlc_Error. See :class:`State`. :param p_md: a media descriptor object. :return: state of media descriptor object. """ f = _Cfunctions.get("libvlc_media_get_state", None) or _Cfunction( "libvlc_media_get_state", ((1,),), None, State, Media ) return f(p_md) def libvlc_media_get_stats(p_md, p_stats): """Get the current statistics about the media. :param p_md:: media descriptor object. :param p_stats:: structure that contain the statistics about the media. (this structure must be allocated by the caller). :return: true if the statistics are available, false otherwise. """ f = _Cfunctions.get("libvlc_media_get_stats", None) or _Cfunction( "libvlc_media_get_stats", ( (1,), (1,), ), None, ctypes.c_int, Media, ctypes.POINTER(MediaStats), ) return f(p_md, p_stats) def libvlc_media_get_tracks_info(p_md): """Get media descriptor's elementary streams description Note, you need to call :func:`libvlc_media_parse` or play the media at least once before calling this function. Not doing this will result in an empty array. .. warning:: **Deprecated!** Use :func:`libvlc_media_tracks_get` instead :param p_md: media descriptor object. :param tracks: address to store an allocated array of Elementary Streams. descriptions (must be freed by the caller) [OUT]. :return: the number of Elementary Streams. """ f = _Cfunctions.get("libvlc_media_get_tracks_info", None) or _Cfunction( "libvlc_media_get_tracks_info", ( (1,), (2,), ), None, ctypes.c_int, Media, ctypes.POINTER(ctypes.POINTER(MediaTrackInfo)), ) return f(p_md) def libvlc_media_get_type(p_md): """Get the media type of the media descriptor object See :class:`MediaType` :param p_md: media descriptor object. :return: media type. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_get_type", None) or _Cfunction( "libvlc_media_get_type", ((1,),), None, MediaType, Media ) return f(p_md) def libvlc_media_get_user_data(p_md): """Get media descriptor's user_data. user_data is specialized data accessed by the host application, VLC.framework uses it as a pointer to an native object that references a :class:`Media` pointer :param p_md: media descriptor object. """ f = _Cfunctions.get("libvlc_media_get_user_data", None) or _Cfunction( "libvlc_media_get_user_data", ((1,),), None, ctypes.c_void_p, Media ) return f(p_md) def libvlc_media_is_parsed(p_md): """Return true is the media descriptor object is parsed .. warning:: **Deprecated!** This can return true in case of failure. Use :func:`libvlc_media_get_parsed_status` instead See libvlc_MediaParsedChanged :param p_md: media descriptor object. :return: true if media object has been parsed otherwise it returns false. """ f = _Cfunctions.get("libvlc_media_is_parsed", None) or _Cfunction( "libvlc_media_is_parsed", ((1,),), None, ctypes.c_int, Media ) return f(p_md) def libvlc_media_library_load(p_mlib): """Load media library. :param p_mlib: media library object. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_media_library_load", None) or _Cfunction( "libvlc_media_library_load", ((1,),), None, ctypes.c_int, MediaLibrary ) return f(p_mlib) def libvlc_media_library_media_list(p_mlib): """Get media library subitems. :param p_mlib: media library object. :return: media list subitems. """ f = _Cfunctions.get("libvlc_media_library_media_list", None) or _Cfunction( "libvlc_media_library_media_list", ((1,),), class_result(MediaList), ctypes.c_void_p, MediaLibrary, ) return f(p_mlib) def libvlc_media_library_new(p_instance): """Create an new Media Library object :param p_instance: the libvlc instance. :return: a new object or None on error. """ f = _Cfunctions.get("libvlc_media_library_new", None) or _Cfunction( "libvlc_media_library_new", ((1,),), class_result(MediaLibrary), ctypes.c_void_p, Instance, ) return f(p_instance) def libvlc_media_library_release(p_mlib): """Release media library object. This functions decrements the reference count of the media library object. If it reaches 0, then the object will be released. :param p_mlib: media library object. """ f = _Cfunctions.get("libvlc_media_library_release", None) or _Cfunction( "libvlc_media_library_release", ((1,),), None, None, MediaLibrary ) return f(p_mlib) def libvlc_media_library_retain(p_mlib): """Retain a reference to a media library object. This function will increment the reference counting for this object. Use :func:`libvlc_media_library_release` to decrement the reference count. :param p_mlib: media library object. """ f = _Cfunctions.get("libvlc_media_library_retain", None) or _Cfunction( "libvlc_media_library_retain", ((1,),), None, None, MediaLibrary ) return f(p_mlib) def libvlc_media_list_add_media(p_ml, p_md): """Add media instance to media list The :func:`libvlc_media_list_lock` should be held upon entering this function. :param p_ml: a media list instance. :param p_md: a media instance. :return: 0 on success, -1 if the media list is read-only. """ f = _Cfunctions.get("libvlc_media_list_add_media", None) or _Cfunction( "libvlc_media_list_add_media", ( (1,), (1,), ), None, ctypes.c_int, MediaList, Media, ) return f(p_ml, p_md) def libvlc_media_list_count(p_ml): """Get count on media list items The :func:`libvlc_media_list_lock` should be held upon entering this function. :param p_ml: a media list instance. :return: number of items in media list. """ f = _Cfunctions.get("libvlc_media_list_count", None) or _Cfunction( "libvlc_media_list_count", ((1,),), None, ctypes.c_int, MediaList ) return f(p_ml) def libvlc_media_list_event_manager(p_ml): """Get libvlc_event_manager from this media list instance. The p_event_manager is immutable, so you don't have to hold the lock :param p_ml: a media list instance. :return: libvlc_event_manager. """ f = _Cfunctions.get("libvlc_media_list_event_manager", None) or _Cfunction( "libvlc_media_list_event_manager", ((1,),), class_result(EventManager), ctypes.c_void_p, MediaList, ) return f(p_ml) def libvlc_media_list_index_of_item(p_ml, p_md): """Find index position of List media instance in media list. Warning: the function will return the first matched position. The :func:`libvlc_media_list_lock` should be held upon entering this function. :param p_ml: a media list instance. :param p_md: media instance. :return: position of media instance or -1 if media not found. """ f = _Cfunctions.get("libvlc_media_list_index_of_item", None) or _Cfunction( "libvlc_media_list_index_of_item", ( (1,), (1,), ), None, ctypes.c_int, MediaList, Media, ) return f(p_ml, p_md) def libvlc_media_list_insert_media(p_ml, p_md, i_pos): """Insert media instance in media list on a position The :func:`libvlc_media_list_lock` should be held upon entering this function. :param p_ml: a media list instance. :param p_md: a media instance. :param i_pos: position in array where to insert. :return: 0 on success, -1 if the media list is read-only. """ f = _Cfunctions.get("libvlc_media_list_insert_media", None) or _Cfunction( "libvlc_media_list_insert_media", ( (1,), (1,), (1,), ), None, ctypes.c_int, MediaList, Media, ctypes.c_int, ) return f(p_ml, p_md, i_pos) def libvlc_media_list_is_readonly(p_ml): """This indicates if this media list is read-only from a user point of view :param p_ml: media list instance. :return: 1 on readonly, 0 on readwrite. """ f = _Cfunctions.get("libvlc_media_list_is_readonly", None) or _Cfunction( "libvlc_media_list_is_readonly", ((1,),), None, ctypes.c_int, MediaList ) return f(p_ml) def libvlc_media_list_item_at_index(p_ml, i_pos): """List media instance in media list at a position The :func:`libvlc_media_list_lock` should be held upon entering this function. :param p_ml: a media list instance. :param i_pos: position in array where to insert. :return: media instance at position *i_pos*, or None if not found. In case of success, :func:`libvlc_media_retain` is called to increase the refcount. on the media. """ f = _Cfunctions.get("libvlc_media_list_item_at_index", None) or _Cfunction( "libvlc_media_list_item_at_index", ( (1,), (1,), ), class_result(Media), ctypes.c_void_p, MediaList, ctypes.c_int, ) return f(p_ml, i_pos) def libvlc_media_list_lock(p_ml): """Get lock on media list items :param p_ml: a media list instance. """ f = _Cfunctions.get("libvlc_media_list_lock", None) or _Cfunction( "libvlc_media_list_lock", ((1,),), None, None, MediaList ) return f(p_ml) def libvlc_media_list_media(p_ml): """Get media instance from this media list instance. This action will increase the refcount on the media instance. The :func:`libvlc_media_list_lock` should NOT be held upon entering this function. :param p_ml: a media list instance. :return: media instance. """ f = _Cfunctions.get("libvlc_media_list_media", None) or _Cfunction( "libvlc_media_list_media", ((1,),), class_result(Media), ctypes.c_void_p, MediaList, ) return f(p_ml) def libvlc_media_list_new(p_instance): """Create an empty media list. :param p_instance: libvlc instance. :return: empty media list, or None on error. """ f = _Cfunctions.get("libvlc_media_list_new", None) or _Cfunction( "libvlc_media_list_new", ((1,),), class_result(MediaList), ctypes.c_void_p, Instance, ) return f(p_instance) def libvlc_media_list_player_event_manager(p_mlp): """Return the event manager of this media_list_player. :param p_mlp: media list player instance. :return: the event manager. """ f = _Cfunctions.get("libvlc_media_list_player_event_manager", None) or _Cfunction( "libvlc_media_list_player_event_manager", ((1,),), class_result(EventManager), ctypes.c_void_p, MediaListPlayer, ) return f(p_mlp) def libvlc_media_list_player_get_media_player(p_mlp): """Get media player of the media_list_player instance. .. note:: the caller is responsible for releasing the returned instance. :param p_mlp: media list player instance. :return: media player instance. """ f = _Cfunctions.get( "libvlc_media_list_player_get_media_player", None ) or _Cfunction( "libvlc_media_list_player_get_media_player", ((1,),), class_result(MediaPlayer), ctypes.c_void_p, MediaListPlayer, ) return f(p_mlp) def libvlc_media_list_player_get_state(p_mlp): """Get current libvlc_state of media list player :param p_mlp: media list player instance. :return: :class:`State` for media list player. """ f = _Cfunctions.get("libvlc_media_list_player_get_state", None) or _Cfunction( "libvlc_media_list_player_get_state", ((1,),), None, State, MediaListPlayer ) return f(p_mlp) def libvlc_media_list_player_is_playing(p_mlp): """Is media list playing? :param p_mlp: media list player instance. :return: true for playing and false for not playing. """ f = _Cfunctions.get("libvlc_media_list_player_is_playing", None) or _Cfunction( "libvlc_media_list_player_is_playing", ((1,),), None, ctypes.c_int, MediaListPlayer, ) return f(p_mlp) def libvlc_media_list_player_new(p_instance): """Create new media_list_player. :param p_instance: libvlc instance. :return: media list player instance or None on error. """ f = _Cfunctions.get("libvlc_media_list_player_new", None) or _Cfunction( "libvlc_media_list_player_new", ((1,),), class_result(MediaListPlayer), ctypes.c_void_p, Instance, ) return f(p_instance) def libvlc_media_list_player_next(p_mlp): """Play next item from media list :param p_mlp: media list player instance. :return: 0 upon success -1 if there is no next item. """ f = _Cfunctions.get("libvlc_media_list_player_next", None) or _Cfunction( "libvlc_media_list_player_next", ((1,),), None, ctypes.c_int, MediaListPlayer ) return f(p_mlp) def libvlc_media_list_player_pause(p_mlp): """Toggle pause (or resume) media list :param p_mlp: media list player instance. """ f = _Cfunctions.get("libvlc_media_list_player_pause", None) or _Cfunction( "libvlc_media_list_player_pause", ((1,),), None, None, MediaListPlayer ) return f(p_mlp) def libvlc_media_list_player_play(p_mlp): """Play media list :param p_mlp: media list player instance. """ f = _Cfunctions.get("libvlc_media_list_player_play", None) or _Cfunction( "libvlc_media_list_player_play", ((1,),), None, None, MediaListPlayer ) return f(p_mlp) def libvlc_media_list_player_play_item(p_mlp, p_md): """Play the given media item :param p_mlp: media list player instance. :param p_md: the media instance. :return: 0 upon success, -1 if the media is not part of the media list. """ f = _Cfunctions.get("libvlc_media_list_player_play_item", None) or _Cfunction( "libvlc_media_list_player_play_item", ( (1,), (1,), ), None, ctypes.c_int, MediaListPlayer, Media, ) return f(p_mlp, p_md) def libvlc_media_list_player_play_item_at_index(p_mlp, i_index): """Play media list item at position index :param p_mlp: media list player instance. :param i_index: index in media list to play. :return: 0 upon success -1 if the item wasn't found. """ f = _Cfunctions.get( "libvlc_media_list_player_play_item_at_index", None ) or _Cfunction( "libvlc_media_list_player_play_item_at_index", ( (1,), (1,), ), None, ctypes.c_int, MediaListPlayer, ctypes.c_int, ) return f(p_mlp, i_index) def libvlc_media_list_player_previous(p_mlp): """Play previous item from media list :param p_mlp: media list player instance. :return: 0 upon success -1 if there is no previous item. """ f = _Cfunctions.get("libvlc_media_list_player_previous", None) or _Cfunction( "libvlc_media_list_player_previous", ((1,),), None, ctypes.c_int, MediaListPlayer, ) return f(p_mlp) def libvlc_media_list_player_release(p_mlp): """Release a media_list_player after use Decrement the reference count of a media player object. If the reference count is 0, then :func:`libvlc_media_list_player_release` will release the media player object. If the media player object has been released, then it should not be used again. :param p_mlp: media list player instance. """ f = _Cfunctions.get("libvlc_media_list_player_release", None) or _Cfunction( "libvlc_media_list_player_release", ((1,),), None, None, MediaListPlayer ) return f(p_mlp) def libvlc_media_list_player_retain(p_mlp): """Retain a reference to a media player list object. Use :func:`libvlc_media_list_player_release` to decrement reference count. :param p_mlp: media player list object. """ f = _Cfunctions.get("libvlc_media_list_player_retain", None) or _Cfunction( "libvlc_media_list_player_retain", ((1,),), None, None, MediaListPlayer ) return f(p_mlp) def libvlc_media_list_player_set_media_list(p_mlp, p_mlist): """Set the media list associated with the player :param p_mlp: media list player instance. :param p_mlist: list of media. """ f = _Cfunctions.get("libvlc_media_list_player_set_media_list", None) or _Cfunction( "libvlc_media_list_player_set_media_list", ( (1,), (1,), ), None, None, MediaListPlayer, MediaList, ) return f(p_mlp, p_mlist) def libvlc_media_list_player_set_media_player(p_mlp, p_mi): """Replace media player in media_list_player with this instance. :param p_mlp: media list player instance. :param p_mi: media player instance. """ f = _Cfunctions.get( "libvlc_media_list_player_set_media_player", None ) or _Cfunction( "libvlc_media_list_player_set_media_player", ( (1,), (1,), ), None, None, MediaListPlayer, MediaPlayer, ) return f(p_mlp, p_mi) def libvlc_media_list_player_set_pause(p_mlp, do_pause): """Pause or resume media list :param p_mlp: media list player instance. :param do_pause: play/resume if zero, pause if non-zero. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_media_list_player_set_pause", None) or _Cfunction( "libvlc_media_list_player_set_pause", ( (1,), (1,), ), None, None, MediaListPlayer, ctypes.c_int, ) return f(p_mlp, do_pause) def libvlc_media_list_player_set_playback_mode(p_mlp, e_mode): """Sets the playback mode for the playlist :param p_mlp: media list player instance. :param e_mode: playback mode specification. """ f = _Cfunctions.get( "libvlc_media_list_player_set_playback_mode", None ) or _Cfunction( "libvlc_media_list_player_set_playback_mode", ( (1,), (1,), ), None, None, MediaListPlayer, PlaybackMode, ) return f(p_mlp, e_mode) def libvlc_media_list_player_stop(p_mlp): """Stop playing media list :param p_mlp: media list player instance. """ f = _Cfunctions.get("libvlc_media_list_player_stop", None) or _Cfunction( "libvlc_media_list_player_stop", ((1,),), None, None, MediaListPlayer ) return f(p_mlp) def libvlc_media_list_release(p_ml): """Release media list created with :func:`libvlc_media_list_new`. :param p_ml: a media list created with :func:`libvlc_media_list_new`. """ f = _Cfunctions.get("libvlc_media_list_release", None) or _Cfunction( "libvlc_media_list_release", ((1,),), None, None, MediaList ) return f(p_ml) def libvlc_media_list_remove_index(p_ml, i_pos): """Remove media instance from media list on a position The :func:`libvlc_media_list_lock` should be held upon entering this function. :param p_ml: a media list instance. :param i_pos: position in array where to insert. :return: 0 on success, -1 if the list is read-only or the item was not found. """ f = _Cfunctions.get("libvlc_media_list_remove_index", None) or _Cfunction( "libvlc_media_list_remove_index", ( (1,), (1,), ), None, ctypes.c_int, MediaList, ctypes.c_int, ) return f(p_ml, i_pos) def libvlc_media_list_retain(p_ml): """Retain reference to a media list :param p_ml: a media list created with :func:`libvlc_media_list_new`. """ f = _Cfunctions.get("libvlc_media_list_retain", None) or _Cfunction( "libvlc_media_list_retain", ((1,),), None, None, MediaList ) return f(p_ml) def libvlc_media_list_set_media(p_ml, p_md): """Associate media instance with this media list instance. If another media instance was present it will be released. The :func:`libvlc_media_list_lock` should NOT be held upon entering this function. :param p_ml: a media list instance. :param p_md: media instance to add. """ f = _Cfunctions.get("libvlc_media_list_set_media", None) or _Cfunction( "libvlc_media_list_set_media", ( (1,), (1,), ), None, None, MediaList, Media, ) return f(p_ml, p_md) def libvlc_media_list_unlock(p_ml): """Release lock on media list items The :func:`libvlc_media_list_lock` should be held upon entering this function. :param p_ml: a media list instance. """ f = _Cfunctions.get("libvlc_media_list_unlock", None) or _Cfunction( "libvlc_media_list_unlock", ((1,),), None, None, MediaList ) return f(p_ml) def libvlc_media_new_as_node(p_instance, psz_name): """Create a media as an empty node with a given name. See :func:`libvlc_media_release` :param p_instance: the instance. :param psz_name: the name of the node. :return: the new empty media or None on error. """ f = _Cfunctions.get("libvlc_media_new_as_node", None) or _Cfunction( "libvlc_media_new_as_node", ( (1,), (1,), ), class_result(Media), ctypes.c_void_p, Instance, ctypes.c_char_p, ) return f(p_instance, psz_name) def libvlc_media_new_callbacks(instance, open_cb, read_cb, seek_cb, close_cb, opaque): """Create a media with custom callbacks to read the data from. .. 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 :func:`libvlc_media_release` :param instance: LibVLC instance. :param open_cb: callback to open the custom bitstream input media. :param read_cb: callback to read data (must not be None). :param seek_cb: callback to seek, or None if seeking is not supported. :param close_cb: callback to close the media, or None if unnecessary. :param opaque: data pointer for the open callback. :return: the newly created media or None on error. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_new_callbacks", None) or _Cfunction( "libvlc_media_new_callbacks", ( (1,), (1,), (1,), (1,), (1,), (1,), ), class_result(Media), ctypes.c_void_p, Instance, MediaOpenCb, MediaReadCb, MediaSeekCb, MediaCloseCb, ctypes.c_void_p, ) return f(instance, open_cb, read_cb, seek_cb, close_cb, opaque) def libvlc_media_new_fd(p_instance, fd): """Create a media for an already open file descriptor. The file descriptor shall be open for reading (or reading and writing). Regular file descriptors, pipe read descriptors and character device descriptors (including TTYs) are supported on all platforms. Block device descriptors are supported where available. Directory descriptors are supported on systems that provide fdopendir(). Sockets are supported on all platforms where they are file descriptors, i.e. all except Windows. .. note:: This library will **not** automatically close the file descriptor under any circumstance. Nevertheless, a file descriptor can usually only be rendered once in a media player. To render it a second time, the file descriptor should probably be rewound to the beginning with lseek(). See :func:`libvlc_media_release` :param p_instance: the instance. :param fd: open file descriptor. :return: the newly created media or None on error. :version: LibVLC 1.1.5 and later. """ f = _Cfunctions.get("libvlc_media_new_fd", None) or _Cfunction( "libvlc_media_new_fd", ( (1,), (1,), ), class_result(Media), ctypes.c_void_p, Instance, ctypes.c_int, ) return f(p_instance, fd) def libvlc_media_new_location(p_instance, psz_mrl): """Create a media with a certain given media resource location, for instance a valid URL. .. note:: To refer to a local file with this function, the file://... URI syntax **must** be used (see IETF RFC3986). We recommend using :func:`libvlc_media_new_path` instead when dealing with local files. See :func:`libvlc_media_release` :param p_instance: the instance. :param psz_mrl: the media location. :return: the newly created media or None on error. """ f = _Cfunctions.get("libvlc_media_new_location", None) or _Cfunction( "libvlc_media_new_location", ( (1,), (1,), ), class_result(Media), ctypes.c_void_p, Instance, ctypes.c_char_p, ) return f(p_instance, psz_mrl) def libvlc_media_new_path(p_instance, path): """Create a media for a certain file *path*. See :func:`libvlc_media_release` :param p_instance: the instance. :param path: local filesystem path. :return: the newly created media or None on error. """ f = _Cfunctions.get("libvlc_media_new_path", None) or _Cfunction( "libvlc_media_new_path", ( (1,), (1,), ), class_result(Media), ctypes.c_void_p, Instance, ctypes.c_char_p, ) return f(p_instance, path) def libvlc_media_parse(p_md): """Parse a media. This fetches (local) art, meta data and tracks information. The method is synchronous. .. warning:: **Deprecated!** This function could block indefinitely. Use :func:`libvlc_media_parse_with_options` instead See :func:`libvlc_media_parse_with_options` See :func:`libvlc_media_get_meta` See :func:`libvlc_media_get_tracks_info` :param p_md: media descriptor object. """ f = _Cfunctions.get("libvlc_media_parse", None) or _Cfunction( "libvlc_media_parse", ((1,),), None, None, Media ) return f(p_md) def libvlc_media_parse_async(p_md): """Parse a media. This fetches (local) art, meta data and tracks information. The method is the asynchronous of :func:`libvlc_media_parse`. To track when this is over you can listen to libvlc_MediaParsedChanged event. However if the media was already parsed you will not receive this event. .. warning:: **Deprecated!** You can't be sure to receive the libvlc_MediaParsedChanged event (you can wait indefinitely for this event). Use :func:`libvlc_media_parse_with_options` instead See :func:`libvlc_media_parse` See libvlc_MediaParsedChanged See :func:`libvlc_media_get_meta` See :func:`libvlc_media_get_tracks_info` :param p_md: media descriptor object. """ f = _Cfunctions.get("libvlc_media_parse_async", None) or _Cfunction( "libvlc_media_parse_async", ((1,),), None, None, Media ) return f(p_md) def libvlc_media_parse_stop(p_md): """Stop the parsing of the media When the media parsing is stopped, the libvlc_MediaParsedChanged event will be sent with the libvlc_media_parsed_status_timeout status. See :func:`libvlc_media_parse_with_options` :param p_md: media descriptor object. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_media_parse_stop", None) or _Cfunction( "libvlc_media_parse_stop", ((1,),), None, None, Media ) return f(p_md) def libvlc_media_parse_with_options(p_md, parse_flag, timeout): """Parse the media asynchronously with options. This fetches (local or network) art, meta data and/or tracks information. This method is the extended version of :func:`libvlc_media_parse_with_options`. To track when this is over you can listen to libvlc_MediaParsedChanged event. However if this functions returns an error, you will not receive any events. It uses a flag to specify parse options (see libvlc_media_parse_flag_t). All these flags can be combined. By default, media is parsed if it's a local file. .. note:: Parsing can be aborted with :func:`libvlc_media_parse_stop`. See libvlc_MediaParsedChanged See :func:`libvlc_media_get_meta` See :func:`libvlc_media_tracks_get` See :func:`libvlc_media_get_parsed_status` See :class:`MediaParseFlag` :param p_md: media descriptor object. :param parse_flag: parse options: :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). :return: -1 in case of error, 0 otherwise. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_media_parse_with_options", None) or _Cfunction( "libvlc_media_parse_with_options", ( (1,), (1,), (1,), ), None, ctypes.c_int, Media, MediaParseFlag, ctypes.c_int, ) return f(p_md, parse_flag, timeout) def libvlc_media_player_add_slave(p_mi, i_type, psz_uri, b_select): """Add a slave to the current media player. .. note:: If the player is playing, the slave will be added directly. This call will also update the slave list of the attached :class:`Media`. See :func:`libvlc_media_slaves_add` :param p_mi: the media player. :param i_type: subtitle or audio. :param psz_uri: Uri of the slave (should contain a valid scheme). :param b_select: True if this slave should be selected when it's loaded. :return: 0 on success, -1 on error. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_player_add_slave", None) or _Cfunction( "libvlc_media_player_add_slave", ( (1,), (1,), (1,), (1,), ), None, ctypes.c_int, MediaPlayer, MediaSlaveType, ctypes.c_char_p, ctypes.c_bool, ) return f(p_mi, i_type, psz_uri, b_select) def libvlc_media_player_can_pause(p_mi): """Can this media player be paused? :param p_mi: the media player. :return: true if the media player can pause. """ f = _Cfunctions.get("libvlc_media_player_can_pause", None) or _Cfunction( "libvlc_media_player_can_pause", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_media_player_event_manager(p_mi): """Get the Event Manager from which the media player send event. :param p_mi: the Media Player. :return: the event manager associated with p_mi. """ f = _Cfunctions.get("libvlc_media_player_event_manager", None) or _Cfunction( "libvlc_media_player_event_manager", ((1,),), class_result(EventManager), ctypes.c_void_p, MediaPlayer, ) return f(p_mi) def libvlc_media_player_get_agl(p_mi): """.. warning:: **Deprecated!** Use :func:`libvlc_media_player_get_nsobject` instead.""" f = _Cfunctions.get("libvlc_media_player_get_agl", None) or _Cfunction( "libvlc_media_player_get_agl", ((1,),), None, ctypes.c_uint32, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_chapter(p_mi): """Get movie chapter. :param p_mi: the Media Player. :return: chapter number currently playing, or -1 if there is no media. """ f = _Cfunctions.get("libvlc_media_player_get_chapter", None) or _Cfunction( "libvlc_media_player_get_chapter", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_chapter_count(p_mi): """Get movie chapter count :param p_mi: the Media Player. :return: number of chapters in movie, or -1. """ f = _Cfunctions.get("libvlc_media_player_get_chapter_count", None) or _Cfunction( "libvlc_media_player_get_chapter_count", ((1,),), None, ctypes.c_int, MediaPlayer, ) return f(p_mi) def libvlc_media_player_get_chapter_count_for_title(p_mi, i_title): """Get title chapter count :param p_mi: the Media Player. :param i_title: title. :return: number of chapters in title, or -1. """ f = _Cfunctions.get( "libvlc_media_player_get_chapter_count_for_title", None ) or _Cfunction( "libvlc_media_player_get_chapter_count_for_title", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_int, ) return f(p_mi, i_title) def libvlc_media_player_get_fps(p_mi): """Get movie fps rate This function is provided for backward compatibility. It cannot deal with multiple video tracks. In LibVLC versions prior to 3.0, it would also fail if the file format did not convey the frame rate explicitly. .. warning:: **Deprecated!** Consider using :func:`libvlc_media_tracks_get` instead. :param p_mi: the Media Player. :return: frames per second (fps) for this playing movie, or 0 if unspecified. """ f = _Cfunctions.get("libvlc_media_player_get_fps", None) or _Cfunction( "libvlc_media_player_get_fps", ((1,),), None, ctypes.c_float, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_full_chapter_descriptions( p_mi, i_chapters_of_title, pp_chapters ): """Get the full description of available chapters :param p_mi: the media player. :param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1). :param pp_chapters: address to store an allocated array of chapter descriptions. descriptions (must be freed with :func:`libvlc_chapter_descriptions_release`. by the caller) [OUT]. :return: the number of chapters (-1 on error). :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get( "libvlc_media_player_get_full_chapter_descriptions", None ) or _Cfunction( "libvlc_media_player_get_full_chapter_descriptions", ( (1,), (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_int, ctypes.POINTER(ctypes.POINTER(ChapterDescription)), ) return f(p_mi, i_chapters_of_title, pp_chapters) def libvlc_media_player_get_full_title_descriptions(p_mi, titles): """Get the full description of available titles :param p_mi: the media player. :param titles: address to store an allocated array of title descriptions. descriptions (must be freed with :func:`libvlc_title_descriptions_release`. by the caller) [OUT]. :return: the number of *titles* (-1 on error). :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get( "libvlc_media_player_get_full_title_descriptions", None ) or _Cfunction( "libvlc_media_player_get_full_title_descriptions", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.POINTER(ctypes.POINTER(TitleDescription)), ) return f(p_mi, titles) def libvlc_media_player_get_hwnd(p_mi): """Get the Windows API window handle (HWND) previously set with :func:`libvlc_media_player_set_hwnd`. The handle will be returned even if LibVLC is not currently outputting any video to it. :param p_mi: the Media Player. :return: a window handle or None if there are none. """ f = _Cfunctions.get("libvlc_media_player_get_hwnd", None) or _Cfunction( "libvlc_media_player_get_hwnd", ((1,),), None, ctypes.c_void_p, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_length(p_mi): """Get the current movie length (in ms). :param p_mi: the Media Player. :return: the movie length (in ms), or -1 if there is no media. """ f = _Cfunctions.get("libvlc_media_player_get_length", None) or _Cfunction( "libvlc_media_player_get_length", ((1,),), None, ctypes.c_longlong, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_media(p_mi): """Get the media used by the media_player. :param p_mi: the Media Player. :return: the media associated with *p_mi*, or None if no. media is associated. """ f = _Cfunctions.get("libvlc_media_player_get_media", None) or _Cfunction( "libvlc_media_player_get_media", ((1,),), class_result(Media), ctypes.c_void_p, MediaPlayer, ) return f(p_mi) def libvlc_media_player_get_nsobject(p_mi): """Get the NSView handler previously set with :func:`libvlc_media_player_set_nsobject`. :param p_mi: the Media Player. :return: the NSView handler or 0 if none where set. """ f = _Cfunctions.get("libvlc_media_player_get_nsobject", None) or _Cfunction( "libvlc_media_player_get_nsobject", ((1,),), None, ctypes.c_void_p, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_position(p_mi): """Get movie position as percentage between 0.0 and 1.0. :param p_mi: the Media Player. :return: movie position, or -1. in case of error. """ f = _Cfunctions.get("libvlc_media_player_get_position", None) or _Cfunction( "libvlc_media_player_get_position", ((1,),), None, ctypes.c_float, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_rate(p_mi): """Get the requested movie play rate. .. warning:: Depending on the underlying media, the requested rate may be different from the real playback rate. :param p_mi: the Media Player. :return: movie play rate. """ f = _Cfunctions.get("libvlc_media_player_get_rate", None) or _Cfunction( "libvlc_media_player_get_rate", ((1,),), None, ctypes.c_float, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_role(p_mi): """Gets the media role. :param p_mi: media player. :return: the media player role (libvlc_media_player_role_t). :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_player_get_role", None) or _Cfunction( "libvlc_media_player_get_role", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_state(p_mi): """Get current movie state :param p_mi: the Media Player. :return: the current state of the media player (playing, paused, ...) See :class:`State`. """ f = _Cfunctions.get("libvlc_media_player_get_state", None) or _Cfunction( "libvlc_media_player_get_state", ((1,),), None, State, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_time(p_mi): """Get the current movie time (in ms). :param p_mi: the Media Player. :return: the movie time (in ms), or -1 if there is no media. """ f = _Cfunctions.get("libvlc_media_player_get_time", None) or _Cfunction( "libvlc_media_player_get_time", ((1,),), None, ctypes.c_longlong, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_title(p_mi): """Get movie title :param p_mi: the Media Player. :return: title number currently playing, or -1. """ f = _Cfunctions.get("libvlc_media_player_get_title", None) or _Cfunction( "libvlc_media_player_get_title", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_title_count(p_mi): """Get movie title count :param p_mi: the Media Player. :return: title number count, or -1. """ f = _Cfunctions.get("libvlc_media_player_get_title_count", None) or _Cfunction( "libvlc_media_player_get_title_count", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_media_player_get_xwindow(p_mi): """Get the X Window System window identifier previously set with :func:`libvlc_media_player_set_xwindow`. Note that this will return the identifier even if VLC is not currently using it (for instance if it is playing an audio-only input). :param p_mi: the Media Player. :return: an X window ID, or 0 if none where set. """ f = _Cfunctions.get("libvlc_media_player_get_xwindow", None) or _Cfunction( "libvlc_media_player_get_xwindow", ((1,),), None, ctypes.c_uint32, MediaPlayer ) return f(p_mi) def libvlc_media_player_has_vout(p_mi): """How many video outputs does this media player have? :param p_mi: the media player. :return: the number of video outputs. """ f = _Cfunctions.get("libvlc_media_player_has_vout", None) or _Cfunction( "libvlc_media_player_has_vout", ((1,),), None, ctypes.c_uint, MediaPlayer ) return f(p_mi) def libvlc_media_player_is_playing(p_mi): """is_playing :param p_mi: the Media Player. :return: 1 if the media player is playing, 0 otherwise. """ f = _Cfunctions.get("libvlc_media_player_is_playing", None) or _Cfunction( "libvlc_media_player_is_playing", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_media_player_is_seekable(p_mi): """Is this media player seekable? :param p_mi: the media player. :return: true if the media player can seek. """ f = _Cfunctions.get("libvlc_media_player_is_seekable", None) or _Cfunction( "libvlc_media_player_is_seekable", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_media_player_navigate(p_mi, navigate): """Navigate through DVD Menu :param p_mi: the Media Player. :param navigate: the Navigation mode. :version: libVLC 2.0.0 or later. """ f = _Cfunctions.get("libvlc_media_player_navigate", None) or _Cfunction( "libvlc_media_player_navigate", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_uint, ) return f(p_mi, navigate) def libvlc_media_player_new(p_libvlc_instance): """Create an empty Media Player object :param p_libvlc_instance: the libvlc instance in which the Media Player. should be created. :return: a new media player object, or None on error. """ f = _Cfunctions.get("libvlc_media_player_new", None) or _Cfunction( "libvlc_media_player_new", ((1,),), class_result(MediaPlayer), ctypes.c_void_p, Instance, ) return f(p_libvlc_instance) def libvlc_media_player_new_from_media(p_md): """Create a Media Player object from a Media :param p_md: the media. Afterwards the p_md can be safely. destroyed. :return: a new media player object, or None on error. """ f = _Cfunctions.get("libvlc_media_player_new_from_media", None) or _Cfunction( "libvlc_media_player_new_from_media", ((1,),), class_result(MediaPlayer), ctypes.c_void_p, Media, ) return f(p_md) def libvlc_media_player_next_chapter(p_mi): """Set next chapter (if applicable) :param p_mi: the Media Player. """ f = _Cfunctions.get("libvlc_media_player_next_chapter", None) or _Cfunction( "libvlc_media_player_next_chapter", ((1,),), None, None, MediaPlayer ) return f(p_mi) def libvlc_media_player_next_frame(p_mi): """Display the next frame (if supported) :param p_mi: the media player. """ f = _Cfunctions.get("libvlc_media_player_next_frame", None) or _Cfunction( "libvlc_media_player_next_frame", ((1,),), None, None, MediaPlayer ) return f(p_mi) def libvlc_media_player_pause(p_mi): """Toggle pause (no effect if there is no media) :param p_mi: the Media Player. """ f = _Cfunctions.get("libvlc_media_player_pause", None) or _Cfunction( "libvlc_media_player_pause", ((1,),), None, None, MediaPlayer ) return f(p_mi) def libvlc_media_player_play(p_mi): """Play :param p_mi: the Media Player. :return: 0 if playback started (and was already started), or -1 on error. """ f = _Cfunctions.get("libvlc_media_player_play", None) or _Cfunction( "libvlc_media_player_play", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_media_player_previous_chapter(p_mi): """Set previous chapter (if applicable) :param p_mi: the Media Player. """ f = _Cfunctions.get("libvlc_media_player_previous_chapter", None) or _Cfunction( "libvlc_media_player_previous_chapter", ((1,),), None, None, MediaPlayer ) return f(p_mi) def libvlc_media_player_program_scrambled(p_mi): """Check if the current program is scrambled :param p_mi: the media player. :return: true if the current program is scrambled. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_media_player_program_scrambled", None) or _Cfunction( "libvlc_media_player_program_scrambled", ((1,),), None, ctypes.c_int, MediaPlayer, ) return f(p_mi) def libvlc_media_player_release(p_mi): """Release a media_player after use Decrement the reference count of a media player object. If the reference count is 0, then :func:`libvlc_media_player_release` will release the media player object. If the media player object has been released, then it should not be used again. :param p_mi: the Media Player to free. """ f = _Cfunctions.get("libvlc_media_player_release", None) or _Cfunction( "libvlc_media_player_release", ((1,),), None, None, MediaPlayer ) return f(p_mi) def libvlc_media_player_retain(p_mi): """Retain a reference to a media player object. Use :func:`libvlc_media_player_release` to decrement reference count. :param p_mi: media player object. """ f = _Cfunctions.get("libvlc_media_player_retain", None) or _Cfunction( "libvlc_media_player_retain", ((1,),), None, None, MediaPlayer ) return f(p_mi) def libvlc_media_player_set_agl(p_mi, drawable): """.. warning:: **Deprecated!** Use :func:`libvlc_media_player_set_nsobject` instead.""" f = _Cfunctions.get("libvlc_media_player_set_agl", None) or _Cfunction( "libvlc_media_player_set_agl", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_uint32, ) return f(p_mi, drawable) def libvlc_media_player_set_android_context(p_mi, p_awindow_handler): """Set the android context. :param p_mi: the media player. :param p_awindow_handler: org.videolan.libvlc.AWindow jobject owned by the. org.videolan.libvlc.MediaPlayer class from the libvlc-android project. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_player_set_android_context", None) or _Cfunction( "libvlc_media_player_set_android_context", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_void_p, ) return f(p_mi, p_awindow_handler) def libvlc_media_player_set_chapter(p_mi, i_chapter): """Set movie chapter (if applicable). :param p_mi: the Media Player. :param i_chapter: chapter number to play. """ f = _Cfunctions.get("libvlc_media_player_set_chapter", None) or _Cfunction( "libvlc_media_player_set_chapter", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_int, ) return f(p_mi, i_chapter) def libvlc_media_player_set_equalizer(p_mi, p_equalizer): """Apply new equalizer settings to a media player. The equalizer is first created by invoking :func:`libvlc_audio_equalizer_new` or :func:`libvlc_audio_equalizer_new_from_preset`. It is possible to apply new equalizer settings to a media player whether the media player is currently playing media or not. Invoking this method will immediately apply the new equalizer settings to the audio output of the currently playing media if there is any. If there is no currently playing media, the new equalizer settings will be applied later if and when new media is played. Equalizer settings will automatically be applied to subsequently played media. To disable the equalizer for a media player invoke this method passing None for the p_equalizer parameter. The media player does not keep a reference to the supplied equalizer so it is safe for an application to release the equalizer reference any time after this method returns. :param p_mi: opaque media player handle. :param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player. :return: zero on success, -1 on error. :version: LibVLC 2.2.0 or later. """ f = _Cfunctions.get("libvlc_media_player_set_equalizer", None) or _Cfunction( "libvlc_media_player_set_equalizer", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, AudioEqualizer, ) return f(p_mi, p_equalizer) def libvlc_media_player_set_evas_object(p_mi, p_evas_object): """Set the EFL Evas Object. :param p_mi: the media player. :param p_evas_object: a valid EFL Evas Object (Evas_Object). :return: -1 if an error was detected, 0 otherwise. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_player_set_evas_object", None) or _Cfunction( "libvlc_media_player_set_evas_object", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_void_p, ) return f(p_mi, p_evas_object) def libvlc_media_player_set_hwnd(p_mi, drawable): """Set a Win32/Win64 API window handle (HWND) where the media player should render its video output. If LibVLC was built without Win32/Win64 API output support, then this has no effects. .. warning:: the HWND must have the WS_CLIPCHILDREN set in its style. :param p_mi: the Media Player. :param drawable: windows handle of the drawable. """ f = _Cfunctions.get("libvlc_media_player_set_hwnd", None) or _Cfunction( "libvlc_media_player_set_hwnd", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_void_p, ) return f(p_mi, drawable) def libvlc_media_player_set_media(p_mi, p_md): """Set the media that will be used by the media_player. If any, previous md will be released. :param p_mi: the Media Player. :param p_md: the Media. Afterwards the p_md can be safely. destroyed. """ f = _Cfunctions.get("libvlc_media_player_set_media", None) or _Cfunction( "libvlc_media_player_set_media", ( (1,), (1,), ), None, None, MediaPlayer, Media, ) return f(p_mi, p_md) def libvlc_media_player_set_nsobject(p_mi, drawable): """Set the NSView handler where the media player should render its video output. Use the vout called "macosx". The *drawable* is an NSObject that follow the VLCOpenGLVideoViewEmbedding protocol: .. code-block:: objectivec++ @protocol VLCOpenGLVideoViewEmbedding - (void)addVoutSubview:(NSView *)view; - (void)removeVoutSubview:(NSView *)view; @end Or it can be an NSView object. If you want to use it along with Qt see the QMacCocoaViewContainer. Then the following code should work: .. code-block:: objectivec++ NSView *video = [[NSView alloc] init]; QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent); libvlc_media_player_set_nsobject(mp, video); [video release]; You can find a live example in VLCVideoView in VLCKit.framework. :param p_mi: the Media Player. :param drawable: the drawable that is either an NSView or an object following. the VLCOpenGLVideoViewEmbedding protocol. """ f = _Cfunctions.get("libvlc_media_player_set_nsobject", None) or _Cfunction( "libvlc_media_player_set_nsobject", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_void_p, ) return f(p_mi, drawable) def libvlc_media_player_set_pause(mp, do_pause): """Pause or resume (no effect if there is no media) :param mp: the Media Player. :param do_pause: play/resume if zero, pause if non-zero. :version: LibVLC 1.1.1 or later. """ f = _Cfunctions.get("libvlc_media_player_set_pause", None) or _Cfunction( "libvlc_media_player_set_pause", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_int, ) return f(mp, do_pause) def libvlc_media_player_set_position(p_mi, f_pos): """Set movie position as percentage between 0.0 and 1.0. This has no effect if playback is not enabled. This might not work depending on the underlying input format and protocol. :param p_mi: the Media Player. :param f_pos: the position. """ f = _Cfunctions.get("libvlc_media_player_set_position", None) or _Cfunction( "libvlc_media_player_set_position", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_float, ) return f(p_mi, f_pos) def libvlc_media_player_set_rate(p_mi, rate): """Set movie play rate :param p_mi: the Media Player. :param rate: movie play rate to set. :return: -1 if an error was detected, 0 otherwise (but even then, it might. not actually work depending on the underlying media protocol). """ f = _Cfunctions.get("libvlc_media_player_set_rate", None) or _Cfunction( "libvlc_media_player_set_rate", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_float, ) return f(p_mi, rate) def libvlc_media_player_set_renderer(p_mi, p_item): """Set a renderer to the media player .. note:: must be called before the first call of :func:`libvlc_media_player_play` to take effect. See :func:`libvlc_renderer_discoverer_new` :param p_mi: the Media Player. :param p_item: an item discovered by :func:`libvlc_renderer_discoverer_start`. :return: 0 on success, -1 on error. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_media_player_set_renderer", None) or _Cfunction( "libvlc_media_player_set_renderer", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, Renderer, ) return f(p_mi, p_item) def libvlc_media_player_set_role(p_mi, role): """Sets the media *role*. :param p_mi: media player. :param role: the media player role (libvlc_media_player_role_t). :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_media_player_set_role", None) or _Cfunction( "libvlc_media_player_set_role", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_uint, ) return f(p_mi, role) def libvlc_media_player_set_time(p_mi, i_time): """Set the movie time (in ms). This has no effect if no media is being played. Not all formats and protocols support this. :param p_mi: the Media Player. :param i_time: the movie time (in ms). """ f = _Cfunctions.get("libvlc_media_player_set_time", None) or _Cfunction( "libvlc_media_player_set_time", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_longlong, ) return f(p_mi, i_time) def libvlc_media_player_set_title(p_mi, i_title): """Set movie title :param p_mi: the Media Player. :param i_title: title number to play. """ f = _Cfunctions.get("libvlc_media_player_set_title", None) or _Cfunction( "libvlc_media_player_set_title", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_int, ) return f(p_mi, i_title) def libvlc_media_player_set_video_title_display(p_mi, position, timeout): """Set if, and how, the video title will be shown when media is played. :param p_mi: the media player. :param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed. :param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable). :version: libVLC 2.1.0 or later. """ f = _Cfunctions.get( "libvlc_media_player_set_video_title_display", None ) or _Cfunction( "libvlc_media_player_set_video_title_display", ( (1,), (1,), (1,), ), None, None, MediaPlayer, Position, ctypes.c_uint, ) return f(p_mi, position, timeout) def libvlc_media_player_set_xwindow(p_mi, drawable): """Set an X Window System *drawable* where the media player should render its video output. The call takes effect when the playback starts. If it is already started, it might need to be stopped before changes apply. If LibVLC was built without X11 output support, then this function has no effects. By default, LibVLC will capture input events on the video rendering area. Use :func:`libvlc_video_set_mouse_input` and :func:`libvlc_video_set_key_input` to disable that and deliver events to the parent window / to the application instead. By design, the X11 protocol delivers input events to only one recipient. .. warning:: The application must call the XInitThreads() function from Xlib before :func:`libvlc_new`, and before any call to XOpenDisplay() directly or via any other library. Failure to call XInitThreads() will seriously impede LibVLC performance. Calling XOpenDisplay() before XInitThreads() will eventually crash the process. That is a limitation of Xlib. .. note:: The specified identifier must correspond to an existing Input/Output class X11 window. Pixmaps are **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. :param p_mi: media player. :param drawable: X11 window ID. :bug: No more than one window handle per media player instance can be specified. If the media has multiple simultaneously active video tracks, extra tracks. will be rendered into external windows beyond the control of the. application. """ f = _Cfunctions.get("libvlc_media_player_set_xwindow", None) or _Cfunction( "libvlc_media_player_set_xwindow", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_uint32, ) return f(p_mi, drawable) def libvlc_media_player_stop(p_mi): """Stop (no effect if there is no media) :param p_mi: the Media Player. """ f = _Cfunctions.get("libvlc_media_player_stop", None) or _Cfunction( "libvlc_media_player_stop", ((1,),), None, None, MediaPlayer ) return f(p_mi) def libvlc_media_player_will_play(p_mi): """Is the player able to play :param p_mi: the Media Player. :return: boolean. """ f = _Cfunctions.get("libvlc_media_player_will_play", None) or _Cfunction( "libvlc_media_player_will_play", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_media_release(p_md): """Decrement the reference count of a media descriptor object. If the reference count is 0, then :func:`libvlc_media_release` will release the media descriptor object. It will send out an libvlc_MediaFreed event to all listeners. If the media descriptor object has been released it should not be used again. :param p_md: the media descriptor. """ f = _Cfunctions.get("libvlc_media_release", None) or _Cfunction( "libvlc_media_release", ((1,),), None, None, Media ) return f(p_md) def libvlc_media_retain(p_md): """Retain a reference to a media descriptor object (libvlc_media_t). Use :func:`libvlc_media_release` to decrement the reference count of a media descriptor object. :param p_md: the media descriptor. """ f = _Cfunctions.get("libvlc_media_retain", None) or _Cfunction( "libvlc_media_retain", ((1,),), None, None, Media ) return f(p_md) def libvlc_media_save_meta(p_md): """Save the meta previously set :param p_md: the media desriptor. :return: true if the write operation was successful. """ f = _Cfunctions.get("libvlc_media_save_meta", None) or _Cfunction( "libvlc_media_save_meta", ((1,),), None, ctypes.c_int, Media ) return f(p_md) def libvlc_media_set_meta(p_md, e_meta, psz_value): """Set the meta of the media (this function will not save the meta, call :func:`libvlc_media_save_meta` in order to save the meta) :param p_md: the media descriptor. :param e_meta: the meta to write. :param psz_value: the media's meta. """ f = _Cfunctions.get("libvlc_media_set_meta", None) or _Cfunction( "libvlc_media_set_meta", ( (1,), (1,), (1,), ), None, None, Media, Meta, ctypes.c_char_p, ) return f(p_md, e_meta, psz_value) def libvlc_media_set_user_data(p_md, p_new_user_data): """Sets media descriptor's user_data. user_data is specialized data accessed by the host application, VLC.framework uses it as a pointer to an native object that references a :class:`Media` pointer :param p_md: media descriptor object. :param p_new_user_data: pointer to user data. """ f = _Cfunctions.get("libvlc_media_set_user_data", None) or _Cfunction( "libvlc_media_set_user_data", ( (1,), (1,), ), None, None, Media, ctypes.c_void_p, ) return f(p_md, p_new_user_data) def libvlc_media_slaves_add(p_md, i_type, i_priority, psz_uri): """Add a slave to the current media. A slave is an external input source that may contains an additional subtitle track (like a .srt) or an additional audio track (like a .ac3). .. note:: This function must be called before the media is parsed (via libvlc_media_parse_with_options) or before the media is played (via libvlc_media_player_play) :param p_md: media descriptor object. :param i_type: subtitle or audio. :param i_priority: from 0 (low priority) to 4 (high priority). :param psz_uri: Uri of the slave (should contain a valid scheme). :return: 0 on success, -1 on error. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_slaves_add", None) or _Cfunction( "libvlc_media_slaves_add", ( (1,), (1,), (1,), (1,), ), None, ctypes.c_int, Media, MediaSlaveType, ctypes.c_uint, ctypes.c_char_p, ) return f(p_md, i_type, i_priority, psz_uri) def libvlc_media_slaves_clear(p_md): """Clear all slaves previously added by :func:`libvlc_media_slaves_add` or internally. :param p_md: media descriptor object. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_slaves_clear", None) or _Cfunction( "libvlc_media_slaves_clear", ((1,),), None, None, Media ) return f(p_md) def libvlc_media_slaves_get(p_md, ppp_slaves): """Get a media descriptor's slave list The list will contain slaves parsed by VLC or previously added by :func:`libvlc_media_slaves_add`. The typical use case of this function is to save a list of slave in a database for a later use. See :func:`libvlc_media_slaves_add` :param p_md: media descriptor object. :param ppp_slaves: address to store an allocated array of slaves (must be. freed with libvlc_media_slaves_release) [OUT]. :return: the number of slaves (zero on error). :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_slaves_get", None) or _Cfunction( "libvlc_media_slaves_get", ( (1,), (1,), ), None, ctypes.c_uint, Media, ctypes.POINTER(ctypes.POINTER(MediaSlave)), ) return f(p_md, ppp_slaves) def libvlc_media_slaves_release(pp_slaves, i_count): """Release a media descriptor's slave list :param pp_slaves: slave array to release. :param i_count: number of elements in the array. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_media_slaves_release", None) or _Cfunction( "libvlc_media_slaves_release", ( (1,), (1,), ), None, None, ctypes.POINTER(ctypes.POINTER(MediaSlave)), ctypes.c_uint, ) return f(pp_slaves, i_count) def libvlc_media_subitems(p_md): """Get subitems of media descriptor object. This will increment the reference count of supplied media descriptor object. Use :func:`libvlc_media_list_release` to decrement the reference counting. :param p_md: media descriptor object. :return: list of media descriptor subitems or None. """ f = _Cfunctions.get("libvlc_media_subitems", None) or _Cfunction( "libvlc_media_subitems", ((1,),), class_result(MediaList), ctypes.c_void_p, Media, ) return f(p_md) def libvlc_media_tracks_get(p_md, tracks): """Get media descriptor's elementary streams description Note, you need to call :func:`libvlc_media_parse` or play the media at least once before calling this function. Not doing this will result in an empty array. :param p_md: media descriptor object. :param tracks: address to store an allocated array of Elementary Streams. descriptions (must be freed with :func:`libvlc_media_tracks_release`. by the caller) [OUT]. :return: the number of Elementary Streams (zero on error). :version: LibVLC 2.1.0 and later. """ f = _Cfunctions.get("libvlc_media_tracks_get", None) or _Cfunction( "libvlc_media_tracks_get", ( (1,), (1,), ), None, ctypes.c_uint, Media, ctypes.POINTER(ctypes.POINTER(MediaTrack)), ) return f(p_md, tracks) def libvlc_media_tracks_release(p_tracks, i_count): """Release media descriptor's elementary streams description array :param p_tracks: tracks info array to release. :param i_count: number of elements in the array. :version: LibVLC 2.1.0 and later. """ f = _Cfunctions.get("libvlc_media_tracks_release", None) or _Cfunction( "libvlc_media_tracks_release", ( (1,), (1,), ), None, None, ctypes.POINTER(ctypes.POINTER(MediaTrack)), ctypes.c_uint, ) return f(p_tracks, i_count) def libvlc_module_description_list_release(p_list): """Release a list of module descriptions. :param p_list: the list to be released. """ f = _Cfunctions.get("libvlc_module_description_list_release", None) or _Cfunction( "libvlc_module_description_list_release", ((1,),), None, None, ctypes.POINTER(ModuleDescription), ) return f(p_list) def libvlc_new(argc, argv): """Create and initialize a libvlc instance. This functions accept a list of "command line" arguments similar to the main(). These arguments affect the LibVLC instance default configuration. .. note:: LibVLC may create threads. Therefore, any thread-unsafe process initialization must be performed before calling :func:`libvlc_new`. In particular and where applicable: * setlocale() and textdomain(), * setenv(), unsetenv() and putenv(), * with the X11 display system, XInitThreads() (see also libvlc_media_player_set_xwindow) and * on Microsoft Windows, SetErrorMode(). * sigprocmask() shall never be invoked; pthread_sigmask() can be used. On POSIX systems, the SIGCHLD signal **must not** be ignored, i.e. the signal handler must set to SIG_DFL or a function pointer, not SIG_IGN. Also while LibVLC is active, the wait() function shall not be called, and any call to waitpid() shall use a strictly positive value for the first parameter (i.e. the PID). Failure to follow those rules may lead to a deadlock or a busy loop. Also on POSIX systems, it is recommended that the SIGPIPE signal be blocked, even if it is not, in principles, necessary, e.g.: .. code-block:: objectivec++ sigset_t set; signal(SIGCHLD, SIG_DFL); sigemptyset(&set); sigaddset(&set, SIGPIPE); pthread_sigmask(SIG_BLOCK, &set, None); On Microsoft Windows Vista/2008, the process error mode SEM_FAILCRITICALERRORS flag **must** be set before using LibVLC. On later versions, that is optional and unnecessary. Also on Microsoft Windows (Vista and any later version), setting the default DLL directories to SYSTEM32 exclusively is strongly recommended for security reasons: .. code-block:: objectivec++ SetErrorMode(SEM_FAILCRITICALERRORS); SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32); .. warning:: There is absolutely no warranty or promise of forward, backward and cross-platform compatibility with regards to :func:`libvlc_new` arguments. We recommend that you do not use them, other than when debugging. :param argc: the number of arguments (should be 0). :param argv: list of arguments (should be None). :return: the libvlc instance or None in case of error. :version: Arguments are meant to be passed from the command line to LibVLC, just like. VLC media player does. The list of valid arguments depends on the LibVLC. version, the operating system and platform, and set of available LibVLC. plugins. Invalid or unsupported arguments will cause the function to fail. (i.e. return None). Also, some arguments may alter the behaviour or. otherwise interfere with other LibVLC functions. """ f = _Cfunctions.get("libvlc_new", None) or _Cfunction( "libvlc_new", ( (1,), (1,), ), class_result(Instance), ctypes.c_void_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p), ) return f(argc, argv) def libvlc_playlist_play(p_instance, i_id, i_options, ppsz_options): """Start playing (if there is any item in the playlist). Additionnal playlist item options can be specified for addition to the item before it is played. :param p_instance: the playlist instance. :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. :param i_options: the number of options to add to the item. :param ppsz_options: the options to add to the item. """ f = _Cfunctions.get("libvlc_playlist_play", None) or _Cfunction( "libvlc_playlist_play", ( (1,), (1,), (1,), (1,), ), None, None, Instance, ctypes.c_int, ctypes.c_int, ListPOINTER(ctypes.c_char_p), ) return f(p_instance, i_id, i_options, ppsz_options) def libvlc_printerr(fmt): """Sets the LibVLC error status and message for the current thread. Any previous error is overridden. :param fmt: the format string. :param args: the arguments. :return: a nul terminated string in any case. """ f = _Cfunctions.get("libvlc_printerr", None) or _Cfunction( "libvlc_printerr", ((1,),), None, ctypes.c_char_p, ctypes.c_char_p ) return f(fmt) def libvlc_release(p_instance): """Decrement the reference count of a libvlc instance, and destroy it if it reaches zero. :param p_instance: the instance to destroy. """ f = _Cfunctions.get("libvlc_release", None) or _Cfunction( "libvlc_release", ((1,),), None, None, Instance ) return f(p_instance) def libvlc_renderer_discoverer_event_manager(p_rd): """Get the event manager of the renderer discoverer The possible events to attach are libvlc_RendererDiscovererItemAdded and libvlc_RendererDiscovererItemDeleted. The :class:`Renderer` struct passed to event callbacks is owned by VLC, users should take care of holding/releasing this struct for their internal usage. See :class:`Event`.u.renderer_discoverer_item_added.item See :class:`Event`.u.renderer_discoverer_item_removed.item :return: a valid event manager (can't fail). :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_renderer_discoverer_event_manager", None) or _Cfunction( "libvlc_renderer_discoverer_event_manager", ((1,),), class_result(EventManager), ctypes.c_void_p, RendererDiscoverer, ) return f(p_rd) def libvlc_renderer_discoverer_list_get(p_inst, ppp_services): """Get media discoverer services See libvlc_renderer_list_release :param p_inst: libvlc instance. :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]. :return: the number of media discoverer services (0 on error). :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_renderer_discoverer_list_get", None) or _Cfunction( "libvlc_renderer_discoverer_list_get", ( (1,), (1,), ), None, ctypes.c_size_t, Instance, ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(RdDescription))), ) return f(p_inst, ppp_services) def libvlc_renderer_discoverer_list_release(pp_services, i_count): """Release an array of media discoverer services See :func:`libvlc_renderer_discoverer_list_get` :param pp_services: array to release. :param i_count: number of elements in the array. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_renderer_discoverer_list_release", None) or _Cfunction( "libvlc_renderer_discoverer_list_release", ( (1,), (1,), ), None, None, ctypes.POINTER(ctypes.POINTER(RdDescription)), ctypes.c_size_t, ) return f(pp_services, i_count) def libvlc_renderer_discoverer_new(p_inst, psz_name): """Create a renderer discoverer object by name After this object is created, you should attach to events in order to be notified of the discoverer events. You need to call :func:`libvlc_renderer_discoverer_start` in order to start the discovery. See :func:`libvlc_renderer_discoverer_event_manager` See :func:`libvlc_renderer_discoverer_start` :param p_inst: libvlc instance. :param psz_name: service name; use :func:`libvlc_renderer_discoverer_list_get` to. get a list of the discoverer names available in this libVLC instance. :return: media discover object or None in case of error. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_renderer_discoverer_new", None) or _Cfunction( "libvlc_renderer_discoverer_new", ( (1,), (1,), ), class_result(RendererDiscoverer), ctypes.c_void_p, Instance, ctypes.c_char_p, ) return f(p_inst, psz_name) def libvlc_renderer_discoverer_release(p_rd): """Release a renderer discoverer object :param p_rd: renderer discoverer object. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_renderer_discoverer_release", None) or _Cfunction( "libvlc_renderer_discoverer_release", ((1,),), None, None, RendererDiscoverer ) return f(p_rd) def libvlc_renderer_discoverer_start(p_rd): """Start renderer discovery To stop it, call :func:`libvlc_renderer_discoverer_stop` or :func:`libvlc_renderer_discoverer_release` directly. See :func:`libvlc_renderer_discoverer_stop` :param p_rd: renderer discoverer object. :return: -1 in case of error, 0 otherwise. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_renderer_discoverer_start", None) or _Cfunction( "libvlc_renderer_discoverer_start", ((1,),), None, ctypes.c_int, RendererDiscoverer, ) return f(p_rd) def libvlc_renderer_discoverer_stop(p_rd): """Stop renderer discovery. See :func:`libvlc_renderer_discoverer_start` :param p_rd: renderer discoverer object. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_renderer_discoverer_stop", None) or _Cfunction( "libvlc_renderer_discoverer_stop", ((1,),), None, None, RendererDiscoverer ) return f(p_rd) def libvlc_renderer_item_flags(p_item): """Get the flags of a renderer item See LIBVLC_RENDERER_CAN_AUDIO See LIBVLC_RENDERER_CAN_VIDEO :return: bitwise flag: capabilities of the renderer, see. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_renderer_item_flags", None) or _Cfunction( "libvlc_renderer_item_flags", ((1,),), None, ctypes.c_int, Renderer ) return f(p_item) def libvlc_renderer_item_hold(p_item): """Hold a renderer item, i.e. creates a new reference This functions need to called from the libvlc_RendererDiscovererItemAdded callback if the libvlc user wants to use this item after. (for display or for passing it to the mediaplayer for example). :return: the current item. :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_renderer_item_hold", None) or _Cfunction( "libvlc_renderer_item_hold", ((1,),), class_result(Renderer), ctypes.c_void_p, Renderer, ) return f(p_item) def libvlc_renderer_item_icon_uri(p_item): """Get the icon uri of a renderer item :return: the uri of the item's icon (can be None, must *not* be freed). :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_renderer_item_icon_uri", None) or _Cfunction( "libvlc_renderer_item_icon_uri", ((1,),), None, ctypes.c_char_p, Renderer ) return f(p_item) def libvlc_renderer_item_name(p_item): """Get the human readable name of a renderer item :return: the name of the item (can't be None, must *not* be freed). :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_renderer_item_name", None) or _Cfunction( "libvlc_renderer_item_name", ((1,),), None, ctypes.c_char_p, Renderer ) return f(p_item) def libvlc_renderer_item_release(p_item): """Releases a renderer item, i.e. decrements its reference counter :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_renderer_item_release", None) or _Cfunction( "libvlc_renderer_item_release", ((1,),), None, None, Renderer ) return f(p_item) def libvlc_renderer_item_type(p_item): """Get the type (not translated) of a renderer item. For now, the type can only be "chromecast" ("upnp", "airplay" may come later). :return: the type of the item (can't be None, must *not* be freed). :version: LibVLC 3.0.0 or later. """ f = _Cfunctions.get("libvlc_renderer_item_type", None) or _Cfunction( "libvlc_renderer_item_type", ((1,),), None, ctypes.c_char_p, Renderer ) return f(p_item) def libvlc_retain(p_instance): """Increments the reference count of a libvlc instance. The initial reference count is 1 after :func:`libvlc_new` returns. :param p_instance: the instance to reference. """ f = _Cfunctions.get("libvlc_retain", None) or _Cfunction( "libvlc_retain", ((1,),), None, None, Instance ) return f(p_instance) def libvlc_set_app_id(p_instance, id, version, icon): """Sets some meta-information about the application. See also :func:`libvlc_set_user_agent`. :param p_instance: LibVLC instance. :param id: Java-style application identifier, e.g. "com.acme.foobar". :param version: application version numbers, e.g. "1.2.3". :param icon: application icon name, e.g. "foobar". :version: LibVLC 2.1.0 or later. """ f = _Cfunctions.get("libvlc_set_app_id", None) or _Cfunction( "libvlc_set_app_id", ( (1,), (1,), (1,), (1,), ), None, None, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ) return f(p_instance, id, version, icon) LibvlcSetExitHandlerCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p) def libvlc_set_exit_handler(p_instance, cb, opaque): """Registers a callback for the LibVLC exit event. This is mostly useful if the VLC playlist and/or at least one interface are started with :func:`libvlc_playlist_play` or :func:`libvlc_add_intf` respectively. Typically, this function will wake up your application main loop (from another thread). .. note:: This function should be called before the playlist or interface are started. Otherwise, there is a small race condition: the exit event could be raised before the handler is registered. .. warning:: This function and :func:`libvlc_wait` cannot be used at the same time. :param p_instance: LibVLC instance. :param cb: callback to invoke when LibVLC wants to exit, or None to disable the exit handler (as by default). :param opaque: data pointer for the callback. """ f = _Cfunctions.get("libvlc_set_exit_handler", None) or _Cfunction( "libvlc_set_exit_handler", ( (1,), (1,), (1,), ), None, None, Instance, LibvlcSetExitHandlerCb, ctypes.c_void_p, ) return f(p_instance, cb, opaque) def libvlc_set_fullscreen(p_mi, b_fullscreen): """Enable or disable fullscreen. .. warning:: With most window managers, only a top-level windows can be in full-screen mode. Hence, this function will not operate properly if :func:`libvlc_media_player_set_xwindow` was used to embed the video in a non-top-level window. In that case, the embedding window must be reparented to the root window **before** fullscreen mode is enabled. You will want to reparent it back to its normal parent when disabling fullscreen. :param p_mi: the media player. :param b_fullscreen: boolean for fullscreen status. """ f = _Cfunctions.get("libvlc_set_fullscreen", None) or _Cfunction( "libvlc_set_fullscreen", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_int, ) return f(p_mi, b_fullscreen) def libvlc_set_log_verbosity(p_instance, level): """This function does nothing. It is only provided for backward compatibility. :param p_instance: ignored. :param level: ignored. """ f = _Cfunctions.get("libvlc_set_log_verbosity", None) or _Cfunction( "libvlc_set_log_verbosity", ( (1,), (1,), ), None, None, Instance, ctypes.c_uint, ) return f(p_instance, level) def libvlc_set_user_agent(p_instance, name, http): """Sets the application *name*. LibVLC passes this as the user agent string when a protocol requires it. :param p_instance: LibVLC instance. :param name: human-readable application name, e.g. "FooBar player 1.2.3". :param http: HTTP User Agent, e.g. "FooBar/1.2.3 Python/2.6.0". :version: LibVLC 1.1.1 or later. """ f = _Cfunctions.get("libvlc_set_user_agent", None) or _Cfunction( "libvlc_set_user_agent", ( (1,), (1,), (1,), ), None, None, Instance, ctypes.c_char_p, ctypes.c_char_p, ) return f(p_instance, name, http) def libvlc_title_descriptions_release(p_titles, i_count): """Release a title description :param p_titles: title description array to release. :param i_count: number of title descriptions to release. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_title_descriptions_release", None) or _Cfunction( "libvlc_title_descriptions_release", ( (1,), (1,), ), None, None, ctypes.POINTER(ctypes.POINTER(TitleDescription)), ctypes.c_uint, ) return f(p_titles, i_count) def libvlc_toggle_fullscreen(p_mi): """Toggle fullscreen status on non-embedded video outputs. .. warning:: The same limitations applies to this function as to :func:`libvlc_set_fullscreen`. :param p_mi: the media player. """ f = _Cfunctions.get("libvlc_toggle_fullscreen", None) or _Cfunction( "libvlc_toggle_fullscreen", ((1,),), None, None, MediaPlayer ) return f(p_mi) def libvlc_toggle_teletext(p_mi): """Toggle teletext transparent status on video output. .. warning:: **Deprecated!** use :func:`libvlc_video_set_teletext` instead. :param p_mi: the media player. """ f = _Cfunctions.get("libvlc_toggle_teletext", None) or _Cfunction( "libvlc_toggle_teletext", ((1,),), None, None, MediaPlayer ) return f(p_mi) def libvlc_track_description_list_release(p_track_description): """Release (free) :class:`TrackDescription` :param p_track_description: the structure to release. """ f = _Cfunctions.get("libvlc_track_description_list_release", None) or _Cfunction( "libvlc_track_description_list_release", ((1,),), None, None, ctypes.POINTER(TrackDescription), ) return f(p_track_description) def libvlc_track_description_release(p_track_description): """.. warning:: **Deprecated!** Use :func:`libvlc_track_description_list_release` instead.""" f = _Cfunctions.get("libvlc_track_description_release", None) or _Cfunction( "libvlc_track_description_release", ((1,),), None, None, ctypes.POINTER(TrackDescription), ) return f(p_track_description) def libvlc_video_filter_list_get(p_instance): """Returns a list of video filters that are available. See :class:`ModuleDescription` See :func:`libvlc_module_description_list_release`. :param p_instance: libvlc instance. :return: a list of module descriptions. It should be freed with :func:`libvlc_module_description_list_release`. In case of an error, None is returned. """ f = _Cfunctions.get("libvlc_video_filter_list_get", None) or _Cfunction( "libvlc_video_filter_list_get", ((1,),), None, ctypes.POINTER(ModuleDescription), Instance, ) return f(p_instance) def libvlc_video_get_adjust_float(p_mi, option): """Get float adjust *option*. :param p_mi: libvlc media player instance. :param option: adjust option to get, values of :class:`VideoAdjustOption`. :version: LibVLC 1.1.1 and later. """ f = _Cfunctions.get("libvlc_video_get_adjust_float", None) or _Cfunction( "libvlc_video_get_adjust_float", ( (1,), (1,), ), None, ctypes.c_float, MediaPlayer, ctypes.c_uint, ) return f(p_mi, option) def libvlc_video_get_adjust_int(p_mi, option): """Get integer adjust *option*. :param p_mi: libvlc media player instance. :param option: adjust option to get, values of :class:`VideoAdjustOption`. :version: LibVLC 1.1.1 and later. """ f = _Cfunctions.get("libvlc_video_get_adjust_int", None) or _Cfunction( "libvlc_video_get_adjust_int", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_uint, ) return f(p_mi, option) def libvlc_video_get_aspect_ratio(p_mi): """Get current video aspect ratio. :param p_mi: the media player. :return: the video aspect ratio or None if unspecified. (the result must be released with free() or libvlc_free). """ f = _Cfunctions.get("libvlc_video_get_aspect_ratio", None) or _Cfunction( "libvlc_video_get_aspect_ratio", ((1,),), string_result, ctypes.c_void_p, MediaPlayer, ) return f(p_mi) def libvlc_video_get_chapter_description(p_mi, i_title): """Get the description of available chapters for specific title. :param p_mi: the media player. :param i_title: selected title. :return: list containing description of available chapter for title *i_title*. It must be freed with :func:`libvlc_track_description_list_release`. """ f = _Cfunctions.get("libvlc_video_get_chapter_description", None) or _Cfunction( "libvlc_video_get_chapter_description", ( (1,), (1,), ), None, ctypes.POINTER(TrackDescription), MediaPlayer, ctypes.c_int, ) return f(p_mi, i_title) def libvlc_video_get_crop_geometry(p_mi): """Get current crop filter geometry. :param p_mi: the media player. :return: the crop filter geometry or None if unset. """ f = _Cfunctions.get("libvlc_video_get_crop_geometry", None) or _Cfunction( "libvlc_video_get_crop_geometry", ((1,),), string_result, ctypes.c_void_p, MediaPlayer, ) return f(p_mi) def libvlc_video_get_cursor(p_mi, num): """Get the mouse pointer coordinates over a video. Coordinates are expressed in terms of the decoded video resolution, **not** in terms of pixels on the screen/viewport (to get the latter, you can query your windowing system directly). Either of the coordinates may be negative or larger than the corresponding dimension of the video, if the cursor is outside the rendering area. .. warning:: The coordinates may be out-of-date if the pointer is not located on the video rendering area. LibVLC does not track the pointer if it is outside of the video widget. .. note:: LibVLC does not support multiple pointers (it does of course support multiple input devices sharing the same pointer) at the moment. :param p_mi: media player. :param num: number of the video (starting from, and most commonly 0). :param px: abscissa [OUT]. :param py: ordinate [OUT]. :return: 0 on success, -1 if the specified video does not exist. """ f = _Cfunctions.get("libvlc_video_get_cursor", None) or _Cfunction( "libvlc_video_get_cursor", ( (1,), (1,), (2,), (2,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int), ) return f(p_mi, num) def libvlc_video_get_height(p_mi): """Get current video height. .. warning:: **Deprecated!** Use :func:`libvlc_video_get_size` instead. :param p_mi: the media player. :return: the video pixel height or 0 if not applicable. """ f = _Cfunctions.get("libvlc_video_get_height", None) or _Cfunction( "libvlc_video_get_height", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_video_get_logo_int(p_mi, option): """Get integer logo *option*. :param p_mi: libvlc media player instance. :param option: logo option to get, values of :class:`VideoLogoOption`. """ f = _Cfunctions.get("libvlc_video_get_logo_int", None) or _Cfunction( "libvlc_video_get_logo_int", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_uint, ) return f(p_mi, option) def libvlc_video_get_marquee_int(p_mi, option): """Get an integer marquee *option* value :param p_mi: libvlc media player. :param option: marq option to get See libvlc_video_marquee_int_option_t. """ f = _Cfunctions.get("libvlc_video_get_marquee_int", None) or _Cfunction( "libvlc_video_get_marquee_int", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_uint, ) return f(p_mi, option) def libvlc_video_get_marquee_string(p_mi, option): """Get a string marquee *option* value :param p_mi: libvlc media player. :param option: marq option to get See libvlc_video_marquee_string_option_t. """ f = _Cfunctions.get("libvlc_video_get_marquee_string", None) or _Cfunction( "libvlc_video_get_marquee_string", ( (1,), (1,), ), string_result, ctypes.c_void_p, MediaPlayer, ctypes.c_uint, ) return f(p_mi, option) def libvlc_video_get_scale(p_mi): """Get the current video scaling factor. See also :func:`libvlc_video_set_scale`. :param p_mi: the media player. :return: the currently configured zoom factor, or 0. if the video is set. to fit to the output window/drawable automatically. """ f = _Cfunctions.get("libvlc_video_get_scale", None) or _Cfunction( "libvlc_video_get_scale", ((1,),), None, ctypes.c_float, MediaPlayer ) return f(p_mi) def libvlc_video_get_size(p_mi, num): """Get the pixel dimensions of a video. :param p_mi: media player. :param num: number of the video (starting from, and most commonly 0). :param px: pixel width [OUT]. :param py: pixel height [OUT]. :return: 0 on success, -1 if the specified video does not exist. """ f = _Cfunctions.get("libvlc_video_get_size", None) or _Cfunction( "libvlc_video_get_size", ( (1,), (1,), (2,), (2,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ) return f(p_mi, num) def libvlc_video_get_spu(p_mi): """Get current video subtitle. :param p_mi: the media player. :return: the video subtitle selected, or -1 if none. """ f = _Cfunctions.get("libvlc_video_get_spu", None) or _Cfunction( "libvlc_video_get_spu", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_video_get_spu_count(p_mi): """Get the number of available video subtitles. :param p_mi: the media player. :return: the number of available video subtitles. """ f = _Cfunctions.get("libvlc_video_get_spu_count", None) or _Cfunction( "libvlc_video_get_spu_count", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_video_get_spu_delay(p_mi): """Get the current subtitle delay. Positive values means subtitles are being displayed later, negative values earlier. :param p_mi: media player. :return: time (in microseconds) the display of subtitles is being delayed. :version: LibVLC 2.0.0 or later. """ f = _Cfunctions.get("libvlc_video_get_spu_delay", None) or _Cfunction( "libvlc_video_get_spu_delay", ((1,),), None, ctypes.c_int64, MediaPlayer ) return f(p_mi) def libvlc_video_get_spu_description(p_mi): """Get the description of available video subtitles. :param p_mi: the media player. :return: list containing description of available video subtitles. It must be freed with :func:`libvlc_track_description_list_release`. """ f = _Cfunctions.get("libvlc_video_get_spu_description", None) or _Cfunction( "libvlc_video_get_spu_description", ((1,),), None, ctypes.POINTER(TrackDescription), MediaPlayer, ) return f(p_mi) def libvlc_video_get_teletext(p_mi): """Get current teletext page requested or 0 if it's disabled. Teletext is disabled by default, call :func:`libvlc_video_set_teletext` to enable it. :param p_mi: the media player. :return: the current teletext page requested. """ f = _Cfunctions.get("libvlc_video_get_teletext", None) or _Cfunction( "libvlc_video_get_teletext", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_video_get_title_description(p_mi): """Get the description of available titles. :param p_mi: the media player. :return: list containing description of available titles. It must be freed with :func:`libvlc_track_description_list_release`. """ f = _Cfunctions.get("libvlc_video_get_title_description", None) or _Cfunction( "libvlc_video_get_title_description", ((1,),), None, ctypes.POINTER(TrackDescription), MediaPlayer, ) return f(p_mi) def libvlc_video_get_track(p_mi): """Get current video track. :param p_mi: media player. :return: the video track ID (int) or -1 if no active input. """ f = _Cfunctions.get("libvlc_video_get_track", None) or _Cfunction( "libvlc_video_get_track", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_video_get_track_count(p_mi): """Get number of available video tracks. :param p_mi: media player. :return: the number of available video tracks (int). """ f = _Cfunctions.get("libvlc_video_get_track_count", None) or _Cfunction( "libvlc_video_get_track_count", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_video_get_track_description(p_mi): """Get the description of available video tracks. :param p_mi: media player. :return: list with description of available video tracks, or None on error. It must be freed with :func:`libvlc_track_description_list_release`. """ f = _Cfunctions.get("libvlc_video_get_track_description", None) or _Cfunction( "libvlc_video_get_track_description", ((1,),), None, ctypes.POINTER(TrackDescription), MediaPlayer, ) return f(p_mi) def libvlc_video_get_width(p_mi): """Get current video width. .. warning:: **Deprecated!** Use :func:`libvlc_video_get_size` instead. :param p_mi: the media player. :return: the video pixel width or 0 if not applicable. """ f = _Cfunctions.get("libvlc_video_get_width", None) or _Cfunction( "libvlc_video_get_width", ((1,),), None, ctypes.c_int, MediaPlayer ) return f(p_mi) def libvlc_video_new_viewpoint(): """Create a video viewpoint structure. :return: video viewpoint or None. (the result must be released with free() or libvlc_free). :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_video_new_viewpoint", None) or _Cfunction( "libvlc_video_new_viewpoint", (), None, ctypes.POINTER(VideoViewpoint) ) return f() def libvlc_video_set_adjust_float(p_mi, option, value): """Set adjust *option* as float. Options that take a different type value are ignored. :param p_mi: libvlc media player instance. :param option: adust option to set, values of :class:`VideoAdjustOption`. :param value: adjust option value. :version: LibVLC 1.1.1 and later. """ f = _Cfunctions.get("libvlc_video_set_adjust_float", None) or _Cfunction( "libvlc_video_set_adjust_float", ( (1,), (1,), (1,), ), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_float, ) return f(p_mi, option, value) def libvlc_video_set_adjust_int(p_mi, option, value): """Set adjust *option* as integer. Options that take a different type value are ignored. Passing libvlc_adjust_enable as *option* *value* has the side effect of starting (arg !0) or stopping (arg 0) the adjust filter. :param p_mi: libvlc media player instance. :param option: adust option to set, values of :class:`VideoAdjustOption`. :param value: adjust option value. :version: LibVLC 1.1.1 and later. """ f = _Cfunctions.get("libvlc_video_set_adjust_int", None) or _Cfunction( "libvlc_video_set_adjust_int", ( (1,), (1,), (1,), ), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_int, ) return f(p_mi, option, value) def libvlc_video_set_aspect_ratio(p_mi, psz_aspect): """Set new video aspect ratio. .. note:: Invalid aspect ratios are ignored. :param p_mi: the media player. :param psz_aspect: new video aspect-ratio or None to reset to default. """ f = _Cfunctions.get("libvlc_video_set_aspect_ratio", None) or _Cfunction( "libvlc_video_set_aspect_ratio", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_char_p, ) return f(p_mi, psz_aspect) def libvlc_video_set_callbacks(mp, lock, unlock, display, opaque): """Set callbacks and private data to render decoded video to a custom area in memory. Use :func:`libvlc_video_set_format` or :func:`libvlc_video_set_format_callbacks` to configure the decoded format. .. warning:: Rendering video into custom memory buffers is considerably less efficient than rendering in a custom window as normal. For optimal perfomances, VLC media player renders into a custom window, and does not use this function and associated callbacks. It is **highly recommended** that other LibVLC-based application do likewise. To embed video in a window, use libvlc_media_player_set_xid or equivalent depending on the operating system. If window embedding does not fit the application use case, then a custom LibVLC video output *display* plugin is required to maintain optimal video rendering performances. The following limitations affect performance: * Hardware video decoding acceleration will either be disabled completely, or require (relatively slow) copy from video/DSP memory to main memory. * Sub-pictures (subtitles, on-screen *display*, etc.) must be blent into the main picture by the CPU instead of the GPU. * Depending on the video format, pixel format conversion, picture scaling, cropping and/or picture re-orientation, must be performed by the CPU instead of the GPU. * Memory copying is required between LibVLC reference picture buffers and application buffers (between *lock* and *unlock* callbacks). :param mp: the media player. :param lock: callback to lock video memory (must not be None). :param unlock: callback to unlock video memory (or None if not needed). :param display: callback to display video (or None if not needed). :param opaque: private pointer for the three callbacks (as first parameter). :version: LibVLC 1.1.1 or later. """ f = _Cfunctions.get("libvlc_video_set_callbacks", None) or _Cfunction( "libvlc_video_set_callbacks", ( (1,), (1,), (1,), (1,), (1,), ), None, None, MediaPlayer, VideoLockCb, VideoUnlockCb, VideoDisplayCb, ctypes.c_void_p, ) return f(mp, lock, unlock, display, opaque) def libvlc_video_set_crop_geometry(p_mi, psz_geometry): """Set new crop filter geometry. :param p_mi: the media player. :param psz_geometry: new crop filter geometry (None to unset). """ f = _Cfunctions.get("libvlc_video_set_crop_geometry", None) or _Cfunction( "libvlc_video_set_crop_geometry", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_char_p, ) return f(p_mi, psz_geometry) def libvlc_video_set_deinterlace(p_mi, psz_mode): """Enable or disable deinterlace filter :param p_mi: libvlc media player. :param psz_mode: type of deinterlace filter, None to disable. """ f = _Cfunctions.get("libvlc_video_set_deinterlace", None) or _Cfunction( "libvlc_video_set_deinterlace", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_char_p, ) return f(p_mi, psz_mode) def libvlc_video_set_format(mp, chroma, width, height, pitch): """Set decoded video *chroma* and dimensions. This only works in combination with :func:`libvlc_video_set_callbacks`, and is mutually exclusive with :func:`libvlc_video_set_format_callbacks`. :param mp: the media player. :param chroma: a four-characters string identifying the chroma. (e.g. "RV32" or "YUYV"). :param width: pixel width. :param height: pixel height. :param pitch: line pitch (in bytes). :version: LibVLC 1.1.1 or later. :bug: All pixel planes are expected to have the same *pitch*. To use the YCbCr color space with chrominance subsampling, consider using :func:`libvlc_video_set_format_callbacks` instead. """ f = _Cfunctions.get("libvlc_video_set_format", None) or _Cfunction( "libvlc_video_set_format", ( (1,), (1,), (1,), (1,), (1,), ), None, None, MediaPlayer, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint, ) return f(mp, chroma, width, height, pitch) def libvlc_video_set_format_callbacks(mp, setup, cleanup): """Set decoded video chroma and dimensions. This only works in combination with :func:`libvlc_video_set_callbacks`. :param mp: the media player. :param setup: callback to select the video format (cannot be None). :param cleanup: callback to release any allocated resources (or None). :version: LibVLC 2.0.0 or later. """ f = _Cfunctions.get("libvlc_video_set_format_callbacks", None) or _Cfunction( "libvlc_video_set_format_callbacks", ( (1,), (1,), (1,), ), None, None, MediaPlayer, VideoFormatCb, VideoCleanupCb, ) return f(mp, setup, cleanup) def libvlc_video_set_key_input(p_mi, on): """Enable or disable key press events handling, according to the LibVLC hotkeys configuration. By default and for historical reasons, keyboard events are handled by the LibVLC video widget. .. note:: On X11, there can be only one subscriber for key press and mouse click events per window. If your application has subscribed to those events for the X window ID of the video widget, then LibVLC will not be able to handle key presses and mouse clicks in any case. .. warning:: This function is only implemented for X11 and Win32 at the moment. :param p_mi: the media player. :param on: true to handle key press events, false to ignore them. """ f = _Cfunctions.get("libvlc_video_set_key_input", None) or _Cfunction( "libvlc_video_set_key_input", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_uint, ) return f(p_mi, on) def libvlc_video_set_logo_int(p_mi, option, value): """Set logo *option* as integer. Options that take a different type value are ignored. Passing libvlc_logo_enable as *option* *value* has the side effect of starting (arg !0) or stopping (arg 0) the logo filter. :param p_mi: libvlc media player instance. :param option: logo option to set, values of :class:`VideoLogoOption`. :param value: logo option value. """ f = _Cfunctions.get("libvlc_video_set_logo_int", None) or _Cfunction( "libvlc_video_set_logo_int", ( (1,), (1,), (1,), ), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_int, ) return f(p_mi, option, value) def libvlc_video_set_logo_string(p_mi, option, psz_value): """Set logo *option* as string. Options that take a different type value are ignored. :param p_mi: libvlc media player instance. :param option: logo option to set, values of :class:`VideoLogoOption`. :param psz_value: logo option value. """ f = _Cfunctions.get("libvlc_video_set_logo_string", None) or _Cfunction( "libvlc_video_set_logo_string", ( (1,), (1,), (1,), ), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p, ) return f(p_mi, option, psz_value) def libvlc_video_set_marquee_int(p_mi, option, i_val): """Enable, disable or set an integer marquee option Setting libvlc_marquee_Enable has the side effect of enabling (arg !0) or disabling (arg 0) the marq filter. :param p_mi: libvlc media player. :param option: marq option to set See libvlc_video_marquee_int_option_t. :param i_val: marq option value. """ f = _Cfunctions.get("libvlc_video_set_marquee_int", None) or _Cfunction( "libvlc_video_set_marquee_int", ( (1,), (1,), (1,), ), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_int, ) return f(p_mi, option, i_val) def libvlc_video_set_marquee_string(p_mi, option, psz_text): """Set a marquee string option :param p_mi: libvlc media player. :param option: marq option to set See libvlc_video_marquee_string_option_t. :param psz_text: marq option value. """ f = _Cfunctions.get("libvlc_video_set_marquee_string", None) or _Cfunction( "libvlc_video_set_marquee_string", ( (1,), (1,), (1,), ), None, None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p, ) return f(p_mi, option, psz_text) def libvlc_video_set_mouse_input(p_mi, on): """Enable or disable mouse click events handling. By default, those events are handled. This is needed for DVD menus to work, as well as a few video filters such as "puzzle". See :func:`libvlc_video_set_key_input`. .. warning:: This function is only implemented for X11 and Win32 at the moment. :param p_mi: the media player. :param on: true to handle mouse click events, false to ignore them. """ f = _Cfunctions.get("libvlc_video_set_mouse_input", None) or _Cfunction( "libvlc_video_set_mouse_input", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_uint, ) return f(p_mi, on) def libvlc_video_set_scale(p_mi, f_factor): """Set the video scaling factor. That is the ratio of the number of pixels on screen to the number of pixels in the original decoded video in each dimension. Zero is a special value; it will adjust the video to the output window/drawable (in windowed mode) or the entire screen. Note that not all video outputs support scaling. :param p_mi: the media player. :param f_factor: the scaling factor, or zero. """ f = _Cfunctions.get("libvlc_video_set_scale", None) or _Cfunction( "libvlc_video_set_scale", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_float, ) return f(p_mi, f_factor) def libvlc_video_set_spu(p_mi, i_spu): """Set new video subtitle. :param p_mi: the media player. :param i_spu: video subtitle track to select (i_id from track description). :return: 0 on success, -1 if out of range. """ f = _Cfunctions.get("libvlc_video_set_spu", None) or _Cfunction( "libvlc_video_set_spu", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_int, ) return f(p_mi, i_spu) def libvlc_video_set_spu_delay(p_mi, i_delay): """Set the subtitle delay. This affects the timing of when the subtitle will be displayed. Positive values result in subtitles being displayed later, while negative values will result in subtitles being displayed earlier. The subtitle delay will be reset to zero each time the media changes. :param p_mi: media player. :param i_delay: time (in microseconds) the display of subtitles should be delayed. :return: 0 on success, -1 on error. :version: LibVLC 2.0.0 or later. """ f = _Cfunctions.get("libvlc_video_set_spu_delay", None) or _Cfunction( "libvlc_video_set_spu_delay", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_int64, ) return f(p_mi, i_delay) def libvlc_video_set_subtitle_file(p_mi, psz_subtitle): """Set new video subtitle file. .. warning:: **Deprecated!** Use :func:`libvlc_media_player_add_slave` instead. :param p_mi: the media player. :param psz_subtitle: new video subtitle file. :return: the success status (boolean). """ f = _Cfunctions.get("libvlc_video_set_subtitle_file", None) or _Cfunction( "libvlc_video_set_subtitle_file", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_char_p, ) return f(p_mi, psz_subtitle) def libvlc_video_set_teletext(p_mi, i_page): """Set new teletext page to retrieve. This function can also be used to send a teletext key. :param p_mi: the media player. :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. :class:`TeletextKey`. 100 is the default teletext page. """ f = _Cfunctions.get("libvlc_video_set_teletext", None) or _Cfunction( "libvlc_video_set_teletext", ( (1,), (1,), ), None, None, MediaPlayer, ctypes.c_int, ) return f(p_mi, i_page) def libvlc_video_set_track(p_mi, i_track): """Set video track. :param p_mi: media player. :param i_track: the track ID (i_id field from track description). :return: 0 on success, -1 if out of range. """ f = _Cfunctions.get("libvlc_video_set_track", None) or _Cfunction( "libvlc_video_set_track", ( (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_int, ) return f(p_mi, i_track) def libvlc_video_take_snapshot(p_mi, num, psz_filepath, i_width, i_height): """Take a snapshot of the current video window. If *i_width* AND *i_height* is 0, original size is used. If *i_width* XOR *i_height* is 0, original aspect-ratio is preserved. :param p_mi: media player instance. :param num: number of video output (typically 0 for the first/only one). :param psz_filepath: the path of a file or a folder to save the screenshot into. :param i_width: the snapshot's width. :param i_height: the snapshot's height. :return: 0 on success, -1 if the video was not found. """ f = _Cfunctions.get("libvlc_video_take_snapshot", None) or _Cfunction( "libvlc_video_take_snapshot", ( (1,), (1,), (1,), (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint, ) return f(p_mi, num, psz_filepath, i_width, i_height) def libvlc_video_update_viewpoint(p_mi, p_viewpoint, b_absolute): """Update the video viewpoint information. .. note:: It is safe to call this function before the media player is started. .. note:: the values are set asynchronously, it will be used by the next frame displayed. :param p_mi: the media player. :param p_viewpoint: video viewpoint allocated via :func:`libvlc_video_new_viewpoint`. :param b_absolute: if true replace the old viewpoint with the new one. If. false, increase/decrease it. :return: -1 in case of error, 0 otherwise. :version: LibVLC 3.0.0 and later. """ f = _Cfunctions.get("libvlc_video_update_viewpoint", None) or _Cfunction( "libvlc_video_update_viewpoint", ( (1,), (1,), (1,), ), None, ctypes.c_int, MediaPlayer, ctypes.POINTER(VideoViewpoint), ctypes.c_bool, ) return f(p_mi, p_viewpoint, b_absolute) def libvlc_vlm_add_broadcast( p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop, ): """Add a broadcast, with one input. :param p_instance: the instance. :param psz_name: the name of the new broadcast. :param psz_input: the input MRL. :param psz_output: the output MRL (the parameter to the "sout" variable). :param i_options: number of additional options. :param ppsz_options: additional options. :param b_enabled: boolean for enabling the new broadcast. :param b_loop: Should this broadcast be played in loop ? :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_add_broadcast", None) or _Cfunction( "libvlc_vlm_add_broadcast", ( (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), ), None, 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, ) return f( p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop, ) def libvlc_vlm_add_input(p_instance, psz_name, psz_input): """Add a media's input MRL. This will add the specified one. :param p_instance: the instance. :param psz_name: the media to work on. :param psz_input: the input MRL. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_add_input", None) or _Cfunction( "libvlc_vlm_add_input", ( (1,), (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ) return f(p_instance, psz_name, psz_input) def libvlc_vlm_add_vod( p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux ): """Add a vod, with one input. :param p_instance: the instance. :param psz_name: the name of the new vod media. :param psz_input: the input MRL. :param i_options: number of additional options. :param ppsz_options: additional options. :param b_enabled: boolean for enabling the new vod. :param psz_mux: the muxer of the vod media. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_add_vod", None) or _Cfunction( "libvlc_vlm_add_vod", ( (1,), (1,), (1,), (1,), (1,), (1,), (1,), ), None, 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, ) return f( p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux ) def libvlc_vlm_change_media( p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop, ): """Edit the parameters of a media. This will delete all existing inputs and add the specified one. :param p_instance: the instance. :param psz_name: the name of the new broadcast. :param psz_input: the input MRL. :param psz_output: the output MRL (the parameter to the "sout" variable). :param i_options: number of additional options. :param ppsz_options: additional options. :param b_enabled: boolean for enabling the new broadcast. :param b_loop: Should this broadcast be played in loop ? :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_change_media", None) or _Cfunction( "libvlc_vlm_change_media", ( (1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,), ), None, 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, ) return f( p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop, ) def libvlc_vlm_del_media(p_instance, psz_name): """Delete a media (VOD or broadcast). :param p_instance: the instance. :param psz_name: the media to delete. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_del_media", None) or _Cfunction( "libvlc_vlm_del_media", ( (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ) return f(p_instance, psz_name) def libvlc_vlm_get_event_manager(p_instance): """Get libvlc_event_manager from a vlm media. The p_event_manager is immutable, so you don't have to hold the lock :param p_instance: a libvlc instance. :return: libvlc_event_manager. """ f = _Cfunctions.get("libvlc_vlm_get_event_manager", None) or _Cfunction( "libvlc_vlm_get_event_manager", ((1,),), class_result(EventManager), ctypes.c_void_p, Instance, ) return f(p_instance) def libvlc_vlm_get_media_instance_length(p_instance, psz_name, i_instance): """Get vlm_media instance length by name or instance id :param p_instance: a libvlc instance. :param psz_name: name of vlm media instance. :param i_instance: instance id. :return: length of media item or -1 on error. """ f = _Cfunctions.get("libvlc_vlm_get_media_instance_length", None) or _Cfunction( "libvlc_vlm_get_media_instance_length", ( (1,), (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int, ) return f(p_instance, psz_name, i_instance) def libvlc_vlm_get_media_instance_position(p_instance, psz_name, i_instance): """Get vlm_media instance position by name or instance id :param p_instance: a libvlc instance. :param psz_name: name of vlm media instance. :param i_instance: instance id. :return: position as float or -1. on error. """ f = _Cfunctions.get("libvlc_vlm_get_media_instance_position", None) or _Cfunction( "libvlc_vlm_get_media_instance_position", ( (1,), (1,), (1,), ), None, ctypes.c_float, Instance, ctypes.c_char_p, ctypes.c_int, ) return f(p_instance, psz_name, i_instance) def libvlc_vlm_get_media_instance_rate(p_instance, psz_name, i_instance): """Get vlm_media instance playback rate by name or instance id :param p_instance: a libvlc instance. :param psz_name: name of vlm media instance. :param i_instance: instance id. :return: playback rate or -1 on error. """ f = _Cfunctions.get("libvlc_vlm_get_media_instance_rate", None) or _Cfunction( "libvlc_vlm_get_media_instance_rate", ( (1,), (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int, ) return f(p_instance, psz_name, i_instance) def libvlc_vlm_get_media_instance_time(p_instance, psz_name, i_instance): """Get vlm_media instance time by name or instance id :param p_instance: a libvlc instance. :param psz_name: name of vlm media instance. :param i_instance: instance id. :return: time as integer or -1 on error. """ f = _Cfunctions.get("libvlc_vlm_get_media_instance_time", None) or _Cfunction( "libvlc_vlm_get_media_instance_time", ( (1,), (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int, ) return f(p_instance, psz_name, i_instance) def libvlc_vlm_pause_media(p_instance, psz_name): """Pause the named broadcast. :param p_instance: the instance. :param psz_name: the name of the broadcast. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_pause_media", None) or _Cfunction( "libvlc_vlm_pause_media", ( (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ) return f(p_instance, psz_name) def libvlc_vlm_play_media(p_instance, psz_name): """Play the named broadcast. :param p_instance: the instance. :param psz_name: the name of the broadcast. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_play_media", None) or _Cfunction( "libvlc_vlm_play_media", ( (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ) return f(p_instance, psz_name) def libvlc_vlm_release(p_instance): """Release the vlm instance related to the given :class:`Instance` :param p_instance: the instance. """ f = _Cfunctions.get("libvlc_vlm_release", None) or _Cfunction( "libvlc_vlm_release", ((1,),), None, None, Instance ) return f(p_instance) def libvlc_vlm_seek_media(p_instance, psz_name, f_percentage): """Seek in the named broadcast. :param p_instance: the instance. :param psz_name: the name of the broadcast. :param f_percentage: the percentage to seek to. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_seek_media", None) or _Cfunction( "libvlc_vlm_seek_media", ( (1,), (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_float, ) return f(p_instance, psz_name, f_percentage) def libvlc_vlm_set_enabled(p_instance, psz_name, b_enabled): """Enable or disable a media (VOD or broadcast). :param p_instance: the instance. :param psz_name: the media to work on. :param b_enabled: the new status. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_set_enabled", None) or _Cfunction( "libvlc_vlm_set_enabled", ( (1,), (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int, ) return f(p_instance, psz_name, b_enabled) def libvlc_vlm_set_input(p_instance, psz_name, psz_input): """Set a media's input MRL. This will delete all existing inputs and add the specified one. :param p_instance: the instance. :param psz_name: the media to work on. :param psz_input: the input MRL. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_set_input", None) or _Cfunction( "libvlc_vlm_set_input", ( (1,), (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ) return f(p_instance, psz_name, psz_input) def libvlc_vlm_set_loop(p_instance, psz_name, b_loop): """Set a media's loop status. :param p_instance: the instance. :param psz_name: the media to work on. :param b_loop: the new status. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_set_loop", None) or _Cfunction( "libvlc_vlm_set_loop", ( (1,), (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int, ) return f(p_instance, psz_name, b_loop) def libvlc_vlm_set_mux(p_instance, psz_name, psz_mux): """Set a media's vod muxer. :param p_instance: the instance. :param psz_name: the media to work on. :param psz_mux: the new muxer. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_set_mux", None) or _Cfunction( "libvlc_vlm_set_mux", ( (1,), (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ) return f(p_instance, psz_name, psz_mux) def libvlc_vlm_set_output(p_instance, psz_name, psz_output): """Set the output for a media. :param p_instance: the instance. :param psz_name: the media to work on. :param psz_output: the output MRL (the parameter to the "sout" variable). :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_set_output", None) or _Cfunction( "libvlc_vlm_set_output", ( (1,), (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ) return f(p_instance, psz_name, psz_output) def libvlc_vlm_show_media(p_instance, psz_name): """Return information about the named media as a JSON string representation. This function is mainly intended for debugging use, if you want programmatic access to the state of a vlm_media_instance_t, please use the corresponding libvlc_vlm_get_media_instance_xxx -functions. Currently there are no such functions available for vlm_media_t though. :param p_instance: the instance. :param psz_name: the name of the media, if the name is an empty string, all media is described. :return: string with information about named media, or None on error. """ f = _Cfunctions.get("libvlc_vlm_show_media", None) or _Cfunction( "libvlc_vlm_show_media", ( (1,), (1,), ), string_result, ctypes.c_void_p, Instance, ctypes.c_char_p, ) return f(p_instance, psz_name) def libvlc_vlm_stop_media(p_instance, psz_name): """Stop the named broadcast. :param p_instance: the instance. :param psz_name: the name of the broadcast. :return: 0 on success, -1 on error. """ f = _Cfunctions.get("libvlc_vlm_stop_media", None) or _Cfunction( "libvlc_vlm_stop_media", ( (1,), (1,), ), None, ctypes.c_int, Instance, ctypes.c_char_p, ) return f(p_instance, psz_name) def libvlc_vprinterr(fmt, ap): """Sets the LibVLC error status and message for the current thread. Any previous error is overridden. :param fmt: the format string. :param ap: the arguments. :return: a nul terminated string in any case. """ f = _Cfunctions.get("libvlc_vprinterr", None) or _Cfunction( "libvlc_vprinterr", ( (1,), (1,), ), None, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p, ) return f(fmt, ap) def libvlc_wait(p_instance): """Waits until an interface causes the instance to exit. You should start at least one interface first, using :func:`libvlc_add_intf`. .. warning:: This function wastes one thread doing basically nothing. :func:`libvlc_set_exit_handler` should be used instead. :param p_instance: the instance. """ f = _Cfunctions.get("libvlc_wait", None) or _Cfunction( "libvlc_wait", ((1,),), None, None, Instance ) return f(p_instance) # End of generated functions # # End of header.py # # 34 function(s) deprecated: # libvlc_audio_output_device_count # libvlc_audio_output_device_id # libvlc_audio_output_device_longname # libvlc_audio_output_get_device_type # libvlc_audio_output_set_device_type # libvlc_get_log_verbosity # libvlc_log_clear # libvlc_log_close # libvlc_log_count # libvlc_log_get_iterator # libvlc_log_iterator_free # libvlc_log_iterator_has_next # libvlc_log_iterator_next # libvlc_log_open # libvlc_media_discoverer_event_manager # libvlc_media_discoverer_localized_name # libvlc_media_discoverer_new_from_name # libvlc_media_get_tracks_info # libvlc_media_is_parsed # libvlc_media_parse # libvlc_media_parse_async # libvlc_media_player_get_agl # libvlc_media_player_get_fps # libvlc_media_player_set_agl # libvlc_playlist_play # libvlc_set_log_verbosity # libvlc_toggle_teletext # libvlc_track_description_release # libvlc_video_get_chapter_description # libvlc_video_get_height # libvlc_video_get_title_description # libvlc_video_get_width # libvlc_video_set_subtitle_file # libvlc_wait # 41 function(s) not wrapped as methods: # libvlc_audio_equalizer_get_band_count # libvlc_audio_equalizer_get_band_frequency # libvlc_audio_equalizer_get_preset_count # libvlc_audio_equalizer_get_preset_name # libvlc_audio_equalizer_new # libvlc_audio_equalizer_new_from_preset # libvlc_audio_output_device_list_release # libvlc_audio_output_list_release # libvlc_chapter_descriptions_release # libvlc_clearerr # libvlc_clock # libvlc_dialog_dismiss # libvlc_dialog_get_context # libvlc_dialog_post_action # libvlc_dialog_post_login # libvlc_dialog_set_context # libvlc_errmsg # libvlc_event_type_name # libvlc_free # libvlc_get_changeset # libvlc_get_compiler # libvlc_get_version # libvlc_log_clear # libvlc_log_close # libvlc_log_count # libvlc_log_get_context # libvlc_log_get_iterator # libvlc_log_get_object # libvlc_media_discoverer_list_release # libvlc_media_get_codec_description # libvlc_media_slaves_release # libvlc_media_tracks_release # libvlc_module_description_list_release # libvlc_new # libvlc_printerr # libvlc_renderer_discoverer_list_release # libvlc_title_descriptions_release # libvlc_track_description_list_release # libvlc_track_description_release # libvlc_video_new_viewpoint # libvlc_vprinterr # Start of footer.py # # Backward compatibility def callbackmethod(callback): """Now obsolete ``@callbackmethod`` decorator.""" return callback # libvlc_free is not present in some versions of libvlc. If it is not # in the library, then emulate it by calling libc.free if not hasattr(dll, "libvlc_free"): # need to find the free function in the C runtime. This is # platform specific. # For Linux and MacOSX libc_path = find_library("c") if libc_path: libc = ctypes.CDLL(libc_path) libvlc_free = libc.free else: # On win32, it is impossible to guess the proper lib to call # (msvcrt, mingw...). Just ignore the call: it will memleak, # but not prevent to run the application. def libvlc_free(p): pass # ensure argtypes is right, because default type of int won't # work on 64-bit systems libvlc_free.argtypes = [ctypes.c_void_p] # Version functions def _dot2int(v): """(INTERNAL) Convert 'i.i.i[.i]' str to int.""" t = [int(i) for i in v.split(".")] if len(t) == 3: if t[2] < 100: t.append(0) else: # 100 is arbitrary t[2:4] = divmod(t[2], 100) elif len(t) != 4: raise ValueError('"i.i.i[.i]": %r' % (v,)) if min(t) < 0 or max(t) > 255: raise ValueError("[0..255]: %r" % (v,)) i = t.pop(0) while t: i = (i << 8) + t.pop(0) return i def hex_version(): """Return the version of these bindings in hex or 0 if unavailable.""" try: return _dot2int(__version__) except (NameError, ValueError): return 0 def libvlc_hex_version(): """Return the libvlc version in hex or 0 if unavailable.""" try: return _dot2int(bytes_to_str(libvlc_get_version()).split()[0]) except ValueError: return 0 def debug_callback(event, *args, **kwds): """Example callback, useful for debugging.""" l = ["event %s" % (event.type,)] if args: l.extend(map(str, args)) if kwds: l.extend(sorted("%s=%s" % t for t in kwds.items())) print("Debug callback (%s)" % ", ".join(l)) def print_python(): from platform import architecture, mac_ver, machine, uname, win32_ver if "intelpython" in sys.executable: t = "Intel-" # elif 'PyPy ' in sys.version: # t = 'PyPy-' else: t = "" t = "%sPython: %s (%s)" % (t, sys.version.split()[0], architecture()[0]) if win32_ver()[0]: t = t, "Windows", win32_ver()[0] elif mac_ver()[0]: t = t, ("iOS" if sys.platform == "ios" else "macOS"), mac_ver()[0], machine() else: try: import distro # t = t, bytes_to_str(distro.name()), bytes_to_str(distro.version()) except ImportError: t = (t,) + uname()[0:3:2] print(" ".join(t)) def print_version(): """Print version of this vlc.py and of the libvlc""" try: print("%s: %s (%s)" % (os.path.basename(__file__), __version__, build_date)) print( "libVLC: %s (%#x)" % (bytes_to_str(libvlc_get_version()), libvlc_hex_version()) ) # print('libVLC %s' % bytes_to_str(libvlc_get_compiler())) if plugin_path: print("plugins: %s" % plugin_path) except Exception: print("Error: %s" % sys.exc_info()[1]) if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG) try: from msvcrt import getch except ImportError: import termios import tty def getch(): # getchar(), getc(stdin) #PYCHOK flake fd = sys.stdin.fileno() old = termios.tcgetattr(fd) try: tty.setraw(fd) ch = sys.stdin.read(1) finally: termios.tcsetattr(fd, termios.TCSADRAIN, old) return ch def end_callback(event): print("End of media stream (event %s)" % event.type) sys.exit(0) echo_position = False def pos_callback(event, player): if echo_position: sys.stdout.write( "\r%s to %.2f%% (%.2f%%)" % (event.type, event.u.new_position * 100, player.get_position() * 100) ) sys.stdout.flush() if "-h" in sys.argv[:2] or "--help" in sys.argv[:2]: print("Usage: %s [options] " % sys.argv[0]) print("Once launched, type ? for help.") print("") elif "-v" in sys.argv[:2] or "--version" in sys.argv[:2]: print_version() print_python() print("") else: movie = os.path.expanduser(sys.argv.pop()) if not os.access(movie, os.R_OK): print("Error: %s file not readable" % movie) sys.exit(1) # Need --sub-source=marq in order to use marquee below instance = Instance(["--sub-source=marq"] + sys.argv[1:]) try: media = instance.media_new(movie) except (AttributeError, NameError) as e: print( "%s: %s (%s %s vs LibVLC %s)" % ( e.__class__.__name__, e, sys.argv[0], __version__, libvlc_get_version(), ) ) sys.exit(1) player = instance.media_player_new() player.set_media(media) player.play() # Some marquee examples. Marquee requires '--sub-source marq' in the # Instance() call above, see player.video_set_marquee_int(VideoMarqueeOption.Enable, 1) player.video_set_marquee_int(VideoMarqueeOption.Size, 24) # pixels # FIXME: This crashes the module - it should be investigated # player.video_set_marquee_int(VideoMarqueeOption.Position, Position.bottom) if False: # only one marquee can be specified player.video_set_marquee_int( VideoMarqueeOption.Timeout, 5000 ) # millisec, 0==forever t = media.get_mrl() # movie else: # update marquee text periodically player.video_set_marquee_int( VideoMarqueeOption.Timeout, 0 ) # millisec, 0==forever player.video_set_marquee_int( VideoMarqueeOption.Refresh, 1000 ) # millisec (or sec?) ##t = '$L / $D or $P at $T' t = "%Y-%m-%d %H:%M:%S" player.video_set_marquee_string(VideoMarqueeOption.Text, str_to_bytes(t)) # Some event manager examples. Note, the callback can be any Python # callable and does not need to be decorated. Optionally, specify # any number of positional and/or keyword arguments to be passed # to the callback (in addition to the first one, an Event instance). event_manager = player.event_manager() event_manager.event_attach(EventType.MediaPlayerEndReached, end_callback) event_manager.event_attach( EventType.MediaPlayerPositionChanged, pos_callback, player ) def mspf(): """Milliseconds per frame""" return int(1000 // (player.get_fps() or 25)) def print_info(): """Print information about the media""" try: print_version() media = player.get_media() print("State: %s" % player.get_state()) print("Media: %s" % bytes_to_str(media.get_mrl())) print( "Track: %s/%s" % (player.video_get_track(), player.video_get_track_count()) ) print("Current time: %s/%s" % (player.get_time(), media.get_duration())) print("Position: %s" % player.get_position()) print("FPS: %s (%d ms)" % (player.get_fps(), mspf())) print("Rate: %s" % player.get_rate()) print("Video size: %s" % str(player.video_get_size(0))) # num=0 print("Scale: %s" % player.video_get_scale()) print("Aspect ratio: %s" % player.video_get_aspect_ratio()) # print('Window:' % player.get_hwnd() except Exception: print("Error: %s" % sys.exc_info()[1]) def sec_forward(): """Go forward one sec""" player.set_time(player.get_time() + 1000) def sec_backward(): """Go backward one sec""" player.set_time(player.get_time() - 1000) def frame_forward(): """Go forward one frame""" player.set_time(player.get_time() + mspf()) def frame_backward(): """Go backward one frame""" player.set_time(player.get_time() - mspf()) def print_help(): """Print help""" print("Single-character commands:") for k, m in sorted(keybindings.items()): m = (m.__doc__ or m.__name__).splitlines()[0] print(" %s: %s." % (k, m.rstrip("."))) print("0-9: go to that fraction of the movie") def quit_app(): """Stop and exit""" sys.exit(0) def toggle_echo_position(): """Toggle echoing of media position""" global echo_position echo_position = not echo_position keybindings = { " ": player.pause, "+": sec_forward, "-": sec_backward, ".": frame_forward, ",": frame_backward, "f": player.toggle_fullscreen, "i": print_info, "p": toggle_echo_position, "q": quit_app, "?": print_help, } print("Press q to quit, ? to get help.%s" % os.linesep) while True: k = getch() print("> %s" % k) if k in keybindings: keybindings[k]() elif k.isdigit(): # jump to fraction of the movie. player.set_position(float("0." + k))