[
  {
    "path": ".github/workflows/ruff.yml",
    "content": "name: Ruff\n\non: [push, pull_request]\n\njobs:\n  linting:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: chartboost/ruff-action@v1\n        with:\n          args: \"check --config ruff.toml\"\n          src: \"./generator/generate.py ./tests ./dev_setup.py\"\n"
  },
  {
    "path": ".github/workflows/tests.yml",
    "content": "name: Tests\n\non: [push, pull_request]\n\njobs:\n  tests:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - run: |\n          sudo apt-get install -y vlc pulseaudio libvlc-dev\n          pulseaudio --start\n          bash ./dev_setup.sh\n          . .venv/bin/activate\n          make test_generator\n          make test_bindings\n"
  },
  {
    "path": ".gitignore",
    "content": "# Hidden files\n*~\n\n*.py[cod]\n\n# C extensions\n*.so\n\n# Packages\n*.egg\n*.egg-info\ndist\nbuild\neggs\nparts\nbin\nvar\nsdist\ndevelop-eggs\n.installed.cfg\nlib\nlib64\n__pycache__\n*.tar.gz\n\n# Installer logs\npip-log.txt\n\n# Unit test / coverage reports\n.coverage\n.tox\nnosetests.xml\n\n# Translations\n*.mo\n\n# Mr Developer\n.mr.developer.cfg\n.project\n.pydevproject\n\n# Virtual environment\n.venv\nvenv\n\n# pyenv version\n.python-version\n\n# Preprocessed libvlc header files\n*.preprocessed*\n\n# Documentation\ndocs/_build/\n"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"vendor/tree-sitter-c\"]\n    path = vendor/tree-sitter-c\n    url = https://github.com/tree-sitter/tree-sitter-c\n    ignore = dirty\n"
  },
  {
    "path": ".pre-commit-config.yaml",
    "content": "# See https://pre-commit.com for more information\n# See https://pre-commit.com/hooks.html for more hooks\nrepos:\n- repo: local\n  hooks:\n    # Abort the commit if there is one or more linting errors\n    - id: lint\n      name: Check no linting errors\n      entry: ruff check --config ruff.toml\n      language: python\n      files: |\n        (?x)^(\n          generator/generate\\.py|\n          tests/.*\\.py|\n          generated/3.0/vlc\\.py|\n          generated/dev/vlc\\.py|\n          dev_setup\\.py\n        )$\n      minimum_pre_commit_version: \"2.9.2\"\n\n    # Abort the commit if code wasn't formatted\n    - id: format\n      name: Check code is formatted\n      entry: ruff format --config ruff.toml --check --diff\n      language: python\n      files: |\n        (?x)^(\n          generator/generate\\.py|\n          tests/.*\\.py|\n          dev_setup\\.py|\n          generator/templates/.*\\.py\n        )$\n      minimum_pre_commit_version: \"2.9.2\"\n\n"
  },
  {
    "path": ".readthedocs.yaml",
    "content": "version: 2\n\nbuild:\n  os: ubuntu-22.04\n  tools:\n    python: \"3.12\"\n\n# Build documentation in the \"docs/\" directory with Sphinx\nsphinx:\n  configuration: docs/conf.py\n\npython:\n  install:\n    - requirements: docs/requirements.txt\n"
  },
  {
    "path": ".travis.yml",
    "content": "group: travis_latest\nlanguage: python\ncache: pip\npython:\n    - 3.8\ninstall:\n    #- pip install -r requirements.txt\n    - pip install flake8  # pytest  # add another testing frameworks later\nbefore_script:\n    - EXCLUDE=./generated/2.2,./generator/templates\n    # stop the build if there are Python syntax errors or undefined names\n    - flake8 . --count --exclude=$EXCLUDE --select=E901,E999,F821,F822,F823 --show-source --statistics\n    # exit-zero treats all errors as warnings.  The GitHub editor is 127 chars wide\n    - flake8 . --count --exclude=$EXCLUDE --exit-zero --max-complexity=10 --max-line-length=127 --statistics\nscript:\n    - true  # pytest --capture=sys  # add other tests here\nnotifications:\n    on_success: change\n    on_failure: change  # `always` will be the setting once code changes slow down\n"
  },
  {
    "path": "AUTHORS",
    "content": "These bindings and example code have been implemented and improved by\nthe following contributors:\n\nOlivier Aubert <contact@olivieraubert.net>\nJean Brouwers <MrJean1@Gmail.com>\nAlberto Invernizzi <alby.inve@gmail.com>\nChristian Clauss <cclauss@bluewin.ch>\nGeoff Salmon <geoff.salmon@gmail.com>\nYann Salmon <yannsalmon.pro@gmail.com>\nWafa Harir <harir.wafa.harir@gmail.com>\nMarwa Tabib <marwatabib21@gmail.com>\nOdin Hørthe Omdal <odin.omdal@gmail.com>\nSaveliy Yusufov <saveliy.m.yusufov@gmail.com>\nTomas Groth <second@tgc.dk>\nMichel Zou <xantares09@hotmail.com>\nDražen Lučanin <kermit666@gmail.com>\nChris Venter <chris.venter@gmail.com>\nCimbali <me@cimba.li>\nDenis Charmet <typx@dinauz.org>\nHendrik Buschmeier <hbuschme@uni-bielefeld.de>\nHukadan <hukadan@protonmail.ch>\nJonas Haag <jonas@lophus.org>\nPatrick Fay <pf5151@gmail.com>\nVaksick <vaksick@gmail.com>\nKim Wiktorén <kim.wiktoren@gmail.com>\n"
  },
  {
    "path": "COPYING",
    "content": "                  GNU LESSER GENERAL PUBLIC LICENSE\n                       Version 2.1, February 1999\n\n Copyright (C) 1991, 1999 Free Software Foundation, Inc.\n 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n[This is the first released version of the Lesser GPL.  It also counts\n as the successor of the GNU Library Public License, version 2, hence\n the version number 2.1.]\n\n                            Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicenses are intended to guarantee your freedom to share and change\nfree software--to make sure the software is free for all its users.\n\n  This license, the Lesser General Public License, applies to some\nspecially designated software packages--typically libraries--of the\nFree Software Foundation and other authors who decide to use it.  You\ncan use it too, but we suggest you first think carefully about whether\nthis license or the ordinary General Public License is the better\nstrategy to use in any particular case, based on the explanations below.\n\n  When we speak of free software, we are referring to freedom of use,\nnot price.  Our General Public Licenses are designed to make sure that\nyou have the freedom to distribute copies of free software (and charge\nfor this service if you wish); that you receive source code or can get\nit if you want it; that you can change the software and use pieces of\nit in new free programs; and that you are informed that you can do\nthese things.\n\n  To protect your rights, we need to make restrictions that forbid\ndistributors to deny you these rights or to ask you to surrender these\nrights.  These restrictions translate to certain responsibilities for\nyou if you distribute copies of the library or if you modify it.\n\n  For example, if you distribute copies of the library, whether gratis\nor for a fee, you must give the recipients all the rights that we gave\nyou.  You must make sure that they, too, receive or can get the source\ncode.  If you link other code with the library, you must provide\ncomplete object files to the recipients, so that they can relink them\nwith the library after making changes to the library and recompiling\nit.  And you must show them these terms so they know their rights.\n\n  We protect your rights with a two-step method: (1) we copyright the\nlibrary, and (2) we offer you this license, which gives you legal\npermission to copy, distribute and/or modify the library.\n\n  To protect each distributor, we want to make it very clear that\nthere is no warranty for the free library.  Also, if the library is\nmodified by someone else and passed on, the recipients should know\nthat what they have is not the original version, so that the original\nauthor's reputation will not be affected by problems that might be\nintroduced by others.\n\f\n  Finally, software patents pose a constant threat to the existence of\nany free program.  We wish to make sure that a company cannot\neffectively restrict the users of a free program by obtaining a\nrestrictive license from a patent holder.  Therefore, we insist that\nany patent license obtained for a version of the library must be\nconsistent with the full freedom of use specified in this license.\n\n  Most GNU software, including some libraries, is covered by the\nordinary GNU General Public License.  This license, the GNU Lesser\nGeneral Public License, applies to certain designated libraries, and\nis quite different from the ordinary General Public License.  We use\nthis license for certain libraries in order to permit linking those\nlibraries into non-free programs.\n\n  When a program is linked with a library, whether statically or using\na shared library, the combination of the two is legally speaking a\ncombined work, a derivative of the original library.  The ordinary\nGeneral Public License therefore permits such linking only if the\nentire combination fits its criteria of freedom.  The Lesser General\nPublic License permits more lax criteria for linking other code with\nthe library.\n\n  We call this license the \"Lesser\" General Public License because it\ndoes Less to protect the user's freedom than the ordinary General\nPublic License.  It also provides other free software developers Less\nof an advantage over competing non-free programs.  These disadvantages\nare the reason we use the ordinary General Public License for many\nlibraries.  However, the Lesser license provides advantages in certain\nspecial circumstances.\n\n  For example, on rare occasions, there may be a special need to\nencourage the widest possible use of a certain library, so that it becomes\na de-facto standard.  To achieve this, non-free programs must be\nallowed to use the library.  A more frequent case is that a free\nlibrary does the same job as widely used non-free libraries.  In this\ncase, there is little to gain by limiting the free library to free\nsoftware only, so we use the Lesser General Public License.\n\n  In other cases, permission to use a particular library in non-free\nprograms enables a greater number of people to use a large body of\nfree software.  For example, permission to use the GNU C Library in\nnon-free programs enables many more people to use the whole GNU\noperating system, as well as its variant, the GNU/Linux operating\nsystem.\n\n  Although the Lesser General Public License is Less protective of the\nusers' freedom, it does ensure that the user of a program that is\nlinked with the Library has the freedom and the wherewithal to run\nthat program using a modified version of the Library.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.  Pay close attention to the difference between a\n\"work based on the library\" and a \"work that uses the library\".  The\nformer contains code derived from the library, whereas the latter must\nbe combined with the library in order to run.\n\f\n                  GNU LESSER GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License Agreement applies to any software library or other\nprogram which contains a notice placed by the copyright holder or\nother authorized party saying it may be distributed under the terms of\nthis Lesser General Public License (also called \"this License\").\nEach licensee is addressed as \"you\".\n\n  A \"library\" means a collection of software functions and/or data\nprepared so as to be conveniently linked with application programs\n(which use some of those functions and data) to form executables.\n\n  The \"Library\", below, refers to any such software library or work\nwhich has been distributed under these terms.  A \"work based on the\nLibrary\" means either the Library or any derivative work under\ncopyright law: that is to say, a work containing the Library or a\nportion of it, either verbatim or with modifications and/or translated\nstraightforwardly into another language.  (Hereinafter, translation is\nincluded without limitation in the term \"modification\".)\n\n  \"Source code\" for a work means the preferred form of the work for\nmaking modifications to it.  For a library, complete source code means\nall the source code for all modules it contains, plus any associated\ninterface definition files, plus the scripts used to control compilation\nand installation of the library.\n\n  Activities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning a program using the Library is not restricted, and output from\nsuch a program is covered only if its contents constitute a work based\non the Library (independent of the use of the Library in a tool for\nwriting it).  Whether that is true depends on what the Library does\nand what the program that uses the Library does.\n\n  1. You may copy and distribute verbatim copies of the Library's\ncomplete source code as you receive it, in any medium, provided that\nyou conspicuously and appropriately publish on each copy an\nappropriate copyright notice and disclaimer of warranty; keep intact\nall the notices that refer to this License and to the absence of any\nwarranty; and distribute a copy of this License along with the\nLibrary.\n\n  You may charge a fee for the physical act of transferring a copy,\nand you may at your option offer warranty protection in exchange for a\nfee.\n\f\n  2. You may modify your copy or copies of the Library or any portion\nof it, thus forming a work based on the Library, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) The modified work must itself be a software library.\n\n    b) You must cause the files modified to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    c) You must cause the whole of the work to be licensed at no\n    charge to all third parties under the terms of this License.\n\n    d) If a facility in the modified Library refers to a function or a\n    table of data to be supplied by an application program that uses\n    the facility, other than as an argument passed when the facility\n    is invoked, then you must make a good faith effort to ensure that,\n    in the event an application does not supply such function or\n    table, the facility still operates, and performs whatever part of\n    its purpose remains meaningful.\n\n    (For example, a function in a library to compute square roots has\n    a purpose that is entirely well-defined independent of the\n    application.  Therefore, Subsection 2d requires that any\n    application-supplied function or table used by this function must\n    be optional: if the application does not supply it, the square\n    root function must still compute square roots.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Library,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Library, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote\nit.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Library.\n\nIn addition, mere aggregation of another work not based on the Library\nwith the Library (or with a work based on the Library) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may opt to apply the terms of the ordinary GNU General Public\nLicense instead of this License to a given copy of the Library.  To do\nthis, you must alter all the notices that refer to this License, so\nthat they refer to the ordinary GNU General Public License, version 2,\ninstead of to this License.  (If a newer version than version 2 of the\nordinary GNU General Public License has appeared, then you can specify\nthat version instead if you wish.)  Do not make any other change in\nthese notices.\n\f\n  Once this change is made in a given copy, it is irreversible for\nthat copy, so the ordinary GNU General Public License applies to all\nsubsequent copies and derivative works made from that copy.\n\n  This option is useful when you wish to copy part of the code of\nthe Library into a program that is not a library.\n\n  4. You may copy and distribute the Library (or a portion or\nderivative of it, under Section 2) in object code or executable form\nunder the terms of Sections 1 and 2 above provided that you accompany\nit with the complete corresponding machine-readable source code, which\nmust be distributed under the terms of Sections 1 and 2 above on a\nmedium customarily used for software interchange.\n\n  If distribution of object code is made by offering access to copy\nfrom a designated place, then offering equivalent access to copy the\nsource code from the same place satisfies the requirement to\ndistribute the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  5. A program that contains no derivative of any portion of the\nLibrary, but is designed to work with the Library by being compiled or\nlinked with it, is called a \"work that uses the Library\".  Such a\nwork, in isolation, is not a derivative work of the Library, and\ntherefore falls outside the scope of this License.\n\n  However, linking a \"work that uses the Library\" with the Library\ncreates an executable that is a derivative of the Library (because it\ncontains portions of the Library), rather than a \"work that uses the\nlibrary\".  The executable is therefore covered by this License.\nSection 6 states terms for distribution of such executables.\n\n  When a \"work that uses the Library\" uses material from a header file\nthat is part of the Library, the object code for the work may be a\nderivative work of the Library even though the source code is not.\nWhether this is true is especially significant if the work can be\nlinked without the Library, or if the work is itself a library.  The\nthreshold for this to be true is not precisely defined by law.\n\n  If such an object file uses only numerical parameters, data\nstructure layouts and accessors, and small macros and small inline\nfunctions (ten lines or less in length), then the use of the object\nfile is unrestricted, regardless of whether it is legally a derivative\nwork.  (Executables containing this object code plus portions of the\nLibrary will still fall under Section 6.)\n\n  Otherwise, if the work is a derivative of the Library, you may\ndistribute the object code for the work under the terms of Section 6.\nAny executables containing that work also fall under Section 6,\nwhether or not they are linked directly with the Library itself.\n\f\n  6. As an exception to the Sections above, you may also combine or\nlink a \"work that uses the Library\" with the Library to produce a\nwork containing portions of the Library, and distribute that work\nunder terms of your choice, provided that the terms permit\nmodification of the work for the customer's own use and reverse\nengineering for debugging such modifications.\n\n  You must give prominent notice with each copy of the work that the\nLibrary is used in it and that the Library and its use are covered by\nthis License.  You must supply a copy of this License.  If the work\nduring execution displays copyright notices, you must include the\ncopyright notice for the Library among them, as well as a reference\ndirecting the user to the copy of this License.  Also, you must do one\nof these things:\n\n    a) Accompany the work with the complete corresponding\n    machine-readable source code for the Library including whatever\n    changes were used in the work (which must be distributed under\n    Sections 1 and 2 above); and, if the work is an executable linked\n    with the Library, with the complete machine-readable \"work that\n    uses the Library\", as object code and/or source code, so that the\n    user can modify the Library and then relink to produce a modified\n    executable containing the modified Library.  (It is understood\n    that the user who changes the contents of definitions files in the\n    Library will not necessarily be able to recompile the application\n    to use the modified definitions.)\n\n    b) Use a suitable shared library mechanism for linking with the\n    Library.  A suitable mechanism is one that (1) uses at run time a\n    copy of the library already present on the user's computer system,\n    rather than copying library functions into the executable, and (2)\n    will operate properly with a modified version of the library, if\n    the user installs one, as long as the modified version is\n    interface-compatible with the version that the work was made with.\n\n    c) Accompany the work with a written offer, valid for at\n    least three years, to give the same user the materials\n    specified in Subsection 6a, above, for a charge no more\n    than the cost of performing this distribution.\n\n    d) If distribution of the work is made by offering access to copy\n    from a designated place, offer equivalent access to copy the above\n    specified materials from the same place.\n\n    e) Verify that the user has already received a copy of these\n    materials or that you have already sent this user a copy.\n\n  For an executable, the required form of the \"work that uses the\nLibrary\" must include any data and utility programs needed for\nreproducing the executable from it.  However, as a special exception,\nthe materials to be distributed need not include anything that is\nnormally distributed (in either source or binary form) with the major\ncomponents (compiler, kernel, and so on) of the operating system on\nwhich the executable runs, unless that component itself accompanies\nthe executable.\n\n  It may happen that this requirement contradicts the license\nrestrictions of other proprietary libraries that do not normally\naccompany the operating system.  Such a contradiction means you cannot\nuse both them and the Library together in an executable that you\ndistribute.\n\f\n  7. You may place library facilities that are a work based on the\nLibrary side-by-side in a single library together with other library\nfacilities not covered by this License, and distribute such a combined\nlibrary, provided that the separate distribution of the work based on\nthe Library and of the other library facilities is otherwise\npermitted, and provided that you do these two things:\n\n    a) Accompany the combined library with a copy of the same work\n    based on the Library, uncombined with any other library\n    facilities.  This must be distributed under the terms of the\n    Sections above.\n\n    b) Give prominent notice with the combined library of the fact\n    that part of it is a work based on the Library, and explaining\n    where to find the accompanying uncombined form of the same work.\n\n  8. You may not copy, modify, sublicense, link with, or distribute\nthe Library except as expressly provided under this License.  Any\nattempt otherwise to copy, modify, sublicense, link with, or\ndistribute the Library is void, and will automatically terminate your\nrights under this License.  However, parties who have received copies,\nor rights, from you under this License will not have their licenses\nterminated so long as such parties remain in full compliance.\n\n  9. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Library or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Library (or any work based on the\nLibrary), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Library or works based on it.\n\n  10. Each time you redistribute the Library (or any work based on the\nLibrary), the recipient automatically receives a license from the\noriginal licensor to copy, distribute, link with or modify the Library\nsubject to these terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties with\nthis License.\n\f\n  11. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Library at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Library by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Library.\n\nIf any portion of this section is held invalid or unenforceable under any\nparticular circumstance, the balance of the section is intended to apply,\nand the section as a whole is intended to apply in other circumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  12. If the distribution and/or use of the Library is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Library under this License may add\nan explicit geographical distribution limitation excluding those countries,\nso that distribution is permitted only in or among countries not thus\nexcluded.  In such case, this License incorporates the limitation as if\nwritten in the body of this License.\n\n  13. The Free Software Foundation may publish revised and/or new\nversions of the Lesser General Public License from time to time.\nSuch new versions will be similar in spirit to the present version,\nbut may differ in detail to address new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Library\nspecifies a version number of this License which applies to it and\n\"any later version\", you have the option of following the terms and\nconditions either of that version or of any later version published by\nthe Free Software Foundation.  If the Library does not specify a\nlicense version number, you may choose any version ever published by\nthe Free Software Foundation.\n\f\n  14. If you wish to incorporate parts of the Library into other free\nprograms whose distribution conditions are incompatible with these,\nwrite to the author to ask for permission.  For software which is\ncopyrighted by the Free Software Foundation, write to the Free\nSoftware Foundation; we sometimes make exceptions for this.  Our\ndecision will be guided by the two goals of preserving the free status\nof all derivatives of our free software and of promoting the sharing\nand reuse of software generally.\n\n                            NO WARRANTY\n\n  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\nWARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\nEXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\nOTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY\nKIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\nLIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\nTHE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\nWRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\nAND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\nFOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\nCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\nLIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\nRENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\nFAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\nSUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGES.\n\n                     END OF TERMS AND CONDITIONS\n\f\n           How to Apply These Terms to Your New Libraries\n\n  If you develop a new library, and you want it to be of the greatest\npossible use to the public, we recommend making it free software that\neveryone can redistribute and change.  You can do so by permitting\nredistribution under these terms (or, alternatively, under the terms of the\nordinary General Public License).\n\n  To apply these terms, attach the following notices to the library.  It is\nsafest to attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least the\n\"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the library's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This library is free software; you can redistribute it and/or\n    modify it under the terms of the GNU Lesser General Public\n    License as published by the Free Software Foundation; either\n    version 2.1 of the License, or (at your option) any later version.\n\n    This library is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n    Lesser General Public License for more details.\n\n    You should have received a copy of the GNU Lesser General Public\n    License along with this library; if not, write to the Free Software\n    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n\nAlso add information on how to contact you by electronic and paper mail.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the library, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the\n  library `Frob' (a library for tweaking knobs) written by James Random Hacker.\n\n  <signature of Ty Coon>, 1 April 1990\n  Ty Coon, President of Vice\n\nThat's all there is to it!\n"
  },
  {
    "path": "COPYING.generator",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 2, June 1991\n\n Copyright (C) 1989, 1991 Free Software Foundation, Inc.,\n 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicense is intended to guarantee your freedom to share and change free\nsoftware--to make sure the software is free for all its users.  This\nGeneral Public License applies to most of the Free Software\nFoundation's software and to any other program whose authors commit to\nusing it.  (Some other Free Software Foundation software is covered by\nthe GNU Lesser General Public License instead.)  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthis service if you wish), that you receive source code or can get it\nif you want it, that you can change the software or use pieces of it\nin new free programs; and that you know you can do these things.\n\n  To protect your rights, we need to make restrictions that forbid\nanyone to deny you these rights or to ask you to surrender the rights.\nThese restrictions translate to certain responsibilities for you if you\ndistribute copies of the software, or if you modify it.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must give the recipients all the rights that\nyou have.  You must make sure that they, too, receive or can get the\nsource code.  And you must show them these terms so they know their\nrights.\n\n  We protect your rights with two steps: (1) copyright the software, and\n(2) offer you this license which gives you legal permission to copy,\ndistribute and/or modify the software.\n\n  Also, for each author's protection and ours, we want to make certain\nthat everyone understands that there is no warranty for this free\nsoftware.  If the software is modified by someone else and passed on, we\nwant its recipients to know that what they have is not the original, so\nthat any problems introduced by others will not reflect on the original\nauthors' reputations.\n\n  Finally, any free program is threatened constantly by software\npatents.  We wish to avoid the danger that redistributors of a free\nprogram will individually obtain patent licenses, in effect making the\nprogram proprietary.  To prevent this, we have made it clear that any\npatent must be licensed for everyone's free use or not licensed at all.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                    GNU GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License applies to any program or other work which contains\na notice placed by the copyright holder saying it may be distributed\nunder the terms of this General Public License.  The \"Program\", below,\nrefers to any such program or work, and a \"work based on the Program\"\nmeans either the Program or any derivative work under copyright law:\nthat is to say, a work containing the Program or a portion of it,\neither verbatim or with modifications and/or translated into another\nlanguage.  (Hereinafter, translation is included without limitation in\nthe term \"modification\".)  Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning the Program is not restricted, and the output from the Program\nis covered only if its contents constitute a work based on the\nProgram (independent of having been made by running the Program).\nWhether that is true depends on what the Program does.\n\n  1. You may copy and distribute verbatim copies of the Program's\nsource code as you receive it, in any medium, provided that you\nconspicuously and appropriately publish on each copy an appropriate\ncopyright notice and disclaimer of warranty; keep intact all the\nnotices that refer to this License and to the absence of any warranty;\nand give any other recipients of the Program a copy of this License\nalong with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and\nyou may at your option offer warranty protection in exchange for a fee.\n\n  2. You may modify your copy or copies of the Program or any portion\nof it, thus forming a work based on the Program, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) You must cause the modified files to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    b) You must cause any work that you distribute or publish, that in\n    whole or in part contains or is derived from the Program or any\n    part thereof, to be licensed as a whole at no charge to all third\n    parties under the terms of this License.\n\n    c) If the modified program normally reads commands interactively\n    when run, you must cause it, when started running for such\n    interactive use in the most ordinary way, to print or display an\n    announcement including an appropriate copyright notice and a\n    notice that there is no warranty (or else, saying that you provide\n    a warranty) and that users may redistribute the program under\n    these conditions, and telling the user how to view a copy of this\n    License.  (Exception: if the Program itself is interactive but\n    does not normally print such an announcement, your work based on\n    the Program is not required to print an announcement.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Program,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Program.\n\nIn addition, mere aggregation of another work not based on the Program\nwith the Program (or with a work based on the Program) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may copy and distribute the Program (or a work based on it,\nunder Section 2) in object code or executable form under the terms of\nSections 1 and 2 above provided that you also do one of the following:\n\n    a) Accompany it with the complete corresponding machine-readable\n    source code, which must be distributed under the terms of Sections\n    1 and 2 above on a medium customarily used for software interchange; or,\n\n    b) Accompany it with a written offer, valid for at least three\n    years, to give any third party, for a charge no more than your\n    cost of physically performing source distribution, a complete\n    machine-readable copy of the corresponding source code, to be\n    distributed under the terms of Sections 1 and 2 above on a medium\n    customarily used for software interchange; or,\n\n    c) Accompany it with the information you received as to the offer\n    to distribute corresponding source code.  (This alternative is\n    allowed only for noncommercial distribution and only if you\n    received the program in object code or executable form with such\n    an offer, in accord with Subsection b above.)\n\nThe source code for a work means the preferred form of the work for\nmaking modifications to it.  For an executable work, complete source\ncode means all the source code for all modules it contains, plus any\nassociated interface definition files, plus the scripts used to\ncontrol compilation and installation of the executable.  However, as a\nspecial exception, the source code distributed need not include\nanything that is normally distributed (in either source or binary\nform) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component\nitself accompanies the executable.\n\nIf distribution of executable or object code is made by offering\naccess to copy from a designated place, then offering equivalent\naccess to copy the source code from the same place counts as\ndistribution of the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  4. You may not copy, modify, sublicense, or distribute the Program\nexcept as expressly provided under this License.  Any attempt\notherwise to copy, modify, sublicense or distribute the Program is\nvoid, and will automatically terminate your rights under this License.\nHowever, parties who have received copies, or rights, from you under\nthis License will not have their licenses terminated so long as such\nparties remain in full compliance.\n\n  5. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Program or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Program (or any work based on the\nProgram), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n  6. Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the\noriginal licensor to copy, distribute or modify the Program subject to\nthese terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties to\nthis License.\n\n  7. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Program at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Program by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under\nany particular circumstance, the balance of the section is intended to\napply and the section as a whole is intended to apply in other\ncircumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system, which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  8. If the distribution and/or use of the Program is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Program under this License\nmay add an explicit geographical distribution limitation excluding\nthose countries, so that distribution is permitted only in or among\ncountries not thus excluded.  In such case, this License incorporates\nthe limitation as if written in the body of this License.\n\n  9. The Free Software Foundation may publish revised and/or new versions\nof the General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Program\nspecifies a version number of this License which applies to it and \"any\nlater version\", you have the option of following the terms and conditions\neither of that version or of any later version published by the Free\nSoftware Foundation.  If the Program does not specify a version number of\nthis License, you may choose any version ever published by the Free Software\nFoundation.\n\n  10. If you wish to incorporate parts of the Program into other free\nprograms whose distribution conditions are different, write to the author\nto ask for permission.  For software which is copyrighted by the Free\nSoftware Foundation, write to the Free Software Foundation; we sometimes\nmake exceptions for this.  Our decision will be guided by the two goals\nof preserving the free status of all derivatives of our free software and\nof promoting the sharing and reuse of software generally.\n\n                            NO WARRANTY\n\n  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\nFOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN\nOTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\nPROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS\nTO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE\nPROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\nREPAIR OR CORRECTION.\n\n  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\nREDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\nOUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\nTO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\nYOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\nPROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGES.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software; you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation; either version 2 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License along\n    with this program; if not, write to the Free Software Foundation, Inc.,\n    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\nAlso add information on how to contact you by electronic and paper mail.\n\nIf the program is interactive, make it output a short notice like this\nwhen it starts in an interactive mode:\n\n    Gnomovision version 69, Copyright (C) year name of author\n    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, the commands you use may\nbe called something other than `show w' and `show c'; they could even be\nmouse-clicks or menu items--whatever suits your program.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n  `Gnomovision' (which makes passes at compilers) written by James Hacker.\n\n  <signature of Ty Coon>, 1 April 1989\n  Ty Coon, President of Vice\n\nThis General Public License does not permit incorporating your program into\nproprietary programs.  If your program is a subroutine library, you may\nconsider it more useful to permit linking proprietary applications with the\nlibrary.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.\n"
  },
  {
    "path": "MANIFEST.in",
    "content": "include setup.py\ninclude COPYING COPYING.generator MANIFEST.in README.rst TODO\ninclude distribute_setup.py Makefile \nrecursive-include tests *\nrecursive-include examples *\n"
  },
  {
    "path": "Makefile",
    "content": "GENERATE:=python3 generator/generate.py\nDEV_INCLUDE_DIR=../../include/vlc\n\nUNAME_S := $(shell uname -s)\nifeq ($(UNAME_S),FreeBSD)\n    INSTALLED_INCLUDE_DIR=/usr/local/include/vlc\nelse\n    INSTALLED_INCLUDE_DIR=/usr/include/vlc\nendif\n\nPROJECT_ROOT=$(shell pwd)\n\nDEV_PATH=generated/dev\nVERSIONED_PATH=generated/3.0\n\nMODULE_NAME=$(DEV_PATH)/vlc.py\nVERSIONED_NAME=$(VERSIONED_PATH)/vlc.py\n\nDEV_INCLUDES=$(wildcard $(DEV_INCLUDE_DIR)/*.h)\nINSTALLED_INCLUDES=$(wildcard $(INSTALLED_INCLUDE_DIR)/*.h)\n\nifneq ($(DEV_INCLUDES),)\nTARGETS+=dev\nendif\nifneq ($(INSTALLED_INCLUDES),)\nTARGETS+=installed dist\nendif\nifeq ($(TARGETS),)\nTARGETS=missing\nendif\n\n.PHONY: missing dev installed dist deb doc test_bindings2 test_bindings test_generator test2 test tests sdist publish format rcheck check clean\n\nall: $(TARGETS)\n\nmissing:\n\t@echo \"Cannot find include files either from a source tree in $(DEV_INCLUDE_DIR) or from installed includes in $(INSTALLED_INCLUDE_DIR).\"\n\texit 0\n\n.ONESHELL:\ndev: $(MODULE_NAME)\n\t@if [ ! -d $(DEV_INCLUDE_DIR) ]; then echo \"The bindings directory must be placed in a VLC source tree as vlc/bindings/python to generate the dev version of the bindings. If you want to generate against installed include files, use the 'installed' target.\" ; exit 1 ; fi\n\ninstalled: $(VERSIONED_NAME)\n\t@if [ ! -d $(INSTALLED_INCLUDE_DIR) ]; then echo \"Cannot find the necessary VLC include files in $(INSTALLED_INCLUDE_DIR). Make sure a full VLC install is present on the system.\" ; exit 1 ; fi\n\ndist: $(VERSIONED_NAME)\n\t$(GENERATE) -p $<\n\n$(MODULE_NAME): generator/generate.py generator/templates/header.py generator/templates/footer.py generator/templates/override.py $(DEV_INCLUDES)\n\tmkdir -p $(DEV_PATH)\n\t$(GENERATE) $(DEV_INCLUDES) -o $@\n\n$(VERSIONED_NAME): generator/generate.py generator/templates/header.py generator/templates/footer.py generator/templates/override.py generator/templates/pyproject.toml $(INSTALLED_INCLUDES)\n\tmkdir -p $(VERSIONED_PATH)\n\t$(GENERATE) $(INSTALLED_INCLUDES) -o $@\n\ndoc: $(VERSIONED_NAME)\n\tsphinx-build docs doc\n\ntest_bindings: installed\n\tPYTHONPATH=$(VERSIONED_PATH):$(PROJECT_ROOT) python3 tests/test_bindings.py\n\tPYTHONPATH=$(DEV_PATH):$(PROJECT_ROOT) python3 tests/test_bindings.py\n\ntest_generator: installed\n\tPYTHONPATH=$(VERSIONED_PATH):$(PROJECT_ROOT) python3 tests/test_generator.py\n\tPYTHONPATH=$(DEV_PATH):$(PROJECT_ROOT) python3 tests/test_generator.py\n\ntest: test_bindings test_generator\n\nsdist: $(VERSIONED_NAME)\n\tcd $(VERSIONED_PATH); python3 -m build\n\npublish: $(VERSIONED_NAME)\n\tcd $(VERSIONED_PATH); python3 -m build && twine upload dist/*\n\nformat:\n\truff format ./generator/generate.py ./tests dev_setup.py ./generator/templates/\n\truff check --fix --fix-only --exit-zero ./generator/generate.py ./tests dev_setup.py ./generator/templates\n\ncheck:\n\truff check ./generator/generate.py ./tests dev_setup.py\n\nclean:\n\t-$(RM) -r $(DEV_PATH)\n\t-$(RM) -r $(VERSIONED_PATH)\n"
  },
  {
    "path": "README.md",
    "content": "# Python ctypes-based bindings generator for libvlc\n\n![](https://img.shields.io/github/actions/workflow/status/oaubert/python-vlc/tests.yml?event=push&label=tests)\n[![](https://readthedocs.org/projects/python-vlc/badge/)](https://python-vlc.readthedocs.org/)\n[![Join the chat at https://discord.gg/3h3K3JF](https://img.shields.io/discord/716939396464508958?label=discord)](https://discord.gg/3h3K3JF)\n\nThis file documents the bindings generator, not the bindings\nthemselves. For the bindings documentation, see the\n[README.module](README.module) file.\n\nThe bindings generator generates ctypes-bindings from the include\nfiles defining the public API. The same generated module should be\ncompatible with various versions of libvlc 2.\\* and 3.\\*. However, there\nmay be incompatible changes between major versions. Versioned bindings\nfor 2.2 and 3.0 are provided in the repository.\n\n## License\n\nThe module generator is licensed under the GNU General Public License\nversion 2 or later. The generated module is licensed, like libvlc,\nunder the GNU Lesser General Public License 2.1 or later.\n\n## Development\n\nYou can get the latest version of the code generator from\n<https://github.com/oaubert/python-vlc/> or\n<https://git.videolan.org/?p=vlc/bindings/python.git>.\n\nThe code expects to be placed inside a VLC source tree, in\nvlc/bindings/python, so that it finds the development include files,\nor to find the installed include files in /usr/include (on Debian,\ninstall libvlc-dev).\n\nOnce you have cloned the project, you can run\n\n```\npython3 dev_setup.sh\n```\n\nfrom the root directory (or the python version if on a platform without shell)\n\nThis script will install everything that is needed (submodules,\nvirtual environment, treesitter, packages, etc.) for you to generate\nthe bindings.  Then, activate the virtual environment:\n\n- On Linux with Bash:\n  ```\n  . .venv/bin/activate\n  ```\n- On Windows with Powershell:\n  ```\n  .\\.venv\\Scripts\\Activate.ps1\n  ```\n\nSee https://docs.python.org/3/library/venv.html#how-venvs-work for other os-shell combinations.\n\nTo generate the vlc.py module and its documentation, for both the\ndevelopment version and the installed VLC version, use `make`.\n\nThe Makefile tries to convert files from either `../../include/vlc`\n(i.e. if the code is placed as a `bindings/pyton` in the VLC source\ntree) or `/usr/include/vlc`.\n\nFor running tests, use `make test`.\nNote that you need vlc installed because some tests require the\nlibvlc's dynamic library to be present on the system.\n\nIf you want to generate the bindings from an installed version of the\nVLC includes (which are expected to be in /usr/include/vlc), use the\n'installed' target: `make installed`.\n\nSee more recipes in the Makefile.\n\nTo install python-vlc for development purposes (add a symlink to your Python\nlibrary) simply do\n\n```\npython setup.py develop\n```\n\npreferably inside a virtualenv. You can uninstall it later with\n\n```\npython setup.py develop --uninstall\n```\n\nDocumentation building needs sphinx. An online build is available at\n<https://python-vlc.readthedocs.io/en/latest/>\n\n## Packaging\n\nThe generated module version number is built from the VLC version\nnumber and the generator version number:\n\nvlc_major.vlc_minor.(1000 * vlc_micro + 100 * generator_major + generator_minor)\n\nso that it shared it major.minor with the corresponding VLC.\n\nTo generate the reference PyPI module (including setup.py, examples\nand metadata files), use\n\n```\nmake dist\n```\n\n## Architecture\n\nFirst of all, the bindings generator is in generator/generate.py.\n\nIt really is the conjunction of two things:\n\n1. A **parser** of C header files (those of libvlc): that is the class `Parser`.\n1. A **generator** of Python bindings: that is the class `PythonGenerator`.\n\n`Parser` parses libvlc's headers and produces a kind of AST where nodes are\ninstances of either `Struct`, `Union`, `Func`, `Par`, `Enum` or `Val`.\nThe information kept is what is necessary for `PythonGenerator` to then produce\nthe bindings.\n\nUntil version 2 of the bindings generator, parsing was regex-based.\nIt worked pretty well thanks to the consistent coding style of libvlc.\nHowever, it remained rather fragile.\n\nSince version 2, parsing is done using [Tree-sitter](https://tree-sitter.github.io/tree-sitter/).\nMore specifically, we use the [C Tree-sitter grammar](https://github.com/tree-sitter/tree-sitter-c)\nand [Tree-sitter's Python bindings](https://github.com/tree-sitter/py-tree-sitter).\nIt offers a more complete and robust parsing of C code.\nThe job of `Parser` is thus to transform the AST[^1] produced by Tree-sitter into an \"AST\"\nunderstandable by the generator.\n\n## LibVLC Discord\n\n[![Join the chat at https://discord.gg/3h3K3JF](https://img.shields.io/discord/716939396464508958?label=discord)](https://discord.gg/3h3K3JF)\n\npython-vlc is part of the LibVLC Discord Community server. Feel free to come say hi!\n\n## How to contribute\n\nContributions such as:\n\n- reporting and fixing bugs,\n- contributing unit tests\n- contributing examples\n\nare welcome!\n\n[^1]: To be exact, it produces a CST: Concrete Syntax Tree.\n"
  },
  {
    "path": "README.module",
    "content": "Python ctypes-based bindings for libvlc\n=======================================\n\nThe bindings use ctypes to directly call the libvlc dynamic lib, and\nthe code is generated from the include files defining the public\nAPI. The same module should be compatible with various versions of\nlibvlc 3.*. However, there may be incompatible changes between major\nversions.\n\nInstalling the module\n---------------------\n\nYou can install the module through PyPI:\n\n    pip install python-vlc\n\nUsing the module\n----------------\n\nThe module offers two ways of accessing the API - a raw access to all\nexported methods, and more convenient wrapper classes.  The [API\ndocumentation](https://python-vlc.readthedocs.io/en/latest/) is\non Readthedocs.\n\nUsing wrapper classes\n+++++++++++++++++++++\n\nMost major structures of the libvlc API (Instance, Media, MediaPlayer,\netc) are wrapped as classes, with shorter method names and some\nadaptations to provide a more pythonic API:\n\n    >>> import vlc\n    >>> player = vlc.MediaPlayer('file:///tmp/foo.avi')\n    >>> player.play()\n    >>> player.get_instance() # returns the corresponding instance\n\nIn this case, a default ``vlc.Instance`` will be instanciated and\nstored in ``vlc._default_instance``. It will be used to instanciate\nthe various classes (``Media``, ``MediaList``, ``MediaPlayer``, etc).\n\nYou also can use wrapper methods closer to the original libvlc API:\n\n    >>> import vlc\n    >>> instance = vlc.Instance('--no-audio', '--fullscreen')\n    >>> player = instance.media_player_new()\n    >>> player.audio_get_volume()\n    50\n    >>> media = instance.media_new('file:///tmp/foo.avi')\n    >>> media.get_mrl()\n    'file:///tmp/foo.avi'\n    >>> player.set_media(m)\n    >>> player.play()\n\nUsing raw access\n++++++++++++++++\n\nLibvlc methods are available as attributes of the vlc module (as\n  vlc.libvlc_*). Use their docstring (any introspective shell like\n  ipython is your friend) to explore them, or refer to the online\n  documentation at https://olivieraubert.net/vlc/python-ctypes/\n\n    >>> import vlc\n    >>> vlc.libvlc_get_version()\n    '3.0.0-rc2 Vetinari'\n    >>> exc = vlc.VLCException()\n    >>> instance = vlc.libvlc_new(0, [], exc)\n    >>> instance\n    <vlc.Instance object at 0x8384a4c>\n    >>> vlc.libvlc_audio_get_volume(instance, exc)\n    50\n\nExample code\n++++++++++++\n\nYou can find [example\nfiles](https://github.com/oaubert/python-vlc/tree/master/examples) in\nthe repository.\n\nNote that the ``vlc.py`` module can itself be invoked as an\napplication using its own features, which also serves as a API usage\nexample. See the [end of the\nmodule](https://github.com/oaubert/python-vlc/blob/master/generated/3.0/vlc.py#L12525)\nafter the line ``if __name__ == \"__main__\":``\n\nLicense\n-------\n\nThe generated module is licensed, like libvlc, under the GNU Lesser\nGeneral Public License 2.1 or later.\n"
  },
  {
    "path": "TODO",
    "content": "* Add more test coverage\n* Provide more examples\n"
  },
  {
    "path": "dev_setup.py",
    "content": "#!/usr/bin/env python3\n\n\"\"\"Script to get going after having cloned the repository.\"\"\"\n\nimport os\nimport sys\nfrom pathlib import Path\nfrom subprocess import PIPE, STDOUT, CalledProcessError, run\n\nPROJECT_ROOT = Path(__file__).parent\ncwd = Path.cwd()\nassert (\n    cwd.resolve() == PROJECT_ROOT.resolve()\n), f\"You should run that script from {PROJECT_ROOT}, but current working directory is {cwd}.\"\n\n# See https://stackoverflow.com/questions/1854/how-to-identify-which-os-python-is-running-on\non_windows = os.name == \"nt\"\n\n\ndef run_cmd(mess, cmd):\n    print(f\"{mess}...\", end=\" \", flush=True)\n    try:\n        _proc = run(cmd, stdout=PIPE, stderr=STDOUT, check=True)\n    except CalledProcessError as e:\n        print()\n        cmd = \" \".join(e.cmd)\n        print(f\"Oops! Command '{cmd}' failed.\")\n        print(f\"Got return code {e.returncode}.\")\n        print(\"Here is the command output:\")\n        print(e.output.decode(), end=\"\", flush=True)\n        sys.exit(e.returncode)\n    print(\"Done.\", flush=True)\n\n\npython = \"python3\"\nvenv_bin = \".venv/Scripts\" if on_windows else \".venv/bin\"\nvenv_python = f\"{venv_bin}/python3\"\npre_commit = f\"{venv_bin}/pre-commit\"\n\n# Clone Tree-sitter grammar which is a Git submodule of the project\n# See https://git-scm.com/book/en/v2/Git-Tools-Submodules\nrun_cmd(\n    \"Clone vendored C Tree-sitter grammar\",\n    [\"git\", \"submodule\", \"update\", \"--init\", \"--recursive\"],\n)\n\n# Create a virtual environment if it doesn't exist\nif not (PROJECT_ROOT / \".venv\").is_dir():\n    run_cmd(\"Create a virtual environment in .venv\", [python, \"-m\", \"venv\", \".venv\"])\n\n# Upgrade venv's pip\nrun_cmd(\"Upgrade pip\", [venv_python, \"-m\", \"pip\", \"install\", \"--upgrade\", \"pip\"])\n\n# Install dev dependencies\nrun_cmd(\n    \"Install dependencies\",\n    [venv_python, \"-m\", \"pip\", \"install\", \"-r\", \"requirements.txt\"],\n)\n\n# Propose to install pre-commit hooks\nprint(\"If you want to enable pre-commit hooks (ruff checks), run the command\\npre-commit install\")\n\nprint(\"Setup successfull!\")\n"
  },
  {
    "path": "dev_setup.sh",
    "content": "#!/bin/bash\n\n# Setup development environment\nPROJECT_ROOT=$(dirname \"$(readlink -f $0)\")\ncd \"${PROJECT_ROOT}\" || exit\n\nVENV_DIR=\"${PROJECT_ROOT}/.venv\"\n\n# Clone Tree-sitter grammar which is a Git submodule of the project\n# See https://git-scm.com/book/en/v2/Git-Tools-Submodules\necho \"Updating C Tree-sitter grammar\"\ngit submodule update --init --recursive\n\nif [ ! -d \"${PROJECT_ROOT}/.venv\" ]\nthen\n    # Create a virtual environment if it doesn't exist\n    echo \"Creating a virtual environment in .venv\"\n    python3 -m venv \"${VENV_DIR}\"\nfi\n\necho \"Activating .venv\"\n# shellcheck source=/dev/null\n. \"${VENV_DIR}/bin/activate\"\n\necho \"Upgrading .venv's pip\"\npython3 -m pip install --upgrade pip\n\necho \"Installing dependencies\"\npython3 -m pip install -r requirements.txt\n\necho \"If you want to enable pre-commit hooks (ruff checks), run the command pre-commit install\"\n\necho \"Setup done\"\n"
  },
  {
    "path": "distribute_setup.py",
    "content": "#!python\n\"\"\"Bootstrap distribute installation\n\nIf you want to use setuptools in your package's setup.py, just include this\nfile in the same directory with it, and add this to the top of your setup.py::\n\n    from distribute_setup import use_setuptools\n    use_setuptools()\n\nIf you want to require a specific version of setuptools, set a download\nmirror, or use an alternate download directory, you can do so by supplying\nthe appropriate options to ``use_setuptools()``.\n\nThis file can also be run as a script to install or upgrade setuptools.\n\"\"\"\nimport os\nimport shutil\nimport sys\nimport time\nimport fnmatch\nimport tempfile\nimport tarfile\nimport optparse\n\nfrom distutils import log\n\ntry:\n    from site import USER_SITE\nexcept ImportError:\n    USER_SITE = None\n\ntry:\n    import subprocess\n\n    def _python_cmd(*args):\n        args = (sys.executable,) + args\n        return subprocess.call(args) == 0\n\nexcept ImportError:\n    # will be used for python 2.3\n    def _python_cmd(*args):\n        args = (sys.executable,) + args\n        # quoting arguments if windows\n        if sys.platform == 'win32':\n            def quote(arg):\n                if ' ' in arg:\n                    return '\"%s\"' % arg\n                return arg\n            args = [quote(arg) for arg in args]\n        return os.spawnl(os.P_WAIT, sys.executable, *args) == 0\n\nDEFAULT_VERSION = \"0.6.49\"\nDEFAULT_URL = \"http://pypi.python.org/packages/source/d/distribute/\"\nSETUPTOOLS_FAKED_VERSION = \"0.6c11\"\n\nSETUPTOOLS_PKG_INFO = \"\"\"\\\nMetadata-Version: 1.0\nName: setuptools\nVersion: %s\nSummary: xxxx\nHome-page: xxx\nAuthor: xxx\nAuthor-email: xxx\nLicense: xxx\nDescription: xxx\n\"\"\" % SETUPTOOLS_FAKED_VERSION\n\n\ndef _install(tarball, install_args=()):\n    # extracting the tarball\n    tmpdir = tempfile.mkdtemp()\n    log.warn('Extracting in %s', tmpdir)\n    old_wd = os.getcwd()\n    try:\n        os.chdir(tmpdir)\n        tar = tarfile.open(tarball)\n        _extractall(tar)\n        tar.close()\n\n        # going in the directory\n        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])\n        os.chdir(subdir)\n        log.warn('Now working in %s', subdir)\n\n        # installing\n        log.warn('Installing Distribute')\n        if not _python_cmd('setup.py', 'install', *install_args):\n            log.warn('Something went wrong during the installation.')\n            log.warn('See the error message above.')\n            # exitcode will be 2\n            return 2\n    finally:\n        os.chdir(old_wd)\n        shutil.rmtree(tmpdir)\n\n\ndef _build_egg(egg, tarball, to_dir):\n    # extracting the tarball\n    tmpdir = tempfile.mkdtemp()\n    log.warn('Extracting in %s', tmpdir)\n    old_wd = os.getcwd()\n    try:\n        os.chdir(tmpdir)\n        tar = tarfile.open(tarball)\n        _extractall(tar)\n        tar.close()\n\n        # going in the directory\n        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])\n        os.chdir(subdir)\n        log.warn('Now working in %s', subdir)\n\n        # building an egg\n        log.warn('Building a Distribute egg in %s', to_dir)\n        _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)\n\n    finally:\n        os.chdir(old_wd)\n        shutil.rmtree(tmpdir)\n    # returning the result\n    log.warn(egg)\n    if not os.path.exists(egg):\n        raise IOError('Could not build the egg.')\n\n\ndef _do_download(version, download_base, to_dir, download_delay):\n    egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg'\n                       % (version, sys.version_info[0], sys.version_info[1]))\n    if not os.path.exists(egg):\n        tarball = download_setuptools(version, download_base,\n                                      to_dir, download_delay)\n        _build_egg(egg, tarball, to_dir)\n    sys.path.insert(0, egg)\n    import setuptools\n    setuptools.bootstrap_install_from = egg\n\n\ndef use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,\n                   to_dir=os.curdir, download_delay=15, no_fake=True):\n    # making sure we use the absolute path\n    to_dir = os.path.abspath(to_dir)\n    was_imported = 'pkg_resources' in sys.modules or \\\n        'setuptools' in sys.modules\n    try:\n        try:\n            import pkg_resources\n\n            # Setuptools 0.7b and later is a suitable (and preferable)\n            # substitute for any Distribute version.\n            try:\n                pkg_resources.require(\"setuptools>=0.7b\")\n                return\n            except (pkg_resources.DistributionNotFound,\n                    pkg_resources.VersionConflict):\n                pass\n\n            if not hasattr(pkg_resources, '_distribute'):\n                if not no_fake:\n                    _fake_setuptools()\n                raise ImportError\n        except ImportError:\n            return _do_download(version, download_base, to_dir, download_delay)\n        try:\n            pkg_resources.require(\"distribute>=\" + version)\n            return\n        except pkg_resources.VersionConflict:\n            e = sys.exc_info()[1]\n            if was_imported:\n                sys.stderr.write(\n                \"The required version of distribute (>=%s) is not available,\\n\"\n                \"and can't be installed while this script is running. Please\\n\"\n                \"install a more recent version first, using\\n\"\n                \"'easy_install -U distribute'.\"\n                \"\\n\\n(Currently using %r)\\n\" % (version, e.args[0]))\n                sys.exit(2)\n            else:\n                del pkg_resources, sys.modules['pkg_resources']    # reload ok\n                return _do_download(version, download_base, to_dir,\n                                    download_delay)\n        except pkg_resources.DistributionNotFound:\n            return _do_download(version, download_base, to_dir,\n                                download_delay)\n    finally:\n        if not no_fake:\n            _create_fake_setuptools_pkg_info(to_dir)\n\n\ndef download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,\n                        to_dir=os.curdir, delay=15):\n    \"\"\"Download distribute from a specified location and return its filename\n\n    `version` should be a valid distribute version number that is available\n    as an egg for download under the `download_base` URL (which should end\n    with a '/'). `to_dir` is the directory where the egg will be downloaded.\n    `delay` is the number of seconds to pause before an actual download\n    attempt.\n    \"\"\"\n    # making sure we use the absolute path\n    to_dir = os.path.abspath(to_dir)\n    try:\n        from urllib.request import urlopen\n    except ImportError:\n        from urllib2 import urlopen\n    tgz_name = \"distribute-%s.tar.gz\" % version\n    url = download_base + tgz_name\n    saveto = os.path.join(to_dir, tgz_name)\n    src = dst = None\n    if not os.path.exists(saveto):  # Avoid repeated downloads\n        try:\n            log.warn(\"Downloading %s\", url)\n            src = urlopen(url)\n            # Read/write all in one block, so we don't create a corrupt file\n            # if the download is interrupted.\n            data = src.read()\n            dst = open(saveto, \"wb\")\n            dst.write(data)\n        finally:\n            if src:\n                src.close()\n            if dst:\n                dst.close()\n    return os.path.realpath(saveto)\n\n\ndef _no_sandbox(function):\n    def __no_sandbox(*args, **kw):\n        try:\n            from setuptools.sandbox import DirectorySandbox\n            if not hasattr(DirectorySandbox, '_old'):\n                def violation(*args):\n                    pass\n                DirectorySandbox._old = DirectorySandbox._violation\n                DirectorySandbox._violation = violation\n                patched = True\n            else:\n                patched = False\n        except ImportError:\n            patched = False\n\n        try:\n            return function(*args, **kw)\n        finally:\n            if patched:\n                DirectorySandbox._violation = DirectorySandbox._old\n                del DirectorySandbox._old\n\n    return __no_sandbox\n\n\ndef _patch_file(path, content):\n    \"\"\"Will backup the file then patch it\"\"\"\n    f = open(path)\n    existing_content = f.read()\n    f.close()\n    if existing_content == content:\n        # already patched\n        log.warn('Already patched.')\n        return False\n    log.warn('Patching...')\n    _rename_path(path)\n    f = open(path, 'w')\n    try:\n        f.write(content)\n    finally:\n        f.close()\n    return True\n\n_patch_file = _no_sandbox(_patch_file)\n\n\ndef _same_content(path, content):\n    f = open(path)\n    existing_content = f.read()\n    f.close()\n    return existing_content == content\n\n\ndef _rename_path(path):\n    new_name = path + '.OLD.%s' % time.time()\n    log.warn('Renaming %s to %s', path, new_name)\n    os.rename(path, new_name)\n    return new_name\n\n\ndef _remove_flat_installation(placeholder):\n    if not os.path.isdir(placeholder):\n        log.warn('Unkown installation at %s', placeholder)\n        return False\n    found = False\n    for file in os.listdir(placeholder):\n        if fnmatch.fnmatch(file, 'setuptools*.egg-info'):\n            found = True\n            break\n    if not found:\n        log.warn('Could not locate setuptools*.egg-info')\n        return\n\n    log.warn('Moving elements out of the way...')\n    pkg_info = os.path.join(placeholder, file)\n    if os.path.isdir(pkg_info):\n        patched = _patch_egg_dir(pkg_info)\n    else:\n        patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO)\n\n    if not patched:\n        log.warn('%s already patched.', pkg_info)\n        return False\n    # now let's move the files out of the way\n    for element in ('setuptools', 'pkg_resources.py', 'site.py'):\n        element = os.path.join(placeholder, element)\n        if os.path.exists(element):\n            _rename_path(element)\n        else:\n            log.warn('Could not find the %s element of the '\n                     'Setuptools distribution', element)\n    return True\n\n_remove_flat_installation = _no_sandbox(_remove_flat_installation)\n\n\ndef _after_install(dist):\n    log.warn('After install bootstrap.')\n    placeholder = dist.get_command_obj('install').install_purelib\n    _create_fake_setuptools_pkg_info(placeholder)\n\n\ndef _create_fake_setuptools_pkg_info(placeholder):\n    if not placeholder or not os.path.exists(placeholder):\n        log.warn('Could not find the install location')\n        return\n    pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1])\n    setuptools_file = 'setuptools-%s-py%s.egg-info' % \\\n            (SETUPTOOLS_FAKED_VERSION, pyver)\n    pkg_info = os.path.join(placeholder, setuptools_file)\n    if os.path.exists(pkg_info):\n        log.warn('%s already exists', pkg_info)\n        return\n\n    log.warn('Creating %s', pkg_info)\n    try:\n        f = open(pkg_info, 'w')\n    except EnvironmentError:\n        log.warn(\"Don't have permissions to write %s, skipping\", pkg_info)\n        return\n    try:\n        f.write(SETUPTOOLS_PKG_INFO)\n    finally:\n        f.close()\n\n    pth_file = os.path.join(placeholder, 'setuptools.pth')\n    log.warn('Creating %s', pth_file)\n    f = open(pth_file, 'w')\n    try:\n        f.write(os.path.join(os.curdir, setuptools_file))\n    finally:\n        f.close()\n\n_create_fake_setuptools_pkg_info = _no_sandbox(\n    _create_fake_setuptools_pkg_info\n)\n\n\ndef _patch_egg_dir(path):\n    # let's check if it's already patched\n    pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')\n    if os.path.exists(pkg_info):\n        if _same_content(pkg_info, SETUPTOOLS_PKG_INFO):\n            log.warn('%s already patched.', pkg_info)\n            return False\n    _rename_path(path)\n    os.mkdir(path)\n    os.mkdir(os.path.join(path, 'EGG-INFO'))\n    pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')\n    f = open(pkg_info, 'w')\n    try:\n        f.write(SETUPTOOLS_PKG_INFO)\n    finally:\n        f.close()\n    return True\n\n_patch_egg_dir = _no_sandbox(_patch_egg_dir)\n\n\ndef _before_install():\n    log.warn('Before install bootstrap.')\n    _fake_setuptools()\n\n\ndef _under_prefix(location):\n    if 'install' not in sys.argv:\n        return True\n    args = sys.argv[sys.argv.index('install') + 1:]\n    for index, arg in enumerate(args):\n        for option in ('--root', '--prefix'):\n            if arg.startswith('%s=' % option):\n                top_dir = arg.split('root=')[-1]\n                return location.startswith(top_dir)\n            elif arg == option:\n                if len(args) > index:\n                    top_dir = args[index + 1]\n                    return location.startswith(top_dir)\n        if arg == '--user' and USER_SITE is not None:\n            return location.startswith(USER_SITE)\n    return True\n\n\ndef _fake_setuptools():\n    log.warn('Scanning installed packages')\n    try:\n        import pkg_resources\n    except ImportError:\n        # we're cool\n        log.warn('Setuptools or Distribute does not seem to be installed.')\n        return\n    ws = pkg_resources.working_set\n    try:\n        setuptools_dist = ws.find(\n            pkg_resources.Requirement.parse('setuptools', replacement=False)\n            )\n    except TypeError:\n        # old distribute API\n        setuptools_dist = ws.find(\n            pkg_resources.Requirement.parse('setuptools')\n        )\n\n    if setuptools_dist is None:\n        log.warn('No setuptools distribution found')\n        return\n    # detecting if it was already faked\n    setuptools_location = setuptools_dist.location\n    log.warn('Setuptools installation detected at %s', setuptools_location)\n\n    # if --root or --preix was provided, and if\n    # setuptools is not located in them, we don't patch it\n    if not _under_prefix(setuptools_location):\n        log.warn('Not patching, --root or --prefix is installing Distribute'\n                 ' in another location')\n        return\n\n    # let's see if its an egg\n    if not setuptools_location.endswith('.egg'):\n        log.warn('Non-egg installation')\n        res = _remove_flat_installation(setuptools_location)\n        if not res:\n            return\n    else:\n        log.warn('Egg installation')\n        pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO')\n        if (os.path.exists(pkg_info) and\n            _same_content(pkg_info, SETUPTOOLS_PKG_INFO)):\n            log.warn('Already patched.')\n            return\n        log.warn('Patching...')\n        # let's create a fake egg replacing setuptools one\n        res = _patch_egg_dir(setuptools_location)\n        if not res:\n            return\n    log.warn('Patching complete.')\n    _relaunch()\n\n\ndef _relaunch():\n    log.warn('Relaunching...')\n    # we have to relaunch the process\n    # pip marker to avoid a relaunch bug\n    _cmd1 = ['-c', 'install', '--single-version-externally-managed']\n    _cmd2 = ['-c', 'install', '--record']\n    if sys.argv[:3] == _cmd1 or sys.argv[:3] == _cmd2:\n        sys.argv[0] = 'setup.py'\n    args = [sys.executable] + sys.argv\n    sys.exit(subprocess.call(args))\n\n\ndef _extractall(self, path=\".\", members=None):\n    \"\"\"Extract all members from the archive to the current working\n       directory and set owner, modification time and permissions on\n       directories afterwards. `path' specifies a different directory\n       to extract to. `members' is optional and must be a subset of the\n       list returned by getmembers().\n    \"\"\"\n    import copy\n    import operator\n    from tarfile import ExtractError\n    directories = []\n\n    if members is None:\n        members = self\n\n    for tarinfo in members:\n        if tarinfo.isdir():\n            # Extract directories with a safe mode.\n            directories.append(tarinfo)\n            tarinfo = copy.copy(tarinfo)\n            tarinfo.mode = 448  # decimal for oct 0700\n        self.extract(tarinfo, path)\n\n    # Reverse sort directories.\n    directories.sort(key=operator.attrgetter('name'), reverse=True)\n\n    # Set correct owner, mtime and filemode on directories.\n    for tarinfo in directories:\n        dirpath = os.path.join(path, tarinfo.name)\n        try:\n            self.chown(tarinfo, dirpath)\n            self.utime(tarinfo, dirpath)\n            self.chmod(tarinfo, dirpath)\n        except ExtractError:\n            e = sys.exc_info()[1]\n            if self.errorlevel > 1:\n                raise\n            else:\n                self._dbg(1, \"tarfile: %s\" % e)\n\n\ndef _build_install_args(options):\n    \"\"\"\n    Build the arguments to 'python setup.py install' on the distribute package\n    \"\"\"\n    install_args = []\n    if options.user_install:\n        if sys.version_info < (2, 6):\n            log.warn(\"--user requires Python 2.6 or later\")\n            raise SystemExit(1)\n        install_args.append('--user')\n    return install_args\n\ndef _parse_args():\n    \"\"\"\n    Parse the command line for options\n    \"\"\"\n    parser = optparse.OptionParser()\n    parser.add_option(\n        '--user', dest='user_install', action='store_true', default=False,\n        help='install in user site package (requires Python 2.6 or later)')\n    parser.add_option(\n        '--download-base', dest='download_base', metavar=\"URL\",\n        default=DEFAULT_URL,\n        help='alternative URL from where to download the distribute package')\n    options, args = parser.parse_args()\n    # positional arguments are ignored\n    return options\n\ndef main(version=DEFAULT_VERSION):\n    \"\"\"Install or upgrade setuptools and EasyInstall\"\"\"\n    options = _parse_args()\n    tarball = download_setuptools(download_base=options.download_base)\n    return _install(tarball, _build_install_args(options))\n\nif __name__ == '__main__':\n    sys.exit(main())\n"
  },
  {
    "path": "docs/Makefile",
    "content": "# Minimal makefile for Sphinx documentation\n#\n\n# You can set these variables from the command line, and also\n# from the environment for the first two.\nSPHINXOPTS    ?=\nSPHINXBUILD   ?= sphinx-build\nSOURCEDIR     = .\nBUILDDIR      = _build\n\n# Put it first so that \"make\" without argument is like \"make help\".\nhelp:\n\t@$(SPHINXBUILD) -M help \"$(SOURCEDIR)\" \"$(BUILDDIR)\" $(SPHINXOPTS) $(O)\n\n.PHONY: help Makefile\n\n# Catch-all target: route all unknown targets to Sphinx using the new\n# \"make mode\" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).\n%: Makefile\n\t@$(SPHINXBUILD) -M $@ \"$(SOURCEDIR)\" \"$(BUILDDIR)\" $(SPHINXOPTS) $(O)\n"
  },
  {
    "path": "docs/api.rst",
    "content": "API documentation\n=================\n\nEssential API classes\n---------------------\n\nThe main starting point for the python API of python-vlc are the\n:doc:`api/vlc/MediaPlayer` class and the :doc:`api/vlc/Instance` class.\n\nFull API\n--------\n\nConsult :doc:`fullapi` for the full API documentation.\n\n.. toctree::\n   :caption: API Documentation\n   :titlesonly:\n\n   api/vlc/Instance\n   api/vlc/MediaPlayer\n   fullapi\n"
  },
  {
    "path": "docs/conf.py",
    "content": "# Configuration file for the Sphinx documentation builder.\n#\n# For the full list of built-in configuration values, see the documentation:\n# https://www.sphinx-doc.org/en/master/usage/configuration.html\n\nimport os\nimport sys\n\n# Relative to conf.py location\nMODULE_DIR = '../generated/3.0/'\n\n# -- Project information -----------------------------------------------------\n# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information\n\nproject = \"python-vlc\"\ncopyright = \"2024, Olivier Aubert\"\nauthor = \"Olivier Aubert\"\n\nversion = \"Unknown\"\nwith open(f\"{MODULE_DIR}/vlc.py\", \"r\") as f:\n    for l in f.readlines():\n        if l.startswith('__version__'):\n            items = l.split('\"')\n            if len(items) == 3:\n                version = items[1]\n            break\nrelease = version\n\n# -- General configuration ---------------------------------------------------\n# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration\n\nsys.path.insert(0, os.path.abspath(MODULE_DIR))\n\nextensions = [\n    'sphinx_rtd_theme',\n    'autoapi.extension',\n    'sphinx_mdinclude',\n]\n\nexclude_patterns = [\"_build\", \"Thumbs.db\", \".DS_Store\"]\n\nautoapi_dirs = [ MODULE_DIR ]\n# We only want to include vlc.py, not example files\nautoapi_file_patterns = [ 'vlc.py' ]\nautoapi_root = 'api'\nautoapi_member_order = 'alphabetical'\nautoapi_own_page_level = 'class'\nautoapi_python_class_content = 'both'\nautoapi_options = [ 'members', 'undoc-members', 'private-members', 'show-inheritance', 'show-module-summary' ]\n\n# -- Options for HTML output -------------------------------------------------\n# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output\n\nhtml_theme = \"sphinx_rtd_theme\"\n\n"
  },
  {
    "path": "docs/fullapi.rst",
    "content": "Full API documentation\n======================\n\n.. toctree::\n   :glob:\n\n   api/vlc/*\n"
  },
  {
    "path": "docs/index.rst",
    "content": "Welcome to python-vlc's documentation!\n======================================\n\nYou are looking at the new python-vlc API documentation. Note that\nthere are still some shortcomings (for instance, Enum values are not\nprovided). If you feel like contributions sphinx/sphinx-autoapi\nchanges to improve this documentation, please do, and submit a pull\nrequest!\n\n.. mdinclude:: ../README.module\n\n.. toctree::\n   :maxdepth: 3\n   :caption: Documentation\n\n   Home <self>\n   api\n\n"
  },
  {
    "path": "docs/make.bat",
    "content": "@ECHO OFF\n\npushd %~dp0\n\nREM Command file for Sphinx documentation\n\nif \"%SPHINXBUILD%\" == \"\" (\n\tset SPHINXBUILD=sphinx-build\n)\nset SOURCEDIR=.\nset BUILDDIR=_build\n\n%SPHINXBUILD% >NUL 2>NUL\nif errorlevel 9009 (\n\techo.\n\techo.The 'sphinx-build' command was not found. Make sure you have Sphinx\n\techo.installed, then set the SPHINXBUILD environment variable to point\n\techo.to the full path of the 'sphinx-build' executable. Alternatively you\n\techo.may add the Sphinx directory to PATH.\n\techo.\n\techo.If you don't have Sphinx installed, grab it from\n\techo.https://www.sphinx-doc.org/\n\texit /b 1\n)\n\nif \"%1\" == \"\" goto help\n\n%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%\ngoto end\n\n:help\n%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%\n\n:end\npopd\n"
  },
  {
    "path": "docs/requirements.txt",
    "content": "Sphinx==7.3.7\nsphinx-autoapi\nsphinx_mdinclude\nsphinx_rtd_theme\n"
  },
  {
    "path": "examples/cocoavlc.py",
    "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Example of using PyCocoa <https://PyPI.org/project/PyCocoa> to create a\n# window, table and an application menu to run a video using VLC on macOS.\n# The Python-VLC binding <https://PyPI.Python.org/pypi/python-vlc> and the\n# corresponding VLC App, see <https://www.VideoLan.org/index.html>.\n\n# PyCocoa version 21.11.02 or later must be installed (on macOS Monterey)\n\n# This VLC player has been tested with VLC 3.0.10-16, 3.0.6-8, 3.0.4,\n# 3.0.1-2, 2.2.8 and 2.2.6 and the compatible vlc.py Python-VLC binding\n# using 64-bit Python 3.10.0, 3.9.6, 3.9.0-1, 3.8.10, 3.8.6, 3.7.0-4,\n# 3.6.4-5 and 2.7.14-18 on macOS 12.0.1 Monterey, 11.5.2-6.1 Big Sur\n# (aka 10.16), 10.15.6 Catalina, 10.14.6 Mojave and 10.13.4-6 High Sierra.\n# This player does not work with PyPy <https://PyPy.org> nor with Intel(R)\n# Python <https://Software.Intel.com/en-us/distribution-for-python>.\n\n# Python 3.10.0, 3.9.6 and macOS' Python 2.7.16 run on Apple Silicon\n# (C{arm64} I{natively}), all other Python versions run on Intel (C{x86_64})\n# or I{emulated} Intel (C{\"arm64_x86_64\"}, see function C{pycocoa.machine}).\n\n# MIT License <https://OpenSource.org/licenses/MIT>\n#\n# Copyright (C) 2017-2021 -- mrJean1 at Gmail -- All Rights Reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the \"Software\"),\n# to deal in the Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n# and/or sell copies of the Software, and to permit persons to whom the\n# Software is furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n# OTHER DEALINGS IN THE SOFTWARE.\n\ndef _PyPI(package):\n    return 'see <https://PyPI.org/project/%s>' % (package,)\n\n__all__  = ('AppVLC',)  # PYCHOK expected\n__version__ = '22.12.14'\n\ntry:\n    import vlc\nexcept ImportError:\n    raise ImportError('no %s, %s' % ('vlc.py', _PyPI('Python-VLC')))\ntry:\n    from pycocoa import __name__    as _pycocoa_, \\\n                        __version__ as _pycocoa_version\nexcept ImportError:\n    raise ImportError('no %s, %s' % (_pycocoa_, _PyPI('PyCocoa')))\nif _pycocoa_version < '21.11.04':  # __version__\n    raise ImportError('%s %s or later required, %s' % (\n                      _pycocoa_, '21.11.04', _PyPI('PyCocoa')))\ndel _PyPI\n\n# all imports listed explicitly to help PyChecker\nfrom pycocoa import App, app_title, aspect_ratio, bytes2str, closeTables, \\\n                    get_printer, Item, ItemSeparator, machine, MediaWindow, Menu, \\\n                    OpenPanel, printf, str2bytes, Table, z1000str, zSIstr\n\nfrom os.path import basename, getsize, isfile, splitext\nfrom platform import architecture, mac_ver\nimport sys\nfrom threading import Thread\nfrom time import sleep, strftime, strptime\ntry:\n    from urllib import unquote as mrl_unquote  # Python 2\nexcept ImportError:\n    from urllib.parse import unquote as mrl_unquote  # Python 3+\n\n_Adjust  = vlc.VideoAdjustOption  # Enum\n# <https://Wiki.VideoLan.org/Documentation:Modules/adjust>\n_Adjust3 = {_Adjust.Brightness: (0, 1, 2),\n            _Adjust.Contrast:   (0, 1, 2),\n            _Adjust.Gamma:   (0.01, 1, 10),\n            _Adjust.Hue:     (-180, 0, 180),\n            _Adjust.Saturation: (0, 1, 3)}\n_AppleSi = machine().startswith('arm64')\n_Argv0   = splitext(basename(__file__))[0]\n_Movies  = '.m4v', '.mov', '.mp4'  # lower-case file types for movies, videos\n_PNG     = '.png'  # snapshot always .png, even if .jpg or .tiff specified\n_Python  = sys.version.split()[0], architecture()[0]  # PYCHOK false\n_Select  = 'Select a video file from the panel'\n_VLC_3_  = vlc.__version__.split('.')[0] > '2' and \\\n           bytes2str(vlc.libvlc_get_version().split(b'.')[0]) > '2'\n\n\n# <https://Wiki.Videolan.org/Documentation:Modules/marq/#appendix_marq-color>\nclass _Color(object):  # PYCHOK expected\n    Aqua    = 0x00FFFF\n    Black   = 0x000000\n    Blue    = 0x0000FF\n    Fuchsia = 0xFF00FF\n    Gray    = 0x808080\n    Green   = 0x008000\n    Lime    = 0x00FF00\n    Maroon  = 0x800000\n    Navy    = 0x000080\n    Olive   = 0x808000\n    Purple  = 0x800080\n    Red     = 0xFF0000\n    Silver  = 0xC0C0C0\n    Teal    = 0x008080\n    White   = 0xFFFFFF\n    Yellow  = 0xFFFF00\n\n_Color = _Color()  # PYCHOK enum-like\n\n\ndef _fstrz(f, n=1, x=''):\n    # format float, strip trailing decimal zeros and point\n    return _fstrz0(f, n).rstrip('.') + x\n\n\ndef _fstrz0(f, n=1, x=''):\n    # format float, strip trailing decimal zeros\n    t = '%.*f' % (n, f)\n    return t.rstrip('0') + x\n\n\ndef _fstrz1(f, n=1, x=''):\n    # format float, strip trailing decimal zeros, except one\n    t = _fstrz0(f, n)\n    if t.endswith('.'):\n        t += '0'\n    return t + x\n\n\ndef _macOS(sep=None):\n    # get macOS version and extended platform.machine\n    t = 'macOS', mac_ver()[0], machine()\n    return sep.join(t) if sep else t\n\n\ndef _mspf(fps):\n    # convert frames per second to frame length in millisecs per frame\n    return 1000.0 / (fps or 25)\n\n\ndef _ms2str(ms):\n    # convert milliseconds to seconds string\n    return _fstrz1(max(ms, 0) * 0.001, 3, ' s')\n\n\ndef _ratio2str(by, *w_h):\n    # aspect ratio as string\n    return by.join(map(str, (w_h + ('-', '-'))[:2]))\n\n\nclass AppVLC(App):\n    '''The application with callback methods for C{app..._},\n       C{menu..._} and C{window..._} events.\n\n       Set things up inside the C{.__init__} and C{.appLauched_}\n       methods, start by calling the C{.run} method.\n    '''\n    adjustr   = ''\n    marquee   = None\n    media     = None\n    logostr   = ''\n    player    = None\n    raiser    = False\n    rate      = 0.0   # rate vs normal\n    scale     = 0.0   # video size / window size\n    sized     = None  # video (width, height)\n    Snapshot  = Item('Snapshot', key='s', alt=True)\n    snapshot  = _PNG  # default: .png, .jpg or .tiff\n    snapshots = 0\n    Toggle    = None\n    video     = None\n    window    = None\n    zoomX     = 1.0   # zoom factor, >= 1.0\n\n    def __init__(self, video=None,       # video file name\n                       adjustr='',       # vlc.VideoAdjustOption\n                       logostr='',       # vlc.VideoLogoOption\n                       marquee=False,    # vlc.VideoMarqueeOption\n                       raiser=False,     # re-raise errors\n                       snapshot=_PNG,    # png, other formats\n                       title='AppVLC'):  # window title\n        super(AppVLC, self).__init__(raiser=raiser, title=title)\n        self.adjustr = adjustr\n        self.logostr = logostr\n        self.marquee = marquee\n#       self.media   = None\n        self.raiser  = raiser\n        self.Toggle  = Item('Play', self.menuToggle_, key='p', ctrl=True)\n        self.video   = video\n\n        if snapshot != AppVLC.snapshot:\n            self.snapshot = '.' + snapshot.lstrip('.').lower()\n        if self.snapshot in (_PNG,):  # only .PNG works, using .JPG ...\n            # ... or .TIFF is OK, but the snapshot image is always .PNG\n            self.player = vlc.MediaPlayer()\n#       elif self.snapshot in (_JPG, _PNG, _TIFF):  # XXX doesn't work\n#           i = vlc.Instance('--snapshot-format', self.snapshot[1:])  # --verbose 2\n#           self.player = i.media_player_new()\n        else:\n            raise ValueError('invalid %s format: %r' % ('snapshot', snapshot))\n\n    def appLaunched_(self, app):\n        super(AppVLC, self).appLaunched_(app)\n        self.window = MediaWindow(title=self.video or self.title)\n\n        if self.player and self.video and isfile(self.video):\n            # the VLC player on macOS needs an ObjC NSView\n            self.media = self.player.set_mrl(self.video)\n            self.player.set_nsobject(self.window.NSview)\n\n            # if this window is on an external screen,\n            # move it to the built-in screen, aka 0\n            # if not self.window.screen.isBuiltIn:\n            #     self.window.screen = 0  # == BuiltIn\n\n            if self.adjustr:  # preset video options\n                for o in self.adjustr.lower().split(','):\n                    o, v = o.strip().split('=')\n                    o = getattr(_Adjust, o.capitalize(), None)\n                    if o is not None:\n                        self._VLCadjust(o, value=v)\n\n            if self.marquee:  # set up marquee\n                self._VLCmarquee()\n\n            if self.logostr:  # show logo\n                self._VLClogo(self.logostr)\n\n            menu = Menu('VLC')\n            menu.append(\n                # the action/method name for each item\n                # is string 'menu' + item.title + '_',\n                # without any spaces and trailing dots,\n                # see function pycocoa.title2action.\n                Item('Open...', key='o'),\n                ItemSeparator(),\n                self.Toggle,  # Play >< Pause\n                Item('Rewind', key='r', ctrl=True),\n                ItemSeparator(),\n                Item('Info',  key='i'),\n                Item('Close', key='w'),\n                ItemSeparator(),\n                Item('Zoom In',  key='+', shift=True),\n                Item('Zoom Out', key='-'),\n                ItemSeparator(),\n                Item('Faster', key='>', shift=True),\n                Item('Slower', key='<', shift=True))\n            if _VLC_3_:\n                menu.append(\n                    ItemSeparator(),\n                    Item('Brighter', key='b', shift=True),\n                    Item('Darker',   key='d', shift=True))\n            menu.append(\n                ItemSeparator(),\n                Item('Normal 1X', key='='),\n                ItemSeparator(),\n                Item('Audio Filters', self.menuFilters_, key='a', shift=True),\n                Item('Video Filters', self.menuFilters_, key='v', shift=True),\n                ItemSeparator(),\n                self.Snapshot)\n            self.append(menu)\n\n        self.menuPlay_(None)\n        self.window.front()\n\n    def menuBrighter_(self, item):\n        self._brightness(item, +0.1)\n\n    def menuClose_(self, item):  # PYCHOK expected\n        # close window(s) from menu Cmd+W\n        # printf('%s %r', 'close_', item)\n        if not closeTables():\n            self.terminate()\n\n    def menuDarker_(self, item):\n        self._brightness(item, -0.1)\n\n    def menuFaster_(self, item):\n        self._rate(item, 1.25)\n\n    def menuFilters_(self, item):\n        try:\n            self.menuPause_(item)\n            # display a table of audio/video filters\n            t = Table(' Name:150:bold', ' Short:150:Center:center', ' Long:300', 'Help')\n            i = self.player.get_instance()\n            b = item.title.split()[0]\n            for f in sorted(i.audio_filter_list_get() if b == 'Audio'\n                       else i.video_filter_list_get()):\n                while f and not f[-1]:  # \"rstrip\" None\n                    f = f[:-1]\n                t.append(*map(bytes2str, f))\n\n            t.display('VLC %s Filters' % (b,), width=800)\n\n        except Exception as x:\n            if self.raiser:\n                raise\n            printf('%s', x, nl=1, nt=1)\n\n    def menuInfo_(self, item):\n        try:\n            self.menuPause_(item)\n            # display Python, vlc, libVLC, media info table\n            p = self.player\n            m = p.get_media()\n\n            t = Table(' Name:bold', ' Value:200:Center:center', ' Alt:100')\n            t.append(_Argv0, __version__, '20' + __version__)\n            t.append('PyCocoa', _pycocoa_version, '20' + _pycocoa_version)\n            t.append('Python', *_Python)\n            t.append(*_macOS())\n            x = 'built-in' if self.window.screen.isBuiltIn else 'external'\n            t.append('screen', x, str(self.window.screen.displayID))\n            t.separator()\n\n            t.append('vlc.py', vlc.__version__, hex(vlc.hex_version()))\n            b = ' '.join(vlc.build_date.split()[:5])\n            t.append('built', strftime('%x', strptime(b, '%c')), vlc.build_date)\n            t.separator()\n            t.append('libVLC', bytes2str(vlc.libvlc_get_version()), hex(vlc.libvlc_hex_version()))\n            t.append('libVLC', *bytes2str(vlc.libvlc_get_compiler()).split(None, 1))\n            t.separator()\n\n            f = mrl_unquote(bytes2str(m.get_mrl()))\n            t.append('media', basename(f), f)\n            if f.lower().startswith('file://'):\n                z = getsize(f[7:])\n                t.append('size', z1000str(z), zSIstr(z))\n            t.append('state', str(p.get_state()))\n            f = max(p.get_position(), 0)\n            t.append('position/length', _fstrz(f * 100, 2), _ms2str(p.get_length()))\n            f = map(_ms2str, (p.get_time(), m.get_duration()))\n            t.append('time/duration', *f)\n            t.append('track/count', z1000str(p.video_get_track()), z1000str(p.video_get_track_count()))\n            t.separator()\n\n            f = p.get_fps()\n            t.append('fps/mspf', _fstrz(f, 5), _fstrz(_mspf(f), 3, ' ms'))\n            r = p.get_rate()\n            t.append('rate', r, '%s%%' % (int(r * 100),))\n            a, b = p.video_get_size(0)  # num=0\n            w, h = map(int, self.window.frame.size.size)\n            t.append('video size', _ratio2str('x', a, b), _ratio2str('x', w, h))\n            r = _ratio2str(':', *aspect_ratio(a, b))  # p.video_get_aspect_ratio()\n            t.append('aspect ratio', r, _ratio2str(':', *self.window.ratio))\n            t.append('scale', _fstrz1(p.video_get_scale(), 3), _fstrz(self.zoomX, 2, 'X'))\n            t.separator()\n\n            def VLCadjustr3(f, option):  # get option value\n                lo, _, hi = _Adjust3[option]\n                v = f(option)\n                p = max(0, (v - lo)) * 100.0 / (hi - lo)\n                n = str(option).split('.')[-1]  # 'VideoAdjustOption.Xyz'\n                return n.lower(), _fstrz1(v, 2), _fstrz(p, 1, '%')\n\n            f = self.player.video_get_adjust_float\n            t.append(*VLCadjustr3(f, _Adjust.Brightness))\n            t.append(*VLCadjustr3(f, _Adjust.Contrast))\n            t.append(*VLCadjustr3(f, _Adjust.Gamma))\n            t.append(*VLCadjustr3(f, _Adjust.Hue))\n            t.append(*VLCadjustr3(f, _Adjust.Saturation))\n            t.separator()\n\n            s = vlc.MediaStats()  # re-use single MediaStats instance?\n            if m.get_stats(s):\n\n                def Kops2bpstr2(bitrate):  # convert Ko/s to bits/sec\n                    # bitrates are conventionally in kilo-octets-per-sec\n                    return zSIstr(bitrate * 8000, B='bps', K=1000).split()\n\n                t.append('media read',     *zSIstr(s.read_bytes).split())\n                t.append('input bitrate',  *Kops2bpstr2(s.input_bitrate))\n                if s.input_bitrate > 0:  # XXX approximate caching, based\n                    # on <https://GitHub.com/oaubert/python-vlc/issues/61>\n                    b = s.read_bytes - s.demux_read_bytes\n                    t.append('input caching', _ms2str(b / s.input_bitrate), zSIstr(b))\n                t.append('demux read',     *zSIstr(s.demux_read_bytes).split())\n                t.append('stream bitrate', *Kops2bpstr2(s.demux_bitrate))\n\n                t.append('video decoded', z1000str(s.decoded_video),      'blocks')\n                t.append('video played',  z1000str(s.displayed_pictures), 'frames')\n                t.append('video lost',    z1000str(s.lost_pictures),      'frames')\n\n                t.append('audio decoded', z1000str(s.decoded_audio),   'blocks')\n                t.append('audio played',  z1000str(s.played_abuffers), 'buffers')\n                t.append('audio lost',    z1000str(s.lost_abuffers),   'buffers')\n\n            t.display('Python, VLC & Media Information', width=500)\n\n        except Exception as x:\n            if self.raiser:\n                raise\n            printf('%s', x, nl=1, nt=1)\n\n    def menuNormal1X_(self, item):\n        # set rate and zoom to 1X\n        self._brightness(item)\n#       self._contrast(item)\n#       self._gamma(item)\n#       self._hue(item)\n        self._rate(item)\n#       self._saturation(item)\n        self._zoom(item)\n\n    def menuOpen_(self, item):\n        # stop the current video and show\n        # the panel to select another video\n        self.menuPause_(item)\n        self.badge.label = 'O'\n        v = OpenPanel(_Select).pick(_Movies)\n        if v:\n            self.window.title = self.video = v\n            self.player.set_mrl(v)\n            self._reset()\n\n    def menuPause_(self, item, pause=False):  # PYCHOK expected\n        # note, .player.pause() pauses and un-pauses the video,\n        # .player.stop() stops the video and blanks the window\n        if pause or self.player.is_playing():\n            self.player.pause()\n            self.badge.label = 'S'  # stopped\n            self.Toggle.title = 'Play'  # item.title = 'Play'\n\n    def menuPlay_(self, item_or_None):  # PYCHOK expected\n        self.player.play()\n        self._resizer()\n        self.badge.label = 'P'  # Playing\n        self.Toggle.title = 'Pause'  # item.title = 'Pause'\n\n    def menuRewind_(self, item):  # PYCHOK expected\n        self.player.set_position(0.0)\n        self.player.set_time(0.0)\n        # note, can't re-play once at the end\n        # self.menuPlay_()\n        self.badge.label = 'R'\n        self._reset()\n\n    def menuSlower_(self, item):\n        self._rate(item, 0.80)\n\n    def menuSnapshot_(self, item):  # PYCHOK expected\n        w = self.lastWindow\n        if w:\n            self.snapshots += 1\n            s = '-'.join((_Argv0,\n                          'snapshot%d' % (self.snapshots,),\n                           w.__class__.__name__))\n            if isinstance(w, MediaWindow):\n                self.player.video_take_snapshot(0, s + self.snapshot, 0, 0)\n            elif get_printer:  # in PyCocoa 18.08.04+\n                get_printer().printView(w.PMview, toPDF=s + '.pdf')\n\n    def menuToggle_(self, item):\n        # toggle between Pause and Play\n        if self.player.is_playing():\n            self.menuPause_(item, pause=True)\n        else:\n            self.menuPlay_(item)\n\n    def menuZoomIn_(self, item):\n        self._zoom(item, 1.25)\n\n    def menuZoomOut_(self, item):\n        self._zoom(item, 0.80)\n\n    def windowClose_(self, window):\n        # quit or click of window close button\n        if window is self.window:\n            self.terminate()\n        self.Snapshot.isEnabled = False\n        super(AppVLC, self).windowClose_(window)\n\n    def windowLast_(self, window):\n        self.Snapshot.isEnabled = window.isPrintable or isinstance(window, MediaWindow)\n        super(AppVLC, self).windowLast_(window)\n\n    def windowResize_(self, window):\n        if window is self.window:\n            self._reset(True)\n        super(AppVLC, self).windowResize_(window)\n\n    def windowScreen_(self, window, change):\n        if window is self.window:\n            self._reset(True)\n        super(AppVLC, self).windowScreen_(window, change)\n\n    def _brightness(self, unused, fraction=0):  # change brightness\n        self._VLCadjust(_Adjust.Brightness, fraction)\n\n    def _contrast(self, unused, fraction=0):  # change contrast\n        self._VLCadjust(_Adjust.Contrast, fraction)\n\n    def _gamma(self, unused, fraction=0):  # change gamma\n        self._VLCadjust(_Adjust.Gamma, fraction)\n\n    def _hue(self, unused, fraction=0):  # change hue\n        self._VLCadjust(_Adjust.Hue, fraction)\n\n    def _rate(self, unused, factor=0):  # change the video rate\n        p = self.player\n        r = p.get_rate() * factor\n        r = max(0.2, min(10.0, r)) if r > 0 else 1.0\n        p.set_rate(r)\n        self.rate = r\n\n    def _reset(self, resize=False):\n        self.zoomX = 1\n        self.sized = None\n        if resize:\n            Thread(target=self._sizer).start()\n\n    def _resizer(self):  # adjust aspect ratio and marquee height\n        if self.sized:\n            # window's contents' aspect ratio\n            self.window.ratio = self.sized\n        else:\n            Thread(target=self._sizer).start()\n\n    def _saturation(self, unused, fraction=0):  # change saturation\n        self._VLCadjust(_Adjust.Saturation, fraction)\n\n    def _sizer(self, secs=0.25):  # asynchronously\n        while True:\n            # the first call(s) returns (0, 0),\n            # subsequent calls return (w, h)\n            a, b = self.player.video_get_size(0)\n            if b > 0 and a > 0:\n                w = self.window\n                # set window's contents' aspect ratio\n                w.ratio = self.sized = a, b\n                # get video scale factor\n                self.scale = float(w.frame.width) / a\n                self._wiggle()\n                break\n            elif secs > 0.001:\n                sleep(secs)\n            else:  # one-shot\n                break\n\n    def _VLCadjust(self, option, fraction=0, value=None):\n        # adjust a video option like brightness, contrast, etc.\n        p = self.player\n        # <https://Wiki.VideoLan.org/Documentation:Modules/adjust>\n        # note, .Enable must be set to 1, but once is sufficient\n        p.video_set_adjust_int(_Adjust.Enable, 1)\n        try:\n            lo, v, hi = _Adjust3[option]\n            if fraction:\n                if value is None:\n                    v = p.video_get_adjust_float(option)\n                else:\n                    v = float(value)\n                v += fraction * (hi - lo)\n            v = float(max(lo, min(hi, v)))\n            p.video_set_adjust_float(option, v)\n        except (KeyError, ValueError):\n            pass\n\n    def _VLClogo(self, logostr):\n        # add a video logo, example \"python cocoavlc.py -logo\n        # cone-altglass2.png\\;cone-icon-small.png ...\"\n        p = self.player\n        g = vlc.VideoLogoOption  # Enum\n        # <https://Wiki.VideoLan.org/Documentation:Modules/logo>\n        p.video_set_logo_int(g.enable, 1)\n        p.video_set_logo_int(g.position, vlc.Position.Center)\n        p.video_set_logo_int(g.opacity, 128)  # 0-255\n        # p.video_set_logo_int(g.delay, 1000)  # millisec\n        # p.video_set_logo_int(g.repeat, -1)  # forever\n        p.video_set_logo_string(g.file, logostr)\n\n    def _VLCmarquee(self, size=36):\n        # put video marquee at the bottom-center\n        p = self.player\n        m = vlc.VideoMarqueeOption  # Enum\n        # <https://Wiki.VideoLan.org/Documentation:Modules/marq>\n        p.video_set_marquee_int(m.Enable, 1)\n        p.video_set_marquee_int(m.Size, int(size))  # pixels\n        p.video_set_marquee_int(m.Position, vlc.Position.Bottom)\n        p.video_set_marquee_int(m.Opacity, 255)  # 0-255\n        p.video_set_marquee_int(m.Color, _Color.Yellow)\n        p.video_set_marquee_int(m.Timeout, 0)  # millisec, 0==forever\n        p.video_set_marquee_int(m.Refresh, 1000)  # millisec (or sec?)\n        p.video_set_marquee_string(m.Text, str2bytes('%Y-%m-%d  %T  %z'))\n\n    def _wiggle(self):\n        # wiggle the video to fill the window\n        p = self.player\n        s = p.video_get_scale()\n        p.video_set_scale(0.0 if s else self.scale)\n        p.video_set_scale(s)\n\n    def _zoom(self, unused, factor=0):\n        # zoom the video in/out, see tkvlc.py\n        p = self.player\n        x = self.zoomX * factor\n        if x > 1:\n            s = x\n        else:  # not below 1X\n            s, x = 0.0, 1.0\n        p.video_set_scale(s)\n        self.scale = s\n        self.zoomX = x\n\n\nif __name__ == '__main__':  # MCCABE 24\n\n    def _Adjustr():\n        a = []  # get adjust default values\n        for n in _Adjust._enum_names_.values():\n            try:\n                _, d, _ = _Adjust3[getattr(_Adjust, n)]\n                a.append('%s=%s' % (n, d))\n            except KeyError:  # ignore .Enable\n                pass\n        return ','.join(sorted(a))\n\n    _adjustr  = ''\n    _argv0    = basename(sys.argv[0])  # _Title\n    _Argv0    = splitext(_argv0)[0]\n    _logostr  = ''\n    _marquee  = False\n    _raiser   = False\n    _snapshot = AppVLC.snapshot  # default\n    _timeout  = None\n    _title    = splitext(_argv0)[0]\n    _video    = None\n\n    args = sys.argv[1:]\n    while args and args[0].startswith('-'):\n        o = args.pop(0)\n        t = o.lower()\n        if t in ('-h', '--help'):\n            u = ('-h|--help',\n                 '-adjust %s' % (_Adjustr(),))\n            if _VLC_3_:  # requires VLC 3+ and libvlc 3+\n                u += ('-logo <image_file_name>[\\\\;<image_file_name>...]',\n                      '-marquee')\n            u += ('-raiser',\n                  '-snapshot-format jpg|png|tiff',\n                  '-timeout <secs>',\n                  '-title <string>',\n                  '-v|--version',\n                  '<video_file_name>')\n            printf('usage:  [%s]', ']  ['.join(u), argv0=_argv0)\n            sys.exit(0)\n        elif '-adjust'.startswith(t) and len(t) > 1 and args:\n            _adjustr = args.pop(0)\n        elif '-logo'.startswith(t) and len(t) > 1 and args and _VLC_3_:\n            _logostr = args.pop(0)\n        elif '-marquee'.startswith(t) and len(t) > 1 and _VLC_3_:\n            _marquee = True\n        elif '-raiser'.startswith(t) and len(t) > 1:\n            _raiser = True\n        elif '-snapshot-format'.startswith(t) and len(t) > 1 and args:\n            _snapshot = args.pop(0)\n        elif '-timeout'.startswith(t) and len(t) > 3 and args:\n            _timeout = args.pop(0)\n        elif '-title'.startswith(t) and len(t) > 3 and args:\n            _title = args.pop(0).strip()\n        elif t in ('-v', '--version'):\n            # Print version of this cocoavlc.py, PyCocoa, etc.\n            print('%s: %s (%s %s %s)' % (basename(__file__), __version__,\n                                        _pycocoa_, _pycocoa_version,\n                                        _macOS(sep=' ')))\n            try:\n                vlc.print_version()  # PYCHOK expected\n                vlc.print_python()   # PYCHOK expected\n            except AttributeError:\n                pass\n            sys.exit(0)\n        else:\n            printf('invalid option: %s', o, argv0=_argv0)\n            sys.exit(1)\n\n    if _raiser:  # get traceback at SIG- faults or ...\n        try:  # ... use: python3 -X faulthandler ...\n            import faulthandler\n            faulthandler.enable()\n        except ImportError:  # not in Python 3.3-\n            pass\n\n    if args:\n        _video = args.pop(0)\n    else:\n        printf('- %s', _Select.lower(), argv0=_argv0, nl=1, nt=1)\n        app_title(_title)  # App.title when there's no App yet\n        _video = OpenPanel('Select a video file').pick(_Movies)\n\n    if _video:\n        app = AppVLC(video=_video, adjustr=_adjustr,\n                                   logostr=_logostr,\n                                   marquee=_marquee,\n                                    raiser=_raiser,\n                                  snapshot=_snapshot,\n                                     title=_title)\n        app.run(timeout=_timeout)  # never returns\n"
  },
  {
    "path": "examples/gtk2vlc.py",
    "content": "#! /usr/bin/env python3\n\n#\n# gtk example/widget for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\n\"\"\"VLC Gtk Widget classes + example application.\n\nThis module provides two helper classes, to ease the embedding of a\nVLC component inside a pygtk application.\n\nVLCWidget is a simple VLC widget.\n\nDecoratedVLCWidget provides simple player controls.\n\nWhen called as an application, it behaves as a video player.\n\n$Id$\n\"\"\"\n\nimport gtk\ngtk.gdk.threads_init()\n\nimport sys\nimport vlc\n\nfrom gettext import gettext as _\n\n# Create a single vlc.Instance() to be shared by (possible) multiple players.\ninstance = vlc.Instance()\n\nclass VLCWidget(gtk.DrawingArea):\n    \"\"\"Simple VLC widget.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a vlc.MediaPlayer() instance.\n    \"\"\"\n    def __init__(self, *p):\n        gtk.DrawingArea.__init__(self)\n        self.player = instance.media_player_new()\n        def handle_embed(*args):\n            if sys.platform == 'win32':\n                self.player.set_hwnd(self.window.handle)\n            else:\n                self.player.set_xwindow(self.window.xid)\n            return True\n        self.connect(\"map\", handle_embed)\n        self.set_size_request(320, 200)\n\nclass DecoratedVLCWidget(gtk.VBox):\n    \"\"\"Decorated VLC widget.\n\n    VLC widget decorated with a player control toolbar.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a Player instance.\n    \"\"\"\n    def __init__(self, *p):\n        gtk.VBox.__init__(self)\n        self._vlc_widget = VLCWidget(*p)\n        self.player = self._vlc_widget.player\n        self.pack_start(self._vlc_widget, expand=True)\n        self._toolbar = self.get_player_control_toolbar()\n        self.pack_start(self._toolbar, expand=False)\n\n    def get_player_control_toolbar(self):\n        \"\"\"Return a player control toolbar\n        \"\"\"\n        tb = gtk.Toolbar()\n        tb.set_style(gtk.TOOLBAR_ICONS)\n        for text, tooltip, stock, callback in (\n            (_(\"Play\"), _(\"Play\"), gtk.STOCK_MEDIA_PLAY, lambda b: self.player.play()),\n            (_(\"Pause\"), _(\"Pause\"), gtk.STOCK_MEDIA_PAUSE, lambda b: self.player.pause()),\n            (_(\"Stop\"), _(\"Stop\"), gtk.STOCK_MEDIA_STOP, lambda b: self.player.stop()),\n            ):\n            b=gtk.ToolButton(stock)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback)\n            tb.insert(b, -1)\n        tb.show_all()\n        return tb\n\nclass VideoPlayer:\n    \"\"\"Example simple video player.\n    \"\"\"\n    def __init__(self):\n        self.vlc = DecoratedVLCWidget()\n\n    def main(self, fname):\n        self.vlc.player.set_media(instance.media_new(fname))\n        w = gtk.Window()\n        w.add(self.vlc)\n        w.show_all()\n        w.connect(\"destroy\", gtk.main_quit)\n        gtk.main()\n\nclass MultiVideoPlayer:\n    \"\"\"Example multi-video player.\n\n    It plays multiple files side-by-side, with per-view and global controls.\n    \"\"\"\n    def main(self, filenames):\n        # Build main window\n        window=gtk.Window()\n        mainbox=gtk.VBox()\n        videos=gtk.HBox()\n\n        window.add(mainbox)\n        mainbox.add(videos)\n\n        # Create VLC widgets\n        for fname in filenames:\n            v = DecoratedVLCWidget()\n            v.player.set_media(instance.media_new(fname))\n            videos.add(v)\n\n        # Create global toolbar\n        tb = gtk.Toolbar()\n        tb.set_style(gtk.TOOLBAR_ICONS)\n\n        def execute(b, methodname):\n            \"\"\"Execute the given method on all VLC widgets.\n            \"\"\"\n            for v in videos.get_children():\n                getattr(v.player, methodname)()\n            return True\n\n        for text, tooltip, stock, callback, arg in (\n            (_(\"Play\"), _(\"Global play\"), gtk.STOCK_MEDIA_PLAY, execute, \"play\"),\n            (_(\"Pause\"), _(\"Global pause\"), gtk.STOCK_MEDIA_PAUSE, execute, \"pause\"),\n            (_(\"Stop\"), _(\"Global stop\"), gtk.STOCK_MEDIA_STOP, execute, \"stop\"),\n            ):\n            b = gtk.ToolButton(stock)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback, arg)\n            tb.insert(b, -1)\n\n        mainbox.pack_start(tb, expand=False)\n\n        window.show_all()\n        window.connect(\"destroy\", gtk.main_quit)\n        gtk.main()\n\nif __name__ == '__main__':\n    if not sys.argv[1:]:\n       print('You must provide at least 1 movie filename')\n       sys.exit(1)\n    if len(sys.argv[1:]) == 1:\n        # Only 1 file. Simple interface\n        p=VideoPlayer()\n        p.main(sys.argv[1])\n    else:\n        # Multiple files.\n        p=MultiVideoPlayer()\n        p.main(sys.argv[1:])\n"
  },
  {
    "path": "examples/gtkvlc.py",
    "content": "#! /usr/bin/env python3\n\n#\n# gtk3 example/widget for VLC Python bindings\n# Copyright (C) 2017 Olivier Aubert <contact@olivieraubert.net>\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\n\"\"\"VLC Gtk3 Widget classes + example application.\n\nThis module provides two helper classes, to ease the embedding of a\nVLC component inside a pygtk application.\n\nVLCWidget is a simple VLC widget.\n\nDecoratedVLCWidget provides simple player controls.\n\nWhen called as an application, it behaves as a video player.\n\"\"\"\n\nimport gi\ngi.require_version('Gdk', '3.0')\ngi.require_version('Gtk', '3.0')\nfrom gi.repository import Gdk\nfrom gi.repository import Gtk\n\nGdk.threads_init ()\n\nimport sys\nimport ctypes\nimport vlc\n\nfrom gettext import gettext as _\n\n# Create a single vlc.Instance() to be shared by (possible) multiple players.\nif 'linux' in sys.platform:\n    # Inform libvlc that Xlib is not initialized for threads\n    instance = vlc.Instance(\"--no-xlib\")\nelse:\n    instance = vlc.Instance()\n\n\ndef get_window_pointer(window):\n    \"\"\" Use the window.__gpointer__ PyCapsule to get the C void* pointer to the window\n    \"\"\"\n    # get the c gpointer of the gdk window\n    ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.c_void_p\n    ctypes.pythonapi.PyCapsule_GetPointer.argtypes = [ctypes.py_object]\n    return ctypes.pythonapi.PyCapsule_GetPointer(window.__gpointer__, None)\n\n\nclass VLCWidget(Gtk.DrawingArea):\n    \"\"\"Simple VLC widget.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a vlc.MediaPlayer() instance.\n    \"\"\"\n    __gtype_name__ = 'VLCWidget'\n\n    def __init__(self, *p):\n        Gtk.DrawingArea.__init__(self)\n        self.player = instance.media_player_new()\n        def handle_embed(*args):\n            if sys.platform == 'win32':\n                # get the win32 handle\n                gdkdll = ctypes.CDLL('libgdk-3-0.dll')\n                handle = gdkdll.gdk_win32_window_get_handle(get_window_pointer(self.get_window()))\n                self.player.set_hwnd(handle)\n            elif sys.platform == 'darwin':\n                # get the nsview pointer. NB need to manually specify function signature\n                gdkdll = ctypes.CDLL('libgdk-3.0.dll')\n                get_nsview = gdkdll.gdk_quaerz_window_get_nsview\n                get_nsview.restype, get_nsview.argtypes = [ctypes.c_void_p],  ctypes.c_void_p\n                self.player.set_nsobject(get_nsview(get_window_pointer(self.get_window())))\n            else:\n                self.player.set_xwindow(self.get_window().get_xid())\n            return True\n        self.connect(\"realize\", handle_embed)\n        self.set_size_request(320, 200)\n\nclass DecoratedVLCWidget(Gtk.VBox):\n    \"\"\"Decorated VLC widget.\n\n    VLC widget decorated with a player control toolbar.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a Player instance.\n    \"\"\"\n    __gtype_name__ = 'DecoratedVLCWidget'\n\n    def __init__(self, *p):\n        super(DecoratedVLCWidget, self).__init__()\n        self._vlc_widget = VLCWidget(*p)\n        self.player = self._vlc_widget.player\n        self.add(self._vlc_widget)\n        self._toolbar = self.get_player_control_toolbar()\n        self.pack_start(self._toolbar, False, False, 0)\n        self.show_all()\n\n    def get_player_control_toolbar(self):\n        \"\"\"Return a player control toolbar\n        \"\"\"\n        tb = Gtk.Toolbar.new()\n        for text, tooltip, iconname, callback in (\n            (_(\"Play\"), _(\"Play\"), 'gtk-media-play', lambda b: self.player.play()),\n            (_(\"Pause\"), _(\"Pause\"), 'gtk-media-pause', lambda b: self.player.pause()),\n            (_(\"Stop\"), _(\"Stop\"), 'gtk-media-stop', lambda b: self.player.stop()),\n            (_(\"Quit\"), _(\"Quit\"), 'gtk-quit', Gtk.main_quit),\n            ):\n            i = Gtk.Image.new_from_icon_name(iconname, Gtk.IconSize.MENU)\n            b = Gtk.ToolButton.new(i, text)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback)\n            tb.insert(b, -1)\n        return tb\n\nclass VideoPlayer:\n    \"\"\"Example simple video player.\n    \"\"\"\n    def __init__(self):\n        self.vlc = DecoratedVLCWidget()\n\n    def main(self, fname):\n        self.vlc.player.set_media(instance.media_new(fname))\n        w = Gtk.Window()\n        w.add(self.vlc)\n        w.show_all()\n        w.connect(\"destroy\", Gtk.main_quit)\n        Gtk.main()\n\nclass MultiVideoPlayer:\n    \"\"\"Example multi-video player.\n\n    It plays multiple files side-by-side, with per-view and global controls.\n    \"\"\"\n    def main(self, filenames):\n        # Build main window\n        window=Gtk.Window()\n        mainbox=Gtk.VBox()\n        videos=Gtk.HBox()\n\n        window.add(mainbox)\n        mainbox.add(videos)\n\n        # Create VLC widgets\n        for fname in filenames:\n            v = DecoratedVLCWidget()\n            v.player.set_media(instance.media_new(fname))\n            videos.add(v)\n\n        # Create global toolbar\n        tb = Gtk.Toolbar.new()\n\n        def execute(b, methodname):\n            \"\"\"Execute the given method on all VLC widgets.\n            \"\"\"\n            for v in videos.get_children():\n                getattr(v.player, methodname)()\n            return True\n\n        for text, tooltip, iconname, callback, arg in (\n            (_(\"Play\"), _(\"Global play\"), 'gtk-media-play', execute, \"play\"),\n            (_(\"Pause\"), _(\"Global pause\"), 'gtk-media-pause', execute, \"pause\"),\n            (_(\"Stop\"), _(\"Global stop\"), 'gtk-media-stop', execute, \"stop\"),\n            (_(\"Quit\"), _(\"Quit\"), 'gtk-quit', Gtk.main_quit, None),\n            ):\n            i = Gtk.Image.new_from_icon_name(iconname, Gtk.IconSize.MENU)\n            b = Gtk.ToolButton.new(i, text)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback, arg)\n            tb.insert(b, -1)\n\n        mainbox.pack_start(tb, False, False, 0)\n\n        window.show_all()\n        window.connect(\"destroy\", Gtk.main_quit)\n        Gtk.main()\n\nif __name__ == '__main__':\n    if not sys.argv[1:]:\n       print('You must provide at least 1 movie filename')\n       sys.exit(1)\n    if len(sys.argv[1:]) == 1:\n        # Only 1 file. Simple interface\n        p=VideoPlayer()\n        from evaluator import Evaluator\n        e = Evaluator(globals(), locals())\n        e.popup()\n        p.main(sys.argv[1])\n    else:\n        # Multiple files.\n        p=MultiVideoPlayer()\n        p.main(sys.argv[1:])\n    instance.release()\n"
  },
  {
    "path": "examples/play_buffer.py",
    "content": "#!/usr/bin/env python3\n\n# Author:   A.Invernizzi (@albestro on GitHub)\n# Date:     Jun 03, 2020\n\n# MIT License <http://OpenSource.org/licenses/MIT>\n#\n# Copyright (C) 2020 -- A. Invernizzi, @albestro on github\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the \"Software\"),\n# to deal in the Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n# and/or sell copies of the Software, and to permit persons to whom the\n# Software is furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n# OTHER DEALINGS IN THE SOFTWARE.\n\n\"\"\"\nExample usage of VLC API function `libvlc_media_new_callbacks`\nThis function allows to create a VLC media `libvlc_media_t` specifying custom\ncallbacks where the user can define how to manage and read the stream of data.\n\nThe general use case for this is when you have data in memory and you want to\nplay it (e.g. audio stream from a web radio).\n\nIn this example, we are going to read playable data from files in a specified\nfolder. In case you would want to read from a file, it is not the best way to do it,\nbut for the sake of this example we are going to read data into memory from files.\n\nThe example tries to highlight the separation of concerns between the callbacks and\nthe application logic, so it would hopefully make clear how to integrate the VLC API\nwith existing libraries.\n\nIn particular, we have two main parts:\n    - StreamProvider: which is a class that implements the logic; \"scrape\" a folder\n    for files with a specific extensions, and provide methods that retrieves data.\n    - VLC callabacks that uses a StreamProvider object\n\"\"\"\n\nimport argparse\nimport ctypes\nimport os\n\nimport vlc\n\n\nclass StreamProviderDir(object):\n    def __init__(self, rootpath, file_ext):\n        self._media_files = []\n        self._rootpath = rootpath\n        self._file_ext = file_ext\n        self._index = 0\n\n    def open(self):\n        \"\"\"\n        this function is responsible of opening the media.\n        it could have been done in the __init__, but it is just an example\n\n        in this case it scan the specified folder, but it could also scan a\n        remote url or whatever you prefer.\n        \"\"\"\n\n        print(\"read file list\")\n        for entry in os.listdir(self._rootpath):\n            if os.path.splitext(entry)[1] == f\".{self._file_ext}\":\n                self._media_files.append(os.path.join(self._rootpath, entry))\n        self._media_files.sort()\n\n        print(\"playlist:\")\n        for index, media_file in enumerate(self._media_files):\n            print(f\"[{index}] {media_file}\")\n\n    def release_resources(self):\n        \"\"\"\n        In this example this function is just a placeholder,\n        in a more complex example this may release resources after the usage,\n        e.g. closing the socket from where we retrieved media data\n        \"\"\"\n        print(\"releasing stream provider\")\n\n    def seek(self, offset):\n        \"\"\"\n        Again, a placeholder, not useful for the example\n        \"\"\"\n        print(f\"requested seek with offset={offset}\")\n\n    def get_data(self):\n        \"\"\"\n        It reads the current file in the list and returns the binary data\n        In this example it reads from file, but it could have downloaded data from an url\n        \"\"\"\n        print(f\"reading file [{self._index}] \", end='')\n\n        if self._index == len(self._media_files):\n            print(\"file list is over\")\n            return b''\n\n        print(f\"{self._media_files[self._index]}\")\n        with open(self._media_files[self._index], 'rb') as stream:\n            data = stream.read()\n\n        self._index = self._index + 1\n\n        return data\n\n\n# HERE THERE ARE THE CALLBACKS USED BY THE MEDIA CREATED IN THE \"MAIN\"\n# a callback in its simplest form is a python function decorated with the specific @vlc.CallbackDecorators.*\n\n@vlc.CallbackDecorators.MediaOpenCb\ndef media_open_cb(opaque, data_pointer, size_pointer):\n    print(\"OPEN\", opaque, data_pointer, size_pointer)\n\n    stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value\n\n    stream_provider.open()\n\n    data_pointer.contents.value = opaque\n    size_pointer.value = 1 ** 64 - 1\n\n    return 0\n\n\n@vlc.CallbackDecorators.MediaReadCb\ndef media_read_cb(opaque, buffer, length):\n    print(\"READ\", opaque, buffer, length)\n\n    stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value\n\n    new_data = stream_provider.get_data()\n    bytes_read = len(new_data)\n\n    if bytes_read > 0:\n        buffer_array = ctypes.cast(buffer, ctypes.POINTER(ctypes.c_char * bytes_read))\n        for index, b in enumerate(new_data):\n            buffer_array.contents[index] = ctypes.c_char(b)\n\n    print(f\"just read f{bytes_read}B\")\n    return bytes_read\n\n\n@vlc.CallbackDecorators.MediaSeekCb\ndef media_seek_cb(opaque, offset):\n    print(\"SEEK\", opaque, offset)\n\n    stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value\n\n    stream_provider.seek(offset)\n\n    return 0\n\n\n@vlc.CallbackDecorators.MediaCloseCb\ndef media_close_cb(opaque):\n    print(\"CLOSE\", opaque)\n\n    stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value\n\n    stream_provider.release_resources()\n\n\n# MAIN\nif __name__ == '__main__':\n    parser = argparse.ArgumentParser(\n            description='play files found in specified media folder (in alphabetic order)',\n            formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n    parser.add_argument(\n            'media_folder',\n            help='where to find files to play')\n    parser.add_argument(\n            '--extension',\n            default='ts',\n            help='file extension of the files to play')\n    args = parser.parse_args()\n\n    # helper object acting as media data provider\n    # it is just to highlight how the opaque pointer in the callback can be used\n    # and that the logic can be isolated from the callbacks\n    stream_provider = StreamProviderDir(args.media_folder, args.extension)\n\n    # these two lines to highlight how to pass a python object using ctypes\n    # it is verbose, but you can see the steps required\n    stream_provider_obj = ctypes.py_object(stream_provider)\n    stream_provider_ptr = ctypes.byref(stream_provider_obj)\n\n    # create an instance of vlc\n    instance = vlc.Instance()\n\n    # setup the callbacks for the media\n    media = instance.media_new_callbacks(\n            media_open_cb,\n            media_read_cb,\n            media_seek_cb,\n            media_close_cb,\n            stream_provider_ptr)\n    player = media.player_new_from_media()\n\n    # play/stop\n    player.play()\n    input(\"press enter to quit\")\n    player.stop()\n"
  },
  {
    "path": "examples/psgvlc.py",
    "content": "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nu'''Bare Bones VLC Media Player Demo with Playlist.\n\n1 - Originally the  Demo_Media_Player_VLC_Based.py  duplicated from\n    <https://GitHub.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms>\n    and modified to work and showing videos on recent macOS versions.\n\n2 - This script uses PySimpleGUI under its LGPL3+ stipulations.\n\n3 - You will need to install the Python bindings for VLC, for example\n    using pip:  python3 -m pip install python-vlc\n\n4 - You need the VLC player itself from <https://www.VideoLan.org>.\n\n5 - On macOS, you also need to get tkvlc.py from this location\n    <https://GitHub.com/oaubert/python-vlc/tree/master/examples>\n    to get video and audio.\n\n6 - On macOS, the video plays full-frame, overwriting the buttons.\n\n7 - Original <https://GitHub.com/israel-dryer/Media-Player> by Israel\n    Dryer, modified to be a PySimpleGUI Demo Program and a python-vlc\n    example for you to customize.  Uses the VLC player to playback\n    local media files (and YouTube streams).\n'''\nimport sys\nif sys.version_info[0] < 3:  # Python 3.4+ only\n    sys.exit('%s requires Python 3.4 or later' % (sys.argv[0],))\n    # import Tkinter as tk\nimport PySimpleGUI as sg\nimport vlc\n\n__all__ = ('libtk',)\n__version__ = '22.11.07'  # mrJean1 at Gmail\n\n_Load_  = 'Load'\n_Next_  = 'Next'\n_Path_  = 'Media URL or local path:'\n_Pause_ = 'Pause'\n_Play_  = 'Play'\n_Prev_  = 'Previous'\n_Stop_  = 'Stop'\n\n# GUI definition & setup\nsg.theme('DarkBlue')\n\ndef Bn(name):  # a PySimpleGUI \"User Defined Element\" (see docs)\n    return sg.Button(name, size=(8, 1), pad=(1, 1))\n\nlayout = [[sg.Input(default_text=_Path_, size=(40, 1), key='-VIDEO_PATH-'), sg.Button(_Load_)],\n          [sg.Frame('', [], size=(300, 170), key='-VID_OUT-')],  # was [sg.Image('', ...)],\n          [Bn(_Prev_), Bn(_Play_), Bn(_Next_), Bn(_Pause_), Bn(_Stop_)],\n          [sg.Text('Load media to start', key='-MESSAGE_AREA-')]]\n\nwindow = sg.Window('PySimpleGUI VLC Player', layout, element_justification='center', finalize=True, resizable=True)\n\nwindow['-VID_OUT-'].expand(True, True)  # type: sg.Element\n\n# Media Player Setup\ninst = vlc.Instance()\nlist_player = inst.media_list_player_new()\nmedia_list = inst.media_list_new([])\nlist_player.set_media_list(media_list)\nplayer = list_player.get_media_player()\n# tell VLC where to render the video(s)\ntk_id = window['-VID_OUT-'].Widget.winfo_id()\nlibtk = ''\nif sg.running_linux():\n    player.set_xwindow(tk_id)\nelif sg.running_windows():\n    player.set_hwnd(tk_id)\nelif sg.running_mac():\n    try:\n        from tkvlc import _GetNSView, libtk\n        ns = _GetNSView(tk_id)\n    except ImportError:\n        ns = None\n        libtk = 'none, install tkvlc.py from <https://GitHub.com/oaubert/python-vlc> examples'\n    if ns:  # drawable NSview\n        player.set_nsobject(ns)\n    else:  # no video, only audio\n        player.set_xwindow(tk_id)\nelse:  # running trinket, etc.\n    player.set_hwnd(tk_id)  # TBD\n\nif __name__ == '__main__':  # MCCABE 20\n\n    if len(sys.argv) > 1:\n        if sys.argv[1].lower() in ('-v', '--version'):\n            # show all versions, this vlc.py, libvlc, etc. (sample output on macOS):\n            # ...\n            # % python3 ./psgvlc.py -v\n            # psgvlc.py: 22.11.06\n            # tkinter: 8.6\n            # libTk: /Library/Frameworks/Python.framework/Versions/3.11/lib/libtk8.6.dylib\n            # vlc.py: 3.0.12119 (Mon May 31 18:25:17 2021 3.0.12)\n            # libVLC: 3.0.16 Vetinari (0x3001000)\n            # plugins: /Applications/VLC.app/Contents/MacOS/plugins\n            # Python: 3.11.0 (64bit) macOS 13.0 arm64\n            for t in ((sys.argv[0], __version__), (sg.tk.__name__, sg.tk.TkVersion), ('libTk', libtk)):\n                print('{}: {}'.format(*t))\n            try:\n                vlc.print_version()\n                vlc.print_python()\n            except AttributeError:\n                pass\n            sys.exit(0)\n\n        if sys.argv[1]:\n            media_list.add_media(sys.argv[1])\n            list_player.set_media_list(media_list)\n\n    # The Event Loop\n    while True:\n        # run with a timeout so that current location can be updated\n        event, values = window.read(timeout=1000)\n\n        if event == sg.WIN_CLOSED:\n            break\n\n        if event == _Pause_:\n            list_player.pause()\n        elif event == _Stop_:\n            list_player.stop()\n        elif event == _Next_:\n            list_player.next()\n            list_player.play()\n        elif event == _Prev_:\n            list_player.previous()  # first call causes current video to start over\n            list_player.previous()  # second call moves back 1 video from current\n            list_player.play()\n        elif event == _Play_:\n            list_player.play()\n        elif event == _Load_:\n            path = values['-VIDEO_PATH-']\n            if path and _Path_ not in path:\n                media_list.add_media(path)\n                list_player.set_media_list(media_list)\n                window['-VIDEO_PATH-'].update(_Path_)  # only add a legit submit\n\n        # update elapsed time if a video loaded and playing\n        if player.is_playing():\n            text = '{:02d}:{:02d}'.format(*divmod(player.get_time()   // 1000, 60)) + ' / ' + \\\n                   '{:02d}:{:02d}'.format(*divmod(player.get_length() // 1000, 60))\n            if sg.running_mac():\n                print('{}: {}'.format(sys.argv[0], text))\n\n        elif not media_list.count():\n            text = 'Load media to start'\n        else:\n            text = 'Ready to play media'\n        window['-MESSAGE_AREA-'].update(text)\n\n    window.close()\n"
  },
  {
    "path": "examples/pyobjcvlc.py",
    "content": "#! /usr/bin/env python3\n\n# -*- coding: utf-8 -*-\n\n# License at the end of this file.  This module is equivalent to\n# PyCocoa/test/simple_VLCplayer.py but based on PyObjC instead\n# of PyCocoa <https://PyPI.org/project/PyCocoa>.  Until macOS\n# release Catalina, macOS' Python includes PyObjC.\n\n# See also a more comprehensive VLC player example cocoavlc.py\n# <https://GitHub.com/oaubert/python-vlc/tree/master/examples>\n\n# This VLC player has only been tested with VLC 2.2.8 and 3.0.8,\n# and a compatible vlc.py <https://PyPI.org/project/Python-VLC>\n# binding using Python 2.7.10 with macOS' PyObjC 2.5.1 and Python\n# 3.7.4 with PyObjC 5.2b1 on macOS 10.13.6 High Sierra or 10.14.6\n# Mojave, all in 64-bit only.  This player has not been tested\n# on iOS, nor with PyPy and Intel(R) Python.\n\nfrom os.path import basename  # PYCHOK expected\nfrom platform import architecture, mac_ver  # PYCHOK false\nimport sys\n\n_argv0 = basename(__file__)\nif not sys.platform.startswith('darwin'):\n    raise ImportError('%s only supported on %s' % (_argv0, 'macOS'))\n\nclass _ImportError(ImportError):  # PYCHOK expected\n    def __init__(self, package, PyPI):\n        PyPI = '<https://PyPI.org/project/%s>' % (PyPI,)\n        t = 'no module %s, see %s' % (package, PyPI)\n        ImportError.__init__(self, t)\n\ntry:  # PYCHOK expected\n    from objc import __version__ as __PyObjC__\nexcept ImportError:\n    raise _ImportError('objc', 'PyObjC')\n\n# the imports listed explicitly to help PyChecker\nfrom Cocoa import NSAlternateKeyMask, NSApplication, \\\n                  NSBackingStoreBuffered, NSBundle, \\\n                  NSCommandKeyMask, NSControlKeyMask, \\\n                  NSMakeRect, NSMenu, NSMenuItem, \\\n                  NSObject, \\\n                  NSScreen, NSShiftKeyMask, NSSize, \\\n                  NSView, NSWindow\ntry:\n    from Cocoa import NSWindowStyleMaskClosable, NSWindowStyleMaskMiniaturizable, \\\n                      NSWindowStyleMaskResizable, NSWindowStyleMaskTitled\nexcept ImportError:  # previously, NSWindowStyleMaskXxx was named NSXxxWindowMask\n    from Cocoa import NSClosableWindowMask as NSWindowStyleMaskClosable, \\\n                      NSMiniaturizableWindowMask as NSWindowStyleMaskMiniaturizable, \\\n                      NSResizableWindowMask as NSWindowStyleMaskResizable, \\\n                      NSTitledWindowMask as NSWindowStyleMaskTitled\n\nNSStr = bytes if sys.version_info.major < 3 else str\nNSWindowStyleMaskUsual = NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable \\\n                       | NSWindowStyleMaskResizable | NSWindowStyleMaskTitled\n\n__all__  = ('simpleVLCplay',)\n__version__ = '19.09.27'\n\n\ntry:  # all imports listed explicitly to help PyChecker\n    from math import gcd  # Python 3+\nexcept ImportError:\n    try:\n        from fractions import gcd  # Python 2-\n    except ImportError:\n\n        def gcd(a, b):\n            a, b = abs(a), abs(b)\n            if a < b:\n                a, b = b, a\n            while b:\n                a, b = b, (a % b)\n            return a\n\n\ndef mspf(fps):\n    '''Convert frames per second to frame length in millisecs.\n    '''\n    return 1000.0 / (fps or 25)\n\n\ndef nsBundleRename(title, match='Python'):\n    '''Change the bundle title if the current title matches.\n\n       @param title: New bundle title (C{str}).\n       @keyword match: Optional, previous title to match (C{str}).\n\n       @return: The previous bundle title (C{str}) or None.\n\n       @note: Used to mimick C{NSApplication.setTitle_(ns_title)},\n              the application name shown in the menu bar.\n    '''\n    # <https://Developer.Apple.com/documentation/\n    #        foundation/nsbundle/1495012-bundlewithpath>\n    # ns = NSBundle.bundleWithPath_(os.path.abspath(match))\n    p, ns = None, NSBundle.mainBundle()\n    if ns:\n        ns = ns.localizedInfoDictionary() or ns.infoDictionary()\n        if ns:\n            k = NSStr('CFBundleName')\n            p = ns.objectForKey_(k) or None\n            if title and match in (p, '', None):  # can't be empty\n                ns.setObject_forKey_(NSStr(title), k)\n    return p\n\n\ndef printf(fmt, *args, **kwds):  # argv0='', nl=0, nt=0\n    '''Formatted print I{fmt % args} with optional keywords.\n\n       @param fmt: Print-like format (C{str}).\n       @param args: Optional arguments to include (I{all positional}).\n       @keyword argv0: Optional prefix (C{str}).\n       @keyword nl: Number of leading blank lines (C{int}).\n       @keyword nt: Number of trailing blank lines (C{int}).\n    '''\n    a = kwds.get('argv0', _argv0)\n    t = (fmt % args) if args else fmt\n    nl = '\\n' * kwds.get('nl', 0)\n    nt = '\\n' * kwds.get('nt', 0)\n    print(''.join((nl, a, ' ', t, nt)))\n\n\ndef terminating(app, timeout):\n    '''Terminate C{app} after C{timeout} seconds.\n\n       @param app: The application (C{NSApplication} instance).\n       @patam timeout: Time in seconds (C{float}).\n    '''\n    try:\n        secs = float(timeout)\n    except (TypeError, ValueError):\n        secs = 0\n\n    if secs > 0:\n        from threading import Thread\n\n        def _t():\n            from time import sleep\n\n            sleep(secs + 0.5)\n            app.terminate_()\n\n        Thread(target=_t).start()\n\n\nclass _NSDelegate(NSObject):\n    '''(INTERNAL) Delegate for NSApplication and NSWindow,\n        handling PyObjC events, notifications and callbacks.\n    '''\n    app    = None  # NSApplication\n    NSItem = None  # NSMenuItem\n    player = None  # vlc.MediaPlayer\n    ratio  = 2     # aspect_ratio calls\n    title  = ''    # top-level menu title\n    video  = None  # video file name\n    window = None  # main NSWindow\n\n    def applicationDidFinishLaunching_(self, notification):\n\n        # the VLC player needs an NSView object\n        self.window, view = _Window2(title=self.video or self.title)\n        # set the window's delegate to the app's to\n        # make method .windowWillClose_ work, see\n        # <https://Gist.GitHub.com/kaloprominat/6105220>\n        self.window.setDelegate_(self)\n        # pass viewable to VLC player, see PyObjC Generated types ...\n        # <https://PyObjC.ReadTheDocs.io/en/latest/core/type-wrapper.html>\n        self.player.set_nsobject(view.__c_void_p__())\n\n        menu = NSMenu.alloc().init()  # create main menu\n        menu.addItem_(_MenuItem('Full ' + 'Screen', 'enterFullScreenMode:', 'f', ctrl=True))  # Ctrl-Cmd-F, Esc to exit\n        menu.addItem_(_MenuItem('Info', 'info:', 'i'))\n\n        menu.addItem_(_MenuItemSeparator())\n        self.NSitem = _MenuItem('Pause', 'toggle:', 'p', ctrl=True)  # Ctrl-Cmd-P\n        menu.addItem_(self.NSitem)\n        menu.addItem_(_MenuItem('Rewind', 'rewind:', 'r', ctrl=True))  # Ctrl-Cmd-R\n\n        menu.addItem_(_MenuItemSeparator())\n        menu.addItem_(_MenuItem('Hide ' + self.title, 'hide:', 'h'))  # Cmd-H, implied\n        menu.addItem_(_MenuItem('Hide Others', 'hideOtherApplications:', 'h', alt=True))  # Alt-Cmd-H\n        menu.addItem_(_MenuItem('Show All', 'unhideAllApplications:'))  # no key\n\n        menu.addItem_(_MenuItemSeparator())\n        menu.addItem_(_MenuItem('Quit ' + self.title, 'terminate:', 'q'))  # Cmd-Q\n\n        subMenu = NSMenuItem.alloc().init()\n        subMenu.setSubmenu_(menu)\n\n        menuBar = NSMenu.alloc().init()\n        menuBar.addItem_(subMenu)\n        self.app.setMainMenu_(menuBar)\n\n        self.player.play()\n        # adjust the contents' aspect ratio\n        self.windowDidResize_(None)\n\n    def info_(self, notification):\n        try:\n            p = self.player\n            if p.is_playing():\n                p.pause()\n            m = p.get_media()\n            v = sys.modules[p.__class__.__module__]  # import vlc\n            b = v.bytes_to_str\n\n            printf(__version__, nl=1)\n            # print Python, vlc, libVLC, media info\n            printf('PyObjC %s', __PyObjC__, nl=1)\n            printf('Python %s %s', sys.version.split()[0], architecture()[0])\n            printf('macOS %s', ' '.join(mac_ver()[0:3:2]), nt=1)\n\n            printf('vlc.py %s (%#x)', v.__version__, v.hex_version())\n            printf('built: %s', v.build_date)\n\n            printf('libVLC %s (%#x)', b(v.libvlc_get_version()), v.libvlc_hex_version())\n            printf('libVLC %s', b(v.libvlc_get_compiler()), nt=1)\n\n            printf('media: %s', b(m.get_mrl()))\n            printf('state: %s', p.get_state())\n\n            printf('track/count: %s/%s', p.video_get_track(), p.video_get_track_count())\n            printf('time/duration: %s/%s ms', p.get_time(), m.get_duration())\n            printf('position/length: %.2f%%/%s ms', p.get_position() * 100.0, p.get_length())\n            f = p.get_fps()\n            printf('fps: %.3f (%.3f ms)', f, mspf(f))\n            printf('rate: %s', p.get_rate())\n\n            w, h = p.video_get_size(0)\n            printf('video size: %sx%s', w, h)\n            r = gcd(w, h) or ''\n            if r and w and h:\n                r = ' (%s:%s)' % (w // r, h // r)\n            printf('aspect ratio: %s%s', p.video_get_aspect_ratio(), r)\n\n            printf('scale: %.3f', p.video_get_scale())\n            o = p.get_nsobject()  # for macOS only\n            printf('nsobject: %r (%#x)', o, o, nt=1)\n        except Exception as x:\n            printf('%r', x, nl=1, nt=1)\n\n    def rewind_(self, notification):\n        self.player.set_position(0.0)\n        # can't re-play once at the end\n        # self.player.play()\n\n    def toggle_(self, notification):\n        # toggle between Pause and Play\n        if self.player.is_playing():\n            # note, .pause() pauses and un-pauses the video,\n            # .stop() stops the video and blanks the window\n            self.player.pause()\n            t = 'Play'\n        else:\n            self.player.play()\n            t = 'Pause'\n        self.NSitem.setTitle_(NSStr(t))\n\n    def windowDidResize_(self, notification):\n        if self.window and self.ratio:\n            # get and maintain the aspect ratio\n            # (the first player.video_get_size()\n            #  call returns (0, 0), subsequent\n            #  calls return (w, h) correctly)\n            w, h = self.player.video_get_size(0)\n            r = gcd(w, h)\n            if r and w and h:\n                r = NSSize(w // r , h // r)\n                self.window.setContentAspectRatio_(r)\n                self.ratio -= 1\n\n    def windowWillClose_(self, notification):\n        self.app.terminate_(self)\n\n\ndef _MenuItem(label, action=None, key='', alt=False, cmd=True, ctrl=False, shift=False):\n    '''New NS menu item with action and optional shortcut key.\n    '''\n    # <http://Developer.Apple.com/documentation/appkit/nsmenuitem/1514858-initwithtitle>\n    ns = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(\n                            NSStr(label), NSStr(action), NSStr(key))\n    if key:\n        mask = 0\n        if alt:\n            mask |= NSAlternateKeyMask\n        if cmd:\n            mask |= NSCommandKeyMask\n        if ctrl:\n            mask |= NSControlKeyMask\n        if shift:\n            mask |= NSShiftKeyMask  # NSAlphaShiftKeyMask\n        if mask:\n            ns.setKeyEquivalentModifierMask_(mask)\n    return ns\n\n\ndef _MenuItemSeparator():\n    '''A menu separator item.\n    '''\n    return NSMenuItem.separatorItem()\n\n\ndef _Window2(title=_argv0, fraction=0.5):\n    '''Create the main NS window and the drawable NS view.\n    '''\n    frame = NSScreen.mainScreen().frame()\n    if 0.1 < fraction < 1.0:\n        # use the lower left quarter of the screen size as frame\n        w = int(frame.size.width * fraction + 0.5)\n        h = int(frame.size.height * w / frame.size.width)\n        frame = NSMakeRect(frame.origin.x + 10, frame.origin.y + 10, w, h)\n\n    window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(\n                              frame,\n                              NSWindowStyleMaskUsual,\n                              NSBackingStoreBuffered,\n                              False)  # or 0\n    window.setTitle_(NSStr(title))\n\n    # create the drawable_nsobject NSView for vlc.py, see vlc.MediaPlayer.set_nsobject()\n    # for an alternate NSView object with protocol VLCOpenGLVideoViewEmbedding\n    # <http://StackOverflow.com/questions/11562587/create-nsview-directly-from-code>\n    # <http://GitHub.com/ariabuckles/pyobjc-framework-Cocoa/blob/master/Examples/AppKit/DotView/DotView.py>\n    view = NSView.alloc().initWithFrame_(frame)\n    window.setContentView_(view)\n    # force the video/window aspect ratio, adjusted\n    # above when the window is/has been resized\n    window.setContentAspectRatio_(frame.size)\n\n    window.makeKeyAndOrderFront_(None)\n    return window, view\n\n\ndef simpleVLCplay(player, title=_argv0, video='', timeout=None):\n    '''Create a minimal NS application, drawable window and basic menu\n       for the given VLC player (with media) and start the player.\n\n       @note: This function never returns, but the VLC player and\n              other Python thread(s) do run.\n    '''\n    if not player:\n        raise ValueError('%s invalid: %r' % ('player', player))\n\n    app = NSApplication.sharedApplication()\n    nsBundleRename(NSStr(title))  # top-level menu title\n\n    dlg = _NSDelegate.alloc().init()\n    dlg.app = app\n    dlg.player = player\n    dlg.title = title or _argv0\n    dlg.video = video or basename(player.get_media().get_mrl())\n    app.setDelegate_(dlg)\n\n    terminating(app, timeout)\n    app.run()  # never returns\n\n\nif __name__ == '__main__':\n\n    try:\n        import vlc\n    except ImportError:\n        raise _ImportError('vlc', 'Python-VLC')\n\n    _argv0 = _name = basename(sys.argv[0])\n    _timeout = None\n\n    args = sys.argv[1:]\n    while args and args[0].startswith('-'):\n        o = args.pop(0)\n        t = o.lower()\n        if t in ('-h', '--help'):\n            printf('usage:  [-h|--help]  [-name \"%s\"]  [-timeout <secs>]  %s',\n                   _name, '<video_file_name>')\n            sys.exit(0)\n        elif args and len(t) > 1 and '-name'.startswith(t):\n            _name = args.pop(0)\n        elif args and len(t) > 1 and '-timeout'.startswith(t):\n            _timeout = args.pop(0)\n        elif t in ('-v', '--version'):\n            print('%s: %s (%s %s)' % (basename(__file__), __version__,\n                                      'PyObjC', __PyObjC__))\n            try:\n                vlc.print_version()\n                vlc.print_python()\n            except AttributeError:\n                pass\n            sys.exit(0)\n        else:\n            printf('invalid option: %s', o)\n            sys.exit(1)\n\n    if not args:\n        printf('missing %s', '<video_file_name>')\n        sys.exit(1)\n\n    # create a VLC player and play the video\n    p = vlc.MediaPlayer(args.pop(0))\n    simpleVLCplay(p, title=_name, timeout=_timeout)  # never returns\n\n# MIT License <http://OpenSource.org/licenses/MIT>\n#\n# Copyright (C) 2017-2020 -- mrJean1 at Gmail -- All Rights Reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the \"Software\"),\n# to deal in the Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n# and/or sell copies of the Software, and to permit persons to whom the\n# Software is furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n# OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "examples/pyqt5vlc.py",
    "content": "#! /usr/bin/env python3\n#\n# PyQt5 example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"\nA simple example for VLC python bindings using PyQt5.\n\nAuthor: Saveliy Yusufov, Columbia University, sy2685@columbia.edu\nDate: 25 December 2018\n\"\"\"\n\nimport platform\nimport os\nimport sys\n\nfrom PyQt5 import QtWidgets, QtGui, QtCore\nimport vlc\n\nclass Player(QtWidgets.QMainWindow):\n    \"\"\"A simple Media Player using VLC and Qt\n    \"\"\"\n\n    def __init__(self, master=None):\n        QtWidgets.QMainWindow.__init__(self, master)\n        self.setWindowTitle(\"Media Player\")\n\n        # Create a basic vlc instance\n        self.instance = vlc.Instance()\n\n        self.media = None\n\n        # Create an empty vlc media player\n        self.mediaplayer = self.instance.media_player_new()\n        self.mediaplayer.audio_set_volume(50)\n\n        self.create_ui()\n        self.is_paused = False\n\n    def create_ui(self):\n        \"\"\"Set up the user interface, signals & slots\n        \"\"\"\n        self.widget = QtWidgets.QWidget(self)\n        self.setCentralWidget(self.widget)\n\n        # In this widget, the video will be drawn\n        if platform.system() == \"Darwin\": # for MacOS\n            self.videoframe = QtWidgets.QMacCocoaViewContainer(0)\n        else:\n            self.videoframe = QtWidgets.QFrame()\n\n        self.palette = self.videoframe.palette()\n        self.palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 0))\n        self.videoframe.setPalette(self.palette)\n        self.videoframe.setAutoFillBackground(True)\n\n        self.positionslider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)\n        self.positionslider.setToolTip(\"Position\")\n        self.positionslider.setMaximum(1000)\n        self.positionslider.sliderMoved.connect(self.set_position)\n        self.positionslider.sliderPressed.connect(self.set_position)\n\n        self.hbuttonbox = QtWidgets.QHBoxLayout()\n        self.playbutton = QtWidgets.QPushButton(\"Play\")\n        self.hbuttonbox.addWidget(self.playbutton)\n        self.playbutton.clicked.connect(self.play_pause)\n\n        self.stopbutton = QtWidgets.QPushButton(\"Stop\")\n        self.hbuttonbox.addWidget(self.stopbutton)\n        self.stopbutton.clicked.connect(self.stop)\n\n        self.hbuttonbox.addStretch(1)\n        self.volumeslider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)\n        self.volumeslider.setMaximum(100)\n        self.volumeslider.setValue(self.mediaplayer.audio_get_volume())\n        self.volumeslider.setToolTip(\"Volume\")\n        self.hbuttonbox.addWidget(self.volumeslider)\n        self.volumeslider.valueChanged.connect(self.set_volume)\n\n        self.vboxlayout = QtWidgets.QVBoxLayout()\n        self.vboxlayout.addWidget(self.videoframe)\n        self.vboxlayout.addWidget(self.positionslider)\n        self.vboxlayout.addLayout(self.hbuttonbox)\n\n        self.widget.setLayout(self.vboxlayout)\n\n        menu_bar = self.menuBar()\n\n        # File menu\n        file_menu = menu_bar.addMenu(\"File\")\n\n        # Add actions to file menu\n        open_action = QtWidgets.QAction(\"Load Video\", self)\n        open_shortcut = QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Open)\n        open_action.setShortcut(open_shortcut)\n        file_menu.addAction(open_action)\n\n        close_action = QtWidgets.QAction(\"Close App\", self)\n        close_shortcut = QtGui.QKeySequence(QtGui.QKeySequence.StandardKey.Close)\n        close_action.setShortcut(close_shortcut)\n        file_menu.addAction(close_action)\n\n        open_action.triggered.connect(self.open_file)\n        close_action.triggered.connect(sys.exit)\n\n        self.timer = QtCore.QTimer(self)\n        self.timer.setInterval(100)\n        self.timer.timeout.connect(self.update_ui)\n\n    def play_pause(self):\n        \"\"\"Toggle play/pause status\n        \"\"\"\n        if self.mediaplayer.is_playing():\n            self.mediaplayer.pause()\n            self.playbutton.setText(\"Play\")\n            self.is_paused = True\n            self.timer.stop()\n        else:\n            if self.mediaplayer.play() == -1:\n                self.open_file()\n                return\n\n            self.mediaplayer.play()\n            self.playbutton.setText(\"Pause\")\n            self.timer.start()\n            self.is_paused = False\n\n    def stop(self):\n        \"\"\"Stop player\n        \"\"\"\n        self.mediaplayer.stop()\n        self.playbutton.setText(\"Play\")\n\n    def open_file(self):\n        \"\"\"Open a media file in a MediaPlayer\n        \"\"\"\n\n        dialog_txt = \"Choose Media File\"\n        filename = QtWidgets.QFileDialog.getOpenFileName(self, dialog_txt, os.path.expanduser('~'))\n        if not filename:\n            return\n\n        # getOpenFileName returns a tuple, so use only the actual file name\n        self.media = self.instance.media_new(filename[0])\n\n        # Put the media in the media player\n        self.mediaplayer.set_media(self.media)\n\n        # Parse the metadata of the file\n        self.media.parse()\n\n        # Set the title of the track as window title\n        self.setWindowTitle(self.media.get_meta(0))\n\n        # The media player has to be 'connected' to the QFrame (otherwise the\n        # video would be displayed in it's own window). This is platform\n        # specific, so we must give the ID of the QFrame (or similar object) to\n        # vlc. Different platforms have different functions for this\n        if platform.system() == \"Linux\": # for Linux using the X Server\n            self.mediaplayer.set_xwindow(int(self.videoframe.winId()))\n        elif platform.system() == \"Windows\": # for Windows\n            self.mediaplayer.set_hwnd(int(self.videoframe.winId()))\n        elif platform.system() == \"Darwin\": # for MacOS\n            self.mediaplayer.set_nsobject(int(self.videoframe.winId()))\n\n        self.play_pause()\n\n    def set_volume(self, volume):\n        \"\"\"Set the volume\n        \"\"\"\n        self.mediaplayer.audio_set_volume(volume)\n\n    def set_position(self):\n        \"\"\"Set the movie position according to the position slider.\n        \"\"\"\n\n        # The vlc MediaPlayer needs a float value between 0 and 1, Qt uses\n        # integer variables, so you need a factor; the higher the factor, the\n        # more precise are the results (1000 should suffice).\n\n        # Set the media position to where the slider was dragged\n        self.timer.stop()\n        pos = self.positionslider.value()\n        self.mediaplayer.set_position(pos / 1000.0)\n        self.timer.start()\n\n    def update_ui(self):\n        \"\"\"Updates the user interface\"\"\"\n\n        # Set the slider's position to its corresponding media position\n        # Note that the setValue function only takes values of type int,\n        # so we must first convert the corresponding media position.\n        media_pos = int(self.mediaplayer.get_position() * 1000)\n        self.positionslider.setValue(media_pos)\n\n        # No need to call this function if nothing is played\n        if not self.mediaplayer.is_playing():\n            self.timer.stop()\n\n            # After the video finished, the play button stills shows \"Pause\",\n            # which is not the desired behavior of a media player.\n            # This fixes that \"bug\".\n            if not self.is_paused:\n                self.stop()\n\ndef main():\n    \"\"\"Entry point for our simple vlc player\n    \"\"\"\n    app = QtWidgets.QApplication(sys.argv)\n    player = Player()\n    player.show()\n    player.resize(640, 480)\n    sys.exit(app.exec_())\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "examples/qtvlc.py",
    "content": "#! /usr/bin/env python3\n\n#\n# Qt example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\nimport sys\nimport os.path\nimport vlc\nfrom PyQt4 import QtGui, QtCore\n\ntry:\n    unicode        # Python 2\nexcept NameError:\n    unicode = str  # Python 3\n\n\nclass Player(QtGui.QMainWindow):\n    \"\"\"A simple Media Player using VLC and Qt\n    \"\"\"\n    def __init__(self, master=None):\n        QtGui.QMainWindow.__init__(self, master)\n        self.setWindowTitle(\"Media Player\")\n\n        # creating a basic vlc instance\n        self.instance = vlc.Instance()\n        # creating an empty vlc media player\n        self.mediaplayer = self.instance.media_player_new()\n\n        self.createUI()\n        self.isPaused = False\n\n    def createUI(self):\n        \"\"\"Set up the user interface, signals & slots\n        \"\"\"\n        self.widget = QtGui.QWidget(self)\n        self.setCentralWidget(self.widget)\n\n        # In this widget, the video will be drawn\n        if sys.platform == \"darwin\": # for MacOS\n            self.videoframe = QtGui.QMacCocoaViewContainer(0)\n        else:\n            self.videoframe = QtGui.QFrame()\n        self.palette = self.videoframe.palette()\n        self.palette.setColor (QtGui.QPalette.Window,\n                               QtGui.QColor(0,0,0))\n        self.videoframe.setPalette(self.palette)\n        self.videoframe.setAutoFillBackground(True)\n\n        self.positionslider = QtGui.QSlider(QtCore.Qt.Horizontal, self)\n        self.positionslider.setToolTip(\"Position\")\n        self.positionslider.setMaximum(1000)\n        self.connect(self.positionslider,\n                     QtCore.SIGNAL(\"sliderMoved(int)\"), self.setPosition)\n\n        self.hbuttonbox = QtGui.QHBoxLayout()\n        self.playbutton = QtGui.QPushButton(\"Play\")\n        self.hbuttonbox.addWidget(self.playbutton)\n        self.connect(self.playbutton, QtCore.SIGNAL(\"clicked()\"),\n                     self.PlayPause)\n\n        self.stopbutton = QtGui.QPushButton(\"Stop\")\n        self.hbuttonbox.addWidget(self.stopbutton)\n        self.connect(self.stopbutton, QtCore.SIGNAL(\"clicked()\"),\n                     self.Stop)\n\n        self.hbuttonbox.addStretch(1)\n        self.volumeslider = QtGui.QSlider(QtCore.Qt.Horizontal, self)\n        self.volumeslider.setMaximum(100)\n        self.volumeslider.setValue(self.mediaplayer.audio_get_volume())\n        self.volumeslider.setToolTip(\"Volume\")\n        self.hbuttonbox.addWidget(self.volumeslider)\n        self.connect(self.volumeslider,\n                     QtCore.SIGNAL(\"valueChanged(int)\"),\n                     self.setVolume)\n\n        self.vboxlayout = QtGui.QVBoxLayout()\n        self.vboxlayout.addWidget(self.videoframe)\n        self.vboxlayout.addWidget(self.positionslider)\n        self.vboxlayout.addLayout(self.hbuttonbox)\n\n        self.widget.setLayout(self.vboxlayout)\n\n        open = QtGui.QAction(\"&Open\", self)\n        self.connect(open, QtCore.SIGNAL(\"triggered()\"), self.OpenFile)\n        exit = QtGui.QAction(\"&Exit\", self)\n        self.connect(exit, QtCore.SIGNAL(\"triggered()\"), sys.exit)\n        menubar = self.menuBar()\n        filemenu = menubar.addMenu(\"&File\")\n        filemenu.addAction(open)\n        filemenu.addSeparator()\n        filemenu.addAction(exit)\n\n        self.timer = QtCore.QTimer(self)\n        self.timer.setInterval(200)\n        self.connect(self.timer, QtCore.SIGNAL(\"timeout()\"),\n                     self.updateUI)\n\n    def PlayPause(self):\n        \"\"\"Toggle play/pause status\n        \"\"\"\n        if self.mediaplayer.is_playing():\n            self.mediaplayer.pause()\n            self.playbutton.setText(\"Play\")\n            self.isPaused = True\n        else:\n            if self.mediaplayer.play() == -1:\n                self.OpenFile()\n                return\n            self.mediaplayer.play()\n            self.playbutton.setText(\"Pause\")\n            self.timer.start()\n            self.isPaused = False\n\n    def Stop(self):\n        \"\"\"Stop player\n        \"\"\"\n        self.mediaplayer.stop()\n        self.playbutton.setText(\"Play\")\n\n    def OpenFile(self, filename=None):\n        \"\"\"Open a media file in a MediaPlayer\n        \"\"\"\n        if filename is None:\n            filename = QtGui.QFileDialog.getOpenFileName(self, \"Open File\", os.path.expanduser('~'))\n        if not filename:\n            return\n\n        # create the media\n        if sys.version < '3':\n            filename = unicode(filename)\n        self.media = self.instance.media_new(filename)\n        # put the media in the media player\n        self.mediaplayer.set_media(self.media)\n\n        # parse the metadata of the file\n        self.media.parse()\n        # set the title of the track as window title\n        self.setWindowTitle(self.media.get_meta(0))\n\n        # the media player has to be 'connected' to the QFrame\n        # (otherwise a video would be displayed in it's own window)\n        # this is platform specific!\n        # you have to give the id of the QFrame (or similar object) to\n        # vlc, different platforms have different functions for this\n        if sys.platform.startswith('linux'): # for Linux using the X Server\n            self.mediaplayer.set_xwindow(self.videoframe.winId())\n        elif sys.platform == \"win32\": # for Windows\n            self.mediaplayer.set_hwnd(self.videoframe.winId())\n        elif sys.platform == \"darwin\": # for MacOS\n            self.mediaplayer.set_nsobject(self.videoframe.winId())\n        self.PlayPause()\n\n    def setVolume(self, Volume):\n        \"\"\"Set the volume\n        \"\"\"\n        self.mediaplayer.audio_set_volume(Volume)\n\n    def setPosition(self, position):\n        \"\"\"Set the position\n        \"\"\"\n        # setting the position to where the slider was dragged\n        self.mediaplayer.set_position(position / 1000.0)\n        # the vlc MediaPlayer needs a float value between 0 and 1, Qt\n        # uses integer variables, so you need a factor; the higher the\n        # factor, the more precise are the results\n        # (1000 should be enough)\n\n    def updateUI(self):\n        \"\"\"updates the user interface\"\"\"\n        # setting the slider to the desired position\n        self.positionslider.setValue(self.mediaplayer.get_position() * 1000)\n\n        if not self.mediaplayer.is_playing():\n            # no need to call this function if nothing is played\n            self.timer.stop()\n            if not self.isPaused:\n                # after the video finished, the play button stills shows\n                # \"Pause\", not the desired behavior of a media player\n                # this will fix it\n                self.Stop()\n\nif __name__ == \"__main__\":\n    app = QtGui.QApplication(sys.argv)\n    player = Player()\n    player.show()\n    player.resize(640, 480)\n    if sys.argv[1:]:\n        player.OpenFile(sys.argv[1])\n    sys.exit(app.exec_())\n"
  },
  {
    "path": "examples/tkvlc.py",
    "content": "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# tkinter example for VLC Python bindings\n# Copyright (C) 2015 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n'''A simple example for VLC python bindings using tkinter.\n\nAuthor: Patrick Fay\nDate: 23-09-2015\n'''\n\n# Tested with VLC 3.0.16, 3.0.12, 3.0.11, 3.0.10, 3.0.8 and 3.0.6 with\n# the compatible vlc.py Python-VLC binding, Python 3.11.0, 3.10.0, 3.9.0\n# and 3.7.4 and with tkinter/Tk 8.6.9 on macOS 13.0.1 (amd64 M1), 11.6.1\n# (10.16 amd64 M1), 11.0.1 (10.16 x86-64) and 10.13.6 and with VLC 3.0.18,\n# Python 3.11.0 and tkinter/Tk 8.6.9 on Windows 10, all in 64-bit only.\n__version__ = '22.12.28'  # mrJean1 at Gmail\n\nimport sys\ntry:  # Python 3.4+ only\n    import tkinter as Tk\n    from tkinter import TclError, ttk  # PYCHOK ttk = Tk.ttk\n    from tkinter.filedialog import askopenfilename\n    from tkinter.messagebox import showerror\nexcept ImportError:\n    sys.exit('%s requires Python 3.4 or later' % (sys.argv[0],))\n    # import Tkinter as Tk; ttk = Tk\nimport os\nimport time\nimport vlc\n\n_isMacOS   = sys.platform.startswith('darwin')\n_isLinux   = sys.platform.startswith('linux')\n_isWindows = sys.platform.startswith('win')\n\n_ANCHORED    = 'Anchored'\n_BANNER_H    =  32 if _isMacOS else 64\n_BUTTONS     = 'Buttons'\n_DISABLED    = (      Tk.DISABLED,)\n_ENABLED     = ('!' + Tk.DISABLED,)\n_FULL_OFF    = 'Full Off'\n_FULL_SCREEN = 'Full Screen'\n# see _Tk_Menu.add_item and .bind_shortcut below\n# <https://www.Tcl.Tk/man/tcl8.6/TkCmd/keysyms.html>\n_KEY_SYMBOL  = {'~': 'asciitilde',  '`': 'grave',\n                '!': 'exclam',      '@': 'at',\n                '#': 'numbersign',  '$': 'dollar',\n                '%': 'percent',     '^': 'asciicirum',\n                '&': 'ampersand',   '*': 'asterisk',\n                '(': 'parenleft',   ')': 'parenright',\n                '_': 'underscore',  '-': 'minus',\n                '+': 'plus',        '=': 'equal',\n                '{': 'braceleft',   '}': 'braceright',\n                '[': 'bracketleft', ']': 'bracketright',\n                '|': 'bar',        '\\\\': 'backslash',\n                ':': 'colon',       ';': 'semicolon',\n                '\"': 'quotedbl',    \"'\": 'apostrophe',\n                '<': 'less',        '>': 'greater',\n                ',': 'comma',       '.': 'period',\n                '?': 'question',    '/': 'slash',\n                ' ': 'space',      '\\b': 'BackSpace',  # S!\n               '\\n': 'KP_Enter',   '\\r': 'Return',\n               '\\f': 'Next',       '\\v': 'Prior',\n               '\\t': 'Tab'}  # '\\a': 'space'?\n# see definition of specialAccelerators in <https://\n# GitHub.com/tcltk/tk/blob/main/macosx/tkMacOSXMenu.c>\n_MAC_ACCEL   = {' ': 'Space',    '\\b': 'Backspace',  # s!\n               '\\n': 'Enter',    '\\r': 'Return',\n               '\\f': 'PageDown', '\\v': 'PageUp',\n               '\\t': 'Tab',  # 'BackTab', 'Eject'?\n            'Prior': 'PageUp', 'Next': 'PageDown'}\n\n_MIN_W       =  420\n_MOD_ALT     =  1 << 17  # alt key down?\n_MOD_CMD     =  1 << 3   # command key down\n_MOD_CTRL    =  1 << 2   # ctrl key down\n_MOD_LOCK    =  1 << 1   # caps lock down\n_MOD_SHIFT   =  1 << 0   # shift key down\n_OPACITY     = 'Opacity %s%%'\n_TAB_X       =  32\n_T_CONFIGURE =  Tk.EventType.Configure\n_T_KEY       =  Tk.EventType.Key  # KeyPress\n_TICK_MS     =  100  # millisecs per time tick\n_Tk_Canvas   =  Tk.Canvas\n_Tk_Frame    =  ttk.Frame\n_Tk_Toplevel =  Tk.Toplevel\n_Tk_Version  =  Tk.TkVersion\n_UN_ANCHORED = 'Un-' + _ANCHORED\n_VOLUME      = 'Volume'\n\n_TKVLC_LIBTK_PATH = 'TKVLC_LIBTK_PATH'\n\nif _isMacOS:  # MCCABE 14\n    from ctypes import cdll, c_void_p\n    from ctypes.util import find_library as _find\n\n    # libtk = cdll.LoadLibrary(ctypes.util.find_library('tk'))\n    # returns (None or) the tk library /usr/lib/libtk.dylib\n    # from macOS, but we need the tkX.Y library bundled with\n    # Python 3+ or one matching the version of tkinter\n\n    # Homebrew-built Python, Tcl/Tk, etc. are installed in\n    # different places, usually something like (/usr/- or)\n    # /opt/local/Cellar/tcl-tk/8.6.11_1/lib/libtk8.6.dylib,\n    # found by command line `find /opt -name libtk8.6.dylib`\n\n    def _find_lib(name, *paths):\n        assert os.path.sep == '/'\n        # 1. built into Python\n        for p in (getattr(sys, 'base_prefix', ''), sys.prefix):\n            if p:\n                yield p + '/lib/' + name\n        # 2. from ctypes.find_library, env variable\n        for p in paths:\n            if p:  # is not None\n                p = os.path.expanduser(p)\n                yield p\n                if not p.endswith(name):\n                    yield p + '/' + name\n        # 3. the Homebrew basement\n        from glob import iglob\n        for t in ('/opt', '/usr'):\n            t += '/local/Cellar/tcl-tk/*/lib/' + name\n            for p in iglob(t):\n                yield p\n\n    try:\n        env = os.environ.get(_TKVLC_LIBTK_PATH, '')\n        lib = 'libtk%s.dylib' % (_Tk_Version,)\n        for libtk in _find_lib(lib, _find(lib), *env.split(os.pathsep)):\n            if libtk and lib in libtk and os.access(libtk, os.F_OK):\n                break\n        else:  # not found anywhere\n            if env:  # bad env?\n                t = 'no %s in %%s=%r' % (lib, env)\n            else:  # env not set, suggest\n                t = 'no %s found, use %%s to set a path' % (lib,)\n            raise NameError(t % (_TKVLC_LIBTK_PATH,))\n\n        lib = cdll.LoadLibrary(libtk)\n        # _GetNSView = lib.TkMacOSXDrawableView is the\n        # proper function to call, but that is non-public\n        # (in Tk source file macosx/TkMacOSXSubwindows.c)\n        # Fortunately, lib.TkMacOSXGetRootControl calls\n        # lib.TkMacOSXDrawableView and returns the NSView\n        _GetNSView = lib.TkMacOSXGetRootControl\n        # C signature: void *_GetNSView(void *drawable) to get\n        # the Cocoa/Obj-C NSWindow.contentView attribute, the\n        # drawable NSView object of the (drawable) NSWindow\n        _GetNSView.restype  =  c_void_p\n        _GetNSView.argtypes = (c_void_p,)\n\n    except (NameError, OSError) as x:  # lib, image or symbol not found\n        libtk = str(x)  # imported by examples/psgvlc.py\n\n        def _GetNSView(unused):  # imported by examples/psgvlc.py\n            return None\n\n    del cdll, c_void_p, env, _find, lib\n    Cmd_ = 'Command+'  # bind key modifier, aka Meta_L\n    # With Python 3.9+ on macOS (only!), accelerator keys specified\n    # with the Shift modifier invoke the callback (command) twice,\n    # once without and once with a Key (or KeyPress) event: hold the\n    # former as a pseudo Key event possibly absorbed by the actual\n    # Key event about 1 millisec later.  With Python 3.8- on macOS,\n    # Shift accelerator keys do not work at all: do not define any\n    # Shift accelerator keys in that case\n    _3_9 = sys.version_info[:2] >= (3, 9)\n\nelse:  # Windows OK, untested on *nix, Xwindows\n    libtk = 'N/A'\n    Cmd_  = 'Ctrl+'  # bind key modifier: Control!\n    _3_9  =  True\n\n\ndef _fullscreen(panel, *full):\n    # get/set a panel full-screen or -off\n    f = panel.attributes('-fullscreen')  # or .wm_attributes\n    if full:\n        panel.attributes('-fullscreen', bool(full[0]))\n        panel.update_idletasks()\n    return f\n\n\ndef _geometry(panel, g_w, *h_x_y):\n    # set a panel geometry to C{g} or C{w, h, x, y}.\n    if h_x_y:\n        t = '+'.join(map(str, h_x_y))\n        g = 'x'.join((str(g_w), t))\n    else:\n        g = g_w\n    panel.geometry(g)  # update geometry, then ...\n    g, *t = _geometry5(panel)  # ... get actual ...\n    panel._g = g  # ... as a C{str} and 4 C{int}s\n    # == panel.winfo_width(), _height(), _x(), _y()\n    panel._whxy = tuple(map(int, t))\n    return g\n\n\ndef _geometry1(panel):\n    # get a panel geometry as C{str}\n    panel.update_idletasks()\n    return panel.geometry()\n\n\ndef _geometry5(panel):\n    # get a panel geometry as 5-tuple of C{str}s\n    g = _geometry1(panel)  # '+-x' means absolute -x\n    z, x, y = g.split('+')\n    w, h = z.split('x')\n    return g, w, h, x, y\n\n\ndef _hms(tensecs, secs=''):\n    # format a time (in 1/10-secs) as h:mm:ss.s\n    s = tensecs * 0.1\n    if s < 60:\n        t = '%3.1f%s' % (s, secs)\n    else:\n        m, s = divmod(s, 60)\n        if m < 60:\n            t = '%d:%04.1f' % (int(m), s)\n        else:\n            h, m = divmod(m, 60)\n            t = '%d:%02d:%04.1f' % (int(h), int(m), s)\n    return t\n\n\ndef _underline2(c, label='', underline=-1, **cfg):\n    # update cfg with C{underline=index} or remove C{underline=.}\n    u = label.find(c) if c and label else underline\n    if u >= 0:\n        cfg.update(underline=u)\n    else:  # no underlining\n        c = ''\n    cfg.update(label=label)\n    return c, cfg\n\n\nclass _Tk_Button(ttk.Button):\n    '''A C{_Tk_Button} with a label, inlieu of text.\n    '''\n    def __init__(self, frame, **kwds):\n        cfg = self._cfg(**kwds)\n        ttk.Button.__init__(self, frame, **cfg)\n\n    def _cfg(self, label=None, **kwds):\n        if label is None:\n            cfg = kwds\n        else:\n            cfg = dict(text=label)\n            cfg.update(kwds)\n        return cfg\n\n    def config(self, **kwds):\n        cfg = self._cfg(**kwds)\n        ttk.Button.config(self, **cfg)\n\n    def disabled(self, *disable):\n        '''Dis-/enable this button.\n        '''\n        # <https://TkDocs.com/tutorial/widgets.html>\n        p = self.instate(_DISABLED)\n        if disable:\n            self.state(_DISABLED if disable[0] else _ENABLED)\n        return bool(p)\n\n\nclass _Tk_Item(object):\n    '''A re-configurable C{_Tk_Menu} item.\n    '''\n    def __init__(self, menu, label='', key='', under='', **kwds):\n        '''New menu item.\n        '''\n        self.menu = menu\n        self.idx  = menu.index(label)\n        self.key  = key  # <...>\n\n        self._cfg_d = dict(label=label, **kwds)\n        self._dis_d = False\n        self._under = under  # lower case\n\n    def config(self, **kwds):\n        '''Reconfigure this menu item.\n        '''\n        cfg = self._cfg_d.copy()\n        cfg.update(kwds)\n        if self._under:  # update underlining\n            _, cfg = _underline2(self._under, **cfg)\n        self.menu.entryconfig(self.idx, **cfg)\n\n    def disabled(self, *disable):\n        '''Dis-/enable this menu item.\n        '''\n        # <https://TkDocs.com/tutorial/menus.html>\n        p = self._dis_d\n        if disable:\n            self._dis_d = d = bool(disable[0])\n            self.config(state=Tk.DISABLED if d else Tk.NORMAL)\n        return p\n\n\nclass _Tk_Menu(Tk.Menu):\n    '''C{Tk.Menu} extended with an C{.add_shortcut} method.\n\n       Note, make C{Command-key} shortcuts on macOS work like\n       C{Control-key} shotcuts on X-/Windows using a *single*\n       character shortcut.\n\n       Other modifiers like Shift- and Option- passed thru,\n       unmodified.\n    '''\n    _shortcuts_entries = None  # {}, see .bind_shortcuts_to\n    _shortcuts_widgets = ()\n\n    def __init__(self, master=None, **kwds):\n        # remove dashed line from X-/Windows tearoff menus\n        # like idlelib.editor.EditorWindow.createmenubar\n        # or use root.option_add('*tearOff', False)  Off?\n        # as per <https://TkDocs.com/tutorial/menus.html>\n        Tk.Menu.__init__(self, master, tearoff=False, **kwds)\n\n    def add_item(self, label='', command=None, key='', **kwds):\n        '''C{Tk.menu.add_command} extended with shortcut key\n           accelerator, underline and binding and returning\n           a C{_Tk_Item} instance instead of an C{item} index.\n\n           If needed use modifiers like Shift- and Alt_ or Option-\n           before the *single* shortcut key character.  Do NOT\n           include the Command- or Control- modifier, instead use\n           the platform-specific Cmd_, like Cmd_ + key.  Also,\n           do NOT enclose the key in <...> brackets since those\n           are handled here as needed for the shortcut binding.\n        '''\n        assert callable(command), 'command=%r' % (command,)\n        return self._Item(Tk.Menu.add_command, key, label,\n                                  command=command, **kwds)\n\n    def add_menu(self, label='', menu=None, key='', **kwds):  # untested\n        '''C{Tk.menu.add_cascade} extended with shortcut key\n           accelerator, underline and binding and returning\n           a C{_Tk_Item} instance instead of an C{item} index.\n        '''\n        assert isinstance(menu, _Tk_Menu), 'menu=%r' % (menu,)\n        return self._Item(Tk.Menu.add_cascade, key, label,\n                                  menu=menu, **kwds)\n\n    def bind_shortcut(self, key='', command=None, label='', **unused):\n        '''Bind shortcut key \"<modifier-...-name>\".\n        '''\n        # C{Accelerator} modifiers on macOS are Command-,\n        # Ctrl-, Option- and Shift-, but for .bind[_all] use\n        # <Command-..>, <Ctrl-..>, <Option_..> and <Shift-..>\n        # with a shortcut key name or character (replaced\n        # with its _KEY_SYMBOL if non-alphanumeric)\n        # <https://www.Tcl.Tk/man/tcl8.6/TkCmd/bind.htm#M6>\n        # <https://www.Tcl.Tk/man/tcl8.6/TkCmd/keysyms.html>\n        if key and callable(command) and self._shortcuts_widgets:\n            for w in self._shortcuts_widgets:\n                w.bind(key, command)\n            if label:  # remember the key in this menu\n                idx = self.index(label)\n                self._shortcuts_entries[idx] = key\n        # The Tk modifier for macOS' Command key is called Meta\n        # with Meta_L and Meta_R for the left and right keyboard\n        # keys.  Similarly for macOS' Option key, the modifier\n        # name Alt with Alt_L and Alt_R.  Previously, there were\n        # only the Meta_L and Alt_L keys/modifiers.  See also\n        # <https://StackOverflow.com/questions/6378556/multiple-\n        # key-event-bindings-in-tkinter-control-e-command-apple-e-etc>\n\n    def bind_shortcuts_to(self, *widgets):\n        '''Set widget(s) to bind shortcut keys to, usually the\n           root and/or Toplevel widgets.\n        '''\n        self._shortcuts_entries = {}\n        self._shortcuts_widgets = widgets\n\n    def entryconfig(self, idx, command=None, **kwds):  # PYCHOK signature\n        '''Update a menu item and the shortcut key binding\n           if the menu item command is being changed.\n\n           Note, C{idx} is the item's index in the menu,\n           see C{_Tk_Item} above.\n        '''\n        if command is None:  # XXX postcommand for sub-menu\n            Tk.Menu.entryconfig(self, idx, **kwds)\n        elif callable(command):  # adjust the shortcut key binding\n            Tk.Menu.entryconfig(self, idx, command=command, **kwds)\n            key = self._shortcuts_entries.get(idx, None)\n            if key is not None:\n                for w in self._shortcuts_widgets:\n                    w.bind(key, command)\n\n    def _Item(self, add_, key, label, **kwds):\n        # Add and bind a menu item or sub~menu with an\n        # optional accelerator key (not <..> enclosed)\n        # or underline letter (preceded by underscore),\n        # see <https://TkDocs.com/tutorial/menus.html>.\n        cfg = dict(label=label)\n        if key:  # Use '+' sign, like key = \"Ctrl+Shift+X\"\n            if key.startswith('<') and key.endswith('>'):\n                c = ''  # pass as-is, e.g. <<virtual event>>\n            else:\n                c = '+'  # split into modifiers and char\n                if key.endswith(c):\n                    m = key.rstrip(c).split(c)\n                else:\n                    m = key.split(c)\n                    c = m.pop()\n                for k in ('Key', 'KeyPress', 'KeyRelease'):\n                    while k in m:\n                        m.remove(k)\n                # adjust accelerator key for specials like KP_1,\n                # PageDown and PageUp (on macOS, see function\n                # ParseAccelerator in <https://GitHub.com/tcltk/tk/\n                # blob/main/macosx/tkMacOSXMenu.c> and definition\n                # of specialAccelerators in <https://GitHub.com/\n                # tcltk/tk/blob/main/macosx/tkMacOSXMenu.c>)\n                a = _MAC_ACCEL.get(c, c) if _isMacOS else c\n                if a.upper().startswith('KP_'):\n                    a = a[3:]\n                # accelerator strings are only used for display\n                # ('+' or '-' OK, ' ' space isn't for macOS)\n                cfg.update(accelerator='+'.join(m + [a]))\n                # replace key with Tk keysymb, allow F1 thru F35\n                # (F19 on macOS) and because shortcut keys are\n                # case-sensitive, use lower-case unless specified\n                # as an upper-case letter with Shift+ modifier\n                s = _KEY_SYMBOL.get(c, c)\n                if len(s) == 1 and s.isupper() \\\n                               and 'Shift' not in m:\n                    s = s.lower()\n                # default to single key down case\n                if len(c) == 1:\n                    m.append('Key')  # == KeyPress\n                # replace Ctrl modifier with Tk Control\n                while 'Ctrl' in m:\n                    m[m.index('Ctrl')] = 'Control'\n                # <enclosed> for .bind_shortcut/.bind\n                key = '<' + '-'.join(m + [s]) + '>'\n                if _isMacOS or len(c) != 1 or not c.isalnum():\n                    c = ''  # no underlining\n                else:  # only Windows?\n                    c, cfg = _underline2(c, **cfg)\n\n        else:  # like idlelib, underline char after ...\n            c, u = '', label.find('_')  # ... underscore\n            if u >= 0:  # ... and remove underscore\n                label = label[:u] + label[u+1:]\n                cfg.update(label=label)\n                if u < len(label) and not _isMacOS:\n                    # c = label[u]\n                    cfg.update(underline=u)\n\n        if kwds:  # may still override accelerator ...\n            cfg.update(kwds)  # ... and underline\n        add_(self, **cfg)  # first _add then ...\n        self.bind_shortcut(key, **cfg)  # ... bind\n        return _Tk_Item(self, key=key, under=c, **cfg)\n\n\nclass _Tk_Slider(Tk.Scale):\n    '''Scale with some add'l attributres\n    '''\n    _var = None\n\n    def __init__(self, frame, to=1, **kwds):\n        if isinstance(to, int):\n            f, v = 0, Tk.IntVar()\n        else:\n            f, v = 0.0, Tk.DoubleVar()\n        cfg = dict(from_=f, to=to,\n                   orient=Tk.HORIZONTAL,\n                   showvalue=0,\n                   variable=v)\n        cfg.update(kwds)\n        Tk.Scale.__init__(self, frame, **cfg)\n        self._var = v\n\n    def set(self, value):\n        # doesn't move the slider\n        self._var.set(value)\n        Tk.Scale.set(self, value)\n\n\nclass Player(_Tk_Frame):\n    '''The main window handling with events, etc.\n    '''\n    _anchored  =  True  # under the video panel\n    _BUTTON_H  = _BANNER_H\n    _debugs    =  0\n    _isFull    = ''  # or geometry\n    _length    =  0  # length time ticks\n    _lengthstr = ''  # length h:m:s\n    _muted     =  False\n    _opacity   =  90 if _isMacOS else 100  # percent\n    _opaque    =  False\n    _rate      =  0.0\n    _ratestr   = ''\n    _scaleX    =  1\n    _scaleXstr = ''\n    _sliding   =  False\n    _snapshots =  0\n    _stopped   =  None\n    _title     = 'tkVLCplayer'\n    _volume    =  50  # percent\n\n    def __init__(self, parent, title='', video='', debug=False):  # PYCHOK called!\n        _Tk_Frame.__init__(self, parent)\n\n        self.debug  = bool(debug)\n        self.parent = parent  # == root\n        self.video  = os.path.expanduser(video)\n        if title:\n            self._title = str(title)\n        parent.title(self._title)\n#       parent.iconname(self._title)\n\n        # set up tickers to avoid None error\n        def _pass():\n            pass\n\n        self._tick_a = self.after(1, _pass)\n        self._tick_c = self.after(2, _pass)\n        self._tick_r = self.after(3, _pass)\n        self._tick_s = self.after(4, _pass)  # .after_idle\n        self._tick_t = self.after(5, _pass)\n        self._tick_z = self.after(6, _pass)\n\n        # panels to play videos and hold buttons, sliders,\n        # created *before* the File menu to be able to bind\n        # the shortcuts keys to both windows/panels.\n        self.videoPanel = v = self._VideoPanel()\n        self._bind_events(v)  # or parent\n        self.buttonsPanel = b = self._ButtonsPanel()\n        self._bind_events(b)\n\n        mb = _Tk_Menu(self.parent)  # menu bar\n        parent.config(menu=mb)\n#       self.menuBar = mb\n\n        # macOS shortcuts <https://Support.Apple.com/en-us/HT201236>\n        m = _Tk_Menu(mb)  # Video menu, shortcuts to both panels\n        m.bind_shortcuts_to(v, b)\n        m.add_item('Open...', self.OnOpen, key=Cmd_ + 'O')\n        m.add_separator()\n        self.playItem = m.add_item('Play', self.OnPlay, key=Cmd_ + 'P')  # Play/Pause\n        m.add_item('Stop', self.OnStop, key=Cmd_ + '\\b')  # BackSpace\n        m.add_separator()\n        m.add_item('Zoom In',  self.OnZoomIn,  key=(Cmd_ + 'Shift++') if _3_9 else '')\n        m.add_item('Zoom Out', self.OnZoomOut, key=(Cmd_ + '-')       if _3_9 else '')\n        m.add_separator()\n        m.add_item('Faster', self.OnFaster, key=(Cmd_ + 'Shift+>') if _3_9 else '')\n        m.add_item('Slower', self.OnSlower, key=(Cmd_ + 'Shift+<') if _3_9 else '')\n        m.add_separator()\n        m.add_item('Normal 1X', self.OnNormal, key=Cmd_ + '=')\n        m.add_separator()\n        self.muteItem = m.add_item('Mute', self.OnMute, key=Cmd_ + 'M')\n        m.add_separator()\n        m.add_item('Snapshot', self.OnSnapshot, key=Cmd_ + 'T')\n        m.add_separator()\n        self.fullItem = m.add_item(_FULL_SCREEN, self.OnFull, key=Cmd_ + 'F')\n        m.add_separator()\n        m.add_item('Close', self.OnClose, key=Cmd_ + 'W')\n        mb.add_cascade(menu=m, label='Video')\n#       self.videoMenu = m\n\n        m = _Tk_Menu(mb)  # Video menu, shortcuts to both panels\n        m.bind_shortcuts_to(v, b)\n        self.anchorItem = m.add_item(_UN_ANCHORED, self.OnAnchor, key=Cmd_ + 'A')\n        m.add_separator()\n        self.opaqueItem = m.add_item(_OPACITY % (self._opacity,), self.OnOpacity, key=Cmd_ + 'Y')\n        m.add_item('Normal 100%', self.OnOpacity100)\n        mb.add_cascade(menu=m, label=_BUTTONS)\n#       self.buttonsMenu = m\n\n        if _isMacOS and self.debug:  # Special macOS \"windows\" menu\n            # <https://TkDocs.com/tutorial/menus.html> \"Providing a Window Menu\"\n            # XXX Which (virtual) events are generated other than Configure?\n            m = _Tk_Menu(mb, name='window')  # must be name='window'\n            mb.add_cascade(menu=m, label='Windows')\n\n        # VLC player\n        args = ['--no-xlib'] if _isLinux else []\n        self.Instance = vlc.Instance(args)\n        self.player = self.Instance.media_player_new()\n\n        b.update_idletasks()\n        v.update_idletasks()\n        if self.video:  # play video for a second, adjusting the panel\n            self._play(self.video)\n            self.after(1000, self.OnPause)\n#       elif _isMacOS:  # <https://StackOverflow.com/questions/18394597/\n#           # is-there-a-way-to-create-transparent-windows-with-tkinter>\n#           self._stopped = True\n#           self._set_opacity()\n        self.OnTick()  # set up the timer\n\n        # Keep the video panel at least as wide as the buttons panel\n        # and move it down enough to put the buttons panel above it.\n        self._BUTTON_H = d = b.winfo_height()\n        b.minsize(width=_MIN_W, height=d)\n        v.minsize(width=_MIN_W, height=0)\n        _, w, h, _, y = _geometry5(v)\n        y = int(y) + d + _BANNER_H\n        _geometry(v, w, h, _TAB_X, y)\n        self._anchorPanels()\n        self._set_volume()\n\n    def _anchorPanels(self, video=False):\n        # Put the buttons panel under the video\n        # or the video panel above the buttons\n        if self._anchored and not self._isFull:\n            self._debug(self._anchorPanels)\n            v = self.videoPanel\n            if _isMacOS and _fullscreen(v):\n                # macOS green button full-screen?\n                _fullscreen(v, False)\n                self.OnFull()\n            else:\n                b = self.buttonsPanel\n                v.update_idletasks()\n                b.update_idletasks()\n                h = v.winfo_height()\n                d = h + _BANNER_H  # vertical delta\n                if video:  # move/adjust video panel\n                    w = b.winfo_width()  # same as ...\n                    x = b.winfo_x()      # ... buttons\n                    y = b.winfo_y() - d  # ... and above\n                    g = v\n                else:  # move/adjust buttons panel\n                    h = b.winfo_height()  # unchanged\n                    if h > self._BUTTON_H and _fullscreen(b):\n                        # macOS green button full-screen?\n                        _fullscreen(b, False)\n                        h = self._BUTTON_H\n                    w = v.winfo_width()  # unchanged\n                    x = v.winfo_x()  # same as the video\n                    y = v.winfo_y() + d  # below the video\n                    g = b\n#               _g = g._g\n                _geometry(g, max(w, _MIN_W), h, x, y)\n                if video:  # and g._g != _g:\n                    self._set_aspect_ratio(True)\n\n    def _bind_events(self, panel):\n        # set up handlers for several events\n        try:\n            p  = panel\n            p_ = p.protocol\n        except AttributeError:\n            p  = p.master  # == p.parent\n            p_ = p.protocol\n        if _isWindows:  # OK for macOS\n            p_('WM_DELETE_WINDOW', self.OnClose)\n#       Event Types <https://www.Tcl.Tk/man/tcl8.6/TkCmd/bind.html#M7>\n        p.bind('<Configure>',       self.OnConfigure)  # window resize, position, etc.\n        # needed on macOS to catch window close events\n        p.bind('<Destroy>',         self.OnClose)      # window half-dead\n#       p.bind('<Activate>',        self.OnActive)     # window activated\n#       p.bind('<Deactivate>',      self.OffActive)    # window deactivated\n        p.bind('<FocusIn>',         self.OnFocus)      # getting keyboard focus\n#       p.bind('<FocusOut>',        self.OffFocus)     # losing keyboard focus\n#       p.bind('<Return>',          self.OnReturn)     # highlighted button\n        if _isMacOS:\n            p.bind('<Command-.>', self.OnClose)\n#           p.bind('<Command-,.'. self.OnPreferences)\n#           p.bind('<KP_Enter>',  self.OnReturn)  # highlighted button\n        # attrs holding the most recently set _geometry ...\n        assert not hasattr(panel, '_g')\n        panel._g = ''  # ... as a sC{str} and ...\n        assert not hasattr(panel, '_whxy')\n        panel._whxy = ()  # ... 4-tuple of C{ints}s\n\n    def _ButtonsPanel(self):\n        # create panel with buttons and sliders\n        b = _Tk_Toplevel(self.parent, name='buttons')\n        t = '%s - %s' % (self._title, _BUTTONS)\n        b.title(t)  # '' removes the window banner\n        b.resizable(True, False)\n\n        f = _Tk_Frame(b)\n        # button are too small on Windows if width is given\n        p = _Tk_Button(f, label='Play', command=self.OnPlay)\n        #                 width=len('Pause'), underline=0\n        s = _Tk_Button(f, label='Stop', command=self.OnStop)\n        m = _Tk_Button(f, label='Mute', command=self.OnMute)\n        #                 width=len('Unmute'), underline=0\n        q = _Tk_Slider(f, command=self.OnPercent, to=100,\n                          label=_VOLUME)  # length=170\n        p.pack(side=Tk.LEFT, padx=8)\n        s.pack(side=Tk.LEFT)\n        m.pack(side=Tk.LEFT, padx=8)\n        q.pack(fill=Tk.X,    padx=4, expand=1)\n        f.pack(side=Tk.BOTTOM, fill=Tk.X)\n\n        f = _Tk_Frame(b)  # new frame?\n        t = _Tk_Slider(f, command=self.OnTime, to=1000,  # millisecs\n                          length=_MIN_W)  # label='Time'\n        t.pack(side=Tk.BOTTOM, fill=Tk.X, expand=1)\n        f.pack(side=Tk.BOTTOM, fill=Tk.X)\n\n        # <https://www.PythonTutorial.net/tkinter/tkinter-window>\n        # <https://TkDocs.com/tutorial/windows.html>\n        # b.attributes('-topmost', 1)\n\n        # self.videoPanel.update()  # needed to ...\n# #     b.overrideredirect(True)  # ignore the panel\n        b.update_idletasks()\n\n        self.muteButton    = m\n        self.playButton    = p\n        self.timeSlider    = t\n        self.percentSlider = q\n        return b\n\n    def _debug(self, where, *event, **kwds):\n        # Print where an event is are handled.\n        if self.debug:\n            self._debugs += 1\n            d = dict(anchored=self._anchored,\n                       isFull=bool(self._isFull),\n                      opacity=self._opacity,\n                       opaque=self._opaque,\n                      stopped=self._stopped,\n                       volume=self._volume)\n            p = self.player\n            if p and p.get_media():\n                d.update(playing=p.is_playing(),\n                            rate=p.get_rate(),\n                           scale=p.video_get_scale(),\n                           scaleX=self._scaleX)\n            try:  # final OnClose may throw TclError\n                d.update(Buttons=_geometry1(self.buttonsPanel))\n                d.update(  Video=_geometry1(self.videoPanel))\n                if event:  # an event\n                    event = event[0]\n                    d.update(event=event)\n                    w = str(event.widget)\n#                   d.update(widget=type(event.widget))  # may fail\n                    d.update(Widget={'.':        'Video',\n                                     '.buttons': _BUTTONS}.get(w, w))\n            except (AttributeError, TclError):\n                pass\n            d.update(kwds)\n            d = ', '.join('%s=%s' % t for t in sorted(d.items()))\n            print('%4s: %s %s' % (self._debugs, where.__name__, d))\n\n    def _frontmost(self):\n        # Move panels to the front ...  temporarily.\n        for p in (self.videoPanel, self.buttonsPanel):\n            p.attributes('-topmost', True)\n            p.update_idletasks()\n            p.attributes('-topmost', False)\n            try:  # no Toplevel.force_focus\n                p.force_focus()\n            except AttributeError:\n                pass\n\n    def OnAnchor(self, *unused):\n        '''Toggle anchoring of the panels.\n        '''\n        self._debug(self.OnAnchor)\n        self._anchored = not self._anchored\n        if self._anchored:\n            self._anchorPanels()\n            a = _UN_ANCHORED\n        else:  # move the buttons panel to the top-left\n            b = self.buttonsPanel\n            h = b.winfo_height()  # unchanged\n            _geometry(b, _MIN_W, h, _TAB_X, _BANNER_H)\n            a = _ANCHORED\n        self.anchorItem.config(label=a)\n\n    def OnClose(self, *event):\n        '''Closes the window(s) and quit.\n        '''\n        self._debug(self.OnClose, *event)\n        # print('_quit: bye')\n        self.after_cancel(self._tick_a)\n        self.after_cancel(self._tick_c)\n        self.after_cancel(self._tick_r)\n        self.after_cancel(self._tick_s)\n        self.after_cancel(self._tick_t)\n        self.after_cancel(self._tick_z)\n        v = self.videoPanel\n        v.update_idletasks()\n        self.quit()  # stops .mainloop\n\n    def OnConfigure(self, event):\n        '''Some widget configuration changed.\n        '''\n        w, T = event.widget, event.type  # int\n        if T == _T_CONFIGURE and w.winfo_toplevel() is w:\n            # i.e. w is videoFrame/Panel or buttonsPanel\n            if w is self.videoPanel:\n                a = self._set_aspect_ratio  # force=True\n            elif w is self.buttonsPanel and self._anchored:\n                a = self._anchorPanels  # video=True\n            else:\n                a = None\n            # prevent endless, recursive onConfigure events due to changing\n            # the buttons- and videoPanel geometry, especially on Windows\n            if a and w._whxy != (event.width, event.height, event.x, event.y):\n                self.after_cancel(self._tick_c)\n                self._debug(self.OnConfigure, event)\n                self._tick_c = self.after(250, a, True)\n\n    def OnFaster(self, *event):\n        '''Speed the video up by 25%.\n        '''\n        self._set_rate(1.25, *event)\n        self._debug(self.OnFaster)\n\n    def OnFocus(self, *unused):\n        '''Got the keyboard focus.\n        '''\n        self._debug(self.OnFocus)\n        self._frontmost()\n#       self._set_aspect_ratio()\n#       self._wiggle()\n\n    def OnFull(self, *unused):\n        '''Toggle full/off screen.\n        '''\n        self._debug(self.OnFull)\n        # <https://www.Tcl.Tk/man/tcl8.6/TkCmd/wm.htm#M10>\n        # self.after_cancel(self._tick_t)\n        v = self.videoPanel\n        if not _fullscreen(v):\n            self._isFull = _geometry1(v)\n            _fullscreen(v, True)  # or .wm_attributes\n            v.bind('<Escape>', self.OnFull)\n            f = _FULL_OFF\n        else:\n            _fullscreen(v, False)\n            v.unbind('<Escape>')\n            _geometry(v, self._isFull)\n            self._isFull = ''\n            self._anchorPanels()\n            f = _FULL_SCREEN\n        self.fullItem.config(label=f)\n\n    def OnMute(self, *unused):\n        '''Mute/Unmute audio.\n        '''\n        if self._stopped or self._opaque:\n            return  # button.disabled\n        self._debug(self.OnMute)\n        # audio un/mute may be unreliable, see vlc.py docs.\n        self._muted = m = not self._muted  # self.player.audio_get_mute()\n        self.player.audio_set_mute(m)\n        u = 'Unmute' if m else 'Mute'\n        # i = u.index('m' if m else 'M')  # 2 if m else 0\n        self.muteItem.config(label=u)\n        self.muteButton.config(label=u)  # width=len(u), underline=i\n        self.OnPercent()  # re-label the slider\n\n    def OnNormal(self, *unused):\n        '''Normal speed and 1X zoom.\n        '''\n        self._frontmost()\n        self._set_rate(0.0)\n        self._set_zoom(0.0)\n#       self._wiggle()\n        self._set_aspect_ratio(True)\n        self._debug(self.OnNormal)\n\n    def OnOpacity(self, *unused):\n        '''Use the percent slider to adjust the opacity.\n        '''\n        self.muteButton.disabled(True)  # greyed out?\n        self.muteItem.disabled(True)  # greyed out?\n        self._opaque = True\n        self._set_opacity()\n        self._debug(self.OnOpacity)\n\n    def OnOpacity100(self, *unused):\n        '''Set the opacity to 100%.\n        '''\n        self._frontmost()\n        self._set_opacity(100)\n        self._debug(self.OnOpacity100)\n\n    def OnOpen(self, *unused):\n        '''Show the file dialog to choose a video, then play it.\n        '''\n        self._debug(self.OnOpen)\n        self._reset()\n        # XXX ... +[CATransaction synchronize] called within transaction\n        v = askopenfilename(initialdir=os.path.expanduser('~'),\n                            title='Choose a video',\n                            filetypes=(('all files', '*.*'),\n                                       ('mp4 files', '*.mp4'),\n                                       ('mov files', '*.mov')))\n        self._play(os.path.expanduser(v))\n        self._set_aspect_ratio(True)\n\n    def OnPause(self, *unused):\n        '''Toggle between Pause and Play.\n        '''\n        self._debug(self.OnPause)\n        p = self.player\n        if p.get_media():\n            self._pause_play(not p.is_playing())\n#           self._wiggle()\n            p.pause()  # toggles\n\n    def OnPercent(self, *unused):\n        '''Percent slider changed, adjust the opacity or volume.\n        '''\n        self._debug(self.OnPercent)\n        s = max(0, min(100, self.percentSlider.get()))\n        if self._opaque or self._stopped:\n            self._set_opacity(s)\n        else:\n            self._set_volume(s)\n\n    def OnPlay(self, *unused):\n        '''Play video, if there's no video to play or\n           playing, show a Tk.FileDialog to select one\n        '''\n        self._debug(self.OnPlay)\n        p = self.player\n        m = p.get_media()\n        if not m:\n            if self.video:\n                self._play(self.video)\n                self.video = ''\n            else:\n                self.OnOpen()\n        elif p.play():  # == -1, play failed\n            self._showError('play ' + repr(m))\n        else:\n            self._pause_play(True)\n            if _isMacOS:\n                self._wiggle()\n\n    def OnSlower(self, *event):\n        '''Slow the video down by 20%.\n        '''\n        self._set_rate(0.80, *event)\n        self._debug(self.OnSlower)\n\n    def OnSnapshot(self, *unused):\n        '''Take a snapshot and save it (as .PNG only).\n        '''\n        p = self.player\n        if p and p.get_media():\n            self._snapshots += 1\n            S = 'Snapshot%s' % (self._snapshots,)\n            s = '%s-%s.PNG' % (self._title, S)  # PNG only\n            if p.video_take_snapshot(0, s, 0, 0):\n                self._showError('take ' + S)\n\n    def OnStop(self, *unused):\n        '''Stop the player, clear panel, etc.\n        '''\n        self._debug(self.OnStop)\n        self._reset()\n\n    def OnTick(self):\n        '''Udate the time slider with the video time.\n        '''\n        p = self.player\n        if p:\n            s = self.timeSlider\n            if self._length > 0:\n                if not self._sliding:  # see .OnTime\n                    t = max(0, p.get_time() // _TICK_MS)\n                    if t != s.get():\n                        s.set(t)\n                        self._set_buttons_title(t)\n            else:  # get video length in millisecs\n                t = p.get_length()\n                if t > 0:\n                    self._length = t = max(1, t // _TICK_MS)\n                    self._lengthstr = _hms(t, secs=' secs')\n                    s.config(to=t)  # tickinterval=t / 5)\n        # re-start the 1/4-second timer\n        self._tick_t = self.after(250, self.OnTick)\n\n    def OnTime(self, *unused):\n        '''Time slider has been moved by user.\n        '''\n        if self.player and self._length:\n            self._sliding = True  # slider moving, see .OnTick\n            self.after_cancel(self._tick_s)\n            t = self.timeSlider.get()\n            self._tick_s = self.after_idle(self._set_time, t * _TICK_MS)\n            self._set_buttons_title(t)\n            self._debug(self.OnTime, tensecs=t)\n\n    def OnZoomIn(self, *event):\n        '''Zoom in by 25%.\n        '''\n        self._set_zoom(1.25, *event)\n        self._debug(self.OnZoomIn)\n\n    def OnZoomOut(self, *event):\n        '''Zoom out by 20%.\n        '''\n        self._set_zoom(0.80, *event)\n        self._debug(self.OnZoomOut)\n\n    def _pause_play(self, playing):\n        # re-label menu item and button, adjust callbacks\n        p = 'Pause' if playing else 'Play'\n        c = self.OnPlay if playing is None else self.OnPause  # PYCHOK attr\n        self.playButton.config(label=p, command=c)\n        self.playItem.config(label=p, command=c)\n        self.muteButton.disabled(False)\n        self.muteItem.disabled(False)\n        self._stopped = self._opaque = False\n        self._set_buttons_title()\n        self._set_opacity()  # no re-label\n        self._set_volume()\n        self._set_aspect_ratio(True)\n\n    def _play(self, video):\n        # helper for OnOpen and OnPlay\n        if os.path.isfile(video):  # Creation\n            m = self.Instance.media_new(str(video))  # unicode\n            p = self.player\n            p.set_media(m)\n            t = '%s - %s' % (self._title, os.path.basename(video))\n            self.videoPanel.title(t)\n#           self.buttonsPanel.title(t)\n\n            # get the window handle for VLC to render the video\n            h = self.videoCanvas.winfo_id()  # .winfo_visualid()?\n            if _isWindows:\n                p.set_hwnd(h)\n            elif _isMacOS:\n                # (1) the handle on macOS *must* be an NSView\n                # (2) the video fills the entire panel, covering\n                # all frames, buttons, sliders, etc. inside it\n                ns = _GetNSView(h)\n                if ns:\n                    p.set_nsobject(ns)\n                else:  # no libtk: no video, only audio\n                    p.set_xwindow(h)\n            else:  # *nix, Xwindows\n                p.set_xwindow(h)  # fails on Windows\n            self.OnPlay(None)\n\n    def _reset(self):\n        # stop playing, clear panel\n        p = self.player\n        if p:\n            p.stop()\n            self.timeSlider.set(0)\n            self._pause_play(None)\n            self._sliding = False\n            self._stopped = True\n            self.OnOpacity()\n\n    def _set_aspect_ratio(self, force=False):\n        # set the video panel aspect ratio and re-anchor\n        p = self.player\n        if p and not self._isFull:\n            v = self.videoPanel\n            g, w, h, x, y = _geometry5(v)\n            if force or g != v._g:  # update\n                self.after_cancel(self._tick_a)\n                a, b = p.video_get_size(0)  # often (0, 0)\n                if b > 0 and a > 0:\n                    # adjust the video panel ...\n                    if a > b:  # ... landscape height\n                        h = round(float(w) * b / a)\n                    else:  # ... or portrait width\n                        w = round(float(h) * a / a)\n                    _g = _geometry(v, w, h, x, y)\n                    self._debug(self._set_aspect_ratio, a=a, b=b)\n                    if self._anchored and (force or _g != g):\n                        self._anchorPanels()\n                # redo periodically since (1) player.video_get_size()\n                # only returns non-zero width and height after playing\n                # for a while and (2) avoid too frequent updates during\n                # manual resizing of the video panel\n                self._tick_a = self.after(500, self._set_aspect_ratio)\n\n    def _set_buttons_title(self, *tensecs):\n        # set the buttons panel title\n        T, s = self._length, self._lengthstr\n        if s and T:\n            t =  tensecs[0] if tensecs else self.timeSlider.get()\n            t = _hms(t) if t < T else s\n            t = '%s - %s / %s%s%s' % (self._title, t, s, self._scaleXstr, self._ratestr)\n        else:  # reset panel title\n            t = '%s - %s' % (self._title, _BUTTONS)\n            self._length = 0\n#           self._lengthstr = ''\n        self.buttonsPanel.title(t)\n\n    def _set_opacity(self, *percent):  # 100% fully opaque\n        # set and re-label the opacity, panels and menu item\n        if percent:\n            self._opacity = p = percent[0]\n        else:\n            p = self._opacity\n        a = max(0.2, min(1, p * 1e-2))\n        self.videoPanel.attributes('-alpha', a if self._stopped else 1)\n        self.buttonsPanel.attributes('-alpha', a)\n#       if _isMacOS:  # <https://TkDocs.com/tutorial/windows.html>\n#           self.buttonsPanel.attributes('-transparent', a)\n        s = _OPACITY % (p,)\n        self.opaqueItem.config(label=s)\n        if self._opaque or self._stopped:\n            self._set_percent(p, label=s)\n\n    def _set_percent(self, percent, **cfg):\n        # set and re-label the slider\n        self.percentSlider.config(**cfg)\n        self.percentSlider.set(percent)\n\n    def _set_rate(self, factor, *event):\n        # change the video rate\n        p = self.player\n        self.after_cancel(self._tick_r)\n        if not event:  # delay the menu event as a false key event ...\n            # ... and possibly overwritten by the actual key event\n            self._tick_r = self.after(3, self._set_rate, factor, False)\n        elif p:\n            r = p.get_rate() * factor\n            if r > 0:\n                r = max(0.2, min(10.0, r))\n                t = ' - %d%%' % (int(r * 100),)\n            else:\n                r, t = 1.0, ''\n            p.set_rate(r)\n            self._rate = r\n            self._ratestr = t\n            self._set_buttons_title()\n\n    def _set_time(self, millisecs):\n        # set player to time\n        p = self.player\n        if p:\n            p.set_time(millisecs)\n        self._sliding = False  # see .OnTick\n\n    def _set_volume(self, *volume):\n        # set and re-label the volume\n        if volume:\n            self._volume = v = volume[0]\n        else:\n            v = self._volume\n        m = ' (Muted)' if self._muted else ''\n        V = '%s %s%%' % (_VOLUME, v)\n        self._set_percent(v, label=V + m)\n        p = self.player\n        if p and p.is_playing() and not self._stopped:\n            # .audio_set_volume returns 0 on success, -1 otherwise,\n            # e.g. if the player is stopped or doesn't have media\n            if p.audio_set_volume(v):  # and p.get_media():\n                self._showError('set ' + V)\n\n    def _set_zoom(self, factor, *event):\n        # zoom the video in/out, see cocoavlc.py\n        p = self.player\n        self.after_cancel(self._tick_z)\n        if not event:  # delay the menu event as a false key event ...\n            # ... and possibly overwritten by the actual key event\n            self._tick_z = self.after(3, self._set_zoom, factor, False)\n        elif p:\n            x = self._scaleX * factor\n            if x > 1:\n                s = x\n                t = ' - %.1fX' % (x,)\n            else:\n                x, s, t = 1, 0.0, ''\n            p.video_set_scale(s)\n#           self.videoPanel.update_idletasks()\n            self._scaleX = x\n            self._scaleXstr = t\n            self._set_buttons_title()\n\n    def _showError(self, verb):\n        '''Display a simple error dialog.\n        '''\n        t = 'Unable to %s' % (verb,)\n        showerror(self._title, t)\n        # sys.exit(t)\n\n    def _VideoPanel(self):\n        # create panel to play video\n        v = _Tk_Frame(self.parent)\n        c = _Tk_Canvas(v)  # takefocus=True\n        c.pack(fill=Tk.BOTH, expand=1)\n        v.pack(fill=Tk.BOTH, expand=1)\n        v.update_idletasks()\n\n        self.videoCanvas = c\n        self.videoFrame  = v\n        # root is used for updates, NOT ...\n        return self.parent  # ... the frame\n\n    def _wiggle(self, d=4):\n        # wiggle the video to fill the window on macOS\n        if not self._isFull:\n            v = self.videoPanel\n            g, w, h, x, y = _geometry5(v)\n            w = int(w) + d\n            # x = int(x) - d\n            # h = int(h) + d\n            if _geometry(v, w, h, x, y) != g:\n                self.after_idle(_geometry, v, g)\n        if d > 1:  # repeat a few times\n            self.after(100, self._wiggle, d - 1)\n\n\ndef print_version(name=''):  # imported by psgvlc.py\n    # show all versions, this module, tkinter, libtk, vlc.py, libvlc, etc.\n\n    # sample output on macOS:\n\n    # % python3 ./tkvlc.py -v\n    # tkvlc.py: 22.12.28\n    # tkinter: 8.6\n    # libTk: /Library/Frameworks/Python.framework/Versions/3.11/lib/libtk8.6.dylib\n    # is_TK: aqua, isAquaTk, isCocoaTk\n    # vlc.py: 3.0.12119 (Mon May 31 18:25:17 2021 3.0.12)\n    # libVLC: 3.0.16 Vetinari (0x3001000)\n    # plugins: /Applications/VLC.app/Contents/MacOS/plugins\n    # Python: 3.11.0 (64bit) macOS 13.0.1 arm64\n\n    # sample output on Windows:\n\n    # PS C: python3 .\\tkvlc.py -v\n    # tkvlc.py: 22.12.28\n    # tkinter: 8.6\n    # libTk: N/A\n    # is_TK: win32\n    # vlc.py: 3.0.12119 (Mon May 31 18:25:17 2021 3.0.12)\n    # libVLC: 3.0.18 Vetinari (0x3001200)\n    # plugins: C:\\Program Files\\VideoLAN\\VLC\n    # Python: 3.11.0 (64bit) Windows 10\n\n    # see <https://TkDocs.com/tutorial/menus.html> or private property\n    r = Tk.Tk()\n    t = r.tk.call('tk', 'windowingsystem'),  # r._windowingsystem\n    r.destroy()\n    if _isMacOS:\n        try:\n            from idlelib import macosx\n            m  = macosx.__dict__\n            t += tuple(sorted(n for n, t in m.items() if n.startswith('is') and\n                                                         n.endswith('Tk') and\n                                                         callable(t) and t()))\n        except ImportError:  # Python 10: no test.support ...\n            pass\n    t = ', '.join(t) or 'N/A'\n\n    n = os.path.basename(name or __file__)\n    for t in ((n, __version__), (Tk.__name__, _Tk_Version), ('libTk', libtk), ('is_Tk', t)):\n        print('%s: %s' % t)\n\n    try:\n        vlc.print_version()\n        vlc.print_python()\n    except AttributeError:\n        try:\n            os.system(sys.executable + ' -m vlc -v')\n        except OSError:\n            pass\n\n\nif __name__ == '__main__':  # MCCABE 13\n\n    _argv0 = sys.argv[0]\n    _debug = False\n    _video = ''\n\n    while len(sys.argv) > 1:\n        arg = sys.argv.pop(1)\n        if arg in ('-v', '--version'):\n            print_version()\n            sys.exit(0)\n        elif '-debug'.startswith(arg) and len(arg) > 3:\n            _debug = True\n        elif arg.startswith('-'):\n            print('usage: %s  [-v | --version]  [-debug]  [<video_file_name>]' % (_argv0,))\n            sys.exit(1)\n        elif arg:  # video file\n            _video = os.path.expanduser(arg)\n            if not os.path.isfile(_video):\n                print('%s error, no such file: %r' % (_argv0, arg))\n                sys.exit(1)\n\n    root = Tk.Tk()  # create a Tk.App()\n    player = Player(root, video=_video, debug=_debug)\n    if _isWindows:  # see function _test() at the bottom of ...\n        # <https://GitHub.com/python/cpython/blob/3.11/Lib/tkinter/__init__.py>\n        root.iconify()\n        root.update()\n        root.deiconify()\n        root.mainloop()  # forever\n        root.destroy()  # this is necessary on Windows to avoid ...\n        # ... Fatal Python Error: PyEval_RestoreThread: NULL tstate\n    else:\n        root.mainloop()  # forever\n"
  },
  {
    "path": "examples/video_sync/README.md",
    "content": "## Video Synchronization with python-vlc\n\n<img src=\"figure.png\" width=\"600\" align=\"center\">\n\nEach 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.\n\nIn 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.\n\nIn 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.\n\nNote: for the sake of clarity, the figure only shows the case of 3 client/slave videos.\n"
  },
  {
    "path": "examples/video_sync/main.py",
    "content": "#! /usr/bin/env python3\n#\n# PyQt5-based video-sync example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"\nA VLC python bindings player implemented with PyQt5 that is meant to be utilized\nas the \"master\" player that controls all \"slave players\".\n\nAuthor: Saveliy Yusufov, Columbia University, sy2685@columbia.edu\nDate: 25 January 2019\n\"\"\"\n\nimport platform\nimport queue\nimport os\nimport subprocess\nimport sys\n\nfrom PyQt5 import QtWidgets, QtGui, QtCore\nimport vlc\nfrom network import Server\n\n\nclass Player(QtWidgets.QMainWindow):\n    \"\"\"A \"master\" Media Player using VLC and Qt\n    \"\"\"\n\n    def __init__(self, master=None):\n        QtWidgets.QMainWindow.__init__(self, master)\n        self.setWindowTitle(\"Main Media Player\")\n\n        # Create a basic vlc instance\n        self.instance = vlc.Instance()\n\n        self.media = None\n\n        # Create an empty vlc media player\n        self.mediaplayer = self.instance.media_player_new()\n\n        self.create_ui()\n        self.data_queue = queue.Queue()\n        self.is_paused = False\n\n        self.timer = QtCore.QTimer(self)\n        self.timer.setInterval(100)\n        self.timer.timeout.connect(self.update_ui)\n        self.timer.timeout.connect(self.update_time_label)\n\n    def create_ui(self):\n        \"\"\"Set up the user interface, signals & slots\n        \"\"\"\n        self.widget = QtWidgets.QWidget(self)\n        self.setCentralWidget(self.widget)\n\n        # In this widget, the video will be drawn\n        if platform.system() == \"Darwin\":  # for MacOS\n            self.videoframe = QtWidgets.QMacCocoaViewContainer(0)\n        else:\n            self.videoframe = QtWidgets.QFrame()\n\n        self.palette = self.videoframe.palette()\n        self.palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 0))\n        self.videoframe.setPalette(self.palette)\n        self.videoframe.setAutoFillBackground(True)\n\n        # Create the time display\n        self.timelabel = QtWidgets.QLabel(\"00:00:00\", self)\n\n        # Create the position slider (QSlider)\n        self.positionslider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)\n        self.positionslider.setToolTip(\"Position\")\n        self.positionslider.setMaximum(1000)\n        self.positionslider.sliderMoved.connect(self.set_position)\n        # self.positionslider.sliderPressed.connect(self.set_position)\n        self.positionslider.sliderMoved.connect(self.update_time_label)\n\n        # Create the \"previous frame\" button\n        self.previousframe = QtWidgets.QPushButton()\n        self.previousframe.setFixedWidth(25)\n        self.previousframe.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSkipBackward))\n        self.previousframe.clicked.connect(self.on_previous_frame)\n\n        # Create the play button and connect it to the play/pause function\n        self.playbutton = QtWidgets.QPushButton()\n        self.playbutton.setFixedWidth(40)\n        self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPlay))\n        self.playbutton.clicked.connect(self.play_pause)\n\n        # Create the \"next frame\" button\n        self.nextframe = QtWidgets.QPushButton()\n        self.nextframe.setFixedWidth(25)\n        self.nextframe.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSkipForward))\n        self.nextframe.clicked.connect(self.on_next_frame)\n\n        # Create the \"Playback rate\" label\n        self.pb_rate_label = QtWidgets.QLabel(\"Playback rate: {}x\".format(self.mediaplayer.get_rate()), self)\n\n        # Create the \"decrease playback rate\" button\n        self.decr_pb_rate = QtWidgets.QPushButton()\n        self.decr_pb_rate.setFixedWidth(30)\n        self.decr_pb_rate.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSeekBackward))\n        self.decr_pb_rate.clicked.connect(self.decr_mov_play_rate)\n\n        # Create the stop button and connect it to the stop function\n        self.stopbutton = QtWidgets.QPushButton()\n        self.stopbutton.setFixedWidth(30)\n        self.stopbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaStop))\n        self.stopbutton.clicked.connect(self.stop)\n\n        # Create the \"increase playback rate\" button\n        self.incr_pb_rate = QtWidgets.QPushButton()\n        self.incr_pb_rate.setFixedWidth(30)\n        self.incr_pb_rate.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSeekForward))\n        self.incr_pb_rate.clicked.connect(self.incr_mov_play_rate)\n\n        self.top_control_box = QtWidgets.QHBoxLayout()\n\n        # Add the time and position slider to the 1st controls layout\n        self.top_control_box.addWidget(self.timelabel)\n        self.top_control_box.addWidget(self.positionslider)\n\n        self.bottom_control_box = QtWidgets.QHBoxLayout()\n\n        # Add the buttons to the 2nd controls layout\n        self.bottom_control_box.addWidget(self.previousframe)\n        self.bottom_control_box.addWidget(self.playbutton)\n        self.bottom_control_box.addWidget(self.nextframe)\n        self.bottom_control_box.addWidget(self.pb_rate_label)\n        self.bottom_control_box.addWidget(self.decr_pb_rate)\n        self.bottom_control_box.addWidget(self.stopbutton)\n        self.bottom_control_box.addWidget(self.incr_pb_rate)\n\n        self.vboxlayout = QtWidgets.QVBoxLayout()\n\n        self.vboxlayout.addWidget(self.videoframe)\n        self.vboxlayout.addLayout(self.top_control_box)\n        self.vboxlayout.addLayout(self.bottom_control_box)\n\n        self.widget.setLayout(self.vboxlayout)\n\n        menu_bar = self.menuBar()\n\n        # File menu\n        file_menu = menu_bar.addMenu(\"File\")\n\n        # Create submenu to start new processes from file menu\n        new_menu = QtWidgets.QMenu(\"Launch\", self)\n        file_menu.addMenu(new_menu)\n        new_video_action = QtWidgets.QAction(\"New Video\", self)\n        new_menu.addAction(new_video_action)\n        new_video_action.triggered.connect(on_new_video)\n\n        # Create actions to load a new media file and to close the app\n        open_action = QtWidgets.QAction(\"Load Video\", self)\n        close_action = QtWidgets.QAction(\"Close App\", self)\n        file_menu.addAction(open_action)\n        file_menu.addAction(close_action)\n        open_action.triggered.connect(self.open_file)\n        close_action.triggered.connect(sys.exit)\n\n    def play_pause(self):\n        \"\"\"Toggle play/pause status\n        \"\"\"\n        if self.mediaplayer.is_playing():\n            signal = 'p'\n            self.mediaplayer.pause()\n            self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPlay))\n            self.is_paused = True\n            self.timer.stop()\n        else:\n            if self.mediaplayer.play() == -1:\n                self.open_file()\n                return\n\n            signal = 'P'\n            self.mediaplayer.play()\n            self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPause))\n            self.timer.start()\n            self.is_paused = False\n\n        # Reset the queue & send the appropriate signal, i.e., play/pause\n        self.data_queue.queue.clear()\n        self.data_queue.put('d')\n        self.data_queue.put(signal)\n\n    def stop(self):\n        \"\"\"Stop player\n        \"\"\"\n        self.mediaplayer.stop()\n        self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPlay))\n\n        # Reset the time label back to 00:00:00\n        time = QtCore.QTime(0, 0, 0, 0)\n        self.timelabel.setText(time.toString())\n\n        # Reset the queue\n        self.data_queue.queue.clear()\n        self.data_queue.put('d')\n        self.data_queue.put('S')\n\n        # Reset the media position slider\n        self.positionslider.setValue(0)\n\n        self.timer.stop()\n\n    def on_next_frame(self):\n        \"\"\"Go forward one frame.\n\n            The Python VLC binding next_frame function causes a:\n\n            \"direct3d11 vout display error: SetThumbNailClip failed\"\n\n            error when next_frame is called while the video is playing,\n            so we are using our own fucntion to get the next frame.\n        \"\"\"\n        # self.mediaplayer.next_frame()\n        next_frame_time = self.mediaplayer.get_time() + self.mspf()\n\n        # Reset the queue & put the next frame's time into the queue\n        self.data_queue.queue.clear()\n        self.data_queue.put('d')\n        self.data_queue.put(next_frame_time)\n        self.update_time_label()\n        self.mediaplayer.set_time(next_frame_time)\n\n    def on_previous_frame(self):\n        \"\"\"Go backward one frame\"\"\"\n        next_frame_time = self.mediaplayer.get_time() - self.mspf()\n\n        # Reset the queue & put the next frame's time into the queue\n        self.data_queue.queue.clear()\n        self.data_queue.put('d')\n        self.data_queue.put(next_frame_time)\n        self.update_time_label()\n        self.mediaplayer.set_time(next_frame_time)\n\n    def mspf(self):\n        \"\"\"Milliseconds per frame\"\"\"\n        return int(1000 // (self.mediaplayer.get_fps() or 25))\n\n    def incr_mov_play_rate(self):\n        \"\"\"Increase the movie play rate by a factor of 2.\"\"\"\n        if self.mediaplayer.get_rate() >= 64:\n            return\n\n        rate = self.mediaplayer.get_rate() * 2\n        result = self.mediaplayer.set_rate(rate)\n        if result == 0:\n            self.data_queue.queue.clear()\n            self.data_queue.put('d')\n            self.data_queue.put('>')\n            self.update_pb_rate_label()\n\n    def decr_mov_play_rate(self):\n        \"\"\"Decrease the movie play rate by a factor of 2.\"\"\"\n        if self.mediaplayer.get_rate() <= 0.125:\n            return\n\n        rate = self.mediaplayer.get_rate() * 0.5\n        result = self.mediaplayer.set_rate(rate)\n        if result == 0:\n            self.data_queue.queue.clear()\n            self.data_queue.put('d')\n            self.data_queue.put('<')\n            self.update_pb_rate_label()\n\n    def open_file(self):\n        \"\"\"Open a media file in a MediaPlayer\n        \"\"\"\n        dialog_txt = \"Choose Media File\"\n        filename = QtWidgets.QFileDialog.getOpenFileName(self, dialog_txt, os.path.expanduser('~'))\n        if not filename[0]:\n            return\n\n        # getOpenFileName returns a tuple, so use only the actual file name\n        self.media = self.instance.media_new(filename[0])\n\n        # Put the media in the media player\n        self.mediaplayer.set_media(self.media)\n\n        # Parse the metadata of the file\n        self.media.parse()\n\n        # Set the title of the track as window title\n        self.setWindowTitle(\"Main Media Player: {}\".format(self.media.get_meta(0)))\n\n        # The media player has to be 'connected' to the QFrame (otherwise the\n        # video would be displayed in it's own window). This is platform\n        # specific, so we must give the ID of the QFrame (or similar object) to\n        # vlc. Different platforms have different functions for this.\n        if platform.system() == \"Linux\":  # for Linux using the X Server\n            self.mediaplayer.set_xwindow(int(self.videoframe.winId()))\n        elif platform.system() == \"Windows\":  # for Windows\n            self.mediaplayer.set_hwnd(int(self.videoframe.winId()))\n        elif platform.system() == \"Darwin\":  # for MacOS\n            self.mediaplayer.set_nsobject(int(self.videoframe.winId()))\n\n        self.play_pause()\n\n    def set_position(self):\n        \"\"\"Set the movie position according to the position slider.\n\n        The vlc MediaPlayer needs a float value between 0 and 1, Qt uses\n        integer variables, so you need a factor; the higher the factor,\n        the more precise are the results (1000 should suffice).\n        \"\"\"\n        # Set the media position to where the slider was dragged\n        self.timer.stop()\n        pos = self.positionslider.value()\n\n        if pos >= 0:\n            self.data_queue.queue.clear()\n            self.data_queue.put('d')\n            current_time = self.mediaplayer.get_time()\n\n            # If the player is stopped, do not attempt to send a -1!!!\n            if current_time == -1:\n                self.timer.start()\n                return\n            self.data_queue.put(current_time)\n\n        self.mediaplayer.set_position(pos * .001)\n        self.timer.start()\n\n    def update_ui(self):\n        \"\"\"Updates the user interface\"\"\"\n\n        # Set the slider's position to its corresponding media position\n        # Note that the setValue function only takes values of type int,\n        # so we must first convert the corresponding media position.\n        media_pos = int(self.mediaplayer.get_position() * 1000)\n        self.positionslider.setValue(media_pos)\n\n        if media_pos >= 0 and self.mediaplayer.is_playing():\n            current_time = self.mediaplayer.get_time()\n            self.data_queue.put(current_time)\n        else:\n            self.data_queue.queue.clear()\n\n        # No need to call this function if nothing is played\n        if not self.mediaplayer.is_playing():\n            self.timer.stop()\n\n            # After the video finished, the play button stills shows \"Pause\",\n            # which is not the desired behavior of a media player.\n            # This fixes that \"bug\".\n            if not self.is_paused:\n                self.stop()\n\n    def update_time_label(self):\n        mtime = QtCore.QTime(0, 0, 0, 0)\n        self.time = mtime.addMSecs(self.mediaplayer.get_time())\n        self.timelabel.setText(self.time.toString())\n\n    def update_pb_rate_label(self):\n        self.pb_rate_label.setText(\"Playback rate: {}x\".format(str(self.mediaplayer.get_rate())))\n\n\ndef on_new_video():\n    \"\"\"Launches a new PyQt5-based \"mini\" media player\n    \"\"\"\n    if platform.system() == \"Windows\":\n        subprocess.Popen([\"python\", \"mini_player.py\"], shell=True)\n    else:\n        subprocess.Popen([\"python\", \"mini_player.py\"])\n\n\ndef main():\n    \"\"\"Entry point for our simple vlc player\n    \"\"\"\n    app = QtWidgets.QApplication(sys.argv)\n    player = Player()\n\n    _ = Server(\"localhost\", 10000, player.data_queue)\n\n    player.show()\n    player.resize(640, 480)\n    sys.exit(app.exec_())\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "examples/video_sync/mini_player.py",
    "content": "#! /usr/bin/env python3\n#\n# PyQt5-based video-sync example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"\nThis module contains a bare-bones VLC player class to play videos.\n\nAuthor: Saveliy Yusufov, Columbia University, sy2685@columbia.edu\nDate: 25 January 2019\n\"\"\"\n\nimport os\nimport sys\nimport queue\nimport platform\n\nfrom PyQt5 import QtWidgets, QtGui, QtCore\nimport vlc\nfrom network import Client\n\n\nclass MiniPlayer(QtWidgets.QMainWindow):\n    \"\"\"Stripped-down PyQt5-based media player class to sync with \"master\" video.\n    \"\"\"\n\n    def __init__(self, data_queue, master=None):\n        QtWidgets.QMainWindow.__init__(self, master)\n        self.setWindowTitle(\"Mini Player\")\n        self.statusbar = self.statusBar()\n        self.statusbar.showMessage(\"Ready\")\n\n        # Create a basic vlc instance\n        self.instance = vlc.Instance()\n\n        self.media = None\n\n        # Create an empty vlc media player\n        self.mediaplayer = self.instance.media_player_new()\n\n        self.init_ui()\n        self.open_file()\n\n        self.timer = QtCore.QTimer(self)\n        self.timer.setInterval(10)\n        self.timer.timeout.connect(self.update_ui)\n\n        self.data_queue = data_queue\n        self.timer.start()\n\n    def init_ui(self):\n        \"\"\"Set up the user interface\n        \"\"\"\n        self.widget = QtWidgets.QWidget(self)\n        self.setCentralWidget(self.widget)\n\n        # In this widget, the video will be drawn\n        if platform.system() == \"Darwin\":  # for MacOS\n            self.videoframe = QtWidgets.QMacCocoaViewContainer(0)\n        else:\n            self.videoframe = QtWidgets.QFrame()\n\n        self.palette = self.videoframe.palette()\n        self.palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 0))\n        self.videoframe.setPalette(self.palette)\n        self.videoframe.setAutoFillBackground(True)\n\n        self.vboxlayout = QtWidgets.QVBoxLayout()\n        self.vboxlayout.addWidget(self.videoframe)\n        self.widget.setLayout(self.vboxlayout)\n\n    def open_file(self):\n        \"\"\"Open a media file in a MediaPlayer\n        \"\"\"\n        dialog_txt = \"Choose Media File\"\n        filename = QtWidgets.QFileDialog.getOpenFileName(self, dialog_txt, os.path.expanduser('~'))\n        if not filename[0]:\n            return\n\n        # getOpenFileName returns a tuple, so use only the actual file name\n        self.media = self.instance.media_new(filename[0])\n\n        # Put the media in the media player\n        self.mediaplayer.set_media(self.media)\n\n        # Parse the metadata of the file\n        self.media.parse()\n\n        # Set the title of the track as the window title\n        self.setWindowTitle(\"{}\".format(self.media.get_meta(0)))\n\n        # The media player has to be 'connected' to the QFrame (otherwise the\n        # video would be displayed in it's own window). This is platform\n        # specific, so we must give the ID of the QFrame (or similar object) to\n        # vlc. Different platforms have different functions for this\n        if platform.system() == \"Linux\":  # for Linux using the X Server\n            self.mediaplayer.set_xwindow(int(self.videoframe.winId()))\n        elif platform.system() == \"Windows\":  # for Windows\n            self.mediaplayer.set_hwnd(int(self.videoframe.winId()))\n        elif platform.system() == \"Darwin\":  # for MacOS\n            self.mediaplayer.set_nsobject(int(self.videoframe.winId()))\n\n        # Start playing the video as soon as it loads\n        self.mediaplayer.play()\n\n    def update_ui(self):\n        self.update_statusbar()\n\n        try:\n            val = self.data_queue.get(block=False)\n        except queue.Empty:\n            return\n\n        if val == '<':\n            self.mediaplayer.set_rate(self.mediaplayer.get_rate() * 0.5)\n            return\n        if val == '>':\n            self.mediaplayer.set_rate(self.mediaplayer.get_rate() * 2)\n            return\n        if val == 'P':\n            self.mediaplayer.play()\n            return\n        if val == 'p':\n            self.mediaplayer.pause()\n            return\n        if val == 'S':\n            self.mediaplayer.stop()\n            return\n\n        val = int(val)\n        if val != self.mediaplayer.get_time():\n            self.mediaplayer.set_time(val)\n\n    def update_statusbar(self):\n        mtime = QtCore.QTime(0, 0, 0, 0)\n        time = mtime.addMSecs(self.mediaplayer.get_time())\n        self.statusbar.showMessage(time.toString())\n\n\ndef main():\n    \"\"\"Entry point for our simple vlc player\n    \"\"\"\n    app = QtWidgets.QApplication(sys.argv)\n\n    data_queue = queue.Queue()\n\n    player = MiniPlayer(data_queue)\n    player.show()\n    player.resize(480, 480)\n\n    _ = Client(\"localhost\", 10000, data_queue)\n    sys.exit(app.exec_())\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "examples/video_sync/network.py",
    "content": "#\n# PyQt5-based video-sync example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"\nThe client/server classes that keep multiple VLC python bindings players\nsynchronized.\n\nAuthor: Saveliy Yusufov, Columbia University, sy2685@columbia.edu\nDate: 25 January 2019\n\"\"\"\n\nimport os\nimport platform\nimport socket\nimport sys\nimport struct\nimport threading\nimport logging\nfrom concurrent import futures\n\nlogger = logging.getLogger(__name__)\nlogger.setLevel(logging.DEBUG)\n\nlogger.setLevel(logging.DEBUG)\n\n# create console handler and set level to debug\nch = logging.StreamHandler()\nch.setLevel(logging.DEBUG)\n\n# create formatter\nformatter = logging.Formatter(\"%(asctime)s - %(name)s - %(levelname)s - %(message)s\")\n\n# add formatter to ch\nch.setFormatter(formatter)\n\n# add ch to logger\nlogger.addHandler(ch)\n\n\nclass Server:\n    \"\"\"Data sender server\"\"\"\n\n    def __init__(self, host, port, data_queue):\n\n        if platform.system() == \"Windows\":\n\n            # Create a TCP/IP socket\n            self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\n            # Bind the socket to the port\n            logger.info(\"Server started on %s port %s\", host, port)\n            self.sock.bind((host, port))\n\n        else:\n            server_address = \"./uds_socket\"\n\n            # Make sure the socket does not already exist\n            try:\n                os.unlink(server_address)\n            except OSError:\n                if os.path.exists(server_address):\n                    raise\n\n            # Create a UDS socket\n            self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\n\n            # Bind the socket to the address\n            logger.info(\"Server starting up on %s\", server_address)\n            self.sock.bind(server_address)\n\n        # Listen for incoming connections\n        self.sock.listen(5)\n\n        self.clients = set()\n        self.data_queue = data_queue\n        listener_thread = threading.Thread(target=self.listen_for_clients, args=())\n        listener_thread.daemon = True\n        listener_thread.start()\n\n    def listen_for_clients(self):\n        logger.info(\"Now listening for clients\")\n        t = threading.Thread(target=self.data_sender, args=())\n        t.daemon = True\n        t.start()\n\n        while True:\n            client, _ = self.sock.accept()\n            logger.info(\"Accepted Connection from: %s\", client)\n            self.clients.add(client)\n\n    def data_sender(self):\n        while True:\n            data = self.data_queue.get()\n            data = str(data).encode()\n            msg = struct.pack(\">I\", len(data)) + data\n\n            with futures.ThreadPoolExecutor(max_workers=5) as ex:\n                for client in self.clients:\n                    ex.submit(self.sendall, client, msg)\n\n    def sendall(self, client, data):\n        \"\"\"Wraps socket module's `sendall` function\"\"\"\n        try:\n            client.sendall(data)\n        except socket.error:\n            logger.exception(\"Connection to client: %s was broken!\", client)\n            client.close()\n            self.clients.remove(client)\n\n\nclass Client:\n    \"\"\"Data receiver client\"\"\"\n\n    def __init__(self, address, port, data_queue):\n        self.data_queue = data_queue\n\n        if platform.system() == \"Windows\":\n\n            # Create a TCP/IP socket\n            self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\n            # Connect the socket to the port where the server is listening\n            logger.info(\"Connecting to %s port %s\", address, port)\n            self.sock.connect((address, port))\n        else:\n\n            # Create a UDS socket\n            self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\n\n            # Connect the socket to the port where the server is listening\n            server_address = \"./uds_socket\"\n            logger.info(\"New client connecting to %s\", server_address)\n\n            try:\n                self.sock.connect(server_address)\n            except socket.error:\n                logger.exception()\n                sys.exit(1)\n\n        thread = threading.Thread(target=self.data_receiver, args=())\n        thread.daemon = True\n        thread.start()\n\n    def recv_all(self, size):\n        \"\"\"Helper function to recv `size` number of bytes, or return False\"\"\"\n        data = bytearray()\n\n        while (len(data) < size):\n            packet = self.sock.recv(size - len(data))\n            if not packet:\n                return False\n\n            data.extend(packet)\n\n        return data\n\n    def recv_msg(self):\n        \"\"\"Receive the message size, n, and receive n bytes into a buffer\"\"\"\n        raw_msg_size = self.recv_all(4)\n        if not raw_msg_size:\n            return False\n\n        msg_size = struct.unpack(\">I\", raw_msg_size)[0]\n        return self.recv_all(msg_size)\n\n    def data_receiver(self):\n        \"\"\"Handles receiving, parsing, and queueing data\"\"\"\n        logger.info(\"New data receiver thread started.\")\n\n        try:\n            while True:\n                raw_data = self.recv_msg()\n                if raw_data:\n                    data = raw_data.decode()\n                    if 'd' in set(data):\n                        self.data_queue.queue.clear()\n                        continue\n                    else:\n                        self.data_queue.put(data)\n        except:\n            logger.exception(\"Closing socket: %s\", self.sock)\n            self.sock.close()\n            return\n"
  },
  {
    "path": "examples/wxvlc.py",
    "content": "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# <https://github.com/oaubert/python-vlc/blob/master/examples/wxvlc.py>\n#\n# WX example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"\nA simple example for VLC python bindings using wxPython.\n\nAuthor: Michele Orrù\nDate: 23-11-2010\n\"\"\"\n\n# Tested with Python 3.7.4, wxPython 4.0.6 on macOS 10.13.6 only.\n__version__ = '19.07.28'  # mrJean1 at Gmail dot com\n\n# import external libraries\nimport wx  # 2.8 ... 4.0.6\nimport vlc\n\n# import standard libraries\nfrom os.path import basename, expanduser, isfile, join as joined\nimport sys\n\ntry:\n    unicode        # Python 2\nexcept NameError:\n    unicode = str  # Python 3\n\n\nclass Player(wx.Frame):\n    \"\"\"The main window has to deal with events.\n    \"\"\"\n    def __init__(self, title='', video=''):\n        wx.Frame.__init__(self, None, -1, title=title or 'wxVLC',\n                          pos=wx.DefaultPosition, size=(550, 500))\n\n        self.video = video\n\n        # Menu Bar\n        #   File Menu\n        self.frame_menubar = wx.MenuBar()\n        self.file_menu = wx.Menu()\n        self.file_menu.Append(1, \"&Open...\", \"Open from file...\")\n        self.file_menu.AppendSeparator()\n        self.file_menu.Append(2, \"&Close\", \"Quit\")\n        self.Bind(wx.EVT_MENU, self.OnOpen, id=1)\n        self.Bind(wx.EVT_MENU, self.OnExit, id=2)\n        self.frame_menubar.Append(self.file_menu, \"File\")\n        self.SetMenuBar(self.frame_menubar)\n\n        # Panels\n        # The first panel holds the video and it's all black\n        self.videopanel = wx.Panel(self, -1)\n        self.videopanel.SetBackgroundColour(wx.BLACK)\n\n        # The second panel holds controls\n        ctrlpanel = wx.Panel(self, -1)\n        self.timeslider = wx.Slider(ctrlpanel, -1, 0, 0, 1000)\n        self.timeslider.SetRange(0, 1000)\n        self.pause = wx.Button(ctrlpanel, label=\"Pause\")\n        self.pause.Disable()\n        self.play = wx.Button(ctrlpanel, label=\"Play\")\n        self.stop = wx.Button(ctrlpanel, label=\"Stop\")\n        self.stop.Disable()\n        self.mute = wx.Button(ctrlpanel, label=\"Mute\")\n        self.volslider = wx.Slider(ctrlpanel, -1, 0, 0, 100, size=(100, -1))\n\n        # Bind controls to events\n        self.Bind(wx.EVT_BUTTON, self.OnPlay,   self.play)\n        self.Bind(wx.EVT_BUTTON, self.OnPause,  self.pause)\n        self.Bind(wx.EVT_BUTTON, self.OnStop,   self.stop)\n        self.Bind(wx.EVT_BUTTON, self.OnMute,   self.mute)\n        self.Bind(wx.EVT_SLIDER, self.OnVolume, self.volslider)\n\n        # Give a pretty layout to the controls\n        ctrlbox = wx.BoxSizer(wx.VERTICAL)\n        box1 = wx.BoxSizer(wx.HORIZONTAL)\n        box2 = wx.BoxSizer(wx.HORIZONTAL)\n        # box1 contains the timeslider\n        box1.Add(self.timeslider, 1)\n        # box2 contains some buttons and the volume controls\n        box2.Add(self.play, flag=wx.RIGHT, border=5)\n        box2.Add(self.pause)\n        box2.Add(self.stop)\n        box2.Add((-1, -1), 1)\n        box2.Add(self.mute)\n        box2.Add(self.volslider, flag=wx.TOP | wx.LEFT, border=5)\n        # Merge box1 and box2 to the ctrlsizer\n        ctrlbox.Add(box1, flag=wx.EXPAND | wx.BOTTOM, border=10)\n        ctrlbox.Add(box2, 1, wx.EXPAND)\n        ctrlpanel.SetSizer(ctrlbox)\n        # Put everything togheter\n        sizer = wx.BoxSizer(wx.VERTICAL)\n        sizer.Add(self.videopanel, 1, flag=wx.EXPAND)\n        sizer.Add(ctrlpanel, flag=wx.EXPAND | wx.BOTTOM | wx.TOP, border=10)\n        self.SetSizer(sizer)\n        self.SetMinSize((350, 300))\n\n        # finally create the timer, which updates the timeslider\n        self.timer = wx.Timer(self)\n        self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)\n\n        # VLC player controls\n        self.Instance = vlc.Instance()\n        self.player = self.Instance.media_player_new()\n\n    def OnExit(self, evt):\n        \"\"\"Closes the window.\n        \"\"\"\n        self.Close()\n\n    def OnOpen(self, evt):\n        \"\"\"Pop up a new dialow window to choose a file, then play the selected file.\n        \"\"\"\n        # if a file is already running, then stop it.\n        self.OnStop(None)\n\n        video = self.video\n        if video:\n            self.video = ''\n        else:  # Create a file dialog opened in the current home directory,\n            # to show all kind of files, having as title \"Choose a ...\".\n            dlg = wx.FileDialog(self, \"Choose a video file\", expanduser('~'),\n                                      \"\", \"*.*\", wx.FD_OPEN)  # XXX wx.OPEN\n            if dlg.ShowModal() == wx.ID_OK:\n                video = joined(dlg.GetDirectory(), dlg.GetFilename())\n            # finally destroy the dialog\n            dlg.Destroy()\n\n        if isfile(video):  # Creation\n            self.Media = self.Instance.media_new(unicode(video))\n            self.player.set_media(self.Media)\n            # Report the title of the file chosen\n            title = self.player.get_title()\n            # if an error was encountred while retrieving the title,\n            # otherwise use filename\n            self.SetTitle(\"%s - %s\" % (title if title != -1 else 'wxVLC', basename(video)))\n\n            # set the window id where to render VLC's video output\n            handle = self.videopanel.GetHandle()\n            if sys.platform.startswith('linux'):  # for Linux using the X Server\n                self.player.set_xwindow(handle)\n            elif sys.platform == \"win32\":  # for Windows\n                self.player.set_hwnd(handle)\n            elif sys.platform == \"darwin\":  # for MacOS\n                self.player.set_nsobject(handle)\n            self.OnPlay(None)\n\n            # set the volume slider to the current volume\n            self.volslider.SetValue(self.player.audio_get_volume() / 2)\n\n    def OnPlay(self, evt):\n        \"\"\"Toggle the status to Play/Pause.\n\n        If no file is loaded, open the dialog window.\n        \"\"\"\n        # check if there is a file to play, otherwise open a\n        # wx.FileDialog to select a file\n        if not self.player.get_media():\n            self.OnOpen(None)\n            # Try to launch the media, if this fails display an error message\n        elif self.player.play():  # == -1:\n            self.errorDialog(\"Unable to play.\")\n        else:\n            # adjust window to video aspect ratio\n            # w, h = self.player.video_get_size()\n            # if h > 0 and w > 0:  # often (0, 0)\n            #     self.videopanel....\n            self.timer.Start(1000)  # XXX millisecs\n            self.play.Disable()\n            self.pause.Enable()\n            self.stop.Enable()\n\n    def OnPause(self, evt):\n        \"\"\"Pause the player.\n        \"\"\"\n        if self.player.is_playing():\n            self.play.Enable()\n            self.pause.Disable()\n        else:\n            self.play.Disable()\n            self.pause.Enable()\n        self.player.pause()\n\n    def OnStop(self, evt):\n        \"\"\"Stop the player.\n        \"\"\"\n        self.player.stop()\n        # reset the time slider\n        self.timeslider.SetValue(0)\n        self.timer.Stop()\n        self.play.Enable()\n        self.pause.Disable()\n        self.stop.Disable()\n\n    def OnTimer(self, evt):\n        \"\"\"Update the time slider according to the current movie time.\n        \"\"\"\n        # since the self.player.get_length can change while playing,\n        # re-set the timeslider to the correct range.\n        length = self.player.get_length()\n        self.timeslider.SetRange(-1, length)\n\n        # update the time on the slider\n        time = self.player.get_time()\n        self.timeslider.SetValue(time)\n\n    def OnMute(self, evt):\n        \"\"\"Mute/Unmute according to the audio button.\n        \"\"\"\n        muted = self.player.audio_get_mute()\n        self.player.audio_set_mute(not muted)\n        self.mute.SetLabel(\"Mute\" if muted else \"Unmute\")\n        # update the volume slider;\n        # since vlc volume range is in [0, 200],\n        # and our volume slider has range [0, 100], just divide by 2.\n        # self.volslider.SetValue(self.player.audio_get_volume() / 2)\n\n    def OnVolume(self, evt):\n        \"\"\"Set the volume according to the volume sider.\n        \"\"\"\n        volume = self.volslider.GetValue() * 2\n        # vlc.MediaPlayer.audio_set_volume returns 0 if success, -1 otherwise\n        if self.player.audio_set_volume(volume) == -1:\n            self.errorDialog(\"Failed to set volume\")\n\n    def errorDialog(self, errormessage):\n        \"\"\"Display a simple error dialog.\n        \"\"\"\n        edialog = wx.MessageDialog(self, errormessage, 'Error', wx.OK|\n                                                                wx.ICON_ERROR)\n        edialog.ShowModal()\n\n\nif __name__ == \"__main__\":\n\n    _video = ''\n\n    while len(sys.argv) > 1:\n        arg = sys.argv.pop(1)\n        if arg.lower() in ('-v', '--version'):\n            # show all versions, sample output on macOS:\n            # % python3 ./wxvlc.py -v\n            # wxvlc.py: 19.07.28 (wx 4.0.6 osx-cocoa (phoenix) wxWidgets 3.0.5 _core.cpython-37m-darwin.so)\n            # vlc.py: 3.0.6109 (Sun Mar 31 20:14:16 2019 3.0.6)\n            # LibVLC version: 3.0.6 Vetinari (0x3000600)\n            # LibVLC compiler: clang: warning: argument unused during compilation: '-mmacosx-version-min=10.7' [-Wunused-command-line-argument]\n            # Plugin path: /Applications/VLC3.0.6.app/Contents/MacOS/plugins\n            # Python: 3.7.4 (64bit) macOS 10.13.6\n\n            # Print version of this vlc.py and of the libvlc\n            c = basename(str(wx._core).split()[-1].rstrip('>').strip(\"'\").strip('\"'))\n            print('%s: %s (%s %s %s)' % (basename(__file__), __version__,\n                                         wx.__name__, wx.version(), c))\n            try:\n                vlc.print_version()\n                vlc.print_python()\n            except AttributeError:\n                pass\n            sys.exit(0)\n\n        elif arg.startswith('-'):\n            print('usage: %s  [-v | --version]  [<video_file_name>]' % (sys.argv[0],))\n            sys.exit(1)\n\n        elif arg:  # video file\n            _video = expanduser(arg)\n            if not isfile(_video):\n                print('%s error: no such file: %r' % (sys.argv[0], arg))\n                sys.exit(1)\n\n    # Create a wx.App(), which handles the windowing system event loop\n    app = wx.App()  # XXX wx.PySimpleApp()\n    # Create the window containing our media player\n    player = Player(video=_video)\n    # show the player window centred\n    player.Centre()\n    player.Show()\n    # run the application\n    app.MainLoop()\n"
  },
  {
    "path": "generated/2.2/COPYING",
    "content": "                  GNU LESSER GENERAL PUBLIC LICENSE\n                       Version 2.1, February 1999\n\n Copyright (C) 1991, 1999 Free Software Foundation, Inc.\n 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n[This is the first released version of the Lesser GPL.  It also counts\n as the successor of the GNU Library Public License, version 2, hence\n the version number 2.1.]\n\n                            Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicenses are intended to guarantee your freedom to share and change\nfree software--to make sure the software is free for all its users.\n\n  This license, the Lesser General Public License, applies to some\nspecially designated software packages--typically libraries--of the\nFree Software Foundation and other authors who decide to use it.  You\ncan use it too, but we suggest you first think carefully about whether\nthis license or the ordinary General Public License is the better\nstrategy to use in any particular case, based on the explanations below.\n\n  When we speak of free software, we are referring to freedom of use,\nnot price.  Our General Public Licenses are designed to make sure that\nyou have the freedom to distribute copies of free software (and charge\nfor this service if you wish); that you receive source code or can get\nit if you want it; that you can change the software and use pieces of\nit in new free programs; and that you are informed that you can do\nthese things.\n\n  To protect your rights, we need to make restrictions that forbid\ndistributors to deny you these rights or to ask you to surrender these\nrights.  These restrictions translate to certain responsibilities for\nyou if you distribute copies of the library or if you modify it.\n\n  For example, if you distribute copies of the library, whether gratis\nor for a fee, you must give the recipients all the rights that we gave\nyou.  You must make sure that they, too, receive or can get the source\ncode.  If you link other code with the library, you must provide\ncomplete object files to the recipients, so that they can relink them\nwith the library after making changes to the library and recompiling\nit.  And you must show them these terms so they know their rights.\n\n  We protect your rights with a two-step method: (1) we copyright the\nlibrary, and (2) we offer you this license, which gives you legal\npermission to copy, distribute and/or modify the library.\n\n  To protect each distributor, we want to make it very clear that\nthere is no warranty for the free library.  Also, if the library is\nmodified by someone else and passed on, the recipients should know\nthat what they have is not the original version, so that the original\nauthor's reputation will not be affected by problems that might be\nintroduced by others.\n\f\n  Finally, software patents pose a constant threat to the existence of\nany free program.  We wish to make sure that a company cannot\neffectively restrict the users of a free program by obtaining a\nrestrictive license from a patent holder.  Therefore, we insist that\nany patent license obtained for a version of the library must be\nconsistent with the full freedom of use specified in this license.\n\n  Most GNU software, including some libraries, is covered by the\nordinary GNU General Public License.  This license, the GNU Lesser\nGeneral Public License, applies to certain designated libraries, and\nis quite different from the ordinary General Public License.  We use\nthis license for certain libraries in order to permit linking those\nlibraries into non-free programs.\n\n  When a program is linked with a library, whether statically or using\na shared library, the combination of the two is legally speaking a\ncombined work, a derivative of the original library.  The ordinary\nGeneral Public License therefore permits such linking only if the\nentire combination fits its criteria of freedom.  The Lesser General\nPublic License permits more lax criteria for linking other code with\nthe library.\n\n  We call this license the \"Lesser\" General Public License because it\ndoes Less to protect the user's freedom than the ordinary General\nPublic License.  It also provides other free software developers Less\nof an advantage over competing non-free programs.  These disadvantages\nare the reason we use the ordinary General Public License for many\nlibraries.  However, the Lesser license provides advantages in certain\nspecial circumstances.\n\n  For example, on rare occasions, there may be a special need to\nencourage the widest possible use of a certain library, so that it becomes\na de-facto standard.  To achieve this, non-free programs must be\nallowed to use the library.  A more frequent case is that a free\nlibrary does the same job as widely used non-free libraries.  In this\ncase, there is little to gain by limiting the free library to free\nsoftware only, so we use the Lesser General Public License.\n\n  In other cases, permission to use a particular library in non-free\nprograms enables a greater number of people to use a large body of\nfree software.  For example, permission to use the GNU C Library in\nnon-free programs enables many more people to use the whole GNU\noperating system, as well as its variant, the GNU/Linux operating\nsystem.\n\n  Although the Lesser General Public License is Less protective of the\nusers' freedom, it does ensure that the user of a program that is\nlinked with the Library has the freedom and the wherewithal to run\nthat program using a modified version of the Library.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.  Pay close attention to the difference between a\n\"work based on the library\" and a \"work that uses the library\".  The\nformer contains code derived from the library, whereas the latter must\nbe combined with the library in order to run.\n\f\n                  GNU LESSER GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License Agreement applies to any software library or other\nprogram which contains a notice placed by the copyright holder or\nother authorized party saying it may be distributed under the terms of\nthis Lesser General Public License (also called \"this License\").\nEach licensee is addressed as \"you\".\n\n  A \"library\" means a collection of software functions and/or data\nprepared so as to be conveniently linked with application programs\n(which use some of those functions and data) to form executables.\n\n  The \"Library\", below, refers to any such software library or work\nwhich has been distributed under these terms.  A \"work based on the\nLibrary\" means either the Library or any derivative work under\ncopyright law: that is to say, a work containing the Library or a\nportion of it, either verbatim or with modifications and/or translated\nstraightforwardly into another language.  (Hereinafter, translation is\nincluded without limitation in the term \"modification\".)\n\n  \"Source code\" for a work means the preferred form of the work for\nmaking modifications to it.  For a library, complete source code means\nall the source code for all modules it contains, plus any associated\ninterface definition files, plus the scripts used to control compilation\nand installation of the library.\n\n  Activities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning a program using the Library is not restricted, and output from\nsuch a program is covered only if its contents constitute a work based\non the Library (independent of the use of the Library in a tool for\nwriting it).  Whether that is true depends on what the Library does\nand what the program that uses the Library does.\n\n  1. You may copy and distribute verbatim copies of the Library's\ncomplete source code as you receive it, in any medium, provided that\nyou conspicuously and appropriately publish on each copy an\nappropriate copyright notice and disclaimer of warranty; keep intact\nall the notices that refer to this License and to the absence of any\nwarranty; and distribute a copy of this License along with the\nLibrary.\n\n  You may charge a fee for the physical act of transferring a copy,\nand you may at your option offer warranty protection in exchange for a\nfee.\n\f\n  2. You may modify your copy or copies of the Library or any portion\nof it, thus forming a work based on the Library, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) The modified work must itself be a software library.\n\n    b) You must cause the files modified to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    c) You must cause the whole of the work to be licensed at no\n    charge to all third parties under the terms of this License.\n\n    d) If a facility in the modified Library refers to a function or a\n    table of data to be supplied by an application program that uses\n    the facility, other than as an argument passed when the facility\n    is invoked, then you must make a good faith effort to ensure that,\n    in the event an application does not supply such function or\n    table, the facility still operates, and performs whatever part of\n    its purpose remains meaningful.\n\n    (For example, a function in a library to compute square roots has\n    a purpose that is entirely well-defined independent of the\n    application.  Therefore, Subsection 2d requires that any\n    application-supplied function or table used by this function must\n    be optional: if the application does not supply it, the square\n    root function must still compute square roots.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Library,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Library, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote\nit.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Library.\n\nIn addition, mere aggregation of another work not based on the Library\nwith the Library (or with a work based on the Library) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may opt to apply the terms of the ordinary GNU General Public\nLicense instead of this License to a given copy of the Library.  To do\nthis, you must alter all the notices that refer to this License, so\nthat they refer to the ordinary GNU General Public License, version 2,\ninstead of to this License.  (If a newer version than version 2 of the\nordinary GNU General Public License has appeared, then you can specify\nthat version instead if you wish.)  Do not make any other change in\nthese notices.\n\f\n  Once this change is made in a given copy, it is irreversible for\nthat copy, so the ordinary GNU General Public License applies to all\nsubsequent copies and derivative works made from that copy.\n\n  This option is useful when you wish to copy part of the code of\nthe Library into a program that is not a library.\n\n  4. You may copy and distribute the Library (or a portion or\nderivative of it, under Section 2) in object code or executable form\nunder the terms of Sections 1 and 2 above provided that you accompany\nit with the complete corresponding machine-readable source code, which\nmust be distributed under the terms of Sections 1 and 2 above on a\nmedium customarily used for software interchange.\n\n  If distribution of object code is made by offering access to copy\nfrom a designated place, then offering equivalent access to copy the\nsource code from the same place satisfies the requirement to\ndistribute the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  5. A program that contains no derivative of any portion of the\nLibrary, but is designed to work with the Library by being compiled or\nlinked with it, is called a \"work that uses the Library\".  Such a\nwork, in isolation, is not a derivative work of the Library, and\ntherefore falls outside the scope of this License.\n\n  However, linking a \"work that uses the Library\" with the Library\ncreates an executable that is a derivative of the Library (because it\ncontains portions of the Library), rather than a \"work that uses the\nlibrary\".  The executable is therefore covered by this License.\nSection 6 states terms for distribution of such executables.\n\n  When a \"work that uses the Library\" uses material from a header file\nthat is part of the Library, the object code for the work may be a\nderivative work of the Library even though the source code is not.\nWhether this is true is especially significant if the work can be\nlinked without the Library, or if the work is itself a library.  The\nthreshold for this to be true is not precisely defined by law.\n\n  If such an object file uses only numerical parameters, data\nstructure layouts and accessors, and small macros and small inline\nfunctions (ten lines or less in length), then the use of the object\nfile is unrestricted, regardless of whether it is legally a derivative\nwork.  (Executables containing this object code plus portions of the\nLibrary will still fall under Section 6.)\n\n  Otherwise, if the work is a derivative of the Library, you may\ndistribute the object code for the work under the terms of Section 6.\nAny executables containing that work also fall under Section 6,\nwhether or not they are linked directly with the Library itself.\n\f\n  6. As an exception to the Sections above, you may also combine or\nlink a \"work that uses the Library\" with the Library to produce a\nwork containing portions of the Library, and distribute that work\nunder terms of your choice, provided that the terms permit\nmodification of the work for the customer's own use and reverse\nengineering for debugging such modifications.\n\n  You must give prominent notice with each copy of the work that the\nLibrary is used in it and that the Library and its use are covered by\nthis License.  You must supply a copy of this License.  If the work\nduring execution displays copyright notices, you must include the\ncopyright notice for the Library among them, as well as a reference\ndirecting the user to the copy of this License.  Also, you must do one\nof these things:\n\n    a) Accompany the work with the complete corresponding\n    machine-readable source code for the Library including whatever\n    changes were used in the work (which must be distributed under\n    Sections 1 and 2 above); and, if the work is an executable linked\n    with the Library, with the complete machine-readable \"work that\n    uses the Library\", as object code and/or source code, so that the\n    user can modify the Library and then relink to produce a modified\n    executable containing the modified Library.  (It is understood\n    that the user who changes the contents of definitions files in the\n    Library will not necessarily be able to recompile the application\n    to use the modified definitions.)\n\n    b) Use a suitable shared library mechanism for linking with the\n    Library.  A suitable mechanism is one that (1) uses at run time a\n    copy of the library already present on the user's computer system,\n    rather than copying library functions into the executable, and (2)\n    will operate properly with a modified version of the library, if\n    the user installs one, as long as the modified version is\n    interface-compatible with the version that the work was made with.\n\n    c) Accompany the work with a written offer, valid for at\n    least three years, to give the same user the materials\n    specified in Subsection 6a, above, for a charge no more\n    than the cost of performing this distribution.\n\n    d) If distribution of the work is made by offering access to copy\n    from a designated place, offer equivalent access to copy the above\n    specified materials from the same place.\n\n    e) Verify that the user has already received a copy of these\n    materials or that you have already sent this user a copy.\n\n  For an executable, the required form of the \"work that uses the\nLibrary\" must include any data and utility programs needed for\nreproducing the executable from it.  However, as a special exception,\nthe materials to be distributed need not include anything that is\nnormally distributed (in either source or binary form) with the major\ncomponents (compiler, kernel, and so on) of the operating system on\nwhich the executable runs, unless that component itself accompanies\nthe executable.\n\n  It may happen that this requirement contradicts the license\nrestrictions of other proprietary libraries that do not normally\naccompany the operating system.  Such a contradiction means you cannot\nuse both them and the Library together in an executable that you\ndistribute.\n\f\n  7. You may place library facilities that are a work based on the\nLibrary side-by-side in a single library together with other library\nfacilities not covered by this License, and distribute such a combined\nlibrary, provided that the separate distribution of the work based on\nthe Library and of the other library facilities is otherwise\npermitted, and provided that you do these two things:\n\n    a) Accompany the combined library with a copy of the same work\n    based on the Library, uncombined with any other library\n    facilities.  This must be distributed under the terms of the\n    Sections above.\n\n    b) Give prominent notice with the combined library of the fact\n    that part of it is a work based on the Library, and explaining\n    where to find the accompanying uncombined form of the same work.\n\n  8. You may not copy, modify, sublicense, link with, or distribute\nthe Library except as expressly provided under this License.  Any\nattempt otherwise to copy, modify, sublicense, link with, or\ndistribute the Library is void, and will automatically terminate your\nrights under this License.  However, parties who have received copies,\nor rights, from you under this License will not have their licenses\nterminated so long as such parties remain in full compliance.\n\n  9. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Library or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Library (or any work based on the\nLibrary), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Library or works based on it.\n\n  10. Each time you redistribute the Library (or any work based on the\nLibrary), the recipient automatically receives a license from the\noriginal licensor to copy, distribute, link with or modify the Library\nsubject to these terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties with\nthis License.\n\f\n  11. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Library at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Library by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Library.\n\nIf any portion of this section is held invalid or unenforceable under any\nparticular circumstance, the balance of the section is intended to apply,\nand the section as a whole is intended to apply in other circumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  12. If the distribution and/or use of the Library is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Library under this License may add\nan explicit geographical distribution limitation excluding those countries,\nso that distribution is permitted only in or among countries not thus\nexcluded.  In such case, this License incorporates the limitation as if\nwritten in the body of this License.\n\n  13. The Free Software Foundation may publish revised and/or new\nversions of the Lesser General Public License from time to time.\nSuch new versions will be similar in spirit to the present version,\nbut may differ in detail to address new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Library\nspecifies a version number of this License which applies to it and\n\"any later version\", you have the option of following the terms and\nconditions either of that version or of any later version published by\nthe Free Software Foundation.  If the Library does not specify a\nlicense version number, you may choose any version ever published by\nthe Free Software Foundation.\n\f\n  14. If you wish to incorporate parts of the Library into other free\nprograms whose distribution conditions are incompatible with these,\nwrite to the author to ask for permission.  For software which is\ncopyrighted by the Free Software Foundation, write to the Free\nSoftware Foundation; we sometimes make exceptions for this.  Our\ndecision will be guided by the two goals of preserving the free status\nof all derivatives of our free software and of promoting the sharing\nand reuse of software generally.\n\n                            NO WARRANTY\n\n  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\nWARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\nEXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\nOTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY\nKIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\nLIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\nTHE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\nWRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\nAND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\nFOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\nCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\nLIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\nRENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\nFAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\nSUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGES.\n\n                     END OF TERMS AND CONDITIONS\n\f\n           How to Apply These Terms to Your New Libraries\n\n  If you develop a new library, and you want it to be of the greatest\npossible use to the public, we recommend making it free software that\neveryone can redistribute and change.  You can do so by permitting\nredistribution under these terms (or, alternatively, under the terms of the\nordinary General Public License).\n\n  To apply these terms, attach the following notices to the library.  It is\nsafest to attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least the\n\"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the library's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This library is free software; you can redistribute it and/or\n    modify it under the terms of the GNU Lesser General Public\n    License as published by the Free Software Foundation; either\n    version 2.1 of the License, or (at your option) any later version.\n\n    This library is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n    Lesser General Public License for more details.\n\n    You should have received a copy of the GNU Lesser General Public\n    License along with this library; if not, write to the Free Software\n    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n\nAlso add information on how to contact you by electronic and paper mail.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the library, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the\n  library `Frob' (a library for tweaking knobs) written by James Random Hacker.\n\n  <signature of Ty Coon>, 1 April 1990\n  Ty Coon, President of Vice\n\nThat's all there is to it!\n"
  },
  {
    "path": "generated/2.2/MANIFEST.in",
    "content": "include setup.py\ninclude vlc.py\ninclude COPYING MANIFEST.in README.module\ninclude distribute_setup.py\nrecursive-include examples *\n"
  },
  {
    "path": "generated/2.2/README.module",
    "content": "Python ctypes-based bindings libvlc\n===================================\n\nThe bindings use ctypes to directly call the libvlc dynamic lib, and\nthe code is generated from the include files defining the public\nAPI. The same module should be compatible with various versions of\nlibvlc 2.*. However, there may be incompatible changes between major\nversions.\n\nLicense\n-------\n\nThe generated module is licensed, like libvlc, under the GNU Lesser\nGeneral Public License 2.1 or later.\n\nInstalling the module\n---------------------\n\nYou can install the module through PyPI:\n\n    pip install python-vlc\n\nUsing the module\n----------------\n\nDocumentation building needs epydoc. An online build is available at\n<http://olivieraubert.net/vlc/python-ctypes/>\n\nThe module offers two ways of accessing the API - a raw access to all\nexported methods, and more convenient wrapper classes :\n\n- Raw access: methods are available as attributes of the vlc\n  module. Use their docstring (any introspective shell like ipython is\n  your friend) to explore them.\n\n- Wrapper classes: most major structures of the libvlc API (Instance,\n  Media, MediaPlayer, etc) are wrapped as classes, with shorter method\n  names.\n\n\n- Using raw access:\n\n    >>> import vlc\n    >>> vlc.libvlc_get_version()\n    '1.0.0 Goldeneye'\n    >>> e=vlc.VLCException()\n    >>> i=vlc.libvlc_new(0, [], e)\n    >>> i\n    <vlc.Instance object at 0x8384a4c>\n    >>> vlc.libvlc_audio_get_volume(i,e)\n    50\n\n- Using wrapper classes:\n\n   >>> import vlc\n   >>> i=vlc.Instance('--no-audio', '--fullscreen')\n   >>> i.audio_get_volume()\n   50\n   >>> p=i.media_player_new()\n   >>> m=i.media_new('file:///tmp/foo.avi')\n   >>> m.get_mrl()\n   'file:///tmp/foo.avi'\n   >>> p.set_media(m)\n   >>> p.play()\n\nor even shorter:\n\n   >>> import vlc\n   >>> p=vlc.MediaPlayer('file:///tmp/foo.avi')\n   >>> p.play()\n   >>> p.get_instance() # returns the corresponding instance\n\nIn this latter case, a default ``vlc.Instance`` will be instanciated and\nstored in ``vlc._default_instance``. It will be used to instanciate the\nvarious classes (``Media``, ``MediaList``, ``MediaPlayer``, etc).\n"
  },
  {
    "path": "generated/2.2/distribute_setup.py",
    "content": "#!python\n\"\"\"Bootstrap distribute installation\n\nIf you want to use setuptools in your package's setup.py, just include this\nfile in the same directory with it, and add this to the top of your setup.py::\n\n    from distribute_setup import use_setuptools\n    use_setuptools()\n\nIf you want to require a specific version of setuptools, set a download\nmirror, or use an alternate download directory, you can do so by supplying\nthe appropriate options to ``use_setuptools()``.\n\nThis file can also be run as a script to install or upgrade setuptools.\n\"\"\"\nimport os\nimport shutil\nimport sys\nimport time\nimport fnmatch\nimport tempfile\nimport tarfile\nimport optparse\n\nfrom distutils import log\n\ntry:\n    from site import USER_SITE\nexcept ImportError:\n    USER_SITE = None\n\ntry:\n    import subprocess\n\n    def _python_cmd(*args):\n        args = (sys.executable,) + args\n        return subprocess.call(args) == 0\n\nexcept ImportError:\n    # will be used for python 2.3\n    def _python_cmd(*args):\n        args = (sys.executable,) + args\n        # quoting arguments if windows\n        if sys.platform == 'win32':\n            def quote(arg):\n                if ' ' in arg:\n                    return '\"%s\"' % arg\n                return arg\n            args = [quote(arg) for arg in args]\n        return os.spawnl(os.P_WAIT, sys.executable, *args) == 0\n\nDEFAULT_VERSION = \"0.6.49\"\nDEFAULT_URL = \"http://pypi.python.org/packages/source/d/distribute/\"\nSETUPTOOLS_FAKED_VERSION = \"0.6c11\"\n\nSETUPTOOLS_PKG_INFO = \"\"\"\\\nMetadata-Version: 1.0\nName: setuptools\nVersion: %s\nSummary: xxxx\nHome-page: xxx\nAuthor: xxx\nAuthor-email: xxx\nLicense: xxx\nDescription: xxx\n\"\"\" % SETUPTOOLS_FAKED_VERSION\n\n\ndef _install(tarball, install_args=()):\n    # extracting the tarball\n    tmpdir = tempfile.mkdtemp()\n    log.warn('Extracting in %s', tmpdir)\n    old_wd = os.getcwd()\n    try:\n        os.chdir(tmpdir)\n        tar = tarfile.open(tarball)\n        _extractall(tar)\n        tar.close()\n\n        # going in the directory\n        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])\n        os.chdir(subdir)\n        log.warn('Now working in %s', subdir)\n\n        # installing\n        log.warn('Installing Distribute')\n        if not _python_cmd('setup.py', 'install', *install_args):\n            log.warn('Something went wrong during the installation.')\n            log.warn('See the error message above.')\n            # exitcode will be 2\n            return 2\n    finally:\n        os.chdir(old_wd)\n        shutil.rmtree(tmpdir)\n\n\ndef _build_egg(egg, tarball, to_dir):\n    # extracting the tarball\n    tmpdir = tempfile.mkdtemp()\n    log.warn('Extracting in %s', tmpdir)\n    old_wd = os.getcwd()\n    try:\n        os.chdir(tmpdir)\n        tar = tarfile.open(tarball)\n        _extractall(tar)\n        tar.close()\n\n        # going in the directory\n        subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])\n        os.chdir(subdir)\n        log.warn('Now working in %s', subdir)\n\n        # building an egg\n        log.warn('Building a Distribute egg in %s', to_dir)\n        _python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)\n\n    finally:\n        os.chdir(old_wd)\n        shutil.rmtree(tmpdir)\n    # returning the result\n    log.warn(egg)\n    if not os.path.exists(egg):\n        raise IOError('Could not build the egg.')\n\n\ndef _do_download(version, download_base, to_dir, download_delay):\n    egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg'\n                       % (version, sys.version_info[0], sys.version_info[1]))\n    if not os.path.exists(egg):\n        tarball = download_setuptools(version, download_base,\n                                      to_dir, download_delay)\n        _build_egg(egg, tarball, to_dir)\n    sys.path.insert(0, egg)\n    import setuptools\n    setuptools.bootstrap_install_from = egg\n\n\ndef use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,\n                   to_dir=os.curdir, download_delay=15, no_fake=True):\n    # making sure we use the absolute path\n    to_dir = os.path.abspath(to_dir)\n    was_imported = 'pkg_resources' in sys.modules or \\\n        'setuptools' in sys.modules\n    try:\n        try:\n            import pkg_resources\n\n            # Setuptools 0.7b and later is a suitable (and preferable)\n            # substitute for any Distribute version.\n            try:\n                pkg_resources.require(\"setuptools>=0.7b\")\n                return\n            except (pkg_resources.DistributionNotFound,\n                    pkg_resources.VersionConflict):\n                pass\n\n            if not hasattr(pkg_resources, '_distribute'):\n                if not no_fake:\n                    _fake_setuptools()\n                raise ImportError\n        except ImportError:\n            return _do_download(version, download_base, to_dir, download_delay)\n        try:\n            pkg_resources.require(\"distribute>=\" + version)\n            return\n        except pkg_resources.VersionConflict:\n            e = sys.exc_info()[1]\n            if was_imported:\n                sys.stderr.write(\n                \"The required version of distribute (>=%s) is not available,\\n\"\n                \"and can't be installed while this script is running. Please\\n\"\n                \"install a more recent version first, using\\n\"\n                \"'easy_install -U distribute'.\"\n                \"\\n\\n(Currently using %r)\\n\" % (version, e.args[0]))\n                sys.exit(2)\n            else:\n                del pkg_resources, sys.modules['pkg_resources']    # reload ok\n                return _do_download(version, download_base, to_dir,\n                                    download_delay)\n        except pkg_resources.DistributionNotFound:\n            return _do_download(version, download_base, to_dir,\n                                download_delay)\n    finally:\n        if not no_fake:\n            _create_fake_setuptools_pkg_info(to_dir)\n\n\ndef download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,\n                        to_dir=os.curdir, delay=15):\n    \"\"\"Download distribute from a specified location and return its filename\n\n    `version` should be a valid distribute version number that is available\n    as an egg for download under the `download_base` URL (which should end\n    with a '/'). `to_dir` is the directory where the egg will be downloaded.\n    `delay` is the number of seconds to pause before an actual download\n    attempt.\n    \"\"\"\n    # making sure we use the absolute path\n    to_dir = os.path.abspath(to_dir)\n    try:\n        from urllib.request import urlopen\n    except ImportError:\n        from urllib2 import urlopen\n    tgz_name = \"distribute-%s.tar.gz\" % version\n    url = download_base + tgz_name\n    saveto = os.path.join(to_dir, tgz_name)\n    src = dst = None\n    if not os.path.exists(saveto):  # Avoid repeated downloads\n        try:\n            log.warn(\"Downloading %s\", url)\n            src = urlopen(url)\n            # Read/write all in one block, so we don't create a corrupt file\n            # if the download is interrupted.\n            data = src.read()\n            dst = open(saveto, \"wb\")\n            dst.write(data)\n        finally:\n            if src:\n                src.close()\n            if dst:\n                dst.close()\n    return os.path.realpath(saveto)\n\n\ndef _no_sandbox(function):\n    def __no_sandbox(*args, **kw):\n        try:\n            from setuptools.sandbox import DirectorySandbox\n            if not hasattr(DirectorySandbox, '_old'):\n                def violation(*args):\n                    pass\n                DirectorySandbox._old = DirectorySandbox._violation\n                DirectorySandbox._violation = violation\n                patched = True\n            else:\n                patched = False\n        except ImportError:\n            patched = False\n\n        try:\n            return function(*args, **kw)\n        finally:\n            if patched:\n                DirectorySandbox._violation = DirectorySandbox._old\n                del DirectorySandbox._old\n\n    return __no_sandbox\n\n\ndef _patch_file(path, content):\n    \"\"\"Will backup the file then patch it\"\"\"\n    f = open(path)\n    existing_content = f.read()\n    f.close()\n    if existing_content == content:\n        # already patched\n        log.warn('Already patched.')\n        return False\n    log.warn('Patching...')\n    _rename_path(path)\n    f = open(path, 'w')\n    try:\n        f.write(content)\n    finally:\n        f.close()\n    return True\n\n_patch_file = _no_sandbox(_patch_file)\n\n\ndef _same_content(path, content):\n    f = open(path)\n    existing_content = f.read()\n    f.close()\n    return existing_content == content\n\n\ndef _rename_path(path):\n    new_name = path + '.OLD.%s' % time.time()\n    log.warn('Renaming %s to %s', path, new_name)\n    os.rename(path, new_name)\n    return new_name\n\n\ndef _remove_flat_installation(placeholder):\n    if not os.path.isdir(placeholder):\n        log.warn('Unkown installation at %s', placeholder)\n        return False\n    found = False\n    for file in os.listdir(placeholder):\n        if fnmatch.fnmatch(file, 'setuptools*.egg-info'):\n            found = True\n            break\n    if not found:\n        log.warn('Could not locate setuptools*.egg-info')\n        return\n\n    log.warn('Moving elements out of the way...')\n    pkg_info = os.path.join(placeholder, file)\n    if os.path.isdir(pkg_info):\n        patched = _patch_egg_dir(pkg_info)\n    else:\n        patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO)\n\n    if not patched:\n        log.warn('%s already patched.', pkg_info)\n        return False\n    # now let's move the files out of the way\n    for element in ('setuptools', 'pkg_resources.py', 'site.py'):\n        element = os.path.join(placeholder, element)\n        if os.path.exists(element):\n            _rename_path(element)\n        else:\n            log.warn('Could not find the %s element of the '\n                     'Setuptools distribution', element)\n    return True\n\n_remove_flat_installation = _no_sandbox(_remove_flat_installation)\n\n\ndef _after_install(dist):\n    log.warn('After install bootstrap.')\n    placeholder = dist.get_command_obj('install').install_purelib\n    _create_fake_setuptools_pkg_info(placeholder)\n\n\ndef _create_fake_setuptools_pkg_info(placeholder):\n    if not placeholder or not os.path.exists(placeholder):\n        log.warn('Could not find the install location')\n        return\n    pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1])\n    setuptools_file = 'setuptools-%s-py%s.egg-info' % \\\n            (SETUPTOOLS_FAKED_VERSION, pyver)\n    pkg_info = os.path.join(placeholder, setuptools_file)\n    if os.path.exists(pkg_info):\n        log.warn('%s already exists', pkg_info)\n        return\n\n    log.warn('Creating %s', pkg_info)\n    try:\n        f = open(pkg_info, 'w')\n    except EnvironmentError:\n        log.warn(\"Don't have permissions to write %s, skipping\", pkg_info)\n        return\n    try:\n        f.write(SETUPTOOLS_PKG_INFO)\n    finally:\n        f.close()\n\n    pth_file = os.path.join(placeholder, 'setuptools.pth')\n    log.warn('Creating %s', pth_file)\n    f = open(pth_file, 'w')\n    try:\n        f.write(os.path.join(os.curdir, setuptools_file))\n    finally:\n        f.close()\n\n_create_fake_setuptools_pkg_info = _no_sandbox(\n    _create_fake_setuptools_pkg_info\n)\n\n\ndef _patch_egg_dir(path):\n    # let's check if it's already patched\n    pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')\n    if os.path.exists(pkg_info):\n        if _same_content(pkg_info, SETUPTOOLS_PKG_INFO):\n            log.warn('%s already patched.', pkg_info)\n            return False\n    _rename_path(path)\n    os.mkdir(path)\n    os.mkdir(os.path.join(path, 'EGG-INFO'))\n    pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')\n    f = open(pkg_info, 'w')\n    try:\n        f.write(SETUPTOOLS_PKG_INFO)\n    finally:\n        f.close()\n    return True\n\n_patch_egg_dir = _no_sandbox(_patch_egg_dir)\n\n\ndef _before_install():\n    log.warn('Before install bootstrap.')\n    _fake_setuptools()\n\n\ndef _under_prefix(location):\n    if 'install' not in sys.argv:\n        return True\n    args = sys.argv[sys.argv.index('install') + 1:]\n    for index, arg in enumerate(args):\n        for option in ('--root', '--prefix'):\n            if arg.startswith('%s=' % option):\n                top_dir = arg.split('root=')[-1]\n                return location.startswith(top_dir)\n            elif arg == option:\n                if len(args) > index:\n                    top_dir = args[index + 1]\n                    return location.startswith(top_dir)\n        if arg == '--user' and USER_SITE is not None:\n            return location.startswith(USER_SITE)\n    return True\n\n\ndef _fake_setuptools():\n    log.warn('Scanning installed packages')\n    try:\n        import pkg_resources\n    except ImportError:\n        # we're cool\n        log.warn('Setuptools or Distribute does not seem to be installed.')\n        return\n    ws = pkg_resources.working_set\n    try:\n        setuptools_dist = ws.find(\n            pkg_resources.Requirement.parse('setuptools', replacement=False)\n            )\n    except TypeError:\n        # old distribute API\n        setuptools_dist = ws.find(\n            pkg_resources.Requirement.parse('setuptools')\n        )\n\n    if setuptools_dist is None:\n        log.warn('No setuptools distribution found')\n        return\n    # detecting if it was already faked\n    setuptools_location = setuptools_dist.location\n    log.warn('Setuptools installation detected at %s', setuptools_location)\n\n    # if --root or --preix was provided, and if\n    # setuptools is not located in them, we don't patch it\n    if not _under_prefix(setuptools_location):\n        log.warn('Not patching, --root or --prefix is installing Distribute'\n                 ' in another location')\n        return\n\n    # let's see if its an egg\n    if not setuptools_location.endswith('.egg'):\n        log.warn('Non-egg installation')\n        res = _remove_flat_installation(setuptools_location)\n        if not res:\n            return\n    else:\n        log.warn('Egg installation')\n        pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO')\n        if (os.path.exists(pkg_info) and\n            _same_content(pkg_info, SETUPTOOLS_PKG_INFO)):\n            log.warn('Already patched.')\n            return\n        log.warn('Patching...')\n        # let's create a fake egg replacing setuptools one\n        res = _patch_egg_dir(setuptools_location)\n        if not res:\n            return\n    log.warn('Patching complete.')\n    _relaunch()\n\n\ndef _relaunch():\n    log.warn('Relaunching...')\n    # we have to relaunch the process\n    # pip marker to avoid a relaunch bug\n    _cmd1 = ['-c', 'install', '--single-version-externally-managed']\n    _cmd2 = ['-c', 'install', '--record']\n    if sys.argv[:3] == _cmd1 or sys.argv[:3] == _cmd2:\n        sys.argv[0] = 'setup.py'\n    args = [sys.executable] + sys.argv\n    sys.exit(subprocess.call(args))\n\n\ndef _extractall(self, path=\".\", members=None):\n    \"\"\"Extract all members from the archive to the current working\n       directory and set owner, modification time and permissions on\n       directories afterwards. `path' specifies a different directory\n       to extract to. `members' is optional and must be a subset of the\n       list returned by getmembers().\n    \"\"\"\n    import copy\n    import operator\n    from tarfile import ExtractError\n    directories = []\n\n    if members is None:\n        members = self\n\n    for tarinfo in members:\n        if tarinfo.isdir():\n            # Extract directories with a safe mode.\n            directories.append(tarinfo)\n            tarinfo = copy.copy(tarinfo)\n            tarinfo.mode = 448  # decimal for oct 0700\n        self.extract(tarinfo, path)\n\n    # Reverse sort directories.\n    if sys.version_info < (2, 4):\n        def sorter(dir1, dir2):\n            return cmp(dir1.name, dir2.name)\n        directories.sort(sorter)\n        directories.reverse()\n    else:\n        directories.sort(key=operator.attrgetter('name'), reverse=True)\n\n    # Set correct owner, mtime and filemode on directories.\n    for tarinfo in directories:\n        dirpath = os.path.join(path, tarinfo.name)\n        try:\n            self.chown(tarinfo, dirpath)\n            self.utime(tarinfo, dirpath)\n            self.chmod(tarinfo, dirpath)\n        except ExtractError:\n            e = sys.exc_info()[1]\n            if self.errorlevel > 1:\n                raise\n            else:\n                self._dbg(1, \"tarfile: %s\" % e)\n\n\ndef _build_install_args(options):\n    \"\"\"\n    Build the arguments to 'python setup.py install' on the distribute package\n    \"\"\"\n    install_args = []\n    if options.user_install:\n        if sys.version_info < (2, 6):\n            log.warn(\"--user requires Python 2.6 or later\")\n            raise SystemExit(1)\n        install_args.append('--user')\n    return install_args\n\ndef _parse_args():\n    \"\"\"\n    Parse the command line for options\n    \"\"\"\n    parser = optparse.OptionParser()\n    parser.add_option(\n        '--user', dest='user_install', action='store_true', default=False,\n        help='install in user site package (requires Python 2.6 or later)')\n    parser.add_option(\n        '--download-base', dest='download_base', metavar=\"URL\",\n        default=DEFAULT_URL,\n        help='alternative URL from where to download the distribute package')\n    options, args = parser.parse_args()\n    # positional arguments are ignored\n    return options\n\ndef main(version=DEFAULT_VERSION):\n    \"\"\"Install or upgrade setuptools and EasyInstall\"\"\"\n    options = _parse_args()\n    tarball = download_setuptools(download_base=options.download_base)\n    return _install(tarball, _build_install_args(options))\n\nif __name__ == '__main__':\n    sys.exit(main())\n"
  },
  {
    "path": "generated/2.2/examples/gtk2vlc.py",
    "content": "#! /usr/bin/python\n\n#\n# gtk example/widget for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\n\"\"\"VLC Gtk Widget classes + example application.\n\nThis module provides two helper classes, to ease the embedding of a\nVLC component inside a pygtk application.\n\nVLCWidget is a simple VLC widget.\n\nDecoratedVLCWidget provides simple player controls.\n\nWhen called as an application, it behaves as a video player.\n\n$Id$\n\"\"\"\n\nimport gtk\ngtk.gdk.threads_init()\n\nimport sys\nimport vlc\n\nfrom gettext import gettext as _\n\n# Create a single vlc.Instance() to be shared by (possible) multiple players.\ninstance = vlc.Instance()\n\nclass VLCWidget(gtk.DrawingArea):\n    \"\"\"Simple VLC widget.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a vlc.MediaPlayer() instance.\n    \"\"\"\n    def __init__(self, *p):\n        gtk.DrawingArea.__init__(self)\n        self.player = instance.media_player_new()\n        def handle_embed(*args):\n            if sys.platform == 'win32':\n                self.player.set_hwnd(self.window.handle)\n            else:\n                self.player.set_xwindow(self.window.xid)\n            return True\n        self.connect(\"map\", handle_embed)\n        self.set_size_request(320, 200)\n\nclass DecoratedVLCWidget(gtk.VBox):\n    \"\"\"Decorated VLC widget.\n\n    VLC widget decorated with a player control toolbar.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a Player instance.\n    \"\"\"\n    def __init__(self, *p):\n        gtk.VBox.__init__(self)\n        self._vlc_widget = VLCWidget(*p)\n        self.player = self._vlc_widget.player\n        self.pack_start(self._vlc_widget, expand=True)\n        self._toolbar = self.get_player_control_toolbar()\n        self.pack_start(self._toolbar, expand=False)\n\n    def get_player_control_toolbar(self):\n        \"\"\"Return a player control toolbar\n        \"\"\"\n        tb = gtk.Toolbar()\n        tb.set_style(gtk.TOOLBAR_ICONS)\n        for text, tooltip, stock, callback in (\n            (_(\"Play\"), _(\"Play\"), gtk.STOCK_MEDIA_PLAY, lambda b: self.player.play()),\n            (_(\"Pause\"), _(\"Pause\"), gtk.STOCK_MEDIA_PAUSE, lambda b: self.player.pause()),\n            (_(\"Stop\"), _(\"Stop\"), gtk.STOCK_MEDIA_STOP, lambda b: self.player.stop()),\n            ):\n            b=gtk.ToolButton(stock)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback)\n            tb.insert(b, -1)\n        tb.show_all()\n        return tb\n\nclass VideoPlayer:\n    \"\"\"Example simple video player.\n    \"\"\"\n    def __init__(self):\n        self.vlc = DecoratedVLCWidget()\n\n    def main(self, fname):\n        self.vlc.player.set_media(instance.media_new(fname))\n        w = gtk.Window()\n        w.add(self.vlc)\n        w.show_all()\n        w.connect(\"destroy\", gtk.main_quit)\n        gtk.main()\n\nclass MultiVideoPlayer:\n    \"\"\"Example multi-video player.\n\n    It plays multiple files side-by-side, with per-view and global controls.\n    \"\"\"\n    def main(self, filenames):\n        # Build main window\n        window=gtk.Window()\n        mainbox=gtk.VBox()\n        videos=gtk.HBox()\n\n        window.add(mainbox)\n        mainbox.add(videos)\n\n        # Create VLC widgets\n        for fname in filenames:\n            v = DecoratedVLCWidget()\n            v.player.set_media(instance.media_new(fname))\n            videos.add(v)\n\n        # Create global toolbar\n        tb = gtk.Toolbar()\n        tb.set_style(gtk.TOOLBAR_ICONS)\n\n        def execute(b, methodname):\n            \"\"\"Execute the given method on all VLC widgets.\n            \"\"\"\n            for v in videos.get_children():\n                getattr(v.player, methodname)()\n            return True\n\n        for text, tooltip, stock, callback, arg in (\n            (_(\"Play\"), _(\"Global play\"), gtk.STOCK_MEDIA_PLAY, execute, \"play\"),\n            (_(\"Pause\"), _(\"Global pause\"), gtk.STOCK_MEDIA_PAUSE, execute, \"pause\"),\n            (_(\"Stop\"), _(\"Global stop\"), gtk.STOCK_MEDIA_STOP, execute, \"stop\"),\n            ):\n            b = gtk.ToolButton(stock)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback, arg)\n            tb.insert(b, -1)\n\n        mainbox.pack_start(tb, expand=False)\n\n        window.show_all()\n        window.connect(\"destroy\", gtk.main_quit)\n        gtk.main()\n\nif __name__ == '__main__':\n    if not sys.argv[1:]:\n       print('You must provide at least 1 movie filename')\n       sys.exit(1)\n    if len(sys.argv[1:]) == 1:\n        # Only 1 file. Simple interface\n        p=VideoPlayer()\n        p.main(sys.argv[1])\n    else:\n        # Multiple files.\n        p=MultiVideoPlayer()\n        p.main(sys.argv[1:])\n"
  },
  {
    "path": "generated/2.2/examples/gtkvlc.py",
    "content": "#! /usr/bin/python\n\n#\n# gtk3 example/widget for VLC Python bindings\n# Copyright (C) 2017 Olivier Aubert <contact@olivieraubert.net>\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\n\"\"\"VLC Gtk3 Widget classes + example application.\n\nThis module provides two helper classes, to ease the embedding of a\nVLC component inside a pygtk application.\n\nVLCWidget is a simple VLC widget.\n\nDecoratedVLCWidget provides simple player controls.\n\nWhen called as an application, it behaves as a video player.\n\"\"\"\n\nimport gi\ngi.require_version('Gdk', '3.0')\ngi.require_version('Gtk', '3.0')\nfrom gi.repository import Gdk\nfrom gi.repository import Gtk\n\nGdk.threads_init ()\n\nimport sys\nimport vlc\n\nfrom gettext import gettext as _\n\n# Create a single vlc.Instance() to be shared by (possible) multiple players.\nif 'linux' in sys.platform:\n    # Inform libvlc that Xlib is not initialized for threads\n    instance = vlc.Instance(\"--no-xlib\")\nelse:\n    instance = vlc.Instance()\n\nclass VLCWidget(Gtk.DrawingArea):\n    \"\"\"Simple VLC widget.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a vlc.MediaPlayer() instance.\n    \"\"\"\n    __gtype_name__ = 'VLCWidget'\n\n    def __init__(self, *p):\n        Gtk.DrawingArea.__init__(self)\n        self.player = instance.media_player_new()\n        def handle_embed(*args):\n            if sys.platform == 'win32':\n                self.player.set_hwnd(self.get_window().get_handle())\n            else:\n                self.player.set_xwindow(self.get_window().get_xid())\n            return True\n        self.connect(\"realize\", handle_embed)\n        self.set_size_request(320, 200)\n\nclass DecoratedVLCWidget(Gtk.VBox):\n    \"\"\"Decorated VLC widget.\n\n    VLC widget decorated with a player control toolbar.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a Player instance.\n    \"\"\"\n    __gtype_name__ = 'DecoratedVLCWidget'\n\n    def __init__(self, *p):\n        super(DecoratedVLCWidget, self).__init__()\n        self._vlc_widget = VLCWidget(*p)\n        self.player = self._vlc_widget.player\n        self.add(self._vlc_widget)\n        self._toolbar = self.get_player_control_toolbar()\n        self.pack_start(self._toolbar, False, False, 0)\n        self.show_all()\n\n    def get_player_control_toolbar(self):\n        \"\"\"Return a player control toolbar\n        \"\"\"\n        tb = Gtk.Toolbar.new()\n        for text, tooltip, iconname, callback in (\n            (_(\"Play\"), _(\"Play\"), 'gtk-media-play', lambda b: self.player.play()),\n            (_(\"Pause\"), _(\"Pause\"), 'gtk-media-pause', lambda b: self.player.pause()),\n            (_(\"Stop\"), _(\"Stop\"), 'gtk-media-stop', lambda b: self.player.stop()),\n            (_(\"Quit\"), _(\"Quit\"), 'gtk-quit', Gtk.main_quit),\n            ):\n            i = Gtk.Image.new_from_icon_name(iconname, Gtk.IconSize.MENU)\n            b = Gtk.ToolButton(i, text)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback)\n            tb.insert(b, -1)\n        return tb\n\nclass VideoPlayer:\n    \"\"\"Example simple video player.\n    \"\"\"\n    def __init__(self):\n        self.vlc = DecoratedVLCWidget()\n\n    def main(self, fname):\n        self.vlc.player.set_media(instance.media_new(fname))\n        w = Gtk.Window()\n        w.add(self.vlc)\n        w.show_all()\n        w.connect(\"destroy\", Gtk.main_quit)\n        Gtk.main()\n\nclass MultiVideoPlayer:\n    \"\"\"Example multi-video player.\n\n    It plays multiple files side-by-side, with per-view and global controls.\n    \"\"\"\n    def main(self, filenames):\n        # Build main window\n        window=Gtk.Window()\n        mainbox=Gtk.VBox()\n        videos=Gtk.HBox()\n\n        window.add(mainbox)\n        mainbox.add(videos)\n\n        # Create VLC widgets\n        for fname in filenames:\n            v = DecoratedVLCWidget()\n            v.player.set_media(instance.media_new(fname))\n            videos.add(v)\n\n        # Create global toolbar\n        tb = Gtk.Toolbar.new()\n\n        def execute(b, methodname):\n            \"\"\"Execute the given method on all VLC widgets.\n            \"\"\"\n            for v in videos.get_children():\n                getattr(v.player, methodname)()\n            return True\n\n        for text, tooltip, iconname, callback, arg in (\n            (_(\"Play\"), _(\"Global play\"), 'gtk-media-play', execute, \"play\"),\n            (_(\"Pause\"), _(\"Global pause\"), 'gtk-media-pause', execute, \"pause\"),\n            (_(\"Stop\"), _(\"Global stop\"), 'gtk-media-stop', execute, \"stop\"),\n            (_(\"Quit\"), _(\"Quit\"), 'gtk-quit', Gtk.main_quit, None),\n            ):\n            i = Gtk.Image.new_from_icon_name(iconname, Gtk.IconSize.MENU)\n            b = Gtk.ToolButton.new(i, text)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback, arg)\n            tb.insert(b, -1)\n\n        mainbox.pack_start(tb, False, False, 0)\n\n        window.show_all()\n        window.connect(\"destroy\", Gtk.main_quit)\n        Gtk.main()\n\nif __name__ == '__main__':\n    if not sys.argv[1:]:\n       print('You must provide at least 1 movie filename')\n       sys.exit(1)\n    if len(sys.argv[1:]) == 1:\n        # Only 1 file. Simple interface\n        p=VideoPlayer()\n        from evaluator import Evaluator\n        e = Evaluator(globals(), locals())\n        e.popup()\n        p.main(sys.argv[1])\n    else:\n        # Multiple files.\n        p=MultiVideoPlayer()\n        p.main(sys.argv[1:])\n    instance.release()\n"
  },
  {
    "path": "generated/2.2/examples/qtvlc.py",
    "content": "#! /usr/bin/python\n\n#\n# Qt example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\nimport sys\nimport os.path\nimport vlc\nfrom PyQt4 import QtGui, QtCore\n\nclass Player(QtGui.QMainWindow):\n    \"\"\"A simple Media Player using VLC and Qt\n    \"\"\"\n    def __init__(self, master=None):\n        QtGui.QMainWindow.__init__(self, master)\n        self.setWindowTitle(\"Media Player\")\n\n        # creating a basic vlc instance\n        self.instance = vlc.Instance()\n        # creating an empty vlc media player\n        self.mediaplayer = self.instance.media_player_new()\n\n        self.createUI()\n        self.isPaused = False\n\n    def createUI(self):\n        \"\"\"Set up the user interface, signals & slots\n        \"\"\"\n        self.widget = QtGui.QWidget(self)\n        self.setCentralWidget(self.widget)\n\n        # In this widget, the video will be drawn\n        if sys.platform == \"darwin\": # for MacOS\n            self.videoframe = QtGui.QMacCocoaViewContainer(0)\n        else:\n            self.videoframe = QtGui.QFrame()\n        self.palette = self.videoframe.palette()\n        self.palette.setColor (QtGui.QPalette.Window,\n                               QtGui.QColor(0,0,0))\n        self.videoframe.setPalette(self.palette)\n        self.videoframe.setAutoFillBackground(True)\n\n        self.positionslider = QtGui.QSlider(QtCore.Qt.Horizontal, self)\n        self.positionslider.setToolTip(\"Position\")\n        self.positionslider.setMaximum(1000)\n        self.connect(self.positionslider,\n                     QtCore.SIGNAL(\"sliderMoved(int)\"), self.setPosition)\n\n        self.hbuttonbox = QtGui.QHBoxLayout()\n        self.playbutton = QtGui.QPushButton(\"Play\")\n        self.hbuttonbox.addWidget(self.playbutton)\n        self.connect(self.playbutton, QtCore.SIGNAL(\"clicked()\"),\n                     self.PlayPause)\n\n        self.stopbutton = QtGui.QPushButton(\"Stop\")\n        self.hbuttonbox.addWidget(self.stopbutton)\n        self.connect(self.stopbutton, QtCore.SIGNAL(\"clicked()\"),\n                     self.Stop)\n\n        self.hbuttonbox.addStretch(1)\n        self.volumeslider = QtGui.QSlider(QtCore.Qt.Horizontal, self)\n        self.volumeslider.setMaximum(100)\n        self.volumeslider.setValue(self.mediaplayer.audio_get_volume())\n        self.volumeslider.setToolTip(\"Volume\")\n        self.hbuttonbox.addWidget(self.volumeslider)\n        self.connect(self.volumeslider,\n                     QtCore.SIGNAL(\"valueChanged(int)\"),\n                     self.setVolume)\n\n        self.vboxlayout = QtGui.QVBoxLayout()\n        self.vboxlayout.addWidget(self.videoframe)\n        self.vboxlayout.addWidget(self.positionslider)\n        self.vboxlayout.addLayout(self.hbuttonbox)\n\n        self.widget.setLayout(self.vboxlayout)\n\n        open = QtGui.QAction(\"&Open\", self)\n        self.connect(open, QtCore.SIGNAL(\"triggered()\"), self.OpenFile)\n        exit = QtGui.QAction(\"&Exit\", self)\n        self.connect(exit, QtCore.SIGNAL(\"triggered()\"), sys.exit)\n        menubar = self.menuBar()\n        filemenu = menubar.addMenu(\"&File\")\n        filemenu.addAction(open)\n        filemenu.addSeparator()\n        filemenu.addAction(exit)\n\n        self.timer = QtCore.QTimer(self)\n        self.timer.setInterval(200)\n        self.connect(self.timer, QtCore.SIGNAL(\"timeout()\"),\n                     self.updateUI)\n\n    def PlayPause(self):\n        \"\"\"Toggle play/pause status\n        \"\"\"\n        if self.mediaplayer.is_playing():\n            self.mediaplayer.pause()\n            self.playbutton.setText(\"Play\")\n            self.isPaused = True\n        else:\n            if self.mediaplayer.play() == -1:\n                self.OpenFile()\n                return\n            self.mediaplayer.play()\n            self.playbutton.setText(\"Pause\")\n            self.timer.start()\n            self.isPaused = False\n\n    def Stop(self):\n        \"\"\"Stop player\n        \"\"\"\n        self.mediaplayer.stop()\n        self.playbutton.setText(\"Play\")\n\n    def OpenFile(self, filename=None):\n        \"\"\"Open a media file in a MediaPlayer\n        \"\"\"\n        if filename is None:\n            filename = QtGui.QFileDialog.getOpenFileName(self, \"Open File\", os.path.expanduser('~'))\n        if not filename:\n            return\n\n        # create the media\n        if sys.version < '3':\n            filename = unicode(filename)\n        self.media = self.instance.media_new(filename)\n        # put the media in the media player\n        self.mediaplayer.set_media(self.media)\n\n        # parse the metadata of the file\n        self.media.parse()\n        # set the title of the track as window title\n        self.setWindowTitle(self.media.get_meta(0))\n\n        # the media player has to be 'connected' to the QFrame\n        # (otherwise a video would be displayed in it's own window)\n        # this is platform specific!\n        # you have to give the id of the QFrame (or similar object) to\n        # vlc, different platforms have different functions for this\n        if sys.platform.startswith('linux'): # for Linux using the X Server\n            self.mediaplayer.set_xwindow(self.videoframe.winId())\n        elif sys.platform == \"win32\": # for Windows\n            self.mediaplayer.set_hwnd(self.videoframe.winId())\n        elif sys.platform == \"darwin\": # for MacOS\n            self.mediaplayer.set_nsobject(self.videoframe.winId())\n        self.PlayPause()\n\n    def setVolume(self, Volume):\n        \"\"\"Set the volume\n        \"\"\"\n        self.mediaplayer.audio_set_volume(Volume)\n\n    def setPosition(self, position):\n        \"\"\"Set the position\n        \"\"\"\n        # setting the position to where the slider was dragged\n        self.mediaplayer.set_position(position / 1000.0)\n        # the vlc MediaPlayer needs a float value between 0 and 1, Qt\n        # uses integer variables, so you need a factor; the higher the\n        # factor, the more precise are the results\n        # (1000 should be enough)\n\n    def updateUI(self):\n        \"\"\"updates the user interface\"\"\"\n        # setting the slider to the desired position\n        self.positionslider.setValue(self.mediaplayer.get_position() * 1000)\n\n        if not self.mediaplayer.is_playing():\n            # no need to call this function if nothing is played\n            self.timer.stop()\n            if not self.isPaused:\n                # after the video finished, the play button stills shows\n                # \"Pause\", not the desired behavior of a media player\n                # this will fix it\n                self.Stop()\n\nif __name__ == \"__main__\":\n    app = QtGui.QApplication(sys.argv)\n    player = Player()\n    player.show()\n    player.resize(640, 480)\n    if sys.argv[1:]:\n        player.OpenFile(sys.argv[1])\n    sys.exit(app.exec_())\n"
  },
  {
    "path": "generated/2.2/examples/tkvlc.py",
    "content": "#! /usr/bin/python\n# -*- coding: utf-8 -*-\n\n#\n# tkinter example for VLC Python bindings\n# Copyright (C) 2015 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"A simple example for VLC python bindings using tkinter. Uses python 3.4\n\nAuthor: Patrick Fay\nDate: 23-09-2015\n\"\"\"\n\n# import external libraries\nimport vlc\nimport sys\n\nif sys.version_info[0] < 3:\n    import Tkinter as Tk\n    from Tkinter import ttk\n    from Tkinter.filedialog import askopenfilename\nelse:\n    import tkinter as Tk\n    from tkinter import ttk\n    from tkinter.filedialog import askopenfilename\n\n# import standard libraries\nimport os\nimport pathlib\nfrom threading import Thread, Event\nimport time\nimport platform\n\nclass ttkTimer(Thread):\n    \"\"\"a class serving same function as wxTimer... but there may be better ways to do this\n    \"\"\"\n    def __init__(self, callback, tick):\n        Thread.__init__(self)\n        self.callback = callback\n        self.stopFlag = Event()\n        self.tick = tick\n        self.iters = 0\n\n    def run(self):\n        while not self.stopFlag.wait(self.tick):\n            self.iters += 1\n            self.callback()\n\n    def stop(self):\n        self.stopFlag.set()\n\n    def get(self):\n        return self.iters\n\nclass Player(Tk.Frame):\n    \"\"\"The main window has to deal with events.\n    \"\"\"\n    def __init__(self, parent, title=None):\n        Tk.Frame.__init__(self, parent)\n\n        self.parent = parent\n\n        if title == None:\n            title = \"tk_vlc\"\n        self.parent.title(title)\n\n        # Menu Bar\n        #   File Menu\n        menubar = Tk.Menu(self.parent)\n        self.parent.config(menu=menubar)\n\n        fileMenu = Tk.Menu(menubar)\n        fileMenu.add_command(label=\"Open\", underline=0, command=self.OnOpen)\n        fileMenu.add_command(label=\"Exit\", underline=1, command=_quit)\n        menubar.add_cascade(label=\"File\", menu=fileMenu)\n\n        # The second panel holds controls\n        self.player = None\n        self.videopanel = ttk.Frame(self.parent)\n        self.canvas = Tk.Canvas(self.videopanel).pack(fill=Tk.BOTH,expand=1)\n        self.videopanel.pack(fill=Tk.BOTH,expand=1)\n\n        ctrlpanel = ttk.Frame(self.parent)\n        pause  = ttk.Button(ctrlpanel, text=\"Pause\", command=self.OnPause)\n        play   = ttk.Button(ctrlpanel, text=\"Play\", command=self.OnPlay)\n        stop   = ttk.Button(ctrlpanel, text=\"Stop\", command=self.OnStop)\n        volume = ttk.Button(ctrlpanel, text=\"Volume\", command=self.OnSetVolume)\n        pause.pack(side=Tk.LEFT)\n        play.pack(side=Tk.LEFT)\n        stop.pack(side=Tk.LEFT)\n        volume.pack(side=Tk.LEFT)\n        self.volume_var = Tk.IntVar()\n        self.volslider = Tk.Scale(ctrlpanel, variable=self.volume_var, command=self.volume_sel,\n                from_=0, to=100, orient=Tk.HORIZONTAL, length=100)\n        self.volslider.pack(side=Tk.LEFT)\n        ctrlpanel.pack(side=Tk.BOTTOM)\n\n        ctrlpanel2 = ttk.Frame(self.parent)\n        self.scale_var = Tk.DoubleVar()\n        self.timeslider_last_val = \"\"\n        self.timeslider = Tk.Scale(ctrlpanel2, variable=self.scale_var, command=self.scale_sel,\n                from_=0, to=1000, orient=Tk.HORIZONTAL, length=500)\n        self.timeslider.pack(side=Tk.BOTTOM, fill=Tk.X,expand=1)\n        self.timeslider_last_update = time.time()\n        ctrlpanel2.pack(side=Tk.BOTTOM,fill=Tk.X)\n\n\n        # VLC player controls\n        self.Instance = vlc.Instance()\n        self.player = self.Instance.media_player_new()\n\n        # below is a test, now use the File->Open file menu\n        #media = self.Instance.media_new('output.mp4')\n        #self.player.set_media(media)\n        #self.player.play() # hit the player button\n        #self.player.video_set_deinterlace(str_to_bytes('yadif'))\n\n        self.timer = ttkTimer(self.OnTimer, 1.0)\n        self.timer.start()\n        self.parent.update()\n\n        #self.player.set_hwnd(self.GetHandle()) # for windows, OnOpen does does this\n\n\n    def OnExit(self, evt):\n        \"\"\"Closes the window.\n        \"\"\"\n        self.Close()\n\n    def OnOpen(self):\n        \"\"\"Pop up a new dialow window to choose a file, then play the selected file.\n        \"\"\"\n        # if a file is already running, then stop it.\n        self.OnStop()\n\n        # Create a file dialog opened in the current home directory, where\n        # you can display all kind of files, having as title \"Choose a file\".\n        p = pathlib.Path(os.path.expanduser(\"~\"))\n        fullname =  askopenfilename(initialdir = p, title = \"choose your file\",filetypes = ((\"all files\",\"*.*\"),(\"mp4 files\",\"*.mp4\")))\n        if os.path.isfile(fullname):\n            dirname  = os.path.dirname(fullname)\n            filename = os.path.basename(fullname)\n            # Creation\n            self.Media = self.Instance.media_new(str(os.path.join(dirname, filename)))\n            self.player.set_media(self.Media)\n            # Report the title of the file chosen\n            #title = self.player.get_title()\n            #  if an error was encountred while retriving the title, then use\n            #  filename\n            #if title == -1:\n            #    title = filename\n            #self.SetTitle(\"%s - tkVLCplayer\" % title)\n\n            # set the window id where to render VLC's video output\n            if platform.system() == 'Windows':\n                self.player.set_hwnd(self.GetHandle())\n            else:\n                self.player.set_xwindow(self.GetHandle()) # this line messes up windows\n            # FIXME: this should be made cross-platform\n            self.OnPlay()\n\n            # set the volume slider to the current volume\n            #self.volslider.SetValue(self.player.audio_get_volume() / 2)\n            self.volslider.set(self.player.audio_get_volume())\n\n    def OnPlay(self):\n        \"\"\"Toggle the status to Play/Pause.\n        If no file is loaded, open the dialog window.\n        \"\"\"\n        # check if there is a file to play, otherwise open a\n        # Tk.FileDialog to select a file\n        if not self.player.get_media():\n            self.OnOpen()\n        else:\n            # Try to launch the media, if this fails display an error message\n            if self.player.play() == -1:\n                self.errorDialog(\"Unable to play.\")\n\n    def GetHandle(self):\n        return self.videopanel.winfo_id()\n\n    #def OnPause(self, evt):\n    def OnPause(self):\n        \"\"\"Pause the player.\n        \"\"\"\n        self.player.pause()\n\n    def OnStop(self):\n        \"\"\"Stop the player.\n        \"\"\"\n        self.player.stop()\n        # reset the time slider\n        self.timeslider.set(0)\n\n    def OnTimer(self):\n        \"\"\"Update the time slider according to the current movie time.\n        \"\"\"\n        if self.player == None:\n            return\n        # since the self.player.get_length can change while playing,\n        # re-set the timeslider to the correct range.\n        length = self.player.get_length()\n        dbl = length * 0.001\n        self.timeslider.config(to=dbl)\n\n        # update the time on the slider\n        tyme = self.player.get_time()\n        if tyme == -1:\n            tyme = 0\n        dbl = tyme * 0.001\n        self.timeslider_last_val = (\"%.0f\" % dbl) + \".0\"\n        # don't want to programatically change slider while user is messing with it.\n        # wait 2 seconds after user lets go of slider\n        if time.time() > (self.timeslider_last_update + 2.0):\n            self.timeslider.set(dbl)\n\n    def scale_sel(self, evt):\n        if self.player == None:\n            return\n        nval = self.scale_var.get()\n        sval = str(nval)\n        if self.timeslider_last_val != sval:\n            # this is a hack. The timer updates the time slider.\n            # This change causes this rtn (the 'slider has changed' rtn) to be invoked.\n            # I can't tell the difference between when the user has manually moved the slider and when\n            # the timer changed the slider. But when the user moves the slider tkinter only notifies\n            # this rtn about once per second and when the slider has quit moving.\n            # Also, the tkinter notification value has no fractional seconds.\n            # The timer update rtn saves off the last update value (rounded to integer seconds) in timeslider_last_val\n            # if the notification time (sval) is the same as the last saved time timeslider_last_val then\n            # we know that this notification is due to the timer changing the slider.\n            # otherwise the notification is due to the user changing the slider.\n            # if the user is changing the slider then I have the timer routine wait for at least\n            # 2 seconds before it starts updating the slider again (so the timer doesn't start fighting with the\n            # user)\n            self.timeslider_last_update = time.time()\n            mval = \"%.0f\" % (nval * 1000)\n            self.player.set_time(int(mval)) # expects milliseconds\n\n\n    def volume_sel(self, evt):\n        if self.player == None:\n            return\n        volume = self.volume_var.get()\n        if volume > 100:\n            volume = 100\n        if self.player.audio_set_volume(volume) == -1:\n            self.errorDialog(\"Failed to set volume\")\n\n\n\n    def OnToggleVolume(self, evt):\n        \"\"\"Mute/Unmute according to the audio button.\n        \"\"\"\n        is_mute = self.player.audio_get_mute()\n\n        self.player.audio_set_mute(not is_mute)\n        # update the volume slider;\n        # since vlc volume range is in [0, 200],\n        # and our volume slider has range [0, 100], just divide by 2.\n        self.volume_var.set(self.player.audio_get_volume())\n\n    def OnSetVolume(self):\n        \"\"\"Set the volume according to the volume sider.\n        \"\"\"\n        volume = self.volume_var.get()\n        # vlc.MediaPlayer.audio_set_volume returns 0 if success, -1 otherwise\n        if volume > 100:\n            volume = 100\n        if self.player.audio_set_volume(volume) == -1:\n            self.errorDialog(\"Failed to set volume\")\n\n    def errorDialog(self, errormessage):\n        \"\"\"Display a simple error dialog.\n        \"\"\"\n        Tk.tkMessageBox.showerror(self, 'Error', errormessage)\n\ndef Tk_get_root():\n    if not hasattr(Tk_get_root, \"root\"): #(1)\n        Tk_get_root.root= Tk.Tk()  #initialization call is inside the function\n    return Tk_get_root.root\n\ndef _quit():\n    print(\"_quit: bye\")\n    root = Tk_get_root()\n    root.quit()     # stops mainloop\n    root.destroy()  # this is necessary on Windows to prevent\n                    # Fatal Python Error: PyEval_RestoreThread: NULL tstate\n    os._exit(1)\n\nif __name__ == \"__main__\":\n    # Create a Tk.App(), which handles the windowing system event loop\n    root = Tk_get_root()\n    root.protocol(\"WM_DELETE_WINDOW\", _quit)\n\n    player = Player(root, title=\"tkinter vlc\")\n    # show the player window centred and run the application\n    root.mainloop()\n"
  },
  {
    "path": "generated/2.2/examples/wxvlc.py",
    "content": "#! /usr/bin/python\n# -*- coding: utf-8 -*-\n\n#\n# WX example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"\nA simple example for VLC python bindings using wxPython.\n\nAuthor: Michele Orrù\nDate: 23-11-2010\n\"\"\"\n\n# import external libraries\nimport wx # 2.8\nimport vlc\n\n# import standard libraries\nimport os\nimport sys\n\nclass Player(wx.Frame):\n    \"\"\"The main window has to deal with events.\n    \"\"\"\n    def __init__(self, title):\n        wx.Frame.__init__(self, None, -1, title,\n                          pos=wx.DefaultPosition, size=(550, 500))\n\n        # Menu Bar\n        #   File Menu\n        self.frame_menubar = wx.MenuBar()\n        self.file_menu = wx.Menu()\n        self.file_menu.Append(1, \"&Open\", \"Open from file..\")\n        self.file_menu.AppendSeparator()\n        self.file_menu.Append(2, \"&Close\", \"Quit\")\n        self.Bind(wx.EVT_MENU, self.OnOpen, id=1)\n        self.Bind(wx.EVT_MENU, self.OnExit, id=2)\n        self.frame_menubar.Append(self.file_menu, \"File\")\n        self.SetMenuBar(self.frame_menubar)\n\n        # Panels\n        # The first panel holds the video and it's all black\n        self.videopanel = wx.Panel(self, -1)\n        self.videopanel.SetBackgroundColour(wx.BLACK)\n\n        # The second panel holds controls\n        ctrlpanel = wx.Panel(self, -1 )\n        self.timeslider = wx.Slider(ctrlpanel, -1, 0, 0, 1000)\n        self.timeslider.SetRange(0, 1000)\n        pause  = wx.Button(ctrlpanel, label=\"Pause\")\n        play   = wx.Button(ctrlpanel, label=\"Play\")\n        stop   = wx.Button(ctrlpanel, label=\"Stop\")\n        volume = wx.Button(ctrlpanel, label=\"Volume\")\n        self.volslider = wx.Slider(ctrlpanel, -1, 0, 0, 100, size=(100, -1))\n\n        # Bind controls to events\n        self.Bind(wx.EVT_BUTTON, self.OnPlay, play)\n        self.Bind(wx.EVT_BUTTON, self.OnPause, pause)\n        self.Bind(wx.EVT_BUTTON, self.OnStop, stop)\n        self.Bind(wx.EVT_BUTTON, self.OnToggleVolume, volume)\n        self.Bind(wx.EVT_SLIDER, self.OnSetVolume, self.volslider)\n\n        # Give a pretty layout to the controls\n        ctrlbox = wx.BoxSizer(wx.VERTICAL)\n        box1 = wx.BoxSizer(wx.HORIZONTAL)\n        box2 = wx.BoxSizer(wx.HORIZONTAL)\n        # box1 contains the timeslider\n        box1.Add(self.timeslider, 1)\n        # box2 contains some buttons and the volume controls\n        box2.Add(play, flag=wx.RIGHT, border=5)\n        box2.Add(pause)\n        box2.Add(stop)\n        box2.Add((-1, -1), 1)\n        box2.Add(volume)\n        box2.Add(self.volslider, flag=wx.TOP | wx.LEFT, border=5)\n        # Merge box1 and box2 to the ctrlsizer\n        ctrlbox.Add(box1, flag=wx.EXPAND | wx.BOTTOM, border=10)\n        ctrlbox.Add(box2, 1, wx.EXPAND)\n        ctrlpanel.SetSizer(ctrlbox)\n        # Put everything togheter\n        sizer = wx.BoxSizer(wx.VERTICAL)\n        sizer.Add(self.videopanel, 1, flag=wx.EXPAND)\n        sizer.Add(ctrlpanel, flag=wx.EXPAND | wx.BOTTOM | wx.TOP, border=10)\n        self.SetSizer(sizer)\n        self.SetMinSize((350, 300))\n\n        # finally create the timer, which updates the timeslider\n        self.timer = wx.Timer(self)\n        self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)\n\n        # VLC player controls\n        self.Instance = vlc.Instance()\n        self.player = self.Instance.media_player_new()\n\n    def OnExit(self, evt):\n        \"\"\"Closes the window.\n        \"\"\"\n        self.Close()\n\n    def OnOpen(self, evt):\n        \"\"\"Pop up a new dialow window to choose a file, then play the selected file.\n        \"\"\"\n        # if a file is already running, then stop it.\n        self.OnStop(None)\n\n        # Create a file dialog opened in the current home directory, where\n        # you can display all kind of files, having as title \"Choose a file\".\n        dlg = wx.FileDialog(self, \"Choose a file\", os.path.expanduser('~'), \"\",\n                            \"*.*\", wx.OPEN)\n        if dlg.ShowModal() == wx.ID_OK:\n            dirname = dlg.GetDirectory()\n            filename = dlg.GetFilename()\n            # Creation\n            self.Media = self.Instance.media_new(unicode(os.path.join(dirname, filename)))\n            self.player.set_media(self.Media)\n            # Report the title of the file chosen\n            title = self.player.get_title()\n            #  if an error was encountred while retriving the title, then use\n            #  filename\n            if title == -1:\n                title = filename\n            self.SetTitle(\"%s - wxVLCplayer\" % title)\n\n            # set the window id where to render VLC's video output\n            handle = self.videopanel.GetHandle()\n            if sys.platform.startswith('linux'): # for Linux using the X Server\n                self.player.set_xwindow(handle)\n            elif sys.platform == \"win32\": # for Windows\n                self.player.set_hwnd(handle)\n            elif sys.platform == \"darwin\": # for MacOS\n                self.player.set_nsobject(handle)\n            self.OnPlay(None)\n\n            # set the volume slider to the current volume\n            self.volslider.SetValue(self.player.audio_get_volume() / 2)\n\n        # finally destroy the dialog\n        dlg.Destroy()\n\n    def OnPlay(self, evt):\n        \"\"\"Toggle the status to Play/Pause.\n\n        If no file is loaded, open the dialog window.\n        \"\"\"\n        # check if there is a file to play, otherwise open a\n        # wx.FileDialog to select a file\n        if not self.player.get_media():\n            self.OnOpen(None)\n        else:\n            # Try to launch the media, if this fails display an error message\n            if self.player.play() == -1:\n                self.errorDialog(\"Unable to play.\")\n            else:\n                self.timer.Start()\n\n    def OnPause(self, evt):\n        \"\"\"Pause the player.\n        \"\"\"\n        self.player.pause()\n\n    def OnStop(self, evt):\n        \"\"\"Stop the player.\n        \"\"\"\n        self.player.stop()\n        # reset the time slider\n        self.timeslider.SetValue(0)\n        self.timer.Stop()\n\n    def OnTimer(self, evt):\n        \"\"\"Update the time slider according to the current movie time.\n        \"\"\"\n        # since the self.player.get_length can change while playing,\n        # re-set the timeslider to the correct range.\n        length = self.player.get_length()\n        self.timeslider.SetRange(-1, length)\n\n        # update the time on the slider\n        time = self.player.get_time()\n        self.timeslider.SetValue(time)\n\n    def OnToggleVolume(self, evt):\n        \"\"\"Mute/Unmute according to the audio button.\n        \"\"\"\n        is_mute = self.player.audio_get_mute()\n\n        self.player.audio_set_mute(not is_mute)\n        # update the volume slider;\n        # since vlc volume range is in [0, 200],\n        # and our volume slider has range [0, 100], just divide by 2.\n        self.volslider.SetValue(self.player.audio_get_volume() / 2)\n\n    def OnSetVolume(self, evt):\n        \"\"\"Set the volume according to the volume sider.\n        \"\"\"\n        volume = self.volslider.GetValue() * 2\n        # vlc.MediaPlayer.audio_set_volume returns 0 if success, -1 otherwise\n        if self.player.audio_set_volume(volume) == -1:\n            self.errorDialog(\"Failed to set volume\")\n\n    def errorDialog(self, errormessage):\n        \"\"\"Display a simple error dialog.\n        \"\"\"\n        edialog = wx.MessageDialog(self, errormessage, 'Error', wx.OK|\n                                                                wx.ICON_ERROR)\n        edialog.ShowModal()\n\nif __name__ == \"__main__\":\n    # Create a wx.App(), which handles the windowing system event loop\n    app = wx.PySimpleApp()\n    # Create the window containing our small media player\n    player = Player(\"Simple PyVLC Player\")\n    # show the player window centred and run the application\n    player.Centre()\n    player.Show()\n    app.MainLoop()\n"
  },
  {
    "path": "generated/2.2/setup.py",
    "content": "from distribute_setup import use_setuptools\nuse_setuptools()\n\nfrom setuptools import setup\n\nsetup(name='python-vlc',\n      version = '2.2.6100',\n      author='Olivier Aubert',\n      author_email='contact@olivieraubert.net',\n      maintainer='Olivier Aubert',\n      maintainer_email='contact@olivieraubert.net',\n      url='http://wiki.videolan.org/PythonBinding',\n      py_modules=['vlc'],\n      keywords = [ 'vlc', 'video' ],\n      license = \"GPL\",\n      classifiers = [\n          \"Development Status :: 5 - Production/Stable\",\n          \"Intended Audience :: Developers\",\n          \"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)\",\n          \"Operating System :: MacOS :: MacOS X\",\n          \"Operating System :: Microsoft :: Windows\",\n          \"Operating System :: POSIX :: Linux\",\n          \"Operating System :: POSIX :: Other\",\n          \"Programming Language :: Python\",\n          \"Programming Language :: Python :: 2\",\n          \"Programming Language :: Python :: 3\",\n          \"Topic :: Multimedia\",\n          \"Topic :: Multimedia :: Sound/Audio\",\n          \"Topic :: Multimedia :: Video\",\n      ],\n      description = \"VLC bindings for python.\",\n      long_description = \"\"\"This module provides ctypes-based bindings (see\n      http://wiki.videolan.org/PythonBinding) for the native libvlc\n      API (see http://wiki.videolan.org/LibVLC) of the VLC video\n      player.\n\n      It has been automatically generated from the include files of\n      vlc 2.2.6, using generator 1.0.\n      \"\"\")\n"
  },
  {
    "path": "generated/2.2/vlc.py",
    "content": "#! /usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Python ctypes bindings for VLC\n#\n# Copyright (C) 2009-2017 the VideoLAN team\n# $Id: $\n#\n# Authors: Olivier Aubert <contact at olivieraubert.net>\n#          Jean Brouwers <MrJean1 at gmail.com>\n#          Geoff Salmon <geoff.salmon at gmail.com>\n#\n# This library is free software; you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License as\n# published by the Free Software Foundation; either version 2.1 of the\n# License, or (at your option) any later version.\n#\n# This library is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this library; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA\n\n\"\"\"This module provides bindings for the LibVLC public API, see\nU{http://wiki.videolan.org/LibVLC}.\n\nYou can find the documentation and a README file with some examples\nat U{http://www.olivieraubert.net/vlc/python-ctypes/}.\n\nBasically, the most important class is L{Instance}, which is used\nto create a libvlc instance.  From this instance, you then create\nL{MediaPlayer} and L{MediaListPlayer} instances.\n\nAlternatively, you may create instances of the L{MediaPlayer} and\nL{MediaListPlayer} class directly and an instance of L{Instance}\nwill be implicitly created.  The latter can be obtained using the\nC{get_instance} method of L{MediaPlayer} and L{MediaListPlayer}.\n\"\"\"\n\nimport ctypes\nfrom ctypes.util import find_library\nimport os\nimport sys\nimport functools\n\n# Used by EventManager in override.py\nfrom inspect import getargspec\n\nimport logging\nlogger = logging.getLogger(__name__)\n\n__version__ = \"2.2.6100\"\n__libvlc_version__ = \"2.2.6\"\n__generator_version__ = \"1.0\"\nbuild_date  = \"Wed Oct 11 15:37:38 2017 2.2.6\"\n\n# The libvlc doc states that filenames are expected to be in UTF8, do\n# not rely on sys.getfilesystemencoding() which will be confused,\n# esp. on windows.\nDEFAULT_ENCODING = 'utf-8'\n\nif sys.version_info[0] > 2:\n    str = str\n    unicode = str\n    bytes = bytes\n    basestring = (str, bytes)\n    PYTHON3 = True\n    def str_to_bytes(s):\n        \"\"\"Translate string or bytes to bytes.\n        \"\"\"\n        if isinstance(s, str):\n            return bytes(s, DEFAULT_ENCODING)\n        else:\n            return s\n\n    def bytes_to_str(b):\n        \"\"\"Translate bytes to string.\n        \"\"\"\n        if isinstance(b, bytes):\n            return b.decode(DEFAULT_ENCODING)\n        else:\n            return b\nelse:\n    str = str\n    unicode = unicode\n    bytes = str\n    basestring = basestring\n    PYTHON3 = False\n    def str_to_bytes(s):\n        \"\"\"Translate string or bytes to bytes.\n        \"\"\"\n        if isinstance(s, unicode):\n            return s.encode(DEFAULT_ENCODING)\n        else:\n            return s\n\n    def bytes_to_str(b):\n        \"\"\"Translate bytes to unicode string.\n        \"\"\"\n        if isinstance(b, str):\n            return unicode(b, DEFAULT_ENCODING)\n        else:\n            return b\n\n# Internal guard to prevent internal classes to be directly\n# instanciated.\n_internal_guard = object()\n\ndef find_lib():\n    dll = None\n    plugin_path = os.environ.get('PYTHON_VLC_MODULE_PATH', None)\n    if 'PYTHON_VLC_LIB_PATH' in os.environ:\n        try:\n            dll = ctypes.CDLL(os.environ['PYTHON_VLC_LIB_PATH'])\n        except OSError:\n            logger.error(\"Cannot load lib specified by PYTHON_VLC_LIB_PATH env. variable\")\n            sys.exit(1)\n    if plugin_path and not os.path.isdir(plugin_path):\n        logger.error(\"Invalid PYTHON_VLC_MODULE_PATH specified. Please fix.\")\n        sys.exit(1)\n    if dll is not None:\n        return dll, plugin_path\n\n    if sys.platform.startswith('linux'):\n        p = find_library('vlc')\n        try:\n            dll = ctypes.CDLL(p)\n        except OSError:  # may fail\n            dll = ctypes.CDLL('libvlc.so.5')\n    elif sys.platform.startswith('win'):\n        libname = 'libvlc.dll'\n        p = find_library(libname)\n        if p is None:\n            try:  # some registry settings\n                # leaner than win32api, win32con\n                if PYTHON3:\n                    import winreg as w\n                else:\n                    import _winreg as w\n                for r in w.HKEY_LOCAL_MACHINE, w.HKEY_CURRENT_USER:\n                    try:\n                        r = w.OpenKey(r, 'Software\\\\VideoLAN\\\\VLC')\n                        plugin_path, _ = w.QueryValueEx(r, 'InstallDir')\n                        w.CloseKey(r)\n                        break\n                    except w.error:\n                        pass\n            except ImportError:  # no PyWin32\n                pass\n            if plugin_path is None:\n                # try some standard locations.\n                programfiles = os.environ[\"ProgramFiles\"]\n                homedir = os.environ[\"HOMEDRIVE\"]\n                for p in ('{programfiles}\\\\VideoLan{libname}', '{homedir}:\\\\VideoLan{libname}',\n                          '{programfiles}{libname}',           '{homedir}:{libname}'):\n                    p = p.format(homedir = homedir,\n                                 programfiles = programfiles,\n                                 libname = '\\\\VLC\\\\' + libname)\n                    if os.path.exists(p):\n                        plugin_path = os.path.dirname(p)\n                        break\n            if plugin_path is not None:  # try loading\n                p = os.getcwd()\n                os.chdir(plugin_path)\n                 # if chdir failed, this will raise an exception\n                dll = ctypes.CDLL(libname)\n                 # restore cwd after dll has been loaded\n                os.chdir(p)\n            else:  # may fail\n                dll = ctypes.CDLL(libname)\n        else:\n            plugin_path = os.path.dirname(p)\n            dll = ctypes.CDLL(p)\n\n    elif sys.platform.startswith('darwin'):\n        # FIXME: should find a means to configure path\n        d = '/Applications/VLC.app/Contents/MacOS/'\n        p = d + 'lib/libvlc.dylib'\n        if os.path.exists(p):\n            dll = ctypes.CDLL(p)\n            for p in ('modules', 'plugins'):\n                p = d + p\n                if os.path.isdir(p):\n                    plugin_path = p\n                    break\n        else:  # hope, some PATH is set...\n            dll = ctypes.CDLL('libvlc.dylib')\n\n    else:\n        raise NotImplementedError('%s: %s not supported' % (sys.argv[0], sys.platform))\n\n    return (dll, plugin_path)\n\n# plugin_path used on win32 and MacOS in override.py\ndll, plugin_path  = find_lib()\n\nclass VLCException(Exception):\n    \"\"\"Exception raised by libvlc methods.\n    \"\"\"\n    pass\n\ntry:\n    _Ints = (int, long)\nexcept NameError:  # no long in Python 3+\n    _Ints =  int\n_Seqs = (list, tuple)\n\n# Used for handling *event_manager() methods.\nclass memoize_parameterless(object):\n    \"\"\"Decorator. Caches a parameterless method's return value each time it is called.\n\n    If called later with the same arguments, the cached value is returned\n    (not reevaluated).\n    Adapted from https://wiki.python.org/moin/PythonDecoratorLibrary\n    \"\"\"\n    def __init__(self, func):\n        self.func = func\n        self._cache = {}\n\n    def __call__(self, obj):\n        try:\n            return self._cache[obj]\n        except KeyError:\n            v = self._cache[obj] = self.func(obj)\n            return v\n\n    def __repr__(self):\n        \"\"\"Return the function's docstring.\n        \"\"\"\n        return self.func.__doc__\n\n    def __get__(self, obj, objtype):\n      \"\"\"Support instance methods.\n      \"\"\"\n      return functools.partial(self.__call__, obj)\n\n# Default instance. It is used to instanciate classes directly in the\n# OO-wrapper.\n_default_instance = None\n\ndef get_default_instance():\n    \"\"\"Return the default VLC.Instance.\n    \"\"\"\n    global _default_instance\n    if _default_instance is None:\n        _default_instance = Instance()\n    return _default_instance\n\n_Cfunctions = {}  # from LibVLC __version__\n_Globals = globals()  # sys.modules[__name__].__dict__\n\ndef _Cfunction(name, flags, errcheck, *types):\n    \"\"\"(INTERNAL) New ctypes function binding.\n    \"\"\"\n    if hasattr(dll, name) and name in _Globals:\n        p = ctypes.CFUNCTYPE(*types)\n        f = p((name, dll), flags)\n        if errcheck is not None:\n            f.errcheck = errcheck\n        # replace the Python function\n        # in this module, but only when\n        # running as python -O or -OO\n        if __debug__:\n            _Cfunctions[name] = f\n        else:\n            _Globals[name] = f\n        return f\n    raise NameError('no function %r' % (name,))\n\ndef _Cobject(cls, ctype):\n    \"\"\"(INTERNAL) New instance from ctypes.\n    \"\"\"\n    o = object.__new__(cls)\n    o._as_parameter_ = ctype\n    return o\n\ndef _Constructor(cls, ptr=_internal_guard):\n    \"\"\"(INTERNAL) New wrapper from ctypes.\n    \"\"\"\n    if ptr == _internal_guard:\n        raise VLCException(\"(INTERNAL) ctypes class. You should get references for this class through methods of the LibVLC API.\")\n    if ptr is None or ptr == 0:\n        return None\n    return _Cobject(cls, ctypes.c_void_p(ptr))\n\nclass _Cstruct(ctypes.Structure):\n    \"\"\"(INTERNAL) Base class for ctypes structures.\n    \"\"\"\n    _fields_ = []  # list of 2-tuples ('name', ctyptes.<type>)\n\n    def __str__(self):\n        l = [' %s:\\t%s' % (n, getattr(self, n)) for n, _ in self._fields_]\n        return '\\n'.join([self.__class__.__name__] + l)\n\n    def __repr__(self):\n        return '%s.%s' % (self.__class__.__module__, self)\n\nclass _Ctype(object):\n    \"\"\"(INTERNAL) Base class for ctypes.\n    \"\"\"\n    @staticmethod\n    def from_param(this):  # not self\n        \"\"\"(INTERNAL) ctypes parameter conversion method.\n        \"\"\"\n        if this is None:\n            return None\n        return this._as_parameter_\n\nclass ListPOINTER(object):\n    \"\"\"Just like a POINTER but accept a list of ctype as an argument.\n    \"\"\"\n    def __init__(self, etype):\n        self.etype = etype\n\n    def from_param(self, param):\n        if isinstance(param, _Seqs):\n            return (self.etype * len(param))(*param)\n        else:\n            return ctypes.POINTER(param)\n\n# errcheck functions for some native functions.\ndef string_result(result, func, arguments):\n    \"\"\"Errcheck function. Returns a string and frees the original pointer.\n\n    It assumes the result is a char *.\n    \"\"\"\n    if result:\n        # make a python string copy\n        s = bytes_to_str(ctypes.string_at(result))\n        # free original string ptr\n        libvlc_free(result)\n        return s\n    return None\n\ndef class_result(classname):\n    \"\"\"Errcheck function. Returns a function that creates the specified class.\n    \"\"\"\n    def wrap_errcheck(result, func, arguments):\n        if result is None:\n            return None\n        return classname(result)\n    return wrap_errcheck\n\n# Wrapper for the opaque struct libvlc_log_t\nclass Log(ctypes.Structure):\n    pass\nLog_ptr = ctypes.POINTER(Log)\n\n# FILE* ctypes wrapper, copied from\n# http://svn.python.org/projects/ctypes/trunk/ctypeslib/ctypeslib/contrib/pythonhdr.py\nclass FILE(ctypes.Structure):\n    pass\nFILE_ptr = ctypes.POINTER(FILE)\n\nif PYTHON3:\n    PyFile_FromFd = ctypes.pythonapi.PyFile_FromFd\n    PyFile_FromFd.restype = ctypes.py_object\n    PyFile_FromFd.argtypes = [ctypes.c_int,\n                              ctypes.c_char_p,\n                              ctypes.c_char_p,\n                              ctypes.c_int,\n                              ctypes.c_char_p,\n                              ctypes.c_char_p,\n                              ctypes.c_char_p,\n                              ctypes.c_int ]\n\n    PyFile_AsFd = ctypes.pythonapi.PyObject_AsFileDescriptor\n    PyFile_AsFd.restype = ctypes.c_int\n    PyFile_AsFd.argtypes = [ctypes.py_object]\nelse:\n    PyFile_FromFile = ctypes.pythonapi.PyFile_FromFile\n    PyFile_FromFile.restype = ctypes.py_object\n    PyFile_FromFile.argtypes = [FILE_ptr,\n                                ctypes.c_char_p,\n                                ctypes.c_char_p,\n                                ctypes.CFUNCTYPE(ctypes.c_int, FILE_ptr)]\n\n    PyFile_AsFile = ctypes.pythonapi.PyFile_AsFile\n    PyFile_AsFile.restype = FILE_ptr\n    PyFile_AsFile.argtypes = [ctypes.py_object]\n\n # Generated enum types #\n\nclass _Enum(ctypes.c_uint):\n    '''(INTERNAL) Base class\n    '''\n    _enum_names_ = {}\n\n    def __str__(self):\n        n = self._enum_names_.get(self.value, '') or ('FIXME_(%r)' % (self.value,))\n        return '.'.join((self.__class__.__name__, n))\n\n    def __hash__(self):\n        return self.value\n\n    def __repr__(self):\n        return '.'.join((self.__class__.__module__, self.__str__()))\n\n    def __eq__(self, other):\n        return ( (isinstance(other, _Enum) and self.value == other.value)\n              or (isinstance(other, _Ints) and self.value == other) )\n\n    def __ne__(self, other):\n        return not self.__eq__(other)\n\nclass LogLevel(_Enum):\n    '''Logging messages level.\n\\note future libvlc versions may define new levels.\n    '''\n    _enum_names_ = {\n        0: 'DEBUG',\n        2: 'NOTICE',\n        3: 'WARNING',\n        4: 'ERROR',\n    }\nLogLevel.DEBUG   = LogLevel(0)\nLogLevel.ERROR   = LogLevel(4)\nLogLevel.NOTICE  = LogLevel(2)\nLogLevel.WARNING = LogLevel(3)\n\nclass EventType(_Enum):\n    '''Event types.\n    '''\n    _enum_names_ = {\n        0: 'MediaMetaChanged',\n        1: 'MediaSubItemAdded',\n        2: 'MediaDurationChanged',\n        3: 'MediaParsedChanged',\n        4: 'MediaFreed',\n        5: 'MediaStateChanged',\n        6: 'MediaSubItemTreeAdded',\n        0x100: 'MediaPlayerMediaChanged',\n        257: 'MediaPlayerNothingSpecial',\n        258: 'MediaPlayerOpening',\n        259: 'MediaPlayerBuffering',\n        260: 'MediaPlayerPlaying',\n        261: 'MediaPlayerPaused',\n        262: 'MediaPlayerStopped',\n        263: 'MediaPlayerForward',\n        264: 'MediaPlayerBackward',\n        265: 'MediaPlayerEndReached',\n        266: 'MediaPlayerEncounteredError',\n        267: 'MediaPlayerTimeChanged',\n        268: 'MediaPlayerPositionChanged',\n        269: 'MediaPlayerSeekableChanged',\n        270: 'MediaPlayerPausableChanged',\n        271: 'MediaPlayerTitleChanged',\n        272: 'MediaPlayerSnapshotTaken',\n        273: 'MediaPlayerLengthChanged',\n        274: 'MediaPlayerVout',\n        275: 'MediaPlayerScrambledChanged',\n        279: 'MediaPlayerCorked',\n        280: 'MediaPlayerUncorked',\n        281: 'MediaPlayerMuted',\n        282: 'MediaPlayerUnmuted',\n        283: 'MediaPlayerAudioVolume',\n        0x200: 'MediaListItemAdded',\n        513: 'MediaListWillAddItem',\n        514: 'MediaListItemDeleted',\n        515: 'MediaListWillDeleteItem',\n        0x300: 'MediaListViewItemAdded',\n        769: 'MediaListViewWillAddItem',\n        770: 'MediaListViewItemDeleted',\n        771: 'MediaListViewWillDeleteItem',\n        0x400: 'MediaListPlayerPlayed',\n        1025: 'MediaListPlayerNextItemSet',\n        1026: 'MediaListPlayerStopped',\n        0x500: 'MediaDiscovererStarted',\n        1281: 'MediaDiscovererEnded',\n        0x600: 'VlmMediaAdded',\n        1537: 'VlmMediaRemoved',\n        1538: 'VlmMediaChanged',\n        1539: 'VlmMediaInstanceStarted',\n        1540: 'VlmMediaInstanceStopped',\n        1541: 'VlmMediaInstanceStatusInit',\n        1542: 'VlmMediaInstanceStatusOpening',\n        1543: 'VlmMediaInstanceStatusPlaying',\n        1544: 'VlmMediaInstanceStatusPause',\n        1545: 'VlmMediaInstanceStatusEnd',\n        1546: 'VlmMediaInstanceStatusError',\n    }\nEventType.MediaDiscovererEnded          = EventType(1281)\nEventType.MediaDiscovererStarted        = EventType(0x500)\nEventType.MediaDurationChanged          = EventType(2)\nEventType.MediaFreed                    = EventType(4)\nEventType.MediaListItemAdded            = EventType(0x200)\nEventType.MediaListItemDeleted          = EventType(514)\nEventType.MediaListPlayerNextItemSet    = EventType(1025)\nEventType.MediaListPlayerPlayed         = EventType(0x400)\nEventType.MediaListPlayerStopped        = EventType(1026)\nEventType.MediaListViewItemAdded        = EventType(0x300)\nEventType.MediaListViewItemDeleted      = EventType(770)\nEventType.MediaListViewWillAddItem      = EventType(769)\nEventType.MediaListViewWillDeleteItem   = EventType(771)\nEventType.MediaListWillAddItem          = EventType(513)\nEventType.MediaListWillDeleteItem       = EventType(515)\nEventType.MediaMetaChanged              = EventType(0)\nEventType.MediaParsedChanged            = EventType(3)\nEventType.MediaPlayerAudioVolume        = EventType(283)\nEventType.MediaPlayerBackward           = EventType(264)\nEventType.MediaPlayerBuffering          = EventType(259)\nEventType.MediaPlayerCorked             = EventType(279)\nEventType.MediaPlayerEncounteredError   = EventType(266)\nEventType.MediaPlayerEndReached         = EventType(265)\nEventType.MediaPlayerForward            = EventType(263)\nEventType.MediaPlayerLengthChanged      = EventType(273)\nEventType.MediaPlayerMediaChanged       = EventType(0x100)\nEventType.MediaPlayerMuted              = EventType(281)\nEventType.MediaPlayerNothingSpecial     = EventType(257)\nEventType.MediaPlayerOpening            = EventType(258)\nEventType.MediaPlayerPausableChanged    = EventType(270)\nEventType.MediaPlayerPaused             = EventType(261)\nEventType.MediaPlayerPlaying            = EventType(260)\nEventType.MediaPlayerPositionChanged    = EventType(268)\nEventType.MediaPlayerScrambledChanged   = EventType(275)\nEventType.MediaPlayerSeekableChanged    = EventType(269)\nEventType.MediaPlayerSnapshotTaken      = EventType(272)\nEventType.MediaPlayerStopped            = EventType(262)\nEventType.MediaPlayerTimeChanged        = EventType(267)\nEventType.MediaPlayerTitleChanged       = EventType(271)\nEventType.MediaPlayerUncorked           = EventType(280)\nEventType.MediaPlayerUnmuted            = EventType(282)\nEventType.MediaPlayerVout               = EventType(274)\nEventType.MediaStateChanged             = EventType(5)\nEventType.MediaSubItemAdded             = EventType(1)\nEventType.MediaSubItemTreeAdded         = EventType(6)\nEventType.VlmMediaAdded                 = EventType(0x600)\nEventType.VlmMediaChanged               = EventType(1538)\nEventType.VlmMediaInstanceStarted       = EventType(1539)\nEventType.VlmMediaInstanceStatusEnd     = EventType(1545)\nEventType.VlmMediaInstanceStatusError   = EventType(1546)\nEventType.VlmMediaInstanceStatusInit    = EventType(1541)\nEventType.VlmMediaInstanceStatusOpening = EventType(1542)\nEventType.VlmMediaInstanceStatusPause   = EventType(1544)\nEventType.VlmMediaInstanceStatusPlaying = EventType(1543)\nEventType.VlmMediaInstanceStopped       = EventType(1540)\nEventType.VlmMediaRemoved               = EventType(1537)\n\nclass Meta(_Enum):\n    '''Meta data types.\n    '''\n    _enum_names_ = {\n        0: 'Title',\n        1: 'Artist',\n        2: 'Genre',\n        3: 'Copyright',\n        4: 'Album',\n        5: 'TrackNumber',\n        6: 'Description',\n        7: 'Rating',\n        8: 'Date',\n        9: 'Setting',\n        10: 'URL',\n        11: 'Language',\n        12: 'NowPlaying',\n        13: 'Publisher',\n        14: 'EncodedBy',\n        15: 'ArtworkURL',\n        16: 'TrackID',\n        17: 'TrackTotal',\n        18: 'Director',\n        19: 'Season',\n        20: 'Episode',\n        21: 'ShowName',\n        22: 'Actors',\n    }\nMeta.Actors      = Meta(22)\nMeta.Album       = Meta(4)\nMeta.Artist      = Meta(1)\nMeta.ArtworkURL  = Meta(15)\nMeta.Copyright   = Meta(3)\nMeta.Date        = Meta(8)\nMeta.Description = Meta(6)\nMeta.Director    = Meta(18)\nMeta.EncodedBy   = Meta(14)\nMeta.Episode     = Meta(20)\nMeta.Genre       = Meta(2)\nMeta.Language    = Meta(11)\nMeta.NowPlaying  = Meta(12)\nMeta.Publisher   = Meta(13)\nMeta.Rating      = Meta(7)\nMeta.Season      = Meta(19)\nMeta.Setting     = Meta(9)\nMeta.ShowName    = Meta(21)\nMeta.Title       = Meta(0)\nMeta.TrackID     = Meta(16)\nMeta.TrackNumber = Meta(5)\nMeta.TrackTotal  = Meta(17)\nMeta.URL         = Meta(10)\n\nclass State(_Enum):\n    '''Note the order of libvlc_state_t enum must match exactly the order of\nSee mediacontrol_playerstatus, See input_state_e enums,\nand videolan.libvlc.state (at bindings/cil/src/media.cs).\nexpected states by web plugins are:\nidle/close=0, opening=1, buffering=2, playing=3, paused=4,\nstopping=5, ended=6, error=7.\n    '''\n    _enum_names_ = {\n        0: 'NothingSpecial',\n        1: 'Opening',\n        2: 'Buffering',\n        3: 'Playing',\n        4: 'Paused',\n        5: 'Stopped',\n        6: 'Ended',\n        7: 'Error',\n    }\nState.Buffering      = State(2)\nState.Ended          = State(6)\nState.Error          = State(7)\nState.NothingSpecial = State(0)\nState.Opening        = State(1)\nState.Paused         = State(4)\nState.Playing        = State(3)\nState.Stopped        = State(5)\n\nclass TrackType(_Enum):\n    '''N/A\n    '''\n    _enum_names_ = {\n        -1: 'unknown',\n        0: 'audio',\n        1: 'video',\n        2: 'text',\n    }\nTrackType.audio   = TrackType(0)\nTrackType.text    = TrackType(2)\nTrackType.unknown = TrackType(-1)\nTrackType.video   = TrackType(1)\n\nclass VideoMarqueeOption(_Enum):\n    '''Marq options definition.\n    '''\n    _enum_names_ = {\n        0: 'Enable',\n        1: 'Text',\n        2: 'Color',\n        3: 'Opacity',\n        4: 'Position',\n        5: 'Refresh',\n        6: 'Size',\n        7: 'Timeout',\n        8: 'marquee_X',\n        9: 'marquee_Y',\n    }\nVideoMarqueeOption.Color     = VideoMarqueeOption(2)\nVideoMarqueeOption.Enable    = VideoMarqueeOption(0)\nVideoMarqueeOption.Opacity   = VideoMarqueeOption(3)\nVideoMarqueeOption.Position  = VideoMarqueeOption(4)\nVideoMarqueeOption.Refresh   = VideoMarqueeOption(5)\nVideoMarqueeOption.Size      = VideoMarqueeOption(6)\nVideoMarqueeOption.Text      = VideoMarqueeOption(1)\nVideoMarqueeOption.Timeout   = VideoMarqueeOption(7)\nVideoMarqueeOption.marquee_X = VideoMarqueeOption(8)\nVideoMarqueeOption.marquee_Y = VideoMarqueeOption(9)\n\nclass NavigateMode(_Enum):\n    '''Navigation mode.\n    '''\n    _enum_names_ = {\n        0: 'activate',\n        1: 'up',\n        2: 'down',\n        3: 'left',\n        4: 'right',\n    }\nNavigateMode.activate = NavigateMode(0)\nNavigateMode.down     = NavigateMode(2)\nNavigateMode.left     = NavigateMode(3)\nNavigateMode.right    = NavigateMode(4)\nNavigateMode.up       = NavigateMode(1)\n\nclass Position(_Enum):\n    '''Enumeration of values used to set position (e.g. of video title).\n    '''\n    _enum_names_ = {\n        -1: 'disable',\n        0: 'center',\n        1: 'left',\n        2: 'right',\n        3: 'top',\n        4: 'left',\n        5: 'right',\n        6: 'bottom',\n        7: 'left',\n        8: 'right',\n    }\nPosition.bottom  = Position(6)\nPosition.center  = Position(0)\nPosition.disable = Position(-1)\nPosition.left    = Position(1)\nPosition.left    = Position(4)\nPosition.left    = Position(7)\nPosition.right   = Position(2)\nPosition.right   = Position(5)\nPosition.right   = Position(8)\nPosition.top     = Position(3)\n\nclass VideoLogoOption(_Enum):\n    '''Option values for libvlc_video_{get,set}_logo_{int,string}.\n    '''\n    _enum_names_ = {\n        0: 'enable',\n        1: 'file',\n        2: 'logo_x',\n        3: 'logo_y',\n        4: 'delay',\n        5: 'repeat',\n        6: 'opacity',\n        7: 'position',\n    }\nVideoLogoOption.delay    = VideoLogoOption(4)\nVideoLogoOption.enable   = VideoLogoOption(0)\nVideoLogoOption.file     = VideoLogoOption(1)\nVideoLogoOption.logo_x   = VideoLogoOption(2)\nVideoLogoOption.logo_y   = VideoLogoOption(3)\nVideoLogoOption.opacity  = VideoLogoOption(6)\nVideoLogoOption.position = VideoLogoOption(7)\nVideoLogoOption.repeat   = VideoLogoOption(5)\n\nclass VideoAdjustOption(_Enum):\n    '''Option values for libvlc_video_{get,set}_adjust_{int,float,bool}.\n    '''\n    _enum_names_ = {\n        0: 'Enable',\n        1: 'Contrast',\n        2: 'Brightness',\n        3: 'Hue',\n        4: 'Saturation',\n        5: 'Gamma',\n    }\nVideoAdjustOption.Brightness = VideoAdjustOption(2)\nVideoAdjustOption.Contrast   = VideoAdjustOption(1)\nVideoAdjustOption.Enable     = VideoAdjustOption(0)\nVideoAdjustOption.Gamma      = VideoAdjustOption(5)\nVideoAdjustOption.Hue        = VideoAdjustOption(3)\nVideoAdjustOption.Saturation = VideoAdjustOption(4)\n\nclass AudioOutputDeviceTypes(_Enum):\n    '''Audio device types.\n    '''\n    _enum_names_ = {\n        -1: 'Error',\n        1: 'Mono',\n        2: 'Stereo',\n        4: '_2F2R',\n        5: '_3F2R',\n        6: '_5_1',\n        7: '_6_1',\n        8: '_7_1',\n        10: 'SPDIF',\n    }\nAudioOutputDeviceTypes.Error  = AudioOutputDeviceTypes(-1)\nAudioOutputDeviceTypes.Mono   = AudioOutputDeviceTypes(1)\nAudioOutputDeviceTypes.SPDIF  = AudioOutputDeviceTypes(10)\nAudioOutputDeviceTypes.Stereo = AudioOutputDeviceTypes(2)\nAudioOutputDeviceTypes._2F2R  = AudioOutputDeviceTypes(4)\nAudioOutputDeviceTypes._3F2R  = AudioOutputDeviceTypes(5)\nAudioOutputDeviceTypes._5_1   = AudioOutputDeviceTypes(6)\nAudioOutputDeviceTypes._6_1   = AudioOutputDeviceTypes(7)\nAudioOutputDeviceTypes._7_1   = AudioOutputDeviceTypes(8)\n\nclass AudioOutputChannel(_Enum):\n    '''Audio channels.\n    '''\n    _enum_names_ = {\n        -1: 'Error',\n        1: 'Stereo',\n        2: 'RStereo',\n        3: 'Left',\n        4: 'Right',\n        5: 'Dolbys',\n    }\nAudioOutputChannel.Dolbys  = AudioOutputChannel(5)\nAudioOutputChannel.Error   = AudioOutputChannel(-1)\nAudioOutputChannel.Left    = AudioOutputChannel(3)\nAudioOutputChannel.RStereo = AudioOutputChannel(2)\nAudioOutputChannel.Right   = AudioOutputChannel(4)\nAudioOutputChannel.Stereo  = AudioOutputChannel(1)\n\nclass PlaybackMode(_Enum):\n    '''Defines playback modes for playlist.\n    '''\n    _enum_names_ = {\n        0: 'default',\n        1: 'loop',\n        2: 'repeat',\n    }\nPlaybackMode.default = PlaybackMode(0)\nPlaybackMode.loop    = PlaybackMode(1)\nPlaybackMode.repeat  = PlaybackMode(2)\n\nclass Callback(ctypes.c_void_p):\n    \"\"\"Callback function notification.\n    @param p_event: the event triggering the callback.\n    \"\"\"\n    pass\nclass LogCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for LibVLC log message handler.\n    @param data: data pointer as given to L{libvlc_log_set}().\n    @param level: message level (@ref enum libvlc_log_level).\n    @param ctx: message context (meta-information about the message).\n    @param fmt: printf() format string (as defined by ISO C11).\n    @param args: variable argument list for the format @note Log message handlers B{must} be thread-safe. @warning The message context pointer, the format string parameters and the variable arguments are only valid until the callback returns.\n    \"\"\"\n    pass\nclass VideoLockCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to allocate and lock a picture buffer.\n    Whenever a new video frame needs to be decoded, the lock callback is\n    invoked. Depending on the video chroma, one or three pixel planes of\n    adequate dimensions must be returned via the second parameter. Those\n    planes must be aligned on 32-bytes boundaries.\n    @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN].\n    @param planes: start address of the pixel planes (LibVLC allocates the array of void pointers, this callback must initialize the array) [OUT].\n    @return: a private pointer for the display and unlock callbacks to identify the picture buffers.\n    \"\"\"\n    pass\nclass VideoUnlockCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to unlock a picture buffer.\n    When the video frame decoding is complete, the unlock callback is invoked.\n    This callback might not be needed at all. It is only an indication that the\n    application can now read the pixel values if it needs to.\n    @warning: A picture buffer is unlocked after the picture is decoded,\n    but before the picture is displayed.\n    @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN].\n    @param picture: private pointer returned from the @ref libvlc_video_lock_cb callback [IN].\n    @param planes: pixel planes as defined by the @ref libvlc_video_lock_cb callback (this parameter is only for convenience) [IN].\n    \"\"\"\n    pass\nclass VideoDisplayCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to display a picture.\n    When the video frame needs to be shown, as determined by the media playback\n    clock, the display callback is invoked.\n    @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN].\n    @param picture: private pointer returned from the @ref libvlc_video_lock_cb callback [IN].\n    \"\"\"\n    pass\nclass VideoFormatCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to configure picture buffers format.\n    This callback gets the format of the video as output by the video decoder\n    and the chain of video filters (if any). It can opt to change any parameter\n    as it needs. In that case, LibVLC will attempt to convert the video format\n    (rescaling and chroma conversion) but these operations can be CPU intensive.\n    @param opaque: pointer to the private pointer passed to L{libvlc_video_set_callbacks}() [IN/OUT].\n    @param chroma: pointer to the 4 bytes video format identifier [IN/OUT].\n    @param width: pointer to the pixel width [IN/OUT].\n    @param height: pointer to the pixel height [IN/OUT].\n    @param pitches: table of scanline pitches in bytes for each pixel plane (the table is allocated by LibVLC) [OUT].\n    @return: lines table of scanlines count for each plane.\n    \"\"\"\n    pass\nclass VideoCleanupCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to configure picture buffers format.\n    @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() (and possibly modified by @ref libvlc_video_format_cb) [IN].\n    \"\"\"\n    pass\nclass AudioPlayCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio playback.\n    @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n    @param samples: pointer to the first audio sample to play back [IN].\n    @param count: number of audio samples to play back.\n    @param pts: expected play time stamp (see libvlc_delay()).\n    \"\"\"\n    pass\nclass AudioPauseCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio pause.\n    @note: The pause callback is never called if the audio is already paused.\n    @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n    @param pts: time stamp of the pause request (should be elapsed already).\n    \"\"\"\n    pass\nclass AudioResumeCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio resumption (i.e. restart from pause).\n    @note: The resume callback is never called if the audio is not paused.\n    @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n    @param pts: time stamp of the resumption request (should be elapsed already).\n    \"\"\"\n    pass\nclass AudioFlushCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio buffer flush\n    (i.e. discard all pending buffers and stop playback as soon as possible).\n    @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n    \"\"\"\n    pass\nclass AudioDrainCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio buffer drain\n    (i.e. wait for pending buffers to be played).\n    @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n    \"\"\"\n    pass\nclass AudioSetVolumeCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio volume change.\n    @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n    @param volume: software volume (1. = nominal, 0. = mute).\n    @param mute: muted flag.\n    \"\"\"\n    pass\nclass AudioSetupCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to setup the audio playback.\n    This is called when the media player needs to create a new audio output.\n    @param opaque: pointer to the data pointer passed to L{libvlc_audio_set_callbacks}() [IN/OUT].\n    @param format: 4 bytes sample format [IN/OUT].\n    @param rate: sample rate [IN/OUT].\n    @param channels: channels count [IN/OUT].\n    @return: 0 on success, anything else to skip audio playback.\n    \"\"\"\n    pass\nclass AudioCleanupCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio playback cleanup.\n    This is called when the media player no longer needs an audio output.\n    @param opaque: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n    \"\"\"\n    pass\nclass CallbackDecorators(object):\n    \"Class holding various method decorators for callback functions.\"\n    Callback = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)\n    Callback.__doc__ = '''Callback function notification.\n        @param p_event: the event triggering the callback.\n    ''' \n    LogCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, Log_ptr, ctypes.c_char_p, ctypes.c_void_p)\n    LogCb.__doc__ = '''Callback prototype for LibVLC log message handler.\n        @param data: data pointer as given to L{libvlc_log_set}().\n        @param level: message level (@ref enum libvlc_log_level).\n        @param ctx: message context (meta-information about the message).\n        @param fmt: printf() format string (as defined by ISO C11).\n        @param args: variable argument list for the format @note Log message handlers B{must} be thread-safe. @warning The message context pointer, the format string parameters and the variable arguments are only valid until the callback returns.\n    ''' \n    VideoLockCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p))\n    VideoLockCb.__doc__ = '''Callback prototype to allocate and lock a picture buffer.\n        Whenever a new video frame needs to be decoded, the lock callback is\n        invoked. Depending on the video chroma, one or three pixel planes of\n        adequate dimensions must be returned via the second parameter. Those\n        planes must be aligned on 32-bytes boundaries.\n        @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN].\n        @param planes: start address of the pixel planes (LibVLC allocates the array of void pointers, this callback must initialize the array) [OUT].\n        @return: a private pointer for the display and unlock callbacks to identify the picture buffers.\n    ''' \n    VideoUnlockCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p))\n    VideoUnlockCb.__doc__ = '''Callback prototype to unlock a picture buffer.\n        When the video frame decoding is complete, the unlock callback is invoked.\n        This callback might not be needed at all. It is only an indication that the\n        application can now read the pixel values if it needs to.\n        @warning: A picture buffer is unlocked after the picture is decoded,\n        but before the picture is displayed.\n        @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN].\n        @param picture: private pointer returned from the @ref libvlc_video_lock_cb callback [IN].\n        @param planes: pixel planes as defined by the @ref libvlc_video_lock_cb callback (this parameter is only for convenience) [IN].\n    ''' \n    VideoDisplayCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)\n    VideoDisplayCb.__doc__ = '''Callback prototype to display a picture.\n        When the video frame needs to be shown, as determined by the media playback\n        clock, the display callback is invoked.\n        @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN].\n        @param picture: private pointer returned from the @ref libvlc_video_lock_cb callback [IN].\n    ''' \n    VideoFormatCb = ctypes.CFUNCTYPE(ctypes.POINTER(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))\n    VideoFormatCb.__doc__ = '''Callback prototype to configure picture buffers format.\n        This callback gets the format of the video as output by the video decoder\n        and the chain of video filters (if any). It can opt to change any parameter\n        as it needs. In that case, LibVLC will attempt to convert the video format\n        (rescaling and chroma conversion) but these operations can be CPU intensive.\n        @param opaque: pointer to the private pointer passed to L{libvlc_video_set_callbacks}() [IN/OUT].\n        @param chroma: pointer to the 4 bytes video format identifier [IN/OUT].\n        @param width: pointer to the pixel width [IN/OUT].\n        @param height: pointer to the pixel height [IN/OUT].\n        @param pitches: table of scanline pitches in bytes for each pixel plane (the table is allocated by LibVLC) [OUT].\n        @return: lines table of scanlines count for each plane.\n    ''' \n    VideoCleanupCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p)\n    VideoCleanupCb.__doc__ = '''Callback prototype to configure picture buffers format.\n        @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() (and possibly modified by @ref libvlc_video_format_cb) [IN].\n    ''' \n    AudioPlayCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint, ctypes.c_int64)\n    AudioPlayCb.__doc__ = '''Callback prototype for audio playback.\n        @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n        @param samples: pointer to the first audio sample to play back [IN].\n        @param count: number of audio samples to play back.\n        @param pts: expected play time stamp (see libvlc_delay()).\n    ''' \n    AudioPauseCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int64)\n    AudioPauseCb.__doc__ = '''Callback prototype for audio pause.\n        @note: The pause callback is never called if the audio is already paused.\n        @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n        @param pts: time stamp of the pause request (should be elapsed already).\n    ''' \n    AudioResumeCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int64)\n    AudioResumeCb.__doc__ = '''Callback prototype for audio resumption (i.e. restart from pause).\n        @note: The resume callback is never called if the audio is not paused.\n        @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n        @param pts: time stamp of the resumption request (should be elapsed already).\n    ''' \n    AudioFlushCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int64)\n    AudioFlushCb.__doc__ = '''Callback prototype for audio buffer flush\n        (i.e. discard all pending buffers and stop playback as soon as possible).\n        @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n    ''' \n    AudioDrainCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p)\n    AudioDrainCb.__doc__ = '''Callback prototype for audio buffer drain\n        (i.e. wait for pending buffers to be played).\n        @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n    ''' \n    AudioSetVolumeCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_float, ctypes.c_bool)\n    AudioSetVolumeCb.__doc__ = '''Callback prototype for audio volume change.\n        @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n        @param volume: software volume (1. = nominal, 0. = mute).\n        @param mute: muted flag.\n    ''' \n    AudioSetupCb = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_void_p), ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint))\n    AudioSetupCb.__doc__ = '''Callback prototype to setup the audio playback.\n        This is called when the media player needs to create a new audio output.\n        @param opaque: pointer to the data pointer passed to L{libvlc_audio_set_callbacks}() [IN/OUT].\n        @param format: 4 bytes sample format [IN/OUT].\n        @param rate: sample rate [IN/OUT].\n        @param channels: channels count [IN/OUT].\n        @return: 0 on success, anything else to skip audio playback.\n    ''' \n    AudioCleanupCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p)\n    AudioCleanupCb.__doc__ = '''Callback prototype for audio playback cleanup.\n        This is called when the media player no longer needs an audio output.\n        @param opaque: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN].\n    ''' \ncb = CallbackDecorators\n # End of generated enum types #\n\n # From libvlc_structures.h\n\nclass AudioOutput(_Cstruct):\n\n    def __str__(self):\n        return '%s(%s:%s)' % (self.__class__.__name__, self.name, self.description)\n\nAudioOutput._fields_ = [  # recursive struct\n    ('name',        ctypes.c_char_p),\n    ('description', ctypes.c_char_p),\n    ('next',        ctypes.POINTER(AudioOutput)),\n    ]\n\nclass LogMessage(_Cstruct):\n    _fields_ = [\n        ('size',     ctypes.c_uint  ),\n        ('severity', ctypes.c_int   ),\n        ('type',     ctypes.c_char_p),\n        ('name',     ctypes.c_char_p),\n        ('header',   ctypes.c_char_p),\n        ('message',  ctypes.c_char_p),\n    ]\n\n    def __init__(self):\n        super(LogMessage, self).__init__()\n        self.size = ctypes.sizeof(self)\n\n    def __str__(self):\n        return '%s(%d:%s): %s' % (self.__class__.__name__, self.severity, self.type, self.message)\n\nclass MediaEvent(_Cstruct):\n    _fields_ = [\n        ('media_name',    ctypes.c_char_p),\n        ('instance_name', ctypes.c_char_p),\n    ]\n\nclass MediaStats(_Cstruct):\n    _fields_ = [\n        ('read_bytes',          ctypes.c_int  ),\n        ('input_bitrate',       ctypes.c_float),\n        ('demux_read_bytes',    ctypes.c_int  ),\n        ('demux_bitrate',       ctypes.c_float),\n        ('demux_corrupted',     ctypes.c_int  ),\n        ('demux_discontinuity', ctypes.c_int  ),\n        ('decoded_video',       ctypes.c_int  ),\n        ('decoded_audio',       ctypes.c_int  ),\n        ('displayed_pictures',  ctypes.c_int  ),\n        ('lost_pictures',       ctypes.c_int  ),\n        ('played_abuffers',     ctypes.c_int  ),\n        ('lost_abuffers',       ctypes.c_int  ),\n        ('sent_packets',        ctypes.c_int  ),\n        ('sent_bytes',          ctypes.c_int  ),\n        ('send_bitrate',        ctypes.c_float),\n    ]\n\nclass MediaTrackInfo(_Cstruct):\n    _fields_ = [\n        ('codec',              ctypes.c_uint32),\n        ('id',                 ctypes.c_int   ),\n        ('type',               TrackType      ),\n        ('profile',            ctypes.c_int   ),\n        ('level',              ctypes.c_int   ),\n        ('channels_or_height', ctypes.c_uint  ),\n        ('rate_or_width',      ctypes.c_uint  ),\n    ]\n\nclass AudioTrack(_Cstruct):\n    _fields_ = [\n        ('channels', ctypes.c_uint),\n        ('rate', ctypes.c_uint),\n        ]\n\nclass VideoTrack(_Cstruct):\n    _fields_ = [\n        ('height', ctypes.c_uint),\n        ('width', ctypes.c_uint),\n        ('sar_num', ctypes.c_uint),\n        ('sar_den', ctypes.c_uint),\n        ('frame_rate_num', ctypes.c_uint),\n        ('frame_rate_den', ctypes.c_uint),\n        ]\n\nclass SubtitleTrack(_Cstruct):\n    _fields_ = [\n        ('encoding', ctypes.c_char_p),\n        ]\n\nclass MediaTrackTracks(ctypes.Union):\n    _fields_ = [\n        ('audio', ctypes.POINTER(AudioTrack)),\n        ('video', ctypes.POINTER(VideoTrack)),\n        ('subtitle', ctypes.POINTER(SubtitleTrack)),\n        ]\n\nclass MediaTrack(_Cstruct):\n    _anonymous_ = (\"u\",)\n    _fields_ = [\n        ('codec',              ctypes.c_uint32),\n        ('original_fourcc',    ctypes.c_uint32),\n        ('id',                 ctypes.c_int   ),\n        ('type',               TrackType      ),\n        ('profile',            ctypes.c_int   ),\n        ('level',              ctypes.c_int   ),\n\n        ('u',                  MediaTrackTracks),\n        ('bitrate',            ctypes.c_uint),\n        ('language',           ctypes.c_char_p),\n        ('description',        ctypes.c_char_p),\n        ]\n\nclass PlaylistItem(_Cstruct):\n    _fields_ = [\n        ('id',   ctypes.c_int   ),\n        ('uri',  ctypes.c_char_p),\n        ('name', ctypes.c_char_p),\n    ]\n\n    def __str__(self):\n        return '%s #%d %s (uri %s)' % (self.__class__.__name__, self.id, self.name, self.uri)\n\nclass Position(object):\n    \"\"\"Enum-like, immutable window position constants.\n\n       See e.g. VideoMarqueeOption.Position.\n    \"\"\"\n    Center       = 0\n    Left         = 1\n    CenterLeft   = 1\n    Right        = 2\n    CenterRight  = 2\n    Top          = 4\n    TopCenter    = 4\n    TopLeft      = 5\n    TopRight     = 6\n    Bottom       = 8\n    BottomCenter = 8\n    BottomLeft   = 9\n    BottomRight  = 10\n    def __init__(self, *unused):\n        raise TypeError('constants only')\n    def __setattr__(self, *unused):  #PYCHOK expected\n        raise TypeError('immutable constants')\n\nclass Rectangle(_Cstruct):\n    _fields_ = [\n        ('top',    ctypes.c_int),\n        ('left',   ctypes.c_int),\n        ('bottom', ctypes.c_int),\n        ('right',  ctypes.c_int),\n    ]\n\nclass TrackDescription(_Cstruct):\n\n    def __str__(self):\n        return '%s(%d:%s)' % (self.__class__.__name__, self.id, self.name)\n\nTrackDescription._fields_ = [  # recursive struct\n    ('id',   ctypes.c_int   ),\n    ('name', ctypes.c_char_p),\n    ('next', ctypes.POINTER(TrackDescription)),\n    ]\n\ndef track_description_list(head):\n    \"\"\"Convert a TrackDescription linked list to a Python list (and release the former).\n    \"\"\"\n    r = []\n    if head:\n        item = head\n        while item:\n            item = item.contents\n            r.append((item.id, item.name))\n            item = item.next\n        try:\n            libvlc_track_description_release(head)\n        except NameError:\n            libvlc_track_description_list_release(head)\n\n    return r\n\nclass EventUnion(ctypes.Union):\n    _fields_ = [\n        ('meta_type',    ctypes.c_uint    ),\n        ('new_child',    ctypes.c_uint    ),\n        ('new_duration', ctypes.c_longlong),\n        ('new_status',   ctypes.c_int     ),\n        ('media',        ctypes.c_void_p  ),\n        ('new_state',    ctypes.c_uint    ),\n        # FIXME: Media instance\n        ('new_cache', ctypes.c_float   ),\n        ('new_position', ctypes.c_float   ),\n        ('new_time',     ctypes.c_longlong),\n        ('new_title',    ctypes.c_int     ),\n        ('new_seekable', ctypes.c_longlong),\n        ('new_pausable', ctypes.c_longlong),\n        ('new_scrambled', ctypes.c_longlong),\n        ('new_count', ctypes.c_longlong),\n        # FIXME: Skipped MediaList and MediaListView...\n        ('filename',     ctypes.c_char_p  ),\n        ('new_length',   ctypes.c_longlong),\n        ('media_event',  MediaEvent       ),\n    ]\n\nclass Event(_Cstruct):\n    _fields_ = [\n        ('type',   EventType      ),\n        ('object', ctypes.c_void_p),\n        ('u',      EventUnion     ),\n    ]\n\nclass ModuleDescription(_Cstruct):\n\n    def __str__(self):\n        return '%s %s (%s)' % (self.__class__.__name__, self.shortname, self.name)\n\nModuleDescription._fields_ = [  # recursive struct\n    ('name',      ctypes.c_char_p),\n    ('shortname', ctypes.c_char_p),\n    ('longname',  ctypes.c_char_p),\n    ('help',      ctypes.c_char_p),\n    ('next',      ctypes.POINTER(ModuleDescription)),\n    ]\n\ndef module_description_list(head):\n    \"\"\"Convert a ModuleDescription linked list to a Python list (and release the former).\n    \"\"\"\n    r = []\n    if head:\n        item = head\n        while item:\n            item = item.contents\n            r.append((item.name, item.shortname, item.longname, item.help))\n            item = item.next\n        libvlc_module_description_list_release(head)\n    return r\n\nclass AudioOutputDevice(_Cstruct):\n\n    def __str__(self):\n        return '%s(%d:%s)' % (self.__class__.__name__, self.id, self.name)\n\nAudioOutputDevice._fields_ = [  # recursive struct\n    ('next', ctypes.POINTER(AudioOutputDevice)),\n    ('device',   ctypes.c_char_p   ),\n    ('description', ctypes.c_char_p),\n    ]\n\nclass TitleDescription(_Cstruct):\n    _fields = [\n        ('duration', ctypes.c_longlong),\n        ('name', ctypes.c_char_p),\n        ('menu', ctypes.c_bool),\n    ]\n\nclass ChapterDescription(_Cstruct):\n    _fields = [\n        ('time_offset', ctypes.c_longlong),\n        ('duration', ctypes.c_longlong),\n        ('name', ctypes.c_char_p),\n    ]\n\nclass VideoViewpoint(_Cstruct):\n    _fields = [\n        ('yaw', ctypes.c_float),\n        ('pitch', ctypes.c_float),\n        ('roll', ctypes.c_float),\n        ('field_of_view', ctypes.c_float),\n    ]\n\n# This struct depends on the MediaSlaveType enum that is defined only\n# in > 2.2\nif 'MediaSlaveType' in locals():\n    class MediaSlave(_Cstruct):\n        _fields = [\n            ('psz_uri', ctypes.c_char_p),\n            ('i_type', MediaSlaveType),\n            ('i_priority', ctypes.c_uint)\n        ]\n\nclass RDDescription(_Cstruct):\n    _fields = [\n        ('name', ctypes.c_char_p),\n        ('longname', ctypes.c_char_p)\n    ]\n\n# End of header.py #\nclass EventManager(_Ctype):\n    '''Create an event manager with callback handler.\n\n    This class interposes the registration and handling of\n    event notifications in order to (a) remove the need for\n    decorating each callback functions with the decorator\n    '@callbackmethod', (b) allow any number of positional\n    and/or keyword arguments to the callback (in addition\n    to the Event instance) and (c) to preserve the Python\n    objects such that the callback and argument objects\n    remain alive (i.e. are not garbage collected) until\n    B{after} the notification has been unregistered.\n\n    @note: Only a single notification can be registered\n    for each event type in an EventManager instance.\n    \n    '''\n\n    _callback_handler = None\n    _callbacks = {}\n\n    def __new__(cls, ptr=_internal_guard):\n        if ptr == _internal_guard:\n            raise VLCException(\"(INTERNAL) ctypes class.\\nYou should get a reference to EventManager through the MediaPlayer.event_manager() method.\")\n        return _Constructor(cls, ptr)\n\n    def event_attach(self, eventtype, callback, *args, **kwds):\n        \"\"\"Register an event notification.\n\n        @param eventtype: the desired event type to be notified about.\n        @param callback: the function to call when the event occurs.\n        @param args: optional positional arguments for the callback.\n        @param kwds: optional keyword arguments for the callback.\n        @return: 0 on success, ENOMEM on error.\n\n        @note: The callback function must have at least one argument,\n        an Event instance.  Any other, optional positional and keyword\n        arguments are in B{addition} to the first one.\n        \"\"\"\n        if not isinstance(eventtype, EventType):\n            raise VLCException(\"%s required: %r\" % ('EventType', eventtype))\n        if not hasattr(callback, '__call__'):  # callable()\n            raise VLCException(\"%s required: %r\" % ('callable', callback))\n         # check that the callback expects arguments\n        if not any(getargspec(callback)[:2]):  # list(...)\n            raise VLCException(\"%s required: %r\" % ('argument', callback))\n\n        if self._callback_handler is None:\n            _called_from_ctypes = ctypes.CFUNCTYPE(None, ctypes.POINTER(Event), ctypes.c_void_p)\n            @_called_from_ctypes\n            def _callback_handler(event, k):\n                \"\"\"(INTERNAL) handle callback call from ctypes.\n\n                @note: We cannot simply make this an EventManager\n                method since ctypes does not prepend self as the\n                first parameter, hence this closure.\n                \"\"\"\n                try: # retrieve Python callback and arguments\n                    call, args, kwds = self._callbacks[k]\n                     # deref event.contents to simplify callback code\n                    call(event.contents, *args, **kwds)\n                except KeyError:  # detached?\n                    pass\n            self._callback_handler = _callback_handler\n            self._callbacks = {}\n\n        k = eventtype.value\n        r = libvlc_event_attach(self, k, self._callback_handler, k)\n        if not r:\n            self._callbacks[k] = (callback, args, kwds)\n        return r\n\n    def event_detach(self, eventtype):\n        \"\"\"Unregister an event notification.\n\n        @param eventtype: the event type notification to be removed.\n        \"\"\"\n        if not isinstance(eventtype, EventType):\n            raise VLCException(\"%s required: %r\" % ('EventType', eventtype))\n\n        k = eventtype.value\n        if k in self._callbacks:\n            del self._callbacks[k] # remove, regardless of libvlc return value\n            libvlc_event_detach(self, k, self._callback_handler, k)\n\nclass Instance(_Ctype):\n    '''Create a new Instance instance.\n\n    It may take as parameter either:\n      - a string\n      - a list of strings as first parameters\n      - the parameters given as the constructor parameters (must be strings)\n    \n    '''\n\n    def __new__(cls, *args):\n        if len(args) == 1:\n            # Only 1 arg. It is either a C pointer, or an arg string,\n            # or a tuple.\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            elif isinstance(i, basestring):\n                args = i.strip().split()\n            elif isinstance(i, _Seqs):\n                args = list(i)\n            else:\n                raise VLCException('Instance %r' % (args,))\n        else:\n            args = list(args)\n\n        if not args:  # no parameters passed\n            args = ['vlc']\n        elif args[0] != 'vlc':\n            args.insert(0, 'vlc')\n\n        if plugin_path is not None:\n            # set plugin_path if detected, win32 and MacOS,\n            # if the user did not specify it itself.\n            os.environ.setdefault('VLC_PLUGIN_PATH', plugin_path)\n\n        if PYTHON3:\n            args = [ str_to_bytes(a) for a in args ]\n        return libvlc_new(len(args), args)\n\n    def media_player_new(self, uri=None):\n        \"\"\"Create a new MediaPlayer instance.\n\n        @param uri: an optional URI to play in the player.\n        \"\"\"\n        p = libvlc_media_player_new(self)\n        if uri:\n            p.set_media(self.media_new(uri))\n        p._instance = self\n        return p\n\n    def media_list_player_new(self):\n        \"\"\"Create a new MediaListPlayer instance.\n        \"\"\"\n        p = libvlc_media_list_player_new(self)\n        p._instance = self\n        return p\n\n    def media_new(self, mrl, *options):\n        \"\"\"Create a new Media instance.\n\n        If mrl contains a colon (:) preceded by more than 1 letter, it\n        will be treated as a URL. Else, it will be considered as a\n        local path. If you need more control, directly use\n        media_new_location/media_new_path methods.\n\n        Options can be specified as supplementary string parameters,\n        but note that many options cannot be set at the media level,\n        and rather at the Instance level. For instance, the marquee\n        filter must be specified when creating the vlc.Instance or\n        vlc.MediaPlayer.\n\n        Alternatively, options can be added to the media using the\n        Media.add_options method (with the same limitation).\n\n        @param options: optional media option=value strings\n        \"\"\"\n        if ':' in mrl and mrl.index(':') > 1:\n            # Assume it is a URL\n            m = libvlc_media_new_location(self, str_to_bytes(mrl))\n        else:\n            # Else it should be a local path.\n            m = libvlc_media_new_path(self, str_to_bytes(os.path.normpath(mrl)))\n        for o in options:\n            libvlc_media_add_option(m, str_to_bytes(o))\n        m._instance = self\n        return m\n\n    def media_list_new(self, mrls=None):\n        \"\"\"Create a new MediaList instance.\n        @param mrls: optional list of MRL strings\n        \"\"\"\n        l = libvlc_media_list_new(self)\n        # We should take the lock, but since we did not leak the\n        # reference, nobody else can access it.\n        if mrls:\n            for m in mrls:\n                l.add_media(m)\n        l._instance = self\n        return l\n\n    def audio_output_enumerate_devices(self):\n        \"\"\"Enumerate the defined audio output devices.\n\n        @return: list of dicts {name:, description:, devices:}\n        \"\"\"\n        r = []\n        head = libvlc_audio_output_list_get(self)\n        if head:\n            i = head\n            while i:\n                i = i.contents\n                d = [{'id':       libvlc_audio_output_device_id      (self, i.name, d),\n                      'longname': libvlc_audio_output_device_longname(self, i.name, d)}\n                   for d in range(libvlc_audio_output_device_count   (self, i.name))]\n                r.append({'name': i.name, 'description': i.description, 'devices': d})\n                i = i.next\n            libvlc_audio_output_list_release(head)\n        return r\n\n    def audio_filter_list_get(self):\n        \"\"\"Returns a list of available audio filters.\n\n        \"\"\"\n        return module_description_list(libvlc_audio_filter_list_get(self))\n\n    def video_filter_list_get(self):\n        \"\"\"Returns a list of available video filters.\n\n        \"\"\"\n        return module_description_list(libvlc_video_filter_list_get(self))\n\n\n    \n    def release(self):\n        '''Decrement the reference count of a libvlc instance, and destroy it\n        if it reaches zero.\n        '''\n        return libvlc_release(self)\n\n    \n    def retain(self):\n        '''Increments the reference count of a libvlc instance.\n        The initial reference count is 1 after L{new}() returns.\n        '''\n        return libvlc_retain(self)\n\n    \n    def add_intf(self, name):\n        '''Try to start a user interface for the libvlc instance.\n        @param name: interface name, or None for default.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_add_intf(self, str_to_bytes(name))\n\n    \n    def wait(self):\n        '''Waits until an interface causes the instance to exit.\n        You should start at least one interface first, using L{add_intf}().\n        '''\n        return libvlc_wait(self)\n\n    \n    def set_user_agent(self, name, http):\n        '''Sets the application name. LibVLC passes this as the user agent string\n        when a protocol requires it.\n        @param name: human-readable application name, e.g. \"FooBar player 1.2.3\".\n        @param http: HTTP User Agent, e.g. \"FooBar/1.2.3 Python/2.6.0\".\n        @version: LibVLC 1.1.1 or later.\n        '''\n        return libvlc_set_user_agent(self, str_to_bytes(name), str_to_bytes(http))\n\n    \n    def set_app_id(self, id, version, icon):\n        '''Sets some meta-information about the application.\n        See also L{set_user_agent}().\n        @param id: Java-style application identifier, e.g. \"com.acme.foobar\".\n        @param version: application version numbers, e.g. \"1.2.3\".\n        @param icon: application icon name, e.g. \"foobar\".\n        @version: LibVLC 2.1.0 or later.\n        '''\n        return libvlc_set_app_id(self, str_to_bytes(id), str_to_bytes(version), str_to_bytes(icon))\n\n    \n    def log_unset(self):\n        '''Unsets the logging callback for a LibVLC instance. This is rarely needed:\n        the callback is implicitly unset when the instance is destroyed.\n        This function will wait for any pending callbacks invocation to complete\n        (causing a deadlock if called from within the callback).\n        @version: LibVLC 2.1.0 or later.\n        '''\n        return libvlc_log_unset(self)\n\n    \n    def log_set(self, data, p_instance):\n        '''Sets the logging callback for a LibVLC instance.\n        This function is thread-safe: it will wait for any pending callbacks\n        invocation to complete.\n        @param data: opaque data pointer for the callback function @note Some log messages (especially debug) are emitted by LibVLC while is being initialized. These messages cannot be captured with this interface. @warning A deadlock may occur if this function is called from the callback.\n        @param p_instance: libvlc instance.\n        @version: LibVLC 2.1.0 or later.\n        '''\n        return libvlc_log_set(self, data, p_instance)\n\n    \n    def log_set_file(self, stream):\n        '''Sets up logging to a file.\n        @param stream: FILE pointer opened for writing (the FILE pointer must remain valid until L{log_unset}()).\n        @version: LibVLC 2.1.0 or later.\n        '''\n        return libvlc_log_set_file(self, stream)\n\n    \n    def get_log_verbosity(self):\n        '''Always returns minus one.\n        This function is only provided for backward compatibility.\n        @return: always -1.\n        '''\n        return libvlc_get_log_verbosity(self)\n\n    \n    def set_log_verbosity(self, level):\n        '''This function does nothing.\n        It is only provided for backward compatibility.\n        @param level: ignored.\n        '''\n        return libvlc_set_log_verbosity(self, level)\n\n    \n    def log_open(self):\n        '''This function does nothing useful.\n        It is only provided for backward compatibility.\n        @return: an unique pointer or None on error.\n        '''\n        return libvlc_log_open(self)\n\n    \n    def media_discoverer_new_from_name(self, psz_name):\n        '''Discover media service by name.\n        @param psz_name: service name.\n        @return: media discover object or None in case of error.\n        '''\n        return libvlc_media_discoverer_new_from_name(self, str_to_bytes(psz_name))\n\n    \n    def media_library_new(self):\n        '''Create an new Media Library object.\n        @return: a new object or None on error.\n        '''\n        return libvlc_media_library_new(self)\n\n    \n    def vlm_release(self):\n        '''Release the vlm instance related to the given L{Instance}.\n        '''\n        return libvlc_vlm_release(self)\n\n    \n    def vlm_add_broadcast(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop):\n        '''Add a broadcast, with one input.\n        @param psz_name: the name of the new broadcast.\n        @param psz_input: the input MRL.\n        @param psz_output: the output MRL (the parameter to the \"sout\" variable).\n        @param i_options: number of additional options.\n        @param ppsz_options: additional options.\n        @param b_enabled: boolean for enabling the new broadcast.\n        @param b_loop: Should this broadcast be played in loop ?\n        @return: 0 on success, -1 on error.\n        '''\n        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)\n\n    \n    def vlm_add_vod(self, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux):\n        '''Add a vod, with one input.\n        @param psz_name: the name of the new vod media.\n        @param psz_input: the input MRL.\n        @param i_options: number of additional options.\n        @param ppsz_options: additional options.\n        @param b_enabled: boolean for enabling the new vod.\n        @param psz_mux: the muxer of the vod media.\n        @return: 0 on success, -1 on error.\n        '''\n        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))\n\n    \n    def vlm_del_media(self, psz_name):\n        '''Delete a media (VOD or broadcast).\n        @param psz_name: the media to delete.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_vlm_del_media(self, str_to_bytes(psz_name))\n\n    \n    def vlm_set_enabled(self, psz_name, b_enabled):\n        '''Enable or disable a media (VOD or broadcast).\n        @param psz_name: the media to work on.\n        @param b_enabled: the new status.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_vlm_set_enabled(self, str_to_bytes(psz_name), b_enabled)\n\n    \n    def vlm_set_output(self, psz_name, psz_output):\n        '''Set the output for a media.\n        @param psz_name: the media to work on.\n        @param psz_output: the output MRL (the parameter to the \"sout\" variable).\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_vlm_set_output(self, str_to_bytes(psz_name), str_to_bytes(psz_output))\n\n    \n    def vlm_set_input(self, psz_name, psz_input):\n        '''Set a media's input MRL. This will delete all existing inputs and\n        add the specified one.\n        @param psz_name: the media to work on.\n        @param psz_input: the input MRL.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_vlm_set_input(self, str_to_bytes(psz_name), str_to_bytes(psz_input))\n\n    \n    def vlm_add_input(self, psz_name, psz_input):\n        '''Add a media's input MRL. This will add the specified one.\n        @param psz_name: the media to work on.\n        @param psz_input: the input MRL.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_vlm_add_input(self, str_to_bytes(psz_name), str_to_bytes(psz_input))\n\n    \n    def vlm_set_loop(self, psz_name, b_loop):\n        '''Set a media's loop status.\n        @param psz_name: the media to work on.\n        @param b_loop: the new status.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_vlm_set_loop(self, str_to_bytes(psz_name), b_loop)\n\n    \n    def vlm_set_mux(self, psz_name, psz_mux):\n        '''Set a media's vod muxer.\n        @param psz_name: the media to work on.\n        @param psz_mux: the new muxer.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_vlm_set_mux(self, str_to_bytes(psz_name), str_to_bytes(psz_mux))\n\n    \n    def vlm_change_media(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop):\n        '''Edit the parameters of a media. This will delete all existing inputs and\n        add the specified one.\n        @param psz_name: the name of the new broadcast.\n        @param psz_input: the input MRL.\n        @param psz_output: the output MRL (the parameter to the \"sout\" variable).\n        @param i_options: number of additional options.\n        @param ppsz_options: additional options.\n        @param b_enabled: boolean for enabling the new broadcast.\n        @param b_loop: Should this broadcast be played in loop ?\n        @return: 0 on success, -1 on error.\n        '''\n        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)\n\n    \n    def vlm_play_media(self, psz_name):\n        '''Play the named broadcast.\n        @param psz_name: the name of the broadcast.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_vlm_play_media(self, str_to_bytes(psz_name))\n\n    \n    def vlm_stop_media(self, psz_name):\n        '''Stop the named broadcast.\n        @param psz_name: the name of the broadcast.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_vlm_stop_media(self, str_to_bytes(psz_name))\n\n    \n    def vlm_pause_media(self, psz_name):\n        '''Pause the named broadcast.\n        @param psz_name: the name of the broadcast.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_vlm_pause_media(self, str_to_bytes(psz_name))\n\n    \n    def vlm_seek_media(self, psz_name, f_percentage):\n        '''Seek in the named broadcast.\n        @param psz_name: the name of the broadcast.\n        @param f_percentage: the percentage to seek to.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_vlm_seek_media(self, str_to_bytes(psz_name), f_percentage)\n\n    \n    def vlm_show_media(self, psz_name):\n        '''Return information about the named media as a JSON\n        string representation.\n        This function is mainly intended for debugging use,\n        if you want programmatic access to the state of\n        a vlm_media_instance_t, please use the corresponding\n        libvlc_vlm_get_media_instance_xxx -functions.\n        Currently there are no such functions available for\n        vlm_media_t though.\n        @param psz_name: the name of the media, if the name is an empty string, all media is described.\n        @return: string with information about named media, or None on error.\n        '''\n        return libvlc_vlm_show_media(self, str_to_bytes(psz_name))\n\n    \n    def vlm_get_media_instance_position(self, psz_name, i_instance):\n        '''Get vlm_media instance position by name or instance id.\n        @param psz_name: name of vlm media instance.\n        @param i_instance: instance id.\n        @return: position as float or -1. on error.\n        '''\n        return libvlc_vlm_get_media_instance_position(self, str_to_bytes(psz_name), i_instance)\n\n    \n    def vlm_get_media_instance_time(self, psz_name, i_instance):\n        '''Get vlm_media instance time by name or instance id.\n        @param psz_name: name of vlm media instance.\n        @param i_instance: instance id.\n        @return: time as integer or -1 on error.\n        '''\n        return libvlc_vlm_get_media_instance_time(self, str_to_bytes(psz_name), i_instance)\n\n    \n    def vlm_get_media_instance_length(self, psz_name, i_instance):\n        '''Get vlm_media instance length by name or instance id.\n        @param psz_name: name of vlm media instance.\n        @param i_instance: instance id.\n        @return: length of media item or -1 on error.\n        '''\n        return libvlc_vlm_get_media_instance_length(self, str_to_bytes(psz_name), i_instance)\n\n    \n    def vlm_get_media_instance_rate(self, psz_name, i_instance):\n        '''Get vlm_media instance playback rate by name or instance id.\n        @param psz_name: name of vlm media instance.\n        @param i_instance: instance id.\n        @return: playback rate or -1 on error.\n        '''\n        return libvlc_vlm_get_media_instance_rate(self, str_to_bytes(psz_name), i_instance)\n\n    \n    def vlm_get_media_instance_title(self, psz_name, i_instance):\n        '''Get vlm_media instance title number by name or instance id.\n        @param psz_name: name of vlm media instance.\n        @param i_instance: instance id.\n        @return: title as number or -1 on error.\n        @bug: will always return 0.\n        '''\n        return libvlc_vlm_get_media_instance_title(self, str_to_bytes(psz_name), i_instance)\n\n    \n    def vlm_get_media_instance_chapter(self, psz_name, i_instance):\n        '''Get vlm_media instance chapter number by name or instance id.\n        @param psz_name: name of vlm media instance.\n        @param i_instance: instance id.\n        @return: chapter as number or -1 on error.\n        @bug: will always return 0.\n        '''\n        return libvlc_vlm_get_media_instance_chapter(self, str_to_bytes(psz_name), i_instance)\n\n    \n    def vlm_get_media_instance_seekable(self, psz_name, i_instance):\n        '''Is libvlc instance seekable ?\n        @param psz_name: name of vlm media instance.\n        @param i_instance: instance id.\n        @return: 1 if seekable, 0 if not, -1 if media does not exist.\n        @bug: will always return 0.\n        '''\n        return libvlc_vlm_get_media_instance_seekable(self, str_to_bytes(psz_name), i_instance)\n\n    @memoize_parameterless\n    def vlm_get_event_manager(self):\n        '''Get libvlc_event_manager from a vlm media.\n        The p_event_manager is immutable, so you don't have to hold the lock.\n        @return: libvlc_event_manager.\n        '''\n        return libvlc_vlm_get_event_manager(self)\n\n    \n    def media_new_location(self, psz_mrl):\n        '''Create a media with a certain given media resource location,\n        for instance a valid URL.\n        @note: To refer to a local file with this function,\n        the file://... URI syntax B{must} be used (see IETF RFC3986).\n        We recommend using L{media_new_path}() instead when dealing with\n        local files.\n        See L{media_release}.\n        @param psz_mrl: the media location.\n        @return: the newly created media or None on error.\n        '''\n        return libvlc_media_new_location(self, str_to_bytes(psz_mrl))\n\n    \n    def media_new_path(self, path):\n        '''Create a media for a certain file path.\n        See L{media_release}.\n        @param path: local filesystem path.\n        @return: the newly created media or None on error.\n        '''\n        return libvlc_media_new_path(self, str_to_bytes(path))\n\n    \n    def media_new_fd(self, fd):\n        '''Create a media for an already open file descriptor.\n        The file descriptor shall be open for reading (or reading and writing).\n        Regular file descriptors, pipe read descriptors and character device\n        descriptors (including TTYs) are supported on all platforms.\n        Block device descriptors are supported where available.\n        Directory descriptors are supported on systems that provide fdopendir().\n        Sockets are supported on all platforms where they are file descriptors,\n        i.e. all except Windows.\n        @note: This library will B{not} automatically close the file descriptor\n        under any circumstance. Nevertheless, a file descriptor can usually only be\n        rendered once in a media player. To render it a second time, the file\n        descriptor should probably be rewound to the beginning with lseek().\n        See L{media_release}.\n        @param fd: open file descriptor.\n        @return: the newly created media or None on error.\n        @version: LibVLC 1.1.5 and later.\n        '''\n        return libvlc_media_new_fd(self, fd)\n\n    \n    def media_new_as_node(self, psz_name):\n        '''Create a media as an empty node with a given name.\n        See L{media_release}.\n        @param psz_name: the name of the node.\n        @return: the new empty media or None on error.\n        '''\n        return libvlc_media_new_as_node(self, str_to_bytes(psz_name))\n\n    \n    def playlist_play(self, i_id, i_options, ppsz_options):\n        '''Start playing (if there is any item in the playlist).\n        Additionnal playlist item options can be specified for addition to the\n        item before it is played.\n        @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.\n        @param i_options: the number of options to add to the item.\n        @param ppsz_options: the options to add to the item.\n        '''\n        return libvlc_playlist_play(self, i_id, i_options, ppsz_options)\n\n    \n    def audio_output_list_get(self):\n        '''Gets the list of available audio output modules.\n        @return: list of available audio outputs. It must be freed it with In case of error, None is returned.\n        '''\n        return libvlc_audio_output_list_get(self)\n\n    \n    def audio_output_device_count(self, psz_name):\n        '''Backward compatibility stub. Do not use in new code.\n        Use L{audio_output_device_list_get}() instead.\n        @param psz_name: name.\n        @return: always 0.\n        '''\n        return libvlc_audio_output_device_count(self, str_to_bytes(psz_name))\n\n    \n    def audio_output_device_longname(self, psz_name, int):\n        '''Backward compatibility stub. Do not use in new code.\n        Use L{audio_output_device_list_get}() instead.\n        @param psz_name: name.\n        @param int: index.\n        @return: always None.\n        '''\n        return libvlc_audio_output_device_longname(self, str_to_bytes(psz_name), int)\n\n    \n    def audio_output_device_id(self, psz_name, int):\n        '''Backward compatibility stub. Do not use in new code.\n        Use L{audio_output_device_list_get}() instead.\n        @param psz_name: name.\n        @param int: index.\n        @return: always None.\n        '''\n        return libvlc_audio_output_device_id(self, str_to_bytes(psz_name), int)\n\n    \n    def audio_output_device_list_get(self, aout):\n        '''Gets a list of audio output devices for a given audio output module,\n        See L{audio_output_device_set}().\n        @note: Not all audio outputs support this. In particular, an empty (None)\n        list of devices does B{not} imply that the specified audio output does\n        not work.\n        @note: The list might not be exhaustive.\n        @warning: Some audio output devices in the list might not actually work in\n        some circumstances. By default, it is recommended to not specify any\n        explicit audio device.\n        @param psz_aout: audio output name (as returned by L{audio_output_list_get}()).\n        @return: A None-terminated linked list of potential audio output devices. It must be freed it with L{audio_output_device_list_release}().\n        @version: LibVLC 2.1.0 or later.\n        '''\n        return libvlc_audio_output_device_list_get(self, str_to_bytes(aout))\n\nclass LogIterator(_Ctype):\n    '''Create a new VLC log iterator.\n    \n    '''\n\n    def __new__(cls, ptr=_internal_guard):\n        '''(INTERNAL) ctypes wrapper constructor.\n        '''\n        return _Constructor(cls, ptr)\n\n    def __iter__(self):\n        return self\n\n    def next(self):\n        if self.has_next():\n            b = LogMessage()\n            i = libvlc_log_iterator_next(self, b)\n            return i.contents\n        raise StopIteration\n\n    def __next__(self):\n        return self.next()\n\n\n    \n    def free(self):\n        '''Frees memory allocated by L{log_get_iterator}().\n        '''\n        return libvlc_log_iterator_free(self)\n\n    \n    def has_next(self):\n        '''Always returns zero.\n        This function is only provided for backward compatibility.\n        @return: always zero.\n        '''\n        return libvlc_log_iterator_has_next(self)\n\nclass Media(_Ctype):\n    '''Create a new Media instance.\n\n    Usage: Media(MRL, *options)\n\n    See vlc.Instance.media_new documentation for details.\n    \n    '''\n\n    def __new__(cls, *args):\n        if args:\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            if isinstance(i, Instance):\n                return i.media_new(*args[1:])\n\n        o = get_default_instance().media_new(*args)\n        return o\n\n    def get_instance(self):\n        return getattr(self, '_instance', None)\n\n    def add_options(self, *options):\n        \"\"\"Add a list of options to the media.\n\n        Options must be written without the double-dash. Warning: most\n        audio and video options, such as text renderer, have no\n        effects on an individual media. These options must be set at\n        the vlc.Instance or vlc.MediaPlayer instanciation.\n\n        @param options: optional media option=value strings\n        \"\"\"\n        for o in options:\n            self.add_option(o)\n\n    def tracks_get(self):\n        \"\"\"Get media descriptor's elementary streams description\n        Note, you need to call L{parse}() or play the media at least once\n        before calling this function.\n        Not doing this will result in an empty array.\n        The result must be freed with L{tracks_release}.\n        @version: LibVLC 2.1.0 and later.\n        \"\"\"\n        mediaTrack_pp = ctypes.POINTER(MediaTrack)()\n        n = libvlc_media_tracks_get(self, ctypes.byref(mediaTrack_pp))\n        info = ctypes.cast(mediaTrack_pp, ctypes.POINTER(ctypes.POINTER(MediaTrack) * n))\n        try:\n            contents = info.contents\n        except ValueError:\n            # Media not parsed, no info.\n            return None\n        tracks = ( contents[i].contents for i in range(len(contents)) )\n        # libvlc_media_tracks_release(mediaTrack_pp, n)\n        return tracks\n\n\n    \n    def add_option(self, psz_options):\n        '''Add an option to the media.\n        This option will be used to determine how the media_player will\n        read the media. This allows to use VLC's advanced\n        reading/streaming options on a per-media basis.\n        @note: The options are listed in 'vlc --long-help' from the command line,\n        e.g. \"-sout-all\". Keep in mind that available options and their semantics\n        vary across LibVLC versions and builds.\n        @warning: Not all options affects L{Media} objects:\n        Specifically, due to architectural issues most audio and video options,\n        such as text renderer options, have no effects on an individual media.\n        These options must be set through L{new}() instead.\n        @param psz_options: the options (as a string).\n        '''\n        return libvlc_media_add_option(self, str_to_bytes(psz_options))\n\n    \n    def add_option_flag(self, psz_options, i_flags):\n        '''Add an option to the media with configurable flags.\n        This option will be used to determine how the media_player will\n        read the media. This allows to use VLC's advanced\n        reading/streaming options on a per-media basis.\n        The options are detailed in vlc --long-help, for instance\n        \"--sout-all\". Note that all options are not usable on medias:\n        specifically, due to architectural issues, video-related options\n        such as text renderer options cannot be set on a single media. They\n        must be set on the whole libvlc instance instead.\n        @param psz_options: the options (as a string).\n        @param i_flags: the flags for this option.\n        '''\n        return libvlc_media_add_option_flag(self, str_to_bytes(psz_options), i_flags)\n\n    \n    def retain(self):\n        '''Retain a reference to a media descriptor object (libvlc_media_t). Use\n        L{release}() to decrement the reference count of a\n        media descriptor object.\n        '''\n        return libvlc_media_retain(self)\n\n    \n    def release(self):\n        '''Decrement the reference count of a media descriptor object. If the\n        reference count is 0, then L{release}() will release the\n        media descriptor object. It will send out an libvlc_MediaFreed event\n        to all listeners. If the media descriptor object has been released it\n        should not be used again.\n        '''\n        return libvlc_media_release(self)\n\n    \n    def get_mrl(self):\n        '''Get the media resource locator (mrl) from a media descriptor object.\n        @return: string with mrl of media descriptor object.\n        '''\n        return libvlc_media_get_mrl(self)\n\n    \n    def duplicate(self):\n        '''Duplicate a media descriptor object.\n        '''\n        return libvlc_media_duplicate(self)\n\n    \n    def get_meta(self, e_meta):\n        '''Read the meta of the media.\n        If the media has not yet been parsed this will return None.\n        This methods automatically calls L{parse_async}(), so after calling\n        it you may receive a libvlc_MediaMetaChanged event. If you prefer a synchronous\n        version ensure that you call L{parse}() before get_meta().\n        See L{parse}\n        See L{parse_async}\n        See libvlc_MediaMetaChanged.\n        @param e_meta: the meta to read.\n        @return: the media's meta.\n        '''\n        return libvlc_media_get_meta(self, e_meta)\n\n    \n    def set_meta(self, e_meta, psz_value):\n        '''Set the meta of the media (this function will not save the meta, call\n        L{save_meta} in order to save the meta).\n        @param e_meta: the meta to write.\n        @param psz_value: the media's meta.\n        '''\n        return libvlc_media_set_meta(self, e_meta, str_to_bytes(psz_value))\n\n    \n    def save_meta(self):\n        '''Save the meta previously set.\n        @return: true if the write operation was successful.\n        '''\n        return libvlc_media_save_meta(self)\n\n    \n    def get_state(self):\n        '''Get current state of media descriptor object. Possible media states\n        are defined in libvlc_structures.c ( libvlc_NothingSpecial=0,\n        libvlc_Opening, libvlc_Buffering, libvlc_Playing, libvlc_Paused,\n        libvlc_Stopped, libvlc_Ended,\n        libvlc_Error).\n        See libvlc_state_t.\n        @return: state of media descriptor object.\n        '''\n        return libvlc_media_get_state(self)\n\n    \n    def get_stats(self, p_stats):\n        '''Get the current statistics about the media.\n        @param p_stats:: structure that contain the statistics about the media (this structure must be allocated by the caller).\n        @return: true if the statistics are available, false otherwise \\libvlc_return_bool.\n        '''\n        return libvlc_media_get_stats(self, p_stats)\n\n    \n    def subitems(self):\n        '''Get subitems of media descriptor object. This will increment\n        the reference count of supplied media descriptor object. Use\n        L{list_release}() to decrement the reference counting.\n        @return: list of media descriptor subitems or None.\n        '''\n        return libvlc_media_subitems(self)\n\n    @memoize_parameterless\n    def event_manager(self):\n        '''Get event manager from media descriptor object.\n        NOTE: this function doesn't increment reference counting.\n        @return: event manager object.\n        '''\n        return libvlc_media_event_manager(self)\n\n    \n    def get_duration(self):\n        '''Get duration (in ms) of media descriptor object item.\n        @return: duration of media item or -1 on error.\n        '''\n        return libvlc_media_get_duration(self)\n\n    \n    def parse(self):\n        '''Parse a media.\n        This fetches (local) meta data and tracks information.\n        The method is synchronous.\n        See L{parse_async}\n        See L{get_meta}\n        See L{get_tracks_info}.\n        '''\n        return libvlc_media_parse(self)\n\n    \n    def parse_async(self):\n        '''Parse a media.\n        This fetches (local) meta data and tracks information.\n        The method is the asynchronous of L{parse}().\n        To track when this is over you can listen to libvlc_MediaParsedChanged\n        event. However if the media was already parsed you will not receive this\n        event.\n        See L{parse}\n        See libvlc_MediaParsedChanged\n        See L{get_meta}\n        See L{get_tracks_info}.\n        '''\n        return libvlc_media_parse_async(self)\n\n    \n    def is_parsed(self):\n        '''Get Parsed status for media descriptor object.\n        See libvlc_MediaParsedChanged.\n        @return: true if media object has been parsed otherwise it returns false \\libvlc_return_bool.\n        '''\n        return libvlc_media_is_parsed(self)\n\n    \n    def set_user_data(self, p_new_user_data):\n        '''Sets media descriptor's user_data. user_data is specialized data\n        accessed by the host application, VLC.framework uses it as a pointer to\n        an native object that references a L{Media} pointer.\n        @param p_new_user_data: pointer to user data.\n        '''\n        return libvlc_media_set_user_data(self, p_new_user_data)\n\n    \n    def get_user_data(self):\n        '''Get media descriptor's user_data. user_data is specialized data\n        accessed by the host application, VLC.framework uses it as a pointer to\n        an native object that references a L{Media} pointer.\n        '''\n        return libvlc_media_get_user_data(self)\n\n    \n    def get_tracks_info(self):\n        '''Get media descriptor's elementary streams description\n        Note, you need to call L{parse}() or play the media at least once\n        before calling this function.\n        Not doing this will result in an empty array.\n        \\deprecated Use L{tracks_get} instead.\n        @param tracks: address to store an allocated array of Elementary Streams descriptions (must be freed by the caller) [OUT].\n        @return: the number of Elementary Streams.\n        '''\n        return libvlc_media_get_tracks_info(self)\n\n    \n    def player_new_from_media(self):\n        '''Create a Media Player object from a Media.\n        @return: a new media player object, or None on error.\n        '''\n        return libvlc_media_player_new_from_media(self)\n\nclass MediaDiscoverer(_Ctype):\n    '''N/A\n    '''\n\n    def __new__(cls, ptr=_internal_guard):\n        '''(INTERNAL) ctypes wrapper constructor.\n        '''\n        return _Constructor(cls, ptr)\n    \n    def release(self):\n        '''Release media discover object. If the reference count reaches 0, then\n        the object will be released.\n        '''\n        return libvlc_media_discoverer_release(self)\n\n    \n    def localized_name(self):\n        '''Get media service discover object its localized name.\n        @return: localized name.\n        '''\n        return libvlc_media_discoverer_localized_name(self)\n\n    \n    def media_list(self):\n        '''Get media service discover media list.\n        @return: list of media items.\n        '''\n        return libvlc_media_discoverer_media_list(self)\n\n    @memoize_parameterless\n    def event_manager(self):\n        '''Get event manager from media service discover object.\n        @return: event manager object.\n        '''\n        return libvlc_media_discoverer_event_manager(self)\n\n    \n    def is_running(self):\n        '''Query if media service discover object is running.\n        @return: true if running, false if not \\libvlc_return_bool.\n        '''\n        return libvlc_media_discoverer_is_running(self)\n\nclass MediaLibrary(_Ctype):\n    '''N/A\n    '''\n\n    def __new__(cls, ptr=_internal_guard):\n        '''(INTERNAL) ctypes wrapper constructor.\n        '''\n        return _Constructor(cls, ptr)\n    \n    def release(self):\n        '''Release media library object. This functions decrements the\n        reference count of the media library object. If it reaches 0,\n        then the object will be released.\n        '''\n        return libvlc_media_library_release(self)\n\n    \n    def retain(self):\n        '''Retain a reference to a media library object. This function will\n        increment the reference counting for this object. Use\n        L{release}() to decrement the reference count.\n        '''\n        return libvlc_media_library_retain(self)\n\n    \n    def load(self):\n        '''Load media library.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_media_library_load(self)\n\n    \n    def media_list(self):\n        '''Get media library subitems.\n        @return: media list subitems.\n        '''\n        return libvlc_media_library_media_list(self)\n\nclass MediaList(_Ctype):\n    '''Create a new MediaList instance.\n\n    Usage: MediaList(list_of_MRLs)\n\n    See vlc.Instance.media_list_new documentation for details.\n    \n    '''\n\n    def __new__(cls, *args):\n        if args:\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            if isinstance(i, Instance):\n                return i.media_list_new(*args[1:])\n\n        o = get_default_instance().media_list_new(*args)\n        return o\n\n    def get_instance(self):\n        return getattr(self, '_instance', None)\n\n    def add_media(self, mrl):\n        \"\"\"Add media instance to media list.\n\n        The L{lock} should be held upon entering this function.\n        @param mrl: a media instance or a MRL.\n        @return: 0 on success, -1 if the media list is read-only.\n        \"\"\"\n        if isinstance(mrl, basestring):\n            mrl = (self.get_instance() or get_default_instance()).media_new(mrl)\n        return libvlc_media_list_add_media(self, mrl)\n\n\n    \n    def release(self):\n        '''Release media list created with L{new}().\n        '''\n        return libvlc_media_list_release(self)\n\n    \n    def retain(self):\n        '''Retain reference to a media list.\n        '''\n        return libvlc_media_list_retain(self)\n\n    \n    def set_media(self, p_md):\n        '''Associate media instance with this media list instance.\n        If another media instance was present it will be released.\n        The L{lock} should NOT be held upon entering this function.\n        @param p_md: media instance to add.\n        '''\n        return libvlc_media_list_set_media(self, p_md)\n\n    \n    def media(self):\n        '''Get media instance from this media list instance. This action will increase\n        the refcount on the media instance.\n        The L{lock} should NOT be held upon entering this function.\n        @return: media instance.\n        '''\n        return libvlc_media_list_media(self)\n\n    \n    def insert_media(self, p_md, i_pos):\n        '''Insert media instance in media list on a position\n        The L{lock} should be held upon entering this function.\n        @param p_md: a media instance.\n        @param i_pos: position in array where to insert.\n        @return: 0 on success, -1 if the media list is read-only.\n        '''\n        return libvlc_media_list_insert_media(self, p_md, i_pos)\n\n    \n    def remove_index(self, i_pos):\n        '''Remove media instance from media list on a position\n        The L{lock} should be held upon entering this function.\n        @param i_pos: position in array where to insert.\n        @return: 0 on success, -1 if the list is read-only or the item was not found.\n        '''\n        return libvlc_media_list_remove_index(self, i_pos)\n\n    \n    def count(self):\n        '''Get count on media list items\n        The L{lock} should be held upon entering this function.\n        @return: number of items in media list.\n        '''\n        return libvlc_media_list_count(self)\n\n    def __len__(self):\n        return libvlc_media_list_count(self)\n\n    \n    def item_at_index(self, i_pos):\n        '''List media instance in media list at a position\n        The L{lock} should be held upon entering this function.\n        @param i_pos: position in array where to insert.\n        @return: media instance at position i_pos, or None if not found. In case of success, L{media_retain}() is called to increase the refcount on the media.\n        '''\n        return libvlc_media_list_item_at_index(self, i_pos)\n\n    def __getitem__(self, i):\n        return libvlc_media_list_item_at_index(self, i)\n\n    def __iter__(self):\n        for i in range(len(self)):\n            yield self[i]\n\n    \n    def index_of_item(self, p_md):\n        '''Find index position of List media instance in media list.\n        Warning: the function will return the first matched position.\n        The L{lock} should be held upon entering this function.\n        @param p_md: media instance.\n        @return: position of media instance or -1 if media not found.\n        '''\n        return libvlc_media_list_index_of_item(self, p_md)\n\n    \n    def is_readonly(self):\n        '''This indicates if this media list is read-only from a user point of view.\n        @return: 1 on readonly, 0 on readwrite \\libvlc_return_bool.\n        '''\n        return libvlc_media_list_is_readonly(self)\n\n    \n    def lock(self):\n        '''Get lock on media list items.\n        '''\n        return libvlc_media_list_lock(self)\n\n    \n    def unlock(self):\n        '''Release lock on media list items\n        The L{lock} should be held upon entering this function.\n        '''\n        return libvlc_media_list_unlock(self)\n\n    @memoize_parameterless\n    def event_manager(self):\n        '''Get libvlc_event_manager from this media list instance.\n        The p_event_manager is immutable, so you don't have to hold the lock.\n        @return: libvlc_event_manager.\n        '''\n        return libvlc_media_list_event_manager(self)\n\nclass MediaListPlayer(_Ctype):\n    '''Create a new MediaListPlayer instance.\n\n    It may take as parameter either:\n      - a vlc.Instance\n      - nothing\n    \n    '''\n\n    def __new__(cls, arg=None):\n        if arg is None:\n            i = get_default_instance()\n        elif isinstance(arg, Instance):\n            i = arg\n        elif isinstance(arg, _Ints):\n            return _Constructor(cls, arg)\n        else:\n            raise TypeError('MediaListPlayer %r' % (arg,))\n\n        return i.media_list_player_new()\n\n    def get_instance(self):\n        \"\"\"Return the associated Instance.\n        \"\"\"\n        return self._instance  #PYCHOK expected\n\n\n    \n    def release(self):\n        '''Release a media_list_player after use\n        Decrement the reference count of a media player object. If the\n        reference count is 0, then L{release}() will\n        release the media player object. If the media player object\n        has been released, then it should not be used again.\n        '''\n        return libvlc_media_list_player_release(self)\n\n    \n    def retain(self):\n        '''Retain a reference to a media player list object. Use\n        L{release}() to decrement reference count.\n        '''\n        return libvlc_media_list_player_retain(self)\n\n    @memoize_parameterless\n    def event_manager(self):\n        '''Return the event manager of this media_list_player.\n        @return: the event manager.\n        '''\n        return libvlc_media_list_player_event_manager(self)\n\n    \n    def set_media_player(self, p_mi):\n        '''Replace media player in media_list_player with this instance.\n        @param p_mi: media player instance.\n        '''\n        return libvlc_media_list_player_set_media_player(self, p_mi)\n\n    \n    def set_media_list(self, p_mlist):\n        '''Set the media list associated with the player.\n        @param p_mlist: list of media.\n        '''\n        return libvlc_media_list_player_set_media_list(self, p_mlist)\n\n    \n    def play(self):\n        '''Play media list.\n        '''\n        return libvlc_media_list_player_play(self)\n\n    \n    def pause(self):\n        '''Toggle pause (or resume) media list.\n        '''\n        return libvlc_media_list_player_pause(self)\n\n    \n    def is_playing(self):\n        '''Is media list playing?\n        @return: true for playing and false for not playing \\libvlc_return_bool.\n        '''\n        return libvlc_media_list_player_is_playing(self)\n\n    \n    def get_state(self):\n        '''Get current libvlc_state of media list player.\n        @return: libvlc_state_t for media list player.\n        '''\n        return libvlc_media_list_player_get_state(self)\n\n    \n    def play_item_at_index(self, i_index):\n        '''Play media list item at position index.\n        @param i_index: index in media list to play.\n        @return: 0 upon success -1 if the item wasn't found.\n        '''\n        return libvlc_media_list_player_play_item_at_index(self, i_index)\n\n    def __getitem__(self, i):\n        return libvlc_media_list_player_play_item_at_index(self, i)\n\n    def __iter__(self):\n        for i in range(len(self)):\n            yield self[i]\n\n    \n    def play_item(self, p_md):\n        '''Play the given media item.\n        @param p_md: the media instance.\n        @return: 0 upon success, -1 if the media is not part of the media list.\n        '''\n        return libvlc_media_list_player_play_item(self, p_md)\n\n    \n    def stop(self):\n        '''Stop playing media list.\n        '''\n        return libvlc_media_list_player_stop(self)\n\n    \n    def next(self):\n        '''Play next item from media list.\n        @return: 0 upon success -1 if there is no next item.\n        '''\n        return libvlc_media_list_player_next(self)\n\n    \n    def previous(self):\n        '''Play previous item from media list.\n        @return: 0 upon success -1 if there is no previous item.\n        '''\n        return libvlc_media_list_player_previous(self)\n\n    \n    def set_playback_mode(self, e_mode):\n        '''Sets the playback mode for the playlist.\n        @param e_mode: playback mode specification.\n        '''\n        return libvlc_media_list_player_set_playback_mode(self, e_mode)\n\nclass MediaPlayer(_Ctype):\n    '''Create a new MediaPlayer instance.\n\n    It may take as parameter either:\n      - a string (media URI), options... In this case, a vlc.Instance will be created.\n      - a vlc.Instance, a string (media URI), options...\n    \n    '''\n\n    def __new__(cls, *args):\n        if len(args) == 1 and isinstance(args[0], _Ints):\n            return _Constructor(cls, args[0])\n\n        if args and isinstance(args[0], Instance):\n            instance = args[0]\n            args = args[1:]\n        else:\n            instance = get_default_instance()\n\n        o = instance.media_player_new()\n        if args:\n            o.set_media(instance.media_new(*args))\n        return o\n\n    def get_instance(self):\n        \"\"\"Return the associated Instance.\n        \"\"\"\n        return self._instance  #PYCHOK expected\n\n    def set_mrl(self, mrl, *options):\n        \"\"\"Set the MRL to play.\n\n        Warning: most audio and video options, such as text renderer,\n        have no effects on an individual media. These options must be\n        set at the vlc.Instance or vlc.MediaPlayer instanciation.\n\n        @param mrl: The MRL\n        @param options: optional media option=value strings\n        @return: the Media object\n        \"\"\"\n        m = self.get_instance().media_new(mrl, *options)\n        self.set_media(m)\n        return m\n\n    def video_get_spu_description(self):\n        \"\"\"Get the description of available video subtitles.\n        \"\"\"\n        return track_description_list(libvlc_video_get_spu_description(self))\n\n    def video_get_title_description(self):\n        \"\"\"Get the description of available titles.\n        \"\"\"\n        return track_description_list(libvlc_video_get_title_description(self))\n\n    def video_get_chapter_description(self, title):\n        \"\"\"Get the description of available chapters for specific title.\n\n        @param title: selected title (int)\n        \"\"\"\n        return track_description_list(libvlc_video_get_chapter_description(self, title))\n\n    def video_get_track_description(self):\n        \"\"\"Get the description of available video tracks.\n        \"\"\"\n        return track_description_list(libvlc_video_get_track_description(self))\n\n    def audio_get_track_description(self):\n        \"\"\"Get the description of available audio tracks.\n        \"\"\"\n        return track_description_list(libvlc_audio_get_track_description(self))\n\n    def get_full_title_descriptions(self):\n        '''Get the full description of available titles.\n        @return: the titles list\n        @version: LibVLC 3.0.0 and later.\n        '''\n        titleDescription_pp = ctypes.POINTER(TitleDescription)()\n        n = libvlc_media_player_get_full_title_descriptions(self, ctypes.byref(titleDescription_pp))\n        info = ctypes.cast(ctypes.titleDescription_pp, ctypes.POINTER(ctypes.POINTER(TitleDescription) * n))\n        return info\n\n    def get_full_chapter_descriptions(self, i_chapters_of_title):\n        '''Get the full description of available chapters.\n        @param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1).\n        @return: the chapters list\n        @version: LibVLC 3.0.0 and later.\n        '''\n        chapterDescription_pp = ctypes.POINTER(ChapterDescription)()\n        n = libvlc_media_player_get_full_chapter_descriptions(self, ctypes.byref(chapterDescription_pp))\n        info = ctypes.cast(ctypes.chapterDescription_pp, ctypes.POINTER(ctypes.POINTER(ChapterDescription) * n))\n        return info\n\n    def video_get_size(self, num=0):\n        \"\"\"Get the video size in pixels as 2-tuple (width, height).\n\n        @param num: video number (default 0).\n        \"\"\"\n        r = libvlc_video_get_size(self, num)\n        if isinstance(r, tuple) and len(r) == 2:\n            return r\n        else:\n            raise VLCException('invalid video number (%s)' % (num,))\n\n    def set_hwnd(self, drawable):\n        \"\"\"Set a Win32/Win64 API window handle (HWND).\n\n        Specify where the media player should render its video\n        output. If LibVLC was built without Win32/Win64 API output\n        support, then this has no effects.\n\n        @param drawable: windows handle of the drawable.\n        \"\"\"\n        if not isinstance(drawable, ctypes.c_void_p):\n            drawable = ctypes.c_void_p(int(drawable))\n        libvlc_media_player_set_hwnd(self, drawable)\n\n    def video_get_width(self, num=0):\n        \"\"\"Get the width of a video in pixels.\n\n        @param num: video number (default 0).\n        \"\"\"\n        return self.video_get_size(num)[0]\n\n    def video_get_height(self, num=0):\n        \"\"\"Get the height of a video in pixels.\n\n        @param num: video number (default 0).\n        \"\"\"\n        return self.video_get_size(num)[1]\n\n    def video_get_cursor(self, num=0):\n        \"\"\"Get the mouse pointer coordinates over a video as 2-tuple (x, y).\n\n        Coordinates are expressed in terms of the decoded video resolution,\n        B{not} in terms of pixels on the screen/viewport.  To get the\n        latter, you must query your windowing system directly.\n\n        Either coordinate may be negative or larger than the corresponding\n        size of the video, if the cursor is outside the rendering area.\n\n        @warning: The coordinates may be out-of-date if the pointer is not\n        located on the video rendering area.  LibVLC does not track the\n        mouse pointer if the latter is outside the video widget.\n\n        @note: LibVLC does not support multiple mouse pointers (but does\n        support multiple input devices sharing the same pointer).\n\n        @param num: video number (default 0).\n        \"\"\"\n        r = libvlc_video_get_cursor(self, num)\n        if isinstance(r, tuple) and len(r) == 2:\n            return r\n        raise VLCException('invalid video number (%s)' % (num,))\n\n\n    \n    def release(self):\n        '''Release a media_player after use\n        Decrement the reference count of a media player object. If the\n        reference count is 0, then L{release}() will\n        release the media player object. If the media player object\n        has been released, then it should not be used again.\n        '''\n        return libvlc_media_player_release(self)\n\n    \n    def retain(self):\n        '''Retain a reference to a media player object. Use\n        L{release}() to decrement reference count.\n        '''\n        return libvlc_media_player_retain(self)\n\n    \n    def set_media(self, p_md):\n        '''Set the media that will be used by the media_player. If any,\n        previous md will be released.\n        @param p_md: the Media. Afterwards the p_md can be safely destroyed.\n        '''\n        return libvlc_media_player_set_media(self, p_md)\n\n    \n    def get_media(self):\n        '''Get the media used by the media_player.\n        @return: the media associated with p_mi, or None if no media is associated.\n        '''\n        return libvlc_media_player_get_media(self)\n\n    @memoize_parameterless\n    def event_manager(self):\n        '''Get the Event Manager from which the media player send event.\n        @return: the event manager associated with p_mi.\n        '''\n        return libvlc_media_player_event_manager(self)\n\n    \n    def is_playing(self):\n        '''is_playing.\n        @return: 1 if the media player is playing, 0 otherwise \\libvlc_return_bool.\n        '''\n        return libvlc_media_player_is_playing(self)\n\n    \n    def play(self):\n        '''Play.\n        @return: 0 if playback started (and was already started), or -1 on error.\n        '''\n        return libvlc_media_player_play(self)\n\n    \n    def set_pause(self, do_pause):\n        '''Pause or resume (no effect if there is no media).\n        @param do_pause: play/resume if zero, pause if non-zero.\n        @version: LibVLC 1.1.1 or later.\n        '''\n        return libvlc_media_player_set_pause(self, do_pause)\n\n    \n    def pause(self):\n        '''Toggle pause (no effect if there is no media).\n        '''\n        return libvlc_media_player_pause(self)\n\n    \n    def stop(self):\n        '''Stop (no effect if there is no media).\n        '''\n        return libvlc_media_player_stop(self)\n\n    \n    def video_set_callbacks(self, lock, unlock, display, opaque):\n        '''Set callbacks and private data to render decoded video to a custom area\n        in memory.\n        Use L{video_set_format}() or L{video_set_format_callbacks}()\n        to configure the decoded format.\n        @param lock: callback to lock video memory (must not be None).\n        @param unlock: callback to unlock video memory (or None if not needed).\n        @param display: callback to display video (or None if not needed).\n        @param opaque: private pointer for the three callbacks (as first parameter).\n        @version: LibVLC 1.1.1 or later.\n        '''\n        return libvlc_video_set_callbacks(self, lock, unlock, display, opaque)\n\n    \n    def video_set_format(self, chroma, width, height, pitch):\n        '''Set decoded video chroma and dimensions.\n        This only works in combination with L{video_set_callbacks}(),\n        and is mutually exclusive with L{video_set_format_callbacks}().\n        @param chroma: a four-characters string identifying the chroma (e.g. \"RV32\" or \"YUYV\").\n        @param width: pixel width.\n        @param height: pixel height.\n        @param pitch: line pitch (in bytes).\n        @version: LibVLC 1.1.1 or later.\n        @bug: All pixel planes are expected to have the same pitch. To use the YCbCr color space with chrominance subsampling, consider using L{video_set_format_callbacks}() instead.\n        '''\n        return libvlc_video_set_format(self, str_to_bytes(chroma), width, height, pitch)\n\n    \n    def video_set_format_callbacks(self, setup, cleanup):\n        '''Set decoded video chroma and dimensions. This only works in combination with\n        L{video_set_callbacks}().\n        @param setup: callback to select the video format (cannot be None).\n        @param cleanup: callback to release any allocated resources (or None).\n        @version: LibVLC 2.0.0 or later.\n        '''\n        return libvlc_video_set_format_callbacks(self, setup, cleanup)\n\n    \n    def set_nsobject(self, drawable):\n        '''Set the NSView handler where the media player should render its video output.\n        Use the vout called \"macosx\".\n        The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding\n        protocol:\n        @begincode\n        \\@protocol VLCOpenGLVideoViewEmbedding <NSObject>\n        - (void)addVoutSubview:(NSView *)view;\n        - (void)removeVoutSubview:(NSView *)view;\n        \\@end\n        @endcode\n        Or it can be an NSView object.\n        If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then\n        the following code should work:\n        @begincode\n        \n            NSView *video = [[NSView alloc] init];\n            QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);\n            L{set_nsobject}(mp, video);\n            [video release];\n        \n        @endcode\n        You can find a live example in VLCVideoView in VLCKit.framework.\n        @param drawable: the drawable that is either an NSView or an object following the VLCOpenGLVideoViewEmbedding protocol.\n        '''\n        return libvlc_media_player_set_nsobject(self, drawable)\n\n    \n    def get_nsobject(self):\n        '''Get the NSView handler previously set with L{set_nsobject}().\n        @return: the NSView handler or 0 if none where set.\n        '''\n        return libvlc_media_player_get_nsobject(self)\n\n    \n    def set_agl(self, drawable):\n        '''Set the agl handler where the media player should render its video output.\n        @param drawable: the agl handler.\n        '''\n        return libvlc_media_player_set_agl(self, drawable)\n\n    \n    def get_agl(self):\n        '''Get the agl handler previously set with L{set_agl}().\n        @return: the agl handler or 0 if none where set.\n        '''\n        return libvlc_media_player_get_agl(self)\n\n    \n    def set_xwindow(self, drawable):\n        '''Set an X Window System drawable where the media player should render its\n        video output. If LibVLC was built without X11 output support, then this has\n        no effects.\n        The specified identifier must correspond to an existing Input/Output class\n        X11 window. Pixmaps are B{not} supported. The caller shall ensure that\n        the X11 server is the same as the one the VLC instance has been configured\n        with. This function must be called before video playback is started;\n        otherwise it will only take effect after playback stop and restart.\n        @param drawable: the ID of the X window.\n        '''\n        return libvlc_media_player_set_xwindow(self, drawable)\n\n    \n    def get_xwindow(self):\n        '''Get the X Window System window identifier previously set with\n        L{set_xwindow}(). Note that this will return the identifier\n        even if VLC is not currently using it (for instance if it is playing an\n        audio-only input).\n        @return: an X window ID, or 0 if none where set.\n        '''\n        return libvlc_media_player_get_xwindow(self)\n\n    \n    def get_hwnd(self):\n        '''Get the Windows API window handle (HWND) previously set with\n        L{set_hwnd}(). The handle will be returned even if LibVLC\n        is not currently outputting any video to it.\n        @return: a window handle or None if there are none.\n        '''\n        return libvlc_media_player_get_hwnd(self)\n\n    \n    def audio_set_callbacks(self, play, pause, resume, flush, drain, opaque):\n        '''Set callbacks and private data for decoded audio.\n        Use L{audio_set_format}() or L{audio_set_format_callbacks}()\n        to configure the decoded audio format.\n        @param play: callback to play audio samples (must not be None).\n        @param pause: callback to pause playback (or None to ignore).\n        @param resume: callback to resume playback (or None to ignore).\n        @param flush: callback to flush audio buffers (or None to ignore).\n        @param drain: callback to drain audio buffers (or None to ignore).\n        @param opaque: private pointer for the audio callbacks (as first parameter).\n        @version: LibVLC 2.0.0 or later.\n        '''\n        return libvlc_audio_set_callbacks(self, play, pause, resume, flush, drain, opaque)\n\n    \n    def audio_set_volume_callback(self, set_volume):\n        '''Set callbacks and private data for decoded audio. This only works in\n        combination with L{audio_set_callbacks}().\n        Use L{audio_set_format}() or L{audio_set_format_callbacks}()\n        to configure the decoded audio format.\n        @param set_volume: callback to apply audio volume, or None to apply volume in software.\n        @version: LibVLC 2.0.0 or later.\n        '''\n        return libvlc_audio_set_volume_callback(self, set_volume)\n\n    \n    def audio_set_format_callbacks(self, setup, cleanup):\n        '''Set decoded audio format. This only works in combination with\n        L{audio_set_callbacks}().\n        @param setup: callback to select the audio format (cannot be None).\n        @param cleanup: callback to release any allocated resources (or None).\n        @version: LibVLC 2.0.0 or later.\n        '''\n        return libvlc_audio_set_format_callbacks(self, setup, cleanup)\n\n    \n    def audio_set_format(self, format, rate, channels):\n        '''Set decoded audio format.\n        This only works in combination with L{audio_set_callbacks}(),\n        and is mutually exclusive with L{audio_set_format_callbacks}().\n        @param format: a four-characters string identifying the sample format (e.g. \"S16N\" or \"FL32\").\n        @param rate: sample rate (expressed in Hz).\n        @param channels: channels count.\n        @version: LibVLC 2.0.0 or later.\n        '''\n        return libvlc_audio_set_format(self, str_to_bytes(format), rate, channels)\n\n    \n    def get_length(self):\n        '''Get the current movie length (in ms).\n        @return: the movie length (in ms), or -1 if there is no media.\n        '''\n        return libvlc_media_player_get_length(self)\n\n    \n    def get_time(self):\n        '''Get the current movie time (in ms).\n        @return: the movie time (in ms), or -1 if there is no media.\n        '''\n        return libvlc_media_player_get_time(self)\n\n    \n    def set_time(self, i_time):\n        '''Set the movie time (in ms). This has no effect if no media is being played.\n        Not all formats and protocols support this.\n        @param i_time: the movie time (in ms).\n        '''\n        return libvlc_media_player_set_time(self, i_time)\n\n    \n    def get_position(self):\n        '''Get movie position as percentage between 0.0 and 1.0.\n        @return: movie position, or -1. in case of error.\n        '''\n        return libvlc_media_player_get_position(self)\n\n    \n    def set_position(self, f_pos):\n        '''Set movie position as percentage between 0.0 and 1.0.\n        This has no effect if playback is not enabled.\n        This might not work depending on the underlying input format and protocol.\n        @param f_pos: the position.\n        '''\n        return libvlc_media_player_set_position(self, f_pos)\n\n    \n    def set_chapter(self, i_chapter):\n        '''Set movie chapter (if applicable).\n        @param i_chapter: chapter number to play.\n        '''\n        return libvlc_media_player_set_chapter(self, i_chapter)\n\n    \n    def get_chapter(self):\n        '''Get movie chapter.\n        @return: chapter number currently playing, or -1 if there is no media.\n        '''\n        return libvlc_media_player_get_chapter(self)\n\n    \n    def get_chapter_count(self):\n        '''Get movie chapter count.\n        @return: number of chapters in movie, or -1.\n        '''\n        return libvlc_media_player_get_chapter_count(self)\n\n    \n    def will_play(self):\n        '''Is the player able to play.\n        @return: boolean \\libvlc_return_bool.\n        '''\n        return libvlc_media_player_will_play(self)\n\n    \n    def get_chapter_count_for_title(self, i_title):\n        '''Get title chapter count.\n        @param i_title: title.\n        @return: number of chapters in title, or -1.\n        '''\n        return libvlc_media_player_get_chapter_count_for_title(self, i_title)\n\n    \n    def set_title(self, i_title):\n        '''Set movie title.\n        @param i_title: title number to play.\n        '''\n        return libvlc_media_player_set_title(self, i_title)\n\n    \n    def get_title(self):\n        '''Get movie title.\n        @return: title number currently playing, or -1.\n        '''\n        return libvlc_media_player_get_title(self)\n\n    \n    def get_title_count(self):\n        '''Get movie title count.\n        @return: title number count, or -1.\n        '''\n        return libvlc_media_player_get_title_count(self)\n\n    \n    def previous_chapter(self):\n        '''Set previous chapter (if applicable).\n        '''\n        return libvlc_media_player_previous_chapter(self)\n\n    \n    def next_chapter(self):\n        '''Set next chapter (if applicable).\n        '''\n        return libvlc_media_player_next_chapter(self)\n\n    \n    def get_rate(self):\n        '''Get the requested movie play rate.\n        @warning: Depending on the underlying media, the requested rate may be\n        different from the real playback rate.\n        @return: movie play rate.\n        '''\n        return libvlc_media_player_get_rate(self)\n\n    \n    def set_rate(self, rate):\n        '''Set movie play rate.\n        @param rate: movie play rate to set.\n        @return: -1 if an error was detected, 0 otherwise (but even then, it might not actually work depending on the underlying media protocol).\n        '''\n        return libvlc_media_player_set_rate(self, rate)\n\n    \n    def get_state(self):\n        '''Get current movie state.\n        @return: the current state of the media player (playing, paused, ...) See libvlc_state_t.\n        '''\n        return libvlc_media_player_get_state(self)\n\n    \n    def get_fps(self):\n        '''Get movie fps rate.\n        @return: frames per second (fps) for this playing movie, or 0 if unspecified.\n        '''\n        return libvlc_media_player_get_fps(self)\n\n    \n    def has_vout(self):\n        '''How many video outputs does this media player have?\n        @return: the number of video outputs.\n        '''\n        return libvlc_media_player_has_vout(self)\n\n    \n    def is_seekable(self):\n        '''Is this media player seekable?\n        @return: true if the media player can seek \\libvlc_return_bool.\n        '''\n        return libvlc_media_player_is_seekable(self)\n\n    \n    def can_pause(self):\n        '''Can this media player be paused?\n        @return: true if the media player can pause \\libvlc_return_bool.\n        '''\n        return libvlc_media_player_can_pause(self)\n\n    \n    def program_scrambled(self):\n        '''Check if the current program is scrambled.\n        @return: true if the current program is scrambled \\libvlc_return_bool.\n        @version: LibVLC 2.2.0 or later.\n        '''\n        return libvlc_media_player_program_scrambled(self)\n\n    \n    def next_frame(self):\n        '''Display the next frame (if supported).\n        '''\n        return libvlc_media_player_next_frame(self)\n\n    \n    def navigate(self, navigate):\n        '''Navigate through DVD Menu.\n        @param navigate: the Navigation mode.\n        @version: libVLC 2.0.0 or later.\n        '''\n        return libvlc_media_player_navigate(self, navigate)\n\n    \n    def set_video_title_display(self, position, timeout):\n        '''Set if, and how, the video title will be shown when media is played.\n        @param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed.\n        @param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable).\n        @version: libVLC 2.1.0 or later.\n        '''\n        return libvlc_media_player_set_video_title_display(self, position, timeout)\n\n    \n    def toggle_fullscreen(self):\n        '''Toggle fullscreen status on non-embedded video outputs.\n        @warning: The same limitations applies to this function\n        as to L{set_fullscreen}().\n        '''\n        return libvlc_toggle_fullscreen(self)\n\n    \n    def set_fullscreen(self, b_fullscreen):\n        '''Enable or disable fullscreen.\n        @warning: With most window managers, only a top-level windows can be in\n        full-screen mode. Hence, this function will not operate properly if\n        L{set_xwindow}() was used to embed the video in a\n        non-top-level window. In that case, the embedding window must be reparented\n        to the root window B{before} fullscreen mode is enabled. You will want\n        to reparent it back to its normal parent when disabling fullscreen.\n        @param b_fullscreen: boolean for fullscreen status.\n        '''\n        return libvlc_set_fullscreen(self, b_fullscreen)\n\n    \n    def get_fullscreen(self):\n        '''Get current fullscreen status.\n        @return: the fullscreen status (boolean) \\libvlc_return_bool.\n        '''\n        return libvlc_get_fullscreen(self)\n\n    \n    def video_set_key_input(self, on):\n        '''Enable or disable key press events handling, according to the LibVLC hotkeys\n        configuration. By default and for historical reasons, keyboard events are\n        handled by the LibVLC video widget.\n        @note: On X11, there can be only one subscriber for key press and mouse\n        click events per window. If your application has subscribed to those events\n        for the X window ID of the video widget, then LibVLC will not be able to\n        handle key presses and mouse clicks in any case.\n        @warning: This function is only implemented for X11 and Win32 at the moment.\n        @param on: true to handle key press events, false to ignore them.\n        '''\n        return libvlc_video_set_key_input(self, on)\n\n    \n    def video_set_mouse_input(self, on):\n        '''Enable or disable mouse click events handling. By default, those events are\n        handled. This is needed for DVD menus to work, as well as a few video\n        filters such as \"puzzle\".\n        See L{video_set_key_input}().\n        @warning: This function is only implemented for X11 and Win32 at the moment.\n        @param on: true to handle mouse click events, false to ignore them.\n        '''\n        return libvlc_video_set_mouse_input(self, on)\n\n    \n    def video_get_scale(self):\n        '''Get the current video scaling factor.\n        See also L{video_set_scale}().\n        @return: the currently configured zoom factor, or 0. if the video is set to fit to the output window/drawable automatically.\n        '''\n        return libvlc_video_get_scale(self)\n\n    \n    def video_set_scale(self, f_factor):\n        '''Set the video scaling factor. That is the ratio of the number of pixels on\n        screen to the number of pixels in the original decoded video in each\n        dimension. Zero is a special value; it will adjust the video to the output\n        window/drawable (in windowed mode) or the entire screen.\n        Note that not all video outputs support scaling.\n        @param f_factor: the scaling factor, or zero.\n        '''\n        return libvlc_video_set_scale(self, f_factor)\n\n    \n    def video_get_aspect_ratio(self):\n        '''Get current video aspect ratio.\n        @return: the video aspect ratio or None if unspecified (the result must be released with free() or L{free}()).\n        '''\n        return libvlc_video_get_aspect_ratio(self)\n\n    \n    def video_set_aspect_ratio(self, psz_aspect):\n        '''Set new video aspect ratio.\n        @param psz_aspect: new video aspect-ratio or None to reset to default @note Invalid aspect ratios are ignored.\n        '''\n        return libvlc_video_set_aspect_ratio(self, str_to_bytes(psz_aspect))\n\n    \n    def video_get_spu(self):\n        '''Get current video subtitle.\n        @return: the video subtitle selected, or -1 if none.\n        '''\n        return libvlc_video_get_spu(self)\n\n    \n    def video_get_spu_count(self):\n        '''Get the number of available video subtitles.\n        @return: the number of available video subtitles.\n        '''\n        return libvlc_video_get_spu_count(self)\n\n    \n    def video_set_spu(self, i_spu):\n        '''Set new video subtitle.\n        @param i_spu: video subtitle track to select (i_id from track description).\n        @return: 0 on success, -1 if out of range.\n        '''\n        return libvlc_video_set_spu(self, i_spu)\n\n    \n    def video_set_subtitle_file(self, psz_subtitle):\n        '''Set new video subtitle file.\n        @param psz_subtitle: new video subtitle file.\n        @return: the success status (boolean).\n        '''\n        return libvlc_video_set_subtitle_file(self, str_to_bytes(psz_subtitle))\n\n    \n    def video_get_spu_delay(self):\n        '''Get the current subtitle delay. Positive values means subtitles are being\n        displayed later, negative values earlier.\n        @return: time (in microseconds) the display of subtitles is being delayed.\n        @version: LibVLC 2.0.0 or later.\n        '''\n        return libvlc_video_get_spu_delay(self)\n\n    \n    def video_set_spu_delay(self, i_delay):\n        '''Set the subtitle delay. This affects the timing of when the subtitle will\n        be displayed. Positive values result in subtitles being displayed later,\n        while negative values will result in subtitles being displayed earlier.\n        The subtitle delay will be reset to zero each time the media changes.\n        @param i_delay: time (in microseconds) the display of subtitles should be delayed.\n        @return: 0 on success, -1 on error.\n        @version: LibVLC 2.0.0 or later.\n        '''\n        return libvlc_video_set_spu_delay(self, i_delay)\n\n    \n    def video_get_crop_geometry(self):\n        '''Get current crop filter geometry.\n        @return: the crop filter geometry or None if unset.\n        '''\n        return libvlc_video_get_crop_geometry(self)\n\n    \n    def video_set_crop_geometry(self, psz_geometry):\n        '''Set new crop filter geometry.\n        @param psz_geometry: new crop filter geometry (None to unset).\n        '''\n        return libvlc_video_set_crop_geometry(self, str_to_bytes(psz_geometry))\n\n    \n    def video_get_teletext(self):\n        '''Get current teletext page requested.\n        @return: the current teletext page requested.\n        '''\n        return libvlc_video_get_teletext(self)\n\n    \n    def video_set_teletext(self, i_page):\n        '''Set new teletext page to retrieve.\n        @param i_page: teletex page number requested.\n        '''\n        return libvlc_video_set_teletext(self, i_page)\n\n    \n    def toggle_teletext(self):\n        '''Toggle teletext transparent status on video output.\n        '''\n        return libvlc_toggle_teletext(self)\n\n    \n    def video_get_track_count(self):\n        '''Get number of available video tracks.\n        @return: the number of available video tracks (int).\n        '''\n        return libvlc_video_get_track_count(self)\n\n    \n    def video_get_track(self):\n        '''Get current video track.\n        @return: the video track ID (int) or -1 if no active input.\n        '''\n        return libvlc_video_get_track(self)\n\n    \n    def video_set_track(self, i_track):\n        '''Set video track.\n        @param i_track: the track ID (i_id field from track description).\n        @return: 0 on success, -1 if out of range.\n        '''\n        return libvlc_video_set_track(self, i_track)\n\n    \n    def video_take_snapshot(self, num, psz_filepath, i_width, i_height):\n        '''Take a snapshot of the current video window.\n        If i_width AND i_height is 0, original size is used.\n        If i_width XOR i_height is 0, original aspect-ratio is preserved.\n        @param num: number of video output (typically 0 for the first/only one).\n        @param psz_filepath: the path where to save the screenshot to.\n        @param i_width: the snapshot's width.\n        @param i_height: the snapshot's height.\n        @return: 0 on success, -1 if the video was not found.\n        '''\n        return libvlc_video_take_snapshot(self, num, str_to_bytes(psz_filepath), i_width, i_height)\n\n    \n    def video_set_deinterlace(self, psz_mode):\n        '''Enable or disable deinterlace filter.\n        @param psz_mode: type of deinterlace filter, None to disable.\n        '''\n        return libvlc_video_set_deinterlace(self, str_to_bytes(psz_mode))\n\n    \n    def video_get_marquee_int(self, option):\n        '''Get an integer marquee option value.\n        @param option: marq option to get See libvlc_video_marquee_int_option_t.\n        '''\n        return libvlc_video_get_marquee_int(self, option)\n\n    \n    def video_get_marquee_string(self, option):\n        '''Get a string marquee option value.\n        @param option: marq option to get See libvlc_video_marquee_string_option_t.\n        '''\n        return libvlc_video_get_marquee_string(self, option)\n\n    \n    def video_set_marquee_int(self, option, i_val):\n        '''Enable, disable or set an integer marquee option\n        Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)\n        or disabling (arg 0) the marq filter.\n        @param option: marq option to set See libvlc_video_marquee_int_option_t.\n        @param i_val: marq option value.\n        '''\n        return libvlc_video_set_marquee_int(self, option, i_val)\n\n    \n    def video_set_marquee_string(self, option, psz_text):\n        '''Set a marquee string option.\n        @param option: marq option to set See libvlc_video_marquee_string_option_t.\n        @param psz_text: marq option value.\n        '''\n        return libvlc_video_set_marquee_string(self, option, str_to_bytes(psz_text))\n\n    \n    def video_get_logo_int(self, option):\n        '''Get integer logo option.\n        @param option: logo option to get, values of libvlc_video_logo_option_t.\n        '''\n        return libvlc_video_get_logo_int(self, option)\n\n    \n    def video_set_logo_int(self, option, value):\n        '''Set logo option as integer. Options that take a different type value\n        are ignored.\n        Passing libvlc_logo_enable as option value has the side effect of\n        starting (arg !0) or stopping (arg 0) the logo filter.\n        @param option: logo option to set, values of libvlc_video_logo_option_t.\n        @param value: logo option value.\n        '''\n        return libvlc_video_set_logo_int(self, option, value)\n\n    \n    def video_set_logo_string(self, option, psz_value):\n        '''Set logo option as string. Options that take a different type value\n        are ignored.\n        @param option: logo option to set, values of libvlc_video_logo_option_t.\n        @param psz_value: logo option value.\n        '''\n        return libvlc_video_set_logo_string(self, option, str_to_bytes(psz_value))\n\n    \n    def video_get_adjust_int(self, option):\n        '''Get integer adjust option.\n        @param option: adjust option to get, values of libvlc_video_adjust_option_t.\n        @version: LibVLC 1.1.1 and later.\n        '''\n        return libvlc_video_get_adjust_int(self, option)\n\n    \n    def video_set_adjust_int(self, option, value):\n        '''Set adjust option as integer. Options that take a different type value\n        are ignored.\n        Passing libvlc_adjust_enable as option value has the side effect of\n        starting (arg !0) or stopping (arg 0) the adjust filter.\n        @param option: adust option to set, values of libvlc_video_adjust_option_t.\n        @param value: adjust option value.\n        @version: LibVLC 1.1.1 and later.\n        '''\n        return libvlc_video_set_adjust_int(self, option, value)\n\n    \n    def video_get_adjust_float(self, option):\n        '''Get float adjust option.\n        @param option: adjust option to get, values of libvlc_video_adjust_option_t.\n        @version: LibVLC 1.1.1 and later.\n        '''\n        return libvlc_video_get_adjust_float(self, option)\n\n    \n    def video_set_adjust_float(self, option, value):\n        '''Set adjust option as float. Options that take a different type value\n        are ignored.\n        @param option: adust option to set, values of libvlc_video_adjust_option_t.\n        @param value: adjust option value.\n        @version: LibVLC 1.1.1 and later.\n        '''\n        return libvlc_video_set_adjust_float(self, option, value)\n\n    \n    def audio_output_set(self, psz_name):\n        '''Selects an audio output module.\n        @note: Any change will take be effect only after playback is stopped and\n        restarted. Audio output cannot be changed while playing.\n        @param psz_name: name of audio output, use psz_name of See L{AudioOutput}.\n        @return: 0 if function succeded, -1 on error.\n        '''\n        return libvlc_audio_output_set(self, str_to_bytes(psz_name))\n\n    \n    def audio_output_device_enum(self):\n        '''Gets a list of potential audio output devices,\n        See L{audio_output_device_set}().\n        @note: Not all audio outputs support enumerating devices.\n        The audio output may be functional even if the list is empty (None).\n        @note: The list may not be exhaustive.\n        @warning: Some audio output devices in the list might not actually work in\n        some circumstances. By default, it is recommended to not specify any\n        explicit audio device.\n        @return: A None-terminated linked list of potential audio output devices. It must be freed it with L{audio_output_device_list_release}().\n        @version: LibVLC 2.2.0 or later.\n        '''\n        return libvlc_audio_output_device_enum(self)\n\n    \n    def audio_output_device_set(self, module, device_id):\n        '''Configures an explicit audio output device.\n        If the module paramater is None, audio output will be moved to the device\n        specified by the device identifier string immediately. This is the\n        recommended usage.\n        A list of adequate potential device strings can be obtained with\n        L{audio_output_device_enum}().\n        However passing None is supported in LibVLC version 2.2.0 and later only;\n        in earlier versions, this function would have no effects when the module\n        parameter was None.\n        If the module parameter is not None, the device parameter of the\n        corresponding audio output, if it exists, will be set to the specified\n        string. Note that some audio output modules do not have such a parameter\n        (notably MMDevice and PulseAudio).\n        A list of adequate potential device strings can be obtained with\n        L{audio_output_device_list_get}().\n        @note: This function does not select the specified audio output plugin.\n        L{audio_output_set}() is used for that purpose.\n        @warning: The syntax for the device parameter depends on the audio output.\n        Some audio output modules require further parameters (e.g. a channels map\n        in the case of ALSA).\n        @param module: If None, current audio output module. if non-None, name of audio output module.\n        @param device_id: device identifier string.\n        @return: Nothing. Errors are ignored (this is a design bug).\n        '''\n        return libvlc_audio_output_device_set(self, str_to_bytes(module), str_to_bytes(device_id))\n\n    \n    def audio_toggle_mute(self):\n        '''Toggle mute status.\n        '''\n        return libvlc_audio_toggle_mute(self)\n\n    \n    def audio_get_mute(self):\n        '''Get current mute status.\n        @return: the mute status (boolean) if defined, -1 if undefined/unapplicable.\n        '''\n        return libvlc_audio_get_mute(self)\n\n    \n    def audio_set_mute(self, status):\n        '''Set mute status.\n        @param status: If status is true then mute, otherwise unmute @warning This function does not always work. If there are no active audio playback stream, the mute status might not be available. If digital pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also some audio output plugins do not support muting at all. @note To force silent playback, disable all audio tracks. This is more efficient and reliable than mute.\n        '''\n        return libvlc_audio_set_mute(self, status)\n\n    \n    def audio_get_volume(self):\n        '''Get current software audio volume.\n        @return: the software volume in percents (0 = mute, 100 = nominal / 0dB).\n        '''\n        return libvlc_audio_get_volume(self)\n\n    \n    def audio_set_volume(self, i_volume):\n        '''Set current software audio volume.\n        @param i_volume: the volume in percents (0 = mute, 100 = 0dB).\n        @return: 0 if the volume was set, -1 if it was out of range.\n        '''\n        return libvlc_audio_set_volume(self, i_volume)\n\n    \n    def audio_get_track_count(self):\n        '''Get number of available audio tracks.\n        @return: the number of available audio tracks (int), or -1 if unavailable.\n        '''\n        return libvlc_audio_get_track_count(self)\n\n    \n    def audio_get_track(self):\n        '''Get current audio track.\n        @return: the audio track ID or -1 if no active input.\n        '''\n        return libvlc_audio_get_track(self)\n\n    \n    def audio_set_track(self, i_track):\n        '''Set current audio track.\n        @param i_track: the track ID (i_id field from track description).\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_audio_set_track(self, i_track)\n\n    \n    def audio_get_channel(self):\n        '''Get current audio channel.\n        @return: the audio channel See libvlc_audio_output_channel_t.\n        '''\n        return libvlc_audio_get_channel(self)\n\n    \n    def audio_set_channel(self, channel):\n        '''Set current audio channel.\n        @param channel: the audio channel, See libvlc_audio_output_channel_t.\n        @return: 0 on success, -1 on error.\n        '''\n        return libvlc_audio_set_channel(self, channel)\n\n    \n    def audio_get_delay(self):\n        '''Get current audio delay.\n        @return: the audio delay (microseconds).\n        @version: LibVLC 1.1.1 or later.\n        '''\n        return libvlc_audio_get_delay(self)\n\n    \n    def audio_set_delay(self, i_delay):\n        '''Set current audio delay. The audio delay will be reset to zero each time the media changes.\n        @param i_delay: the audio delay (microseconds).\n        @return: 0 on success, -1 on error.\n        @version: LibVLC 1.1.1 or later.\n        '''\n        return libvlc_audio_set_delay(self, i_delay)\n\n    \n    def set_equalizer(self, p_equalizer):\n        '''Apply new equalizer settings to a media player.\n        The equalizer is first created by invoking L{audio_equalizer_new}() or\n        L{audio_equalizer_new_from_preset}().\n        It is possible to apply new equalizer settings to a media player whether the media\n        player is currently playing media or not.\n        Invoking this method will immediately apply the new equalizer settings to the audio\n        output of the currently playing media if there is any.\n        If there is no currently playing media, the new equalizer settings will be applied\n        later if and when new media is played.\n        Equalizer settings will automatically be applied to subsequently played media.\n        To disable the equalizer for a media player invoke this method passing None for the\n        p_equalizer parameter.\n        The media player does not keep a reference to the supplied equalizer so it is safe\n        for an application to release the equalizer reference any time after this method\n        returns.\n        @param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player.\n        @return: zero on success, -1 on error.\n        @version: LibVLC 2.2.0 or later.\n        '''\n        return libvlc_media_player_set_equalizer(self, p_equalizer)\n\n\n # LibVLC __version__ functions #\n\ndef libvlc_clearerr():\n    '''Clears the LibVLC error status for the current thread. This is optional.\n    By default, the error status is automatically overridden when a new error\n    occurs, and destroyed when the thread exits.\n    '''\n    f = _Cfunctions.get('libvlc_clearerr', None) or \\\n        _Cfunction('libvlc_clearerr', (), None,\n                    None)\n    return f()\n\ndef libvlc_vprinterr(fmt, ap):\n    '''Sets the LibVLC error status and message for the current thread.\n    Any previous error is overridden.\n    @param fmt: the format string.\n    @param ap: the arguments.\n    @return: a nul terminated string in any case.\n    '''\n    f = _Cfunctions.get('libvlc_vprinterr', None) or \\\n        _Cfunction('libvlc_vprinterr', ((1,), (1,),), None,\n                    ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p)\n    return f(fmt, ap)\n\ndef libvlc_new(argc, argv):\n    '''Create and initialize a libvlc instance.\n    This functions accept a list of \"command line\" arguments similar to the\n    main(). These arguments affect the LibVLC instance default configuration.\n    @param argc: the number of arguments (should be 0).\n    @param argv: list of arguments (should be None).\n    @return: the libvlc instance or None in case of error.\n    @version Arguments are meant to be passed from the command line to LibVLC, just like VLC media player does. The list of valid arguments depends on the LibVLC version, the operating system and platform, and set of available LibVLC plugins. Invalid or unsupported arguments will cause the function to fail (i.e. return None). Also, some arguments may alter the behaviour or otherwise interfere with other LibVLC functions. @warning There is absolutely no warranty or promise of forward, backward and cross-platform compatibility with regards to L{libvlc_new}() arguments. We recommend that you do not use them, other than when debugging.\n    '''\n    f = _Cfunctions.get('libvlc_new', None) or \\\n        _Cfunction('libvlc_new', ((1,), (1,),), class_result(Instance),\n                    ctypes.c_void_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p))\n    return f(argc, argv)\n\ndef libvlc_release(p_instance):\n    '''Decrement the reference count of a libvlc instance, and destroy it\n    if it reaches zero.\n    @param p_instance: the instance to destroy.\n    '''\n    f = _Cfunctions.get('libvlc_release', None) or \\\n        _Cfunction('libvlc_release', ((1,),), None,\n                    None, Instance)\n    return f(p_instance)\n\ndef libvlc_retain(p_instance):\n    '''Increments the reference count of a libvlc instance.\n    The initial reference count is 1 after L{libvlc_new}() returns.\n    @param p_instance: the instance to reference.\n    '''\n    f = _Cfunctions.get('libvlc_retain', None) or \\\n        _Cfunction('libvlc_retain', ((1,),), None,\n                    None, Instance)\n    return f(p_instance)\n\ndef libvlc_add_intf(p_instance, name):\n    '''Try to start a user interface for the libvlc instance.\n    @param p_instance: the instance.\n    @param name: interface name, or None for default.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_add_intf', None) or \\\n        _Cfunction('libvlc_add_intf', ((1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p)\n    return f(p_instance, name)\n\ndef libvlc_wait(p_instance):\n    '''Waits until an interface causes the instance to exit.\n    You should start at least one interface first, using L{libvlc_add_intf}().\n    @param p_instance: the instance @warning This function wastes one thread doing basically nothing. libvlc_set_exit_handler() should be used instead.\n    '''\n    f = _Cfunctions.get('libvlc_wait', None) or \\\n        _Cfunction('libvlc_wait', ((1,),), None,\n                    None, Instance)\n    return f(p_instance)\n\ndef libvlc_set_user_agent(p_instance, name, http):\n    '''Sets the application name. LibVLC passes this as the user agent string\n    when a protocol requires it.\n    @param p_instance: LibVLC instance.\n    @param name: human-readable application name, e.g. \"FooBar player 1.2.3\".\n    @param http: HTTP User Agent, e.g. \"FooBar/1.2.3 Python/2.6.0\".\n    @version: LibVLC 1.1.1 or later.\n    '''\n    f = _Cfunctions.get('libvlc_set_user_agent', None) or \\\n        _Cfunction('libvlc_set_user_agent', ((1,), (1,), (1,),), None,\n                    None, Instance, ctypes.c_char_p, ctypes.c_char_p)\n    return f(p_instance, name, http)\n\ndef libvlc_set_app_id(p_instance, id, version, icon):\n    '''Sets some meta-information about the application.\n    See also L{libvlc_set_user_agent}().\n    @param p_instance: LibVLC instance.\n    @param id: Java-style application identifier, e.g. \"com.acme.foobar\".\n    @param version: application version numbers, e.g. \"1.2.3\".\n    @param icon: application icon name, e.g. \"foobar\".\n    @version: LibVLC 2.1.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_set_app_id', None) or \\\n        _Cfunction('libvlc_set_app_id', ((1,), (1,), (1,), (1,),), None,\n                    None, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p)\n    return f(p_instance, id, version, icon)\n\ndef libvlc_get_version():\n    '''Retrieve libvlc version.\n    Example: \"1.1.0-git The Luggage\".\n    @return: a string containing the libvlc version.\n    '''\n    f = _Cfunctions.get('libvlc_get_version', None) or \\\n        _Cfunction('libvlc_get_version', (), None,\n                    ctypes.c_char_p)\n    return f()\n\ndef libvlc_get_compiler():\n    '''Retrieve libvlc compiler version.\n    Example: \"gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)\".\n    @return: a string containing the libvlc compiler version.\n    '''\n    f = _Cfunctions.get('libvlc_get_compiler', None) or \\\n        _Cfunction('libvlc_get_compiler', (), None,\n                    ctypes.c_char_p)\n    return f()\n\ndef libvlc_get_changeset():\n    '''Retrieve libvlc changeset.\n    Example: \"aa9bce0bc4\".\n    @return: a string containing the libvlc changeset.\n    '''\n    f = _Cfunctions.get('libvlc_get_changeset', None) or \\\n        _Cfunction('libvlc_get_changeset', (), None,\n                    ctypes.c_char_p)\n    return f()\n\ndef libvlc_free(ptr):\n    '''Frees an heap allocation returned by a LibVLC function.\n    If you know you're using the same underlying C run-time as the LibVLC\n    implementation, then you can call ANSI C free() directly instead.\n    @param ptr: the pointer.\n    '''\n    f = _Cfunctions.get('libvlc_free', None) or \\\n        _Cfunction('libvlc_free', ((1,),), None,\n                    None, ctypes.c_void_p)\n    return f(ptr)\n\ndef libvlc_event_attach(p_event_manager, i_event_type, f_callback, user_data):\n    '''Register for an event notification.\n    @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.\n    @param i_event_type: the desired event to which we want to listen.\n    @param f_callback: the function to call when i_event_type occurs.\n    @param user_data: user provided data to carry with the event.\n    @return: 0 on success, ENOMEM on error.\n    '''\n    f = _Cfunctions.get('libvlc_event_attach', None) or \\\n        _Cfunction('libvlc_event_attach', ((1,), (1,), (1,), (1,),), None,\n                    ctypes.c_int, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p)\n    return f(p_event_manager, i_event_type, f_callback, user_data)\n\ndef libvlc_event_detach(p_event_manager, i_event_type, f_callback, p_user_data):\n    '''Unregister an event notification.\n    @param p_event_manager: the event manager.\n    @param i_event_type: the desired event to which we want to unregister.\n    @param f_callback: the function to call when i_event_type occurs.\n    @param p_user_data: user provided data to carry with the event.\n    '''\n    f = _Cfunctions.get('libvlc_event_detach', None) or \\\n        _Cfunction('libvlc_event_detach', ((1,), (1,), (1,), (1,),), None,\n                    None, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p)\n    return f(p_event_manager, i_event_type, f_callback, p_user_data)\n\ndef libvlc_event_type_name(event_type):\n    '''Get an event's type name.\n    @param event_type: the desired event.\n    '''\n    f = _Cfunctions.get('libvlc_event_type_name', None) or \\\n        _Cfunction('libvlc_event_type_name', ((1,),), None,\n                    ctypes.c_char_p, ctypes.c_uint)\n    return f(event_type)\n\ndef libvlc_log_get_context(ctx):\n    '''Gets debugging information about a log message: the name of the VLC module\n    emitting the message and the message location within the source code.\n    The returned module name and file name will be None if unknown.\n    The returned line number will similarly be zero if unknown.\n    @param ctx: message context (as passed to the @ref libvlc_log_cb callback).\n    @return: module module name storage (or None), file source code file name storage (or None), line source code file line number storage (or None).\n    @version: LibVLC 2.1.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_log_get_context', None) or \\\n        _Cfunction('libvlc_log_get_context', ((1,), (2,), (2,), (2,),), None,\n                    None, Log_ptr, ListPOINTER(ctypes.c_char_p), ListPOINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_uint))\n    return f(ctx)\n\ndef libvlc_log_get_object(ctx, id):\n    '''Gets VLC object information about a log message: the type name of the VLC\n    object emitting the message, the object header if any and a temporaly-unique\n    object identifier. This information is mainly meant for B{manual}\n    troubleshooting.\n    The returned type name may be \"generic\" if unknown, but it cannot be None.\n    The returned header will be None if unset; in current versions, the header\n    is used to distinguish for VLM inputs.\n    The returned object ID will be zero if the message is not associated with\n    any VLC object.\n    @param ctx: message context (as passed to the @ref libvlc_log_cb callback).\n    @return: name object name storage (or None), header object header (or None), line source code file line number storage (or None).\n    @version: LibVLC 2.1.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_log_get_object', None) or \\\n        _Cfunction('libvlc_log_get_object', ((1,), (2,), (2,), (1,),), None,\n                    None, Log_ptr, ListPOINTER(ctypes.c_char_p), ListPOINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_uint))\n    return f(ctx, id)\n\ndef libvlc_log_unset(p_instance):\n    '''Unsets the logging callback for a LibVLC instance. This is rarely needed:\n    the callback is implicitly unset when the instance is destroyed.\n    This function will wait for any pending callbacks invocation to complete\n    (causing a deadlock if called from within the callback).\n    @param p_instance: libvlc instance.\n    @version: LibVLC 2.1.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_log_unset', None) or \\\n        _Cfunction('libvlc_log_unset', ((1,),), None,\n                    None, Instance)\n    return f(p_instance)\n\ndef libvlc_log_set(cb, data, p_instance):\n    '''Sets the logging callback for a LibVLC instance.\n    This function is thread-safe: it will wait for any pending callbacks\n    invocation to complete.\n    @param cb: callback function pointer.\n    @param data: opaque data pointer for the callback function @note Some log messages (especially debug) are emitted by LibVLC while is being initialized. These messages cannot be captured with this interface. @warning A deadlock may occur if this function is called from the callback.\n    @param p_instance: libvlc instance.\n    @version: LibVLC 2.1.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_log_set', None) or \\\n        _Cfunction('libvlc_log_set', ((1,), (1,), (1,),), None,\n                    None, Instance, LogCb, ctypes.c_void_p)\n    return f(cb, data, p_instance)\n\ndef libvlc_log_set_file(p_instance, stream):\n    '''Sets up logging to a file.\n    @param p_instance: libvlc instance.\n    @param stream: FILE pointer opened for writing (the FILE pointer must remain valid until L{libvlc_log_unset}()).\n    @version: LibVLC 2.1.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_log_set_file', None) or \\\n        _Cfunction('libvlc_log_set_file', ((1,), (1,),), None,\n                    None, Instance, FILE_ptr)\n    return f(p_instance, stream)\n\ndef libvlc_get_log_verbosity(p_instance):\n    '''Always returns minus one.\n    This function is only provided for backward compatibility.\n    @param p_instance: ignored.\n    @return: always -1.\n    '''\n    f = _Cfunctions.get('libvlc_get_log_verbosity', None) or \\\n        _Cfunction('libvlc_get_log_verbosity', ((1,),), None,\n                    ctypes.c_uint, Instance)\n    return f(p_instance)\n\ndef libvlc_set_log_verbosity(p_instance, level):\n    '''This function does nothing.\n    It is only provided for backward compatibility.\n    @param p_instance: ignored.\n    @param level: ignored.\n    '''\n    f = _Cfunctions.get('libvlc_set_log_verbosity', None) or \\\n        _Cfunction('libvlc_set_log_verbosity', ((1,), (1,),), None,\n                    None, Instance, ctypes.c_uint)\n    return f(p_instance, level)\n\ndef libvlc_log_open(p_instance):\n    '''This function does nothing useful.\n    It is only provided for backward compatibility.\n    @param p_instance: libvlc instance.\n    @return: an unique pointer or None on error.\n    '''\n    f = _Cfunctions.get('libvlc_log_open', None) or \\\n        _Cfunction('libvlc_log_open', ((1,),), None,\n                    Log_ptr, Instance)\n    return f(p_instance)\n\ndef libvlc_log_close(p_log):\n    '''Frees memory allocated by L{libvlc_log_open}().\n    @param p_log: libvlc log instance or None.\n    '''\n    f = _Cfunctions.get('libvlc_log_close', None) or \\\n        _Cfunction('libvlc_log_close', ((1,),), None,\n                    None, Log_ptr)\n    return f(p_log)\n\ndef libvlc_log_count(p_log):\n    '''Always returns zero.\n    This function is only provided for backward compatibility.\n    @param p_log: ignored.\n    @return: always zero.\n    '''\n    f = _Cfunctions.get('libvlc_log_count', None) or \\\n        _Cfunction('libvlc_log_count', ((1,),), None,\n                    ctypes.c_uint, Log_ptr)\n    return f(p_log)\n\ndef libvlc_log_clear(p_log):\n    '''This function does nothing.\n    It is only provided for backward compatibility.\n    @param p_log: ignored.\n    '''\n    f = _Cfunctions.get('libvlc_log_clear', None) or \\\n        _Cfunction('libvlc_log_clear', ((1,),), None,\n                    None, Log_ptr)\n    return f(p_log)\n\ndef libvlc_log_get_iterator(p_log):\n    '''This function does nothing useful.\n    It is only provided for backward compatibility.\n    @param p_log: ignored.\n    @return: an unique pointer or None on error or if the parameter was None.\n    '''\n    f = _Cfunctions.get('libvlc_log_get_iterator', None) or \\\n        _Cfunction('libvlc_log_get_iterator', ((1,),), class_result(LogIterator),\n                    ctypes.c_void_p, Log_ptr)\n    return f(p_log)\n\ndef libvlc_log_iterator_free(p_iter):\n    '''Frees memory allocated by L{libvlc_log_get_iterator}().\n    @param p_iter: libvlc log iterator or None.\n    '''\n    f = _Cfunctions.get('libvlc_log_iterator_free', None) or \\\n        _Cfunction('libvlc_log_iterator_free', ((1,),), None,\n                    None, LogIterator)\n    return f(p_iter)\n\ndef libvlc_log_iterator_has_next(p_iter):\n    '''Always returns zero.\n    This function is only provided for backward compatibility.\n    @param p_iter: ignored.\n    @return: always zero.\n    '''\n    f = _Cfunctions.get('libvlc_log_iterator_has_next', None) or \\\n        _Cfunction('libvlc_log_iterator_has_next', ((1,),), None,\n                    ctypes.c_int, LogIterator)\n    return f(p_iter)\n\ndef libvlc_log_iterator_next(p_iter, p_buf):\n    '''Always returns None.\n    This function is only provided for backward compatibility.\n    @param p_iter: libvlc log iterator or None.\n    @param p_buf: ignored.\n    @return: always None.\n    '''\n    f = _Cfunctions.get('libvlc_log_iterator_next', None) or \\\n        _Cfunction('libvlc_log_iterator_next', ((1,), (1,),), None,\n                    ctypes.POINTER(LogMessage), LogIterator, ctypes.POINTER(LogMessage))\n    return f(p_iter, p_buf)\n\ndef libvlc_module_description_list_release(p_list):\n    '''Release a list of module descriptions.\n    @param p_list: the list to be released.\n    '''\n    f = _Cfunctions.get('libvlc_module_description_list_release', None) or \\\n        _Cfunction('libvlc_module_description_list_release', ((1,),), None,\n                    None, ctypes.POINTER(ModuleDescription))\n    return f(p_list)\n\ndef libvlc_audio_filter_list_get(p_instance):\n    '''Returns a list of audio filters that are available.\n    @param p_instance: libvlc instance.\n    @return: a list of module descriptions. It should be freed with L{libvlc_module_description_list_release}(). In case of an error, None is returned. See L{ModuleDescription} See L{libvlc_module_description_list_release}.\n    '''\n    f = _Cfunctions.get('libvlc_audio_filter_list_get', None) or \\\n        _Cfunction('libvlc_audio_filter_list_get', ((1,),), None,\n                    ctypes.POINTER(ModuleDescription), Instance)\n    return f(p_instance)\n\ndef libvlc_video_filter_list_get(p_instance):\n    '''Returns a list of video filters that are available.\n    @param p_instance: libvlc instance.\n    @return: a list of module descriptions. It should be freed with L{libvlc_module_description_list_release}(). In case of an error, None is returned. See L{ModuleDescription} See L{libvlc_module_description_list_release}.\n    '''\n    f = _Cfunctions.get('libvlc_video_filter_list_get', None) or \\\n        _Cfunction('libvlc_video_filter_list_get', ((1,),), None,\n                    ctypes.POINTER(ModuleDescription), Instance)\n    return f(p_instance)\n\ndef libvlc_clock():\n    '''Return the current time as defined by LibVLC. The unit is the microsecond.\n    Time increases monotonically (regardless of time zone changes and RTC\n    adjustements).\n    The origin is arbitrary but consistent across the whole system\n    (e.g. the system uptim, the time since the system was booted).\n    @note: On systems that support it, the POSIX monotonic clock is used.\n    '''\n    f = _Cfunctions.get('libvlc_clock', None) or \\\n        _Cfunction('libvlc_clock', (), None,\n                    ctypes.c_int64)\n    return f()\n\ndef libvlc_media_discoverer_new_from_name(p_inst, psz_name):\n    '''Discover media service by name.\n    @param p_inst: libvlc instance.\n    @param psz_name: service name.\n    @return: media discover object or None in case of error.\n    '''\n    f = _Cfunctions.get('libvlc_media_discoverer_new_from_name', None) or \\\n        _Cfunction('libvlc_media_discoverer_new_from_name', ((1,), (1,),), class_result(MediaDiscoverer),\n                    ctypes.c_void_p, Instance, ctypes.c_char_p)\n    return f(p_inst, psz_name)\n\ndef libvlc_media_discoverer_release(p_mdis):\n    '''Release media discover object. If the reference count reaches 0, then\n    the object will be released.\n    @param p_mdis: media service discover object.\n    '''\n    f = _Cfunctions.get('libvlc_media_discoverer_release', None) or \\\n        _Cfunction('libvlc_media_discoverer_release', ((1,),), None,\n                    None, MediaDiscoverer)\n    return f(p_mdis)\n\ndef libvlc_media_discoverer_localized_name(p_mdis):\n    '''Get media service discover object its localized name.\n    @param p_mdis: media discover object.\n    @return: localized name.\n    '''\n    f = _Cfunctions.get('libvlc_media_discoverer_localized_name', None) or \\\n        _Cfunction('libvlc_media_discoverer_localized_name', ((1,),), string_result,\n                    ctypes.c_void_p, MediaDiscoverer)\n    return f(p_mdis)\n\ndef libvlc_media_discoverer_media_list(p_mdis):\n    '''Get media service discover media list.\n    @param p_mdis: media service discover object.\n    @return: list of media items.\n    '''\n    f = _Cfunctions.get('libvlc_media_discoverer_media_list', None) or \\\n        _Cfunction('libvlc_media_discoverer_media_list', ((1,),), class_result(MediaList),\n                    ctypes.c_void_p, MediaDiscoverer)\n    return f(p_mdis)\n\ndef libvlc_media_discoverer_event_manager(p_mdis):\n    '''Get event manager from media service discover object.\n    @param p_mdis: media service discover object.\n    @return: event manager object.\n    '''\n    f = _Cfunctions.get('libvlc_media_discoverer_event_manager', None) or \\\n        _Cfunction('libvlc_media_discoverer_event_manager', ((1,),), class_result(EventManager),\n                    ctypes.c_void_p, MediaDiscoverer)\n    return f(p_mdis)\n\ndef libvlc_media_discoverer_is_running(p_mdis):\n    '''Query if media service discover object is running.\n    @param p_mdis: media service discover object.\n    @return: true if running, false if not \\libvlc_return_bool.\n    '''\n    f = _Cfunctions.get('libvlc_media_discoverer_is_running', None) or \\\n        _Cfunction('libvlc_media_discoverer_is_running', ((1,),), None,\n                    ctypes.c_int, MediaDiscoverer)\n    return f(p_mdis)\n\ndef libvlc_media_library_new(p_instance):\n    '''Create an new Media Library object.\n    @param p_instance: the libvlc instance.\n    @return: a new object or None on error.\n    '''\n    f = _Cfunctions.get('libvlc_media_library_new', None) or \\\n        _Cfunction('libvlc_media_library_new', ((1,),), class_result(MediaLibrary),\n                    ctypes.c_void_p, Instance)\n    return f(p_instance)\n\ndef libvlc_media_library_release(p_mlib):\n    '''Release media library object. This functions decrements the\n    reference count of the media library object. If it reaches 0,\n    then the object will be released.\n    @param p_mlib: media library object.\n    '''\n    f = _Cfunctions.get('libvlc_media_library_release', None) or \\\n        _Cfunction('libvlc_media_library_release', ((1,),), None,\n                    None, MediaLibrary)\n    return f(p_mlib)\n\ndef libvlc_media_library_retain(p_mlib):\n    '''Retain a reference to a media library object. This function will\n    increment the reference counting for this object. Use\n    L{libvlc_media_library_release}() to decrement the reference count.\n    @param p_mlib: media library object.\n    '''\n    f = _Cfunctions.get('libvlc_media_library_retain', None) or \\\n        _Cfunction('libvlc_media_library_retain', ((1,),), None,\n                    None, MediaLibrary)\n    return f(p_mlib)\n\ndef libvlc_media_library_load(p_mlib):\n    '''Load media library.\n    @param p_mlib: media library object.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_media_library_load', None) or \\\n        _Cfunction('libvlc_media_library_load', ((1,),), None,\n                    ctypes.c_int, MediaLibrary)\n    return f(p_mlib)\n\ndef libvlc_media_library_media_list(p_mlib):\n    '''Get media library subitems.\n    @param p_mlib: media library object.\n    @return: media list subitems.\n    '''\n    f = _Cfunctions.get('libvlc_media_library_media_list', None) or \\\n        _Cfunction('libvlc_media_library_media_list', ((1,),), class_result(MediaList),\n                    ctypes.c_void_p, MediaLibrary)\n    return f(p_mlib)\n\ndef libvlc_vlm_release(p_instance):\n    '''Release the vlm instance related to the given L{Instance}.\n    @param p_instance: the instance.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_release', None) or \\\n        _Cfunction('libvlc_vlm_release', ((1,),), None,\n                    None, Instance)\n    return f(p_instance)\n\ndef libvlc_vlm_add_broadcast(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop):\n    '''Add a broadcast, with one input.\n    @param p_instance: the instance.\n    @param psz_name: the name of the new broadcast.\n    @param psz_input: the input MRL.\n    @param psz_output: the output MRL (the parameter to the \"sout\" variable).\n    @param i_options: number of additional options.\n    @param ppsz_options: additional options.\n    @param b_enabled: boolean for enabling the new broadcast.\n    @param b_loop: Should this broadcast be played in loop ?\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_add_broadcast', None) or \\\n        _Cfunction('libvlc_vlm_add_broadcast', ((1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),), None,\n                    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)\n    return f(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop)\n\ndef libvlc_vlm_add_vod(p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux):\n    '''Add a vod, with one input.\n    @param p_instance: the instance.\n    @param psz_name: the name of the new vod media.\n    @param psz_input: the input MRL.\n    @param i_options: number of additional options.\n    @param ppsz_options: additional options.\n    @param b_enabled: boolean for enabling the new vod.\n    @param psz_mux: the muxer of the vod media.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_add_vod', None) or \\\n        _Cfunction('libvlc_vlm_add_vod', ((1,), (1,), (1,), (1,), (1,), (1,), (1,),), None,\n                    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)\n    return f(p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux)\n\ndef libvlc_vlm_del_media(p_instance, psz_name):\n    '''Delete a media (VOD or broadcast).\n    @param p_instance: the instance.\n    @param psz_name: the media to delete.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_del_media', None) or \\\n        _Cfunction('libvlc_vlm_del_media', ((1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p)\n    return f(p_instance, psz_name)\n\ndef libvlc_vlm_set_enabled(p_instance, psz_name, b_enabled):\n    '''Enable or disable a media (VOD or broadcast).\n    @param p_instance: the instance.\n    @param psz_name: the media to work on.\n    @param b_enabled: the new status.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_set_enabled', None) or \\\n        _Cfunction('libvlc_vlm_set_enabled', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int)\n    return f(p_instance, psz_name, b_enabled)\n\ndef libvlc_vlm_set_output(p_instance, psz_name, psz_output):\n    '''Set the output for a media.\n    @param p_instance: the instance.\n    @param psz_name: the media to work on.\n    @param psz_output: the output MRL (the parameter to the \"sout\" variable).\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_set_output', None) or \\\n        _Cfunction('libvlc_vlm_set_output', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p)\n    return f(p_instance, psz_name, psz_output)\n\ndef libvlc_vlm_set_input(p_instance, psz_name, psz_input):\n    '''Set a media's input MRL. This will delete all existing inputs and\n    add the specified one.\n    @param p_instance: the instance.\n    @param psz_name: the media to work on.\n    @param psz_input: the input MRL.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_set_input', None) or \\\n        _Cfunction('libvlc_vlm_set_input', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p)\n    return f(p_instance, psz_name, psz_input)\n\ndef libvlc_vlm_add_input(p_instance, psz_name, psz_input):\n    '''Add a media's input MRL. This will add the specified one.\n    @param p_instance: the instance.\n    @param psz_name: the media to work on.\n    @param psz_input: the input MRL.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_add_input', None) or \\\n        _Cfunction('libvlc_vlm_add_input', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p)\n    return f(p_instance, psz_name, psz_input)\n\ndef libvlc_vlm_set_loop(p_instance, psz_name, b_loop):\n    '''Set a media's loop status.\n    @param p_instance: the instance.\n    @param psz_name: the media to work on.\n    @param b_loop: the new status.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_set_loop', None) or \\\n        _Cfunction('libvlc_vlm_set_loop', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int)\n    return f(p_instance, psz_name, b_loop)\n\ndef libvlc_vlm_set_mux(p_instance, psz_name, psz_mux):\n    '''Set a media's vod muxer.\n    @param p_instance: the instance.\n    @param psz_name: the media to work on.\n    @param psz_mux: the new muxer.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_set_mux', None) or \\\n        _Cfunction('libvlc_vlm_set_mux', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p)\n    return f(p_instance, psz_name, psz_mux)\n\ndef libvlc_vlm_change_media(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop):\n    '''Edit the parameters of a media. This will delete all existing inputs and\n    add the specified one.\n    @param p_instance: the instance.\n    @param psz_name: the name of the new broadcast.\n    @param psz_input: the input MRL.\n    @param psz_output: the output MRL (the parameter to the \"sout\" variable).\n    @param i_options: number of additional options.\n    @param ppsz_options: additional options.\n    @param b_enabled: boolean for enabling the new broadcast.\n    @param b_loop: Should this broadcast be played in loop ?\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_change_media', None) or \\\n        _Cfunction('libvlc_vlm_change_media', ((1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),), None,\n                    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)\n    return f(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop)\n\ndef libvlc_vlm_play_media(p_instance, psz_name):\n    '''Play the named broadcast.\n    @param p_instance: the instance.\n    @param psz_name: the name of the broadcast.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_play_media', None) or \\\n        _Cfunction('libvlc_vlm_play_media', ((1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p)\n    return f(p_instance, psz_name)\n\ndef libvlc_vlm_stop_media(p_instance, psz_name):\n    '''Stop the named broadcast.\n    @param p_instance: the instance.\n    @param psz_name: the name of the broadcast.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_stop_media', None) or \\\n        _Cfunction('libvlc_vlm_stop_media', ((1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p)\n    return f(p_instance, psz_name)\n\ndef libvlc_vlm_pause_media(p_instance, psz_name):\n    '''Pause the named broadcast.\n    @param p_instance: the instance.\n    @param psz_name: the name of the broadcast.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_pause_media', None) or \\\n        _Cfunction('libvlc_vlm_pause_media', ((1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p)\n    return f(p_instance, psz_name)\n\ndef libvlc_vlm_seek_media(p_instance, psz_name, f_percentage):\n    '''Seek in the named broadcast.\n    @param p_instance: the instance.\n    @param psz_name: the name of the broadcast.\n    @param f_percentage: the percentage to seek to.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_seek_media', None) or \\\n        _Cfunction('libvlc_vlm_seek_media', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_float)\n    return f(p_instance, psz_name, f_percentage)\n\ndef libvlc_vlm_show_media(p_instance, psz_name):\n    '''Return information about the named media as a JSON\n    string representation.\n    This function is mainly intended for debugging use,\n    if you want programmatic access to the state of\n    a vlm_media_instance_t, please use the corresponding\n    libvlc_vlm_get_media_instance_xxx -functions.\n    Currently there are no such functions available for\n    vlm_media_t though.\n    @param p_instance: the instance.\n    @param psz_name: the name of the media, if the name is an empty string, all media is described.\n    @return: string with information about named media, or None on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_show_media', None) or \\\n        _Cfunction('libvlc_vlm_show_media', ((1,), (1,),), string_result,\n                    ctypes.c_void_p, Instance, ctypes.c_char_p)\n    return f(p_instance, psz_name)\n\ndef libvlc_vlm_get_media_instance_position(p_instance, psz_name, i_instance):\n    '''Get vlm_media instance position by name or instance id.\n    @param p_instance: a libvlc instance.\n    @param psz_name: name of vlm media instance.\n    @param i_instance: instance id.\n    @return: position as float or -1. on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_get_media_instance_position', None) or \\\n        _Cfunction('libvlc_vlm_get_media_instance_position', ((1,), (1,), (1,),), None,\n                    ctypes.c_float, Instance, ctypes.c_char_p, ctypes.c_int)\n    return f(p_instance, psz_name, i_instance)\n\ndef libvlc_vlm_get_media_instance_time(p_instance, psz_name, i_instance):\n    '''Get vlm_media instance time by name or instance id.\n    @param p_instance: a libvlc instance.\n    @param psz_name: name of vlm media instance.\n    @param i_instance: instance id.\n    @return: time as integer or -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_get_media_instance_time', None) or \\\n        _Cfunction('libvlc_vlm_get_media_instance_time', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int)\n    return f(p_instance, psz_name, i_instance)\n\ndef libvlc_vlm_get_media_instance_length(p_instance, psz_name, i_instance):\n    '''Get vlm_media instance length by name or instance id.\n    @param p_instance: a libvlc instance.\n    @param psz_name: name of vlm media instance.\n    @param i_instance: instance id.\n    @return: length of media item or -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_get_media_instance_length', None) or \\\n        _Cfunction('libvlc_vlm_get_media_instance_length', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int)\n    return f(p_instance, psz_name, i_instance)\n\ndef libvlc_vlm_get_media_instance_rate(p_instance, psz_name, i_instance):\n    '''Get vlm_media instance playback rate by name or instance id.\n    @param p_instance: a libvlc instance.\n    @param psz_name: name of vlm media instance.\n    @param i_instance: instance id.\n    @return: playback rate or -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_get_media_instance_rate', None) or \\\n        _Cfunction('libvlc_vlm_get_media_instance_rate', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int)\n    return f(p_instance, psz_name, i_instance)\n\ndef libvlc_vlm_get_media_instance_title(p_instance, psz_name, i_instance):\n    '''Get vlm_media instance title number by name or instance id.\n    @param p_instance: a libvlc instance.\n    @param psz_name: name of vlm media instance.\n    @param i_instance: instance id.\n    @return: title as number or -1 on error.\n    @bug: will always return 0.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_get_media_instance_title', None) or \\\n        _Cfunction('libvlc_vlm_get_media_instance_title', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int)\n    return f(p_instance, psz_name, i_instance)\n\ndef libvlc_vlm_get_media_instance_chapter(p_instance, psz_name, i_instance):\n    '''Get vlm_media instance chapter number by name or instance id.\n    @param p_instance: a libvlc instance.\n    @param psz_name: name of vlm media instance.\n    @param i_instance: instance id.\n    @return: chapter as number or -1 on error.\n    @bug: will always return 0.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_get_media_instance_chapter', None) or \\\n        _Cfunction('libvlc_vlm_get_media_instance_chapter', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int)\n    return f(p_instance, psz_name, i_instance)\n\ndef libvlc_vlm_get_media_instance_seekable(p_instance, psz_name, i_instance):\n    '''Is libvlc instance seekable ?\n    @param p_instance: a libvlc instance.\n    @param psz_name: name of vlm media instance.\n    @param i_instance: instance id.\n    @return: 1 if seekable, 0 if not, -1 if media does not exist.\n    @bug: will always return 0.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_get_media_instance_seekable', None) or \\\n        _Cfunction('libvlc_vlm_get_media_instance_seekable', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int)\n    return f(p_instance, psz_name, i_instance)\n\ndef libvlc_vlm_get_event_manager(p_instance):\n    '''Get libvlc_event_manager from a vlm media.\n    The p_event_manager is immutable, so you don't have to hold the lock.\n    @param p_instance: a libvlc instance.\n    @return: libvlc_event_manager.\n    '''\n    f = _Cfunctions.get('libvlc_vlm_get_event_manager', None) or \\\n        _Cfunction('libvlc_vlm_get_event_manager', ((1,),), class_result(EventManager),\n                    ctypes.c_void_p, Instance)\n    return f(p_instance)\n\ndef libvlc_media_new_location(p_instance, psz_mrl):\n    '''Create a media with a certain given media resource location,\n    for instance a valid URL.\n    @note: To refer to a local file with this function,\n    the file://... URI syntax B{must} be used (see IETF RFC3986).\n    We recommend using L{libvlc_media_new_path}() instead when dealing with\n    local files.\n    See L{libvlc_media_release}.\n    @param p_instance: the instance.\n    @param psz_mrl: the media location.\n    @return: the newly created media or None on error.\n    '''\n    f = _Cfunctions.get('libvlc_media_new_location', None) or \\\n        _Cfunction('libvlc_media_new_location', ((1,), (1,),), class_result(Media),\n                    ctypes.c_void_p, Instance, ctypes.c_char_p)\n    return f(p_instance, psz_mrl)\n\ndef libvlc_media_new_path(p_instance, path):\n    '''Create a media for a certain file path.\n    See L{libvlc_media_release}.\n    @param p_instance: the instance.\n    @param path: local filesystem path.\n    @return: the newly created media or None on error.\n    '''\n    f = _Cfunctions.get('libvlc_media_new_path', None) or \\\n        _Cfunction('libvlc_media_new_path', ((1,), (1,),), class_result(Media),\n                    ctypes.c_void_p, Instance, ctypes.c_char_p)\n    return f(p_instance, path)\n\ndef libvlc_media_new_fd(p_instance, fd):\n    '''Create a media for an already open file descriptor.\n    The file descriptor shall be open for reading (or reading and writing).\n    Regular file descriptors, pipe read descriptors and character device\n    descriptors (including TTYs) are supported on all platforms.\n    Block device descriptors are supported where available.\n    Directory descriptors are supported on systems that provide fdopendir().\n    Sockets are supported on all platforms where they are file descriptors,\n    i.e. all except Windows.\n    @note: This library will B{not} automatically close the file descriptor\n    under any circumstance. Nevertheless, a file descriptor can usually only be\n    rendered once in a media player. To render it a second time, the file\n    descriptor should probably be rewound to the beginning with lseek().\n    See L{libvlc_media_release}.\n    @param p_instance: the instance.\n    @param fd: open file descriptor.\n    @return: the newly created media or None on error.\n    @version: LibVLC 1.1.5 and later.\n    '''\n    f = _Cfunctions.get('libvlc_media_new_fd', None) or \\\n        _Cfunction('libvlc_media_new_fd', ((1,), (1,),), class_result(Media),\n                    ctypes.c_void_p, Instance, ctypes.c_int)\n    return f(p_instance, fd)\n\ndef libvlc_media_new_as_node(p_instance, psz_name):\n    '''Create a media as an empty node with a given name.\n    See L{libvlc_media_release}.\n    @param p_instance: the instance.\n    @param psz_name: the name of the node.\n    @return: the new empty media or None on error.\n    '''\n    f = _Cfunctions.get('libvlc_media_new_as_node', None) or \\\n        _Cfunction('libvlc_media_new_as_node', ((1,), (1,),), class_result(Media),\n                    ctypes.c_void_p, Instance, ctypes.c_char_p)\n    return f(p_instance, psz_name)\n\ndef libvlc_media_add_option(p_md, psz_options):\n    '''Add an option to the media.\n    This option will be used to determine how the media_player will\n    read the media. This allows to use VLC's advanced\n    reading/streaming options on a per-media basis.\n    @note: The options are listed in 'vlc --long-help' from the command line,\n    e.g. \"-sout-all\". Keep in mind that available options and their semantics\n    vary across LibVLC versions and builds.\n    @warning: Not all options affects L{Media} objects:\n    Specifically, due to architectural issues most audio and video options,\n    such as text renderer options, have no effects on an individual media.\n    These options must be set through L{libvlc_new}() instead.\n    @param p_md: the media descriptor.\n    @param psz_options: the options (as a string).\n    '''\n    f = _Cfunctions.get('libvlc_media_add_option', None) or \\\n        _Cfunction('libvlc_media_add_option', ((1,), (1,),), None,\n                    None, Media, ctypes.c_char_p)\n    return f(p_md, psz_options)\n\ndef libvlc_media_add_option_flag(p_md, psz_options, i_flags):\n    '''Add an option to the media with configurable flags.\n    This option will be used to determine how the media_player will\n    read the media. This allows to use VLC's advanced\n    reading/streaming options on a per-media basis.\n    The options are detailed in vlc --long-help, for instance\n    \"--sout-all\". Note that all options are not usable on medias:\n    specifically, due to architectural issues, video-related options\n    such as text renderer options cannot be set on a single media. They\n    must be set on the whole libvlc instance instead.\n    @param p_md: the media descriptor.\n    @param psz_options: the options (as a string).\n    @param i_flags: the flags for this option.\n    '''\n    f = _Cfunctions.get('libvlc_media_add_option_flag', None) or \\\n        _Cfunction('libvlc_media_add_option_flag', ((1,), (1,), (1,),), None,\n                    None, Media, ctypes.c_char_p, ctypes.c_uint)\n    return f(p_md, psz_options, i_flags)\n\ndef libvlc_media_retain(p_md):\n    '''Retain a reference to a media descriptor object (libvlc_media_t). Use\n    L{libvlc_media_release}() to decrement the reference count of a\n    media descriptor object.\n    @param p_md: the media descriptor.\n    '''\n    f = _Cfunctions.get('libvlc_media_retain', None) or \\\n        _Cfunction('libvlc_media_retain', ((1,),), None,\n                    None, Media)\n    return f(p_md)\n\ndef libvlc_media_release(p_md):\n    '''Decrement the reference count of a media descriptor object. If the\n    reference count is 0, then L{libvlc_media_release}() will release the\n    media descriptor object. It will send out an libvlc_MediaFreed event\n    to all listeners. If the media descriptor object has been released it\n    should not be used again.\n    @param p_md: the media descriptor.\n    '''\n    f = _Cfunctions.get('libvlc_media_release', None) or \\\n        _Cfunction('libvlc_media_release', ((1,),), None,\n                    None, Media)\n    return f(p_md)\n\ndef libvlc_media_get_mrl(p_md):\n    '''Get the media resource locator (mrl) from a media descriptor object.\n    @param p_md: a media descriptor object.\n    @return: string with mrl of media descriptor object.\n    '''\n    f = _Cfunctions.get('libvlc_media_get_mrl', None) or \\\n        _Cfunction('libvlc_media_get_mrl', ((1,),), string_result,\n                    ctypes.c_void_p, Media)\n    return f(p_md)\n\ndef libvlc_media_duplicate(p_md):\n    '''Duplicate a media descriptor object.\n    @param p_md: a media descriptor object.\n    '''\n    f = _Cfunctions.get('libvlc_media_duplicate', None) or \\\n        _Cfunction('libvlc_media_duplicate', ((1,),), class_result(Media),\n                    ctypes.c_void_p, Media)\n    return f(p_md)\n\ndef libvlc_media_get_meta(p_md, e_meta):\n    '''Read the meta of the media.\n    If the media has not yet been parsed this will return None.\n    This methods automatically calls L{libvlc_media_parse_async}(), so after calling\n    it you may receive a libvlc_MediaMetaChanged event. If you prefer a synchronous\n    version ensure that you call L{libvlc_media_parse}() before get_meta().\n    See L{libvlc_media_parse}\n    See L{libvlc_media_parse_async}\n    See libvlc_MediaMetaChanged.\n    @param p_md: the media descriptor.\n    @param e_meta: the meta to read.\n    @return: the media's meta.\n    '''\n    f = _Cfunctions.get('libvlc_media_get_meta', None) or \\\n        _Cfunction('libvlc_media_get_meta', ((1,), (1,),), string_result,\n                    ctypes.c_void_p, Media, Meta)\n    return f(p_md, e_meta)\n\ndef libvlc_media_set_meta(p_md, e_meta, psz_value):\n    '''Set the meta of the media (this function will not save the meta, call\n    L{libvlc_media_save_meta} in order to save the meta).\n    @param p_md: the media descriptor.\n    @param e_meta: the meta to write.\n    @param psz_value: the media's meta.\n    '''\n    f = _Cfunctions.get('libvlc_media_set_meta', None) or \\\n        _Cfunction('libvlc_media_set_meta', ((1,), (1,), (1,),), None,\n                    None, Media, Meta, ctypes.c_char_p)\n    return f(p_md, e_meta, psz_value)\n\ndef libvlc_media_save_meta(p_md):\n    '''Save the meta previously set.\n    @param p_md: the media desriptor.\n    @return: true if the write operation was successful.\n    '''\n    f = _Cfunctions.get('libvlc_media_save_meta', None) or \\\n        _Cfunction('libvlc_media_save_meta', ((1,),), None,\n                    ctypes.c_int, Media)\n    return f(p_md)\n\ndef libvlc_media_get_state(p_md):\n    '''Get current state of media descriptor object. Possible media states\n    are defined in libvlc_structures.c ( libvlc_NothingSpecial=0,\n    libvlc_Opening, libvlc_Buffering, libvlc_Playing, libvlc_Paused,\n    libvlc_Stopped, libvlc_Ended,\n    libvlc_Error).\n    See libvlc_state_t.\n    @param p_md: a media descriptor object.\n    @return: state of media descriptor object.\n    '''\n    f = _Cfunctions.get('libvlc_media_get_state', None) or \\\n        _Cfunction('libvlc_media_get_state', ((1,),), None,\n                    State, Media)\n    return f(p_md)\n\ndef libvlc_media_get_stats(p_md, p_stats):\n    '''Get the current statistics about the media.\n    @param p_md:: media descriptor object.\n    @param p_stats:: structure that contain the statistics about the media (this structure must be allocated by the caller).\n    @return: true if the statistics are available, false otherwise \\libvlc_return_bool.\n    '''\n    f = _Cfunctions.get('libvlc_media_get_stats', None) or \\\n        _Cfunction('libvlc_media_get_stats', ((1,), (1,),), None,\n                    ctypes.c_int, Media, ctypes.POINTER(MediaStats))\n    return f(p_md, p_stats)\n\ndef libvlc_media_subitems(p_md):\n    '''Get subitems of media descriptor object. This will increment\n    the reference count of supplied media descriptor object. Use\n    L{libvlc_media_list_release}() to decrement the reference counting.\n    @param p_md: media descriptor object.\n    @return: list of media descriptor subitems or None.\n    '''\n    f = _Cfunctions.get('libvlc_media_subitems', None) or \\\n        _Cfunction('libvlc_media_subitems', ((1,),), class_result(MediaList),\n                    ctypes.c_void_p, Media)\n    return f(p_md)\n\ndef libvlc_media_event_manager(p_md):\n    '''Get event manager from media descriptor object.\n    NOTE: this function doesn't increment reference counting.\n    @param p_md: a media descriptor object.\n    @return: event manager object.\n    '''\n    f = _Cfunctions.get('libvlc_media_event_manager', None) or \\\n        _Cfunction('libvlc_media_event_manager', ((1,),), class_result(EventManager),\n                    ctypes.c_void_p, Media)\n    return f(p_md)\n\ndef libvlc_media_get_duration(p_md):\n    '''Get duration (in ms) of media descriptor object item.\n    @param p_md: media descriptor object.\n    @return: duration of media item or -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_media_get_duration', None) or \\\n        _Cfunction('libvlc_media_get_duration', ((1,),), None,\n                    ctypes.c_longlong, Media)\n    return f(p_md)\n\ndef libvlc_media_parse(p_md):\n    '''Parse a media.\n    This fetches (local) meta data and tracks information.\n    The method is synchronous.\n    See L{libvlc_media_parse_async}\n    See L{libvlc_media_get_meta}\n    See L{libvlc_media_get_tracks_info}.\n    @param p_md: media descriptor object.\n    '''\n    f = _Cfunctions.get('libvlc_media_parse', None) or \\\n        _Cfunction('libvlc_media_parse', ((1,),), None,\n                    None, Media)\n    return f(p_md)\n\ndef libvlc_media_parse_async(p_md):\n    '''Parse a media.\n    This fetches (local) meta data and tracks information.\n    The method is the asynchronous of L{libvlc_media_parse}().\n    To track when this is over you can listen to libvlc_MediaParsedChanged\n    event. However if the media was already parsed you will not receive this\n    event.\n    See L{libvlc_media_parse}\n    See libvlc_MediaParsedChanged\n    See L{libvlc_media_get_meta}\n    See L{libvlc_media_get_tracks_info}.\n    @param p_md: media descriptor object.\n    '''\n    f = _Cfunctions.get('libvlc_media_parse_async', None) or \\\n        _Cfunction('libvlc_media_parse_async', ((1,),), None,\n                    None, Media)\n    return f(p_md)\n\ndef libvlc_media_is_parsed(p_md):\n    '''Get Parsed status for media descriptor object.\n    See libvlc_MediaParsedChanged.\n    @param p_md: media descriptor object.\n    @return: true if media object has been parsed otherwise it returns false \\libvlc_return_bool.\n    '''\n    f = _Cfunctions.get('libvlc_media_is_parsed', None) or \\\n        _Cfunction('libvlc_media_is_parsed', ((1,),), None,\n                    ctypes.c_int, Media)\n    return f(p_md)\n\ndef libvlc_media_set_user_data(p_md, p_new_user_data):\n    '''Sets media descriptor's user_data. user_data is specialized data\n    accessed by the host application, VLC.framework uses it as a pointer to\n    an native object that references a L{Media} pointer.\n    @param p_md: media descriptor object.\n    @param p_new_user_data: pointer to user data.\n    '''\n    f = _Cfunctions.get('libvlc_media_set_user_data', None) or \\\n        _Cfunction('libvlc_media_set_user_data', ((1,), (1,),), None,\n                    None, Media, ctypes.c_void_p)\n    return f(p_md, p_new_user_data)\n\ndef libvlc_media_get_user_data(p_md):\n    '''Get media descriptor's user_data. user_data is specialized data\n    accessed by the host application, VLC.framework uses it as a pointer to\n    an native object that references a L{Media} pointer.\n    @param p_md: media descriptor object.\n    '''\n    f = _Cfunctions.get('libvlc_media_get_user_data', None) or \\\n        _Cfunction('libvlc_media_get_user_data', ((1,),), None,\n                    ctypes.c_void_p, Media)\n    return f(p_md)\n\ndef libvlc_media_get_tracks_info(p_md):\n    '''Get media descriptor's elementary streams description\n    Note, you need to call L{libvlc_media_parse}() or play the media at least once\n    before calling this function.\n    Not doing this will result in an empty array.\n    \\deprecated Use L{libvlc_media_tracks_get} instead.\n    @param p_md: media descriptor object.\n    @param tracks: address to store an allocated array of Elementary Streams descriptions (must be freed by the caller) [OUT].\n    @return: the number of Elementary Streams.\n    '''\n    f = _Cfunctions.get('libvlc_media_get_tracks_info', None) or \\\n        _Cfunction('libvlc_media_get_tracks_info', ((1,), (2,),), None,\n                    ctypes.c_int, Media, ctypes.POINTER(ctypes.c_void_p))\n    return f(p_md)\n\ndef libvlc_media_tracks_get(p_md, tracks):\n    '''Get media descriptor's elementary streams description\n    Note, you need to call L{libvlc_media_parse}() or play the media at least once\n    before calling this function.\n    Not doing this will result in an empty array.\n    @param p_md: media descriptor object.\n    @param tracks: address to store an allocated array of Elementary Streams descriptions (must be freed with L{libvlc_media_tracks_release}.\n    @return: the number of Elementary Streams (zero on error).\n    @version: LibVLC 2.1.0 and later.\n    '''\n    f = _Cfunctions.get('libvlc_media_tracks_get', None) or \\\n        _Cfunction('libvlc_media_tracks_get', ((1,), (1,),), None,\n                    ctypes.c_uint, Media, ctypes.POINTER(ctypes.POINTER(MediaTrack)))\n    return f(p_md, tracks)\n\ndef libvlc_media_tracks_release(p_tracks, i_count):\n    '''Release media descriptor's elementary streams description array.\n    @param p_tracks: tracks info array to release.\n    @param i_count: number of elements in the array.\n    @version: LibVLC 2.1.0 and later.\n    '''\n    f = _Cfunctions.get('libvlc_media_tracks_release', None) or \\\n        _Cfunction('libvlc_media_tracks_release', ((1,), (1,),), None,\n                    None, ctypes.POINTER(MediaTrack), ctypes.c_uint)\n    return f(p_tracks, i_count)\n\ndef libvlc_media_list_new(p_instance):\n    '''Create an empty media list.\n    @param p_instance: libvlc instance.\n    @return: empty media list, or None on error.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_new', None) or \\\n        _Cfunction('libvlc_media_list_new', ((1,),), class_result(MediaList),\n                    ctypes.c_void_p, Instance)\n    return f(p_instance)\n\ndef libvlc_media_list_release(p_ml):\n    '''Release media list created with L{libvlc_media_list_new}().\n    @param p_ml: a media list created with L{libvlc_media_list_new}().\n    '''\n    f = _Cfunctions.get('libvlc_media_list_release', None) or \\\n        _Cfunction('libvlc_media_list_release', ((1,),), None,\n                    None, MediaList)\n    return f(p_ml)\n\ndef libvlc_media_list_retain(p_ml):\n    '''Retain reference to a media list.\n    @param p_ml: a media list created with L{libvlc_media_list_new}().\n    '''\n    f = _Cfunctions.get('libvlc_media_list_retain', None) or \\\n        _Cfunction('libvlc_media_list_retain', ((1,),), None,\n                    None, MediaList)\n    return f(p_ml)\n\ndef libvlc_media_list_set_media(p_ml, p_md):\n    '''Associate media instance with this media list instance.\n    If another media instance was present it will be released.\n    The L{libvlc_media_list_lock} should NOT be held upon entering this function.\n    @param p_ml: a media list instance.\n    @param p_md: media instance to add.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_set_media', None) or \\\n        _Cfunction('libvlc_media_list_set_media', ((1,), (1,),), None,\n                    None, MediaList, Media)\n    return f(p_ml, p_md)\n\ndef libvlc_media_list_media(p_ml):\n    '''Get media instance from this media list instance. This action will increase\n    the refcount on the media instance.\n    The L{libvlc_media_list_lock} should NOT be held upon entering this function.\n    @param p_ml: a media list instance.\n    @return: media instance.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_media', None) or \\\n        _Cfunction('libvlc_media_list_media', ((1,),), class_result(Media),\n                    ctypes.c_void_p, MediaList)\n    return f(p_ml)\n\ndef libvlc_media_list_add_media(p_ml, p_md):\n    '''Add media instance to media list\n    The L{libvlc_media_list_lock} should be held upon entering this function.\n    @param p_ml: a media list instance.\n    @param p_md: a media instance.\n    @return: 0 on success, -1 if the media list is read-only.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_add_media', None) or \\\n        _Cfunction('libvlc_media_list_add_media', ((1,), (1,),), None,\n                    ctypes.c_int, MediaList, Media)\n    return f(p_ml, p_md)\n\ndef libvlc_media_list_insert_media(p_ml, p_md, i_pos):\n    '''Insert media instance in media list on a position\n    The L{libvlc_media_list_lock} should be held upon entering this function.\n    @param p_ml: a media list instance.\n    @param p_md: a media instance.\n    @param i_pos: position in array where to insert.\n    @return: 0 on success, -1 if the media list is read-only.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_insert_media', None) or \\\n        _Cfunction('libvlc_media_list_insert_media', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, MediaList, Media, ctypes.c_int)\n    return f(p_ml, p_md, i_pos)\n\ndef libvlc_media_list_remove_index(p_ml, i_pos):\n    '''Remove media instance from media list on a position\n    The L{libvlc_media_list_lock} should be held upon entering this function.\n    @param p_ml: a media list instance.\n    @param i_pos: position in array where to insert.\n    @return: 0 on success, -1 if the list is read-only or the item was not found.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_remove_index', None) or \\\n        _Cfunction('libvlc_media_list_remove_index', ((1,), (1,),), None,\n                    ctypes.c_int, MediaList, ctypes.c_int)\n    return f(p_ml, i_pos)\n\ndef libvlc_media_list_count(p_ml):\n    '''Get count on media list items\n    The L{libvlc_media_list_lock} should be held upon entering this function.\n    @param p_ml: a media list instance.\n    @return: number of items in media list.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_count', None) or \\\n        _Cfunction('libvlc_media_list_count', ((1,),), None,\n                    ctypes.c_int, MediaList)\n    return f(p_ml)\n\ndef libvlc_media_list_item_at_index(p_ml, i_pos):\n    '''List media instance in media list at a position\n    The L{libvlc_media_list_lock} should be held upon entering this function.\n    @param p_ml: a media list instance.\n    @param i_pos: position in array where to insert.\n    @return: media instance at position i_pos, or None if not found. In case of success, L{libvlc_media_retain}() is called to increase the refcount on the media.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_item_at_index', None) or \\\n        _Cfunction('libvlc_media_list_item_at_index', ((1,), (1,),), class_result(Media),\n                    ctypes.c_void_p, MediaList, ctypes.c_int)\n    return f(p_ml, i_pos)\n\ndef libvlc_media_list_index_of_item(p_ml, p_md):\n    '''Find index position of List media instance in media list.\n    Warning: the function will return the first matched position.\n    The L{libvlc_media_list_lock} should be held upon entering this function.\n    @param p_ml: a media list instance.\n    @param p_md: media instance.\n    @return: position of media instance or -1 if media not found.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_index_of_item', None) or \\\n        _Cfunction('libvlc_media_list_index_of_item', ((1,), (1,),), None,\n                    ctypes.c_int, MediaList, Media)\n    return f(p_ml, p_md)\n\ndef libvlc_media_list_is_readonly(p_ml):\n    '''This indicates if this media list is read-only from a user point of view.\n    @param p_ml: media list instance.\n    @return: 1 on readonly, 0 on readwrite \\libvlc_return_bool.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_is_readonly', None) or \\\n        _Cfunction('libvlc_media_list_is_readonly', ((1,),), None,\n                    ctypes.c_int, MediaList)\n    return f(p_ml)\n\ndef libvlc_media_list_lock(p_ml):\n    '''Get lock on media list items.\n    @param p_ml: a media list instance.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_lock', None) or \\\n        _Cfunction('libvlc_media_list_lock', ((1,),), None,\n                    None, MediaList)\n    return f(p_ml)\n\ndef libvlc_media_list_unlock(p_ml):\n    '''Release lock on media list items\n    The L{libvlc_media_list_lock} should be held upon entering this function.\n    @param p_ml: a media list instance.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_unlock', None) or \\\n        _Cfunction('libvlc_media_list_unlock', ((1,),), None,\n                    None, MediaList)\n    return f(p_ml)\n\ndef libvlc_media_list_event_manager(p_ml):\n    '''Get libvlc_event_manager from this media list instance.\n    The p_event_manager is immutable, so you don't have to hold the lock.\n    @param p_ml: a media list instance.\n    @return: libvlc_event_manager.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_event_manager', None) or \\\n        _Cfunction('libvlc_media_list_event_manager', ((1,),), class_result(EventManager),\n                    ctypes.c_void_p, MediaList)\n    return f(p_ml)\n\ndef libvlc_playlist_play(p_instance, i_id, i_options, ppsz_options):\n    '''Start playing (if there is any item in the playlist).\n    Additionnal playlist item options can be specified for addition to the\n    item before it is played.\n    @param p_instance: the playlist instance.\n    @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.\n    @param i_options: the number of options to add to the item.\n    @param ppsz_options: the options to add to the item.\n    '''\n    f = _Cfunctions.get('libvlc_playlist_play', None) or \\\n        _Cfunction('libvlc_playlist_play', ((1,), (1,), (1,), (1,),), None,\n                    None, Instance, ctypes.c_int, ctypes.c_int, ListPOINTER(ctypes.c_char_p))\n    return f(p_instance, i_id, i_options, ppsz_options)\n\ndef libvlc_media_player_new(p_libvlc_instance):\n    '''Create an empty Media Player object.\n    @param p_libvlc_instance: the libvlc instance in which the Media Player should be created.\n    @return: a new media player object, or None on error.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_new', None) or \\\n        _Cfunction('libvlc_media_player_new', ((1,),), class_result(MediaPlayer),\n                    ctypes.c_void_p, Instance)\n    return f(p_libvlc_instance)\n\ndef libvlc_media_player_new_from_media(p_md):\n    '''Create a Media Player object from a Media.\n    @param p_md: the media. Afterwards the p_md can be safely destroyed.\n    @return: a new media player object, or None on error.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_new_from_media', None) or \\\n        _Cfunction('libvlc_media_player_new_from_media', ((1,),), class_result(MediaPlayer),\n                    ctypes.c_void_p, Media)\n    return f(p_md)\n\ndef libvlc_media_player_release(p_mi):\n    '''Release a media_player after use\n    Decrement the reference count of a media player object. If the\n    reference count is 0, then L{libvlc_media_player_release}() will\n    release the media player object. If the media player object\n    has been released, then it should not be used again.\n    @param p_mi: the Media Player to free.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_release', None) or \\\n        _Cfunction('libvlc_media_player_release', ((1,),), None,\n                    None, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_retain(p_mi):\n    '''Retain a reference to a media player object. Use\n    L{libvlc_media_player_release}() to decrement reference count.\n    @param p_mi: media player object.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_retain', None) or \\\n        _Cfunction('libvlc_media_player_retain', ((1,),), None,\n                    None, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_set_media(p_mi, p_md):\n    '''Set the media that will be used by the media_player. If any,\n    previous md will be released.\n    @param p_mi: the Media Player.\n    @param p_md: the Media. Afterwards the p_md can be safely destroyed.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_media', None) or \\\n        _Cfunction('libvlc_media_player_set_media', ((1,), (1,),), None,\n                    None, MediaPlayer, Media)\n    return f(p_mi, p_md)\n\ndef libvlc_media_player_get_media(p_mi):\n    '''Get the media used by the media_player.\n    @param p_mi: the Media Player.\n    @return: the media associated with p_mi, or None if no media is associated.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_media', None) or \\\n        _Cfunction('libvlc_media_player_get_media', ((1,),), class_result(Media),\n                    ctypes.c_void_p, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_event_manager(p_mi):\n    '''Get the Event Manager from which the media player send event.\n    @param p_mi: the Media Player.\n    @return: the event manager associated with p_mi.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_event_manager', None) or \\\n        _Cfunction('libvlc_media_player_event_manager', ((1,),), class_result(EventManager),\n                    ctypes.c_void_p, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_is_playing(p_mi):\n    '''is_playing.\n    @param p_mi: the Media Player.\n    @return: 1 if the media player is playing, 0 otherwise \\libvlc_return_bool.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_is_playing', None) or \\\n        _Cfunction('libvlc_media_player_is_playing', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_play(p_mi):\n    '''Play.\n    @param p_mi: the Media Player.\n    @return: 0 if playback started (and was already started), or -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_play', None) or \\\n        _Cfunction('libvlc_media_player_play', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_set_pause(mp, do_pause):\n    '''Pause or resume (no effect if there is no media).\n    @param mp: the Media Player.\n    @param do_pause: play/resume if zero, pause if non-zero.\n    @version: LibVLC 1.1.1 or later.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_pause', None) or \\\n        _Cfunction('libvlc_media_player_set_pause', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_int)\n    return f(mp, do_pause)\n\ndef libvlc_media_player_pause(p_mi):\n    '''Toggle pause (no effect if there is no media).\n    @param p_mi: the Media Player.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_pause', None) or \\\n        _Cfunction('libvlc_media_player_pause', ((1,),), None,\n                    None, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_stop(p_mi):\n    '''Stop (no effect if there is no media).\n    @param p_mi: the Media Player.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_stop', None) or \\\n        _Cfunction('libvlc_media_player_stop', ((1,),), None,\n                    None, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_set_callbacks(mp, lock, unlock, display, opaque):\n    '''Set callbacks and private data to render decoded video to a custom area\n    in memory.\n    Use L{libvlc_video_set_format}() or L{libvlc_video_set_format_callbacks}()\n    to configure the decoded format.\n    @param mp: the media player.\n    @param lock: callback to lock video memory (must not be None).\n    @param unlock: callback to unlock video memory (or None if not needed).\n    @param display: callback to display video (or None if not needed).\n    @param opaque: private pointer for the three callbacks (as first parameter).\n    @version: LibVLC 1.1.1 or later.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_callbacks', None) or \\\n        _Cfunction('libvlc_video_set_callbacks', ((1,), (1,), (1,), (1,), (1,),), None,\n                    None, MediaPlayer, VideoLockCb, VideoUnlockCb, VideoDisplayCb, ctypes.c_void_p)\n    return f(mp, lock, unlock, display, opaque)\n\ndef libvlc_video_set_format(mp, chroma, width, height, pitch):\n    '''Set decoded video chroma and dimensions.\n    This only works in combination with L{libvlc_video_set_callbacks}(),\n    and is mutually exclusive with L{libvlc_video_set_format_callbacks}().\n    @param mp: the media player.\n    @param chroma: a four-characters string identifying the chroma (e.g. \"RV32\" or \"YUYV\").\n    @param width: pixel width.\n    @param height: pixel height.\n    @param pitch: line pitch (in bytes).\n    @version: LibVLC 1.1.1 or later.\n    @bug: All pixel planes are expected to have the same pitch. To use the YCbCr color space with chrominance subsampling, consider using L{libvlc_video_set_format_callbacks}() instead.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_format', None) or \\\n        _Cfunction('libvlc_video_set_format', ((1,), (1,), (1,), (1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint)\n    return f(mp, chroma, width, height, pitch)\n\ndef libvlc_video_set_format_callbacks(mp, setup, cleanup):\n    '''Set decoded video chroma and dimensions. This only works in combination with\n    L{libvlc_video_set_callbacks}().\n    @param mp: the media player.\n    @param setup: callback to select the video format (cannot be None).\n    @param cleanup: callback to release any allocated resources (or None).\n    @version: LibVLC 2.0.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_format_callbacks', None) or \\\n        _Cfunction('libvlc_video_set_format_callbacks', ((1,), (1,), (1,),), None,\n                    None, MediaPlayer, VideoFormatCb, VideoCleanupCb)\n    return f(mp, setup, cleanup)\n\ndef libvlc_media_player_set_nsobject(p_mi, drawable):\n    '''Set the NSView handler where the media player should render its video output.\n    Use the vout called \"macosx\".\n    The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding\n    protocol:\n    @begincode\n    \\@protocol VLCOpenGLVideoViewEmbedding <NSObject>\n    - (void)addVoutSubview:(NSView *)view;\n    - (void)removeVoutSubview:(NSView *)view;\n    \\@end\n    @endcode\n    Or it can be an NSView object.\n    If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then\n    the following code should work:\n    @begincode\n    \n        NSView *video = [[NSView alloc] init];\n        QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);\n        L{libvlc_media_player_set_nsobject}(mp, video);\n        [video release];\n    \n    @endcode\n    You can find a live example in VLCVideoView in VLCKit.framework.\n    @param p_mi: the Media Player.\n    @param drawable: the drawable that is either an NSView or an object following the VLCOpenGLVideoViewEmbedding protocol.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_nsobject', None) or \\\n        _Cfunction('libvlc_media_player_set_nsobject', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_void_p)\n    return f(p_mi, drawable)\n\ndef libvlc_media_player_get_nsobject(p_mi):\n    '''Get the NSView handler previously set with L{libvlc_media_player_set_nsobject}().\n    @param p_mi: the Media Player.\n    @return: the NSView handler or 0 if none where set.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_nsobject', None) or \\\n        _Cfunction('libvlc_media_player_get_nsobject', ((1,),), None,\n                    ctypes.c_void_p, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_set_agl(p_mi, drawable):\n    '''Set the agl handler where the media player should render its video output.\n    @param p_mi: the Media Player.\n    @param drawable: the agl handler.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_agl', None) or \\\n        _Cfunction('libvlc_media_player_set_agl', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_uint32)\n    return f(p_mi, drawable)\n\ndef libvlc_media_player_get_agl(p_mi):\n    '''Get the agl handler previously set with L{libvlc_media_player_set_agl}().\n    @param p_mi: the Media Player.\n    @return: the agl handler or 0 if none where set.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_agl', None) or \\\n        _Cfunction('libvlc_media_player_get_agl', ((1,),), None,\n                    ctypes.c_uint32, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_set_xwindow(p_mi, drawable):\n    '''Set an X Window System drawable where the media player should render its\n    video output. If LibVLC was built without X11 output support, then this has\n    no effects.\n    The specified identifier must correspond to an existing Input/Output class\n    X11 window. Pixmaps are B{not} supported. The caller shall ensure that\n    the X11 server is the same as the one the VLC instance has been configured\n    with. This function must be called before video playback is started;\n    otherwise it will only take effect after playback stop and restart.\n    @param p_mi: the Media Player.\n    @param drawable: the ID of the X window.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_xwindow', None) or \\\n        _Cfunction('libvlc_media_player_set_xwindow', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_uint32)\n    return f(p_mi, drawable)\n\ndef libvlc_media_player_get_xwindow(p_mi):\n    '''Get the X Window System window identifier previously set with\n    L{libvlc_media_player_set_xwindow}(). Note that this will return the identifier\n    even if VLC is not currently using it (for instance if it is playing an\n    audio-only input).\n    @param p_mi: the Media Player.\n    @return: an X window ID, or 0 if none where set.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_xwindow', None) or \\\n        _Cfunction('libvlc_media_player_get_xwindow', ((1,),), None,\n                    ctypes.c_uint32, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_set_hwnd(p_mi, drawable):\n    '''Set a Win32/Win64 API window handle (HWND) where the media player should\n    render its video output. If LibVLC was built without Win32/Win64 API output\n    support, then this has no effects.\n    @param p_mi: the Media Player.\n    @param drawable: windows handle of the drawable.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_hwnd', None) or \\\n        _Cfunction('libvlc_media_player_set_hwnd', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_void_p)\n    return f(p_mi, drawable)\n\ndef libvlc_media_player_get_hwnd(p_mi):\n    '''Get the Windows API window handle (HWND) previously set with\n    L{libvlc_media_player_set_hwnd}(). The handle will be returned even if LibVLC\n    is not currently outputting any video to it.\n    @param p_mi: the Media Player.\n    @return: a window handle or None if there are none.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_hwnd', None) or \\\n        _Cfunction('libvlc_media_player_get_hwnd', ((1,),), None,\n                    ctypes.c_void_p, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_audio_set_callbacks(mp, play, pause, resume, flush, drain, opaque):\n    '''Set callbacks and private data for decoded audio.\n    Use L{libvlc_audio_set_format}() or L{libvlc_audio_set_format_callbacks}()\n    to configure the decoded audio format.\n    @param mp: the media player.\n    @param play: callback to play audio samples (must not be None).\n    @param pause: callback to pause playback (or None to ignore).\n    @param resume: callback to resume playback (or None to ignore).\n    @param flush: callback to flush audio buffers (or None to ignore).\n    @param drain: callback to drain audio buffers (or None to ignore).\n    @param opaque: private pointer for the audio callbacks (as first parameter).\n    @version: LibVLC 2.0.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_set_callbacks', None) or \\\n        _Cfunction('libvlc_audio_set_callbacks', ((1,), (1,), (1,), (1,), (1,), (1,), (1,),), None,\n                    None, MediaPlayer, AudioPlayCb, AudioPauseCb, AudioResumeCb, AudioFlushCb, AudioDrainCb, ctypes.c_void_p)\n    return f(mp, play, pause, resume, flush, drain, opaque)\n\ndef libvlc_audio_set_volume_callback(mp, set_volume):\n    '''Set callbacks and private data for decoded audio. This only works in\n    combination with L{libvlc_audio_set_callbacks}().\n    Use L{libvlc_audio_set_format}() or L{libvlc_audio_set_format_callbacks}()\n    to configure the decoded audio format.\n    @param mp: the media player.\n    @param set_volume: callback to apply audio volume, or None to apply volume in software.\n    @version: LibVLC 2.0.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_set_volume_callback', None) or \\\n        _Cfunction('libvlc_audio_set_volume_callback', ((1,), (1,),), None,\n                    None, MediaPlayer, AudioSetVolumeCb)\n    return f(mp, set_volume)\n\ndef libvlc_audio_set_format_callbacks(mp, setup, cleanup):\n    '''Set decoded audio format. This only works in combination with\n    L{libvlc_audio_set_callbacks}().\n    @param mp: the media player.\n    @param setup: callback to select the audio format (cannot be None).\n    @param cleanup: callback to release any allocated resources (or None).\n    @version: LibVLC 2.0.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_set_format_callbacks', None) or \\\n        _Cfunction('libvlc_audio_set_format_callbacks', ((1,), (1,), (1,),), None,\n                    None, MediaPlayer, AudioSetupCb, AudioCleanupCb)\n    return f(mp, setup, cleanup)\n\ndef libvlc_audio_set_format(mp, format, rate, channels):\n    '''Set decoded audio format.\n    This only works in combination with L{libvlc_audio_set_callbacks}(),\n    and is mutually exclusive with L{libvlc_audio_set_format_callbacks}().\n    @param mp: the media player.\n    @param format: a four-characters string identifying the sample format (e.g. \"S16N\" or \"FL32\").\n    @param rate: sample rate (expressed in Hz).\n    @param channels: channels count.\n    @version: LibVLC 2.0.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_set_format', None) or \\\n        _Cfunction('libvlc_audio_set_format', ((1,), (1,), (1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint)\n    return f(mp, format, rate, channels)\n\ndef libvlc_media_player_get_length(p_mi):\n    '''Get the current movie length (in ms).\n    @param p_mi: the Media Player.\n    @return: the movie length (in ms), or -1 if there is no media.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_length', None) or \\\n        _Cfunction('libvlc_media_player_get_length', ((1,),), None,\n                    ctypes.c_longlong, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_get_time(p_mi):\n    '''Get the current movie time (in ms).\n    @param p_mi: the Media Player.\n    @return: the movie time (in ms), or -1 if there is no media.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_time', None) or \\\n        _Cfunction('libvlc_media_player_get_time', ((1,),), None,\n                    ctypes.c_longlong, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_set_time(p_mi, i_time):\n    '''Set the movie time (in ms). This has no effect if no media is being played.\n    Not all formats and protocols support this.\n    @param p_mi: the Media Player.\n    @param i_time: the movie time (in ms).\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_time', None) or \\\n        _Cfunction('libvlc_media_player_set_time', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_longlong)\n    return f(p_mi, i_time)\n\ndef libvlc_media_player_get_position(p_mi):\n    '''Get movie position as percentage between 0.0 and 1.0.\n    @param p_mi: the Media Player.\n    @return: movie position, or -1. in case of error.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_position', None) or \\\n        _Cfunction('libvlc_media_player_get_position', ((1,),), None,\n                    ctypes.c_float, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_set_position(p_mi, f_pos):\n    '''Set movie position as percentage between 0.0 and 1.0.\n    This has no effect if playback is not enabled.\n    This might not work depending on the underlying input format and protocol.\n    @param p_mi: the Media Player.\n    @param f_pos: the position.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_position', None) or \\\n        _Cfunction('libvlc_media_player_set_position', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_float)\n    return f(p_mi, f_pos)\n\ndef libvlc_media_player_set_chapter(p_mi, i_chapter):\n    '''Set movie chapter (if applicable).\n    @param p_mi: the Media Player.\n    @param i_chapter: chapter number to play.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_chapter', None) or \\\n        _Cfunction('libvlc_media_player_set_chapter', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_int)\n    return f(p_mi, i_chapter)\n\ndef libvlc_media_player_get_chapter(p_mi):\n    '''Get movie chapter.\n    @param p_mi: the Media Player.\n    @return: chapter number currently playing, or -1 if there is no media.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_chapter', None) or \\\n        _Cfunction('libvlc_media_player_get_chapter', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_get_chapter_count(p_mi):\n    '''Get movie chapter count.\n    @param p_mi: the Media Player.\n    @return: number of chapters in movie, or -1.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_chapter_count', None) or \\\n        _Cfunction('libvlc_media_player_get_chapter_count', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_will_play(p_mi):\n    '''Is the player able to play.\n    @param p_mi: the Media Player.\n    @return: boolean \\libvlc_return_bool.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_will_play', None) or \\\n        _Cfunction('libvlc_media_player_will_play', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_get_chapter_count_for_title(p_mi, i_title):\n    '''Get title chapter count.\n    @param p_mi: the Media Player.\n    @param i_title: title.\n    @return: number of chapters in title, or -1.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_chapter_count_for_title', None) or \\\n        _Cfunction('libvlc_media_player_get_chapter_count_for_title', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_int)\n    return f(p_mi, i_title)\n\ndef libvlc_media_player_set_title(p_mi, i_title):\n    '''Set movie title.\n    @param p_mi: the Media Player.\n    @param i_title: title number to play.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_title', None) or \\\n        _Cfunction('libvlc_media_player_set_title', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_int)\n    return f(p_mi, i_title)\n\ndef libvlc_media_player_get_title(p_mi):\n    '''Get movie title.\n    @param p_mi: the Media Player.\n    @return: title number currently playing, or -1.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_title', None) or \\\n        _Cfunction('libvlc_media_player_get_title', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_get_title_count(p_mi):\n    '''Get movie title count.\n    @param p_mi: the Media Player.\n    @return: title number count, or -1.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_title_count', None) or \\\n        _Cfunction('libvlc_media_player_get_title_count', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_previous_chapter(p_mi):\n    '''Set previous chapter (if applicable).\n    @param p_mi: the Media Player.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_previous_chapter', None) or \\\n        _Cfunction('libvlc_media_player_previous_chapter', ((1,),), None,\n                    None, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_next_chapter(p_mi):\n    '''Set next chapter (if applicable).\n    @param p_mi: the Media Player.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_next_chapter', None) or \\\n        _Cfunction('libvlc_media_player_next_chapter', ((1,),), None,\n                    None, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_get_rate(p_mi):\n    '''Get the requested movie play rate.\n    @warning: Depending on the underlying media, the requested rate may be\n    different from the real playback rate.\n    @param p_mi: the Media Player.\n    @return: movie play rate.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_rate', None) or \\\n        _Cfunction('libvlc_media_player_get_rate', ((1,),), None,\n                    ctypes.c_float, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_set_rate(p_mi, rate):\n    '''Set movie play rate.\n    @param p_mi: the Media Player.\n    @param rate: movie play rate to set.\n    @return: -1 if an error was detected, 0 otherwise (but even then, it might not actually work depending on the underlying media protocol).\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_rate', None) or \\\n        _Cfunction('libvlc_media_player_set_rate', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_float)\n    return f(p_mi, rate)\n\ndef libvlc_media_player_get_state(p_mi):\n    '''Get current movie state.\n    @param p_mi: the Media Player.\n    @return: the current state of the media player (playing, paused, ...) See libvlc_state_t.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_state', None) or \\\n        _Cfunction('libvlc_media_player_get_state', ((1,),), None,\n                    State, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_get_fps(p_mi):\n    '''Get movie fps rate.\n    @param p_mi: the Media Player.\n    @return: frames per second (fps) for this playing movie, or 0 if unspecified.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_get_fps', None) or \\\n        _Cfunction('libvlc_media_player_get_fps', ((1,),), None,\n                    ctypes.c_float, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_has_vout(p_mi):\n    '''How many video outputs does this media player have?\n    @param p_mi: the media player.\n    @return: the number of video outputs.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_has_vout', None) or \\\n        _Cfunction('libvlc_media_player_has_vout', ((1,),), None,\n                    ctypes.c_uint, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_is_seekable(p_mi):\n    '''Is this media player seekable?\n    @param p_mi: the media player.\n    @return: true if the media player can seek \\libvlc_return_bool.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_is_seekable', None) or \\\n        _Cfunction('libvlc_media_player_is_seekable', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_can_pause(p_mi):\n    '''Can this media player be paused?\n    @param p_mi: the media player.\n    @return: true if the media player can pause \\libvlc_return_bool.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_can_pause', None) or \\\n        _Cfunction('libvlc_media_player_can_pause', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_program_scrambled(p_mi):\n    '''Check if the current program is scrambled.\n    @param p_mi: the media player.\n    @return: true if the current program is scrambled \\libvlc_return_bool.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_program_scrambled', None) or \\\n        _Cfunction('libvlc_media_player_program_scrambled', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_next_frame(p_mi):\n    '''Display the next frame (if supported).\n    @param p_mi: the media player.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_next_frame', None) or \\\n        _Cfunction('libvlc_media_player_next_frame', ((1,),), None,\n                    None, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_media_player_navigate(p_mi, navigate):\n    '''Navigate through DVD Menu.\n    @param p_mi: the Media Player.\n    @param navigate: the Navigation mode.\n    @version: libVLC 2.0.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_navigate', None) or \\\n        _Cfunction('libvlc_media_player_navigate', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_uint)\n    return f(p_mi, navigate)\n\ndef libvlc_media_player_set_video_title_display(p_mi, position, timeout):\n    '''Set if, and how, the video title will be shown when media is played.\n    @param p_mi: the media player.\n    @param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed.\n    @param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable).\n    @version: libVLC 2.1.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_video_title_display', None) or \\\n        _Cfunction('libvlc_media_player_set_video_title_display', ((1,), (1,), (1,),), None,\n                    None, MediaPlayer, Position, ctypes.c_int)\n    return f(p_mi, position, timeout)\n\ndef libvlc_track_description_list_release(p_track_description):\n    '''Release (free) L{TrackDescription}.\n    @param p_track_description: the structure to release.\n    '''\n    f = _Cfunctions.get('libvlc_track_description_list_release', None) or \\\n        _Cfunction('libvlc_track_description_list_release', ((1,),), None,\n                    None, ctypes.POINTER(TrackDescription))\n    return f(p_track_description)\n\ndef libvlc_track_description_release(p_track_description):\n    '''\\deprecated Use L{libvlc_track_description_list_release} instead.\n    '''\n    f = _Cfunctions.get('libvlc_track_description_release', None) or \\\n        _Cfunction('libvlc_track_description_release', ((1,),), None,\n                    None, ctypes.POINTER(TrackDescription))\n    return f(p_track_description)\n\ndef libvlc_toggle_fullscreen(p_mi):\n    '''Toggle fullscreen status on non-embedded video outputs.\n    @warning: The same limitations applies to this function\n    as to L{libvlc_set_fullscreen}().\n    @param p_mi: the media player.\n    '''\n    f = _Cfunctions.get('libvlc_toggle_fullscreen', None) or \\\n        _Cfunction('libvlc_toggle_fullscreen', ((1,),), None,\n                    None, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_set_fullscreen(p_mi, b_fullscreen):\n    '''Enable or disable fullscreen.\n    @warning: With most window managers, only a top-level windows can be in\n    full-screen mode. Hence, this function will not operate properly if\n    L{libvlc_media_player_set_xwindow}() was used to embed the video in a\n    non-top-level window. In that case, the embedding window must be reparented\n    to the root window B{before} fullscreen mode is enabled. You will want\n    to reparent it back to its normal parent when disabling fullscreen.\n    @param p_mi: the media player.\n    @param b_fullscreen: boolean for fullscreen status.\n    '''\n    f = _Cfunctions.get('libvlc_set_fullscreen', None) or \\\n        _Cfunction('libvlc_set_fullscreen', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_int)\n    return f(p_mi, b_fullscreen)\n\ndef libvlc_get_fullscreen(p_mi):\n    '''Get current fullscreen status.\n    @param p_mi: the media player.\n    @return: the fullscreen status (boolean) \\libvlc_return_bool.\n    '''\n    f = _Cfunctions.get('libvlc_get_fullscreen', None) or \\\n        _Cfunction('libvlc_get_fullscreen', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_set_key_input(p_mi, on):\n    '''Enable or disable key press events handling, according to the LibVLC hotkeys\n    configuration. By default and for historical reasons, keyboard events are\n    handled by the LibVLC video widget.\n    @note: On X11, there can be only one subscriber for key press and mouse\n    click events per window. If your application has subscribed to those events\n    for the X window ID of the video widget, then LibVLC will not be able to\n    handle key presses and mouse clicks in any case.\n    @warning: This function is only implemented for X11 and Win32 at the moment.\n    @param p_mi: the media player.\n    @param on: true to handle key press events, false to ignore them.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_key_input', None) or \\\n        _Cfunction('libvlc_video_set_key_input', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_uint)\n    return f(p_mi, on)\n\ndef libvlc_video_set_mouse_input(p_mi, on):\n    '''Enable or disable mouse click events handling. By default, those events are\n    handled. This is needed for DVD menus to work, as well as a few video\n    filters such as \"puzzle\".\n    See L{libvlc_video_set_key_input}().\n    @warning: This function is only implemented for X11 and Win32 at the moment.\n    @param p_mi: the media player.\n    @param on: true to handle mouse click events, false to ignore them.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_mouse_input', None) or \\\n        _Cfunction('libvlc_video_set_mouse_input', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_uint)\n    return f(p_mi, on)\n\ndef libvlc_video_get_size(p_mi, num):\n    '''Get the pixel dimensions of a video.\n    @param p_mi: media player.\n    @param num: number of the video (starting from, and most commonly 0).\n    @return: px pixel width, py pixel height.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_size', None) or \\\n        _Cfunction('libvlc_video_get_size', ((1,), (1,), (2,), (2,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint))\n    return f(p_mi, num)\n\ndef libvlc_video_get_height(p_mi):\n    '''Get current video height.\n    \\deprecated Use L{libvlc_video_get_size}() instead.\n    @param p_mi: the media player.\n    @return: the video pixel height or 0 if not applicable.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_height', None) or \\\n        _Cfunction('libvlc_video_get_height', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_get_width(p_mi):\n    '''Get current video width.\n    \\deprecated Use L{libvlc_video_get_size}() instead.\n    @param p_mi: the media player.\n    @return: the video pixel width or 0 if not applicable.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_width', None) or \\\n        _Cfunction('libvlc_video_get_width', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_get_cursor(p_mi, num):\n    '''Get the mouse pointer coordinates over a video.\n    Coordinates are expressed in terms of the decoded video resolution,\n    B{not} in terms of pixels on the screen/viewport (to get the latter,\n    you can query your windowing system directly).\n    Either of the coordinates may be negative or larger than the corresponding\n    dimension of the video, if the cursor is outside the rendering area.\n    @warning: The coordinates may be out-of-date if the pointer is not located\n    on the video rendering area. LibVLC does not track the pointer if it is\n    outside of the video widget.\n    @note: LibVLC does not support multiple pointers (it does of course support\n    multiple input devices sharing the same pointer) at the moment.\n    @param p_mi: media player.\n    @param num: number of the video (starting from, and most commonly 0).\n    @return: px abscissa, py ordinate.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_cursor', None) or \\\n        _Cfunction('libvlc_video_get_cursor', ((1,), (1,), (2,), (2,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int))\n    return f(p_mi, num)\n\ndef libvlc_video_get_scale(p_mi):\n    '''Get the current video scaling factor.\n    See also L{libvlc_video_set_scale}().\n    @param p_mi: the media player.\n    @return: the currently configured zoom factor, or 0. if the video is set to fit to the output window/drawable automatically.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_scale', None) or \\\n        _Cfunction('libvlc_video_get_scale', ((1,),), None,\n                    ctypes.c_float, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_set_scale(p_mi, f_factor):\n    '''Set the video scaling factor. That is the ratio of the number of pixels on\n    screen to the number of pixels in the original decoded video in each\n    dimension. Zero is a special value; it will adjust the video to the output\n    window/drawable (in windowed mode) or the entire screen.\n    Note that not all video outputs support scaling.\n    @param p_mi: the media player.\n    @param f_factor: the scaling factor, or zero.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_scale', None) or \\\n        _Cfunction('libvlc_video_set_scale', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_float)\n    return f(p_mi, f_factor)\n\ndef libvlc_video_get_aspect_ratio(p_mi):\n    '''Get current video aspect ratio.\n    @param p_mi: the media player.\n    @return: the video aspect ratio or None if unspecified (the result must be released with free() or L{libvlc_free}()).\n    '''\n    f = _Cfunctions.get('libvlc_video_get_aspect_ratio', None) or \\\n        _Cfunction('libvlc_video_get_aspect_ratio', ((1,),), string_result,\n                    ctypes.c_void_p, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_set_aspect_ratio(p_mi, psz_aspect):\n    '''Set new video aspect ratio.\n    @param p_mi: the media player.\n    @param psz_aspect: new video aspect-ratio or None to reset to default @note Invalid aspect ratios are ignored.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_aspect_ratio', None) or \\\n        _Cfunction('libvlc_video_set_aspect_ratio', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_char_p)\n    return f(p_mi, psz_aspect)\n\ndef libvlc_video_get_spu(p_mi):\n    '''Get current video subtitle.\n    @param p_mi: the media player.\n    @return: the video subtitle selected, or -1 if none.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_spu', None) or \\\n        _Cfunction('libvlc_video_get_spu', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_get_spu_count(p_mi):\n    '''Get the number of available video subtitles.\n    @param p_mi: the media player.\n    @return: the number of available video subtitles.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_spu_count', None) or \\\n        _Cfunction('libvlc_video_get_spu_count', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_get_spu_description(p_mi):\n    '''Get the description of available video subtitles.\n    @param p_mi: the media player.\n    @return: list containing description of available video subtitles.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_spu_description', None) or \\\n        _Cfunction('libvlc_video_get_spu_description', ((1,),), None,\n                    ctypes.POINTER(TrackDescription), MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_set_spu(p_mi, i_spu):\n    '''Set new video subtitle.\n    @param p_mi: the media player.\n    @param i_spu: video subtitle track to select (i_id from track description).\n    @return: 0 on success, -1 if out of range.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_spu', None) or \\\n        _Cfunction('libvlc_video_set_spu', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_int)\n    return f(p_mi, i_spu)\n\ndef libvlc_video_set_subtitle_file(p_mi, psz_subtitle):\n    '''Set new video subtitle file.\n    @param p_mi: the media player.\n    @param psz_subtitle: new video subtitle file.\n    @return: the success status (boolean).\n    '''\n    f = _Cfunctions.get('libvlc_video_set_subtitle_file', None) or \\\n        _Cfunction('libvlc_video_set_subtitle_file', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_char_p)\n    return f(p_mi, psz_subtitle)\n\ndef libvlc_video_get_spu_delay(p_mi):\n    '''Get the current subtitle delay. Positive values means subtitles are being\n    displayed later, negative values earlier.\n    @param p_mi: media player.\n    @return: time (in microseconds) the display of subtitles is being delayed.\n    @version: LibVLC 2.0.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_spu_delay', None) or \\\n        _Cfunction('libvlc_video_get_spu_delay', ((1,),), None,\n                    ctypes.c_int64, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_set_spu_delay(p_mi, i_delay):\n    '''Set the subtitle delay. This affects the timing of when the subtitle will\n    be displayed. Positive values result in subtitles being displayed later,\n    while negative values will result in subtitles being displayed earlier.\n    The subtitle delay will be reset to zero each time the media changes.\n    @param p_mi: media player.\n    @param i_delay: time (in microseconds) the display of subtitles should be delayed.\n    @return: 0 on success, -1 on error.\n    @version: LibVLC 2.0.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_spu_delay', None) or \\\n        _Cfunction('libvlc_video_set_spu_delay', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_int64)\n    return f(p_mi, i_delay)\n\ndef libvlc_video_get_title_description(p_mi):\n    '''Get the description of available titles.\n    @param p_mi: the media player.\n    @return: list containing description of available titles.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_title_description', None) or \\\n        _Cfunction('libvlc_video_get_title_description', ((1,),), None,\n                    ctypes.POINTER(TrackDescription), MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_get_chapter_description(p_mi, i_title):\n    '''Get the description of available chapters for specific title.\n    @param p_mi: the media player.\n    @param i_title: selected title.\n    @return: list containing description of available chapter for title i_title.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_chapter_description', None) or \\\n        _Cfunction('libvlc_video_get_chapter_description', ((1,), (1,),), None,\n                    ctypes.POINTER(TrackDescription), MediaPlayer, ctypes.c_int)\n    return f(p_mi, i_title)\n\ndef libvlc_video_get_crop_geometry(p_mi):\n    '''Get current crop filter geometry.\n    @param p_mi: the media player.\n    @return: the crop filter geometry or None if unset.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_crop_geometry', None) or \\\n        _Cfunction('libvlc_video_get_crop_geometry', ((1,),), string_result,\n                    ctypes.c_void_p, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_set_crop_geometry(p_mi, psz_geometry):\n    '''Set new crop filter geometry.\n    @param p_mi: the media player.\n    @param psz_geometry: new crop filter geometry (None to unset).\n    '''\n    f = _Cfunctions.get('libvlc_video_set_crop_geometry', None) or \\\n        _Cfunction('libvlc_video_set_crop_geometry', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_char_p)\n    return f(p_mi, psz_geometry)\n\ndef libvlc_video_get_teletext(p_mi):\n    '''Get current teletext page requested.\n    @param p_mi: the media player.\n    @return: the current teletext page requested.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_teletext', None) or \\\n        _Cfunction('libvlc_video_get_teletext', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_set_teletext(p_mi, i_page):\n    '''Set new teletext page to retrieve.\n    @param p_mi: the media player.\n    @param i_page: teletex page number requested.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_teletext', None) or \\\n        _Cfunction('libvlc_video_set_teletext', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_int)\n    return f(p_mi, i_page)\n\ndef libvlc_toggle_teletext(p_mi):\n    '''Toggle teletext transparent status on video output.\n    @param p_mi: the media player.\n    '''\n    f = _Cfunctions.get('libvlc_toggle_teletext', None) or \\\n        _Cfunction('libvlc_toggle_teletext', ((1,),), None,\n                    None, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_get_track_count(p_mi):\n    '''Get number of available video tracks.\n    @param p_mi: media player.\n    @return: the number of available video tracks (int).\n    '''\n    f = _Cfunctions.get('libvlc_video_get_track_count', None) or \\\n        _Cfunction('libvlc_video_get_track_count', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_get_track_description(p_mi):\n    '''Get the description of available video tracks.\n    @param p_mi: media player.\n    @return: list with description of available video tracks, or None on error.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_track_description', None) or \\\n        _Cfunction('libvlc_video_get_track_description', ((1,),), None,\n                    ctypes.POINTER(TrackDescription), MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_get_track(p_mi):\n    '''Get current video track.\n    @param p_mi: media player.\n    @return: the video track ID (int) or -1 if no active input.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_track', None) or \\\n        _Cfunction('libvlc_video_get_track', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_video_set_track(p_mi, i_track):\n    '''Set video track.\n    @param p_mi: media player.\n    @param i_track: the track ID (i_id field from track description).\n    @return: 0 on success, -1 if out of range.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_track', None) or \\\n        _Cfunction('libvlc_video_set_track', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_int)\n    return f(p_mi, i_track)\n\ndef libvlc_video_take_snapshot(p_mi, num, psz_filepath, i_width, i_height):\n    '''Take a snapshot of the current video window.\n    If i_width AND i_height is 0, original size is used.\n    If i_width XOR i_height is 0, original aspect-ratio is preserved.\n    @param p_mi: media player instance.\n    @param num: number of video output (typically 0 for the first/only one).\n    @param psz_filepath: the path where to save the screenshot to.\n    @param i_width: the snapshot's width.\n    @param i_height: the snapshot's height.\n    @return: 0 on success, -1 if the video was not found.\n    '''\n    f = _Cfunctions.get('libvlc_video_take_snapshot', None) or \\\n        _Cfunction('libvlc_video_take_snapshot', ((1,), (1,), (1,), (1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.c_char_p, ctypes.c_int, ctypes.c_int)\n    return f(p_mi, num, psz_filepath, i_width, i_height)\n\ndef libvlc_video_set_deinterlace(p_mi, psz_mode):\n    '''Enable or disable deinterlace filter.\n    @param p_mi: libvlc media player.\n    @param psz_mode: type of deinterlace filter, None to disable.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_deinterlace', None) or \\\n        _Cfunction('libvlc_video_set_deinterlace', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_char_p)\n    return f(p_mi, psz_mode)\n\ndef libvlc_video_get_marquee_int(p_mi, option):\n    '''Get an integer marquee option value.\n    @param p_mi: libvlc media player.\n    @param option: marq option to get See libvlc_video_marquee_int_option_t.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_marquee_int', None) or \\\n        _Cfunction('libvlc_video_get_marquee_int', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_uint)\n    return f(p_mi, option)\n\ndef libvlc_video_get_marquee_string(p_mi, option):\n    '''Get a string marquee option value.\n    @param p_mi: libvlc media player.\n    @param option: marq option to get See libvlc_video_marquee_string_option_t.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_marquee_string', None) or \\\n        _Cfunction('libvlc_video_get_marquee_string', ((1,), (1,),), string_result,\n                    ctypes.c_void_p, MediaPlayer, ctypes.c_uint)\n    return f(p_mi, option)\n\ndef libvlc_video_set_marquee_int(p_mi, option, i_val):\n    '''Enable, disable or set an integer marquee option\n    Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)\n    or disabling (arg 0) the marq filter.\n    @param p_mi: libvlc media player.\n    @param option: marq option to set See libvlc_video_marquee_int_option_t.\n    @param i_val: marq option value.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_marquee_int', None) or \\\n        _Cfunction('libvlc_video_set_marquee_int', ((1,), (1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_uint, ctypes.c_int)\n    return f(p_mi, option, i_val)\n\ndef libvlc_video_set_marquee_string(p_mi, option, psz_text):\n    '''Set a marquee string option.\n    @param p_mi: libvlc media player.\n    @param option: marq option to set See libvlc_video_marquee_string_option_t.\n    @param psz_text: marq option value.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_marquee_string', None) or \\\n        _Cfunction('libvlc_video_set_marquee_string', ((1,), (1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p)\n    return f(p_mi, option, psz_text)\n\ndef libvlc_video_get_logo_int(p_mi, option):\n    '''Get integer logo option.\n    @param p_mi: libvlc media player instance.\n    @param option: logo option to get, values of libvlc_video_logo_option_t.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_logo_int', None) or \\\n        _Cfunction('libvlc_video_get_logo_int', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_uint)\n    return f(p_mi, option)\n\ndef libvlc_video_set_logo_int(p_mi, option, value):\n    '''Set logo option as integer. Options that take a different type value\n    are ignored.\n    Passing libvlc_logo_enable as option value has the side effect of\n    starting (arg !0) or stopping (arg 0) the logo filter.\n    @param p_mi: libvlc media player instance.\n    @param option: logo option to set, values of libvlc_video_logo_option_t.\n    @param value: logo option value.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_logo_int', None) or \\\n        _Cfunction('libvlc_video_set_logo_int', ((1,), (1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_uint, ctypes.c_int)\n    return f(p_mi, option, value)\n\ndef libvlc_video_set_logo_string(p_mi, option, psz_value):\n    '''Set logo option as string. Options that take a different type value\n    are ignored.\n    @param p_mi: libvlc media player instance.\n    @param option: logo option to set, values of libvlc_video_logo_option_t.\n    @param psz_value: logo option value.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_logo_string', None) or \\\n        _Cfunction('libvlc_video_set_logo_string', ((1,), (1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p)\n    return f(p_mi, option, psz_value)\n\ndef libvlc_video_get_adjust_int(p_mi, option):\n    '''Get integer adjust option.\n    @param p_mi: libvlc media player instance.\n    @param option: adjust option to get, values of libvlc_video_adjust_option_t.\n    @version: LibVLC 1.1.1 and later.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_adjust_int', None) or \\\n        _Cfunction('libvlc_video_get_adjust_int', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_uint)\n    return f(p_mi, option)\n\ndef libvlc_video_set_adjust_int(p_mi, option, value):\n    '''Set adjust option as integer. Options that take a different type value\n    are ignored.\n    Passing libvlc_adjust_enable as option value has the side effect of\n    starting (arg !0) or stopping (arg 0) the adjust filter.\n    @param p_mi: libvlc media player instance.\n    @param option: adust option to set, values of libvlc_video_adjust_option_t.\n    @param value: adjust option value.\n    @version: LibVLC 1.1.1 and later.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_adjust_int', None) or \\\n        _Cfunction('libvlc_video_set_adjust_int', ((1,), (1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_uint, ctypes.c_int)\n    return f(p_mi, option, value)\n\ndef libvlc_video_get_adjust_float(p_mi, option):\n    '''Get float adjust option.\n    @param p_mi: libvlc media player instance.\n    @param option: adjust option to get, values of libvlc_video_adjust_option_t.\n    @version: LibVLC 1.1.1 and later.\n    '''\n    f = _Cfunctions.get('libvlc_video_get_adjust_float', None) or \\\n        _Cfunction('libvlc_video_get_adjust_float', ((1,), (1,),), None,\n                    ctypes.c_float, MediaPlayer, ctypes.c_uint)\n    return f(p_mi, option)\n\ndef libvlc_video_set_adjust_float(p_mi, option, value):\n    '''Set adjust option as float. Options that take a different type value\n    are ignored.\n    @param p_mi: libvlc media player instance.\n    @param option: adust option to set, values of libvlc_video_adjust_option_t.\n    @param value: adjust option value.\n    @version: LibVLC 1.1.1 and later.\n    '''\n    f = _Cfunctions.get('libvlc_video_set_adjust_float', None) or \\\n        _Cfunction('libvlc_video_set_adjust_float', ((1,), (1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_uint, ctypes.c_float)\n    return f(p_mi, option, value)\n\ndef libvlc_audio_output_list_get(p_instance):\n    '''Gets the list of available audio output modules.\n    @param p_instance: libvlc instance.\n    @return: list of available audio outputs. It must be freed it with In case of error, None is returned.\n    '''\n    f = _Cfunctions.get('libvlc_audio_output_list_get', None) or \\\n        _Cfunction('libvlc_audio_output_list_get', ((1,),), None,\n                    ctypes.POINTER(AudioOutput), Instance)\n    return f(p_instance)\n\ndef libvlc_audio_output_list_release(p_list):\n    '''Frees the list of available audio output modules.\n    @param p_list: list with audio outputs for release.\n    '''\n    f = _Cfunctions.get('libvlc_audio_output_list_release', None) or \\\n        _Cfunction('libvlc_audio_output_list_release', ((1,),), None,\n                    None, ctypes.POINTER(AudioOutput))\n    return f(p_list)\n\ndef libvlc_audio_output_set(p_mi, psz_name):\n    '''Selects an audio output module.\n    @note: Any change will take be effect only after playback is stopped and\n    restarted. Audio output cannot be changed while playing.\n    @param p_mi: media player.\n    @param psz_name: name of audio output, use psz_name of See L{AudioOutput}.\n    @return: 0 if function succeded, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_audio_output_set', None) or \\\n        _Cfunction('libvlc_audio_output_set', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_char_p)\n    return f(p_mi, psz_name)\n\ndef libvlc_audio_output_device_count(p_instance, psz_name):\n    '''Backward compatibility stub. Do not use in new code.\n    Use L{libvlc_audio_output_device_list_get}() instead.\n    @param p_instance: vlc instance.\n    @param psz_name: name.\n    @return: always 0.\n    '''\n    f = _Cfunctions.get('libvlc_audio_output_device_count', None) or \\\n        _Cfunction('libvlc_audio_output_device_count', ((1,), (1,),), None,\n                    ctypes.c_int, Instance, ctypes.c_char_p)\n    return f(p_instance, psz_name)\n\ndef libvlc_audio_output_device_longname(p_instance, psz_name, int):\n    '''Backward compatibility stub. Do not use in new code.\n    Use L{libvlc_audio_output_device_list_get}() instead.\n    @param p_instance: vlc instance.\n    @param psz_name: name.\n    @param int: index.\n    @return: always None.\n    '''\n    f = _Cfunctions.get('libvlc_audio_output_device_longname', None) or \\\n        _Cfunction('libvlc_audio_output_device_longname', ((1,), (1,), (1,),), string_result,\n                    ctypes.c_void_p, Instance, ctypes.c_char_p, ctypes.c_int)\n    return f(p_instance, psz_name, int)\n\ndef libvlc_audio_output_device_id(p_instance, psz_name, int):\n    '''Backward compatibility stub. Do not use in new code.\n    Use L{libvlc_audio_output_device_list_get}() instead.\n    @param p_instance: vlc instance.\n    @param psz_name: name.\n    @param int: index.\n    @return: always None.\n    '''\n    f = _Cfunctions.get('libvlc_audio_output_device_id', None) or \\\n        _Cfunction('libvlc_audio_output_device_id', ((1,), (1,), (1,),), string_result,\n                    ctypes.c_void_p, Instance, ctypes.c_char_p, ctypes.c_int)\n    return f(p_instance, psz_name, int)\n\ndef libvlc_audio_output_device_enum(mp):\n    '''Gets a list of potential audio output devices,\n    See L{libvlc_audio_output_device_set}().\n    @note: Not all audio outputs support enumerating devices.\n    The audio output may be functional even if the list is empty (None).\n    @note: The list may not be exhaustive.\n    @warning: Some audio output devices in the list might not actually work in\n    some circumstances. By default, it is recommended to not specify any\n    explicit audio device.\n    @param mp: media player.\n    @return: A None-terminated linked list of potential audio output devices. It must be freed it with L{libvlc_audio_output_device_list_release}().\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_output_device_enum', None) or \\\n        _Cfunction('libvlc_audio_output_device_enum', ((1,),), None,\n                    ctypes.POINTER(AudioOutputDevice), MediaPlayer)\n    return f(mp)\n\ndef libvlc_audio_output_device_list_get(p_instance, aout):\n    '''Gets a list of audio output devices for a given audio output module,\n    See L{libvlc_audio_output_device_set}().\n    @note: Not all audio outputs support this. In particular, an empty (None)\n    list of devices does B{not} imply that the specified audio output does\n    not work.\n    @note: The list might not be exhaustive.\n    @warning: Some audio output devices in the list might not actually work in\n    some circumstances. By default, it is recommended to not specify any\n    explicit audio device.\n    @param p_instance: libvlc instance.\n    @param psz_aout: audio output name (as returned by L{libvlc_audio_output_list_get}()).\n    @return: A None-terminated linked list of potential audio output devices. It must be freed it with L{libvlc_audio_output_device_list_release}().\n    @version: LibVLC 2.1.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_output_device_list_get', None) or \\\n        _Cfunction('libvlc_audio_output_device_list_get', ((1,), (1,),), None,\n                    ctypes.POINTER(AudioOutputDevice), Instance, ctypes.c_char_p)\n    return f(p_instance, aout)\n\ndef libvlc_audio_output_device_list_release(p_list):\n    '''Frees a list of available audio output devices.\n    @param p_list: list with audio outputs for release.\n    @version: LibVLC 2.1.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_output_device_list_release', None) or \\\n        _Cfunction('libvlc_audio_output_device_list_release', ((1,),), None,\n                    None, ctypes.POINTER(AudioOutputDevice))\n    return f(p_list)\n\ndef libvlc_audio_output_device_set(mp, module, device_id):\n    '''Configures an explicit audio output device.\n    If the module paramater is None, audio output will be moved to the device\n    specified by the device identifier string immediately. This is the\n    recommended usage.\n    A list of adequate potential device strings can be obtained with\n    L{libvlc_audio_output_device_enum}().\n    However passing None is supported in LibVLC version 2.2.0 and later only;\n    in earlier versions, this function would have no effects when the module\n    parameter was None.\n    If the module parameter is not None, the device parameter of the\n    corresponding audio output, if it exists, will be set to the specified\n    string. Note that some audio output modules do not have such a parameter\n    (notably MMDevice and PulseAudio).\n    A list of adequate potential device strings can be obtained with\n    L{libvlc_audio_output_device_list_get}().\n    @note: This function does not select the specified audio output plugin.\n    L{libvlc_audio_output_set}() is used for that purpose.\n    @warning: The syntax for the device parameter depends on the audio output.\n    Some audio output modules require further parameters (e.g. a channels map\n    in the case of ALSA).\n    @param mp: media player.\n    @param module: If None, current audio output module. if non-None, name of audio output module.\n    @param device_id: device identifier string.\n    @return: Nothing. Errors are ignored (this is a design bug).\n    '''\n    f = _Cfunctions.get('libvlc_audio_output_device_set', None) or \\\n        _Cfunction('libvlc_audio_output_device_set', ((1,), (1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_char_p, ctypes.c_char_p)\n    return f(mp, module, device_id)\n\ndef libvlc_audio_toggle_mute(p_mi):\n    '''Toggle mute status.\n    @param p_mi: media player @warning Toggling mute atomically is not always possible: On some platforms, other processes can mute the VLC audio playback stream asynchronously. Thus, there is a small race condition where toggling will not work. See also the limitations of L{libvlc_audio_set_mute}().\n    '''\n    f = _Cfunctions.get('libvlc_audio_toggle_mute', None) or \\\n        _Cfunction('libvlc_audio_toggle_mute', ((1,),), None,\n                    None, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_audio_get_mute(p_mi):\n    '''Get current mute status.\n    @param p_mi: media player.\n    @return: the mute status (boolean) if defined, -1 if undefined/unapplicable.\n    '''\n    f = _Cfunctions.get('libvlc_audio_get_mute', None) or \\\n        _Cfunction('libvlc_audio_get_mute', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_audio_set_mute(p_mi, status):\n    '''Set mute status.\n    @param p_mi: media player.\n    @param status: If status is true then mute, otherwise unmute @warning This function does not always work. If there are no active audio playback stream, the mute status might not be available. If digital pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also some audio output plugins do not support muting at all. @note To force silent playback, disable all audio tracks. This is more efficient and reliable than mute.\n    '''\n    f = _Cfunctions.get('libvlc_audio_set_mute', None) or \\\n        _Cfunction('libvlc_audio_set_mute', ((1,), (1,),), None,\n                    None, MediaPlayer, ctypes.c_int)\n    return f(p_mi, status)\n\ndef libvlc_audio_get_volume(p_mi):\n    '''Get current software audio volume.\n    @param p_mi: media player.\n    @return: the software volume in percents (0 = mute, 100 = nominal / 0dB).\n    '''\n    f = _Cfunctions.get('libvlc_audio_get_volume', None) or \\\n        _Cfunction('libvlc_audio_get_volume', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_audio_set_volume(p_mi, i_volume):\n    '''Set current software audio volume.\n    @param p_mi: media player.\n    @param i_volume: the volume in percents (0 = mute, 100 = 0dB).\n    @return: 0 if the volume was set, -1 if it was out of range.\n    '''\n    f = _Cfunctions.get('libvlc_audio_set_volume', None) or \\\n        _Cfunction('libvlc_audio_set_volume', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_int)\n    return f(p_mi, i_volume)\n\ndef libvlc_audio_get_track_count(p_mi):\n    '''Get number of available audio tracks.\n    @param p_mi: media player.\n    @return: the number of available audio tracks (int), or -1 if unavailable.\n    '''\n    f = _Cfunctions.get('libvlc_audio_get_track_count', None) or \\\n        _Cfunction('libvlc_audio_get_track_count', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_audio_get_track_description(p_mi):\n    '''Get the description of available audio tracks.\n    @param p_mi: media player.\n    @return: list with description of available audio tracks, or None.\n    '''\n    f = _Cfunctions.get('libvlc_audio_get_track_description', None) or \\\n        _Cfunction('libvlc_audio_get_track_description', ((1,),), None,\n                    ctypes.POINTER(TrackDescription), MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_audio_get_track(p_mi):\n    '''Get current audio track.\n    @param p_mi: media player.\n    @return: the audio track ID or -1 if no active input.\n    '''\n    f = _Cfunctions.get('libvlc_audio_get_track', None) or \\\n        _Cfunction('libvlc_audio_get_track', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_audio_set_track(p_mi, i_track):\n    '''Set current audio track.\n    @param p_mi: media player.\n    @param i_track: the track ID (i_id field from track description).\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_audio_set_track', None) or \\\n        _Cfunction('libvlc_audio_set_track', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_int)\n    return f(p_mi, i_track)\n\ndef libvlc_audio_get_channel(p_mi):\n    '''Get current audio channel.\n    @param p_mi: media player.\n    @return: the audio channel See libvlc_audio_output_channel_t.\n    '''\n    f = _Cfunctions.get('libvlc_audio_get_channel', None) or \\\n        _Cfunction('libvlc_audio_get_channel', ((1,),), None,\n                    ctypes.c_int, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_audio_set_channel(p_mi, channel):\n    '''Set current audio channel.\n    @param p_mi: media player.\n    @param channel: the audio channel, See libvlc_audio_output_channel_t.\n    @return: 0 on success, -1 on error.\n    '''\n    f = _Cfunctions.get('libvlc_audio_set_channel', None) or \\\n        _Cfunction('libvlc_audio_set_channel', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_int)\n    return f(p_mi, channel)\n\ndef libvlc_audio_get_delay(p_mi):\n    '''Get current audio delay.\n    @param p_mi: media player.\n    @return: the audio delay (microseconds).\n    @version: LibVLC 1.1.1 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_get_delay', None) or \\\n        _Cfunction('libvlc_audio_get_delay', ((1,),), None,\n                    ctypes.c_int64, MediaPlayer)\n    return f(p_mi)\n\ndef libvlc_audio_set_delay(p_mi, i_delay):\n    '''Set current audio delay. The audio delay will be reset to zero each time the media changes.\n    @param p_mi: media player.\n    @param i_delay: the audio delay (microseconds).\n    @return: 0 on success, -1 on error.\n    @version: LibVLC 1.1.1 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_set_delay', None) or \\\n        _Cfunction('libvlc_audio_set_delay', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_int64)\n    return f(p_mi, i_delay)\n\ndef libvlc_audio_equalizer_get_preset_count():\n    '''Get the number of equalizer presets.\n    @return: number of presets.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_equalizer_get_preset_count', None) or \\\n        _Cfunction('libvlc_audio_equalizer_get_preset_count', (), None,\n                    ctypes.c_uint)\n    return f()\n\ndef libvlc_audio_equalizer_get_preset_name(u_index):\n    '''Get the name of a particular equalizer preset.\n    This name can be used, for example, to prepare a preset label or menu in a user\n    interface.\n    @param u_index: index of the preset, counting from zero.\n    @return: preset name, or None if there is no such preset.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_equalizer_get_preset_name', None) or \\\n        _Cfunction('libvlc_audio_equalizer_get_preset_name', ((1,),), None,\n                    ctypes.c_char_p, ctypes.c_uint)\n    return f(u_index)\n\ndef libvlc_audio_equalizer_get_band_count():\n    '''Get the number of distinct frequency bands for an equalizer.\n    @return: number of frequency bands.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_equalizer_get_band_count', None) or \\\n        _Cfunction('libvlc_audio_equalizer_get_band_count', (), None,\n                    ctypes.c_uint)\n    return f()\n\ndef libvlc_audio_equalizer_get_band_frequency(u_index):\n    '''Get a particular equalizer band frequency.\n    This value can be used, for example, to create a label for an equalizer band control\n    in a user interface.\n    @param u_index: index of the band, counting from zero.\n    @return: equalizer band frequency (Hz), or -1 if there is no such band.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_equalizer_get_band_frequency', None) or \\\n        _Cfunction('libvlc_audio_equalizer_get_band_frequency', ((1,),), None,\n                    ctypes.c_float, ctypes.c_uint)\n    return f(u_index)\n\ndef libvlc_audio_equalizer_new():\n    '''Create a new default equalizer, with all frequency values zeroed.\n    The new equalizer can subsequently be applied to a media player by invoking\n    L{libvlc_media_player_set_equalizer}().\n    The returned handle should be freed via L{libvlc_audio_equalizer_release}() when\n    it is no longer needed.\n    @return: opaque equalizer handle, or None on error.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_equalizer_new', None) or \\\n        _Cfunction('libvlc_audio_equalizer_new', (), None,\n                    ctypes.c_void_p)\n    return f()\n\ndef libvlc_audio_equalizer_new_from_preset(u_index):\n    '''Create a new equalizer, with initial frequency values copied from an existing\n    preset.\n    The new equalizer can subsequently be applied to a media player by invoking\n    L{libvlc_media_player_set_equalizer}().\n    The returned handle should be freed via L{libvlc_audio_equalizer_release}() when\n    it is no longer needed.\n    @param u_index: index of the preset, counting from zero.\n    @return: opaque equalizer handle, or None on error.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_equalizer_new_from_preset', None) or \\\n        _Cfunction('libvlc_audio_equalizer_new_from_preset', ((1,),), None,\n                    ctypes.c_void_p, ctypes.c_uint)\n    return f(u_index)\n\ndef libvlc_audio_equalizer_release(p_equalizer):\n    '''Release a previously created equalizer instance.\n    The equalizer was previously created by using L{libvlc_audio_equalizer_new}() or\n    L{libvlc_audio_equalizer_new_from_preset}().\n    It is safe to invoke this method with a None p_equalizer parameter for no effect.\n    @param p_equalizer: opaque equalizer handle, or None.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_equalizer_release', None) or \\\n        _Cfunction('libvlc_audio_equalizer_release', ((1,),), None,\n                    None, ctypes.c_void_p)\n    return f(p_equalizer)\n\ndef libvlc_audio_equalizer_set_preamp(p_equalizer, f_preamp):\n    '''Set a new pre-amplification value for an equalizer.\n    The new equalizer settings are subsequently applied to a media player by invoking\n    L{libvlc_media_player_set_equalizer}().\n    The supplied amplification value will be clamped to the -20.0 to +20.0 range.\n    @param p_equalizer: valid equalizer handle, must not be None.\n    @param f_preamp: preamp value (-20.0 to 20.0 Hz).\n    @return: zero on success, -1 on error.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_equalizer_set_preamp', None) or \\\n        _Cfunction('libvlc_audio_equalizer_set_preamp', ((1,), (1,),), None,\n                    ctypes.c_int, ctypes.c_void_p, ctypes.c_float)\n    return f(p_equalizer, f_preamp)\n\ndef libvlc_audio_equalizer_get_preamp(p_equalizer):\n    '''Get the current pre-amplification value from an equalizer.\n    @param p_equalizer: valid equalizer handle, must not be None.\n    @return: preamp value (Hz).\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_equalizer_get_preamp', None) or \\\n        _Cfunction('libvlc_audio_equalizer_get_preamp', ((1,),), None,\n                    ctypes.c_float, ctypes.c_void_p)\n    return f(p_equalizer)\n\ndef libvlc_audio_equalizer_set_amp_at_index(p_equalizer, f_amp, u_band):\n    '''Set a new amplification value for a particular equalizer frequency band.\n    The new equalizer settings are subsequently applied to a media player by invoking\n    L{libvlc_media_player_set_equalizer}().\n    The supplied amplification value will be clamped to the -20.0 to +20.0 range.\n    @param p_equalizer: valid equalizer handle, must not be None.\n    @param f_amp: amplification value (-20.0 to 20.0 Hz).\n    @param u_band: index, counting from zero, of the frequency band to set.\n    @return: zero on success, -1 on error.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_equalizer_set_amp_at_index', None) or \\\n        _Cfunction('libvlc_audio_equalizer_set_amp_at_index', ((1,), (1,), (1,),), None,\n                    ctypes.c_int, ctypes.c_void_p, ctypes.c_float, ctypes.c_uint)\n    return f(p_equalizer, f_amp, u_band)\n\ndef libvlc_audio_equalizer_get_amp_at_index(p_equalizer, u_band):\n    '''Get the amplification value for a particular equalizer frequency band.\n    @param p_equalizer: valid equalizer handle, must not be None.\n    @param u_band: index, counting from zero, of the frequency band to get.\n    @return: amplification value (Hz); NaN if there is no such frequency band.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_audio_equalizer_get_amp_at_index', None) or \\\n        _Cfunction('libvlc_audio_equalizer_get_amp_at_index', ((1,), (1,),), None,\n                    ctypes.c_float, ctypes.c_void_p, ctypes.c_uint)\n    return f(p_equalizer, u_band)\n\ndef libvlc_media_player_set_equalizer(p_mi, p_equalizer):\n    '''Apply new equalizer settings to a media player.\n    The equalizer is first created by invoking L{libvlc_audio_equalizer_new}() or\n    L{libvlc_audio_equalizer_new_from_preset}().\n    It is possible to apply new equalizer settings to a media player whether the media\n    player is currently playing media or not.\n    Invoking this method will immediately apply the new equalizer settings to the audio\n    output of the currently playing media if there is any.\n    If there is no currently playing media, the new equalizer settings will be applied\n    later if and when new media is played.\n    Equalizer settings will automatically be applied to subsequently played media.\n    To disable the equalizer for a media player invoke this method passing None for the\n    p_equalizer parameter.\n    The media player does not keep a reference to the supplied equalizer so it is safe\n    for an application to release the equalizer reference any time after this method\n    returns.\n    @param p_mi: opaque media player handle.\n    @param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player.\n    @return: zero on success, -1 on error.\n    @version: LibVLC 2.2.0 or later.\n    '''\n    f = _Cfunctions.get('libvlc_media_player_set_equalizer', None) or \\\n        _Cfunction('libvlc_media_player_set_equalizer', ((1,), (1,),), None,\n                    ctypes.c_int, MediaPlayer, ctypes.c_void_p)\n    return f(p_mi, p_equalizer)\n\ndef libvlc_media_list_player_new(p_instance):\n    '''Create new media_list_player.\n    @param p_instance: libvlc instance.\n    @return: media list player instance or None on error.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_new', None) or \\\n        _Cfunction('libvlc_media_list_player_new', ((1,),), class_result(MediaListPlayer),\n                    ctypes.c_void_p, Instance)\n    return f(p_instance)\n\ndef libvlc_media_list_player_release(p_mlp):\n    '''Release a media_list_player after use\n    Decrement the reference count of a media player object. If the\n    reference count is 0, then L{libvlc_media_list_player_release}() will\n    release the media player object. If the media player object\n    has been released, then it should not be used again.\n    @param p_mlp: media list player instance.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_release', None) or \\\n        _Cfunction('libvlc_media_list_player_release', ((1,),), None,\n                    None, MediaListPlayer)\n    return f(p_mlp)\n\ndef libvlc_media_list_player_retain(p_mlp):\n    '''Retain a reference to a media player list object. Use\n    L{libvlc_media_list_player_release}() to decrement reference count.\n    @param p_mlp: media player list object.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_retain', None) or \\\n        _Cfunction('libvlc_media_list_player_retain', ((1,),), None,\n                    None, MediaListPlayer)\n    return f(p_mlp)\n\ndef libvlc_media_list_player_event_manager(p_mlp):\n    '''Return the event manager of this media_list_player.\n    @param p_mlp: media list player instance.\n    @return: the event manager.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_event_manager', None) or \\\n        _Cfunction('libvlc_media_list_player_event_manager', ((1,),), class_result(EventManager),\n                    ctypes.c_void_p, MediaListPlayer)\n    return f(p_mlp)\n\ndef libvlc_media_list_player_set_media_player(p_mlp, p_mi):\n    '''Replace media player in media_list_player with this instance.\n    @param p_mlp: media list player instance.\n    @param p_mi: media player instance.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_set_media_player', None) or \\\n        _Cfunction('libvlc_media_list_player_set_media_player', ((1,), (1,),), None,\n                    None, MediaListPlayer, MediaPlayer)\n    return f(p_mlp, p_mi)\n\ndef libvlc_media_list_player_set_media_list(p_mlp, p_mlist):\n    '''Set the media list associated with the player.\n    @param p_mlp: media list player instance.\n    @param p_mlist: list of media.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_set_media_list', None) or \\\n        _Cfunction('libvlc_media_list_player_set_media_list', ((1,), (1,),), None,\n                    None, MediaListPlayer, MediaList)\n    return f(p_mlp, p_mlist)\n\ndef libvlc_media_list_player_play(p_mlp):\n    '''Play media list.\n    @param p_mlp: media list player instance.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_play', None) or \\\n        _Cfunction('libvlc_media_list_player_play', ((1,),), None,\n                    None, MediaListPlayer)\n    return f(p_mlp)\n\ndef libvlc_media_list_player_pause(p_mlp):\n    '''Toggle pause (or resume) media list.\n    @param p_mlp: media list player instance.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_pause', None) or \\\n        _Cfunction('libvlc_media_list_player_pause', ((1,),), None,\n                    None, MediaListPlayer)\n    return f(p_mlp)\n\ndef libvlc_media_list_player_is_playing(p_mlp):\n    '''Is media list playing?\n    @param p_mlp: media list player instance.\n    @return: true for playing and false for not playing \\libvlc_return_bool.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_is_playing', None) or \\\n        _Cfunction('libvlc_media_list_player_is_playing', ((1,),), None,\n                    ctypes.c_int, MediaListPlayer)\n    return f(p_mlp)\n\ndef libvlc_media_list_player_get_state(p_mlp):\n    '''Get current libvlc_state of media list player.\n    @param p_mlp: media list player instance.\n    @return: libvlc_state_t for media list player.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_get_state', None) or \\\n        _Cfunction('libvlc_media_list_player_get_state', ((1,),), None,\n                    State, MediaListPlayer)\n    return f(p_mlp)\n\ndef libvlc_media_list_player_play_item_at_index(p_mlp, i_index):\n    '''Play media list item at position index.\n    @param p_mlp: media list player instance.\n    @param i_index: index in media list to play.\n    @return: 0 upon success -1 if the item wasn't found.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_play_item_at_index', None) or \\\n        _Cfunction('libvlc_media_list_player_play_item_at_index', ((1,), (1,),), None,\n                    ctypes.c_int, MediaListPlayer, ctypes.c_int)\n    return f(p_mlp, i_index)\n\ndef libvlc_media_list_player_play_item(p_mlp, p_md):\n    '''Play the given media item.\n    @param p_mlp: media list player instance.\n    @param p_md: the media instance.\n    @return: 0 upon success, -1 if the media is not part of the media list.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_play_item', None) or \\\n        _Cfunction('libvlc_media_list_player_play_item', ((1,), (1,),), None,\n                    ctypes.c_int, MediaListPlayer, Media)\n    return f(p_mlp, p_md)\n\ndef libvlc_media_list_player_stop(p_mlp):\n    '''Stop playing media list.\n    @param p_mlp: media list player instance.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_stop', None) or \\\n        _Cfunction('libvlc_media_list_player_stop', ((1,),), None,\n                    None, MediaListPlayer)\n    return f(p_mlp)\n\ndef libvlc_media_list_player_next(p_mlp):\n    '''Play next item from media list.\n    @param p_mlp: media list player instance.\n    @return: 0 upon success -1 if there is no next item.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_next', None) or \\\n        _Cfunction('libvlc_media_list_player_next', ((1,),), None,\n                    ctypes.c_int, MediaListPlayer)\n    return f(p_mlp)\n\ndef libvlc_media_list_player_previous(p_mlp):\n    '''Play previous item from media list.\n    @param p_mlp: media list player instance.\n    @return: 0 upon success -1 if there is no previous item.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_previous', None) or \\\n        _Cfunction('libvlc_media_list_player_previous', ((1,),), None,\n                    ctypes.c_int, MediaListPlayer)\n    return f(p_mlp)\n\ndef libvlc_media_list_player_set_playback_mode(p_mlp, e_mode):\n    '''Sets the playback mode for the playlist.\n    @param p_mlp: media list player instance.\n    @param e_mode: playback mode specification.\n    '''\n    f = _Cfunctions.get('libvlc_media_list_player_set_playback_mode', None) or \\\n        _Cfunction('libvlc_media_list_player_set_playback_mode', ((1,), (1,),), None,\n                    None, MediaListPlayer, PlaybackMode)\n    return f(p_mlp, e_mode)\n\n\n# 4 function(s) blacklisted:\n#  libvlc_audio_output_get_device_type\n#  libvlc_audio_output_set_device_type\n#  libvlc_printerr\n#  libvlc_set_exit_handler\n\n# 32 function(s) not wrapped as methods:\n#  libvlc_audio_equalizer_get_amp_at_index\n#  libvlc_audio_equalizer_get_band_count\n#  libvlc_audio_equalizer_get_band_frequency\n#  libvlc_audio_equalizer_get_preamp\n#  libvlc_audio_equalizer_get_preset_count\n#  libvlc_audio_equalizer_get_preset_name\n#  libvlc_audio_equalizer_new\n#  libvlc_audio_equalizer_new_from_preset\n#  libvlc_audio_equalizer_release\n#  libvlc_audio_equalizer_set_amp_at_index\n#  libvlc_audio_equalizer_set_preamp\n#  libvlc_audio_output_device_list_release\n#  libvlc_audio_output_list_release\n#  libvlc_clearerr\n#  libvlc_clock\n#  libvlc_event_type_name\n#  libvlc_free\n#  libvlc_get_changeset\n#  libvlc_get_compiler\n#  libvlc_get_version\n#  libvlc_log_clear\n#  libvlc_log_close\n#  libvlc_log_count\n#  libvlc_log_get_context\n#  libvlc_log_get_iterator\n#  libvlc_log_get_object\n#  libvlc_media_tracks_release\n#  libvlc_module_description_list_release\n#  libvlc_new\n#  libvlc_track_description_list_release\n#  libvlc_track_description_release\n#  libvlc_vprinterr\n\n# Start of footer.py #\n\n# Backward compatibility\ndef callbackmethod(callback):\n    \"\"\"Now obsolete @callbackmethod decorator.\"\"\"\n    return callback\n\n# libvlc_free is not present in some versions of libvlc. If it is not\n# in the library, then emulate it by calling libc.free\nif not hasattr(dll, 'libvlc_free'):\n    # need to find the free function in the C runtime. This is\n    # platform specific.\n    # For Linux and MacOSX\n    libc_path = find_library('c')\n    if libc_path:\n        libc = ctypes.CDLL(libc_path)\n        libvlc_free = libc.free\n    else:\n        # On win32, it is impossible to guess the proper lib to call\n        # (msvcrt, mingw...). Just ignore the call: it will memleak,\n        # but not prevent to run the application.\n        def libvlc_free(p):\n            pass\n\n    # ensure argtypes is right, because default type of int won't\n    # work on 64-bit systems\n    libvlc_free.argtypes = [ ctypes.c_void_p ]\n\n# Version functions\ndef _dot2int(v):\n    '''(INTERNAL) Convert 'i.i.i[.i]' str to int.\n    '''\n    t = [int(i) for i in v.split('.')]\n    if len(t) == 3:\n        t.append(0)\n    elif len(t) != 4:\n        raise ValueError('\"i.i.i[.i]\": %r' % (v,))\n    if min(t) < 0 or max(t) > 255:\n        raise ValueError('[0..255]: %r' % (v,))\n    i = t.pop(0)\n    while t:\n        i = (i << 8) + t.pop(0)\n    return i\n\ndef hex_version():\n    \"\"\"Return the version of these bindings in hex or 0 if unavailable.\n    \"\"\"\n    try:\n        return _dot2int(__version__)\n    except (NameError, ValueError):\n        return 0\n\ndef libvlc_hex_version():\n    \"\"\"Return the libvlc version in hex or 0 if unavailable.\n    \"\"\"\n    try:\n        return _dot2int(bytes_to_str(libvlc_get_version()).split()[0])\n    except ValueError:\n        return 0\n\ndef debug_callback(event, *args, **kwds):\n    '''Example callback, useful for debugging.\n    '''\n    l = ['event %s' % (event.type,)]\n    if args:\n        l.extend(map(str, args))\n    if kwds:\n        l.extend(sorted('%s=%s' % t for t in kwds.items()))\n    print('Debug callback (%s)' % ', '.join(l))\n\n\nif __name__ == '__main__':\n    logging.basicConfig(level=logging.DEBUG)\n    try:\n        from msvcrt import getch\n    except ImportError:\n        import termios\n        import tty\n\n        def getch():  # getchar(), getc(stdin)  #PYCHOK flake\n            fd = sys.stdin.fileno()\n            old = termios.tcgetattr(fd)\n            try:\n                tty.setraw(fd)\n                ch = sys.stdin.read(1)\n            finally:\n                termios.tcsetattr(fd, termios.TCSADRAIN, old)\n            return ch\n\n    def end_callback(event):\n        print('End of media stream (event %s)' % event.type)\n        sys.exit(0)\n\n    echo_position = False\n    def pos_callback(event, player):\n        if echo_position:\n            sys.stdout.write('\\r%s to %.2f%% (%.2f%%)' % (event.type,\n                                                          event.u.new_position * 100,\n                                                          player.get_position() * 100))\n            sys.stdout.flush()\n\n    def print_version():\n        \"\"\"Print version of this vlc.py and of the libvlc\"\"\"\n        try:\n            print('Build date: %s (%#x)' % (build_date, hex_version()))\n            print('LibVLC version: %s (%#x)' % (bytes_to_str(libvlc_get_version()), libvlc_hex_version()))\n            print('LibVLC compiler: %s' % bytes_to_str(libvlc_get_compiler()))\n            if plugin_path:\n                print('Plugin path: %s' % plugin_path)\n        except:\n            print('Error: %s' % sys.exc_info()[1])\n\n    if sys.argv[1:] and '-h' not in sys.argv[1:] and '--help' not in sys.argv[1:]:\n\n        movie = os.path.expanduser(sys.argv.pop())\n        if not os.access(movie, os.R_OK):\n            print('Error: %s file not readable' % movie)\n            sys.exit(1)\n\n        # Need --sub-source=marq in order to use marquee below\n        instance = Instance([\"--sub-source=marq\"] + sys.argv[1:])\n        try:\n            media = instance.media_new(movie)\n        except (AttributeError, NameError) as e:\n            print('%s: %s (%s %s vs LibVLC %s)' % (e.__class__.__name__, e,\n                                                   sys.argv[0], __version__,\n                                                   libvlc_get_version()))\n            sys.exit(1)\n        player = instance.media_player_new()\n        player.set_media(media)\n        player.play()\n\n        # Some marquee examples.  Marquee requires '--sub-source marq' in the\n        # Instance() call above, see <http://www.videolan.org/doc/play-howto/en/ch04.html>\n        player.video_set_marquee_int(VideoMarqueeOption.Enable, 1)\n        player.video_set_marquee_int(VideoMarqueeOption.Size, 24)  # pixels\n        player.video_set_marquee_int(VideoMarqueeOption.Position, Position.Bottom)\n        if False:  # only one marquee can be specified\n            player.video_set_marquee_int(VideoMarqueeOption.Timeout, 5000)  # millisec, 0==forever\n            t = media.get_mrl()  # movie\n        else:  # update marquee text periodically\n            player.video_set_marquee_int(VideoMarqueeOption.Timeout, 0)  # millisec, 0==forever\n            player.video_set_marquee_int(VideoMarqueeOption.Refresh, 1000)  # millisec (or sec?)\n            ##t = '$L / $D or $P at $T'\n            t = '%Y-%m-%d  %H:%M:%S'\n        player.video_set_marquee_string(VideoMarqueeOption.Text, str_to_bytes(t))\n\n        # Some event manager examples.  Note, the callback can be any Python\n        # callable and does not need to be decorated.  Optionally, specify\n        # any number of positional and/or keyword arguments to be passed\n        # to the callback (in addition to the first one, an Event instance).\n        event_manager = player.event_manager()\n        event_manager.event_attach(EventType.MediaPlayerEndReached,      end_callback)\n        event_manager.event_attach(EventType.MediaPlayerPositionChanged, pos_callback, player)\n\n        def mspf():\n            \"\"\"Milliseconds per frame\"\"\"\n            return int(1000 // (player.get_fps() or 25))\n\n        def print_info():\n            \"\"\"Print information about the media\"\"\"\n            try:\n                print_version()\n                media = player.get_media()\n                print('State: %s' % player.get_state())\n                print('Media: %s' % bytes_to_str(media.get_mrl()))\n                print('Track: %s/%s' % (player.video_get_track(), player.video_get_track_count()))\n                print('Current time: %s/%s' % (player.get_time(), media.get_duration()))\n                print('Position: %s' % player.get_position())\n                print('FPS: %s (%d ms)' % (player.get_fps(), mspf()))\n                print('Rate: %s' % player.get_rate())\n                print('Video size: %s' % str(player.video_get_size(0)))  # num=0\n                print('Scale: %s' % player.video_get_scale())\n                print('Aspect ratio: %s' % player.video_get_aspect_ratio())\n               #print('Window:' % player.get_hwnd()\n            except Exception:\n                print('Error: %s' % sys.exc_info()[1])\n\n        def sec_forward():\n            \"\"\"Go forward one sec\"\"\"\n            player.set_time(player.get_time() + 1000)\n\n        def sec_backward():\n            \"\"\"Go backward one sec\"\"\"\n            player.set_time(player.get_time() - 1000)\n\n        def frame_forward():\n            \"\"\"Go forward one frame\"\"\"\n            player.set_time(player.get_time() + mspf())\n\n        def frame_backward():\n            \"\"\"Go backward one frame\"\"\"\n            player.set_time(player.get_time() - mspf())\n\n        def print_help():\n            \"\"\"Print help\"\"\"\n            print('Single-character commands:')\n            for k, m in sorted(keybindings.items()):\n                m = (m.__doc__ or m.__name__).splitlines()[0]\n                print('  %s: %s.' % (k, m.rstrip('.')))\n            print('0-9: go to that fraction of the movie')\n\n        def quit_app():\n            \"\"\"Stop and exit\"\"\"\n            sys.exit(0)\n\n        def toggle_echo_position():\n            \"\"\"Toggle echoing of media position\"\"\"\n            global echo_position\n            echo_position = not echo_position\n\n        keybindings = {\n            ' ': player.pause,\n            '+': sec_forward,\n            '-': sec_backward,\n            '.': frame_forward,\n            ',': frame_backward,\n            'f': player.toggle_fullscreen,\n            'i': print_info,\n            'p': toggle_echo_position,\n            'q': quit_app,\n            '?': print_help,\n            }\n\n        print('Press q to quit, ? to get help.%s' % os.linesep)\n        while True:\n            k = getch()\n            print('> %s' % k)\n            if k in keybindings:\n                keybindings[k]()\n            elif k.isdigit():\n                 # jump to fraction of the movie.\n                player.set_position(float('0.'+k))\n\n    else:\n        print('Usage: %s [options] <movie_filename>' % sys.argv[0])\n        print('Once launched, type ? for help.')\n        print('')\n        print_version()\n"
  },
  {
    "path": "generated/3.0/COPYING",
    "content": "                  GNU LESSER GENERAL PUBLIC LICENSE\n                       Version 2.1, February 1999\n\n Copyright (C) 1991, 1999 Free Software Foundation, Inc.\n 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n[This is the first released version of the Lesser GPL.  It also counts\n as the successor of the GNU Library Public License, version 2, hence\n the version number 2.1.]\n\n                            Preamble\n\n  The licenses for most software are designed to take away your\nfreedom to share and change it.  By contrast, the GNU General Public\nLicenses are intended to guarantee your freedom to share and change\nfree software--to make sure the software is free for all its users.\n\n  This license, the Lesser General Public License, applies to some\nspecially designated software packages--typically libraries--of the\nFree Software Foundation and other authors who decide to use it.  You\ncan use it too, but we suggest you first think carefully about whether\nthis license or the ordinary General Public License is the better\nstrategy to use in any particular case, based on the explanations below.\n\n  When we speak of free software, we are referring to freedom of use,\nnot price.  Our General Public Licenses are designed to make sure that\nyou have the freedom to distribute copies of free software (and charge\nfor this service if you wish); that you receive source code or can get\nit if you want it; that you can change the software and use pieces of\nit in new free programs; and that you are informed that you can do\nthese things.\n\n  To protect your rights, we need to make restrictions that forbid\ndistributors to deny you these rights or to ask you to surrender these\nrights.  These restrictions translate to certain responsibilities for\nyou if you distribute copies of the library or if you modify it.\n\n  For example, if you distribute copies of the library, whether gratis\nor for a fee, you must give the recipients all the rights that we gave\nyou.  You must make sure that they, too, receive or can get the source\ncode.  If you link other code with the library, you must provide\ncomplete object files to the recipients, so that they can relink them\nwith the library after making changes to the library and recompiling\nit.  And you must show them these terms so they know their rights.\n\n  We protect your rights with a two-step method: (1) we copyright the\nlibrary, and (2) we offer you this license, which gives you legal\npermission to copy, distribute and/or modify the library.\n\n  To protect each distributor, we want to make it very clear that\nthere is no warranty for the free library.  Also, if the library is\nmodified by someone else and passed on, the recipients should know\nthat what they have is not the original version, so that the original\nauthor's reputation will not be affected by problems that might be\nintroduced by others.\n\f\n  Finally, software patents pose a constant threat to the existence of\nany free program.  We wish to make sure that a company cannot\neffectively restrict the users of a free program by obtaining a\nrestrictive license from a patent holder.  Therefore, we insist that\nany patent license obtained for a version of the library must be\nconsistent with the full freedom of use specified in this license.\n\n  Most GNU software, including some libraries, is covered by the\nordinary GNU General Public License.  This license, the GNU Lesser\nGeneral Public License, applies to certain designated libraries, and\nis quite different from the ordinary General Public License.  We use\nthis license for certain libraries in order to permit linking those\nlibraries into non-free programs.\n\n  When a program is linked with a library, whether statically or using\na shared library, the combination of the two is legally speaking a\ncombined work, a derivative of the original library.  The ordinary\nGeneral Public License therefore permits such linking only if the\nentire combination fits its criteria of freedom.  The Lesser General\nPublic License permits more lax criteria for linking other code with\nthe library.\n\n  We call this license the \"Lesser\" General Public License because it\ndoes Less to protect the user's freedom than the ordinary General\nPublic License.  It also provides other free software developers Less\nof an advantage over competing non-free programs.  These disadvantages\nare the reason we use the ordinary General Public License for many\nlibraries.  However, the Lesser license provides advantages in certain\nspecial circumstances.\n\n  For example, on rare occasions, there may be a special need to\nencourage the widest possible use of a certain library, so that it becomes\na de-facto standard.  To achieve this, non-free programs must be\nallowed to use the library.  A more frequent case is that a free\nlibrary does the same job as widely used non-free libraries.  In this\ncase, there is little to gain by limiting the free library to free\nsoftware only, so we use the Lesser General Public License.\n\n  In other cases, permission to use a particular library in non-free\nprograms enables a greater number of people to use a large body of\nfree software.  For example, permission to use the GNU C Library in\nnon-free programs enables many more people to use the whole GNU\noperating system, as well as its variant, the GNU/Linux operating\nsystem.\n\n  Although the Lesser General Public License is Less protective of the\nusers' freedom, it does ensure that the user of a program that is\nlinked with the Library has the freedom and the wherewithal to run\nthat program using a modified version of the Library.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.  Pay close attention to the difference between a\n\"work based on the library\" and a \"work that uses the library\".  The\nformer contains code derived from the library, whereas the latter must\nbe combined with the library in order to run.\n\f\n                  GNU LESSER GENERAL PUBLIC LICENSE\n   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n\n  0. This License Agreement applies to any software library or other\nprogram which contains a notice placed by the copyright holder or\nother authorized party saying it may be distributed under the terms of\nthis Lesser General Public License (also called \"this License\").\nEach licensee is addressed as \"you\".\n\n  A \"library\" means a collection of software functions and/or data\nprepared so as to be conveniently linked with application programs\n(which use some of those functions and data) to form executables.\n\n  The \"Library\", below, refers to any such software library or work\nwhich has been distributed under these terms.  A \"work based on the\nLibrary\" means either the Library or any derivative work under\ncopyright law: that is to say, a work containing the Library or a\nportion of it, either verbatim or with modifications and/or translated\nstraightforwardly into another language.  (Hereinafter, translation is\nincluded without limitation in the term \"modification\".)\n\n  \"Source code\" for a work means the preferred form of the work for\nmaking modifications to it.  For a library, complete source code means\nall the source code for all modules it contains, plus any associated\ninterface definition files, plus the scripts used to control compilation\nand installation of the library.\n\n  Activities other than copying, distribution and modification are not\ncovered by this License; they are outside its scope.  The act of\nrunning a program using the Library is not restricted, and output from\nsuch a program is covered only if its contents constitute a work based\non the Library (independent of the use of the Library in a tool for\nwriting it).  Whether that is true depends on what the Library does\nand what the program that uses the Library does.\n\n  1. You may copy and distribute verbatim copies of the Library's\ncomplete source code as you receive it, in any medium, provided that\nyou conspicuously and appropriately publish on each copy an\nappropriate copyright notice and disclaimer of warranty; keep intact\nall the notices that refer to this License and to the absence of any\nwarranty; and distribute a copy of this License along with the\nLibrary.\n\n  You may charge a fee for the physical act of transferring a copy,\nand you may at your option offer warranty protection in exchange for a\nfee.\n\f\n  2. You may modify your copy or copies of the Library or any portion\nof it, thus forming a work based on the Library, and copy and\ndistribute such modifications or work under the terms of Section 1\nabove, provided that you also meet all of these conditions:\n\n    a) The modified work must itself be a software library.\n\n    b) You must cause the files modified to carry prominent notices\n    stating that you changed the files and the date of any change.\n\n    c) You must cause the whole of the work to be licensed at no\n    charge to all third parties under the terms of this License.\n\n    d) If a facility in the modified Library refers to a function or a\n    table of data to be supplied by an application program that uses\n    the facility, other than as an argument passed when the facility\n    is invoked, then you must make a good faith effort to ensure that,\n    in the event an application does not supply such function or\n    table, the facility still operates, and performs whatever part of\n    its purpose remains meaningful.\n\n    (For example, a function in a library to compute square roots has\n    a purpose that is entirely well-defined independent of the\n    application.  Therefore, Subsection 2d requires that any\n    application-supplied function or table used by this function must\n    be optional: if the application does not supply it, the square\n    root function must still compute square roots.)\n\nThese requirements apply to the modified work as a whole.  If\nidentifiable sections of that work are not derived from the Library,\nand can be reasonably considered independent and separate works in\nthemselves, then this License, and its terms, do not apply to those\nsections when you distribute them as separate works.  But when you\ndistribute the same sections as part of a whole which is a work based\non the Library, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the\nentire whole, and thus to each and every part regardless of who wrote\nit.\n\nThus, it is not the intent of this section to claim rights or contest\nyour rights to work written entirely by you; rather, the intent is to\nexercise the right to control the distribution of derivative or\ncollective works based on the Library.\n\nIn addition, mere aggregation of another work not based on the Library\nwith the Library (or with a work based on the Library) on a volume of\na storage or distribution medium does not bring the other work under\nthe scope of this License.\n\n  3. You may opt to apply the terms of the ordinary GNU General Public\nLicense instead of this License to a given copy of the Library.  To do\nthis, you must alter all the notices that refer to this License, so\nthat they refer to the ordinary GNU General Public License, version 2,\ninstead of to this License.  (If a newer version than version 2 of the\nordinary GNU General Public License has appeared, then you can specify\nthat version instead if you wish.)  Do not make any other change in\nthese notices.\n\f\n  Once this change is made in a given copy, it is irreversible for\nthat copy, so the ordinary GNU General Public License applies to all\nsubsequent copies and derivative works made from that copy.\n\n  This option is useful when you wish to copy part of the code of\nthe Library into a program that is not a library.\n\n  4. You may copy and distribute the Library (or a portion or\nderivative of it, under Section 2) in object code or executable form\nunder the terms of Sections 1 and 2 above provided that you accompany\nit with the complete corresponding machine-readable source code, which\nmust be distributed under the terms of Sections 1 and 2 above on a\nmedium customarily used for software interchange.\n\n  If distribution of object code is made by offering access to copy\nfrom a designated place, then offering equivalent access to copy the\nsource code from the same place satisfies the requirement to\ndistribute the source code, even though third parties are not\ncompelled to copy the source along with the object code.\n\n  5. A program that contains no derivative of any portion of the\nLibrary, but is designed to work with the Library by being compiled or\nlinked with it, is called a \"work that uses the Library\".  Such a\nwork, in isolation, is not a derivative work of the Library, and\ntherefore falls outside the scope of this License.\n\n  However, linking a \"work that uses the Library\" with the Library\ncreates an executable that is a derivative of the Library (because it\ncontains portions of the Library), rather than a \"work that uses the\nlibrary\".  The executable is therefore covered by this License.\nSection 6 states terms for distribution of such executables.\n\n  When a \"work that uses the Library\" uses material from a header file\nthat is part of the Library, the object code for the work may be a\nderivative work of the Library even though the source code is not.\nWhether this is true is especially significant if the work can be\nlinked without the Library, or if the work is itself a library.  The\nthreshold for this to be true is not precisely defined by law.\n\n  If such an object file uses only numerical parameters, data\nstructure layouts and accessors, and small macros and small inline\nfunctions (ten lines or less in length), then the use of the object\nfile is unrestricted, regardless of whether it is legally a derivative\nwork.  (Executables containing this object code plus portions of the\nLibrary will still fall under Section 6.)\n\n  Otherwise, if the work is a derivative of the Library, you may\ndistribute the object code for the work under the terms of Section 6.\nAny executables containing that work also fall under Section 6,\nwhether or not they are linked directly with the Library itself.\n\f\n  6. As an exception to the Sections above, you may also combine or\nlink a \"work that uses the Library\" with the Library to produce a\nwork containing portions of the Library, and distribute that work\nunder terms of your choice, provided that the terms permit\nmodification of the work for the customer's own use and reverse\nengineering for debugging such modifications.\n\n  You must give prominent notice with each copy of the work that the\nLibrary is used in it and that the Library and its use are covered by\nthis License.  You must supply a copy of this License.  If the work\nduring execution displays copyright notices, you must include the\ncopyright notice for the Library among them, as well as a reference\ndirecting the user to the copy of this License.  Also, you must do one\nof these things:\n\n    a) Accompany the work with the complete corresponding\n    machine-readable source code for the Library including whatever\n    changes were used in the work (which must be distributed under\n    Sections 1 and 2 above); and, if the work is an executable linked\n    with the Library, with the complete machine-readable \"work that\n    uses the Library\", as object code and/or source code, so that the\n    user can modify the Library and then relink to produce a modified\n    executable containing the modified Library.  (It is understood\n    that the user who changes the contents of definitions files in the\n    Library will not necessarily be able to recompile the application\n    to use the modified definitions.)\n\n    b) Use a suitable shared library mechanism for linking with the\n    Library.  A suitable mechanism is one that (1) uses at run time a\n    copy of the library already present on the user's computer system,\n    rather than copying library functions into the executable, and (2)\n    will operate properly with a modified version of the library, if\n    the user installs one, as long as the modified version is\n    interface-compatible with the version that the work was made with.\n\n    c) Accompany the work with a written offer, valid for at\n    least three years, to give the same user the materials\n    specified in Subsection 6a, above, for a charge no more\n    than the cost of performing this distribution.\n\n    d) If distribution of the work is made by offering access to copy\n    from a designated place, offer equivalent access to copy the above\n    specified materials from the same place.\n\n    e) Verify that the user has already received a copy of these\n    materials or that you have already sent this user a copy.\n\n  For an executable, the required form of the \"work that uses the\nLibrary\" must include any data and utility programs needed for\nreproducing the executable from it.  However, as a special exception,\nthe materials to be distributed need not include anything that is\nnormally distributed (in either source or binary form) with the major\ncomponents (compiler, kernel, and so on) of the operating system on\nwhich the executable runs, unless that component itself accompanies\nthe executable.\n\n  It may happen that this requirement contradicts the license\nrestrictions of other proprietary libraries that do not normally\naccompany the operating system.  Such a contradiction means you cannot\nuse both them and the Library together in an executable that you\ndistribute.\n\f\n  7. You may place library facilities that are a work based on the\nLibrary side-by-side in a single library together with other library\nfacilities not covered by this License, and distribute such a combined\nlibrary, provided that the separate distribution of the work based on\nthe Library and of the other library facilities is otherwise\npermitted, and provided that you do these two things:\n\n    a) Accompany the combined library with a copy of the same work\n    based on the Library, uncombined with any other library\n    facilities.  This must be distributed under the terms of the\n    Sections above.\n\n    b) Give prominent notice with the combined library of the fact\n    that part of it is a work based on the Library, and explaining\n    where to find the accompanying uncombined form of the same work.\n\n  8. You may not copy, modify, sublicense, link with, or distribute\nthe Library except as expressly provided under this License.  Any\nattempt otherwise to copy, modify, sublicense, link with, or\ndistribute the Library is void, and will automatically terminate your\nrights under this License.  However, parties who have received copies,\nor rights, from you under this License will not have their licenses\nterminated so long as such parties remain in full compliance.\n\n  9. You are not required to accept this License, since you have not\nsigned it.  However, nothing else grants you permission to modify or\ndistribute the Library or its derivative works.  These actions are\nprohibited by law if you do not accept this License.  Therefore, by\nmodifying or distributing the Library (or any work based on the\nLibrary), you indicate your acceptance of this License to do so, and\nall its terms and conditions for copying, distributing or modifying\nthe Library or works based on it.\n\n  10. Each time you redistribute the Library (or any work based on the\nLibrary), the recipient automatically receives a license from the\noriginal licensor to copy, distribute, link with or modify the Library\nsubject to these terms and conditions.  You may not impose any further\nrestrictions on the recipients' exercise of the rights granted herein.\nYou are not responsible for enforcing compliance by third parties with\nthis License.\n\f\n  11. If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues),\nconditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot\ndistribute so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you\nmay not distribute the Library at all.  For example, if a patent\nlicense would not permit royalty-free redistribution of the Library by\nall those who receive copies directly or indirectly through you, then\nthe only way you could satisfy both it and this License would be to\nrefrain entirely from distribution of the Library.\n\nIf any portion of this section is held invalid or unenforceable under any\nparticular circumstance, the balance of the section is intended to apply,\nand the section as a whole is intended to apply in other circumstances.\n\nIt is not the purpose of this section to induce you to infringe any\npatents or other property right claims or to contest validity of any\nsuch claims; this section has the sole purpose of protecting the\nintegrity of the free software distribution system which is\nimplemented by public license practices.  Many people have made\ngenerous contributions to the wide range of software distributed\nthrough that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing\nto distribute software through any other system and a licensee cannot\nimpose that choice.\n\nThis section is intended to make thoroughly clear what is believed to\nbe a consequence of the rest of this License.\n\n  12. If the distribution and/or use of the Library is restricted in\ncertain countries either by patents or by copyrighted interfaces, the\noriginal copyright holder who places the Library under this License may add\nan explicit geographical distribution limitation excluding those countries,\nso that distribution is permitted only in or among countries not thus\nexcluded.  In such case, this License incorporates the limitation as if\nwritten in the body of this License.\n\n  13. The Free Software Foundation may publish revised and/or new\nversions of the Lesser General Public License from time to time.\nSuch new versions will be similar in spirit to the present version,\nbut may differ in detail to address new problems or concerns.\n\nEach version is given a distinguishing version number.  If the Library\nspecifies a version number of this License which applies to it and\n\"any later version\", you have the option of following the terms and\nconditions either of that version or of any later version published by\nthe Free Software Foundation.  If the Library does not specify a\nlicense version number, you may choose any version ever published by\nthe Free Software Foundation.\n\f\n  14. If you wish to incorporate parts of the Library into other free\nprograms whose distribution conditions are incompatible with these,\nwrite to the author to ask for permission.  For software which is\ncopyrighted by the Free Software Foundation, write to the Free\nSoftware Foundation; we sometimes make exceptions for this.  Our\ndecision will be guided by the two goals of preserving the free status\nof all derivatives of our free software and of promoting the sharing\nand reuse of software generally.\n\n                            NO WARRANTY\n\n  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\nWARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\nEXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\nOTHER PARTIES PROVIDE THE LIBRARY \"AS IS\" WITHOUT WARRANTY OF ANY\nKIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\nLIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\nTHE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\nWRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\nAND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\nFOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\nCONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\nLIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\nRENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\nFAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\nSUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGES.\n\n                     END OF TERMS AND CONDITIONS\n\f\n           How to Apply These Terms to Your New Libraries\n\n  If you develop a new library, and you want it to be of the greatest\npossible use to the public, we recommend making it free software that\neveryone can redistribute and change.  You can do so by permitting\nredistribution under these terms (or, alternatively, under the terms of the\nordinary General Public License).\n\n  To apply these terms, attach the following notices to the library.  It is\nsafest to attach them to the start of each source file to most effectively\nconvey the exclusion of warranty; and each file should have at least the\n\"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the library's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This library is free software; you can redistribute it and/or\n    modify it under the terms of the GNU Lesser General Public\n    License as published by the Free Software Foundation; either\n    version 2.1 of the License, or (at your option) any later version.\n\n    This library is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n    Lesser General Public License for more details.\n\n    You should have received a copy of the GNU Lesser General Public\n    License along with this library; if not, write to the Free Software\n    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n\nAlso add information on how to contact you by electronic and paper mail.\n\nYou should also get your employer (if you work as a programmer) or your\nschool, if any, to sign a \"copyright disclaimer\" for the library, if\nnecessary.  Here is a sample; alter the names:\n\n  Yoyodyne, Inc., hereby disclaims all copyright interest in the\n  library `Frob' (a library for tweaking knobs) written by James Random Hacker.\n\n  <signature of Ty Coon>, 1 April 1990\n  Ty Coon, President of Vice\n\nThat's all there is to it!\n"
  },
  {
    "path": "generated/3.0/MANIFEST.in",
    "content": "include setup.py\ninclude vlc.py\ninclude COPYING MANIFEST.in README.module\ninclude distribute_setup.py\nrecursive-include examples *\n"
  },
  {
    "path": "generated/3.0/README.module",
    "content": "Python ctypes-based bindings for libvlc\n=======================================\n\nThe bindings use ctypes to directly call the libvlc dynamic lib, and\nthe code is generated from the include files defining the public\nAPI. The same module should be compatible with various versions of\nlibvlc 3.*. However, there may be incompatible changes between major\nversions.\n\nInstalling the module\n---------------------\n\nYou can install the module through PyPI:\n\n    pip install python-vlc\n\nUsing the module\n----------------\n\nThe module offers two ways of accessing the API - a raw access to all\nexported methods, and more convenient wrapper classes.\n\nUsing wrapper classes\n+++++++++++++++++++++\n\nMost major structures of the libvlc API (Instance, Media, MediaPlayer,\netc) are wrapped as classes, with shorter method names and some\nadaptations to provide a more pythonic API:\n\n    >>> import vlc\n    >>> player = vlc.MediaPlayer('file:///tmp/foo.avi')\n    >>> player.play()\n    >>> player.get_instance() # returns the corresponding instance\n\nIn this case, a default ``vlc.Instance`` will be instanciated and\nstored in ``vlc._default_instance``. It will be used to instanciate\nthe various classes (``Media``, ``MediaList``, ``MediaPlayer``, etc).\n\nYou also can use wrapper methods closer to the original libvlc API:\n\n    >>> import vlc\n    >>> instance = vlc.Instance('--no-audio', '--fullscreen')\n    >>> player = instance.media_player_new()\n    >>> player.audio_get_volume()\n    50\n    >>> media = instance.media_new('file:///tmp/foo.avi')\n    >>> media.get_mrl()\n    'file:///tmp/foo.avi'\n    >>> player.set_media(m)\n    >>> player.play()\n\nUsing raw access\n++++++++++++++++\n\nLibvlc methods are available as attributes of the vlc module (as\n  vlc.libvlc_*). Use their docstring (any introspective shell like\n  ipython is your friend) to explore them, or refer to the online\n  documentation at https://olivieraubert.net/vlc/python-ctypes/\n\n    >>> import vlc\n    >>> vlc.libvlc_get_version()\n    '3.0.0-rc2 Vetinari'\n    >>> exc = vlc.VLCException()\n    >>> instance = vlc.libvlc_new(0, [], exc)\n    >>> instance\n    <vlc.Instance object at 0x8384a4c>\n    >>> vlc.libvlc_audio_get_volume(instance, exc)\n    50\n\nExample code\n++++++++++++\n\nYou can find [example\nfiles](https://github.com/oaubert/python-vlc/tree/master/examples) in\nthe repository.\n\nNote that the ``vlc.py`` module can itself be invoked as an\napplication using its own features, which also serves as a API usage\nexample. See the [end of the\nmodule](https://github.com/oaubert/python-vlc/blob/master/generated/3.0/vlc.py#L12525)\nafter the line ``if __name__ == \"__main__\":``\n\nLicense\n-------\n\nThe generated module is licensed, like libvlc, under the GNU Lesser\nGeneral Public License 2.1 or later.\n"
  },
  {
    "path": "generated/3.0/examples/cocoavlc.py",
    "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n# Example of using PyCocoa <https://PyPI.org/project/PyCocoa> to create a\n# window, table and an application menu to run a video using VLC on macOS.\n# The Python-VLC binding <https://PyPI.Python.org/pypi/python-vlc> and the\n# corresponding VLC App, see <https://www.VideoLan.org/index.html>.\n\n# PyCocoa version 21.11.02 or later must be installed (on macOS Monterey)\n\n# This VLC player has been tested with VLC 3.0.10-16, 3.0.6-8, 3.0.4,\n# 3.0.1-2, 2.2.8 and 2.2.6 and the compatible vlc.py Python-VLC binding\n# using 64-bit Python 3.10.0, 3.9.6, 3.9.0-1, 3.8.10, 3.8.6, 3.7.0-4,\n# 3.6.4-5 and 2.7.14-18 on macOS 12.0.1 Monterey, 11.5.2-6.1 Big Sur\n# (aka 10.16), 10.15.6 Catalina, 10.14.6 Mojave and 10.13.4-6 High Sierra.\n# This player does not work with PyPy <https://PyPy.org> nor with Intel(R)\n# Python <https://Software.Intel.com/en-us/distribution-for-python>.\n\n# Python 3.10.0, 3.9.6 and macOS' Python 2.7.16 run on Apple Silicon\n# (C{arm64} I{natively}), all other Python versions run on Intel (C{x86_64})\n# or I{emulated} Intel (C{\"arm64_x86_64\"}, see function C{pycocoa.machine}).\n\n# MIT License <https://OpenSource.org/licenses/MIT>\n#\n# Copyright (C) 2017-2021 -- mrJean1 at Gmail -- All Rights Reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the \"Software\"),\n# to deal in the Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n# and/or sell copies of the Software, and to permit persons to whom the\n# Software is furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n# OTHER DEALINGS IN THE SOFTWARE.\n\ndef _PyPI(package):\n    return 'see <https://PyPI.org/project/%s>' % (package,)\n\n__all__  = ('AppVLC',)  # PYCHOK expected\n__version__ = '22.12.14'\n\ntry:\n    import vlc\nexcept ImportError:\n    raise ImportError('no %s, %s' % ('vlc.py', _PyPI('Python-VLC')))\ntry:\n    from pycocoa import __name__    as _pycocoa_, \\\n                        __version__ as _pycocoa_version\nexcept ImportError:\n    raise ImportError('no %s, %s' % (_pycocoa_, _PyPI('PyCocoa')))\nif _pycocoa_version < '21.11.04':  # __version__\n    raise ImportError('%s %s or later required, %s' % (\n                      _pycocoa_, '21.11.04', _PyPI('PyCocoa')))\ndel _PyPI\n\n# all imports listed explicitly to help PyChecker\nfrom pycocoa import App, app_title, aspect_ratio, bytes2str, closeTables, \\\n                    get_printer, Item, ItemSeparator, machine, MediaWindow, Menu, \\\n                    OpenPanel, printf, str2bytes, Table, z1000str, zSIstr\n\nfrom os.path import basename, getsize, isfile, splitext\nfrom platform import architecture, mac_ver\nimport sys\nfrom threading import Thread\nfrom time import sleep, strftime, strptime\ntry:\n    from urllib import unquote as mrl_unquote  # Python 2\nexcept ImportError:\n    from urllib.parse import unquote as mrl_unquote  # Python 3+\n\n_Adjust  = vlc.VideoAdjustOption  # Enum\n# <https://Wiki.VideoLan.org/Documentation:Modules/adjust>\n_Adjust3 = {_Adjust.Brightness: (0, 1, 2),\n            _Adjust.Contrast:   (0, 1, 2),\n            _Adjust.Gamma:   (0.01, 1, 10),\n            _Adjust.Hue:     (-180, 0, 180),\n            _Adjust.Saturation: (0, 1, 3)}\n_AppleSi = machine().startswith('arm64')\n_Argv0   = splitext(basename(__file__))[0]\n_Movies  = '.m4v', '.mov', '.mp4'  # lower-case file types for movies, videos\n_PNG     = '.png'  # snapshot always .png, even if .jpg or .tiff specified\n_Python  = sys.version.split()[0], architecture()[0]  # PYCHOK false\n_Select  = 'Select a video file from the panel'\n_VLC_3_  = vlc.__version__.split('.')[0] > '2' and \\\n           bytes2str(vlc.libvlc_get_version().split(b'.')[0]) > '2'\n\n\n# <https://Wiki.Videolan.org/Documentation:Modules/marq/#appendix_marq-color>\nclass _Color(object):  # PYCHOK expected\n    Aqua    = 0x00FFFF\n    Black   = 0x000000\n    Blue    = 0x0000FF\n    Fuchsia = 0xFF00FF\n    Gray    = 0x808080\n    Green   = 0x008000\n    Lime    = 0x00FF00\n    Maroon  = 0x800000\n    Navy    = 0x000080\n    Olive   = 0x808000\n    Purple  = 0x800080\n    Red     = 0xFF0000\n    Silver  = 0xC0C0C0\n    Teal    = 0x008080\n    White   = 0xFFFFFF\n    Yellow  = 0xFFFF00\n\n_Color = _Color()  # PYCHOK enum-like\n\n\ndef _fstrz(f, n=1, x=''):\n    # format float, strip trailing decimal zeros and point\n    return _fstrz0(f, n).rstrip('.') + x\n\n\ndef _fstrz0(f, n=1, x=''):\n    # format float, strip trailing decimal zeros\n    t = '%.*f' % (n, f)\n    return t.rstrip('0') + x\n\n\ndef _fstrz1(f, n=1, x=''):\n    # format float, strip trailing decimal zeros, except one\n    t = _fstrz0(f, n)\n    if t.endswith('.'):\n        t += '0'\n    return t + x\n\n\ndef _macOS(sep=None):\n    # get macOS version and extended platform.machine\n    t = 'macOS', mac_ver()[0], machine()\n    return sep.join(t) if sep else t\n\n\ndef _mspf(fps):\n    # convert frames per second to frame length in millisecs per frame\n    return 1000.0 / (fps or 25)\n\n\ndef _ms2str(ms):\n    # convert milliseconds to seconds string\n    return _fstrz1(max(ms, 0) * 0.001, 3, ' s')\n\n\ndef _ratio2str(by, *w_h):\n    # aspect ratio as string\n    return by.join(map(str, (w_h + ('-', '-'))[:2]))\n\n\nclass AppVLC(App):\n    '''The application with callback methods for C{app..._},\n       C{menu..._} and C{window..._} events.\n\n       Set things up inside the C{.__init__} and C{.appLauched_}\n       methods, start by calling the C{.run} method.\n    '''\n    adjustr   = ''\n    marquee   = None\n    media     = None\n    logostr   = ''\n    player    = None\n    raiser    = False\n    rate      = 0.0   # rate vs normal\n    scale     = 0.0   # video size / window size\n    sized     = None  # video (width, height)\n    Snapshot  = Item('Snapshot', key='s', alt=True)\n    snapshot  = _PNG  # default: .png, .jpg or .tiff\n    snapshots = 0\n    Toggle    = None\n    video     = None\n    window    = None\n    zoomX     = 1.0   # zoom factor, >= 1.0\n\n    def __init__(self, video=None,       # video file name\n                       adjustr='',       # vlc.VideoAdjustOption\n                       logostr='',       # vlc.VideoLogoOption\n                       marquee=False,    # vlc.VideoMarqueeOption\n                       raiser=False,     # re-raise errors\n                       snapshot=_PNG,    # png, other formats\n                       title='AppVLC'):  # window title\n        super(AppVLC, self).__init__(raiser=raiser, title=title)\n        self.adjustr = adjustr\n        self.logostr = logostr\n        self.marquee = marquee\n#       self.media   = None\n        self.raiser  = raiser\n        self.Toggle  = Item('Play', self.menuToggle_, key='p', ctrl=True)\n        self.video   = video\n\n        if snapshot != AppVLC.snapshot:\n            self.snapshot = '.' + snapshot.lstrip('.').lower()\n        if self.snapshot in (_PNG,):  # only .PNG works, using .JPG ...\n            # ... or .TIFF is OK, but the snapshot image is always .PNG\n            self.player = vlc.MediaPlayer()\n#       elif self.snapshot in (_JPG, _PNG, _TIFF):  # XXX doesn't work\n#           i = vlc.Instance('--snapshot-format', self.snapshot[1:])  # --verbose 2\n#           self.player = i.media_player_new()\n        else:\n            raise ValueError('invalid %s format: %r' % ('snapshot', snapshot))\n\n    def appLaunched_(self, app):\n        super(AppVLC, self).appLaunched_(app)\n        self.window = MediaWindow(title=self.video or self.title)\n\n        if self.player and self.video and isfile(self.video):\n            # the VLC player on macOS needs an ObjC NSView\n            self.media = self.player.set_mrl(self.video)\n            self.player.set_nsobject(self.window.NSview)\n\n            # if this window is on an external screen,\n            # move it to the built-in screen, aka 0\n            # if not self.window.screen.isBuiltIn:\n            #     self.window.screen = 0  # == BuiltIn\n\n            if self.adjustr:  # preset video options\n                for o in self.adjustr.lower().split(','):\n                    o, v = o.strip().split('=')\n                    o = getattr(_Adjust, o.capitalize(), None)\n                    if o is not None:\n                        self._VLCadjust(o, value=v)\n\n            if self.marquee:  # set up marquee\n                self._VLCmarquee()\n\n            if self.logostr:  # show logo\n                self._VLClogo(self.logostr)\n\n            menu = Menu('VLC')\n            menu.append(\n                # the action/method name for each item\n                # is string 'menu' + item.title + '_',\n                # without any spaces and trailing dots,\n                # see function pycocoa.title2action.\n                Item('Open...', key='o'),\n                ItemSeparator(),\n                self.Toggle,  # Play >< Pause\n                Item('Rewind', key='r', ctrl=True),\n                ItemSeparator(),\n                Item('Info',  key='i'),\n                Item('Close', key='w'),\n                ItemSeparator(),\n                Item('Zoom In',  key='+', shift=True),\n                Item('Zoom Out', key='-'),\n                ItemSeparator(),\n                Item('Faster', key='>', shift=True),\n                Item('Slower', key='<', shift=True))\n            if _VLC_3_:\n                menu.append(\n                    ItemSeparator(),\n                    Item('Brighter', key='b', shift=True),\n                    Item('Darker',   key='d', shift=True))\n            menu.append(\n                ItemSeparator(),\n                Item('Normal 1X', key='='),\n                ItemSeparator(),\n                Item('Audio Filters', self.menuFilters_, key='a', shift=True),\n                Item('Video Filters', self.menuFilters_, key='v', shift=True),\n                ItemSeparator(),\n                self.Snapshot)\n            self.append(menu)\n\n        self.menuPlay_(None)\n        self.window.front()\n\n    def menuBrighter_(self, item):\n        self._brightness(item, +0.1)\n\n    def menuClose_(self, item):  # PYCHOK expected\n        # close window(s) from menu Cmd+W\n        # printf('%s %r', 'close_', item)\n        if not closeTables():\n            self.terminate()\n\n    def menuDarker_(self, item):\n        self._brightness(item, -0.1)\n\n    def menuFaster_(self, item):\n        self._rate(item, 1.25)\n\n    def menuFilters_(self, item):\n        try:\n            self.menuPause_(item)\n            # display a table of audio/video filters\n            t = Table(' Name:150:bold', ' Short:150:Center:center', ' Long:300', 'Help')\n            i = self.player.get_instance()\n            b = item.title.split()[0]\n            for f in sorted(i.audio_filter_list_get() if b == 'Audio'\n                       else i.video_filter_list_get()):\n                while f and not f[-1]:  # \"rstrip\" None\n                    f = f[:-1]\n                t.append(*map(bytes2str, f))\n\n            t.display('VLC %s Filters' % (b,), width=800)\n\n        except Exception as x:\n            if self.raiser:\n                raise\n            printf('%s', x, nl=1, nt=1)\n\n    def menuInfo_(self, item):\n        try:\n            self.menuPause_(item)\n            # display Python, vlc, libVLC, media info table\n            p = self.player\n            m = p.get_media()\n\n            t = Table(' Name:bold', ' Value:200:Center:center', ' Alt:100')\n            t.append(_Argv0, __version__, '20' + __version__)\n            t.append('PyCocoa', _pycocoa_version, '20' + _pycocoa_version)\n            t.append('Python', *_Python)\n            t.append(*_macOS())\n            x = 'built-in' if self.window.screen.isBuiltIn else 'external'\n            t.append('screen', x, str(self.window.screen.displayID))\n            t.separator()\n\n            t.append('vlc.py', vlc.__version__, hex(vlc.hex_version()))\n            b = ' '.join(vlc.build_date.split()[:5])\n            t.append('built', strftime('%x', strptime(b, '%c')), vlc.build_date)\n            t.separator()\n            t.append('libVLC', bytes2str(vlc.libvlc_get_version()), hex(vlc.libvlc_hex_version()))\n            t.append('libVLC', *bytes2str(vlc.libvlc_get_compiler()).split(None, 1))\n            t.separator()\n\n            f = mrl_unquote(bytes2str(m.get_mrl()))\n            t.append('media', basename(f), f)\n            if f.lower().startswith('file://'):\n                z = getsize(f[7:])\n                t.append('size', z1000str(z), zSIstr(z))\n            t.append('state', str(p.get_state()))\n            f = max(p.get_position(), 0)\n            t.append('position/length', _fstrz(f * 100, 2), _ms2str(p.get_length()))\n            f = map(_ms2str, (p.get_time(), m.get_duration()))\n            t.append('time/duration', *f)\n            t.append('track/count', z1000str(p.video_get_track()), z1000str(p.video_get_track_count()))\n            t.separator()\n\n            f = p.get_fps()\n            t.append('fps/mspf', _fstrz(f, 5), _fstrz(_mspf(f), 3, ' ms'))\n            r = p.get_rate()\n            t.append('rate', r, '%s%%' % (int(r * 100),))\n            a, b = p.video_get_size(0)  # num=0\n            w, h = map(int, self.window.frame.size.size)\n            t.append('video size', _ratio2str('x', a, b), _ratio2str('x', w, h))\n            r = _ratio2str(':', *aspect_ratio(a, b))  # p.video_get_aspect_ratio()\n            t.append('aspect ratio', r, _ratio2str(':', *self.window.ratio))\n            t.append('scale', _fstrz1(p.video_get_scale(), 3), _fstrz(self.zoomX, 2, 'X'))\n            t.separator()\n\n            def VLCadjustr3(f, option):  # get option value\n                lo, _, hi = _Adjust3[option]\n                v = f(option)\n                p = max(0, (v - lo)) * 100.0 / (hi - lo)\n                n = str(option).split('.')[-1]  # 'VideoAdjustOption.Xyz'\n                return n.lower(), _fstrz1(v, 2), _fstrz(p, 1, '%')\n\n            f = self.player.video_get_adjust_float\n            t.append(*VLCadjustr3(f, _Adjust.Brightness))\n            t.append(*VLCadjustr3(f, _Adjust.Contrast))\n            t.append(*VLCadjustr3(f, _Adjust.Gamma))\n            t.append(*VLCadjustr3(f, _Adjust.Hue))\n            t.append(*VLCadjustr3(f, _Adjust.Saturation))\n            t.separator()\n\n            s = vlc.MediaStats()  # re-use single MediaStats instance?\n            if m.get_stats(s):\n\n                def Kops2bpstr2(bitrate):  # convert Ko/s to bits/sec\n                    # bitrates are conventionally in kilo-octets-per-sec\n                    return zSIstr(bitrate * 8000, B='bps', K=1000).split()\n\n                t.append('media read',     *zSIstr(s.read_bytes).split())\n                t.append('input bitrate',  *Kops2bpstr2(s.input_bitrate))\n                if s.input_bitrate > 0:  # XXX approximate caching, based\n                    # on <https://GitHub.com/oaubert/python-vlc/issues/61>\n                    b = s.read_bytes - s.demux_read_bytes\n                    t.append('input caching', _ms2str(b / s.input_bitrate), zSIstr(b))\n                t.append('demux read',     *zSIstr(s.demux_read_bytes).split())\n                t.append('stream bitrate', *Kops2bpstr2(s.demux_bitrate))\n\n                t.append('video decoded', z1000str(s.decoded_video),      'blocks')\n                t.append('video played',  z1000str(s.displayed_pictures), 'frames')\n                t.append('video lost',    z1000str(s.lost_pictures),      'frames')\n\n                t.append('audio decoded', z1000str(s.decoded_audio),   'blocks')\n                t.append('audio played',  z1000str(s.played_abuffers), 'buffers')\n                t.append('audio lost',    z1000str(s.lost_abuffers),   'buffers')\n\n            t.display('Python, VLC & Media Information', width=500)\n\n        except Exception as x:\n            if self.raiser:\n                raise\n            printf('%s', x, nl=1, nt=1)\n\n    def menuNormal1X_(self, item):\n        # set rate and zoom to 1X\n        self._brightness(item)\n#       self._contrast(item)\n#       self._gamma(item)\n#       self._hue(item)\n        self._rate(item)\n#       self._saturation(item)\n        self._zoom(item)\n\n    def menuOpen_(self, item):\n        # stop the current video and show\n        # the panel to select another video\n        self.menuPause_(item)\n        self.badge.label = 'O'\n        v = OpenPanel(_Select).pick(_Movies)\n        if v:\n            self.window.title = self.video = v\n            self.player.set_mrl(v)\n            self._reset()\n\n    def menuPause_(self, item, pause=False):  # PYCHOK expected\n        # note, .player.pause() pauses and un-pauses the video,\n        # .player.stop() stops the video and blanks the window\n        if pause or self.player.is_playing():\n            self.player.pause()\n            self.badge.label = 'S'  # stopped\n            self.Toggle.title = 'Play'  # item.title = 'Play'\n\n    def menuPlay_(self, item_or_None):  # PYCHOK expected\n        self.player.play()\n        self._resizer()\n        self.badge.label = 'P'  # Playing\n        self.Toggle.title = 'Pause'  # item.title = 'Pause'\n\n    def menuRewind_(self, item):  # PYCHOK expected\n        self.player.set_position(0.0)\n        self.player.set_time(0.0)\n        # note, can't re-play once at the end\n        # self.menuPlay_()\n        self.badge.label = 'R'\n        self._reset()\n\n    def menuSlower_(self, item):\n        self._rate(item, 0.80)\n\n    def menuSnapshot_(self, item):  # PYCHOK expected\n        w = self.lastWindow\n        if w:\n            self.snapshots += 1\n            s = '-'.join((_Argv0,\n                          'snapshot%d' % (self.snapshots,),\n                           w.__class__.__name__))\n            if isinstance(w, MediaWindow):\n                self.player.video_take_snapshot(0, s + self.snapshot, 0, 0)\n            elif get_printer:  # in PyCocoa 18.08.04+\n                get_printer().printView(w.PMview, toPDF=s + '.pdf')\n\n    def menuToggle_(self, item):\n        # toggle between Pause and Play\n        if self.player.is_playing():\n            self.menuPause_(item, pause=True)\n        else:\n            self.menuPlay_(item)\n\n    def menuZoomIn_(self, item):\n        self._zoom(item, 1.25)\n\n    def menuZoomOut_(self, item):\n        self._zoom(item, 0.80)\n\n    def windowClose_(self, window):\n        # quit or click of window close button\n        if window is self.window:\n            self.terminate()\n        self.Snapshot.isEnabled = False\n        super(AppVLC, self).windowClose_(window)\n\n    def windowLast_(self, window):\n        self.Snapshot.isEnabled = window.isPrintable or isinstance(window, MediaWindow)\n        super(AppVLC, self).windowLast_(window)\n\n    def windowResize_(self, window):\n        if window is self.window:\n            self._reset(True)\n        super(AppVLC, self).windowResize_(window)\n\n    def windowScreen_(self, window, change):\n        if window is self.window:\n            self._reset(True)\n        super(AppVLC, self).windowScreen_(window, change)\n\n    def _brightness(self, unused, fraction=0):  # change brightness\n        self._VLCadjust(_Adjust.Brightness, fraction)\n\n    def _contrast(self, unused, fraction=0):  # change contrast\n        self._VLCadjust(_Adjust.Contrast, fraction)\n\n    def _gamma(self, unused, fraction=0):  # change gamma\n        self._VLCadjust(_Adjust.Gamma, fraction)\n\n    def _hue(self, unused, fraction=0):  # change hue\n        self._VLCadjust(_Adjust.Hue, fraction)\n\n    def _rate(self, unused, factor=0):  # change the video rate\n        p = self.player\n        r = p.get_rate() * factor\n        r = max(0.2, min(10.0, r)) if r > 0 else 1.0\n        p.set_rate(r)\n        self.rate = r\n\n    def _reset(self, resize=False):\n        self.zoomX = 1\n        self.sized = None\n        if resize:\n            Thread(target=self._sizer).start()\n\n    def _resizer(self):  # adjust aspect ratio and marquee height\n        if self.sized:\n            # window's contents' aspect ratio\n            self.window.ratio = self.sized\n        else:\n            Thread(target=self._sizer).start()\n\n    def _saturation(self, unused, fraction=0):  # change saturation\n        self._VLCadjust(_Adjust.Saturation, fraction)\n\n    def _sizer(self, secs=0.25):  # asynchronously\n        while True:\n            # the first call(s) returns (0, 0),\n            # subsequent calls return (w, h)\n            a, b = self.player.video_get_size(0)\n            if b > 0 and a > 0:\n                w = self.window\n                # set window's contents' aspect ratio\n                w.ratio = self.sized = a, b\n                # get video scale factor\n                self.scale = float(w.frame.width) / a\n                self._wiggle()\n                break\n            elif secs > 0.001:\n                sleep(secs)\n            else:  # one-shot\n                break\n\n    def _VLCadjust(self, option, fraction=0, value=None):\n        # adjust a video option like brightness, contrast, etc.\n        p = self.player\n        # <https://Wiki.VideoLan.org/Documentation:Modules/adjust>\n        # note, .Enable must be set to 1, but once is sufficient\n        p.video_set_adjust_int(_Adjust.Enable, 1)\n        try:\n            lo, v, hi = _Adjust3[option]\n            if fraction:\n                if value is None:\n                    v = p.video_get_adjust_float(option)\n                else:\n                    v = float(value)\n                v += fraction * (hi - lo)\n            v = float(max(lo, min(hi, v)))\n            p.video_set_adjust_float(option, v)\n        except (KeyError, ValueError):\n            pass\n\n    def _VLClogo(self, logostr):\n        # add a video logo, example \"python cocoavlc.py -logo\n        # cone-altglass2.png\\;cone-icon-small.png ...\"\n        p = self.player\n        g = vlc.VideoLogoOption  # Enum\n        # <https://Wiki.VideoLan.org/Documentation:Modules/logo>\n        p.video_set_logo_int(g.enable, 1)\n        p.video_set_logo_int(g.position, vlc.Position.Center)\n        p.video_set_logo_int(g.opacity, 128)  # 0-255\n        # p.video_set_logo_int(g.delay, 1000)  # millisec\n        # p.video_set_logo_int(g.repeat, -1)  # forever\n        p.video_set_logo_string(g.file, logostr)\n\n    def _VLCmarquee(self, size=36):\n        # put video marquee at the bottom-center\n        p = self.player\n        m = vlc.VideoMarqueeOption  # Enum\n        # <https://Wiki.VideoLan.org/Documentation:Modules/marq>\n        p.video_set_marquee_int(m.Enable, 1)\n        p.video_set_marquee_int(m.Size, int(size))  # pixels\n        p.video_set_marquee_int(m.Position, vlc.Position.Bottom)\n        p.video_set_marquee_int(m.Opacity, 255)  # 0-255\n        p.video_set_marquee_int(m.Color, _Color.Yellow)\n        p.video_set_marquee_int(m.Timeout, 0)  # millisec, 0==forever\n        p.video_set_marquee_int(m.Refresh, 1000)  # millisec (or sec?)\n        p.video_set_marquee_string(m.Text, str2bytes('%Y-%m-%d  %T  %z'))\n\n    def _wiggle(self):\n        # wiggle the video to fill the window\n        p = self.player\n        s = p.video_get_scale()\n        p.video_set_scale(0.0 if s else self.scale)\n        p.video_set_scale(s)\n\n    def _zoom(self, unused, factor=0):\n        # zoom the video in/out, see tkvlc.py\n        p = self.player\n        x = self.zoomX * factor\n        if x > 1:\n            s = x\n        else:  # not below 1X\n            s, x = 0.0, 1.0\n        p.video_set_scale(s)\n        self.scale = s\n        self.zoomX = x\n\n\nif __name__ == '__main__':  # MCCABE 24\n\n    def _Adjustr():\n        a = []  # get adjust default values\n        for n in _Adjust._enum_names_.values():\n            try:\n                _, d, _ = _Adjust3[getattr(_Adjust, n)]\n                a.append('%s=%s' % (n, d))\n            except KeyError:  # ignore .Enable\n                pass\n        return ','.join(sorted(a))\n\n    _adjustr  = ''\n    _argv0    = basename(sys.argv[0])  # _Title\n    _Argv0    = splitext(_argv0)[0]\n    _logostr  = ''\n    _marquee  = False\n    _raiser   = False\n    _snapshot = AppVLC.snapshot  # default\n    _timeout  = None\n    _title    = splitext(_argv0)[0]\n    _video    = None\n\n    args = sys.argv[1:]\n    while args and args[0].startswith('-'):\n        o = args.pop(0)\n        t = o.lower()\n        if t in ('-h', '--help'):\n            u = ('-h|--help',\n                 '-adjust %s' % (_Adjustr(),))\n            if _VLC_3_:  # requires VLC 3+ and libvlc 3+\n                u += ('-logo <image_file_name>[\\\\;<image_file_name>...]',\n                      '-marquee')\n            u += ('-raiser',\n                  '-snapshot-format jpg|png|tiff',\n                  '-timeout <secs>',\n                  '-title <string>',\n                  '-v|--version',\n                  '<video_file_name>')\n            printf('usage:  [%s]', ']  ['.join(u), argv0=_argv0)\n            sys.exit(0)\n        elif '-adjust'.startswith(t) and len(t) > 1 and args:\n            _adjustr = args.pop(0)\n        elif '-logo'.startswith(t) and len(t) > 1 and args and _VLC_3_:\n            _logostr = args.pop(0)\n        elif '-marquee'.startswith(t) and len(t) > 1 and _VLC_3_:\n            _marquee = True\n        elif '-raiser'.startswith(t) and len(t) > 1:\n            _raiser = True\n        elif '-snapshot-format'.startswith(t) and len(t) > 1 and args:\n            _snapshot = args.pop(0)\n        elif '-timeout'.startswith(t) and len(t) > 3 and args:\n            _timeout = args.pop(0)\n        elif '-title'.startswith(t) and len(t) > 3 and args:\n            _title = args.pop(0).strip()\n        elif t in ('-v', '--version'):\n            # Print version of this cocoavlc.py, PyCocoa, etc.\n            print('%s: %s (%s %s %s)' % (basename(__file__), __version__,\n                                        _pycocoa_, _pycocoa_version,\n                                        _macOS(sep=' ')))\n            try:\n                vlc.print_version()  # PYCHOK expected\n                vlc.print_python()   # PYCHOK expected\n            except AttributeError:\n                pass\n            sys.exit(0)\n        else:\n            printf('invalid option: %s', o, argv0=_argv0)\n            sys.exit(1)\n\n    if _raiser:  # get traceback at SIG- faults or ...\n        try:  # ... use: python3 -X faulthandler ...\n            import faulthandler\n            faulthandler.enable()\n        except ImportError:  # not in Python 3.3-\n            pass\n\n    if args:\n        _video = args.pop(0)\n    else:\n        printf('- %s', _Select.lower(), argv0=_argv0, nl=1, nt=1)\n        app_title(_title)  # App.title when there's no App yet\n        _video = OpenPanel('Select a video file').pick(_Movies)\n\n    if _video:\n        app = AppVLC(video=_video, adjustr=_adjustr,\n                                   logostr=_logostr,\n                                   marquee=_marquee,\n                                    raiser=_raiser,\n                                  snapshot=_snapshot,\n                                     title=_title)\n        app.run(timeout=_timeout)  # never returns\n"
  },
  {
    "path": "generated/3.0/examples/glsurface.py",
    "content": "#! /usr/bin/env python3\n\n#\n# GlSurface example code for VLC Python bindings\n# Copyright (C) 2020 Daniël van Adrichem <daniel5gh@spiet.nl>\n\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\n\"\"\"VLC GlSurface example\n\"\"\"\n\nimport time\nimport ctypes\nfrom threading import Lock\n\nimport numpy as np\nfrom OpenGL.GL import (GL_TEXTURE_2D, glTexSubImage2D, glTexImage2D,\n                       GL_BGR, GL_RGB,\n                       GL_UNSIGNED_BYTE)\nimport vlc\n\nclass Surface(object):\n    \"\"\"A lockable image buffer\n    \"\"\"\n    def __init__(self, w, h):\n        self._width = w\n        self._height = h\n\n        # size in bytes when RV32 *4 or RV24 * 3\n        self._row_size = self._width * 3\n        self._buf_size = self._height * self._row_size\n        # allocate buffer\n        self._buf1 = np.zeros(self._buf_size, dtype=np.ubyte)\n        # get pointer to buffer\n        self._buf_p = self._buf1.ctypes.data_as(ctypes.c_void_p)\n        self._lock = Lock()\n\n    def update_gl(self):\n        # with self._lock:\n        glTexSubImage2D(GL_TEXTURE_2D,\n                        0, 0, 0,\n                        self._width,\n                        self._height,\n                        GL_BGR,\n                        GL_UNSIGNED_BYTE,\n                        self._buf1)\n\n    def create_texture_gl(self):\n        glTexImage2D(GL_TEXTURE_2D,\n                     0,\n                     GL_RGB,\n                     self._width,  # width\n                     self._height,  # height\n                     0,\n                     GL_BGR,\n                     GL_UNSIGNED_BYTE,\n                     None)\n\n    @property\n    def width(self):\n        return self._width\n\n    @property\n    def height(self):\n        return self._height\n\n    @property\n    def row_size(self):\n        return self._row_size\n\n    @property\n    def buf(self):\n        return self._buf1\n\n    @property\n    def buf_pointer(self):\n        return self._buf_p\n\n    def lock(self):\n        self._lock.acquire()\n\n    def unlock(self):\n        self._lock.release()\n\n    def __enter__(self, *args):\n        return self._lock.__enter__(*args)\n\n    def __exit__(self, *args):\n        return self._lock.__exit__(*args)\n\n    def get_libvlc_lock_callback(self):\n        @vlc.VideoLockCb\n        def _cb(opaque, planes):\n            self._lock.acquire()\n            planes[0] = self._buf_p\n\n        return _cb\n\n    def get_libvlc_unlock_callback(self):\n        @vlc.VideoUnlockCb\n        def _cb(opaque, picta, planes):\n            self._lock.release()\n\n        return _cb\n\nif __name__ == '__main__':\n    import sys\n    player = vlc.MediaPlayer(sys.argv[1])\n    # play and stop so video_get_size gets a correct value\n    # setting all callbacks to None prevents a window being created on play\n    player.video_set_callbacks(None, None, None, None)\n    # play and stop so video_get_size gets a correct value\n    player.play()\n    time.sleep(1)\n    player.stop()\n    w, h = player.video_get_size()\n    surface = Surface(w, h)\n    # need to keep a reference to the CFUNCTYPEs or else it will get GCed\n    _lock_cb = surface.get_libvlc_lock_callback()\n    _unlock_cb = surface.get_libvlc_unlock_callback()\n    player.video_set_callbacks(_lock_cb, _unlock_cb, None, None)\n    player.video_set_format(\n        \"RV24\",\n        surface.width,\n        surface.height,\n        surface.row_size)\n    # this starts populating the surface's buf with pixels, from another thread\n    player.play()\n    # in main thread, where gl context is current:\n    # FIXME: add some code to embed the surface + a mainloop\n    # v.surface.update_gl()\n"
  },
  {
    "path": "generated/3.0/examples/gtk2vlc.py",
    "content": "#! /usr/bin/env python3\n\n#\n# gtk example/widget for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\n\"\"\"VLC Gtk Widget classes + example application.\n\nThis module provides two helper classes, to ease the embedding of a\nVLC component inside a pygtk application.\n\nVLCWidget is a simple VLC widget.\n\nDecoratedVLCWidget provides simple player controls.\n\nWhen called as an application, it behaves as a video player.\n\n$Id$\n\"\"\"\n\nimport gtk\ngtk.gdk.threads_init()\n\nimport sys\nimport vlc\n\nfrom gettext import gettext as _\n\n# Create a single vlc.Instance() to be shared by (possible) multiple players.\ninstance = vlc.Instance()\n\nclass VLCWidget(gtk.DrawingArea):\n    \"\"\"Simple VLC widget.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a vlc.MediaPlayer() instance.\n    \"\"\"\n    def __init__(self, *p):\n        gtk.DrawingArea.__init__(self)\n        self.player = instance.media_player_new()\n        def handle_embed(*args):\n            if sys.platform == 'win32':\n                self.player.set_hwnd(self.window.handle)\n            else:\n                self.player.set_xwindow(self.window.xid)\n            return True\n        self.connect(\"map\", handle_embed)\n        self.set_size_request(320, 200)\n\nclass DecoratedVLCWidget(gtk.VBox):\n    \"\"\"Decorated VLC widget.\n\n    VLC widget decorated with a player control toolbar.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a Player instance.\n    \"\"\"\n    def __init__(self, *p):\n        gtk.VBox.__init__(self)\n        self._vlc_widget = VLCWidget(*p)\n        self.player = self._vlc_widget.player\n        self.pack_start(self._vlc_widget, expand=True)\n        self._toolbar = self.get_player_control_toolbar()\n        self.pack_start(self._toolbar, expand=False)\n\n    def get_player_control_toolbar(self):\n        \"\"\"Return a player control toolbar\n        \"\"\"\n        tb = gtk.Toolbar()\n        tb.set_style(gtk.TOOLBAR_ICONS)\n        for text, tooltip, stock, callback in (\n            (_(\"Play\"), _(\"Play\"), gtk.STOCK_MEDIA_PLAY, lambda b: self.player.play()),\n            (_(\"Pause\"), _(\"Pause\"), gtk.STOCK_MEDIA_PAUSE, lambda b: self.player.pause()),\n            (_(\"Stop\"), _(\"Stop\"), gtk.STOCK_MEDIA_STOP, lambda b: self.player.stop()),\n            ):\n            b=gtk.ToolButton(stock)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback)\n            tb.insert(b, -1)\n        tb.show_all()\n        return tb\n\nclass VideoPlayer:\n    \"\"\"Example simple video player.\n    \"\"\"\n    def __init__(self):\n        self.vlc = DecoratedVLCWidget()\n\n    def main(self, fname):\n        self.vlc.player.set_media(instance.media_new(fname))\n        w = gtk.Window()\n        w.add(self.vlc)\n        w.show_all()\n        w.connect(\"destroy\", gtk.main_quit)\n        gtk.main()\n\nclass MultiVideoPlayer:\n    \"\"\"Example multi-video player.\n\n    It plays multiple files side-by-side, with per-view and global controls.\n    \"\"\"\n    def main(self, filenames):\n        # Build main window\n        window=gtk.Window()\n        mainbox=gtk.VBox()\n        videos=gtk.HBox()\n\n        window.add(mainbox)\n        mainbox.add(videos)\n\n        # Create VLC widgets\n        for fname in filenames:\n            v = DecoratedVLCWidget()\n            v.player.set_media(instance.media_new(fname))\n            videos.add(v)\n\n        # Create global toolbar\n        tb = gtk.Toolbar()\n        tb.set_style(gtk.TOOLBAR_ICONS)\n\n        def execute(b, methodname):\n            \"\"\"Execute the given method on all VLC widgets.\n            \"\"\"\n            for v in videos.get_children():\n                getattr(v.player, methodname)()\n            return True\n\n        for text, tooltip, stock, callback, arg in (\n            (_(\"Play\"), _(\"Global play\"), gtk.STOCK_MEDIA_PLAY, execute, \"play\"),\n            (_(\"Pause\"), _(\"Global pause\"), gtk.STOCK_MEDIA_PAUSE, execute, \"pause\"),\n            (_(\"Stop\"), _(\"Global stop\"), gtk.STOCK_MEDIA_STOP, execute, \"stop\"),\n            ):\n            b = gtk.ToolButton(stock)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback, arg)\n            tb.insert(b, -1)\n\n        mainbox.pack_start(tb, expand=False)\n\n        window.show_all()\n        window.connect(\"destroy\", gtk.main_quit)\n        gtk.main()\n\nif __name__ == '__main__':\n    if not sys.argv[1:]:\n       print('You must provide at least 1 movie filename')\n       sys.exit(1)\n    if len(sys.argv[1:]) == 1:\n        # Only 1 file. Simple interface\n        p=VideoPlayer()\n        p.main(sys.argv[1])\n    else:\n        # Multiple files.\n        p=MultiVideoPlayer()\n        p.main(sys.argv[1:])\n"
  },
  {
    "path": "generated/3.0/examples/gtkvlc.py",
    "content": "#! /usr/bin/env python3\n\n#\n# gtk3 example/widget for VLC Python bindings\n# Copyright (C) 2017 Olivier Aubert <contact@olivieraubert.net>\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\n\"\"\"VLC Gtk3 Widget classes + example application.\n\nThis module provides two helper classes, to ease the embedding of a\nVLC component inside a pygtk application.\n\nVLCWidget is a simple VLC widget.\n\nDecoratedVLCWidget provides simple player controls.\n\nWhen called as an application, it behaves as a video player.\n\"\"\"\n\nimport gi\ngi.require_version('Gdk', '3.0')\ngi.require_version('Gtk', '3.0')\nfrom gi.repository import Gdk\nfrom gi.repository import Gtk\n\nGdk.threads_init ()\n\nimport sys\nimport ctypes\nimport vlc\n\nfrom gettext import gettext as _\n\n# Create a single vlc.Instance() to be shared by (possible) multiple players.\nif 'linux' in sys.platform:\n    # Inform libvlc that Xlib is not initialized for threads\n    instance = vlc.Instance(\"--no-xlib\")\nelse:\n    instance = vlc.Instance()\n\n\ndef get_window_pointer(window):\n    \"\"\" Use the window.__gpointer__ PyCapsule to get the C void* pointer to the window\n    \"\"\"\n    # get the c gpointer of the gdk window\n    ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.c_void_p\n    ctypes.pythonapi.PyCapsule_GetPointer.argtypes = [ctypes.py_object]\n    return ctypes.pythonapi.PyCapsule_GetPointer(window.__gpointer__, None)\n\n\nclass VLCWidget(Gtk.DrawingArea):\n    \"\"\"Simple VLC widget.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a vlc.MediaPlayer() instance.\n    \"\"\"\n    __gtype_name__ = 'VLCWidget'\n\n    def __init__(self, *p):\n        Gtk.DrawingArea.__init__(self)\n        self.player = instance.media_player_new()\n        def handle_embed(*args):\n            if sys.platform == 'win32':\n                # get the win32 handle\n                gdkdll = ctypes.CDLL('libgdk-3-0.dll')\n                handle = gdkdll.gdk_win32_window_get_handle(get_window_pointer(self.get_window()))\n                self.player.set_hwnd(handle)\n            elif sys.platform == 'darwin':\n                # get the nsview pointer. NB need to manually specify function signature\n                gdkdll = ctypes.CDLL('libgdk-3.0.dll')\n                get_nsview = gdkdll.gdk_quaerz_window_get_nsview\n                get_nsview.restype, get_nsview.argtypes = [ctypes.c_void_p],  ctypes.c_void_p\n                self.player.set_nsobject(get_nsview(get_window_pointer(self.get_window())))\n            else:\n                self.player.set_xwindow(self.get_window().get_xid())\n            return True\n        self.connect(\"realize\", handle_embed)\n        self.set_size_request(320, 200)\n\nclass DecoratedVLCWidget(Gtk.VBox):\n    \"\"\"Decorated VLC widget.\n\n    VLC widget decorated with a player control toolbar.\n\n    Its player can be controlled through the 'player' attribute, which\n    is a Player instance.\n    \"\"\"\n    __gtype_name__ = 'DecoratedVLCWidget'\n\n    def __init__(self, *p):\n        super(DecoratedVLCWidget, self).__init__()\n        self._vlc_widget = VLCWidget(*p)\n        self.player = self._vlc_widget.player\n        self.add(self._vlc_widget)\n        self._toolbar = self.get_player_control_toolbar()\n        self.pack_start(self._toolbar, False, False, 0)\n        self.show_all()\n\n    def get_player_control_toolbar(self):\n        \"\"\"Return a player control toolbar\n        \"\"\"\n        tb = Gtk.Toolbar.new()\n        for text, tooltip, iconname, callback in (\n            (_(\"Play\"), _(\"Play\"), 'gtk-media-play', lambda b: self.player.play()),\n            (_(\"Pause\"), _(\"Pause\"), 'gtk-media-pause', lambda b: self.player.pause()),\n            (_(\"Stop\"), _(\"Stop\"), 'gtk-media-stop', lambda b: self.player.stop()),\n            (_(\"Quit\"), _(\"Quit\"), 'gtk-quit', Gtk.main_quit),\n            ):\n            i = Gtk.Image.new_from_icon_name(iconname, Gtk.IconSize.MENU)\n            b = Gtk.ToolButton.new(i, text)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback)\n            tb.insert(b, -1)\n        return tb\n\nclass VideoPlayer:\n    \"\"\"Example simple video player.\n    \"\"\"\n    def __init__(self):\n        self.vlc = DecoratedVLCWidget()\n\n    def main(self, fname):\n        self.vlc.player.set_media(instance.media_new(fname))\n        w = Gtk.Window()\n        w.add(self.vlc)\n        w.show_all()\n        w.connect(\"destroy\", Gtk.main_quit)\n        Gtk.main()\n\nclass MultiVideoPlayer:\n    \"\"\"Example multi-video player.\n\n    It plays multiple files side-by-side, with per-view and global controls.\n    \"\"\"\n    def main(self, filenames):\n        # Build main window\n        window=Gtk.Window()\n        mainbox=Gtk.VBox()\n        videos=Gtk.HBox()\n\n        window.add(mainbox)\n        mainbox.add(videos)\n\n        # Create VLC widgets\n        for fname in filenames:\n            v = DecoratedVLCWidget()\n            v.player.set_media(instance.media_new(fname))\n            videos.add(v)\n\n        # Create global toolbar\n        tb = Gtk.Toolbar.new()\n\n        def execute(b, methodname):\n            \"\"\"Execute the given method on all VLC widgets.\n            \"\"\"\n            for v in videos.get_children():\n                getattr(v.player, methodname)()\n            return True\n\n        for text, tooltip, iconname, callback, arg in (\n            (_(\"Play\"), _(\"Global play\"), 'gtk-media-play', execute, \"play\"),\n            (_(\"Pause\"), _(\"Global pause\"), 'gtk-media-pause', execute, \"pause\"),\n            (_(\"Stop\"), _(\"Global stop\"), 'gtk-media-stop', execute, \"stop\"),\n            (_(\"Quit\"), _(\"Quit\"), 'gtk-quit', Gtk.main_quit, None),\n            ):\n            i = Gtk.Image.new_from_icon_name(iconname, Gtk.IconSize.MENU)\n            b = Gtk.ToolButton.new(i, text)\n            b.set_tooltip_text(tooltip)\n            b.connect(\"clicked\", callback, arg)\n            tb.insert(b, -1)\n\n        mainbox.pack_start(tb, False, False, 0)\n\n        window.show_all()\n        window.connect(\"destroy\", Gtk.main_quit)\n        Gtk.main()\n\nif __name__ == '__main__':\n    if not sys.argv[1:]:\n       print('You must provide at least 1 movie filename')\n       sys.exit(1)\n    if len(sys.argv[1:]) == 1:\n        # Only 1 file. Simple interface\n        p=VideoPlayer()\n        from evaluator import Evaluator\n        e = Evaluator(globals(), locals())\n        e.popup()\n        p.main(sys.argv[1])\n    else:\n        # Multiple files.\n        p=MultiVideoPlayer()\n        p.main(sys.argv[1:])\n    instance.release()\n"
  },
  {
    "path": "generated/3.0/examples/play_buffer.py",
    "content": "#!/usr/bin/env python3\n\n# Author:   A.Invernizzi (@albestro on GitHub)\n# Date:     Jun 03, 2020\n\n# MIT License <http://OpenSource.org/licenses/MIT>\n#\n# Copyright (C) 2020 -- A. Invernizzi, @albestro on github\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the \"Software\"),\n# to deal in the Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n# and/or sell copies of the Software, and to permit persons to whom the\n# Software is furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n# OTHER DEALINGS IN THE SOFTWARE.\n\n\"\"\"\nExample usage of VLC API function `libvlc_media_new_callbacks`\nThis function allows to create a VLC media `libvlc_media_t` specifying custom\ncallbacks where the user can define how to manage and read the stream of data.\n\nThe general use case for this is when you have data in memory and you want to\nplay it (e.g. audio stream from a web radio).\n\nIn this example, we are going to read playable data from files in a specified\nfolder. In case you would want to read from a file, it is not the best way to do it,\nbut for the sake of this example we are going to read data into memory from files.\n\nThe example tries to highlight the separation of concerns between the callbacks and\nthe application logic, so it would hopefully make clear how to integrate the VLC API\nwith existing libraries.\n\nIn particular, we have two main parts:\n    - StreamProvider: which is a class that implements the logic; \"scrape\" a folder\n    for files with a specific extensions, and provide methods that retrieves data.\n    - VLC callabacks that uses a StreamProvider object\n\"\"\"\n\nimport argparse\nimport ctypes\nimport os\n\nimport vlc\n\n\nclass StreamProviderDir(object):\n    def __init__(self, rootpath, file_ext):\n        self._media_files = []\n        self._rootpath = rootpath\n        self._file_ext = file_ext\n        self._index = 0\n\n    def open(self):\n        \"\"\"\n        this function is responsible of opening the media.\n        it could have been done in the __init__, but it is just an example\n\n        in this case it scan the specified folder, but it could also scan a\n        remote url or whatever you prefer.\n        \"\"\"\n\n        print(\"read file list\")\n        for entry in os.listdir(self._rootpath):\n            if os.path.splitext(entry)[1] == f\".{self._file_ext}\":\n                self._media_files.append(os.path.join(self._rootpath, entry))\n        self._media_files.sort()\n\n        print(\"playlist:\")\n        for index, media_file in enumerate(self._media_files):\n            print(f\"[{index}] {media_file}\")\n\n    def release_resources(self):\n        \"\"\"\n        In this example this function is just a placeholder,\n        in a more complex example this may release resources after the usage,\n        e.g. closing the socket from where we retrieved media data\n        \"\"\"\n        print(\"releasing stream provider\")\n\n    def seek(self, offset):\n        \"\"\"\n        Again, a placeholder, not useful for the example\n        \"\"\"\n        print(f\"requested seek with offset={offset}\")\n\n    def get_data(self):\n        \"\"\"\n        It reads the current file in the list and returns the binary data\n        In this example it reads from file, but it could have downloaded data from an url\n        \"\"\"\n        print(f\"reading file [{self._index}] \", end='')\n\n        if self._index == len(self._media_files):\n            print(\"file list is over\")\n            return b''\n\n        print(f\"{self._media_files[self._index]}\")\n        with open(self._media_files[self._index], 'rb') as stream:\n            data = stream.read()\n\n        self._index = self._index + 1\n\n        return data\n\n\n# HERE THERE ARE THE CALLBACKS USED BY THE MEDIA CREATED IN THE \"MAIN\"\n# a callback in its simplest form is a python function decorated with the specific @vlc.CallbackDecorators.*\n\n@vlc.CallbackDecorators.MediaOpenCb\ndef media_open_cb(opaque, data_pointer, size_pointer):\n    print(\"OPEN\", opaque, data_pointer, size_pointer)\n\n    stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value\n\n    stream_provider.open()\n\n    data_pointer.contents.value = opaque\n    size_pointer.value = 1 ** 64 - 1\n\n    return 0\n\n\n@vlc.CallbackDecorators.MediaReadCb\ndef media_read_cb(opaque, buffer, length):\n    print(\"READ\", opaque, buffer, length)\n\n    stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value\n\n    new_data = stream_provider.get_data()\n    bytes_read = len(new_data)\n\n    if bytes_read > 0:\n        buffer_array = ctypes.cast(buffer, ctypes.POINTER(ctypes.c_char * bytes_read))\n        for index, b in enumerate(new_data):\n            buffer_array.contents[index] = ctypes.c_char(b)\n\n    print(f\"just read f{bytes_read}B\")\n    return bytes_read\n\n\n@vlc.CallbackDecorators.MediaSeekCb\ndef media_seek_cb(opaque, offset):\n    print(\"SEEK\", opaque, offset)\n\n    stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value\n\n    stream_provider.seek(offset)\n\n    return 0\n\n\n@vlc.CallbackDecorators.MediaCloseCb\ndef media_close_cb(opaque):\n    print(\"CLOSE\", opaque)\n\n    stream_provider = ctypes.cast(opaque, ctypes.POINTER(ctypes.py_object)).contents.value\n\n    stream_provider.release_resources()\n\n\n# MAIN\nif __name__ == '__main__':\n    parser = argparse.ArgumentParser(\n            description='play files found in specified media folder (in alphabetic order)',\n            formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n    parser.add_argument(\n            'media_folder',\n            help='where to find files to play')\n    parser.add_argument(\n            '--extension',\n            default='ts',\n            help='file extension of the files to play')\n    args = parser.parse_args()\n\n    # helper object acting as media data provider\n    # it is just to highlight how the opaque pointer in the callback can be used\n    # and that the logic can be isolated from the callbacks\n    stream_provider = StreamProviderDir(args.media_folder, args.extension)\n\n    # these two lines to highlight how to pass a python object using ctypes\n    # it is verbose, but you can see the steps required\n    stream_provider_obj = ctypes.py_object(stream_provider)\n    stream_provider_ptr = ctypes.byref(stream_provider_obj)\n\n    # create an instance of vlc\n    instance = vlc.Instance()\n\n    # setup the callbacks for the media\n    media = instance.media_new_callbacks(\n            media_open_cb,\n            media_read_cb,\n            media_seek_cb,\n            media_close_cb,\n            stream_provider_ptr)\n    player = media.player_new_from_media()\n\n    # play/stop\n    player.play()\n    input(\"press enter to quit\")\n    player.stop()\n"
  },
  {
    "path": "generated/3.0/examples/psgvlc.py",
    "content": "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nu'''Bare Bones VLC Media Player Demo with Playlist.\n\n1 - Originally the  Demo_Media_Player_VLC_Based.py  duplicated from\n    <https://GitHub.com/PySimpleGUI/PySimpleGUI/blob/master/DemoPrograms>\n    and modified to work and showing videos on recent macOS versions.\n\n2 - This script uses PySimpleGUI under its LGPL3+ stipulations.\n\n3 - You will need to install the Python bindings for VLC, for example\n    using pip:  python3 -m pip install python-vlc\n\n4 - You need the VLC player itself from <https://www.VideoLan.org>.\n\n5 - On macOS, you also need to get tkvlc.py from this location\n    <https://GitHub.com/oaubert/python-vlc/tree/master/examples>\n    to get video and audio.\n\n6 - On macOS, the video plays full-frame, overwriting the buttons.\n\n7 - Original <https://GitHub.com/israel-dryer/Media-Player> by Israel\n    Dryer, modified to be a PySimpleGUI Demo Program and a python-vlc\n    example for you to customize.  Uses the VLC player to playback\n    local media files (and YouTube streams).\n'''\nimport sys\nif sys.version_info[0] < 3:  # Python 3.4+ only\n    sys.exit('%s requires Python 3.4 or later' % (sys.argv[0],))\n    # import Tkinter as tk\nimport PySimpleGUI as sg\nimport vlc\n\n__all__ = ('libtk',)\n__version__ = '22.11.07'  # mrJean1 at Gmail\n\n_Load_  = 'Load'\n_Next_  = 'Next'\n_Path_  = 'Media URL or local path:'\n_Pause_ = 'Pause'\n_Play_  = 'Play'\n_Prev_  = 'Previous'\n_Stop_  = 'Stop'\n\n# GUI definition & setup\nsg.theme('DarkBlue')\n\ndef Bn(name):  # a PySimpleGUI \"User Defined Element\" (see docs)\n    return sg.Button(name, size=(8, 1), pad=(1, 1))\n\nlayout = [[sg.Input(default_text=_Path_, size=(40, 1), key='-VIDEO_PATH-'), sg.Button(_Load_)],\n          [sg.Frame('', [], size=(300, 170), key='-VID_OUT-')],  # was [sg.Image('', ...)],\n          [Bn(_Prev_), Bn(_Play_), Bn(_Next_), Bn(_Pause_), Bn(_Stop_)],\n          [sg.Text('Load media to start', key='-MESSAGE_AREA-')]]\n\nwindow = sg.Window('PySimpleGUI VLC Player', layout, element_justification='center', finalize=True, resizable=True)\n\nwindow['-VID_OUT-'].expand(True, True)  # type: sg.Element\n\n# Media Player Setup\ninst = vlc.Instance()\nlist_player = inst.media_list_player_new()\nmedia_list = inst.media_list_new([])\nlist_player.set_media_list(media_list)\nplayer = list_player.get_media_player()\n# tell VLC where to render the video(s)\ntk_id = window['-VID_OUT-'].Widget.winfo_id()\nlibtk = ''\nif sg.running_linux():\n    player.set_xwindow(tk_id)\nelif sg.running_windows():\n    player.set_hwnd(tk_id)\nelif sg.running_mac():\n    try:\n        from tkvlc import _GetNSView, libtk\n        ns = _GetNSView(tk_id)\n    except ImportError:\n        ns = None\n        libtk = 'none, install tkvlc.py from <https://GitHub.com/oaubert/python-vlc> examples'\n    if ns:  # drawable NSview\n        player.set_nsobject(ns)\n    else:  # no video, only audio\n        player.set_xwindow(tk_id)\nelse:  # running trinket, etc.\n    player.set_hwnd(tk_id)  # TBD\n\nif __name__ == '__main__':  # MCCABE 20\n\n    if len(sys.argv) > 1:\n        if sys.argv[1].lower() in ('-v', '--version'):\n            # show all versions, this vlc.py, libvlc, etc. (sample output on macOS):\n            # ...\n            # % python3 ./psgvlc.py -v\n            # psgvlc.py: 22.11.06\n            # tkinter: 8.6\n            # libTk: /Library/Frameworks/Python.framework/Versions/3.11/lib/libtk8.6.dylib\n            # vlc.py: 3.0.12119 (Mon May 31 18:25:17 2021 3.0.12)\n            # libVLC: 3.0.16 Vetinari (0x3001000)\n            # plugins: /Applications/VLC.app/Contents/MacOS/plugins\n            # Python: 3.11.0 (64bit) macOS 13.0 arm64\n            for t in ((sys.argv[0], __version__), (sg.tk.__name__, sg.tk.TkVersion), ('libTk', libtk)):\n                print('{}: {}'.format(*t))\n            try:\n                vlc.print_version()\n                vlc.print_python()\n            except AttributeError:\n                pass\n            sys.exit(0)\n\n        if sys.argv[1]:\n            media_list.add_media(sys.argv[1])\n            list_player.set_media_list(media_list)\n\n    # The Event Loop\n    while True:\n        # run with a timeout so that current location can be updated\n        event, values = window.read(timeout=1000)\n\n        if event == sg.WIN_CLOSED:\n            break\n\n        if event == _Pause_:\n            list_player.pause()\n        elif event == _Stop_:\n            list_player.stop()\n        elif event == _Next_:\n            list_player.next()\n            list_player.play()\n        elif event == _Prev_:\n            list_player.previous()  # first call causes current video to start over\n            list_player.previous()  # second call moves back 1 video from current\n            list_player.play()\n        elif event == _Play_:\n            list_player.play()\n        elif event == _Load_:\n            path = values['-VIDEO_PATH-']\n            if path and _Path_ not in path:\n                media_list.add_media(path)\n                list_player.set_media_list(media_list)\n                window['-VIDEO_PATH-'].update(_Path_)  # only add a legit submit\n\n        # update elapsed time if a video loaded and playing\n        if player.is_playing():\n            text = '{:02d}:{:02d}'.format(*divmod(player.get_time()   // 1000, 60)) + ' / ' + \\\n                   '{:02d}:{:02d}'.format(*divmod(player.get_length() // 1000, 60))\n            if sg.running_mac():\n                print('{}: {}'.format(sys.argv[0], text))\n\n        elif not media_list.count():\n            text = 'Load media to start'\n        else:\n            text = 'Ready to play media'\n        window['-MESSAGE_AREA-'].update(text)\n\n    window.close()\n"
  },
  {
    "path": "generated/3.0/examples/pyobjcvlc.py",
    "content": "#! /usr/bin/env python3\n\n# -*- coding: utf-8 -*-\n\n# License at the end of this file.  This module is equivalent to\n# PyCocoa/test/simple_VLCplayer.py but based on PyObjC instead\n# of PyCocoa <https://PyPI.org/project/PyCocoa>.  Until macOS\n# release Catalina, macOS' Python includes PyObjC.\n\n# See also a more comprehensive VLC player example cocoavlc.py\n# <https://GitHub.com/oaubert/python-vlc/tree/master/examples>\n\n# This VLC player has only been tested with VLC 2.2.8 and 3.0.8,\n# and a compatible vlc.py <https://PyPI.org/project/Python-VLC>\n# binding using Python 2.7.10 with macOS' PyObjC 2.5.1 and Python\n# 3.7.4 with PyObjC 5.2b1 on macOS 10.13.6 High Sierra or 10.14.6\n# Mojave, all in 64-bit only.  This player has not been tested\n# on iOS, nor with PyPy and Intel(R) Python.\n\nfrom os.path import basename  # PYCHOK expected\nfrom platform import architecture, mac_ver  # PYCHOK false\nimport sys\n\n_argv0 = basename(__file__)\nif not sys.platform.startswith('darwin'):\n    raise ImportError('%s only supported on %s' % (_argv0, 'macOS'))\n\nclass _ImportError(ImportError):  # PYCHOK expected\n    def __init__(self, package, PyPI):\n        PyPI = '<https://PyPI.org/project/%s>' % (PyPI,)\n        t = 'no module %s, see %s' % (package, PyPI)\n        ImportError.__init__(self, t)\n\ntry:  # PYCHOK expected\n    from objc import __version__ as __PyObjC__\nexcept ImportError:\n    raise _ImportError('objc', 'PyObjC')\n\n# the imports listed explicitly to help PyChecker\nfrom Cocoa import NSAlternateKeyMask, NSApplication, \\\n                  NSBackingStoreBuffered, NSBundle, \\\n                  NSCommandKeyMask, NSControlKeyMask, \\\n                  NSMakeRect, NSMenu, NSMenuItem, \\\n                  NSObject, \\\n                  NSScreen, NSShiftKeyMask, NSSize, \\\n                  NSView, NSWindow\ntry:\n    from Cocoa import NSWindowStyleMaskClosable, NSWindowStyleMaskMiniaturizable, \\\n                      NSWindowStyleMaskResizable, NSWindowStyleMaskTitled\nexcept ImportError:  # previously, NSWindowStyleMaskXxx was named NSXxxWindowMask\n    from Cocoa import NSClosableWindowMask as NSWindowStyleMaskClosable, \\\n                      NSMiniaturizableWindowMask as NSWindowStyleMaskMiniaturizable, \\\n                      NSResizableWindowMask as NSWindowStyleMaskResizable, \\\n                      NSTitledWindowMask as NSWindowStyleMaskTitled\n\nNSStr = bytes if sys.version_info.major < 3 else str\nNSWindowStyleMaskUsual = NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable \\\n                       | NSWindowStyleMaskResizable | NSWindowStyleMaskTitled\n\n__all__  = ('simpleVLCplay',)\n__version__ = '19.09.27'\n\n\ntry:  # all imports listed explicitly to help PyChecker\n    from math import gcd  # Python 3+\nexcept ImportError:\n    try:\n        from fractions import gcd  # Python 2-\n    except ImportError:\n\n        def gcd(a, b):\n            a, b = abs(a), abs(b)\n            if a < b:\n                a, b = b, a\n            while b:\n                a, b = b, (a % b)\n            return a\n\n\ndef mspf(fps):\n    '''Convert frames per second to frame length in millisecs.\n    '''\n    return 1000.0 / (fps or 25)\n\n\ndef nsBundleRename(title, match='Python'):\n    '''Change the bundle title if the current title matches.\n\n       @param title: New bundle title (C{str}).\n       @keyword match: Optional, previous title to match (C{str}).\n\n       @return: The previous bundle title (C{str}) or None.\n\n       @note: Used to mimick C{NSApplication.setTitle_(ns_title)},\n              the application name shown in the menu bar.\n    '''\n    # <https://Developer.Apple.com/documentation/\n    #        foundation/nsbundle/1495012-bundlewithpath>\n    # ns = NSBundle.bundleWithPath_(os.path.abspath(match))\n    p, ns = None, NSBundle.mainBundle()\n    if ns:\n        ns = ns.localizedInfoDictionary() or ns.infoDictionary()\n        if ns:\n            k = NSStr('CFBundleName')\n            p = ns.objectForKey_(k) or None\n            if title and match in (p, '', None):  # can't be empty\n                ns.setObject_forKey_(NSStr(title), k)\n    return p\n\n\ndef printf(fmt, *args, **kwds):  # argv0='', nl=0, nt=0\n    '''Formatted print I{fmt % args} with optional keywords.\n\n       @param fmt: Print-like format (C{str}).\n       @param args: Optional arguments to include (I{all positional}).\n       @keyword argv0: Optional prefix (C{str}).\n       @keyword nl: Number of leading blank lines (C{int}).\n       @keyword nt: Number of trailing blank lines (C{int}).\n    '''\n    a = kwds.get('argv0', _argv0)\n    t = (fmt % args) if args else fmt\n    nl = '\\n' * kwds.get('nl', 0)\n    nt = '\\n' * kwds.get('nt', 0)\n    print(''.join((nl, a, ' ', t, nt)))\n\n\ndef terminating(app, timeout):\n    '''Terminate C{app} after C{timeout} seconds.\n\n       @param app: The application (C{NSApplication} instance).\n       @patam timeout: Time in seconds (C{float}).\n    '''\n    try:\n        secs = float(timeout)\n    except (TypeError, ValueError):\n        secs = 0\n\n    if secs > 0:\n        from threading import Thread\n\n        def _t():\n            from time import sleep\n\n            sleep(secs + 0.5)\n            app.terminate_()\n\n        Thread(target=_t).start()\n\n\nclass _NSDelegate(NSObject):\n    '''(INTERNAL) Delegate for NSApplication and NSWindow,\n        handling PyObjC events, notifications and callbacks.\n    '''\n    app    = None  # NSApplication\n    NSItem = None  # NSMenuItem\n    player = None  # vlc.MediaPlayer\n    ratio  = 2     # aspect_ratio calls\n    title  = ''    # top-level menu title\n    video  = None  # video file name\n    window = None  # main NSWindow\n\n    def applicationDidFinishLaunching_(self, notification):\n\n        # the VLC player needs an NSView object\n        self.window, view = _Window2(title=self.video or self.title)\n        # set the window's delegate to the app's to\n        # make method .windowWillClose_ work, see\n        # <https://Gist.GitHub.com/kaloprominat/6105220>\n        self.window.setDelegate_(self)\n        # pass viewable to VLC player, see PyObjC Generated types ...\n        # <https://PyObjC.ReadTheDocs.io/en/latest/core/type-wrapper.html>\n        self.player.set_nsobject(view.__c_void_p__())\n\n        menu = NSMenu.alloc().init()  # create main menu\n        menu.addItem_(_MenuItem('Full ' + 'Screen', 'enterFullScreenMode:', 'f', ctrl=True))  # Ctrl-Cmd-F, Esc to exit\n        menu.addItem_(_MenuItem('Info', 'info:', 'i'))\n\n        menu.addItem_(_MenuItemSeparator())\n        self.NSitem = _MenuItem('Pause', 'toggle:', 'p', ctrl=True)  # Ctrl-Cmd-P\n        menu.addItem_(self.NSitem)\n        menu.addItem_(_MenuItem('Rewind', 'rewind:', 'r', ctrl=True))  # Ctrl-Cmd-R\n\n        menu.addItem_(_MenuItemSeparator())\n        menu.addItem_(_MenuItem('Hide ' + self.title, 'hide:', 'h'))  # Cmd-H, implied\n        menu.addItem_(_MenuItem('Hide Others', 'hideOtherApplications:', 'h', alt=True))  # Alt-Cmd-H\n        menu.addItem_(_MenuItem('Show All', 'unhideAllApplications:'))  # no key\n\n        menu.addItem_(_MenuItemSeparator())\n        menu.addItem_(_MenuItem('Quit ' + self.title, 'terminate:', 'q'))  # Cmd-Q\n\n        subMenu = NSMenuItem.alloc().init()\n        subMenu.setSubmenu_(menu)\n\n        menuBar = NSMenu.alloc().init()\n        menuBar.addItem_(subMenu)\n        self.app.setMainMenu_(menuBar)\n\n        self.player.play()\n        # adjust the contents' aspect ratio\n        self.windowDidResize_(None)\n\n    def info_(self, notification):\n        try:\n            p = self.player\n            if p.is_playing():\n                p.pause()\n            m = p.get_media()\n            v = sys.modules[p.__class__.__module__]  # import vlc\n            b = v.bytes_to_str\n\n            printf(__version__, nl=1)\n            # print Python, vlc, libVLC, media info\n            printf('PyObjC %s', __PyObjC__, nl=1)\n            printf('Python %s %s', sys.version.split()[0], architecture()[0])\n            printf('macOS %s', ' '.join(mac_ver()[0:3:2]), nt=1)\n\n            printf('vlc.py %s (%#x)', v.__version__, v.hex_version())\n            printf('built: %s', v.build_date)\n\n            printf('libVLC %s (%#x)', b(v.libvlc_get_version()), v.libvlc_hex_version())\n            printf('libVLC %s', b(v.libvlc_get_compiler()), nt=1)\n\n            printf('media: %s', b(m.get_mrl()))\n            printf('state: %s', p.get_state())\n\n            printf('track/count: %s/%s', p.video_get_track(), p.video_get_track_count())\n            printf('time/duration: %s/%s ms', p.get_time(), m.get_duration())\n            printf('position/length: %.2f%%/%s ms', p.get_position() * 100.0, p.get_length())\n            f = p.get_fps()\n            printf('fps: %.3f (%.3f ms)', f, mspf(f))\n            printf('rate: %s', p.get_rate())\n\n            w, h = p.video_get_size(0)\n            printf('video size: %sx%s', w, h)\n            r = gcd(w, h) or ''\n            if r and w and h:\n                r = ' (%s:%s)' % (w // r, h // r)\n            printf('aspect ratio: %s%s', p.video_get_aspect_ratio(), r)\n\n            printf('scale: %.3f', p.video_get_scale())\n            o = p.get_nsobject()  # for macOS only\n            printf('nsobject: %r (%#x)', o, o, nt=1)\n        except Exception as x:\n            printf('%r', x, nl=1, nt=1)\n\n    def rewind_(self, notification):\n        self.player.set_position(0.0)\n        # can't re-play once at the end\n        # self.player.play()\n\n    def toggle_(self, notification):\n        # toggle between Pause and Play\n        if self.player.is_playing():\n            # note, .pause() pauses and un-pauses the video,\n            # .stop() stops the video and blanks the window\n            self.player.pause()\n            t = 'Play'\n        else:\n            self.player.play()\n            t = 'Pause'\n        self.NSitem.setTitle_(NSStr(t))\n\n    def windowDidResize_(self, notification):\n        if self.window and self.ratio:\n            # get and maintain the aspect ratio\n            # (the first player.video_get_size()\n            #  call returns (0, 0), subsequent\n            #  calls return (w, h) correctly)\n            w, h = self.player.video_get_size(0)\n            r = gcd(w, h)\n            if r and w and h:\n                r = NSSize(w // r , h // r)\n                self.window.setContentAspectRatio_(r)\n                self.ratio -= 1\n\n    def windowWillClose_(self, notification):\n        self.app.terminate_(self)\n\n\ndef _MenuItem(label, action=None, key='', alt=False, cmd=True, ctrl=False, shift=False):\n    '''New NS menu item with action and optional shortcut key.\n    '''\n    # <http://Developer.Apple.com/documentation/appkit/nsmenuitem/1514858-initwithtitle>\n    ns = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(\n                            NSStr(label), NSStr(action), NSStr(key))\n    if key:\n        mask = 0\n        if alt:\n            mask |= NSAlternateKeyMask\n        if cmd:\n            mask |= NSCommandKeyMask\n        if ctrl:\n            mask |= NSControlKeyMask\n        if shift:\n            mask |= NSShiftKeyMask  # NSAlphaShiftKeyMask\n        if mask:\n            ns.setKeyEquivalentModifierMask_(mask)\n    return ns\n\n\ndef _MenuItemSeparator():\n    '''A menu separator item.\n    '''\n    return NSMenuItem.separatorItem()\n\n\ndef _Window2(title=_argv0, fraction=0.5):\n    '''Create the main NS window and the drawable NS view.\n    '''\n    frame = NSScreen.mainScreen().frame()\n    if 0.1 < fraction < 1.0:\n        # use the lower left quarter of the screen size as frame\n        w = int(frame.size.width * fraction + 0.5)\n        h = int(frame.size.height * w / frame.size.width)\n        frame = NSMakeRect(frame.origin.x + 10, frame.origin.y + 10, w, h)\n\n    window = NSWindow.alloc().initWithContentRect_styleMask_backing_defer_(\n                              frame,\n                              NSWindowStyleMaskUsual,\n                              NSBackingStoreBuffered,\n                              False)  # or 0\n    window.setTitle_(NSStr(title))\n\n    # create the drawable_nsobject NSView for vlc.py, see vlc.MediaPlayer.set_nsobject()\n    # for an alternate NSView object with protocol VLCOpenGLVideoViewEmbedding\n    # <http://StackOverflow.com/questions/11562587/create-nsview-directly-from-code>\n    # <http://GitHub.com/ariabuckles/pyobjc-framework-Cocoa/blob/master/Examples/AppKit/DotView/DotView.py>\n    view = NSView.alloc().initWithFrame_(frame)\n    window.setContentView_(view)\n    # force the video/window aspect ratio, adjusted\n    # above when the window is/has been resized\n    window.setContentAspectRatio_(frame.size)\n\n    window.makeKeyAndOrderFront_(None)\n    return window, view\n\n\ndef simpleVLCplay(player, title=_argv0, video='', timeout=None):\n    '''Create a minimal NS application, drawable window and basic menu\n       for the given VLC player (with media) and start the player.\n\n       @note: This function never returns, but the VLC player and\n              other Python thread(s) do run.\n    '''\n    if not player:\n        raise ValueError('%s invalid: %r' % ('player', player))\n\n    app = NSApplication.sharedApplication()\n    nsBundleRename(NSStr(title))  # top-level menu title\n\n    dlg = _NSDelegate.alloc().init()\n    dlg.app = app\n    dlg.player = player\n    dlg.title = title or _argv0\n    dlg.video = video or basename(player.get_media().get_mrl())\n    app.setDelegate_(dlg)\n\n    terminating(app, timeout)\n    app.run()  # never returns\n\n\nif __name__ == '__main__':\n\n    try:\n        import vlc\n    except ImportError:\n        raise _ImportError('vlc', 'Python-VLC')\n\n    _argv0 = _name = basename(sys.argv[0])\n    _timeout = None\n\n    args = sys.argv[1:]\n    while args and args[0].startswith('-'):\n        o = args.pop(0)\n        t = o.lower()\n        if t in ('-h', '--help'):\n            printf('usage:  [-h|--help]  [-name \"%s\"]  [-timeout <secs>]  %s',\n                   _name, '<video_file_name>')\n            sys.exit(0)\n        elif args and len(t) > 1 and '-name'.startswith(t):\n            _name = args.pop(0)\n        elif args and len(t) > 1 and '-timeout'.startswith(t):\n            _timeout = args.pop(0)\n        elif t in ('-v', '--version'):\n            print('%s: %s (%s %s)' % (basename(__file__), __version__,\n                                      'PyObjC', __PyObjC__))\n            try:\n                vlc.print_version()\n                vlc.print_python()\n            except AttributeError:\n                pass\n            sys.exit(0)\n        else:\n            printf('invalid option: %s', o)\n            sys.exit(1)\n\n    if not args:\n        printf('missing %s', '<video_file_name>')\n        sys.exit(1)\n\n    # create a VLC player and play the video\n    p = vlc.MediaPlayer(args.pop(0))\n    simpleVLCplay(p, title=_name, timeout=_timeout)  # never returns\n\n# MIT License <http://OpenSource.org/licenses/MIT>\n#\n# Copyright (C) 2017-2020 -- mrJean1 at Gmail -- All Rights Reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the \"Software\"),\n# to deal in the Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n# and/or sell copies of the Software, and to permit persons to whom the\n# Software is furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,\n# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\n# OTHER DEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "generated/3.0/examples/pyqt5vlc.py",
    "content": "#! /usr/bin/env python3\n#\n# PyQt5 example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"\nA simple example for VLC python bindings using PyQt5.\n\nAuthor: Saveliy Yusufov, Columbia University, sy2685@columbia.edu\nDate: 25 December 2018\n\"\"\"\n\nimport platform\nimport os\nimport sys\n\nfrom PyQt5 import QtWidgets, QtGui, QtCore\nimport vlc\n\nclass Player(QtWidgets.QMainWindow):\n    \"\"\"A simple Media Player using VLC and Qt\n    \"\"\"\n\n    def __init__(self, master=None):\n        QtWidgets.QMainWindow.__init__(self, master)\n        self.setWindowTitle(\"Media Player\")\n\n        # Create a basic vlc instance\n        self.instance = vlc.Instance()\n\n        self.media = None\n\n        # Create an empty vlc media player\n        self.mediaplayer = self.instance.media_player_new()\n\n        self.create_ui()\n        self.is_paused = False\n\n    def create_ui(self):\n        \"\"\"Set up the user interface, signals & slots\n        \"\"\"\n        self.widget = QtWidgets.QWidget(self)\n        self.setCentralWidget(self.widget)\n\n        # In this widget, the video will be drawn\n        if platform.system() == \"Darwin\": # for MacOS\n            self.videoframe = QtWidgets.QMacCocoaViewContainer(0)\n        else:\n            self.videoframe = QtWidgets.QFrame()\n\n        self.palette = self.videoframe.palette()\n        self.palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 0))\n        self.videoframe.setPalette(self.palette)\n        self.videoframe.setAutoFillBackground(True)\n\n        self.positionslider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)\n        self.positionslider.setToolTip(\"Position\")\n        self.positionslider.setMaximum(1000)\n        self.positionslider.sliderMoved.connect(self.set_position)\n        self.positionslider.sliderPressed.connect(self.set_position)\n\n        self.hbuttonbox = QtWidgets.QHBoxLayout()\n        self.playbutton = QtWidgets.QPushButton(\"Play\")\n        self.hbuttonbox.addWidget(self.playbutton)\n        self.playbutton.clicked.connect(self.play_pause)\n\n        self.stopbutton = QtWidgets.QPushButton(\"Stop\")\n        self.hbuttonbox.addWidget(self.stopbutton)\n        self.stopbutton.clicked.connect(self.stop)\n\n        self.hbuttonbox.addStretch(1)\n        self.volumeslider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)\n        self.volumeslider.setMaximum(100)\n        self.volumeslider.setValue(self.mediaplayer.audio_get_volume())\n        self.volumeslider.setToolTip(\"Volume\")\n        self.hbuttonbox.addWidget(self.volumeslider)\n        self.volumeslider.valueChanged.connect(self.set_volume)\n\n        self.vboxlayout = QtWidgets.QVBoxLayout()\n        self.vboxlayout.addWidget(self.videoframe)\n        self.vboxlayout.addWidget(self.positionslider)\n        self.vboxlayout.addLayout(self.hbuttonbox)\n\n        self.widget.setLayout(self.vboxlayout)\n\n        menu_bar = self.menuBar()\n\n        # File menu\n        file_menu = menu_bar.addMenu(\"File\")\n\n        # Add actions to file menu\n        open_action = QtWidgets.QAction(\"Load Video\", self)\n        close_action = QtWidgets.QAction(\"Close App\", self)\n        file_menu.addAction(open_action)\n        file_menu.addAction(close_action)\n\n        open_action.triggered.connect(self.open_file)\n        close_action.triggered.connect(sys.exit)\n\n        self.timer = QtCore.QTimer(self)\n        self.timer.setInterval(100)\n        self.timer.timeout.connect(self.update_ui)\n\n    def play_pause(self):\n        \"\"\"Toggle play/pause status\n        \"\"\"\n        if self.mediaplayer.is_playing():\n            self.mediaplayer.pause()\n            self.playbutton.setText(\"Play\")\n            self.is_paused = True\n            self.timer.stop()\n        else:\n            if self.mediaplayer.play() == -1:\n                self.open_file()\n                return\n\n            self.mediaplayer.play()\n            self.playbutton.setText(\"Pause\")\n            self.timer.start()\n            self.is_paused = False\n\n    def stop(self):\n        \"\"\"Stop player\n        \"\"\"\n        self.mediaplayer.stop()\n        self.playbutton.setText(\"Play\")\n\n    def open_file(self):\n        \"\"\"Open a media file in a MediaPlayer\n        \"\"\"\n\n        dialog_txt = \"Choose Media File\"\n        filename = QtWidgets.QFileDialog.getOpenFileName(self, dialog_txt, os.path.expanduser('~'))\n        if not filename:\n            return\n\n        # getOpenFileName returns a tuple, so use only the actual file name\n        self.media = self.instance.media_new(filename[0])\n\n        # Put the media in the media player\n        self.mediaplayer.set_media(self.media)\n\n        # Parse the metadata of the file\n        self.media.parse()\n\n        # Set the title of the track as window title\n        self.setWindowTitle(self.media.get_meta(0))\n\n        # The media player has to be 'connected' to the QFrame (otherwise the\n        # video would be displayed in it's own window). This is platform\n        # specific, so we must give the ID of the QFrame (or similar object) to\n        # vlc. Different platforms have different functions for this\n        if platform.system() == \"Linux\": # for Linux using the X Server\n            self.mediaplayer.set_xwindow(int(self.videoframe.winId()))\n        elif platform.system() == \"Windows\": # for Windows\n            self.mediaplayer.set_hwnd(int(self.videoframe.winId()))\n        elif platform.system() == \"Darwin\": # for MacOS\n            self.mediaplayer.set_nsobject(int(self.videoframe.winId()))\n\n        self.play_pause()\n\n    def set_volume(self, volume):\n        \"\"\"Set the volume\n        \"\"\"\n        self.mediaplayer.audio_set_volume(volume)\n\n    def set_position(self):\n        \"\"\"Set the movie position according to the position slider.\n        \"\"\"\n\n        # The vlc MediaPlayer needs a float value between 0 and 1, Qt uses\n        # integer variables, so you need a factor; the higher the factor, the\n        # more precise are the results (1000 should suffice).\n\n        # Set the media position to where the slider was dragged\n        self.timer.stop()\n        pos = self.positionslider.value()\n        self.mediaplayer.set_position(pos / 1000.0)\n        self.timer.start()\n\n    def update_ui(self):\n        \"\"\"Updates the user interface\"\"\"\n\n        # Set the slider's position to its corresponding media position\n        # Note that the setValue function only takes values of type int,\n        # so we must first convert the corresponding media position.\n        media_pos = int(self.mediaplayer.get_position() * 1000)\n        self.positionslider.setValue(media_pos)\n\n        # No need to call this function if nothing is played\n        if not self.mediaplayer.is_playing():\n            self.timer.stop()\n\n            # After the video finished, the play button stills shows \"Pause\",\n            # which is not the desired behavior of a media player.\n            # This fixes that \"bug\".\n            if not self.is_paused:\n                self.stop()\n\ndef main():\n    \"\"\"Entry point for our simple vlc player\n    \"\"\"\n    app = QtWidgets.QApplication(sys.argv)\n    player = Player()\n    player.show()\n    player.resize(640, 480)\n    sys.exit(app.exec_())\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "generated/3.0/examples/qtvlc.py",
    "content": "#! /usr/bin/env python3\n\n#\n# Qt example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\nimport sys\nimport os.path\nimport vlc\nfrom PyQt4 import QtGui, QtCore\n\ntry:\n    unicode        # Python 2\nexcept NameError:\n    unicode = str  # Python 3\n\n\nclass Player(QtGui.QMainWindow):\n    \"\"\"A simple Media Player using VLC and Qt\n    \"\"\"\n    def __init__(self, master=None):\n        QtGui.QMainWindow.__init__(self, master)\n        self.setWindowTitle(\"Media Player\")\n\n        # creating a basic vlc instance\n        self.instance = vlc.Instance()\n        # creating an empty vlc media player\n        self.mediaplayer = self.instance.media_player_new()\n\n        self.createUI()\n        self.isPaused = False\n\n    def createUI(self):\n        \"\"\"Set up the user interface, signals & slots\n        \"\"\"\n        self.widget = QtGui.QWidget(self)\n        self.setCentralWidget(self.widget)\n\n        # In this widget, the video will be drawn\n        if sys.platform == \"darwin\": # for MacOS\n            self.videoframe = QtGui.QMacCocoaViewContainer(0)\n        else:\n            self.videoframe = QtGui.QFrame()\n        self.palette = self.videoframe.palette()\n        self.palette.setColor (QtGui.QPalette.Window,\n                               QtGui.QColor(0,0,0))\n        self.videoframe.setPalette(self.palette)\n        self.videoframe.setAutoFillBackground(True)\n\n        self.positionslider = QtGui.QSlider(QtCore.Qt.Horizontal, self)\n        self.positionslider.setToolTip(\"Position\")\n        self.positionslider.setMaximum(1000)\n        self.connect(self.positionslider,\n                     QtCore.SIGNAL(\"sliderMoved(int)\"), self.setPosition)\n\n        self.hbuttonbox = QtGui.QHBoxLayout()\n        self.playbutton = QtGui.QPushButton(\"Play\")\n        self.hbuttonbox.addWidget(self.playbutton)\n        self.connect(self.playbutton, QtCore.SIGNAL(\"clicked()\"),\n                     self.PlayPause)\n\n        self.stopbutton = QtGui.QPushButton(\"Stop\")\n        self.hbuttonbox.addWidget(self.stopbutton)\n        self.connect(self.stopbutton, QtCore.SIGNAL(\"clicked()\"),\n                     self.Stop)\n\n        self.hbuttonbox.addStretch(1)\n        self.volumeslider = QtGui.QSlider(QtCore.Qt.Horizontal, self)\n        self.volumeslider.setMaximum(100)\n        self.volumeslider.setValue(self.mediaplayer.audio_get_volume())\n        self.volumeslider.setToolTip(\"Volume\")\n        self.hbuttonbox.addWidget(self.volumeslider)\n        self.connect(self.volumeslider,\n                     QtCore.SIGNAL(\"valueChanged(int)\"),\n                     self.setVolume)\n\n        self.vboxlayout = QtGui.QVBoxLayout()\n        self.vboxlayout.addWidget(self.videoframe)\n        self.vboxlayout.addWidget(self.positionslider)\n        self.vboxlayout.addLayout(self.hbuttonbox)\n\n        self.widget.setLayout(self.vboxlayout)\n\n        open = QtGui.QAction(\"&Open\", self)\n        self.connect(open, QtCore.SIGNAL(\"triggered()\"), self.OpenFile)\n        exit = QtGui.QAction(\"&Exit\", self)\n        self.connect(exit, QtCore.SIGNAL(\"triggered()\"), sys.exit)\n        menubar = self.menuBar()\n        filemenu = menubar.addMenu(\"&File\")\n        filemenu.addAction(open)\n        filemenu.addSeparator()\n        filemenu.addAction(exit)\n\n        self.timer = QtCore.QTimer(self)\n        self.timer.setInterval(200)\n        self.connect(self.timer, QtCore.SIGNAL(\"timeout()\"),\n                     self.updateUI)\n\n    def PlayPause(self):\n        \"\"\"Toggle play/pause status\n        \"\"\"\n        if self.mediaplayer.is_playing():\n            self.mediaplayer.pause()\n            self.playbutton.setText(\"Play\")\n            self.isPaused = True\n        else:\n            if self.mediaplayer.play() == -1:\n                self.OpenFile()\n                return\n            self.mediaplayer.play()\n            self.playbutton.setText(\"Pause\")\n            self.timer.start()\n            self.isPaused = False\n\n    def Stop(self):\n        \"\"\"Stop player\n        \"\"\"\n        self.mediaplayer.stop()\n        self.playbutton.setText(\"Play\")\n\n    def OpenFile(self, filename=None):\n        \"\"\"Open a media file in a MediaPlayer\n        \"\"\"\n        if filename is None:\n            filename = QtGui.QFileDialog.getOpenFileName(self, \"Open File\", os.path.expanduser('~'))\n        if not filename:\n            return\n\n        # create the media\n        if sys.version < '3':\n            filename = unicode(filename)\n        self.media = self.instance.media_new(filename)\n        # put the media in the media player\n        self.mediaplayer.set_media(self.media)\n\n        # parse the metadata of the file\n        self.media.parse()\n        # set the title of the track as window title\n        self.setWindowTitle(self.media.get_meta(0))\n\n        # the media player has to be 'connected' to the QFrame\n        # (otherwise a video would be displayed in it's own window)\n        # this is platform specific!\n        # you have to give the id of the QFrame (or similar object) to\n        # vlc, different platforms have different functions for this\n        if sys.platform.startswith('linux'): # for Linux using the X Server\n            self.mediaplayer.set_xwindow(self.videoframe.winId())\n        elif sys.platform == \"win32\": # for Windows\n            self.mediaplayer.set_hwnd(self.videoframe.winId())\n        elif sys.platform == \"darwin\": # for MacOS\n            self.mediaplayer.set_nsobject(self.videoframe.winId())\n        self.PlayPause()\n\n    def setVolume(self, Volume):\n        \"\"\"Set the volume\n        \"\"\"\n        self.mediaplayer.audio_set_volume(Volume)\n\n    def setPosition(self, position):\n        \"\"\"Set the position\n        \"\"\"\n        # setting the position to where the slider was dragged\n        self.mediaplayer.set_position(position / 1000.0)\n        # the vlc MediaPlayer needs a float value between 0 and 1, Qt\n        # uses integer variables, so you need a factor; the higher the\n        # factor, the more precise are the results\n        # (1000 should be enough)\n\n    def updateUI(self):\n        \"\"\"updates the user interface\"\"\"\n        # setting the slider to the desired position\n        self.positionslider.setValue(self.mediaplayer.get_position() * 1000)\n\n        if not self.mediaplayer.is_playing():\n            # no need to call this function if nothing is played\n            self.timer.stop()\n            if not self.isPaused:\n                # after the video finished, the play button stills shows\n                # \"Pause\", not the desired behavior of a media player\n                # this will fix it\n                self.Stop()\n\nif __name__ == \"__main__\":\n    app = QtGui.QApplication(sys.argv)\n    player = Player()\n    player.show()\n    player.resize(640, 480)\n    if sys.argv[1:]:\n        player.OpenFile(sys.argv[1])\n    sys.exit(app.exec_())\n"
  },
  {
    "path": "generated/3.0/examples/tkvlc.py",
    "content": "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# tkinter example for VLC Python bindings\n# Copyright (C) 2015 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n'''A simple example for VLC python bindings using tkinter.\n\nAuthor: Patrick Fay\nDate: 23-09-2015\n'''\n\n# Tested with VLC 3.0.16, 3.0.12, 3.0.11, 3.0.10, 3.0.8 and 3.0.6 with\n# the compatible vlc.py Python-VLC binding, Python 3.11.0, 3.10.0, 3.9.0\n# and 3.7.4 and with tkinter/Tk 8.6.9 on macOS 13.0.1 (amd64 M1), 11.6.1\n# (10.16 amd64 M1), 11.0.1 (10.16 x86-64) and 10.13.6 and with VLC 3.0.18,\n# Python 3.11.0 and tkinter/Tk 8.6.9 on Windows 10, all in 64-bit only.\n__version__ = '22.12.28'  # mrJean1 at Gmail\n\nimport sys\ntry:  # Python 3.4+ only\n    import tkinter as Tk\n    from tkinter import TclError, ttk  # PYCHOK ttk = Tk.ttk\n    from tkinter.filedialog import askopenfilename\n    from tkinter.messagebox import showerror\nexcept ImportError:\n    sys.exit('%s requires Python 3.4 or later' % (sys.argv[0],))\n    # import Tkinter as Tk; ttk = Tk\nimport os\nimport time\nimport vlc\n\n_isMacOS   = sys.platform.startswith('darwin')\n_isLinux   = sys.platform.startswith('linux')\n_isWindows = sys.platform.startswith('win')\n\n_ANCHORED    = 'Anchored'\n_BANNER_H    =  32 if _isMacOS else 64\n_BUTTONS     = 'Buttons'\n_DISABLED    = (      Tk.DISABLED,)\n_ENABLED     = ('!' + Tk.DISABLED,)\n_FULL_OFF    = 'Full Off'\n_FULL_SCREEN = 'Full Screen'\n# see _Tk_Menu.add_item and .bind_shortcut below\n# <https://www.Tcl.Tk/man/tcl8.6/TkCmd/keysyms.html>\n_KEY_SYMBOL  = {'~': 'asciitilde',  '`': 'grave',\n                '!': 'exclam',      '@': 'at',\n                '#': 'numbersign',  '$': 'dollar',\n                '%': 'percent',     '^': 'asciicirum',\n                '&': 'ampersand',   '*': 'asterisk',\n                '(': 'parenleft',   ')': 'parenright',\n                '_': 'underscore',  '-': 'minus',\n                '+': 'plus',        '=': 'equal',\n                '{': 'braceleft',   '}': 'braceright',\n                '[': 'bracketleft', ']': 'bracketright',\n                '|': 'bar',        '\\\\': 'backslash',\n                ':': 'colon',       ';': 'semicolon',\n                '\"': 'quotedbl',    \"'\": 'apostrophe',\n                '<': 'less',        '>': 'greater',\n                ',': 'comma',       '.': 'period',\n                '?': 'question',    '/': 'slash',\n                ' ': 'space',      '\\b': 'BackSpace',  # S!\n               '\\n': 'KP_Enter',   '\\r': 'Return',\n               '\\f': 'Next',       '\\v': 'Prior',\n               '\\t': 'Tab'}  # '\\a': 'space'?\n# see definition of specialAccelerators in <https://\n# GitHub.com/tcltk/tk/blob/main/macosx/tkMacOSXMenu.c>\n_MAC_ACCEL   = {' ': 'Space',    '\\b': 'Backspace',  # s!\n               '\\n': 'Enter',    '\\r': 'Return',\n               '\\f': 'PageDown', '\\v': 'PageUp',\n               '\\t': 'Tab',  # 'BackTab', 'Eject'?\n            'Prior': 'PageUp', 'Next': 'PageDown'}\n\n_MIN_W       =  420\n_MOD_ALT     =  1 << 17  # alt key down?\n_MOD_CMD     =  1 << 3   # command key down\n_MOD_CTRL    =  1 << 2   # ctrl key down\n_MOD_LOCK    =  1 << 1   # caps lock down\n_MOD_SHIFT   =  1 << 0   # shift key down\n_OPACITY     = 'Opacity %s%%'\n_TAB_X       =  32\n_T_CONFIGURE =  Tk.EventType.Configure\n_T_KEY       =  Tk.EventType.Key  # KeyPress\n_TICK_MS     =  100  # millisecs per time tick\n_Tk_Canvas   =  Tk.Canvas\n_Tk_Frame    =  ttk.Frame\n_Tk_Toplevel =  Tk.Toplevel\n_Tk_Version  =  Tk.TkVersion\n_UN_ANCHORED = 'Un-' + _ANCHORED\n_VOLUME      = 'Volume'\n\n_TKVLC_LIBTK_PATH = 'TKVLC_LIBTK_PATH'\n\nif _isMacOS:  # MCCABE 14\n    from ctypes import cdll, c_void_p\n    from ctypes.util import find_library as _find\n\n    # libtk = cdll.LoadLibrary(ctypes.util.find_library('tk'))\n    # returns (None or) the tk library /usr/lib/libtk.dylib\n    # from macOS, but we need the tkX.Y library bundled with\n    # Python 3+ or one matching the version of tkinter\n\n    # Homebrew-built Python, Tcl/Tk, etc. are installed in\n    # different places, usually something like (/usr/- or)\n    # /opt/local/Cellar/tcl-tk/8.6.11_1/lib/libtk8.6.dylib,\n    # found by command line `find /opt -name libtk8.6.dylib`\n\n    def _find_lib(name, *paths):\n        assert os.path.sep == '/'\n        # 1. built into Python\n        for p in (getattr(sys, 'base_prefix', ''), sys.prefix):\n            if p:\n                yield p + '/lib/' + name\n        # 2. from ctypes.find_library, env variable\n        for p in paths:\n            if p:  # is not None\n                p = os.path.expanduser(p)\n                yield p\n                if not p.endswith(name):\n                    yield p + '/' + name\n        # 3. the Homebrew basement\n        from glob import iglob\n        for t in ('/opt', '/usr'):\n            t += '/local/Cellar/tcl-tk/*/lib/' + name\n            for p in iglob(t):\n                yield p\n\n    try:\n        env = os.environ.get(_TKVLC_LIBTK_PATH, '')\n        lib = 'libtk%s.dylib' % (_Tk_Version,)\n        for libtk in _find_lib(lib, _find(lib), *env.split(os.pathsep)):\n            if libtk and lib in libtk and os.access(libtk, os.F_OK):\n                break\n        else:  # not found anywhere\n            if env:  # bad env?\n                t = 'no %s in %%s=%r' % (lib, env)\n            else:  # env not set, suggest\n                t = 'no %s found, use %%s to set a path' % (lib,)\n            raise NameError(t % (_TKVLC_LIBTK_PATH,))\n\n        lib = cdll.LoadLibrary(libtk)\n        # _GetNSView = lib.TkMacOSXDrawableView is the\n        # proper function to call, but that is non-public\n        # (in Tk source file macosx/TkMacOSXSubwindows.c)\n        # Fortunately, lib.TkMacOSXGetRootControl calls\n        # lib.TkMacOSXDrawableView and returns the NSView\n        _GetNSView = lib.TkMacOSXGetRootControl\n        # C signature: void *_GetNSView(void *drawable) to get\n        # the Cocoa/Obj-C NSWindow.contentView attribute, the\n        # drawable NSView object of the (drawable) NSWindow\n        _GetNSView.restype  =  c_void_p\n        _GetNSView.argtypes = (c_void_p,)\n\n    except (NameError, OSError) as x:  # lib, image or symbol not found\n        libtk = str(x)  # imported by examples/psgvlc.py\n\n        def _GetNSView(unused):  # imported by examples/psgvlc.py\n            return None\n\n    del cdll, c_void_p, env, _find, lib\n    Cmd_ = 'Command+'  # bind key modifier, aka Meta_L\n    # With Python 3.9+ on macOS (only!), accelerator keys specified\n    # with the Shift modifier invoke the callback (command) twice,\n    # once without and once with a Key (or KeyPress) event: hold the\n    # former as a pseudo Key event possibly absorbed by the actual\n    # Key event about 1 millisec later.  With Python 3.8- on macOS,\n    # Shift accelerator keys do not work at all: do not define any\n    # Shift accelerator keys in that case\n    _3_9 = sys.version_info[:2] >= (3, 9)\n\nelse:  # Windows OK, untested on *nix, Xwindows\n    libtk = 'N/A'\n    Cmd_  = 'Ctrl+'  # bind key modifier: Control!\n    _3_9  =  True\n\n\ndef _fullscreen(panel, *full):\n    # get/set a panel full-screen or -off\n    f = panel.attributes('-fullscreen')  # or .wm_attributes\n    if full:\n        panel.attributes('-fullscreen', bool(full[0]))\n        panel.update_idletasks()\n    return f\n\n\ndef _geometry(panel, g_w, *h_x_y):\n    # set a panel geometry to C{g} or C{w, h, x, y}.\n    if h_x_y:\n        t = '+'.join(map(str, h_x_y))\n        g = 'x'.join((str(g_w), t))\n    else:\n        g = g_w\n    panel.geometry(g)  # update geometry, then ...\n    g, *t = _geometry5(panel)  # ... get actual ...\n    panel._g = g  # ... as a C{str} and 4 C{int}s\n    # == panel.winfo_width(), _height(), _x(), _y()\n    panel._whxy = tuple(map(int, t))\n    return g\n\n\ndef _geometry1(panel):\n    # get a panel geometry as C{str}\n    panel.update_idletasks()\n    return panel.geometry()\n\n\ndef _geometry5(panel):\n    # get a panel geometry as 5-tuple of C{str}s\n    g = _geometry1(panel)  # '+-x' means absolute -x\n    z, x, y = g.split('+')\n    w, h = z.split('x')\n    return g, w, h, x, y\n\n\ndef _hms(tensecs, secs=''):\n    # format a time (in 1/10-secs) as h:mm:ss.s\n    s = tensecs * 0.1\n    if s < 60:\n        t = '%3.1f%s' % (s, secs)\n    else:\n        m, s = divmod(s, 60)\n        if m < 60:\n            t = '%d:%04.1f' % (int(m), s)\n        else:\n            h, m = divmod(m, 60)\n            t = '%d:%02d:%04.1f' % (int(h), int(m), s)\n    return t\n\n\ndef _underline2(c, label='', underline=-1, **cfg):\n    # update cfg with C{underline=index} or remove C{underline=.}\n    u = label.find(c) if c and label else underline\n    if u >= 0:\n        cfg.update(underline=u)\n    else:  # no underlining\n        c = ''\n    cfg.update(label=label)\n    return c, cfg\n\n\nclass _Tk_Button(ttk.Button):\n    '''A C{_Tk_Button} with a label, inlieu of text.\n    '''\n    def __init__(self, frame, **kwds):\n        cfg = self._cfg(**kwds)\n        ttk.Button.__init__(self, frame, **cfg)\n\n    def _cfg(self, label=None, **kwds):\n        if label is None:\n            cfg = kwds\n        else:\n            cfg = dict(text=label)\n            cfg.update(kwds)\n        return cfg\n\n    def config(self, **kwds):\n        cfg = self._cfg(**kwds)\n        ttk.Button.config(self, **cfg)\n\n    def disabled(self, *disable):\n        '''Dis-/enable this button.\n        '''\n        # <https://TkDocs.com/tutorial/widgets.html>\n        p = self.instate(_DISABLED)\n        if disable:\n            self.state(_DISABLED if disable[0] else _ENABLED)\n        return bool(p)\n\n\nclass _Tk_Item(object):\n    '''A re-configurable C{_Tk_Menu} item.\n    '''\n    def __init__(self, menu, label='', key='', under='', **kwds):\n        '''New menu item.\n        '''\n        self.menu = menu\n        self.idx  = menu.index(label)\n        self.key  = key  # <...>\n\n        self._cfg_d = dict(label=label, **kwds)\n        self._dis_d = False\n        self._under = under  # lower case\n\n    def config(self, **kwds):\n        '''Reconfigure this menu item.\n        '''\n        cfg = self._cfg_d.copy()\n        cfg.update(kwds)\n        if self._under:  # update underlining\n            _, cfg = _underline2(self._under, **cfg)\n        self.menu.entryconfig(self.idx, **cfg)\n\n    def disabled(self, *disable):\n        '''Dis-/enable this menu item.\n        '''\n        # <https://TkDocs.com/tutorial/menus.html>\n        p = self._dis_d\n        if disable:\n            self._dis_d = d = bool(disable[0])\n            self.config(state=Tk.DISABLED if d else Tk.NORMAL)\n        return p\n\n\nclass _Tk_Menu(Tk.Menu):\n    '''C{Tk.Menu} extended with an C{.add_shortcut} method.\n\n       Note, make C{Command-key} shortcuts on macOS work like\n       C{Control-key} shotcuts on X-/Windows using a *single*\n       character shortcut.\n\n       Other modifiers like Shift- and Option- passed thru,\n       unmodified.\n    '''\n    _shortcuts_entries = None  # {}, see .bind_shortcuts_to\n    _shortcuts_widgets = ()\n\n    def __init__(self, master=None, **kwds):\n        # remove dashed line from X-/Windows tearoff menus\n        # like idlelib.editor.EditorWindow.createmenubar\n        # or use root.option_add('*tearOff', False)  Off?\n        # as per <https://TkDocs.com/tutorial/menus.html>\n        Tk.Menu.__init__(self, master, tearoff=False, **kwds)\n\n    def add_item(self, label='', command=None, key='', **kwds):\n        '''C{Tk.menu.add_command} extended with shortcut key\n           accelerator, underline and binding and returning\n           a C{_Tk_Item} instance instead of an C{item} index.\n\n           If needed use modifiers like Shift- and Alt_ or Option-\n           before the *single* shortcut key character.  Do NOT\n           include the Command- or Control- modifier, instead use\n           the platform-specific Cmd_, like Cmd_ + key.  Also,\n           do NOT enclose the key in <...> brackets since those\n           are handled here as needed for the shortcut binding.\n        '''\n        assert callable(command), 'command=%r' % (command,)\n        return self._Item(Tk.Menu.add_command, key, label,\n                                  command=command, **kwds)\n\n    def add_menu(self, label='', menu=None, key='', **kwds):  # untested\n        '''C{Tk.menu.add_cascade} extended with shortcut key\n           accelerator, underline and binding and returning\n           a C{_Tk_Item} instance instead of an C{item} index.\n        '''\n        assert isinstance(menu, _Tk_Menu), 'menu=%r' % (menu,)\n        return self._Item(Tk.Menu.add_cascade, key, label,\n                                  menu=menu, **kwds)\n\n    def bind_shortcut(self, key='', command=None, label='', **unused):\n        '''Bind shortcut key \"<modifier-...-name>\".\n        '''\n        # C{Accelerator} modifiers on macOS are Command-,\n        # Ctrl-, Option- and Shift-, but for .bind[_all] use\n        # <Command-..>, <Ctrl-..>, <Option_..> and <Shift-..>\n        # with a shortcut key name or character (replaced\n        # with its _KEY_SYMBOL if non-alphanumeric)\n        # <https://www.Tcl.Tk/man/tcl8.6/TkCmd/bind.htm#M6>\n        # <https://www.Tcl.Tk/man/tcl8.6/TkCmd/keysyms.html>\n        if key and callable(command) and self._shortcuts_widgets:\n            for w in self._shortcuts_widgets:\n                w.bind(key, command)\n            if label:  # remember the key in this menu\n                idx = self.index(label)\n                self._shortcuts_entries[idx] = key\n        # The Tk modifier for macOS' Command key is called Meta\n        # with Meta_L and Meta_R for the left and right keyboard\n        # keys.  Similarly for macOS' Option key, the modifier\n        # name Alt with Alt_L and Alt_R.  Previously, there were\n        # only the Meta_L and Alt_L keys/modifiers.  See also\n        # <https://StackOverflow.com/questions/6378556/multiple-\n        # key-event-bindings-in-tkinter-control-e-command-apple-e-etc>\n\n    def bind_shortcuts_to(self, *widgets):\n        '''Set widget(s) to bind shortcut keys to, usually the\n           root and/or Toplevel widgets.\n        '''\n        self._shortcuts_entries = {}\n        self._shortcuts_widgets = widgets\n\n    def entryconfig(self, idx, command=None, **kwds):  # PYCHOK signature\n        '''Update a menu item and the shortcut key binding\n           if the menu item command is being changed.\n\n           Note, C{idx} is the item's index in the menu,\n           see C{_Tk_Item} above.\n        '''\n        if command is None:  # XXX postcommand for sub-menu\n            Tk.Menu.entryconfig(self, idx, **kwds)\n        elif callable(command):  # adjust the shortcut key binding\n            Tk.Menu.entryconfig(self, idx, command=command, **kwds)\n            key = self._shortcuts_entries.get(idx, None)\n            if key is not None:\n                for w in self._shortcuts_widgets:\n                    w.bind(key, command)\n\n    def _Item(self, add_, key, label, **kwds):\n        # Add and bind a menu item or sub~menu with an\n        # optional accelerator key (not <..> enclosed)\n        # or underline letter (preceded by underscore),\n        # see <https://TkDocs.com/tutorial/menus.html>.\n        cfg = dict(label=label)\n        if key:  # Use '+' sign, like key = \"Ctrl+Shift+X\"\n            if key.startswith('<') and key.endswith('>'):\n                c = ''  # pass as-is, e.g. <<virtual event>>\n            else:\n                c = '+'  # split into modifiers and char\n                if key.endswith(c):\n                    m = key.rstrip(c).split(c)\n                else:\n                    m = key.split(c)\n                    c = m.pop()\n                for k in ('Key', 'KeyPress', 'KeyRelease'):\n                    while k in m:\n                        m.remove(k)\n                # adjust accelerator key for specials like KP_1,\n                # PageDown and PageUp (on macOS, see function\n                # ParseAccelerator in <https://GitHub.com/tcltk/tk/\n                # blob/main/macosx/tkMacOSXMenu.c> and definition\n                # of specialAccelerators in <https://GitHub.com/\n                # tcltk/tk/blob/main/macosx/tkMacOSXMenu.c>)\n                a = _MAC_ACCEL.get(c, c) if _isMacOS else c\n                if a.upper().startswith('KP_'):\n                    a = a[3:]\n                # accelerator strings are only used for display\n                # ('+' or '-' OK, ' ' space isn't for macOS)\n                cfg.update(accelerator='+'.join(m + [a]))\n                # replace key with Tk keysymb, allow F1 thru F35\n                # (F19 on macOS) and because shortcut keys are\n                # case-sensitive, use lower-case unless specified\n                # as an upper-case letter with Shift+ modifier\n                s = _KEY_SYMBOL.get(c, c)\n                if len(s) == 1 and s.isupper() \\\n                               and 'Shift' not in m:\n                    s = s.lower()\n                # default to single key down case\n                if len(c) == 1:\n                    m.append('Key')  # == KeyPress\n                # replace Ctrl modifier with Tk Control\n                while 'Ctrl' in m:\n                    m[m.index('Ctrl')] = 'Control'\n                # <enclosed> for .bind_shortcut/.bind\n                key = '<' + '-'.join(m + [s]) + '>'\n                if _isMacOS or len(c) != 1 or not c.isalnum():\n                    c = ''  # no underlining\n                else:  # only Windows?\n                    c, cfg = _underline2(c, **cfg)\n\n        else:  # like idlelib, underline char after ...\n            c, u = '', label.find('_')  # ... underscore\n            if u >= 0:  # ... and remove underscore\n                label = label[:u] + label[u+1:]\n                cfg.update(label=label)\n                if u < len(label) and not _isMacOS:\n                    # c = label[u]\n                    cfg.update(underline=u)\n\n        if kwds:  # may still override accelerator ...\n            cfg.update(kwds)  # ... and underline\n        add_(self, **cfg)  # first _add then ...\n        self.bind_shortcut(key, **cfg)  # ... bind\n        return _Tk_Item(self, key=key, under=c, **cfg)\n\n\nclass _Tk_Slider(Tk.Scale):\n    '''Scale with some add'l attributres\n    '''\n    _var = None\n\n    def __init__(self, frame, to=1, **kwds):\n        if isinstance(to, int):\n            f, v = 0, Tk.IntVar()\n        else:\n            f, v = 0.0, Tk.DoubleVar()\n        cfg = dict(from_=f, to=to,\n                   orient=Tk.HORIZONTAL,\n                   showvalue=0,\n                   variable=v)\n        cfg.update(kwds)\n        Tk.Scale.__init__(self, frame, **cfg)\n        self._var = v\n\n    def set(self, value):\n        # doesn't move the slider\n        self._var.set(value)\n        Tk.Scale.set(self, value)\n\n\nclass Player(_Tk_Frame):\n    '''The main window handling with events, etc.\n    '''\n    _anchored  =  True  # under the video panel\n    _BUTTON_H  = _BANNER_H\n    _debugs    =  0\n    _isFull    = ''  # or geometry\n    _length    =  0  # length time ticks\n    _lengthstr = ''  # length h:m:s\n    _muted     =  False\n    _opacity   =  90 if _isMacOS else 100  # percent\n    _opaque    =  False\n    _rate      =  0.0\n    _ratestr   = ''\n    _scaleX    =  1\n    _scaleXstr = ''\n    _sliding   =  False\n    _snapshots =  0\n    _stopped   =  None\n    _title     = 'tkVLCplayer'\n    _volume    =  50  # percent\n\n    def __init__(self, parent, title='', video='', debug=False):  # PYCHOK called!\n        _Tk_Frame.__init__(self, parent)\n\n        self.debug  = bool(debug)\n        self.parent = parent  # == root\n        self.video  = os.path.expanduser(video)\n        if title:\n            self._title = str(title)\n        parent.title(self._title)\n#       parent.iconname(self._title)\n\n        # set up tickers to avoid None error\n        def _pass():\n            pass\n\n        self._tick_a = self.after(1, _pass)\n        self._tick_c = self.after(2, _pass)\n        self._tick_r = self.after(3, _pass)\n        self._tick_s = self.after(4, _pass)  # .after_idle\n        self._tick_t = self.after(5, _pass)\n        self._tick_z = self.after(6, _pass)\n\n        # panels to play videos and hold buttons, sliders,\n        # created *before* the File menu to be able to bind\n        # the shortcuts keys to both windows/panels.\n        self.videoPanel = v = self._VideoPanel()\n        self._bind_events(v)  # or parent\n        self.buttonsPanel = b = self._ButtonsPanel()\n        self._bind_events(b)\n\n        mb = _Tk_Menu(self.parent)  # menu bar\n        parent.config(menu=mb)\n#       self.menuBar = mb\n\n        # macOS shortcuts <https://Support.Apple.com/en-us/HT201236>\n        m = _Tk_Menu(mb)  # Video menu, shortcuts to both panels\n        m.bind_shortcuts_to(v, b)\n        m.add_item('Open...', self.OnOpen, key=Cmd_ + 'O')\n        m.add_separator()\n        self.playItem = m.add_item('Play', self.OnPlay, key=Cmd_ + 'P')  # Play/Pause\n        m.add_item('Stop', self.OnStop, key=Cmd_ + '\\b')  # BackSpace\n        m.add_separator()\n        m.add_item('Zoom In',  self.OnZoomIn,  key=(Cmd_ + 'Shift++') if _3_9 else '')\n        m.add_item('Zoom Out', self.OnZoomOut, key=(Cmd_ + '-')       if _3_9 else '')\n        m.add_separator()\n        m.add_item('Faster', self.OnFaster, key=(Cmd_ + 'Shift+>') if _3_9 else '')\n        m.add_item('Slower', self.OnSlower, key=(Cmd_ + 'Shift+<') if _3_9 else '')\n        m.add_separator()\n        m.add_item('Normal 1X', self.OnNormal, key=Cmd_ + '=')\n        m.add_separator()\n        self.muteItem = m.add_item('Mute', self.OnMute, key=Cmd_ + 'M')\n        m.add_separator()\n        m.add_item('Snapshot', self.OnSnapshot, key=Cmd_ + 'T')\n        m.add_separator()\n        self.fullItem = m.add_item(_FULL_SCREEN, self.OnFull, key=Cmd_ + 'F')\n        m.add_separator()\n        m.add_item('Close', self.OnClose, key=Cmd_ + 'W')\n        mb.add_cascade(menu=m, label='Video')\n#       self.videoMenu = m\n\n        m = _Tk_Menu(mb)  # Video menu, shortcuts to both panels\n        m.bind_shortcuts_to(v, b)\n        self.anchorItem = m.add_item(_UN_ANCHORED, self.OnAnchor, key=Cmd_ + 'A')\n        m.add_separator()\n        self.opaqueItem = m.add_item(_OPACITY % (self._opacity,), self.OnOpacity, key=Cmd_ + 'Y')\n        m.add_item('Normal 100%', self.OnOpacity100)\n        mb.add_cascade(menu=m, label=_BUTTONS)\n#       self.buttonsMenu = m\n\n        if _isMacOS and self.debug:  # Special macOS \"windows\" menu\n            # <https://TkDocs.com/tutorial/menus.html> \"Providing a Window Menu\"\n            # XXX Which (virtual) events are generated other than Configure?\n            m = _Tk_Menu(mb, name='window')  # must be name='window'\n            mb.add_cascade(menu=m, label='Windows')\n\n        # VLC player\n        args = ['--no-xlib'] if _isLinux else []\n        self.Instance = vlc.Instance(args)\n        self.player = self.Instance.media_player_new()\n\n        b.update_idletasks()\n        v.update_idletasks()\n        if self.video:  # play video for a second, adjusting the panel\n            self._play(self.video)\n            self.after(1000, self.OnPause)\n#       elif _isMacOS:  # <https://StackOverflow.com/questions/18394597/\n#           # is-there-a-way-to-create-transparent-windows-with-tkinter>\n#           self._stopped = True\n#           self._set_opacity()\n        self.OnTick()  # set up the timer\n\n        # Keep the video panel at least as wide as the buttons panel\n        # and move it down enough to put the buttons panel above it.\n        self._BUTTON_H = d = b.winfo_height()\n        b.minsize(width=_MIN_W, height=d)\n        v.minsize(width=_MIN_W, height=0)\n        _, w, h, _, y = _geometry5(v)\n        y = int(y) + d + _BANNER_H\n        _geometry(v, w, h, _TAB_X, y)\n        self._anchorPanels()\n        self._set_volume()\n\n    def _anchorPanels(self, video=False):\n        # Put the buttons panel under the video\n        # or the video panel above the buttons\n        if self._anchored and not self._isFull:\n            self._debug(self._anchorPanels)\n            v = self.videoPanel\n            if _isMacOS and _fullscreen(v):\n                # macOS green button full-screen?\n                _fullscreen(v, False)\n                self.OnFull()\n            else:\n                b = self.buttonsPanel\n                v.update_idletasks()\n                b.update_idletasks()\n                h = v.winfo_height()\n                d = h + _BANNER_H  # vertical delta\n                if video:  # move/adjust video panel\n                    w = b.winfo_width()  # same as ...\n                    x = b.winfo_x()      # ... buttons\n                    y = b.winfo_y() - d  # ... and above\n                    g = v\n                else:  # move/adjust buttons panel\n                    h = b.winfo_height()  # unchanged\n                    if h > self._BUTTON_H and _fullscreen(b):\n                        # macOS green button full-screen?\n                        _fullscreen(b, False)\n                        h = self._BUTTON_H\n                    w = v.winfo_width()  # unchanged\n                    x = v.winfo_x()  # same as the video\n                    y = v.winfo_y() + d  # below the video\n                    g = b\n#               _g = g._g\n                _geometry(g, max(w, _MIN_W), h, x, y)\n                if video:  # and g._g != _g:\n                    self._set_aspect_ratio(True)\n\n    def _bind_events(self, panel):\n        # set up handlers for several events\n        try:\n            p  = panel\n            p_ = p.protocol\n        except AttributeError:\n            p  = p.master  # == p.parent\n            p_ = p.protocol\n        if _isWindows:  # OK for macOS\n            p_('WM_DELETE_WINDOW', self.OnClose)\n#       Event Types <https://www.Tcl.Tk/man/tcl8.6/TkCmd/bind.html#M7>\n        p.bind('<Configure>',       self.OnConfigure)  # window resize, position, etc.\n        # needed on macOS to catch window close events\n        p.bind('<Destroy>',         self.OnClose)      # window half-dead\n#       p.bind('<Activate>',        self.OnActive)     # window activated\n#       p.bind('<Deactivate>',      self.OffActive)    # window deactivated\n        p.bind('<FocusIn>',         self.OnFocus)      # getting keyboard focus\n#       p.bind('<FocusOut>',        self.OffFocus)     # losing keyboard focus\n#       p.bind('<Return>',          self.OnReturn)     # highlighted button\n        if _isMacOS:\n            p.bind('<Command-.>', self.OnClose)\n#           p.bind('<Command-,.'. self.OnPreferences)\n#           p.bind('<KP_Enter>',  self.OnReturn)  # highlighted button\n        # attrs holding the most recently set _geometry ...\n        assert not hasattr(panel, '_g')\n        panel._g = ''  # ... as a sC{str} and ...\n        assert not hasattr(panel, '_whxy')\n        panel._whxy = ()  # ... 4-tuple of C{ints}s\n\n    def _ButtonsPanel(self):\n        # create panel with buttons and sliders\n        b = _Tk_Toplevel(self.parent, name='buttons')\n        t = '%s - %s' % (self._title, _BUTTONS)\n        b.title(t)  # '' removes the window banner\n        b.resizable(True, False)\n\n        f = _Tk_Frame(b)\n        # button are too small on Windows if width is given\n        p = _Tk_Button(f, label='Play', command=self.OnPlay)\n        #                 width=len('Pause'), underline=0\n        s = _Tk_Button(f, label='Stop', command=self.OnStop)\n        m = _Tk_Button(f, label='Mute', command=self.OnMute)\n        #                 width=len('Unmute'), underline=0\n        q = _Tk_Slider(f, command=self.OnPercent, to=100,\n                          label=_VOLUME)  # length=170\n        p.pack(side=Tk.LEFT, padx=8)\n        s.pack(side=Tk.LEFT)\n        m.pack(side=Tk.LEFT, padx=8)\n        q.pack(fill=Tk.X,    padx=4, expand=1)\n        f.pack(side=Tk.BOTTOM, fill=Tk.X)\n\n        f = _Tk_Frame(b)  # new frame?\n        t = _Tk_Slider(f, command=self.OnTime, to=1000,  # millisecs\n                          length=_MIN_W)  # label='Time'\n        t.pack(side=Tk.BOTTOM, fill=Tk.X, expand=1)\n        f.pack(side=Tk.BOTTOM, fill=Tk.X)\n\n        # <https://www.PythonTutorial.net/tkinter/tkinter-window>\n        # <https://TkDocs.com/tutorial/windows.html>\n        # b.attributes('-topmost', 1)\n\n        # self.videoPanel.update()  # needed to ...\n# #     b.overrideredirect(True)  # ignore the panel\n        b.update_idletasks()\n\n        self.muteButton    = m\n        self.playButton    = p\n        self.timeSlider    = t\n        self.percentSlider = q\n        return b\n\n    def _debug(self, where, *event, **kwds):\n        # Print where an event is are handled.\n        if self.debug:\n            self._debugs += 1\n            d = dict(anchored=self._anchored,\n                       isFull=bool(self._isFull),\n                      opacity=self._opacity,\n                       opaque=self._opaque,\n                      stopped=self._stopped,\n                       volume=self._volume)\n            p = self.player\n            if p and p.get_media():\n                d.update(playing=p.is_playing(),\n                            rate=p.get_rate(),\n                           scale=p.video_get_scale(),\n                           scaleX=self._scaleX)\n            try:  # final OnClose may throw TclError\n                d.update(Buttons=_geometry1(self.buttonsPanel))\n                d.update(  Video=_geometry1(self.videoPanel))\n                if event:  # an event\n                    event = event[0]\n                    d.update(event=event)\n                    w = str(event.widget)\n#                   d.update(widget=type(event.widget))  # may fail\n                    d.update(Widget={'.':        'Video',\n                                     '.buttons': _BUTTONS}.get(w, w))\n            except (AttributeError, TclError):\n                pass\n            d.update(kwds)\n            d = ', '.join('%s=%s' % t for t in sorted(d.items()))\n            print('%4s: %s %s' % (self._debugs, where.__name__, d))\n\n    def _frontmost(self):\n        # Move panels to the front ...  temporarily.\n        for p in (self.videoPanel, self.buttonsPanel):\n            p.attributes('-topmost', True)\n            p.update_idletasks()\n            p.attributes('-topmost', False)\n            try:  # no Toplevel.force_focus\n                p.force_focus()\n            except AttributeError:\n                pass\n\n    def OnAnchor(self, *unused):\n        '''Toggle anchoring of the panels.\n        '''\n        self._debug(self.OnAnchor)\n        self._anchored = not self._anchored\n        if self._anchored:\n            self._anchorPanels()\n            a = _UN_ANCHORED\n        else:  # move the buttons panel to the top-left\n            b = self.buttonsPanel\n            h = b.winfo_height()  # unchanged\n            _geometry(b, _MIN_W, h, _TAB_X, _BANNER_H)\n            a = _ANCHORED\n        self.anchorItem.config(label=a)\n\n    def OnClose(self, *event):\n        '''Closes the window(s) and quit.\n        '''\n        self._debug(self.OnClose, *event)\n        # print('_quit: bye')\n        self.after_cancel(self._tick_a)\n        self.after_cancel(self._tick_c)\n        self.after_cancel(self._tick_r)\n        self.after_cancel(self._tick_s)\n        self.after_cancel(self._tick_t)\n        self.after_cancel(self._tick_z)\n        v = self.videoPanel\n        v.update_idletasks()\n        self.quit()  # stops .mainloop\n\n    def OnConfigure(self, event):\n        '''Some widget configuration changed.\n        '''\n        w, T = event.widget, event.type  # int\n        if T == _T_CONFIGURE and w.winfo_toplevel() is w:\n            # i.e. w is videoFrame/Panel or buttonsPanel\n            if w is self.videoPanel:\n                a = self._set_aspect_ratio  # force=True\n            elif w is self.buttonsPanel and self._anchored:\n                a = self._anchorPanels  # video=True\n            else:\n                a = None\n            # prevent endless, recursive onConfigure events due to changing\n            # the buttons- and videoPanel geometry, especially on Windows\n            if a and w._whxy != (event.width, event.height, event.x, event.y):\n                self.after_cancel(self._tick_c)\n                self._debug(self.OnConfigure, event)\n                self._tick_c = self.after(250, a, True)\n\n    def OnFaster(self, *event):\n        '''Speed the video up by 25%.\n        '''\n        self._set_rate(1.25, *event)\n        self._debug(self.OnFaster)\n\n    def OnFocus(self, *unused):\n        '''Got the keyboard focus.\n        '''\n        self._debug(self.OnFocus)\n        self._frontmost()\n#       self._set_aspect_ratio()\n#       self._wiggle()\n\n    def OnFull(self, *unused):\n        '''Toggle full/off screen.\n        '''\n        self._debug(self.OnFull)\n        # <https://www.Tcl.Tk/man/tcl8.6/TkCmd/wm.htm#M10>\n        # self.after_cancel(self._tick_t)\n        v = self.videoPanel\n        if not _fullscreen(v):\n            self._isFull = _geometry1(v)\n            _fullscreen(v, True)  # or .wm_attributes\n            v.bind('<Escape>', self.OnFull)\n            f = _FULL_OFF\n        else:\n            _fullscreen(v, False)\n            v.unbind('<Escape>')\n            _geometry(v, self._isFull)\n            self._isFull = ''\n            self._anchorPanels()\n            f = _FULL_SCREEN\n        self.fullItem.config(label=f)\n\n    def OnMute(self, *unused):\n        '''Mute/Unmute audio.\n        '''\n        if self._stopped or self._opaque:\n            return  # button.disabled\n        self._debug(self.OnMute)\n        # audio un/mute may be unreliable, see vlc.py docs.\n        self._muted = m = not self._muted  # self.player.audio_get_mute()\n        self.player.audio_set_mute(m)\n        u = 'Unmute' if m else 'Mute'\n        # i = u.index('m' if m else 'M')  # 2 if m else 0\n        self.muteItem.config(label=u)\n        self.muteButton.config(label=u)  # width=len(u), underline=i\n        self.OnPercent()  # re-label the slider\n\n    def OnNormal(self, *unused):\n        '''Normal speed and 1X zoom.\n        '''\n        self._frontmost()\n        self._set_rate(0.0)\n        self._set_zoom(0.0)\n#       self._wiggle()\n        self._set_aspect_ratio(True)\n        self._debug(self.OnNormal)\n\n    def OnOpacity(self, *unused):\n        '''Use the percent slider to adjust the opacity.\n        '''\n        self.muteButton.disabled(True)  # greyed out?\n        self.muteItem.disabled(True)  # greyed out?\n        self._opaque = True\n        self._set_opacity()\n        self._debug(self.OnOpacity)\n\n    def OnOpacity100(self, *unused):\n        '''Set the opacity to 100%.\n        '''\n        self._frontmost()\n        self._set_opacity(100)\n        self._debug(self.OnOpacity100)\n\n    def OnOpen(self, *unused):\n        '''Show the file dialog to choose a video, then play it.\n        '''\n        self._debug(self.OnOpen)\n        self._reset()\n        # XXX ... +[CATransaction synchronize] called within transaction\n        v = askopenfilename(initialdir=os.path.expanduser('~'),\n                            title='Choose a video',\n                            filetypes=(('all files', '*.*'),\n                                       ('mp4 files', '*.mp4'),\n                                       ('mov files', '*.mov')))\n        self._play(os.path.expanduser(v))\n        self._set_aspect_ratio(True)\n\n    def OnPause(self, *unused):\n        '''Toggle between Pause and Play.\n        '''\n        self._debug(self.OnPause)\n        p = self.player\n        if p.get_media():\n            self._pause_play(not p.is_playing())\n#           self._wiggle()\n            p.pause()  # toggles\n\n    def OnPercent(self, *unused):\n        '''Percent slider changed, adjust the opacity or volume.\n        '''\n        self._debug(self.OnPercent)\n        s = max(0, min(100, self.percentSlider.get()))\n        if self._opaque or self._stopped:\n            self._set_opacity(s)\n        else:\n            self._set_volume(s)\n\n    def OnPlay(self, *unused):\n        '''Play video, if there's no video to play or\n           playing, show a Tk.FileDialog to select one\n        '''\n        self._debug(self.OnPlay)\n        p = self.player\n        m = p.get_media()\n        if not m:\n            if self.video:\n                self._play(self.video)\n                self.video = ''\n            else:\n                self.OnOpen()\n        elif p.play():  # == -1, play failed\n            self._showError('play ' + repr(m))\n        else:\n            self._pause_play(True)\n            if _isMacOS:\n                self._wiggle()\n\n    def OnSlower(self, *event):\n        '''Slow the video down by 20%.\n        '''\n        self._set_rate(0.80, *event)\n        self._debug(self.OnSlower)\n\n    def OnSnapshot(self, *unused):\n        '''Take a snapshot and save it (as .PNG only).\n        '''\n        p = self.player\n        if p and p.get_media():\n            self._snapshots += 1\n            S = 'Snapshot%s' % (self._snapshots,)\n            s = '%s-%s.PNG' % (self._title, S)  # PNG only\n            if p.video_take_snapshot(0, s, 0, 0):\n                self._showError('take ' + S)\n\n    def OnStop(self, *unused):\n        '''Stop the player, clear panel, etc.\n        '''\n        self._debug(self.OnStop)\n        self._reset()\n\n    def OnTick(self):\n        '''Udate the time slider with the video time.\n        '''\n        p = self.player\n        if p:\n            s = self.timeSlider\n            if self._length > 0:\n                if not self._sliding:  # see .OnTime\n                    t = max(0, p.get_time() // _TICK_MS)\n                    if t != s.get():\n                        s.set(t)\n                        self._set_buttons_title(t)\n            else:  # get video length in millisecs\n                t = p.get_length()\n                if t > 0:\n                    self._length = t = max(1, t // _TICK_MS)\n                    self._lengthstr = _hms(t, secs=' secs')\n                    s.config(to=t)  # tickinterval=t / 5)\n        # re-start the 1/4-second timer\n        self._tick_t = self.after(250, self.OnTick)\n\n    def OnTime(self, *unused):\n        '''Time slider has been moved by user.\n        '''\n        if self.player and self._length:\n            self._sliding = True  # slider moving, see .OnTick\n            self.after_cancel(self._tick_s)\n            t = self.timeSlider.get()\n            self._tick_s = self.after_idle(self._set_time, t * _TICK_MS)\n            self._set_buttons_title(t)\n            self._debug(self.OnTime, tensecs=t)\n\n    def OnZoomIn(self, *event):\n        '''Zoom in by 25%.\n        '''\n        self._set_zoom(1.25, *event)\n        self._debug(self.OnZoomIn)\n\n    def OnZoomOut(self, *event):\n        '''Zoom out by 20%.\n        '''\n        self._set_zoom(0.80, *event)\n        self._debug(self.OnZoomOut)\n\n    def _pause_play(self, playing):\n        # re-label menu item and button, adjust callbacks\n        p = 'Pause' if playing else 'Play'\n        c = self.OnPlay if playing is None else self.OnPause  # PYCHOK attr\n        self.playButton.config(label=p, command=c)\n        self.playItem.config(label=p, command=c)\n        self.muteButton.disabled(False)\n        self.muteItem.disabled(False)\n        self._stopped = self._opaque = False\n        self._set_buttons_title()\n        self._set_opacity()  # no re-label\n        self._set_volume()\n        self._set_aspect_ratio(True)\n\n    def _play(self, video):\n        # helper for OnOpen and OnPlay\n        if os.path.isfile(video):  # Creation\n            m = self.Instance.media_new(str(video))  # unicode\n            p = self.player\n            p.set_media(m)\n            t = '%s - %s' % (self._title, os.path.basename(video))\n            self.videoPanel.title(t)\n#           self.buttonsPanel.title(t)\n\n            # get the window handle for VLC to render the video\n            h = self.videoCanvas.winfo_id()  # .winfo_visualid()?\n            if _isWindows:\n                p.set_hwnd(h)\n            elif _isMacOS:\n                # (1) the handle on macOS *must* be an NSView\n                # (2) the video fills the entire panel, covering\n                # all frames, buttons, sliders, etc. inside it\n                ns = _GetNSView(h)\n                if ns:\n                    p.set_nsobject(ns)\n                else:  # no libtk: no video, only audio\n                    p.set_xwindow(h)\n            else:  # *nix, Xwindows\n                p.set_xwindow(h)  # fails on Windows\n            self.OnPlay(None)\n\n    def _reset(self):\n        # stop playing, clear panel\n        p = self.player\n        if p:\n            p.stop()\n            self.timeSlider.set(0)\n            self._pause_play(None)\n            self._sliding = False\n            self._stopped = True\n            self.OnOpacity()\n\n    def _set_aspect_ratio(self, force=False):\n        # set the video panel aspect ratio and re-anchor\n        p = self.player\n        if p and not self._isFull:\n            v = self.videoPanel\n            g, w, h, x, y = _geometry5(v)\n            if force or g != v._g:  # update\n                self.after_cancel(self._tick_a)\n                a, b = p.video_get_size(0)  # often (0, 0)\n                if b > 0 and a > 0:\n                    # adjust the video panel ...\n                    if a > b:  # ... landscape height\n                        h = round(float(w) * b / a)\n                    else:  # ... or portrait width\n                        w = round(float(h) * a / a)\n                    _g = _geometry(v, w, h, x, y)\n                    self._debug(self._set_aspect_ratio, a=a, b=b)\n                    if self._anchored and (force or _g != g):\n                        self._anchorPanels()\n                # redo periodically since (1) player.video_get_size()\n                # only returns non-zero width and height after playing\n                # for a while and (2) avoid too frequent updates during\n                # manual resizing of the video panel\n                self._tick_a = self.after(500, self._set_aspect_ratio)\n\n    def _set_buttons_title(self, *tensecs):\n        # set the buttons panel title\n        T, s = self._length, self._lengthstr\n        if s and T:\n            t =  tensecs[0] if tensecs else self.timeSlider.get()\n            t = _hms(t) if t < T else s\n            t = '%s - %s / %s%s%s' % (self._title, t, s, self._scaleXstr, self._ratestr)\n        else:  # reset panel title\n            t = '%s - %s' % (self._title, _BUTTONS)\n            self._length = 0\n#           self._lengthstr = ''\n        self.buttonsPanel.title(t)\n\n    def _set_opacity(self, *percent):  # 100% fully opaque\n        # set and re-label the opacity, panels and menu item\n        if percent:\n            self._opacity = p = percent[0]\n        else:\n            p = self._opacity\n        a = max(0.2, min(1, p * 1e-2))\n        self.videoPanel.attributes('-alpha', a if self._stopped else 1)\n        self.buttonsPanel.attributes('-alpha', a)\n#       if _isMacOS:  # <https://TkDocs.com/tutorial/windows.html>\n#           self.buttonsPanel.attributes('-transparent', a)\n        s = _OPACITY % (p,)\n        self.opaqueItem.config(label=s)\n        if self._opaque or self._stopped:\n            self._set_percent(p, label=s)\n\n    def _set_percent(self, percent, **cfg):\n        # set and re-label the slider\n        self.percentSlider.config(**cfg)\n        self.percentSlider.set(percent)\n\n    def _set_rate(self, factor, *event):\n        # change the video rate\n        p = self.player\n        self.after_cancel(self._tick_r)\n        if not event:  # delay the menu event as a false key event ...\n            # ... and possibly overwritten by the actual key event\n            self._tick_r = self.after(3, self._set_rate, factor, False)\n        elif p:\n            r = p.get_rate() * factor\n            if r > 0:\n                r = max(0.2, min(10.0, r))\n                t = ' - %d%%' % (int(r * 100),)\n            else:\n                r, t = 1.0, ''\n            p.set_rate(r)\n            self._rate = r\n            self._ratestr = t\n            self._set_buttons_title()\n\n    def _set_time(self, millisecs):\n        # set player to time\n        p = self.player\n        if p:\n            p.set_time(millisecs)\n        self._sliding = False  # see .OnTick\n\n    def _set_volume(self, *volume):\n        # set and re-label the volume\n        if volume:\n            self._volume = v = volume[0]\n        else:\n            v = self._volume\n        m = ' (Muted)' if self._muted else ''\n        V = '%s %s%%' % (_VOLUME, v)\n        self._set_percent(v, label=V + m)\n        p = self.player\n        if p and p.is_playing() and not self._stopped:\n            # .audio_set_volume returns 0 on success, -1 otherwise,\n            # e.g. if the player is stopped or doesn't have media\n            if p.audio_set_volume(v):  # and p.get_media():\n                self._showError('set ' + V)\n\n    def _set_zoom(self, factor, *event):\n        # zoom the video in/out, see cocoavlc.py\n        p = self.player\n        self.after_cancel(self._tick_z)\n        if not event:  # delay the menu event as a false key event ...\n            # ... and possibly overwritten by the actual key event\n            self._tick_z = self.after(3, self._set_zoom, factor, False)\n        elif p:\n            x = self._scaleX * factor\n            if x > 1:\n                s = x\n                t = ' - %.1fX' % (x,)\n            else:\n                x, s, t = 1, 0.0, ''\n            p.video_set_scale(s)\n#           self.videoPanel.update_idletasks()\n            self._scaleX = x\n            self._scaleXstr = t\n            self._set_buttons_title()\n\n    def _showError(self, verb):\n        '''Display a simple error dialog.\n        '''\n        t = 'Unable to %s' % (verb,)\n        showerror(self._title, t)\n        # sys.exit(t)\n\n    def _VideoPanel(self):\n        # create panel to play video\n        v = _Tk_Frame(self.parent)\n        c = _Tk_Canvas(v)  # takefocus=True\n        c.pack(fill=Tk.BOTH, expand=1)\n        v.pack(fill=Tk.BOTH, expand=1)\n        v.update_idletasks()\n\n        self.videoCanvas = c\n        self.videoFrame  = v\n        # root is used for updates, NOT ...\n        return self.parent  # ... the frame\n\n    def _wiggle(self, d=4):\n        # wiggle the video to fill the window on macOS\n        if not self._isFull:\n            v = self.videoPanel\n            g, w, h, x, y = _geometry5(v)\n            w = int(w) + d\n            # x = int(x) - d\n            # h = int(h) + d\n            if _geometry(v, w, h, x, y) != g:\n                self.after_idle(_geometry, v, g)\n        if d > 1:  # repeat a few times\n            self.after(100, self._wiggle, d - 1)\n\n\ndef print_version(name=''):  # imported by psgvlc.py\n    # show all versions, this module, tkinter, libtk, vlc.py, libvlc, etc.\n\n    # sample output on macOS:\n\n    # % python3 ./tkvlc.py -v\n    # tkvlc.py: 22.12.28\n    # tkinter: 8.6\n    # libTk: /Library/Frameworks/Python.framework/Versions/3.11/lib/libtk8.6.dylib\n    # is_TK: aqua, isAquaTk, isCocoaTk\n    # vlc.py: 3.0.12119 (Mon May 31 18:25:17 2021 3.0.12)\n    # libVLC: 3.0.16 Vetinari (0x3001000)\n    # plugins: /Applications/VLC.app/Contents/MacOS/plugins\n    # Python: 3.11.0 (64bit) macOS 13.0.1 arm64\n\n    # sample output on Windows:\n\n    # PS C: python3 .\\tkvlc.py -v\n    # tkvlc.py: 22.12.28\n    # tkinter: 8.6\n    # libTk: N/A\n    # is_TK: win32\n    # vlc.py: 3.0.12119 (Mon May 31 18:25:17 2021 3.0.12)\n    # libVLC: 3.0.18 Vetinari (0x3001200)\n    # plugins: C:\\Program Files\\VideoLAN\\VLC\n    # Python: 3.11.0 (64bit) Windows 10\n\n    # see <https://TkDocs.com/tutorial/menus.html> or private property\n    r = Tk.Tk()\n    t = r.tk.call('tk', 'windowingsystem'),  # r._windowingsystem\n    r.destroy()\n    if _isMacOS:\n        try:\n            from idlelib import macosx\n            m  = macosx.__dict__\n            t += tuple(sorted(n for n, t in m.items() if n.startswith('is') and\n                                                         n.endswith('Tk') and\n                                                         callable(t) and t()))\n        except ImportError:  # Python 10: no test.support ...\n            pass\n    t = ', '.join(t) or 'N/A'\n\n    n = os.path.basename(name or __file__)\n    for t in ((n, __version__), (Tk.__name__, _Tk_Version), ('libTk', libtk), ('is_Tk', t)):\n        print('%s: %s' % t)\n\n    try:\n        vlc.print_version()\n        vlc.print_python()\n    except AttributeError:\n        try:\n            os.system(sys.executable + ' -m vlc -v')\n        except OSError:\n            pass\n\n\nif __name__ == '__main__':  # MCCABE 13\n\n    _argv0 = sys.argv[0]\n    _debug = False\n    _video = ''\n\n    while len(sys.argv) > 1:\n        arg = sys.argv.pop(1)\n        if arg in ('-v', '--version'):\n            print_version()\n            sys.exit(0)\n        elif '-debug'.startswith(arg) and len(arg) > 3:\n            _debug = True\n        elif arg.startswith('-'):\n            print('usage: %s  [-v | --version]  [-debug]  [<video_file_name>]' % (_argv0,))\n            sys.exit(1)\n        elif arg:  # video file\n            _video = os.path.expanduser(arg)\n            if not os.path.isfile(_video):\n                print('%s error, no such file: %r' % (_argv0, arg))\n                sys.exit(1)\n\n    root = Tk.Tk()  # create a Tk.App()\n    player = Player(root, video=_video, debug=_debug)\n    if _isWindows:  # see function _test() at the bottom of ...\n        # <https://GitHub.com/python/cpython/blob/3.11/Lib/tkinter/__init__.py>\n        root.iconify()\n        root.update()\n        root.deiconify()\n        root.mainloop()  # forever\n        root.destroy()  # this is necessary on Windows to avoid ...\n        # ... Fatal Python Error: PyEval_RestoreThread: NULL tstate\n    else:\n        root.mainloop()  # forever\n"
  },
  {
    "path": "generated/3.0/examples/video_sync/README.md",
    "content": "## Video Synchronization with python-vlc\n\n<img src=\"figure.png\" width=\"600\" align=\"center\">\n\nEach 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.\n\nIn 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.\n\nIn 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.\n\nNote: for the sake of clarity, the figure only shows the case of 3 client/slave videos.\n"
  },
  {
    "path": "generated/3.0/examples/video_sync/main.py",
    "content": "#! /usr/bin/env python3\n#\n# PyQt5-based video-sync example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"\nA VLC python bindings player implemented with PyQt5 that is meant to be utilized\nas the \"master\" player that controls all \"slave players\".\n\nAuthor: Saveliy Yusufov, Columbia University, sy2685@columbia.edu\nDate: 25 January 2019\n\"\"\"\n\nimport platform\nimport queue\nimport os\nimport subprocess\nimport sys\n\nfrom PyQt5 import QtWidgets, QtGui, QtCore\nimport vlc\nfrom network import Server\n\n\nclass Player(QtWidgets.QMainWindow):\n    \"\"\"A \"master\" Media Player using VLC and Qt\n    \"\"\"\n\n    def __init__(self, master=None):\n        QtWidgets.QMainWindow.__init__(self, master)\n        self.setWindowTitle(\"Main Media Player\")\n\n        # Create a basic vlc instance\n        self.instance = vlc.Instance()\n\n        self.media = None\n\n        # Create an empty vlc media player\n        self.mediaplayer = self.instance.media_player_new()\n\n        self.create_ui()\n        self.data_queue = queue.Queue()\n        self.is_paused = False\n\n        self.timer = QtCore.QTimer(self)\n        self.timer.setInterval(100)\n        self.timer.timeout.connect(self.update_ui)\n        self.timer.timeout.connect(self.update_time_label)\n\n    def create_ui(self):\n        \"\"\"Set up the user interface, signals & slots\n        \"\"\"\n        self.widget = QtWidgets.QWidget(self)\n        self.setCentralWidget(self.widget)\n\n        # In this widget, the video will be drawn\n        if platform.system() == \"Darwin\":  # for MacOS\n            self.videoframe = QtWidgets.QMacCocoaViewContainer(0)\n        else:\n            self.videoframe = QtWidgets.QFrame()\n\n        self.palette = self.videoframe.palette()\n        self.palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 0))\n        self.videoframe.setPalette(self.palette)\n        self.videoframe.setAutoFillBackground(True)\n\n        # Create the time display\n        self.timelabel = QtWidgets.QLabel(\"00:00:00\", self)\n\n        # Create the position slider (QSlider)\n        self.positionslider = QtWidgets.QSlider(QtCore.Qt.Horizontal, self)\n        self.positionslider.setToolTip(\"Position\")\n        self.positionslider.setMaximum(1000)\n        self.positionslider.sliderMoved.connect(self.set_position)\n        # self.positionslider.sliderPressed.connect(self.set_position)\n        self.positionslider.sliderMoved.connect(self.update_time_label)\n\n        # Create the \"previous frame\" button\n        self.previousframe = QtWidgets.QPushButton()\n        self.previousframe.setFixedWidth(25)\n        self.previousframe.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSkipBackward))\n        self.previousframe.clicked.connect(self.on_previous_frame)\n\n        # Create the play button and connect it to the play/pause function\n        self.playbutton = QtWidgets.QPushButton()\n        self.playbutton.setFixedWidth(40)\n        self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPlay))\n        self.playbutton.clicked.connect(self.play_pause)\n\n        # Create the \"next frame\" button\n        self.nextframe = QtWidgets.QPushButton()\n        self.nextframe.setFixedWidth(25)\n        self.nextframe.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSkipForward))\n        self.nextframe.clicked.connect(self.on_next_frame)\n\n        # Create the \"Playback rate\" label\n        self.pb_rate_label = QtWidgets.QLabel(\"Playback rate: {}x\".format(self.mediaplayer.get_rate()), self)\n\n        # Create the \"decrease playback rate\" button\n        self.decr_pb_rate = QtWidgets.QPushButton()\n        self.decr_pb_rate.setFixedWidth(30)\n        self.decr_pb_rate.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSeekBackward))\n        self.decr_pb_rate.clicked.connect(self.decr_mov_play_rate)\n\n        # Create the stop button and connect it to the stop function\n        self.stopbutton = QtWidgets.QPushButton()\n        self.stopbutton.setFixedWidth(30)\n        self.stopbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaStop))\n        self.stopbutton.clicked.connect(self.stop)\n\n        # Create the \"increase playback rate\" button\n        self.incr_pb_rate = QtWidgets.QPushButton()\n        self.incr_pb_rate.setFixedWidth(30)\n        self.incr_pb_rate.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaSeekForward))\n        self.incr_pb_rate.clicked.connect(self.incr_mov_play_rate)\n\n        self.top_control_box = QtWidgets.QHBoxLayout()\n\n        # Add the time and position slider to the 1st controls layout\n        self.top_control_box.addWidget(self.timelabel)\n        self.top_control_box.addWidget(self.positionslider)\n\n        self.bottom_control_box = QtWidgets.QHBoxLayout()\n\n        # Add the buttons to the 2nd controls layout\n        self.bottom_control_box.addWidget(self.previousframe)\n        self.bottom_control_box.addWidget(self.playbutton)\n        self.bottom_control_box.addWidget(self.nextframe)\n        self.bottom_control_box.addWidget(self.pb_rate_label)\n        self.bottom_control_box.addWidget(self.decr_pb_rate)\n        self.bottom_control_box.addWidget(self.stopbutton)\n        self.bottom_control_box.addWidget(self.incr_pb_rate)\n\n        self.vboxlayout = QtWidgets.QVBoxLayout()\n\n        self.vboxlayout.addWidget(self.videoframe)\n        self.vboxlayout.addLayout(self.top_control_box)\n        self.vboxlayout.addLayout(self.bottom_control_box)\n\n        self.widget.setLayout(self.vboxlayout)\n\n        menu_bar = self.menuBar()\n\n        # File menu\n        file_menu = menu_bar.addMenu(\"File\")\n\n        # Create submenu to start new processes from file menu\n        new_menu = QtWidgets.QMenu(\"Launch\", self)\n        file_menu.addMenu(new_menu)\n        new_video_action = QtWidgets.QAction(\"New Video\", self)\n        new_menu.addAction(new_video_action)\n        new_video_action.triggered.connect(on_new_video)\n\n        # Create actions to load a new media file and to close the app\n        open_action = QtWidgets.QAction(\"Load Video\", self)\n        close_action = QtWidgets.QAction(\"Close App\", self)\n        file_menu.addAction(open_action)\n        file_menu.addAction(close_action)\n        open_action.triggered.connect(self.open_file)\n        close_action.triggered.connect(sys.exit)\n\n    def play_pause(self):\n        \"\"\"Toggle play/pause status\n        \"\"\"\n        if self.mediaplayer.is_playing():\n            signal = 'p'\n            self.mediaplayer.pause()\n            self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPlay))\n            self.is_paused = True\n            self.timer.stop()\n        else:\n            if self.mediaplayer.play() == -1:\n                self.open_file()\n                return\n\n            signal = 'P'\n            self.mediaplayer.play()\n            self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPause))\n            self.timer.start()\n            self.is_paused = False\n\n        # Reset the queue & send the appropriate signal, i.e., play/pause\n        self.data_queue.queue.clear()\n        self.data_queue.put('d')\n        self.data_queue.put(signal)\n\n    def stop(self):\n        \"\"\"Stop player\n        \"\"\"\n        self.mediaplayer.stop()\n        self.playbutton.setIcon(self.style().standardIcon(QtWidgets.QStyle.SP_MediaPlay))\n\n        # Reset the time label back to 00:00:00\n        time = QtCore.QTime(0, 0, 0, 0)\n        self.timelabel.setText(time.toString())\n\n        # Reset the queue\n        self.data_queue.queue.clear()\n        self.data_queue.put('d')\n        self.data_queue.put('S')\n\n        # Reset the media position slider\n        self.positionslider.setValue(0)\n\n        self.timer.stop()\n\n    def on_next_frame(self):\n        \"\"\"Go forward one frame.\n\n            The Python VLC binding next_frame function causes a:\n\n            \"direct3d11 vout display error: SetThumbNailClip failed\"\n\n            error when next_frame is called while the video is playing,\n            so we are using our own fucntion to get the next frame.\n        \"\"\"\n        # self.mediaplayer.next_frame()\n        next_frame_time = self.mediaplayer.get_time() + self.mspf()\n\n        # Reset the queue & put the next frame's time into the queue\n        self.data_queue.queue.clear()\n        self.data_queue.put('d')\n        self.data_queue.put(next_frame_time)\n        self.update_time_label()\n        self.mediaplayer.set_time(next_frame_time)\n\n    def on_previous_frame(self):\n        \"\"\"Go backward one frame\"\"\"\n        next_frame_time = self.mediaplayer.get_time() - self.mspf()\n\n        # Reset the queue & put the next frame's time into the queue\n        self.data_queue.queue.clear()\n        self.data_queue.put('d')\n        self.data_queue.put(next_frame_time)\n        self.update_time_label()\n        self.mediaplayer.set_time(next_frame_time)\n\n    def mspf(self):\n        \"\"\"Milliseconds per frame\"\"\"\n        return int(1000 // (self.mediaplayer.get_fps() or 25))\n\n    def incr_mov_play_rate(self):\n        \"\"\"Increase the movie play rate by a factor of 2.\"\"\"\n        if self.mediaplayer.get_rate() >= 64:\n            return\n\n        rate = self.mediaplayer.get_rate() * 2\n        result = self.mediaplayer.set_rate(rate)\n        if result == 0:\n            self.data_queue.queue.clear()\n            self.data_queue.put('d')\n            self.data_queue.put('>')\n            self.update_pb_rate_label()\n\n    def decr_mov_play_rate(self):\n        \"\"\"Decrease the movie play rate by a factor of 2.\"\"\"\n        if self.mediaplayer.get_rate() <= 0.125:\n            return\n\n        rate = self.mediaplayer.get_rate() * 0.5\n        result = self.mediaplayer.set_rate(rate)\n        if result == 0:\n            self.data_queue.queue.clear()\n            self.data_queue.put('d')\n            self.data_queue.put('<')\n            self.update_pb_rate_label()\n\n    def open_file(self):\n        \"\"\"Open a media file in a MediaPlayer\n        \"\"\"\n        dialog_txt = \"Choose Media File\"\n        filename = QtWidgets.QFileDialog.getOpenFileName(self, dialog_txt, os.path.expanduser('~'))\n        if not filename[0]:\n            return\n\n        # getOpenFileName returns a tuple, so use only the actual file name\n        self.media = self.instance.media_new(filename[0])\n\n        # Put the media in the media player\n        self.mediaplayer.set_media(self.media)\n\n        # Parse the metadata of the file\n        self.media.parse()\n\n        # Set the title of the track as window title\n        self.setWindowTitle(\"Main Media Player: {}\".format(self.media.get_meta(0)))\n\n        # The media player has to be 'connected' to the QFrame (otherwise the\n        # video would be displayed in it's own window). This is platform\n        # specific, so we must give the ID of the QFrame (or similar object) to\n        # vlc. Different platforms have different functions for this.\n        if platform.system() == \"Linux\":  # for Linux using the X Server\n            self.mediaplayer.set_xwindow(int(self.videoframe.winId()))\n        elif platform.system() == \"Windows\":  # for Windows\n            self.mediaplayer.set_hwnd(int(self.videoframe.winId()))\n        elif platform.system() == \"Darwin\":  # for MacOS\n            self.mediaplayer.set_nsobject(int(self.videoframe.winId()))\n\n        self.play_pause()\n\n    def set_position(self):\n        \"\"\"Set the movie position according to the position slider.\n\n        The vlc MediaPlayer needs a float value between 0 and 1, Qt uses\n        integer variables, so you need a factor; the higher the factor,\n        the more precise are the results (1000 should suffice).\n        \"\"\"\n        # Set the media position to where the slider was dragged\n        self.timer.stop()\n        pos = self.positionslider.value()\n\n        if pos >= 0:\n            self.data_queue.queue.clear()\n            self.data_queue.put('d')\n            current_time = self.mediaplayer.get_time()\n\n            # If the player is stopped, do not attempt to send a -1!!!\n            if current_time == -1:\n                self.timer.start()\n                return\n            self.data_queue.put(current_time)\n\n        self.mediaplayer.set_position(pos * .001)\n        self.timer.start()\n\n    def update_ui(self):\n        \"\"\"Updates the user interface\"\"\"\n\n        # Set the slider's position to its corresponding media position\n        # Note that the setValue function only takes values of type int,\n        # so we must first convert the corresponding media position.\n        media_pos = int(self.mediaplayer.get_position() * 1000)\n        self.positionslider.setValue(media_pos)\n\n        if media_pos >= 0 and self.mediaplayer.is_playing():\n            current_time = self.mediaplayer.get_time()\n            self.data_queue.put(current_time)\n        else:\n            self.data_queue.queue.clear()\n\n        # No need to call this function if nothing is played\n        if not self.mediaplayer.is_playing():\n            self.timer.stop()\n\n            # After the video finished, the play button stills shows \"Pause\",\n            # which is not the desired behavior of a media player.\n            # This fixes that \"bug\".\n            if not self.is_paused:\n                self.stop()\n\n    def update_time_label(self):\n        mtime = QtCore.QTime(0, 0, 0, 0)\n        self.time = mtime.addMSecs(self.mediaplayer.get_time())\n        self.timelabel.setText(self.time.toString())\n\n    def update_pb_rate_label(self):\n        self.pb_rate_label.setText(\"Playback rate: {}x\".format(str(self.mediaplayer.get_rate())))\n\n\ndef on_new_video():\n    \"\"\"Launches a new PyQt5-based \"mini\" media player\n    \"\"\"\n    if platform.system() == \"Windows\":\n        subprocess.Popen([\"python\", \"mini_player.py\"], shell=True)\n    else:\n        subprocess.Popen([\"python\", \"mini_player.py\"])\n\n\ndef main():\n    \"\"\"Entry point for our simple vlc player\n    \"\"\"\n    app = QtWidgets.QApplication(sys.argv)\n    player = Player()\n\n    _ = Server(\"localhost\", 10000, player.data_queue)\n\n    player.show()\n    player.resize(640, 480)\n    sys.exit(app.exec_())\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "generated/3.0/examples/video_sync/mini_player.py",
    "content": "#! /usr/bin/env python3\n#\n# PyQt5-based video-sync example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"\nThis module contains a bare-bones VLC player class to play videos.\n\nAuthor: Saveliy Yusufov, Columbia University, sy2685@columbia.edu\nDate: 25 January 2019\n\"\"\"\n\nimport os\nimport sys\nimport queue\nimport platform\n\nfrom PyQt5 import QtWidgets, QtGui, QtCore\nimport vlc\nfrom network import Client\n\n\nclass MiniPlayer(QtWidgets.QMainWindow):\n    \"\"\"Stripped-down PyQt5-based media player class to sync with \"master\" video.\n    \"\"\"\n\n    def __init__(self, data_queue, master=None):\n        QtWidgets.QMainWindow.__init__(self, master)\n        self.setWindowTitle(\"Mini Player\")\n        self.statusbar = self.statusBar()\n        self.statusbar.showMessage(\"Ready\")\n\n        # Create a basic vlc instance\n        self.instance = vlc.Instance()\n\n        self.media = None\n\n        # Create an empty vlc media player\n        self.mediaplayer = self.instance.media_player_new()\n\n        self.init_ui()\n        self.open_file()\n\n        self.timer = QtCore.QTimer(self)\n        self.timer.setInterval(10)\n        self.timer.timeout.connect(self.update_ui)\n\n        self.data_queue = data_queue\n        self.timer.start()\n\n    def init_ui(self):\n        \"\"\"Set up the user interface\n        \"\"\"\n        self.widget = QtWidgets.QWidget(self)\n        self.setCentralWidget(self.widget)\n\n        # In this widget, the video will be drawn\n        if platform.system() == \"Darwin\":  # for MacOS\n            self.videoframe = QtWidgets.QMacCocoaViewContainer(0)\n        else:\n            self.videoframe = QtWidgets.QFrame()\n\n        self.palette = self.videoframe.palette()\n        self.palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 0))\n        self.videoframe.setPalette(self.palette)\n        self.videoframe.setAutoFillBackground(True)\n\n        self.vboxlayout = QtWidgets.QVBoxLayout()\n        self.vboxlayout.addWidget(self.videoframe)\n        self.widget.setLayout(self.vboxlayout)\n\n    def open_file(self):\n        \"\"\"Open a media file in a MediaPlayer\n        \"\"\"\n        dialog_txt = \"Choose Media File\"\n        filename = QtWidgets.QFileDialog.getOpenFileName(self, dialog_txt, os.path.expanduser('~'))\n        if not filename[0]:\n            return\n\n        # getOpenFileName returns a tuple, so use only the actual file name\n        self.media = self.instance.media_new(filename[0])\n\n        # Put the media in the media player\n        self.mediaplayer.set_media(self.media)\n\n        # Parse the metadata of the file\n        self.media.parse()\n\n        # Set the title of the track as the window title\n        self.setWindowTitle(\"{}\".format(self.media.get_meta(0)))\n\n        # The media player has to be 'connected' to the QFrame (otherwise the\n        # video would be displayed in it's own window). This is platform\n        # specific, so we must give the ID of the QFrame (or similar object) to\n        # vlc. Different platforms have different functions for this\n        if platform.system() == \"Linux\":  # for Linux using the X Server\n            self.mediaplayer.set_xwindow(int(self.videoframe.winId()))\n        elif platform.system() == \"Windows\":  # for Windows\n            self.mediaplayer.set_hwnd(int(self.videoframe.winId()))\n        elif platform.system() == \"Darwin\":  # for MacOS\n            self.mediaplayer.set_nsobject(int(self.videoframe.winId()))\n\n        # Start playing the video as soon as it loads\n        self.mediaplayer.play()\n\n    def update_ui(self):\n        self.update_statusbar()\n\n        try:\n            val = self.data_queue.get(block=False)\n        except queue.Empty:\n            return\n\n        if val == '<':\n            self.mediaplayer.set_rate(self.mediaplayer.get_rate() * 0.5)\n            return\n        if val == '>':\n            self.mediaplayer.set_rate(self.mediaplayer.get_rate() * 2)\n            return\n        if val == 'P':\n            self.mediaplayer.play()\n            return\n        if val == 'p':\n            self.mediaplayer.pause()\n            return\n        if val == 'S':\n            self.mediaplayer.stop()\n            return\n\n        val = int(val)\n        if val != self.mediaplayer.get_time():\n            self.mediaplayer.set_time(val)\n\n    def update_statusbar(self):\n        mtime = QtCore.QTime(0, 0, 0, 0)\n        time = mtime.addMSecs(self.mediaplayer.get_time())\n        self.statusbar.showMessage(time.toString())\n\n\ndef main():\n    \"\"\"Entry point for our simple vlc player\n    \"\"\"\n    app = QtWidgets.QApplication(sys.argv)\n\n    data_queue = queue.Queue()\n\n    player = MiniPlayer(data_queue)\n    player.show()\n    player.resize(480, 480)\n\n    _ = Client(\"localhost\", 10000, data_queue)\n    sys.exit(app.exec_())\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "generated/3.0/examples/video_sync/network.py",
    "content": "#\n# PyQt5-based video-sync example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"\nThe client/server classes that keep multiple VLC python bindings players\nsynchronized.\n\nAuthor: Saveliy Yusufov, Columbia University, sy2685@columbia.edu\nDate: 25 January 2019\n\"\"\"\n\nimport os\nimport platform\nimport socket\nimport sys\nimport struct\nimport threading\nimport logging\nfrom concurrent import futures\n\nlogger = logging.getLogger(__name__)\nlogger.setLevel(logging.DEBUG)\n\nlogger.setLevel(logging.DEBUG)\n\n# create console handler and set level to debug\nch = logging.StreamHandler()\nch.setLevel(logging.DEBUG)\n\n# create formatter\nformatter = logging.Formatter(\"%(asctime)s - %(name)s - %(levelname)s - %(message)s\")\n\n# add formatter to ch\nch.setFormatter(formatter)\n\n# add ch to logger\nlogger.addHandler(ch)\n\n\nclass Server:\n    \"\"\"Data sender server\"\"\"\n\n    def __init__(self, host, port, data_queue):\n\n        if platform.system() == \"Windows\":\n\n            # Create a TCP/IP socket\n            self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\n            # Bind the socket to the port\n            logger.info(\"Server started on %s port %s\", host, port)\n            self.sock.bind((host, port))\n\n        else:\n            server_address = \"./uds_socket\"\n\n            # Make sure the socket does not already exist\n            try:\n                os.unlink(server_address)\n            except OSError:\n                if os.path.exists(server_address):\n                    raise\n\n            # Create a UDS socket\n            self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\n\n            # Bind the socket to the address\n            logger.info(\"Server starting up on %s\", server_address)\n            self.sock.bind(server_address)\n\n        # Listen for incoming connections\n        self.sock.listen(5)\n\n        self.clients = set()\n        self.data_queue = data_queue\n        listener_thread = threading.Thread(target=self.listen_for_clients, args=())\n        listener_thread.daemon = True\n        listener_thread.start()\n\n    def listen_for_clients(self):\n        logger.info(\"Now listening for clients\")\n        t = threading.Thread(target=self.data_sender, args=())\n        t.daemon = True\n        t.start()\n\n        while True:\n            client, _ = self.sock.accept()\n            logger.info(\"Accepted Connection from: %s\", client)\n            self.clients.add(client)\n\n    def data_sender(self):\n        while True:\n            data = self.data_queue.get()\n            data = str(data).encode()\n            msg = struct.pack(\">I\", len(data)) + data\n\n            with futures.ThreadPoolExecutor(max_workers=5) as ex:\n                for client in self.clients:\n                    ex.submit(self.sendall, client, msg)\n\n    def sendall(self, client, data):\n        \"\"\"Wraps socket module's `sendall` function\"\"\"\n        try:\n            client.sendall(data)\n        except socket.error:\n            logger.exception(\"Connection to client: %s was broken!\", client)\n            client.close()\n            self.clients.remove(client)\n\n\nclass Client:\n    \"\"\"Data receiver client\"\"\"\n\n    def __init__(self, address, port, data_queue):\n        self.data_queue = data_queue\n\n        if platform.system() == \"Windows\":\n\n            # Create a TCP/IP socket\n            self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\n            # Connect the socket to the port where the server is listening\n            logger.info(\"Connecting to %s port %s\", address, port)\n            self.sock.connect((address, port))\n        else:\n\n            # Create a UDS socket\n            self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)\n\n            # Connect the socket to the port where the server is listening\n            server_address = \"./uds_socket\"\n            logger.info(\"New client connecting to %s\", server_address)\n\n            try:\n                self.sock.connect(server_address)\n            except socket.error:\n                logger.exception()\n                sys.exit(1)\n\n        thread = threading.Thread(target=self.data_receiver, args=())\n        thread.daemon = True\n        thread.start()\n\n    def recv_all(self, size):\n        \"\"\"Helper function to recv `size` number of bytes, or return False\"\"\"\n        data = bytearray()\n\n        while (len(data) < size):\n            packet = self.sock.recv(size - len(data))\n            if not packet:\n                return False\n\n            data.extend(packet)\n\n        return data\n\n    def recv_msg(self):\n        \"\"\"Receive the message size, n, and receive n bytes into a buffer\"\"\"\n        raw_msg_size = self.recv_all(4)\n        if not raw_msg_size:\n            return False\n\n        msg_size = struct.unpack(\">I\", raw_msg_size)[0]\n        return self.recv_all(msg_size)\n\n    def data_receiver(self):\n        \"\"\"Handles receiving, parsing, and queueing data\"\"\"\n        logger.info(\"New data receiver thread started.\")\n\n        try:\n            while True:\n                raw_data = self.recv_msg()\n                if raw_data:\n                    data = raw_data.decode()\n                    if 'd' in set(data):\n                        self.data_queue.queue.clear()\n                        continue\n                    else:\n                        self.data_queue.put(data)\n        except:\n            logger.exception(\"Closing socket: %s\", self.sock)\n            self.sock.close()\n            return\n"
  },
  {
    "path": "generated/3.0/examples/wxvlc.py",
    "content": "#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# <https://github.com/oaubert/python-vlc/blob/master/examples/wxvlc.py>\n#\n# WX example for VLC Python bindings\n# Copyright (C) 2009-2010 the VideoLAN team\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\"\"\"\nA simple example for VLC python bindings using wxPython.\n\nAuthor: Michele Orrù\nDate: 23-11-2010\n\"\"\"\n\n# Tested with Python 3.7.4, wxPython 4.0.6 on macOS 10.13.6 only.\n__version__ = '19.07.28'  # mrJean1 at Gmail dot com\n\n# import external libraries\nimport wx  # 2.8 ... 4.0.6\nimport vlc\n\n# import standard libraries\nfrom os.path import basename, expanduser, isfile, join as joined\nimport sys\n\ntry:\n    unicode        # Python 2\nexcept NameError:\n    unicode = str  # Python 3\n\n\nclass Player(wx.Frame):\n    \"\"\"The main window has to deal with events.\n    \"\"\"\n    def __init__(self, title='', video=''):\n        wx.Frame.__init__(self, None, -1, title=title or 'wxVLC',\n                          pos=wx.DefaultPosition, size=(550, 500))\n\n        self.video = video\n\n        # Menu Bar\n        #   File Menu\n        self.frame_menubar = wx.MenuBar()\n        self.file_menu = wx.Menu()\n        self.file_menu.Append(1, \"&Open...\", \"Open from file...\")\n        self.file_menu.AppendSeparator()\n        self.file_menu.Append(2, \"&Close\", \"Quit\")\n        self.Bind(wx.EVT_MENU, self.OnOpen, id=1)\n        self.Bind(wx.EVT_MENU, self.OnExit, id=2)\n        self.frame_menubar.Append(self.file_menu, \"File\")\n        self.SetMenuBar(self.frame_menubar)\n\n        # Panels\n        # The first panel holds the video and it's all black\n        self.videopanel = wx.Panel(self, -1)\n        self.videopanel.SetBackgroundColour(wx.BLACK)\n\n        # The second panel holds controls\n        ctrlpanel = wx.Panel(self, -1)\n        self.timeslider = wx.Slider(ctrlpanel, -1, 0, 0, 1000)\n        self.timeslider.SetRange(0, 1000)\n        self.pause = wx.Button(ctrlpanel, label=\"Pause\")\n        self.pause.Disable()\n        self.play = wx.Button(ctrlpanel, label=\"Play\")\n        self.stop = wx.Button(ctrlpanel, label=\"Stop\")\n        self.stop.Disable()\n        self.mute = wx.Button(ctrlpanel, label=\"Mute\")\n        self.volslider = wx.Slider(ctrlpanel, -1, 0, 0, 100, size=(100, -1))\n\n        # Bind controls to events\n        self.Bind(wx.EVT_BUTTON, self.OnPlay,   self.play)\n        self.Bind(wx.EVT_BUTTON, self.OnPause,  self.pause)\n        self.Bind(wx.EVT_BUTTON, self.OnStop,   self.stop)\n        self.Bind(wx.EVT_BUTTON, self.OnMute,   self.mute)\n        self.Bind(wx.EVT_SLIDER, self.OnVolume, self.volslider)\n\n        # Give a pretty layout to the controls\n        ctrlbox = wx.BoxSizer(wx.VERTICAL)\n        box1 = wx.BoxSizer(wx.HORIZONTAL)\n        box2 = wx.BoxSizer(wx.HORIZONTAL)\n        # box1 contains the timeslider\n        box1.Add(self.timeslider, 1)\n        # box2 contains some buttons and the volume controls\n        box2.Add(self.play, flag=wx.RIGHT, border=5)\n        box2.Add(self.pause)\n        box2.Add(self.stop)\n        box2.Add((-1, -1), 1)\n        box2.Add(self.mute)\n        box2.Add(self.volslider, flag=wx.TOP | wx.LEFT, border=5)\n        # Merge box1 and box2 to the ctrlsizer\n        ctrlbox.Add(box1, flag=wx.EXPAND | wx.BOTTOM, border=10)\n        ctrlbox.Add(box2, 1, wx.EXPAND)\n        ctrlpanel.SetSizer(ctrlbox)\n        # Put everything togheter\n        sizer = wx.BoxSizer(wx.VERTICAL)\n        sizer.Add(self.videopanel, 1, flag=wx.EXPAND)\n        sizer.Add(ctrlpanel, flag=wx.EXPAND | wx.BOTTOM | wx.TOP, border=10)\n        self.SetSizer(sizer)\n        self.SetMinSize((350, 300))\n\n        # finally create the timer, which updates the timeslider\n        self.timer = wx.Timer(self)\n        self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)\n\n        # VLC player controls\n        self.Instance = vlc.Instance()\n        self.player = self.Instance.media_player_new()\n\n    def OnExit(self, evt):\n        \"\"\"Closes the window.\n        \"\"\"\n        self.Close()\n\n    def OnOpen(self, evt):\n        \"\"\"Pop up a new dialow window to choose a file, then play the selected file.\n        \"\"\"\n        # if a file is already running, then stop it.\n        self.OnStop(None)\n\n        video = self.video\n        if video:\n            self.video = ''\n        else:  # Create a file dialog opened in the current home directory,\n            # to show all kind of files, having as title \"Choose a ...\".\n            dlg = wx.FileDialog(self, \"Choose a video file\", expanduser('~'),\n                                      \"\", \"*.*\", wx.FD_OPEN)  # XXX wx.OPEN\n            if dlg.ShowModal() == wx.ID_OK:\n                video = joined(dlg.GetDirectory(), dlg.GetFilename())\n            # finally destroy the dialog\n            dlg.Destroy()\n\n        if isfile(video):  # Creation\n            self.Media = self.Instance.media_new(unicode(video))\n            self.player.set_media(self.Media)\n            # Report the title of the file chosen\n            title = self.player.get_title()\n            # if an error was encountred while retrieving the title,\n            # otherwise use filename\n            self.SetTitle(\"%s - %s\" % (title if title != -1 else 'wxVLC', basename(video)))\n\n            # set the window id where to render VLC's video output\n            handle = self.videopanel.GetHandle()\n            if sys.platform.startswith('linux'):  # for Linux using the X Server\n                self.player.set_xwindow(handle)\n            elif sys.platform == \"win32\":  # for Windows\n                self.player.set_hwnd(handle)\n            elif sys.platform == \"darwin\":  # for MacOS\n                self.player.set_nsobject(handle)\n            self.OnPlay(None)\n\n            # set the volume slider to the current volume\n            self.volslider.SetValue(self.player.audio_get_volume() / 2)\n\n    def OnPlay(self, evt):\n        \"\"\"Toggle the status to Play/Pause.\n\n        If no file is loaded, open the dialog window.\n        \"\"\"\n        # check if there is a file to play, otherwise open a\n        # wx.FileDialog to select a file\n        if not self.player.get_media():\n            self.OnOpen(None)\n            # Try to launch the media, if this fails display an error message\n        elif self.player.play():  # == -1:\n            self.errorDialog(\"Unable to play.\")\n        else:\n            # adjust window to video aspect ratio\n            # w, h = self.player.video_get_size()\n            # if h > 0 and w > 0:  # often (0, 0)\n            #     self.videopanel....\n            self.timer.Start(1000)  # XXX millisecs\n            self.play.Disable()\n            self.pause.Enable()\n            self.stop.Enable()\n\n    def OnPause(self, evt):\n        \"\"\"Pause the player.\n        \"\"\"\n        if self.player.is_playing():\n            self.play.Enable()\n            self.pause.Disable()\n        else:\n            self.play.Disable()\n            self.pause.Enable()\n        self.player.pause()\n\n    def OnStop(self, evt):\n        \"\"\"Stop the player.\n        \"\"\"\n        self.player.stop()\n        # reset the time slider\n        self.timeslider.SetValue(0)\n        self.timer.Stop()\n        self.play.Enable()\n        self.pause.Disable()\n        self.stop.Disable()\n\n    def OnTimer(self, evt):\n        \"\"\"Update the time slider according to the current movie time.\n        \"\"\"\n        # since the self.player.get_length can change while playing,\n        # re-set the timeslider to the correct range.\n        length = self.player.get_length()\n        self.timeslider.SetRange(-1, length)\n\n        # update the time on the slider\n        time = self.player.get_time()\n        self.timeslider.SetValue(time)\n\n    def OnMute(self, evt):\n        \"\"\"Mute/Unmute according to the audio button.\n        \"\"\"\n        muted = self.player.audio_get_mute()\n        self.player.audio_set_mute(not muted)\n        self.mute.SetLabel(\"Mute\" if muted else \"Unmute\")\n        # update the volume slider;\n        # since vlc volume range is in [0, 200],\n        # and our volume slider has range [0, 100], just divide by 2.\n        # self.volslider.SetValue(self.player.audio_get_volume() / 2)\n\n    def OnVolume(self, evt):\n        \"\"\"Set the volume according to the volume sider.\n        \"\"\"\n        volume = self.volslider.GetValue() * 2\n        # vlc.MediaPlayer.audio_set_volume returns 0 if success, -1 otherwise\n        if self.player.audio_set_volume(volume) == -1:\n            self.errorDialog(\"Failed to set volume\")\n\n    def errorDialog(self, errormessage):\n        \"\"\"Display a simple error dialog.\n        \"\"\"\n        edialog = wx.MessageDialog(self, errormessage, 'Error', wx.OK|\n                                                                wx.ICON_ERROR)\n        edialog.ShowModal()\n\n\nif __name__ == \"__main__\":\n\n    _video = ''\n\n    while len(sys.argv) > 1:\n        arg = sys.argv.pop(1)\n        if arg.lower() in ('-v', '--version'):\n            # show all versions, sample output on macOS:\n            # % python3 ./wxvlc.py -v\n            # wxvlc.py: 19.07.28 (wx 4.0.6 osx-cocoa (phoenix) wxWidgets 3.0.5 _core.cpython-37m-darwin.so)\n            # vlc.py: 3.0.6109 (Sun Mar 31 20:14:16 2019 3.0.6)\n            # LibVLC version: 3.0.6 Vetinari (0x3000600)\n            # LibVLC compiler: clang: warning: argument unused during compilation: '-mmacosx-version-min=10.7' [-Wunused-command-line-argument]\n            # Plugin path: /Applications/VLC3.0.6.app/Contents/MacOS/plugins\n            # Python: 3.7.4 (64bit) macOS 10.13.6\n\n            # Print version of this vlc.py and of the libvlc\n            c = basename(str(wx._core).split()[-1].rstrip('>').strip(\"'\").strip('\"'))\n            print('%s: %s (%s %s %s)' % (basename(__file__), __version__,\n                                         wx.__name__, wx.version(), c))\n            try:\n                vlc.print_version()\n                vlc.print_python()\n            except AttributeError:\n                pass\n            sys.exit(0)\n\n        elif arg.startswith('-'):\n            print('usage: %s  [-v | --version]  [<video_file_name>]' % (sys.argv[0],))\n            sys.exit(1)\n\n        elif arg:  # video file\n            _video = expanduser(arg)\n            if not isfile(_video):\n                print('%s error: no such file: %r' % (sys.argv[0], arg))\n                sys.exit(1)\n\n    # Create a wx.App(), which handles the windowing system event loop\n    app = wx.App()  # XXX wx.PySimpleApp()\n    # Create the window containing our media player\n    player = Player(video=_video)\n    # show the player window centred\n    player.Centre()\n    player.Show()\n    # run the application\n    app.MainLoop()\n"
  },
  {
    "path": "generated/3.0/pyproject.toml",
    "content": "[build-system]\nrequires = [\"setuptools\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"python-vlc\"\ndynamic = [ \"version\" ]\nauthors = [\n    { name = \"Olivier Aubert\", email = \"contact@olivieraubert.net\" }\n]\nmaintainers = [\n    { name = \"Olivier Aubert\", email = \"contact@olivieraubert.net\" }\n]\nreadme = { file = \"README.module\", content-type = \"text/x-rst\" }\nlicense = { text = \"LGPL-2.1+\" }\ndescription = \"VLC bindings for python.\"\nclassifiers = [\n    \"Development Status :: 5 - Production/Stable\",\n    \"Intended Audience :: Developers\",\n    \"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)\",\n    \"Operating System :: MacOS :: MacOS X\",\n    \"Operating System :: Microsoft :: Windows\",\n    \"Operating System :: POSIX :: Linux\",\n    \"Operating System :: POSIX :: Other\",\n    \"Programming Language :: Python\",\n    \"Programming Language :: Python :: 2\",\n    \"Programming Language :: Python :: 3\",\n    \"Topic :: Multimedia\",\n    \"Topic :: Multimedia :: Sound/Audio\",\n    \"Topic :: Multimedia :: Video\"\n]\nkeywords = [\"vlc\", \"video\"]\n\n[project.urls]\nHomepage = \"https://wiki.videolan.org/PythonBinding\"\nDocumentation = \"https://python-vlc.readthedocs.io/en/latest/\"\nRepository = \"https://github.com/oaubert/python-vlc.git\"\n\"Alternate repository\" = \"https://git.videolan.org/?p=vlc/bindings/python.git;a=summary\"\n\"Bug Tracker\" = \"https://github.com/oaubert/python-vlc/issues\"\n\n[tool.setuptools.dynamic]\nversion = {attr = \"vlc.__version__\"}\n"
  },
  {
    "path": "generated/3.0/vlc.py",
    "content": "#! /usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Python ctypes bindings for VLC\n#\n# Copyright (C) 2009-2017 the VideoLAN team\n# $Id: $\n#\n# Authors: Olivier Aubert <contact at olivieraubert.net>\n#          Jean Brouwers <MrJean1 at gmail.com>\n#          Geoff Salmon <geoff.salmon at gmail.com>\n#\n# This library is free software; you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License as\n# published by the Free Software Foundation; either version 2.1 of the\n# License, or (at your option) any later version.\n#\n# This library is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this library; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA\n\n\"\"\"This module provides bindings for the LibVLC public API, see\nhttps://wiki.videolan.org/LibVLC.\n\nYou can find the documentation and a README file with some examples\nat https://www.olivieraubert.net/vlc/python-ctypes/.\n\nBasically, the most important class is :class:`Instance`, which is used\nto create a libvlc instance. From this instance, you then create\n:class:`MediaPlayer` and :class:`MediaListPlayer` instances.\n\nAlternatively, you may create instances of the :class:`MediaPlayer` and\n:class:`MediaListPlayer` class directly and an instance of :class:`Instance`\nwill be implicitly created. The latter can be obtained using the\n:meth:`MediaPlayer.get_instance` and :class:`MediaListPlayer`.\n\"\"\"\n\nimport ctypes\nimport functools\n\n# Used by EventManager in override.py\nimport inspect as _inspect\nimport logging\nimport os\nimport sys\nfrom ctypes.util import find_library\n\nlogger = logging.getLogger(__name__)\n\n__version__ = \"3.0.21203\"\n__libvlc_version__ = \"3.0.21\"\n__generator_version__ = \"2.3\"\nbuild_date = \"Mon Oct  7 16:36:40 2024 3.0.21\"\n\n# The libvlc doc states that filenames are expected to be in UTF8, do\n# not rely on sys.getfilesystemencoding() which will be confused,\n# esp. on windows.\nDEFAULT_ENCODING = \"utf-8\"\n\n\ndef str_to_bytes(s):\n    \"\"\"Translate string or bytes to bytes.\"\"\"\n    if isinstance(s, str):\n        return bytes(s, DEFAULT_ENCODING)\n    else:\n        return s\n\n\ndef bytes_to_str(b):\n    \"\"\"Translate bytes to string.\"\"\"\n    if isinstance(b, bytes):\n        return b.decode(DEFAULT_ENCODING)\n    else:\n        return b\n\n\ndef len_args(func):\n    \"\"\"Return number of positional arguments.\"\"\"\n    return len(_inspect.signature(func).parameters)\n\n\n# Internal guard to prevent internal classes to be directly\n# instanciated.\n_internal_guard = object()\n\n\ndef find_lib():\n    dll = None\n    plugin_path = os.environ.get(\"PYTHON_VLC_MODULE_PATH\", None)\n    if \"PYTHON_VLC_LIB_PATH\" in os.environ:\n        try:\n            dll = ctypes.CDLL(os.environ[\"PYTHON_VLC_LIB_PATH\"])\n        except OSError:\n            logger.error(\n                \"Cannot load lib specified by PYTHON_VLC_LIB_PATH env. variable\"\n            )\n            sys.exit(1)\n    if plugin_path and not os.path.isdir(plugin_path):\n        logger.error(\"Invalid PYTHON_VLC_MODULE_PATH specified. Please fix.\")\n        sys.exit(1)\n    if dll is not None:\n        return dll, plugin_path\n\n    if sys.platform.startswith(\"win\"):\n        libname = \"libvlc.dll\"\n        p = find_library(libname)\n        if p is None:\n            try:  # some registry settings\n                # leaner than win32api, win32con\n                import winreg as w\n\n                for r in w.HKEY_LOCAL_MACHINE, w.HKEY_CURRENT_USER:\n                    try:\n                        r = w.OpenKey(r, \"Software\\\\VideoLAN\\\\VLC\")\n                        plugin_path, _ = w.QueryValueEx(r, \"InstallDir\")\n                        w.CloseKey(r)\n                        break\n                    except w.error:\n                        pass\n            except ImportError:  # no PyWin32\n                pass\n            if plugin_path is None:\n                # try some standard locations.\n                programfiles = os.environ[\"ProgramFiles\"]\n                homedir = os.environ[\"HOMEDRIVE\"]\n                for p in (\n                    \"{programfiles}\\\\VideoLan{libname}\",\n                    \"{homedir}:\\\\VideoLan{libname}\",\n                    \"{programfiles}{libname}\",\n                    \"{homedir}:{libname}\",\n                ):\n                    p = p.format(\n                        homedir=homedir,\n                        programfiles=programfiles,\n                        libname=\"\\\\VLC\\\\\" + libname,\n                    )\n                    if os.path.exists(p):\n                        plugin_path = os.path.dirname(p)\n                        break\n            if plugin_path is not None:  # try loading\n                # PyInstaller Windows fix\n                if \"PyInstallerCDLL\" in ctypes.CDLL.__name__:\n                    ctypes.windll.kernel32.SetDllDirectoryW(None)\n                p = os.getcwd()\n                os.chdir(plugin_path)\n                # if chdir failed, this will raise an exception\n                dll = ctypes.CDLL(\".\\\\\" + libname)\n                # restore cwd after dll has been loaded\n                os.chdir(p)\n            else:  # may fail\n                dll = ctypes.CDLL(\".\\\\\" + libname)\n        else:\n            plugin_path = os.path.dirname(p)\n            dll = ctypes.CDLL(p)\n\n    elif sys.platform.startswith(\"darwin\"):\n        # FIXME: should find a means to configure path\n        d = \"/Applications/VLC.app/Contents/MacOS/\"\n        c = d + \"lib/libvlccore.dylib\"\n        p = d + \"lib/libvlc.dylib\"\n        if os.path.exists(p) and os.path.exists(c):\n            # pre-load libvlccore VLC 2.2.8+\n            ctypes.CDLL(c)\n            dll = ctypes.CDLL(p)\n            for p in (\"modules\", \"plugins\"):\n                p = d + p\n                if os.path.isdir(p):\n                    plugin_path = p\n                    break\n        else:  # hope, some [DY]LD_LIBRARY_PATH is set...\n            # pre-load libvlccore VLC 2.2.8+\n            ctypes.CDLL(\"libvlccore.dylib\")\n            dll = ctypes.CDLL(\"libvlc.dylib\")\n\n    else:\n        # All other OSes (linux, freebsd...)\n        p = find_library(\"vlc\")\n        try:\n            dll = ctypes.CDLL(p)\n        except OSError:  # may fail\n            dll = None\n        if dll is None:\n            try:\n                dll = ctypes.CDLL(\"libvlc.so.5\")\n            except:\n                raise NotImplementedError(\"Cannot find libvlc lib\")\n\n    return (dll, plugin_path)\n\n\n# plugin_path used on win32 and MacOS in override.py\ndll, plugin_path = find_lib()\n\n\nclass VLCException(Exception):\n    \"\"\"Exception raised by libvlc methods.\"\"\"\n\n    pass\n\n\ntry:\n    _Ints = (int, long)\nexcept NameError:  # no long in Python 3+\n    _Ints = int\n_Seqs = (list, tuple)\n\n\n# Used for handling *event_manager() methods.\nclass memoize_parameterless(object):\n    \"\"\"Decorator. Caches a parameterless method's return value each time it is called.\n\n    If called later with the same arguments, the cached value is returned (not reevaluated).\n\n    Adapted from https://wiki.python.org/moin/PythonDecoratorLibrary.\n    \"\"\"\n\n    def __init__(self, func):\n        self.func = func\n        self._cache = {}\n\n    def __call__(self, obj):\n        try:\n            return self._cache[obj]\n        except KeyError:\n            v = self._cache[obj] = self.func(obj)\n            return v\n\n    def __repr__(self):\n        \"\"\"Return the function's docstring.\"\"\"\n        return self.func.__doc__\n\n    def __get__(self, obj, objtype):\n        \"\"\"Support instance methods.\"\"\"\n        return functools.partial(self.__call__, obj)\n\n\n# Default instance. It is used to instanciate classes directly in the\n# OO-wrapper.\n_default_instance = None\n\n\ndef get_default_instance():\n    \"\"\"Returns the default :class:`Instance`.\"\"\"\n    global _default_instance\n    if _default_instance is None:\n        _default_instance = Instance()\n    return _default_instance\n\n\ndef try_fspath(path):\n    \"\"\"Try calling ``os.fspath``.\n\n    ``os.fspath`` is only available from py3.6.\n    \"\"\"\n    try:\n        return os.fspath(path)\n    except (AttributeError, TypeError):\n        return path\n\n\n_Cfunctions = {}  # from LibVLC __version__\n_Globals = globals()  # sys.modules[__name__].__dict__\n\n\ndef _Cfunction(name, flags, errcheck, *types):\n    \"\"\"(INTERNAL) New ctypes function binding.\"\"\"\n    if hasattr(dll, name) and name in _Globals:\n        p = ctypes.CFUNCTYPE(*types)\n        f = p((name, dll), flags)\n        if errcheck is not None:\n            f.errcheck = errcheck\n        # replace the Python function\n        # in this module, but only when\n        # running as python -O or -OO\n        if __debug__:\n            _Cfunctions[name] = f\n        else:\n            _Globals[name] = f\n        return f\n    raise NameError(\"no function %r\" % (name,))\n\n\ndef _Cobject(cls, ctype):\n    \"\"\"(INTERNAL) New instance from ctypes.\"\"\"\n    o = object.__new__(cls)\n    o._as_parameter_ = ctype\n    return o\n\n\ndef _Constructor(cls, ptr=_internal_guard):\n    \"\"\"(INTERNAL) New wrapper from ctypes.\"\"\"\n    if ptr == _internal_guard:\n        raise VLCException(\n            \"(INTERNAL) ctypes class. You should get references for this class through methods of the LibVLC API.\"\n        )\n    if ptr is None or ptr == 0:\n        return None\n    return _Cobject(cls, ctypes.c_void_p(ptr))\n\n\nclass _Cstruct(ctypes.Structure):\n    \"\"\"(INTERNAL) Base class for ctypes structures.\"\"\"\n\n    _fields_ = []  # list of 2-tuples ('name', ctypes.<type>)\n\n    def __str__(self):\n        l = [\" %s:\\t%s\" % (n, getattr(self, n)) for n, _ in self._fields_]\n        return \"\\n\".join([self.__class__.__name__] + l)\n\n    def __repr__(self):\n        return \"%s.%s\" % (self.__class__.__module__, self)\n\n\nclass _Ctype(object):\n    \"\"\"(INTERNAL) Base class for ctypes.\"\"\"\n\n    @staticmethod\n    def from_param(this):  # not self\n        \"\"\"(INTERNAL) ctypes parameter conversion method.\"\"\"\n        if this is None:\n            return None\n        return this._as_parameter_\n\n\nclass ListPOINTER(object):\n    \"\"\"Just like a POINTER but accept a list of etype elements as an argument.\"\"\"\n\n    def __init__(self, etype):\n        self.etype = etype\n\n    def from_param(self, param):\n        if isinstance(param, _Seqs):\n            return (self.etype * len(param))(*param)\n        else:\n            return ctypes.POINTER(param)\n\n\n# errcheck functions for some native functions.\ndef string_result(result, func, arguments):\n    \"\"\"Errcheck function. Returns a string and frees the original pointer.\n\n    It assumes the result is a ``char*``.\n    \"\"\"\n    if result:\n        # make a python string copy\n        s = bytes_to_str(ctypes.string_at(result))\n        # free original string ptr\n        libvlc_free(result)\n        return s\n    return None\n\n\ndef class_result(classname):\n    \"\"\"Errcheck function. Returns a function that creates the specified class.\"\"\"\n\n    def wrap_errcheck(result, func, arguments):\n        if result is None:\n            return None\n        return classname(result)\n\n    return wrap_errcheck\n\n\n# Wrapper for the opaque struct libvlc_log_t\nclass Log(ctypes.Structure):\n    pass\n\n\nLog_ptr = ctypes.POINTER(Log)\n\n\n# Wrapper for the opaque struct libvlc_media_thumbnail_request_t\nclass MediaThumbnailRequest:\n    def __new__(cls, *args):\n        if len(args) == 1 and isinstance(args[0], _Ints):\n            return _Constructor(cls, args[0])\n\n\n# FILE* ctypes wrapper, copied from\n# https://svn.python.org/projects/ctypes/trunk/ctypeslib/ctypeslib/contrib/pythonhdr.py\nclass FILE(ctypes.Structure):\n    pass\n\n\nFILE_ptr = ctypes.POINTER(FILE)\n\nPyFile_FromFd = ctypes.pythonapi.PyFile_FromFd\nPyFile_FromFd.restype = ctypes.py_object\nPyFile_FromFd.argtypes = [\n    ctypes.c_int,\n    ctypes.c_char_p,\n    ctypes.c_char_p,\n    ctypes.c_int,\n    ctypes.c_char_p,\n    ctypes.c_char_p,\n    ctypes.c_char_p,\n    ctypes.c_int,\n]\n\nPyFile_AsFd = ctypes.pythonapi.PyObject_AsFileDescriptor\nPyFile_AsFd.restype = ctypes.c_int\nPyFile_AsFd.argtypes = [ctypes.py_object]\n\n\ndef module_description_list(head):\n    \"\"\"Convert a ModuleDescription linked list to a Python list (and release the former).\"\"\"\n    r = []\n    if head:\n        item = head\n        while item:\n            item = item.contents\n            r.append((item.name, item.shortname, item.longname, item.help))\n            item = item.next\n        libvlc_module_description_list_release(head)\n    return r\n\n\ndef track_description_list(head):\n    \"\"\"Convert a TrackDescription linked list to a Python list (and release the former).\"\"\"\n    r = []\n    if head:\n        item = head\n        while item:\n            item = item.contents\n            r.append((item.id, item.name))\n            item = item.next\n        try:\n            libvlc_track_description_release(head)\n        except NameError:\n            libvlc_track_description_list_release(head)\n\n    return r\n\n\nclass _Enum(ctypes.c_uint):\n    \"\"\"(INTERNAL) Base class\"\"\"\n\n    _enum_names_ = {}\n\n    def __str__(self):\n        n = self._enum_names_.get(self.value, \"\") or (\"FIXME_(%r)\" % (self.value,))\n        return \".\".join((self.__class__.__name__, n))\n\n    def __hash__(self):\n        return self.value\n\n    def __repr__(self):\n        return \".\".join((self.__class__.__module__, self.__str__()))\n\n    def __eq__(self, other):\n        return (isinstance(other, _Enum) and self.value == other.value) or (\n            isinstance(other, _Ints) and self.value == other\n        )\n\n    def __ne__(self, other):\n        return not self.__eq__(other)\n\n\n# Generated wrappers #\nclass AudioEqualizer(_Ctype):\n    \"\"\"Create a new default equalizer, with all frequency values zeroed.\n\n    The new equalizer can subsequently be applied to a media player by invoking\n    :meth:`MediaPlayer.set_equalizer`.\n\n    The returned handle should be freed via :meth:`release` when\n    it is no longer needed.\n\n    \"\"\"\n\n    def __new__(cls, *args):\n        if len(args) == 1 and isinstance(args[0], _Ints):\n            return _Constructor(cls, args[0])\n        return libvlc_audio_equalizer_new()\n\n    def get_amp_at_index(self, u_band):\n        \"\"\"Get the amplification value for a particular equalizer frequency band.\n\n        :param u_band: index, counting from zero, of the frequency band to get.\n\n        :return: amplification value (Hz); NaN if there is no such frequency band.\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_equalizer_get_amp_at_index(self, u_band)\n\n    def get_preamp(self):\n        \"\"\"Get the current pre-amplification value from an equalizer.\n\n        :return: preamp value (Hz).\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_equalizer_get_preamp(self)\n\n    def release(self):\n        \"\"\"Release a previously created equalizer instance.\n\n        The equalizer was previously created by using :func:`new` or\n        :func:`new_from_preset`.\n\n        It is safe to invoke this method with a None *p_equalizer* parameter for no effect.\n\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_equalizer_release(self)\n\n    def set_amp_at_index(self, f_amp, u_band):\n        \"\"\"Set a new amplification value for a particular equalizer frequency band.\n\n        The new equalizer settings are subsequently applied to a media player by invoking\n        :func:`media_player_set_equalizer`.\n\n        The supplied amplification value will be clamped to the -20.0 to +20.0 range.\n\n        :param f_amp: amplification value (-20.0 to 20.0 Hz).\n        :param u_band: index, counting from zero, of the frequency band to set.\n\n        :return: zero on success, -1 on error.\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_equalizer_set_amp_at_index(self, f_amp, u_band)\n\n    def set_preamp(self, f_preamp):\n        \"\"\"Set a new pre-amplification value for an equalizer.\n\n        The new equalizer settings are subsequently applied to a media player by invoking\n        :func:`media_player_set_equalizer`.\n\n        The supplied amplification value will be clamped to the -20.0 to +20.0 range.\n\n        :param f_preamp: preamp value (-20.0 to 20.0 Hz).\n\n        :return: zero on success, -1 on error.\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_equalizer_set_preamp(self, f_preamp)\n\n\nclass EventManager(_Ctype):\n    \"\"\"Create an event manager with callback handler.\n\n    This class interposes the registration and handling of\n    event notifications in order to (a) remove the need for\n    decorating each callback functions with the decorator\n    ``@callbackmethod``, (b) allow any number of positional\n    and/or keyword arguments to the callback (in addition\n    to the :class:`Event` instance) and (c) to preserve the Python\n    objects such that the callback and argument objects\n    remain alive (i.e. are not garbage collected) until\n    **after** the notification has been unregistered.\n\n    .. note::\n        Only a single notification can be registered\n        for each event type in an :class:`EventManager` instance.\n\n    \"\"\"\n\n    _callback_handler = None\n    _callbacks = {}\n\n    def __new__(cls, ptr=_internal_guard):\n        if ptr == _internal_guard:\n            raise VLCException(\n                \"(INTERNAL) ctypes class.\\nYou should get a reference to EventManager through the MediaPlayer.event_manager() method.\"\n            )\n        return _Constructor(cls, ptr)\n\n    def event_attach(self, eventtype, callback, *args, **kwds):\n        \"\"\"Register an event notification.\n\n        :param eventtype: the desired event type to be notified about.\n        :param callback: the function to call when the event occurs.\n        :param args: optional positional arguments for the callback.\n        :param kwds: optional keyword arguments for the callback.\n\n        :return: 0 on success, ENOMEM on error.\n\n        .. note::\n            The callback function must have at least one argument,\n            an :class:`Event` instance. Any other, optional positional and keyword\n            arguments are in **addition** to the first one.\n\n        .. warning::\n            LibVLC is not reentrant, i.e. you cannot call libvlc functions from an event handler.\n            They must be called from the main application thread.\n        \"\"\"\n        if not isinstance(eventtype, EventType):\n            raise VLCException(\"%s required: %r\" % (\"EventType\", eventtype))\n        if not hasattr(callback, \"__call__\"):  # callable()\n            raise VLCException(\"%s required: %r\" % (\"callable\", callback))\n        # check that the callback expects arguments\n        if len_args(callback) < 1:  # list(...)\n            raise VLCException(\"%s required: %r\" % (\"argument\", callback))\n\n        if self._callback_handler is None:\n            _called_from_ctypes = ctypes.CFUNCTYPE(\n                None, ctypes.POINTER(Event), ctypes.c_void_p\n            )\n\n            @_called_from_ctypes\n            def _callback_handler(event, k):\n                \"\"\"(INTERNAL) handle callback call from ctypes.\n\n                .. note::\n                    We cannot simply make this an :class:`EventManager`\n                    method since ctypes does not prepend self as the\n                    first parameter, hence this closure.\n                \"\"\"\n                try:  # retrieve Python callback and arguments\n                    call, args, kwds = self._callbacks[k]\n                except KeyError:  # detached?\n                    pass\n                else:\n                    # deref event.contents to simplify callback code\n                    call(event.contents, *args, **kwds)\n\n            self._callback_handler = _callback_handler\n            self._callbacks = {}\n\n        k = eventtype.value\n        r = libvlc_event_attach(self, k, self._callback_handler, k)\n        if not r:\n            self._callbacks[k] = (callback, args, kwds)\n        return r\n\n    def event_detach(self, eventtype):\n        \"\"\"Unregister an event notification.\n\n        :param eventtype: the event type notification to be removed.\n        \"\"\"\n        if not isinstance(eventtype, EventType):\n            raise VLCException(\"%s required: %r\" % (\"EventType\", eventtype))\n\n        k = eventtype.value\n        if k in self._callbacks:\n            del self._callbacks[k]  # remove, regardless of libvlc return value\n            libvlc_event_detach(self, k, self._callback_handler, k)\n\n\nclass Instance(_Ctype):\n    \"\"\"It may take as parameter either:\n\n    * a string\n    * a list of strings as first parameters\n    * the parameters given as the constructor parameters (must be strings)\n\n    \"\"\"\n\n    def __new__(cls, *args):\n        if len(args) == 1:\n            # Only 1 arg. It is either a C pointer, or an arg string,\n            # or a tuple.\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            elif isinstance(i, str):\n                args = i.strip().split()\n            elif isinstance(i, _Seqs):\n                args = list(i)\n            else:\n                raise VLCException(\"Instance %r\" % (args,))\n        else:\n            args = list(args)\n\n        if not args:  # no parameters passed\n            args = [\"vlc\"]\n        elif args[0] != \"vlc\":\n            args.insert(0, \"vlc\")\n\n        if plugin_path is not None:\n            # set plugin_path if detected, win32 and MacOS,\n            # if the user did not specify it itself.\n            os.environ.setdefault(\"VLC_PLUGIN_PATH\", plugin_path)\n\n        args = [str_to_bytes(a) for a in args]\n        return libvlc_new(len(args), args)\n\n    def media_player_new(self, uri=None):\n        \"\"\"Create a new :class:`MediaPlayer` instance.\n\n        :param uri: an optional URI to play in the player as a str, bytes or PathLike object.\n        \"\"\"\n        p = libvlc_media_player_new(self)\n        if uri:\n            p.set_media(self.media_new(uri))\n        p._instance = self\n        return p\n\n    def media_list_player_new(self):\n        \"\"\"Create a new :class:`MediaListPlayer` instance.\"\"\"\n        p = libvlc_media_list_player_new(self)\n        p._instance = self\n        return p\n\n    def media_new(self, mrl, *options):\n        \"\"\"Create a new :class:`Media` instance.\n\n        If mrl contains a colon (:) preceded by more than 1 letter, it\n        will be treated as a URL. Else, it will be considered as a\n        local path. If you need more control, directly use\n        :meth:`media_new_location` or :meth:`media_new_path`.\n\n        Options can be specified as supplementary string parameters,\n        but note that many options cannot be set at the media level,\n        and rather at the :class:`Instance` level. For instance, the marquee\n        filter must be specified when creating the :class:`Instance` or\n        :class:`MediaPlayer`.\n\n        Alternatively, options can be added to the media using the\n        :meth:`Media.add_options` method (with the same limitation).\n\n        :param mrl: A str, bytes or PathLike object\n        :param options: optional media option=value strings\n        \"\"\"\n        mrl = try_fspath(mrl)\n        if \":\" in mrl and mrl.index(\":\") > 1:\n            # Assume it is a URL\n            if __version__ >= \"4\":\n                m = libvlc_media_new_location(str_to_bytes(mrl))\n            else:\n                m = libvlc_media_new_location(self, str_to_bytes(mrl))\n        else:\n            # Else it should be a local path.\n            m = self.media_new_path(str_to_bytes(os.path.normpath(mrl)))\n        for o in options:\n            libvlc_media_add_option(m, str_to_bytes(o))\n        m._instance = self\n        return m\n\n    def media_new_path(self, path):\n        \"\"\"Create a media for a certain file path. See :meth:`media_release`.\n\n        :param path: A str, byte, or PathLike object representing a local filesystem path.\n\n        :return: the newly created media or None on error.\n        \"\"\"\n        path = try_fspath(path)\n        if __version__ >= \"4\":\n            return libvlc_media_new_path(str_to_bytes(path))\n        else:\n            return libvlc_media_new_path(self, str_to_bytes(path))\n\n    def media_list_new(self, mrls=None):\n        \"\"\"Create a new :class:`MediaList` instance.\n\n        :param mrls: optional list of MRL strings, bytes, or PathLike objects.\n        \"\"\"\n        # API 3 vs 4: libvlc_media_list_new does not take any\n        # parameter as input anymore.\n        if len_args(libvlc_media_list_new) == 1:  # API <= 3\n            l = libvlc_media_list_new(self)\n        else:  # API >= 4\n            l = libvlc_media_list_new()\n        # We should take the lock, but since we did not leak the\n        # reference, nobody else can access it.\n        if mrls:\n            for m in mrls:\n                l.add_media(m)\n        l._instance = self\n        return l\n\n    def audio_output_enumerate_devices(self):\n        \"\"\"Enumerate the defined audio output devices.\n\n        :return: list of dicts {name:, description:, devices:}\n        \"\"\"\n        r = []\n        head = libvlc_audio_output_list_get(self)\n        if head:\n            i = head\n            while i:\n                i = i.contents\n                r.append({\"name\": i.name, \"description\": i.description})\n                i = i.next\n            libvlc_audio_output_list_release(head)\n        return r\n\n    def audio_filter_list_get(self):\n        \"\"\"Returns a list of available audio filters.\"\"\"\n        return module_description_list(libvlc_audio_filter_list_get(self))\n\n    def video_filter_list_get(self):\n        \"\"\"Returns a list of available video filters.\"\"\"\n        return module_description_list(libvlc_video_filter_list_get(self))\n\n    def add_intf(self, name):\n        \"\"\"Try to start a user interface for the libvlc instance.\n\n        :param name: interface name, or None for default.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_add_intf(self, str_to_bytes(name))\n\n    def audio_output_device_count(self, psz_audio_output):\n        \"\"\"Backward compatibility stub. Do not use in new code.\n\n        .. warning:: **Deprecated!** Use :func:`audio_output_device_list_get` instead.\n\n        :return: always 0.\n        \"\"\"\n        return libvlc_audio_output_device_count(self, str_to_bytes(psz_audio_output))\n\n    def audio_output_device_id(self, psz_audio_output, i_device):\n        \"\"\"Backward compatibility stub. Do not use in new code.\n\n        .. warning:: **Deprecated!** Use :func:`audio_output_device_list_get` instead.\n\n        :return: always None.\n        \"\"\"\n        return libvlc_audio_output_device_id(\n            self, str_to_bytes(psz_audio_output), i_device\n        )\n\n    def audio_output_device_list_get(self, aout):\n        \"\"\"Gets a list of audio output devices for a given audio output module,\n        See :func:`audio_output_device_set`.\n\n        .. note:: Not all audio outputs support this. In particular, an empty (None)\n            list of devices does **not** imply that the specified audio output does\n            not work.\n\n        .. note:: The list might not be exhaustive.\n\n        .. warning:: Some audio output devices in the list might not actually work in\n            some circumstances. By default, it is recommended to not specify any\n            explicit audio device.\n\n        :param aout: audio output name.\n            (as returned by libvlc_audio_output_list_get).\n\n        :return: A None-terminated linked list of potential audio output devices.\n            It must be freed with :func:`audio_output_device_list_release`.\n        :version: LibVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_audio_output_device_list_get(self, str_to_bytes(aout))\n\n    def audio_output_device_longname(self, psz_output, i_device):\n        \"\"\"Backward compatibility stub. Do not use in new code.\n\n        .. warning:: **Deprecated!** Use :func:`audio_output_device_list_get` instead.\n\n        :return: always None.\n        \"\"\"\n        return libvlc_audio_output_device_longname(\n            self, str_to_bytes(psz_output), i_device\n        )\n\n    def audio_output_list_get(self):\n        \"\"\"Gets the list of available audio output modules.\n\n        :return: list of available audio outputs. It must be freed with.\n            See :func:`audio_output_list_release` See :class:`AudioOutput` .\n            In case of error, None is returned.\n        \"\"\"\n        return libvlc_audio_output_list_get(self)\n\n    def dialog_set_callbacks(self, p_cbs, p_data):\n        \"\"\"Register callbacks in order to handle VLC dialogs\n\n        :param p_data: opaque pointer for the callback.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_dialog_set_callbacks(self, p_cbs, p_data)\n\n    def get_log_verbosity(self):\n        \"\"\"Always returns minus one.\n        This function is only provided for backward compatibility.\n\n        :return: always -1.\n        \"\"\"\n        return libvlc_get_log_verbosity(self)\n\n    def log_open(self):\n        \"\"\"This function does nothing useful.\n        It is only provided for backward compatibility.\n\n        :return: an unique pointer or None on error.\n        \"\"\"\n        return libvlc_log_open(self)\n\n    def log_set(self, cb, data):\n        \"\"\"Sets the logging callback for a LibVLC instance.\n\n        This function is thread-safe: it will wait for any pending callbacks\n        invocation to complete.\n\n        .. note:: Some log messages (especially debug) are emitted by LibVLC while\n            is being initialized. These messages cannot be captured with this interface.\n\n        .. warning:: A deadlock may occur if this function is called from the callback.\n\n        :param data: opaque data pointer for the callback function.\n\n        :param p_instance: libvlc instance.\n\n        :version: LibVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_log_set(self, cb, data)\n\n    def log_set_file(self, stream):\n        \"\"\"Sets up logging to a file.\n\n        :param stream: FILE pointer opened for writing.\n            (the FILE pointer must remain valid until libvlc_log_unset).\n\n        :version: LibVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_log_set_file(self, stream)\n\n    def log_unset(self):\n        \"\"\"Unsets the logging callback.\n\n        This function deregisters the logging callback for a LibVLC instance.\n        This is rarely needed as the callback is implicitly unset when the instance\n        is destroyed.\n\n        .. note:: This function will wait for any pending callbacks invocation to\n            complete (causing a deadlock if called from within the callback).\n\n        :version: LibVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_log_unset(self)\n\n    def media_discoverer_list_get(self, i_cat, ppp_services):\n        \"\"\"Get media discoverer services by category\n\n        :param i_cat: category of services to fetch.\n        :param ppp_services: address to store an allocated array of media discoverer.\n            services (must be freed with :func:`media_discoverer_list_release` by.\n            the caller) [OUT].\n\n        :return: the number of media discoverer services (0 on error).\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_discoverer_list_get(self, i_cat, ppp_services)\n\n    def media_discoverer_new(self, psz_name):\n        \"\"\"Create a media discoverer object by name.\n\n        After this object is created, you should attach to media_list events in\n        order to be notified of new items discovered.\n\n        You need to call :func:`media_discoverer_start` in order to start the\n        discovery.\n\n        See :func:`media_discoverer_media_list`\n        See :func:`media_discoverer_event_manager`\n        See :func:`media_discoverer_start`\n\n        :param psz_name: service name; use :func:`media_discoverer_list_get` to get.\n            a list of the discoverer names available in this libVLC instance.\n\n        :return: media discover object or None in case of error.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_discoverer_new(self, str_to_bytes(psz_name))\n\n    def media_discoverer_new_from_name(self, psz_name):\n        \"\"\".. warning:: **Deprecated!** Use :func:`media_discoverer_new` and :func:`media_discoverer_start`.\"\"\"\n        return libvlc_media_discoverer_new_from_name(self, str_to_bytes(psz_name))\n\n    def media_library_new(self):\n        \"\"\"Create an new Media Library object\n\n        :return: a new object or None on error.\n        \"\"\"\n        return libvlc_media_library_new(self)\n\n    def media_new_as_node(self, psz_name):\n        \"\"\"Create a media as an empty node with a given name.\n\n        See :func:`media_release`\n\n        :param psz_name: the name of the node.\n\n        :return: the new empty media or None on error.\n        \"\"\"\n        return libvlc_media_new_as_node(self, str_to_bytes(psz_name))\n\n    def media_new_callbacks(self, open_cb, read_cb, seek_cb, close_cb, opaque):\n        \"\"\"Create a media with custom callbacks to read the data from.\n\n        .. note:: If *open_cb* is None, the *opaque* pointer will be passed to *read_cb*,\n            *seek_cb* and *close_cb*, and the stream size will be treated as unknown.\n\n        .. note:: The callbacks may be called asynchronously (from another thread).\n            A single stream *instance* need not be reentrant. However the *open_cb* needs to\n            be reentrant if the media is used by multiple player instances.\n\n        .. warning:: The callbacks may be used until all or any player instances\n            that were supplied the media item are stopped.\n\n        See :func:`media_release`\n\n        :param open_cb: callback to open the custom bitstream input media.\n        :param read_cb: callback to read data (must not be None).\n        :param seek_cb: callback to seek, or None if seeking is not supported.\n        :param close_cb: callback to close the media, or None if unnecessary.\n        :param opaque: data pointer for the open callback.\n\n        :return: the newly created media or None on error.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_new_callbacks(\n            self, open_cb, read_cb, seek_cb, close_cb, opaque\n        )\n\n    def media_new_fd(self, fd):\n        \"\"\"Create a media for an already open file descriptor.\n        The file descriptor shall be open for reading (or reading and writing).\n\n        Regular file descriptors, pipe read descriptors and character device\n        descriptors (including TTYs) are supported on all platforms.\n        Block device descriptors are supported where available.\n        Directory descriptors are supported on systems that provide fdopendir().\n        Sockets are supported on all platforms where they are file descriptors,\n        i.e. all except Windows.\n\n        .. note:: This library will **not** automatically close the file descriptor\n            under any circumstance. Nevertheless, a file descriptor can usually only be\n            rendered once in a media player. To render it a second time, the file\n            descriptor should probably be rewound to the beginning with lseek().\n\n        See :func:`media_release`\n\n        :param fd: open file descriptor.\n\n        :return: the newly created media or None on error.\n        :version: LibVLC 1.1.5 and later.\n        \"\"\"\n        return libvlc_media_new_fd(self, fd)\n\n    def media_new_location(self, psz_mrl):\n        \"\"\"Create a media with a certain given media resource location,\n        for instance a valid URL.\n\n        .. note:: To refer to a local file with this function,\n            the file://... URI syntax **must** be used (see IETF RFC3986).\n            We recommend using :func:`media_new_path` instead when dealing with\n            local files.\n\n        See :func:`media_release`\n\n        :param psz_mrl: the media location.\n\n        :return: the newly created media or None on error.\n        \"\"\"\n        return libvlc_media_new_location(self, str_to_bytes(psz_mrl))\n\n    def playlist_play(self, i_id, i_options, ppsz_options):\n        \"\"\"Start playing (if there is any item in the playlist).\n\n        Additionnal playlist item options can be specified for addition to the\n        item before it is played.\n\n        :param i_id: the item to play. If this is a negative number, the next.\n            item will be selected. Otherwise, the item with the given ID will be.\n            played.\n        :param i_options: the number of options to add to the item.\n        :param ppsz_options: the options to add to the item.\n        \"\"\"\n        return libvlc_playlist_play(self, i_id, i_options, ppsz_options)\n\n    def release(self):\n        \"\"\"Decrement the reference count of a libvlc instance, and destroy it\n        if it reaches zero.\n        \"\"\"\n        return libvlc_release(self)\n\n    def renderer_discoverer_list_get(self, ppp_services):\n        \"\"\"Get media discoverer services\n\n        See libvlc_renderer_list_release\n\n        :param ppp_services: address to store an allocated array of renderer.\n            discoverer services (must be freed with libvlc_renderer_list_release by.\n            the caller) [OUT].\n\n        :return: the number of media discoverer services (0 on error).\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_renderer_discoverer_list_get(self, ppp_services)\n\n    def renderer_discoverer_new(self, psz_name):\n        \"\"\"Create a renderer discoverer object by name\n\n        After this object is created, you should attach to events in order to be\n        notified of the discoverer events.\n\n        You need to call :func:`renderer_discoverer_start` in order to start the\n        discovery.\n\n        See :func:`renderer_discoverer_event_manager`\n        See :func:`renderer_discoverer_start`\n\n        :param psz_name: service name; use :func:`renderer_discoverer_list_get` to.\n            get a list of the discoverer names available in this libVLC instance.\n\n        :return: media discover object or None in case of error.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_discoverer_new(self, str_to_bytes(psz_name))\n\n    def retain(self):\n        \"\"\"Increments the reference count of a libvlc instance.\n        The initial reference count is 1 after :func:`new` returns.\n        \"\"\"\n        return libvlc_retain(self)\n\n    def set_app_id(self, id, version, icon):\n        \"\"\"Sets some meta-information about the application.\n        See also :func:`set_user_agent`.\n\n        :param id: Java-style application identifier, e.g. \"com.acme.foobar\".\n        :param version: application version numbers, e.g. \"1.2.3\".\n        :param icon: application icon name, e.g. \"foobar\".\n\n        :version: LibVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_set_app_id(\n            self, str_to_bytes(id), str_to_bytes(version), str_to_bytes(icon)\n        )\n\n    def set_exit_handler(self, cb, opaque):\n        \"\"\"Registers a callback for the LibVLC exit event. This is mostly useful if\n        the VLC playlist and/or at least one interface are started with\n        :func:`playlist_play` or :func:`add_intf` respectively.\n        Typically, this function will wake up your application main loop (from\n        another thread).\n\n        .. note:: This function should be called before the playlist or interface are\n            started. Otherwise, there is a small race condition: the exit event could\n            be raised before the handler is registered.\n\n        .. warning:: This function and :func:`wait` cannot be used at the same time.\n\n        :param cb: callback to invoke when LibVLC wants to exit,\n            or None to disable the exit handler (as by default).\n        :param opaque: data pointer for the callback.\n        \"\"\"\n        return libvlc_set_exit_handler(self, cb, opaque)\n\n    def set_log_verbosity(self, level):\n        \"\"\"This function does nothing.\n        It is only provided for backward compatibility.\n\n        :param level: ignored.\n        \"\"\"\n        return libvlc_set_log_verbosity(self, level)\n\n    def set_user_agent(self, name, http):\n        \"\"\"Sets the application *name*. LibVLC passes this as the user agent string\n        when a protocol requires it.\n\n        :param name: human-readable application name, e.g. \"FooBar player 1.2.3\".\n        :param http: HTTP User Agent, e.g. \"FooBar/1.2.3 Python/2.6.0\".\n\n        :version: LibVLC 1.1.1 or later.\n        \"\"\"\n        return libvlc_set_user_agent(self, str_to_bytes(name), str_to_bytes(http))\n\n    def vlm_add_broadcast(\n        self,\n        psz_name,\n        psz_input,\n        psz_output,\n        i_options,\n        ppsz_options,\n        b_enabled,\n        b_loop,\n    ):\n        \"\"\"Add a broadcast, with one input.\n\n        :param psz_name: the name of the new broadcast.\n        :param psz_input: the input MRL.\n        :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n        :param i_options: number of additional options.\n        :param ppsz_options: additional options.\n        :param b_enabled: boolean for enabling the new broadcast.\n        :param b_loop: Should this broadcast be played in loop ?\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_add_broadcast(\n            self,\n            str_to_bytes(psz_name),\n            str_to_bytes(psz_input),\n            str_to_bytes(psz_output),\n            i_options,\n            ppsz_options,\n            b_enabled,\n            b_loop,\n        )\n\n    def vlm_add_input(self, psz_name, psz_input):\n        \"\"\"Add a media's input MRL. This will add the specified one.\n\n        :param psz_name: the media to work on.\n        :param psz_input: the input MRL.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_add_input(\n            self, str_to_bytes(psz_name), str_to_bytes(psz_input)\n        )\n\n    def vlm_add_vod(\n        self, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux\n    ):\n        \"\"\"Add a vod, with one input.\n\n        :param psz_name: the name of the new vod media.\n        :param psz_input: the input MRL.\n        :param i_options: number of additional options.\n        :param ppsz_options: additional options.\n        :param b_enabled: boolean for enabling the new vod.\n        :param psz_mux: the muxer of the vod media.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_add_vod(\n            self,\n            str_to_bytes(psz_name),\n            str_to_bytes(psz_input),\n            i_options,\n            ppsz_options,\n            b_enabled,\n            str_to_bytes(psz_mux),\n        )\n\n    def vlm_change_media(\n        self,\n        psz_name,\n        psz_input,\n        psz_output,\n        i_options,\n        ppsz_options,\n        b_enabled,\n        b_loop,\n    ):\n        \"\"\"Edit the parameters of a media. This will delete all existing inputs and\n        add the specified one.\n\n        :param psz_name: the name of the new broadcast.\n        :param psz_input: the input MRL.\n        :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n        :param i_options: number of additional options.\n        :param ppsz_options: additional options.\n        :param b_enabled: boolean for enabling the new broadcast.\n        :param b_loop: Should this broadcast be played in loop ?\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_change_media(\n            self,\n            str_to_bytes(psz_name),\n            str_to_bytes(psz_input),\n            str_to_bytes(psz_output),\n            i_options,\n            ppsz_options,\n            b_enabled,\n            b_loop,\n        )\n\n    def vlm_del_media(self, psz_name):\n        \"\"\"Delete a media (VOD or broadcast).\n\n        :param psz_name: the media to delete.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_del_media(self, str_to_bytes(psz_name))\n\n    @memoize_parameterless\n    def vlm_get_event_manager(self):\n        \"\"\"Get libvlc_event_manager from a vlm media.\n        The p_event_manager is immutable, so you don't have to hold the lock\n\n        :return: libvlc_event_manager.\n        \"\"\"\n        return libvlc_vlm_get_event_manager(self)\n\n    def vlm_get_media_instance_length(self, psz_name, i_instance):\n        \"\"\"Get vlm_media instance length by name or instance id\n\n        :param psz_name: name of vlm media instance.\n        :param i_instance: instance id.\n\n        :return: length of media item or -1 on error.\n        \"\"\"\n        return libvlc_vlm_get_media_instance_length(\n            self, str_to_bytes(psz_name), i_instance\n        )\n\n    def vlm_get_media_instance_position(self, psz_name, i_instance):\n        \"\"\"Get vlm_media instance position by name or instance id\n\n        :param psz_name: name of vlm media instance.\n        :param i_instance: instance id.\n\n        :return: position as float or -1. on error.\n        \"\"\"\n        return libvlc_vlm_get_media_instance_position(\n            self, str_to_bytes(psz_name), i_instance\n        )\n\n    def vlm_get_media_instance_rate(self, psz_name, i_instance):\n        \"\"\"Get vlm_media instance playback rate by name or instance id\n\n        :param psz_name: name of vlm media instance.\n        :param i_instance: instance id.\n\n        :return: playback rate or -1 on error.\n        \"\"\"\n        return libvlc_vlm_get_media_instance_rate(\n            self, str_to_bytes(psz_name), i_instance\n        )\n\n    def vlm_get_media_instance_time(self, psz_name, i_instance):\n        \"\"\"Get vlm_media instance time by name or instance id\n\n        :param psz_name: name of vlm media instance.\n        :param i_instance: instance id.\n\n        :return: time as integer or -1 on error.\n        \"\"\"\n        return libvlc_vlm_get_media_instance_time(\n            self, str_to_bytes(psz_name), i_instance\n        )\n\n    def vlm_pause_media(self, psz_name):\n        \"\"\"Pause the named broadcast.\n\n        :param psz_name: the name of the broadcast.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_pause_media(self, str_to_bytes(psz_name))\n\n    def vlm_play_media(self, psz_name):\n        \"\"\"Play the named broadcast.\n\n        :param psz_name: the name of the broadcast.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_play_media(self, str_to_bytes(psz_name))\n\n    def vlm_release(self):\n        \"\"\"Release the vlm instance related to the given :class:`Instance`\"\"\"\n        return libvlc_vlm_release(self)\n\n    def vlm_seek_media(self, psz_name, f_percentage):\n        \"\"\"Seek in the named broadcast.\n\n        :param psz_name: the name of the broadcast.\n        :param f_percentage: the percentage to seek to.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_seek_media(self, str_to_bytes(psz_name), f_percentage)\n\n    def vlm_set_enabled(self, psz_name, b_enabled):\n        \"\"\"Enable or disable a media (VOD or broadcast).\n\n        :param psz_name: the media to work on.\n        :param b_enabled: the new status.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_set_enabled(self, str_to_bytes(psz_name), b_enabled)\n\n    def vlm_set_input(self, psz_name, psz_input):\n        \"\"\"Set a media's input MRL. This will delete all existing inputs and\n        add the specified one.\n\n        :param psz_name: the media to work on.\n        :param psz_input: the input MRL.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_set_input(\n            self, str_to_bytes(psz_name), str_to_bytes(psz_input)\n        )\n\n    def vlm_set_loop(self, psz_name, b_loop):\n        \"\"\"Set a media's loop status.\n\n        :param psz_name: the media to work on.\n        :param b_loop: the new status.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_set_loop(self, str_to_bytes(psz_name), b_loop)\n\n    def vlm_set_mux(self, psz_name, psz_mux):\n        \"\"\"Set a media's vod muxer.\n\n        :param psz_name: the media to work on.\n        :param psz_mux: the new muxer.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_set_mux(self, str_to_bytes(psz_name), str_to_bytes(psz_mux))\n\n    def vlm_set_output(self, psz_name, psz_output):\n        \"\"\"Set the output for a media.\n\n        :param psz_name: the media to work on.\n        :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_set_output(\n            self, str_to_bytes(psz_name), str_to_bytes(psz_output)\n        )\n\n    def vlm_show_media(self, psz_name):\n        \"\"\"Return information about the named media as a JSON\n        string representation.\n\n        This function is mainly intended for debugging use,\n        if you want programmatic access to the state of\n        a vlm_media_instance_t, please use the corresponding\n        libvlc_vlm_get_media_instance_xxx -functions.\n        Currently there are no such functions available for\n        vlm_media_t though.\n\n        :param psz_name: the name of the media,\n            if the name is an empty string, all media is described.\n\n        :return: string with information about named media, or None on error.\n        \"\"\"\n        return libvlc_vlm_show_media(self, str_to_bytes(psz_name))\n\n    def vlm_stop_media(self, psz_name):\n        \"\"\"Stop the named broadcast.\n\n        :param psz_name: the name of the broadcast.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_stop_media(self, str_to_bytes(psz_name))\n\n    def wait(self):\n        \"\"\"Waits until an interface causes the instance to exit.\n        You should start at least one interface first, using :func:`add_intf`.\n\n        .. warning:: This function wastes one thread doing basically nothing.\n            :func:`set_exit_handler` should be used instead.\n        \"\"\"\n        return libvlc_wait(self)\n\n\nclass LogIterator(_Ctype):\n    \"\"\"Create a new VLC log iterator.\"\"\"\n\n    def __new__(cls, ptr=_internal_guard):\n        \"\"\"(INTERNAL) ctypes wrapper constructor.\"\"\"\n        return _Constructor(cls, ptr)\n\n    def __iter__(self):\n        return self\n\n    def next(self):\n        if self.has_next():\n            b = LogMessage()\n            i = libvlc_log_iterator_next(self, b)\n            return i.contents\n        raise StopIteration\n\n    def __next__(self):\n        return self.next()\n\n    def free(self):\n        \"\"\"Frees memory allocated by :func:`log_get_iterator`.\"\"\"\n        return libvlc_log_iterator_free(self)\n\n    def has_next(self):\n        \"\"\"Always returns zero.\n        This function is only provided for backward compatibility.\n\n        :return: always zero.\n        \"\"\"\n        return libvlc_log_iterator_has_next(self)\n\n\nclass Media(_Ctype):\n    \"\"\"Usage:\n\n    .. code-block:: python\n\n        Media(MRL, *options)\n\n    See :meth:`Instance.media_new` documentation for details.\n\n    \"\"\"\n\n    def __new__(cls, *args):\n        if args:\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            if isinstance(i, Instance):\n                return i.media_new(*args[1:])\n\n        o = get_default_instance().media_new(*args)\n        return o\n\n    def get_instance(self):\n        return getattr(self, \"_instance\", None)\n\n    def add_options(self, *options):\n        \"\"\"Add a list of options to the media.\n\n        .. note::\n            Options must be written without the double-dash.\n\n        .. warning::\n            Most audio and video options, such as text renderer, have no\n            effects on an individual media. These options must be set at\n            the :class:`Instance` or :class:`MediaPlayer` instanciation.\n\n        :param options: optional media option=value strings\n        \"\"\"\n        for o in options:\n            self.add_option(o)\n\n    def tracks_get(self):\n        \"\"\"Get media descriptor's elementary streams description.\n\n        .. note::\n            You need to call :meth:`parse` or play the media at least once\n            before calling this function.\n            Not doing this will result in an empty array.\n\n        .. note::\n            The result must be freed with :meth:`tracks_release`.\n\n        :version: LibVLC 2.1.0 and later.\n        \"\"\"\n        mediaTrack_pp = ctypes.POINTER(MediaTrack)()\n        n = libvlc_media_tracks_get(self, ctypes.byref(mediaTrack_pp))\n        info = ctypes.cast(\n            mediaTrack_pp, ctypes.POINTER(ctypes.POINTER(MediaTrack) * n)\n        )\n        try:\n            contents = info.contents\n        except ValueError:\n            # Media not parsed, no info.\n            return None\n        tracks = (contents[i].contents for i in range(len(contents)))\n        # libvlc_media_tracks_release(mediaTrack_pp, n)\n        return tracks\n\n    def add_option(self, psz_options):\n        \"\"\"Add an option to the media.\n\n        This option will be used to determine how the media_player will\n        read the media. This allows to use VLC's advanced\n        reading/streaming options on a per-media basis.\n\n        .. note:: The options are listed in 'vlc --long-help' from the command line,\n            e.g. \"-sout-all\". Keep in mind that available options and their semantics\n            vary across LibVLC versions and builds.\n        .. warning:: Not all options affects :class:`Media` objects:\n            Specifically, due to architectural issues most audio and video options,\n            such as text renderer options, have no effects on an individual media.\n            These options must be set through :func:`new` instead.\n\n        :param psz_options: the options (as a string).\n        \"\"\"\n        return libvlc_media_add_option(self, str_to_bytes(psz_options))\n\n    def add_option_flag(self, psz_options, i_flags):\n        \"\"\"Add an option to the media with configurable flags.\n\n        This option will be used to determine how the media_player will\n        read the media. This allows to use VLC's advanced\n        reading/streaming options on a per-media basis.\n\n        The options are detailed in vlc --long-help, for instance\n        \"--sout-all\". Note that all options are not usable on medias:\n        specifically, due to architectural issues, video-related options\n        such as text renderer options cannot be set on a single media. They\n        must be set on the whole libvlc instance instead.\n\n        :param psz_options: the options (as a string).\n        :param i_flags: the flags for this option.\n        \"\"\"\n        return libvlc_media_add_option_flag(self, str_to_bytes(psz_options), i_flags)\n\n    def duplicate(self):\n        \"\"\"Duplicate a media descriptor object.\"\"\"\n        return libvlc_media_duplicate(self)\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Get event manager from media descriptor object.\n        NOTE: this function doesn't increment reference counting.\n\n        :return: event manager object.\n        \"\"\"\n        return libvlc_media_event_manager(self)\n\n    def get_duration(self):\n        \"\"\"Get duration (in ms) of media descriptor object item.\n\n        :return: duration of media item or -1 on error.\n        \"\"\"\n        return libvlc_media_get_duration(self)\n\n    def get_meta(self, e_meta):\n        \"\"\"Read the meta of the media.\n\n        If the media has not yet been parsed this will return None.\n\n        See :func:`parse`\n        See :func:`parse_with_options`\n        See libvlc_MediaMetaChanged\n\n        :param e_meta: the meta to read.\n\n        :return: the media's meta.\n        \"\"\"\n        return libvlc_media_get_meta(self, e_meta)\n\n    def get_mrl(self):\n        \"\"\"Get the media resource locator (mrl) from a media descriptor object\n\n        :return: string with mrl of media descriptor object.\n        \"\"\"\n        return libvlc_media_get_mrl(self)\n\n    def get_parsed_status(self):\n        \"\"\"Get Parsed status for media descriptor object.\n\n        See libvlc_MediaParsedChanged\n        See :class:`MediaParsedStatus`\n\n        :return: a value of the :class:`MediaParsedStatus` enum.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_get_parsed_status(self)\n\n    def get_state(self):\n        \"\"\"Get current state of media descriptor object. Possible media states are\n        libvlc_NothingSpecial=0, libvlc_Opening, libvlc_Playing, libvlc_Paused,\n        libvlc_Stopped, libvlc_Ended, libvlc_Error.\n\n        See :class:`State`.\n\n        :return: state of media descriptor object.\n        \"\"\"\n        return libvlc_media_get_state(self)\n\n    def get_stats(self, p_stats):\n        \"\"\"Get the current statistics about the media.\n\n        :param p_stats:: structure that contain the statistics about the media.\n            (this structure must be allocated by the caller).\n\n        :return: true if the statistics are available, false otherwise.\n        \"\"\"\n        return libvlc_media_get_stats(self, p_stats)\n\n    def get_tracks_info(self):\n        \"\"\"Get media descriptor's elementary streams description\n\n        Note, you need to call :func:`parse` or play the media at least once\n        before calling this function.\n        Not doing this will result in an empty array.\n\n\n        .. warning:: **Deprecated!** Use :func:`tracks_get` instead\n\n        :param tracks: address to store an allocated array of Elementary Streams.\n            descriptions (must be freed by the caller) [OUT].\n\n        :return: the number of Elementary Streams.\n        \"\"\"\n        return libvlc_media_get_tracks_info(self)\n\n    def get_type(self):\n        \"\"\"Get the media type of the media descriptor object\n\n        See :class:`MediaType`\n\n        :return: media type.\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_get_type(self)\n\n    def get_user_data(self):\n        \"\"\"Get media descriptor's user_data. user_data is specialized data\n        accessed by the host application, VLC.framework uses it as a pointer to\n        an native object that references a :class:`Media` pointer\n        \"\"\"\n        return libvlc_media_get_user_data(self)\n\n    def is_parsed(self):\n        \"\"\"Return true is the media descriptor object is parsed\n\n\n        .. warning:: **Deprecated!** This can return true in case of failure.\n            Use :func:`get_parsed_status` instead\n\n        See libvlc_MediaParsedChanged\n\n        :return: true if media object has been parsed otherwise it returns false.\n        \"\"\"\n        return libvlc_media_is_parsed(self)\n\n    def parse(self):\n        \"\"\"Parse a media.\n\n        This fetches (local) art, meta data and tracks information.\n        The method is synchronous.\n\n\n        .. warning:: **Deprecated!** This function could block indefinitely.\n            Use :func:`parse_with_options` instead\n\n        See :func:`parse_with_options`\n        See :func:`get_meta`\n        See :func:`get_tracks_info`\n        \"\"\"\n        return libvlc_media_parse(self)\n\n    def parse_async(self):\n        \"\"\"Parse a media.\n\n        This fetches (local) art, meta data and tracks information.\n        The method is the asynchronous of :func:`parse`.\n\n        To track when this is over you can listen to libvlc_MediaParsedChanged\n        event. However if the media was already parsed you will not receive this\n        event.\n\n\n        .. warning:: **Deprecated!** You can't be sure to receive the libvlc_MediaParsedChanged\n            event (you can wait indefinitely for this event).\n            Use :func:`parse_with_options` instead\n\n        See :func:`parse`\n        See libvlc_MediaParsedChanged\n        See :func:`get_meta`\n        See :func:`get_tracks_info`\n        \"\"\"\n        return libvlc_media_parse_async(self)\n\n    def parse_stop(self):\n        \"\"\"Stop the parsing of the media\n\n        When the media parsing is stopped, the libvlc_MediaParsedChanged event will\n        be sent with the libvlc_media_parsed_status_timeout status.\n\n        See :func:`parse_with_options`\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_parse_stop(self)\n\n    def parse_with_options(self, parse_flag, timeout):\n        \"\"\"Parse the media asynchronously with options.\n\n        This fetches (local or network) art, meta data and/or tracks information.\n        This method is the extended version of :func:`parse_with_options`.\n\n        To track when this is over you can listen to libvlc_MediaParsedChanged\n        event. However if this functions returns an error, you will not receive any\n        events.\n\n        It uses a flag to specify parse options (see libvlc_media_parse_flag_t). All\n        these flags can be combined. By default, media is parsed if it's a local\n        file.\n\n        .. note:: Parsing can be aborted with :func:`parse_stop`.\n\n        See libvlc_MediaParsedChanged\n        See :func:`get_meta`\n        See :func:`tracks_get`\n        See :func:`get_parsed_status`\n        See :class:`MediaParseFlag`\n\n        :param parse_flag: parse options:\n        :param timeout: maximum time allowed to preparse the media. If -1, the.\n            default \"preparse-timeout\" option will be used as a timeout. If 0, it will.\n            wait indefinitely. If > 0, the timeout will be used (in milliseconds).\n\n        :return: -1 in case of error, 0 otherwise.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_parse_with_options(self, parse_flag, timeout)\n\n    def player_new_from_media(self):\n        \"\"\"Create a Media Player object from a Media\n\n            destroyed.\n\n        :return: a new media player object, or None on error.\n        \"\"\"\n        return libvlc_media_player_new_from_media(self)\n\n    def release(self):\n        \"\"\"Decrement the reference count of a media descriptor object. If the\n        reference count is 0, then :func:`release` will release the\n        media descriptor object. It will send out an libvlc_MediaFreed event\n        to all listeners. If the media descriptor object has been released it\n        should not be used again.\n        \"\"\"\n        return libvlc_media_release(self)\n\n    def retain(self):\n        \"\"\"Retain a reference to a media descriptor object (libvlc_media_t). Use\n        :func:`release` to decrement the reference count of a\n        media descriptor object.\n        \"\"\"\n        return libvlc_media_retain(self)\n\n    def save_meta(self):\n        \"\"\"Save the meta previously set\n\n        :return: true if the write operation was successful.\n        \"\"\"\n        return libvlc_media_save_meta(self)\n\n    def set_meta(self, e_meta, psz_value):\n        \"\"\"Set the meta of the media (this function will not save the meta, call\n        :func:`save_meta` in order to save the meta)\n\n        :param e_meta: the meta to write.\n        :param psz_value: the media's meta.\n        \"\"\"\n        return libvlc_media_set_meta(self, e_meta, str_to_bytes(psz_value))\n\n    def set_user_data(self, p_new_user_data):\n        \"\"\"Sets media descriptor's user_data. user_data is specialized data\n        accessed by the host application, VLC.framework uses it as a pointer to\n        an native object that references a :class:`Media` pointer\n\n        :param p_new_user_data: pointer to user data.\n        \"\"\"\n        return libvlc_media_set_user_data(self, p_new_user_data)\n\n    def slaves_add(self, i_type, i_priority, psz_uri):\n        \"\"\"Add a slave to the current media.\n\n        A slave is an external input source that may contains an additional subtitle\n        track (like a .srt) or an additional audio track (like a .ac3).\n\n        .. note:: This function must be called before the media is parsed (via\n            libvlc_media_parse_with_options) or before the media is played (via\n            libvlc_media_player_play)\n\n        :param i_type: subtitle or audio.\n        :param i_priority: from 0 (low priority) to 4 (high priority).\n        :param psz_uri: Uri of the slave (should contain a valid scheme).\n\n        :return: 0 on success, -1 on error.\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_slaves_add(self, i_type, i_priority, str_to_bytes(psz_uri))\n\n    def slaves_clear(self):\n        \"\"\"Clear all slaves previously added by :func:`slaves_add` or\n        internally.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_slaves_clear(self)\n\n    def slaves_get(self, ppp_slaves):\n        \"\"\"Get a media descriptor's slave list\n\n        The list will contain slaves parsed by VLC or previously added by\n        :func:`slaves_add`. The typical use case of this function is to save\n        a list of slave in a database for a later use.\n\n        See :func:`slaves_add`\n\n        :param ppp_slaves: address to store an allocated array of slaves (must be.\n            freed with libvlc_media_slaves_release) [OUT].\n\n        :return: the number of slaves (zero on error).\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_slaves_get(self, ppp_slaves)\n\n    def subitems(self):\n        \"\"\"Get subitems of media descriptor object. This will increment\n        the reference count of supplied media descriptor object. Use\n        :func:`list_release` to decrement the reference counting.\n\n        :return: list of media descriptor subitems or None.\n        \"\"\"\n        return libvlc_media_subitems(self)\n\n\nclass MediaDiscoverer(_Ctype):\n    def __new__(cls, ptr=_internal_guard):\n        \"\"\"(INTERNAL) ctypes wrapper constructor.\"\"\"\n        return _Constructor(cls, ptr)\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Get event manager from media service discover object.\n\n\n        .. warning:: **Deprecated!** Useless, media_discoverer events are only triggered when calling\n            :func:`start` and :func:`stop`.\n\n        :return: event manager object.\n        \"\"\"\n        return libvlc_media_discoverer_event_manager(self)\n\n    def is_running(self):\n        \"\"\"Query if media service discover object is running.\n\n        :return: true if running, false if not.\n        \"\"\"\n        return libvlc_media_discoverer_is_running(self)\n\n    def localized_name(self):\n        \"\"\"Get media service discover object its localized name.\n\n\n        .. warning:: **Deprecated!** Useless, use :func:`list_get` to get the\n            longname of the service discovery.\n\n        :return: localized name or None if the media_discoverer is not started.\n        \"\"\"\n        return libvlc_media_discoverer_localized_name(self)\n\n    def media_list(self):\n        \"\"\"Get media service discover media list.\n\n        :return: list of media items.\n        \"\"\"\n        return libvlc_media_discoverer_media_list(self)\n\n    def release(self):\n        \"\"\"Release media discover object. If the reference count reaches 0, then\n        the object will be released.\n        \"\"\"\n        return libvlc_media_discoverer_release(self)\n\n    def start(self):\n        \"\"\"Start media discovery.\n\n        To stop it, call :func:`stop` or\n        :func:`list_release` directly.\n\n        See :func:`stop`\n\n        :return: -1 in case of error, 0 otherwise.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_discoverer_start(self)\n\n    def stop(self):\n        \"\"\"Stop media discovery.\n\n        See :func:`start`\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_discoverer_stop(self)\n\n\nclass MediaLibrary(_Ctype):\n    def __new__(cls, ptr=_internal_guard):\n        \"\"\"(INTERNAL) ctypes wrapper constructor.\"\"\"\n        return _Constructor(cls, ptr)\n\n    def load(self):\n        \"\"\"Load media library.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_media_library_load(self)\n\n    def media_list(self):\n        \"\"\"Get media library subitems.\n\n        :return: media list subitems.\n        \"\"\"\n        return libvlc_media_library_media_list(self)\n\n    def release(self):\n        \"\"\"Release media library object. This functions decrements the\n        reference count of the media library object. If it reaches 0,\n        then the object will be released.\n        \"\"\"\n        return libvlc_media_library_release(self)\n\n    def retain(self):\n        \"\"\"Retain a reference to a media library object. This function will\n        increment the reference counting for this object. Use\n        :func:`release` to decrement the reference count.\n        \"\"\"\n        return libvlc_media_library_retain(self)\n\n\nclass MediaList(_Ctype):\n    \"\"\"Usage:\n\n    .. code-block:: python\n\n        MediaList(list_of_MRLs)\n\n    See :meth:`Instance.media_list_new` documentation for details.\n\n    \"\"\"\n\n    def __new__(cls, *args):\n        if args:\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            if isinstance(i, Instance):\n                return i.media_list_new(*args[1:])\n\n        o = get_default_instance().media_list_new(*args)\n        return o\n\n    def get_instance(self):\n        return getattr(self, \"_instance\", None)\n\n    def add_media(self, mrl):\n        \"\"\"Add :class:`Media` instance to media list.\n\n        .. note::\n            The lock should be held upon entering this function.\n\n        :param mrl: A :class:`Media` instance or a MRL.\n\n        :return: 0 on success, -1 if the media list is read-only.\n        \"\"\"\n        mrl = try_fspath(mrl)\n        if isinstance(mrl, str):\n            mrl = (self.get_instance() or get_default_instance()).media_new(mrl)\n        return libvlc_media_list_add_media(self, mrl)\n\n    def count(self):\n        \"\"\"Get count on media list items\n        The :func:`lock` should be held upon entering this function.\n\n        :return: number of items in media list.\n        \"\"\"\n        return libvlc_media_list_count(self)\n\n    def __len__(self):\n        return libvlc_media_list_count(self)\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Get libvlc_event_manager from this media list instance.\n        The p_event_manager is immutable, so you don't have to hold the lock\n\n        :return: libvlc_event_manager.\n        \"\"\"\n        return libvlc_media_list_event_manager(self)\n\n    def index_of_item(self, p_md):\n        \"\"\"Find index position of List media instance in media list.\n        Warning: the function will return the first matched position.\n        The :func:`lock` should be held upon entering this function.\n\n        :param p_md: media instance.\n\n        :return: position of media instance or -1 if media not found.\n        \"\"\"\n        return libvlc_media_list_index_of_item(self, p_md)\n\n    def insert_media(self, p_md, i_pos):\n        \"\"\"Insert media instance in media list on a position\n        The :func:`lock` should be held upon entering this function.\n\n        :param p_md: a media instance.\n        :param i_pos: position in array where to insert.\n\n        :return: 0 on success, -1 if the media list is read-only.\n        \"\"\"\n        return libvlc_media_list_insert_media(self, p_md, i_pos)\n\n    def is_readonly(self):\n        \"\"\"This indicates if this media list is read-only from a user point of view\n\n        :return: 1 on readonly, 0 on readwrite.\n        \"\"\"\n        return libvlc_media_list_is_readonly(self)\n\n    def item_at_index(self, i_pos):\n        \"\"\"List media instance in media list at a position\n        The :func:`lock` should be held upon entering this function.\n\n        :param i_pos: position in array where to insert.\n\n        :return: media instance at position *i_pos*, or None if not found.\n            In case of success, :func:`media_retain` is called to increase the refcount.\n            on the media.\n        \"\"\"\n        return libvlc_media_list_item_at_index(self, i_pos)\n\n    def __getitem__(self, i):\n        return libvlc_media_list_item_at_index(self, i)\n\n    def __iter__(self):\n        for i in range(len(self)):\n            yield self[i]\n\n    def lock(self):\n        \"\"\"Get lock on media list items\"\"\"\n        return libvlc_media_list_lock(self)\n\n    def media(self):\n        \"\"\"Get media instance from this media list instance. This action will increase\n        the refcount on the media instance.\n        The :func:`lock` should NOT be held upon entering this function.\n\n        :return: media instance.\n        \"\"\"\n        return libvlc_media_list_media(self)\n\n    def release(self):\n        \"\"\"Release media list created with :func:`new`.\"\"\"\n        return libvlc_media_list_release(self)\n\n    def remove_index(self, i_pos):\n        \"\"\"Remove media instance from media list on a position\n        The :func:`lock` should be held upon entering this function.\n\n        :param i_pos: position in array where to insert.\n\n        :return: 0 on success, -1 if the list is read-only or the item was not found.\n        \"\"\"\n        return libvlc_media_list_remove_index(self, i_pos)\n\n    def retain(self):\n        \"\"\"Retain reference to a media list\"\"\"\n        return libvlc_media_list_retain(self)\n\n    def set_media(self, p_md):\n        \"\"\"Associate media instance with this media list instance.\n        If another media instance was present it will be released.\n        The :func:`lock` should NOT be held upon entering this function.\n\n        :param p_md: media instance to add.\n        \"\"\"\n        return libvlc_media_list_set_media(self, p_md)\n\n    def unlock(self):\n        \"\"\"Release lock on media list items\n        The :func:`lock` should be held upon entering this function.\n        \"\"\"\n        return libvlc_media_list_unlock(self)\n\n\nclass MediaListPlayer(_Ctype):\n    \"\"\"It may take as parameter either:\n\n    * an :class:`Instance`\n    * nothing\n\n    \"\"\"\n\n    def __new__(cls, arg=None):\n        if arg is None:\n            i = get_default_instance()\n        elif isinstance(arg, Instance):\n            i = arg\n        elif isinstance(arg, _Ints):\n            return _Constructor(cls, arg)\n        else:\n            raise TypeError(\"MediaListPlayer %r\" % (arg,))\n\n        return i.media_list_player_new()\n\n    def get_instance(self):\n        \"\"\"Return the associated :class:`Instance`.\"\"\"\n        return self._instance\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Return the event manager of this media_list_player.\n\n        :return: the event manager.\n        \"\"\"\n        return libvlc_media_list_player_event_manager(self)\n\n    def get_media_player(self):\n        \"\"\"Get media player of the media_list_player instance.\n\n\n        .. note:: the caller is responsible for releasing the returned instance.\n\n        :return: media player instance.\n        \"\"\"\n        return libvlc_media_list_player_get_media_player(self)\n\n    def get_state(self):\n        \"\"\"Get current libvlc_state of media list player\n\n        :return: :class:`State` for media list player.\n        \"\"\"\n        return libvlc_media_list_player_get_state(self)\n\n    def is_playing(self):\n        \"\"\"Is media list playing?\n\n        :return: true for playing and false for not playing.\n        \"\"\"\n        return libvlc_media_list_player_is_playing(self)\n\n    def next(self):\n        \"\"\"Play next item from media list\n\n        :return: 0 upon success -1 if there is no next item.\n        \"\"\"\n        return libvlc_media_list_player_next(self)\n\n    def pause(self):\n        \"\"\"Toggle pause (or resume) media list\"\"\"\n        return libvlc_media_list_player_pause(self)\n\n    def play(self):\n        \"\"\"Play media list\"\"\"\n        return libvlc_media_list_player_play(self)\n\n    def play_item(self, p_md):\n        \"\"\"Play the given media item\n\n        :param p_md: the media instance.\n\n        :return: 0 upon success, -1 if the media is not part of the media list.\n        \"\"\"\n        return libvlc_media_list_player_play_item(self, p_md)\n\n    def play_item_at_index(self, i_index):\n        \"\"\"Play media list item at position index\n\n        :param i_index: index in media list to play.\n\n        :return: 0 upon success -1 if the item wasn't found.\n        \"\"\"\n        return libvlc_media_list_player_play_item_at_index(self, i_index)\n\n    def __getitem__(self, i):\n        return libvlc_media_list_player_play_item_at_index(self, i)\n\n    def __iter__(self):\n        for i in range(len(self)):\n            yield self[i]\n\n    def previous(self):\n        \"\"\"Play previous item from media list\n\n        :return: 0 upon success -1 if there is no previous item.\n        \"\"\"\n        return libvlc_media_list_player_previous(self)\n\n    def release(self):\n        \"\"\"Release a media_list_player after use\n        Decrement the reference count of a media player object. If the\n        reference count is 0, then :func:`release` will\n        release the media player object. If the media player object\n        has been released, then it should not be used again.\n        \"\"\"\n        return libvlc_media_list_player_release(self)\n\n    def retain(self):\n        \"\"\"Retain a reference to a media player list object. Use\n        :func:`release` to decrement reference count.\n        \"\"\"\n        return libvlc_media_list_player_retain(self)\n\n    def set_media_list(self, p_mlist):\n        \"\"\"Set the media list associated with the player\n\n        :param p_mlist: list of media.\n        \"\"\"\n        return libvlc_media_list_player_set_media_list(self, p_mlist)\n\n    def set_media_player(self, p_mi):\n        \"\"\"Replace media player in media_list_player with this instance.\n\n        :param p_mi: media player instance.\n        \"\"\"\n        return libvlc_media_list_player_set_media_player(self, p_mi)\n\n    def set_pause(self, do_pause):\n        \"\"\"Pause or resume media list\n\n        :param do_pause: play/resume if zero, pause if non-zero.\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_list_player_set_pause(self, do_pause)\n\n    def set_playback_mode(self, e_mode):\n        \"\"\"Sets the playback mode for the playlist\n\n        :param e_mode: playback mode specification.\n        \"\"\"\n        return libvlc_media_list_player_set_playback_mode(self, e_mode)\n\n    def stop(self):\n        \"\"\"Stop playing media list\"\"\"\n        return libvlc_media_list_player_stop(self)\n\n\nclass MediaPlayer(_Ctype):\n    \"\"\"It may take as parameter either:\n\n    * a string (media URI), options... In this case, an :class:`Instance` will be created.\n    * an :class:`Instance`, a string (media URI), options...\n\n    \"\"\"\n\n    def __new__(cls, *args):\n        if len(args) == 1 and isinstance(args[0], _Ints):\n            return _Constructor(cls, args[0])\n\n        if args and isinstance(args[0], Instance):\n            instance = args[0]\n            args = args[1:]\n        else:\n            instance = get_default_instance()\n\n        o = instance.media_player_new()\n        if args:\n            o.set_media(instance.media_new(*args))\n        return o\n\n    def get_instance(self):\n        \"\"\"Return the associated :class:`Instance`.\"\"\"\n        return self._instance\n\n    def set_mrl(self, mrl, *options):\n        \"\"\"Set the MRL to play.\n\n        .. warning::\n            Most audio and video options, such as text renderer,\n            have no effects on an individual media. These options must be\n            set at the :class:`Instance` or :class:`MediaPlayer` instanciation.\n\n        :param mrl: The MRL\n        :param options: optional media option=value strings\n\n        :return: the Media object\n        \"\"\"\n        m = self.get_instance().media_new(mrl, *options)\n        self.set_media(m)\n        return m\n\n    def video_get_spu_description(self):\n        \"\"\"Get the description of available video subtitles.\"\"\"\n        return track_description_list(libvlc_video_get_spu_description(self))\n\n    def video_get_track_description(self):\n        \"\"\"Get the description of available video tracks.\"\"\"\n        return track_description_list(libvlc_video_get_track_description(self))\n\n    def audio_get_track_description(self):\n        \"\"\"Get the description of available audio tracks.\"\"\"\n        return track_description_list(libvlc_audio_get_track_description(self))\n\n    def get_full_title_descriptions(self):\n        \"\"\"Get the full description of available titles.\n\n        :return: The titles list.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        titleDescription_pp = ctypes.POINTER(TitleDescription)()\n        n = libvlc_media_player_get_full_title_descriptions(\n            self, ctypes.byref(titleDescription_pp)\n        )\n        info = ctypes.cast(\n            titleDescription_pp, ctypes.POINTER(ctypes.POINTER(TitleDescription) * n)\n        )\n        try:\n            contents = info.contents\n        except ValueError:\n            # Media not parsed, no info.\n            return None\n        descr = (contents[i].contents for i in range(len(contents)))\n        return descr\n\n    def get_full_chapter_descriptions(self, i_chapters_of_title):\n        \"\"\"Get the full description of available chapters.\n\n        :param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1).\n\n        :return: the chapters list\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        chapterDescription_pp = ctypes.POINTER(ChapterDescription)()\n        n = libvlc_media_player_get_full_chapter_descriptions(\n            self, i_chapters_of_title, ctypes.byref(chapterDescription_pp)\n        )\n        info = ctypes.cast(\n            chapterDescription_pp,\n            ctypes.POINTER(ctypes.POINTER(ChapterDescription) * n),\n        )\n        try:\n            contents = info.contents\n        except ValueError:\n            # Media not parsed, no info.\n            return None\n        descr = (contents[i].contents for i in range(len(contents)))\n        return descr\n\n    def video_get_size(self, num=0):\n        \"\"\"Get the video size in pixels as 2-tuple (width, height).\n\n        :param num: video number (default 0).\n        \"\"\"\n        r = libvlc_video_get_size(self, num)\n        if isinstance(r, tuple) and len(r) == 2:\n            return r\n        else:\n            raise VLCException(\"invalid video number (%s)\" % (num,))\n\n    def set_hwnd(self, drawable):\n        \"\"\"Set a Win32/Win64 API window handle (HWND).\n\n        Specify where the media player should render its video\n        output. If LibVLC was built without Win32/Win64 API output\n        support, then this has no effects.\n\n        :param drawable: windows handle of the drawable.\n        \"\"\"\n        if not isinstance(drawable, ctypes.c_void_p):\n            drawable = ctypes.c_void_p(int(drawable))\n        libvlc_media_player_set_hwnd(self, drawable)\n\n    def video_get_width(self, num=0):\n        \"\"\"Get the width of a video in pixels.\n\n        :param num: video number (default 0).\n        \"\"\"\n        return self.video_get_size(num)[0]\n\n    def video_get_height(self, num=0):\n        \"\"\"Get the height of a video in pixels.\n\n        :param num: video number (default 0).\n        \"\"\"\n        return self.video_get_size(num)[1]\n\n    def video_get_cursor(self, num=0):\n        \"\"\"Get the mouse pointer coordinates over a video as 2-tuple (x, y).\n\n        Coordinates are expressed in terms of the decoded video resolution,\n        **not** in terms of pixels on the screen/viewport. To get the\n        latter, you must query your windowing system directly.\n\n        Either coordinate may be negative or larger than the corresponding\n        size of the video, if the cursor is outside the rendering area.\n\n        .. warning::\n            The coordinates may be out-of-date if the pointer is not\n            located on the video rendering area. LibVLC does not track the\n            mouse pointer if the latter is outside the video widget.\n\n        .. note::\n            LibVLC does not support multiple mouse pointers (but does\n            support multiple input devices sharing the same pointer).\n\n        :param num: video number (default 0).\n        \"\"\"\n        r = libvlc_video_get_cursor(self, num)\n        if isinstance(r, tuple) and len(r) == 2:\n            return r\n        raise VLCException(\"invalid video number (%s)\" % (num,))\n\n    def audio_get_channel(self):\n        \"\"\"Get current audio channel.\n\n        :return: the audio channel See :class:`AudioOutputChannel`.\n        \"\"\"\n        return libvlc_audio_get_channel(self)\n\n    def audio_get_delay(self):\n        \"\"\"Get current audio delay.\n\n        :return: the audio delay (microseconds).\n        :version: LibVLC 1.1.1 or later.\n        \"\"\"\n        return libvlc_audio_get_delay(self)\n\n    def audio_get_mute(self):\n        \"\"\"Get current mute status.\n\n        :return: the mute status (boolean) if defined, -1 if undefined/unapplicable.\n        \"\"\"\n        return libvlc_audio_get_mute(self)\n\n    def audio_get_track(self):\n        \"\"\"Get current audio track.\n\n        :return: the audio track ID or -1 if no active input.\n        \"\"\"\n        return libvlc_audio_get_track(self)\n\n    def audio_get_track_count(self):\n        \"\"\"Get number of available audio tracks.\n\n        :return: the number of available audio tracks (int), or -1 if unavailable.\n        \"\"\"\n        return libvlc_audio_get_track_count(self)\n\n    def audio_get_volume(self):\n        \"\"\"Get current software audio volume.\n\n        :return: the software volume in percents.\n            (0 = mute, 100 = nominal / 0dB).\n        \"\"\"\n        return libvlc_audio_get_volume(self)\n\n    def audio_output_device_enum(self):\n        \"\"\"Gets a list of potential audio output devices,\n        See :func:`audio_output_device_set`.\n\n        .. note:: Not all audio outputs support enumerating devices.\n            The audio output may be functional even if the list is empty (None).\n\n        .. note:: The list may not be exhaustive.\n\n        .. warning:: Some audio output devices in the list might not actually work in\n            some circumstances. By default, it is recommended to not specify any\n            explicit audio device.\n\n        :return: A None-terminated linked list of potential audio output devices.\n            It must be freed with :func:`audio_output_device_list_release`.\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_output_device_enum(self)\n\n    def audio_output_device_get(self):\n        \"\"\"Get the current audio output device identifier.\n\n        This complements :func:`audio_output_device_set`.\n\n        .. warning:: The initial value for the current audio output device identifier\n            may not be set or may be some unknown value. A LibVLC application should\n            compare this value against the known device identifiers (e.g. those that\n            were previously retrieved by a call to :func:`audio_output_device_enum` or\n            libvlc_audio_output_device_list_get) to find the current audio output device.\n\n        It is possible that the selected audio output device changes (an external\n        change) without a call to :func:`audio_output_device_set`. That may make this\n        method unsuitable to use if a LibVLC application is attempting to track\n        dynamic audio device changes as they happen.\n\n        :return: the current audio output device identifier.\n            None if no device is selected or in case of error.\n            (the result must be released with free() or libvlc_free).\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_audio_output_device_get(self)\n\n    def audio_output_device_set(self, module, device_id):\n        \"\"\"Configures an explicit audio output device.\n\n        If the *module* paramater is None, audio output will be moved to the device\n        specified by the device identifier string immediately. This is the\n        recommended usage.\n\n        A list of adequate potential device strings can be obtained with\n        :func:`audio_output_device_enum`.\n\n        However passing None is supported in LibVLC version 2.2.0 and later only;\n        in earlier versions, this function would have no effects when the module\n        parameter was None.\n\n        If the *module* parameter is not None, the device parameter of the\n        corresponding audio output, if it exists, will be set to the specified\n        string. Note that some audio output modules do not have such a parameter\n        (notably MMDevice and PulseAudio).\n\n        A list of adequate potential device strings can be obtained with\n        :func:`audio_output_device_list_get`.\n\n        .. note:: This function does not select the specified audio output plugin.\n            :func:`audio_output_set` is used for that purpose.\n\n        .. warning:: The syntax for the device parameter depends on the audio output.\n\n        Some audio output modules require further parameters (e.g. a channels map\n        in the case of ALSA).\n\n        :param module: If None, current audio output module.\n            if non-None, name of audio output module.\n            (See libvlc_audio_output_t).\n        :param device_id: device identifier string.\n\n        :return: Nothing. Errors are ignored (this is a design bug).\n        \"\"\"\n        return libvlc_audio_output_device_set(\n            self, str_to_bytes(module), str_to_bytes(device_id)\n        )\n\n    def audio_output_get_device_type(self):\n        \"\"\"Stub for backward compatibility.\n\n        :return: always -1.\n        \"\"\"\n        return libvlc_audio_output_get_device_type(self)\n\n    def audio_output_set(self, psz_name):\n        \"\"\"Selects an audio output module.\n\n        .. note:: Any change will take be effect only after playback is stopped and\n            restarted. Audio output cannot be changed while playing.\n\n        :param psz_name: name of audio output,\n            use psz_name of See :class:`AudioOutput`.\n\n        :return: 0 if function succeeded, -1 on error.\n        \"\"\"\n        return libvlc_audio_output_set(self, str_to_bytes(psz_name))\n\n    def audio_output_set_device_type(self, device_type):\n        \"\"\"Stub for backward compatibility.\"\"\"\n        return libvlc_audio_output_set_device_type(self, device_type)\n\n    def audio_set_callbacks(self, play, pause, resume, flush, drain, opaque):\n        \"\"\"Sets callbacks and private data for decoded audio.\n\n        Use :func:`audio_set_format` or :func:`audio_set_format_callbacks`\n        to configure the decoded audio format.\n\n        .. note:: The audio callbacks override any other audio output mechanism.\n            If the callbacks are set, LibVLC will **not** output audio in any way.\n\n        :param play: callback to play audio samples (must not be None).\n        :param pause: callback to pause playback (or None to ignore).\n        :param resume: callback to resume playback (or None to ignore).\n        :param flush: callback to flush audio buffers (or None to ignore).\n        :param drain: callback to drain audio buffers (or None to ignore).\n        :param opaque: private pointer for the audio callbacks (as first parameter).\n\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_audio_set_callbacks(\n            self, play, pause, resume, flush, drain, opaque\n        )\n\n    def audio_set_channel(self, channel):\n        \"\"\"Set current audio *channel*.\n\n        :param channel: the audio channel, See :class:`AudioOutputChannel`.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_audio_set_channel(self, channel)\n\n    def audio_set_delay(self, i_delay):\n        \"\"\"Set current audio delay. The audio delay will be reset to zero each time the media changes.\n\n        :param i_delay: the audio delay (microseconds).\n\n        :return: 0 on success, -1 on error.\n        :version: LibVLC 1.1.1 or later.\n        \"\"\"\n        return libvlc_audio_set_delay(self, i_delay)\n\n    def audio_set_format(self, format, rate, channels):\n        \"\"\"Sets a fixed decoded audio *format*.\n\n        This only works in combination with :func:`audio_set_callbacks`,\n        and is mutually exclusive with :func:`audio_set_format_callbacks`.\n\n        :param format: a four-characters string identifying the sample format.\n            (e.g. \"S16N\" or \"f32l\").\n        :param rate: sample rate (expressed in Hz).\n        :param channels: channels count.\n\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_audio_set_format(self, str_to_bytes(format), rate, channels)\n\n    def audio_set_format_callbacks(self, setup, cleanup):\n        \"\"\"Sets decoded audio format via callbacks.\n\n        This only works in combination with :func:`audio_set_callbacks`.\n\n        :param setup: callback to select the audio format (cannot be None).\n        :param cleanup: callback to release any allocated resources (or None).\n\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_audio_set_format_callbacks(self, setup, cleanup)\n\n    def audio_set_mute(self, status):\n        \"\"\"Set mute *status*.\n\n        .. warning:: This function does not always work. If there are no active audio\n            playback stream, the mute *status* might not be available. If digital\n            pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also\n            some audio output plugins do not support muting at all.\n\n        .. note:: To force silent playback, disable all audio tracks. This is more\n            efficient and reliable than mute.\n\n        :param status: If status is true then mute, otherwise unmute.\n        \"\"\"\n        return libvlc_audio_set_mute(self, status)\n\n    def audio_set_track(self, i_track):\n        \"\"\"Set current audio track.\n\n        :param i_track: the track ID (i_id field from track description).\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_audio_set_track(self, i_track)\n\n    def audio_set_volume(self, i_volume):\n        \"\"\"Set current software audio volume.\n\n        :param i_volume: the volume in percents (0 = mute, 100 = 0dB).\n\n        :return: 0 if the volume was set, -1 if it was out of range.\n        \"\"\"\n        return libvlc_audio_set_volume(self, i_volume)\n\n    def audio_set_volume_callback(self, set_volume):\n        \"\"\"Set callbacks and private data for decoded audio. This only works in\n        combination with :func:`audio_set_callbacks`.\n        Use :func:`audio_set_format` or :func:`audio_set_format_callbacks`\n        to configure the decoded audio format.\n\n        :param set_volume: callback to apply audio volume,\n            or None to apply volume in software.\n\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_audio_set_volume_callback(self, set_volume)\n\n    def audio_toggle_mute(self):\n        \"\"\"Toggle mute status.\n\n        .. warning:: Toggling mute atomically is not always possible: On some platforms,\n            other processes can mute the VLC audio playback stream asynchronously. Thus,\n            there is a small race condition where toggling will not work.\n            See also the limitations of :func:`audio_set_mute`.\n        \"\"\"\n        return libvlc_audio_toggle_mute(self)\n\n    def get_fullscreen(self):\n        \"\"\"Get current fullscreen status.\n\n        :return: the fullscreen status (boolean).\n        \"\"\"\n        return libvlc_get_fullscreen(self)\n\n    def add_slave(self, i_type, psz_uri, b_select):\n        \"\"\"Add a slave to the current media player.\n\n        .. note:: If the player is playing, the slave will be added directly. This call\n            will also update the slave list of the attached :class:`Media`.\n\n        See :func:`media_slaves_add`\n\n        :param i_type: subtitle or audio.\n        :param psz_uri: Uri of the slave (should contain a valid scheme).\n        :param b_select: True if this slave should be selected when it's loaded.\n\n        :return: 0 on success, -1 on error.\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_player_add_slave(\n            self, i_type, str_to_bytes(psz_uri), b_select\n        )\n\n    def can_pause(self):\n        \"\"\"Can this media player be paused?\n\n        :return: true if the media player can pause.\n        \"\"\"\n        return libvlc_media_player_can_pause(self)\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Get the Event Manager from which the media player send event.\n\n        :return: the event manager associated with p_mi.\n        \"\"\"\n        return libvlc_media_player_event_manager(self)\n\n    def get_agl(self):\n        \"\"\".. warning:: **Deprecated!** Use :func:`get_nsobject` instead.\"\"\"\n        return libvlc_media_player_get_agl(self)\n\n    def get_chapter(self):\n        \"\"\"Get movie chapter.\n\n        :return: chapter number currently playing, or -1 if there is no media.\n        \"\"\"\n        return libvlc_media_player_get_chapter(self)\n\n    def get_chapter_count(self):\n        \"\"\"Get movie chapter count\n\n        :return: number of chapters in movie, or -1.\n        \"\"\"\n        return libvlc_media_player_get_chapter_count(self)\n\n    def get_chapter_count_for_title(self, i_title):\n        \"\"\"Get title chapter count\n\n        :param i_title: title.\n\n        :return: number of chapters in title, or -1.\n        \"\"\"\n        return libvlc_media_player_get_chapter_count_for_title(self, i_title)\n\n    def get_fps(self):\n        \"\"\"Get movie fps rate\n\n        This function is provided for backward compatibility. It cannot deal with\n        multiple video tracks. In LibVLC versions prior to 3.0, it would also fail\n        if the file format did not convey the frame rate explicitly.\n\n\n        .. warning:: **Deprecated!** Consider using :func:`media_tracks_get` instead.\n\n        :return: frames per second (fps) for this playing movie, or 0 if unspecified.\n        \"\"\"\n        return libvlc_media_player_get_fps(self)\n\n    def get_hwnd(self):\n        \"\"\"Get the Windows API window handle (HWND) previously set with\n        :func:`set_hwnd`. The handle will be returned even if LibVLC\n        is not currently outputting any video to it.\n\n        :return: a window handle or None if there are none.\n        \"\"\"\n        return libvlc_media_player_get_hwnd(self)\n\n    def get_length(self):\n        \"\"\"Get the current movie length (in ms).\n\n        :return: the movie length (in ms), or -1 if there is no media.\n        \"\"\"\n        return libvlc_media_player_get_length(self)\n\n    def get_media(self):\n        \"\"\"Get the media used by the media_player.\n\n        :return: the media associated with *p_mi*, or None if no.\n            media is associated.\n        \"\"\"\n        return libvlc_media_player_get_media(self)\n\n    def get_nsobject(self):\n        \"\"\"Get the NSView handler previously set with :func:`set_nsobject`.\n\n        :return: the NSView handler or 0 if none where set.\n        \"\"\"\n        return libvlc_media_player_get_nsobject(self)\n\n    def get_position(self):\n        \"\"\"Get movie position as percentage between 0.0 and 1.0.\n\n        :return: movie position, or -1. in case of error.\n        \"\"\"\n        return libvlc_media_player_get_position(self)\n\n    def get_rate(self):\n        \"\"\"Get the requested movie play rate.\n        .. warning:: Depending on the underlying media, the requested rate may be\n            different from the real playback rate.\n\n        :return: movie play rate.\n        \"\"\"\n        return libvlc_media_player_get_rate(self)\n\n    def get_role(self):\n        \"\"\"Gets the media role.\n\n        :return: the media player role (libvlc_media_player_role_t).\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_player_get_role(self)\n\n    def get_state(self):\n        \"\"\"Get current movie state\n\n        :return: the current state of the media player (playing, paused, ...) See :class:`State`.\n        \"\"\"\n        return libvlc_media_player_get_state(self)\n\n    def get_time(self):\n        \"\"\"Get the current movie time (in ms).\n\n        :return: the movie time (in ms), or -1 if there is no media.\n        \"\"\"\n        return libvlc_media_player_get_time(self)\n\n    def get_title(self):\n        \"\"\"Get movie title\n\n        :return: title number currently playing, or -1.\n        \"\"\"\n        return libvlc_media_player_get_title(self)\n\n    def get_title_count(self):\n        \"\"\"Get movie title count\n\n        :return: title number count, or -1.\n        \"\"\"\n        return libvlc_media_player_get_title_count(self)\n\n    def get_xwindow(self):\n        \"\"\"Get the X Window System window identifier previously set with\n        :func:`set_xwindow`. Note that this will return the identifier\n        even if VLC is not currently using it (for instance if it is playing an\n        audio-only input).\n\n        :return: an X window ID, or 0 if none where set.\n        \"\"\"\n        return libvlc_media_player_get_xwindow(self)\n\n    def has_vout(self):\n        \"\"\"How many video outputs does this media player have?\n\n        :return: the number of video outputs.\n        \"\"\"\n        return libvlc_media_player_has_vout(self)\n\n    def is_playing(self):\n        \"\"\"is_playing\n\n        :return: 1 if the media player is playing, 0 otherwise.\n        \"\"\"\n        return libvlc_media_player_is_playing(self)\n\n    def is_seekable(self):\n        \"\"\"Is this media player seekable?\n\n        :return: true if the media player can seek.\n        \"\"\"\n        return libvlc_media_player_is_seekable(self)\n\n    def navigate(self, navigate):\n        \"\"\"Navigate through DVD Menu\n\n        :param navigate: the Navigation mode.\n\n        :version: libVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_media_player_navigate(self, navigate)\n\n    def next_chapter(self):\n        \"\"\"Set next chapter (if applicable)\"\"\"\n        return libvlc_media_player_next_chapter(self)\n\n    def next_frame(self):\n        \"\"\"Display the next frame (if supported)\"\"\"\n        return libvlc_media_player_next_frame(self)\n\n    def pause(self):\n        \"\"\"Toggle pause (no effect if there is no media)\"\"\"\n        return libvlc_media_player_pause(self)\n\n    def play(self):\n        \"\"\"Play\n\n        :return: 0 if playback started (and was already started), or -1 on error.\n        \"\"\"\n        return libvlc_media_player_play(self)\n\n    def previous_chapter(self):\n        \"\"\"Set previous chapter (if applicable)\"\"\"\n        return libvlc_media_player_previous_chapter(self)\n\n    def program_scrambled(self):\n        \"\"\"Check if the current program is scrambled\n\n        :return: true if the current program is scrambled.\n\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_media_player_program_scrambled(self)\n\n    def release(self):\n        \"\"\"Release a media_player after use\n        Decrement the reference count of a media player object. If the\n        reference count is 0, then :func:`release` will\n        release the media player object. If the media player object\n        has been released, then it should not be used again.\n        \"\"\"\n        return libvlc_media_player_release(self)\n\n    def retain(self):\n        \"\"\"Retain a reference to a media player object. Use\n        :func:`release` to decrement reference count.\n        \"\"\"\n        return libvlc_media_player_retain(self)\n\n    def set_agl(self, drawable):\n        \"\"\".. warning:: **Deprecated!** Use :func:`set_nsobject` instead.\"\"\"\n        return libvlc_media_player_set_agl(self, drawable)\n\n    def set_android_context(self, p_awindow_handler):\n        \"\"\"Set the android context.\n\n        :param p_awindow_handler: org.videolan.libvlc.AWindow jobject owned by the.\n            org.videolan.libvlc.MediaPlayer class from the libvlc-android project.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_player_set_android_context(self, p_awindow_handler)\n\n    def set_chapter(self, i_chapter):\n        \"\"\"Set movie chapter (if applicable).\n\n        :param i_chapter: chapter number to play.\n        \"\"\"\n        return libvlc_media_player_set_chapter(self, i_chapter)\n\n    def set_equalizer(self, p_equalizer):\n        \"\"\"Apply new equalizer settings to a media player.\n\n        The equalizer is first created by invoking :func:`audio_equalizer_new` or\n        :func:`audio_equalizer_new_from_preset`.\n\n        It is possible to apply new equalizer settings to a media player whether the media\n        player is currently playing media or not.\n\n        Invoking this method will immediately apply the new equalizer settings to the audio\n        output of the currently playing media if there is any.\n\n        If there is no currently playing media, the new equalizer settings will be applied\n        later if and when new media is played.\n\n        Equalizer settings will automatically be applied to subsequently played media.\n\n        To disable the equalizer for a media player invoke this method passing None for the\n        p_equalizer parameter.\n\n        The media player does not keep a reference to the supplied equalizer so it is safe\n        for an application to release the equalizer reference any time after this method\n        returns.\n\n        :param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player.\n\n        :return: zero on success, -1 on error.\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_media_player_set_equalizer(self, p_equalizer)\n\n    def set_evas_object(self, p_evas_object):\n        \"\"\"Set the EFL Evas Object.\n\n        :param p_evas_object: a valid EFL Evas Object (Evas_Object).\n\n        :return: -1 if an error was detected, 0 otherwise.\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_player_set_evas_object(self, p_evas_object)\n\n    def set_media(self, p_md):\n        \"\"\"Set the media that will be used by the media_player. If any,\n        previous md will be released.\n\n        :param p_md: the Media. Afterwards the p_md can be safely.\n            destroyed.\n        \"\"\"\n        return libvlc_media_player_set_media(self, p_md)\n\n    def set_nsobject(self, drawable):\n        \"\"\"Set the NSView handler where the media player should render its video output.\n\n        Use the vout called \"macosx\".\n\n        The *drawable* is an NSObject that follow the VLCOpenGLVideoViewEmbedding\n        protocol:\n\n        .. code-block:: objectivec++\n\n            @protocol VLCOpenGLVideoViewEmbedding <NSObject>\n            - (void)addVoutSubview:(NSView *)view;\n            - (void)removeVoutSubview:(NSView *)view;\n            @end\n\n        Or it can be an NSView object.\n\n        If you want to use it along with Qt see the QMacCocoaViewContainer. Then\n        the following code should work:\n\n        .. code-block:: objectivec++\n\n            NSView *video = [[NSView alloc] init];\n            QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);\n            libvlc_media_player_set_nsobject(mp, video);\n            [video release];\n\n\n        You can find a live example in VLCVideoView in VLCKit.framework.\n\n        :param drawable: the drawable that is either an NSView or an object following.\n            the VLCOpenGLVideoViewEmbedding protocol.\n        \"\"\"\n        return libvlc_media_player_set_nsobject(self, drawable)\n\n    def set_pause(self, do_pause):\n        \"\"\"Pause or resume (no effect if there is no media)\n\n        :param do_pause: play/resume if zero, pause if non-zero.\n\n        :version: LibVLC 1.1.1 or later.\n        \"\"\"\n        return libvlc_media_player_set_pause(self, do_pause)\n\n    def set_position(self, f_pos):\n        \"\"\"Set movie position as percentage between 0.0 and 1.0.\n        This has no effect if playback is not enabled.\n        This might not work depending on the underlying input format and protocol.\n\n        :param f_pos: the position.\n        \"\"\"\n        return libvlc_media_player_set_position(self, f_pos)\n\n    def set_rate(self, rate):\n        \"\"\"Set movie play rate\n\n        :param rate: movie play rate to set.\n\n        :return: -1 if an error was detected, 0 otherwise (but even then, it might.\n            not actually work depending on the underlying media protocol).\n        \"\"\"\n        return libvlc_media_player_set_rate(self, rate)\n\n    def set_renderer(self, p_item):\n        \"\"\"Set a renderer to the media player\n\n        .. note:: must be called before the first call of :func:`play` to\n            take effect.\n\n        See :func:`renderer_discoverer_new`\n\n        :param p_item: an item discovered by :func:`renderer_discoverer_start`.\n\n        :return: 0 on success, -1 on error.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_player_set_renderer(self, p_item)\n\n    def set_role(self, role):\n        \"\"\"Sets the media *role*.\n\n        :param role: the media player role (libvlc_media_player_role_t).\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_media_player_set_role(self, role)\n\n    def set_time(self, i_time):\n        \"\"\"Set the movie time (in ms). This has no effect if no media is being played.\n        Not all formats and protocols support this.\n\n        :param i_time: the movie time (in ms).\n        \"\"\"\n        return libvlc_media_player_set_time(self, i_time)\n\n    def set_title(self, i_title):\n        \"\"\"Set movie title\n\n        :param i_title: title number to play.\n        \"\"\"\n        return libvlc_media_player_set_title(self, i_title)\n\n    def set_video_title_display(self, position, timeout):\n        \"\"\"Set if, and how, the video title will be shown when media is played.\n\n        :param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed.\n        :param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable).\n\n        :version: libVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_media_player_set_video_title_display(self, position, timeout)\n\n    def set_xwindow(self, drawable):\n        \"\"\"Set an X Window System *drawable* where the media player should render its\n        video output. The call takes effect when the playback starts. If it is\n        already started, it might need to be stopped before changes apply.\n        If LibVLC was built without X11 output support, then this function has no\n        effects.\n\n        By default, LibVLC will capture input events on the video rendering area.\n        Use :func:`video_set_mouse_input` and :func:`video_set_key_input` to\n        disable that and deliver events to the parent window / to the application\n        instead. By design, the X11 protocol delivers input events to only one\n        recipient.\n\n        .. warning::\n            The application must call the XInitThreads() function from Xlib before\n            :func:`new`, and before any call to XOpenDisplay() directly or via any\n            other library. Failure to call XInitThreads() will seriously impede LibVLC\n            performance. Calling XOpenDisplay() before XInitThreads() will eventually\n            crash the process. That is a limitation of Xlib.\n\n        .. note::\n            The specified identifier must correspond to an existing Input/Output class\n            X11 window. Pixmaps are **not** currently supported. The default X11\n            server is assumed, i.e. that specified in the DISPLAY environment variable.\n\n        .. warning::\n            LibVLC can deal with invalid X11 handle errors, however some display drivers\n            (EGL, GLX, VA and/or VDPAU) can unfortunately not. Thus the window handle\n            must remain valid until playback is stopped, otherwise the process may\n            abort or crash.\n\n        :param drawable: X11 window ID.\n\n        :bug:\n            No more than one window handle per media player instance can be specified.\n            If the media has multiple simultaneously active video tracks, extra tracks.\n            will be rendered into external windows beyond the control of the.\n            application.\n        \"\"\"\n        return libvlc_media_player_set_xwindow(self, drawable)\n\n    def stop(self):\n        \"\"\"Stop (no effect if there is no media)\"\"\"\n        return libvlc_media_player_stop(self)\n\n    def will_play(self):\n        \"\"\"Is the player able to play\n\n        :return: boolean.\n        \"\"\"\n        return libvlc_media_player_will_play(self)\n\n    def set_fullscreen(self, b_fullscreen):\n        \"\"\"Enable or disable fullscreen.\n\n        .. warning:: With most window managers, only a top-level windows can be in\n            full-screen mode. Hence, this function will not operate properly if\n            :func:`set_xwindow` was used to embed the video in a\n            non-top-level window. In that case, the embedding window must be reparented\n            to the root window **before** fullscreen mode is enabled. You will want\n            to reparent it back to its normal parent when disabling fullscreen.\n\n        :param b_fullscreen: boolean for fullscreen status.\n        \"\"\"\n        return libvlc_set_fullscreen(self, b_fullscreen)\n\n    def toggle_fullscreen(self):\n        \"\"\"Toggle fullscreen status on non-embedded video outputs.\n\n        .. warning:: The same limitations applies to this function\n            as to :func:`set_fullscreen`.\n        \"\"\"\n        return libvlc_toggle_fullscreen(self)\n\n    def toggle_teletext(self):\n        \"\"\"Toggle teletext transparent status on video output.\n\n        .. warning:: **Deprecated!** use :func:`video_set_teletext` instead.\n        \"\"\"\n        return libvlc_toggle_teletext(self)\n\n    def video_get_adjust_float(self, option):\n        \"\"\"Get float adjust *option*.\n\n        :param option: adjust option to get, values of :class:`VideoAdjustOption`.\n\n        :version: LibVLC 1.1.1 and later.\n        \"\"\"\n        return libvlc_video_get_adjust_float(self, option)\n\n    def video_get_adjust_int(self, option):\n        \"\"\"Get integer adjust *option*.\n\n        :param option: adjust option to get, values of :class:`VideoAdjustOption`.\n\n        :version: LibVLC 1.1.1 and later.\n        \"\"\"\n        return libvlc_video_get_adjust_int(self, option)\n\n    def video_get_aspect_ratio(self):\n        \"\"\"Get current video aspect ratio.\n\n        :return: the video aspect ratio or None if unspecified.\n            (the result must be released with free() or libvlc_free).\n        \"\"\"\n        return libvlc_video_get_aspect_ratio(self)\n\n    def video_get_chapter_description(self, i_title):\n        \"\"\"Get the description of available chapters for specific title.\n\n        :param i_title: selected title.\n\n        :return: list containing description of available chapter for title *i_title*.\n            It must be freed with :func:`track_description_list_release`.\n        \"\"\"\n        return libvlc_video_get_chapter_description(self, i_title)\n\n    def video_get_crop_geometry(self):\n        \"\"\"Get current crop filter geometry.\n\n        :return: the crop filter geometry or None if unset.\n        \"\"\"\n        return libvlc_video_get_crop_geometry(self)\n\n    def video_get_logo_int(self, option):\n        \"\"\"Get integer logo *option*.\n\n        :param option: logo option to get, values of :class:`VideoLogoOption`.\n        \"\"\"\n        return libvlc_video_get_logo_int(self, option)\n\n    def video_get_marquee_int(self, option):\n        \"\"\"Get an integer marquee *option* value\n\n        :param option: marq option to get See libvlc_video_marquee_int_option_t.\n        \"\"\"\n        return libvlc_video_get_marquee_int(self, option)\n\n    def video_get_marquee_string(self, option):\n        \"\"\"Get a string marquee *option* value\n\n        :param option: marq option to get See libvlc_video_marquee_string_option_t.\n        \"\"\"\n        return libvlc_video_get_marquee_string(self, option)\n\n    def video_get_scale(self):\n        \"\"\"Get the current video scaling factor.\n        See also :func:`video_set_scale`.\n\n        :return: the currently configured zoom factor, or 0. if the video is set.\n            to fit to the output window/drawable automatically.\n        \"\"\"\n        return libvlc_video_get_scale(self)\n\n    def video_get_spu(self):\n        \"\"\"Get current video subtitle.\n\n        :return: the video subtitle selected, or -1 if none.\n        \"\"\"\n        return libvlc_video_get_spu(self)\n\n    def video_get_spu_count(self):\n        \"\"\"Get the number of available video subtitles.\n\n        :return: the number of available video subtitles.\n        \"\"\"\n        return libvlc_video_get_spu_count(self)\n\n    def video_get_spu_delay(self):\n        \"\"\"Get the current subtitle delay. Positive values means subtitles are being\n        displayed later, negative values earlier.\n\n        :return: time (in microseconds) the display of subtitles is being delayed.\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_video_get_spu_delay(self)\n\n    def video_get_teletext(self):\n        \"\"\"Get current teletext page requested or 0 if it's disabled.\n\n        Teletext is disabled by default, call :func:`video_set_teletext` to enable\n        it.\n\n        :return: the current teletext page requested.\n        \"\"\"\n        return libvlc_video_get_teletext(self)\n\n    def video_get_title_description(self):\n        \"\"\"Get the description of available titles.\n\n        :return: list containing description of available titles.\n            It must be freed with :func:`track_description_list_release`.\n        \"\"\"\n        return libvlc_video_get_title_description(self)\n\n    def video_get_track(self):\n        \"\"\"Get current video track.\n\n        :return: the video track ID (int) or -1 if no active input.\n        \"\"\"\n        return libvlc_video_get_track(self)\n\n    def video_get_track_count(self):\n        \"\"\"Get number of available video tracks.\n\n        :return: the number of available video tracks (int).\n        \"\"\"\n        return libvlc_video_get_track_count(self)\n\n    def video_set_adjust_float(self, option, value):\n        \"\"\"Set adjust *option* as float. Options that take a different type value\n        are ignored.\n\n        :param option: adust option to set, values of :class:`VideoAdjustOption`.\n        :param value: adjust option value.\n\n        :version: LibVLC 1.1.1 and later.\n        \"\"\"\n        return libvlc_video_set_adjust_float(self, option, value)\n\n    def video_set_adjust_int(self, option, value):\n        \"\"\"Set adjust *option* as integer. Options that take a different type value\n        are ignored.\n        Passing libvlc_adjust_enable as *option* *value* has the side effect of\n        starting (arg !0) or stopping (arg 0) the adjust filter.\n\n        :param option: adust option to set, values of :class:`VideoAdjustOption`.\n        :param value: adjust option value.\n\n        :version: LibVLC 1.1.1 and later.\n        \"\"\"\n        return libvlc_video_set_adjust_int(self, option, value)\n\n    def video_set_aspect_ratio(self, psz_aspect):\n        \"\"\"Set new video aspect ratio.\n\n\n        .. note:: Invalid aspect ratios are ignored.\n\n        :param psz_aspect: new video aspect-ratio or None to reset to default.\n        \"\"\"\n        return libvlc_video_set_aspect_ratio(self, str_to_bytes(psz_aspect))\n\n    def video_set_callbacks(self, lock, unlock, display, opaque):\n        \"\"\"Set callbacks and private data to render decoded video to a custom area\n        in memory.\n        Use :func:`video_set_format` or :func:`video_set_format_callbacks`\n        to configure the decoded format.\n\n        .. warning:: Rendering video into custom memory buffers is considerably less\n            efficient than rendering in a custom window as normal.\n\n        For optimal perfomances, VLC media player renders into a custom window, and\n        does not use this function and associated callbacks. It is **highly\n        recommended** that other LibVLC-based application do likewise.\n        To embed video in a window, use libvlc_media_player_set_xid or equivalent\n        depending on the operating system.\n\n        If window embedding does not fit the application use case, then a custom\n        LibVLC video output *display* plugin is required to maintain optimal video\n        rendering performances.\n\n        The following limitations affect performance:\n\n        * Hardware video decoding acceleration will either be disabled completely,\n            or require (relatively slow) copy from video/DSP memory to main memory.\n        * Sub-pictures (subtitles, on-screen *display*, etc.) must be blent into the\n            main picture by the CPU instead of the GPU.\n        * Depending on the video format, pixel format conversion, picture scaling,\n            cropping and/or picture re-orientation, must be performed by the CPU\n            instead of the GPU.\n        * Memory copying is required between LibVLC reference picture buffers and\n            application buffers (between *lock* and *unlock* callbacks).\n\n        :param lock: callback to lock video memory (must not be None).\n        :param unlock: callback to unlock video memory (or None if not needed).\n        :param display: callback to display video (or None if not needed).\n        :param opaque: private pointer for the three callbacks (as first parameter).\n\n        :version: LibVLC 1.1.1 or later.\n        \"\"\"\n        return libvlc_video_set_callbacks(self, lock, unlock, display, opaque)\n\n    def video_set_crop_geometry(self, psz_geometry):\n        \"\"\"Set new crop filter geometry.\n\n        :param psz_geometry: new crop filter geometry (None to unset).\n        \"\"\"\n        return libvlc_video_set_crop_geometry(self, str_to_bytes(psz_geometry))\n\n    def video_set_deinterlace(self, psz_mode):\n        \"\"\"Enable or disable deinterlace filter\n\n        :param psz_mode: type of deinterlace filter, None to disable.\n        \"\"\"\n        return libvlc_video_set_deinterlace(self, str_to_bytes(psz_mode))\n\n    def video_set_format(self, chroma, width, height, pitch):\n        \"\"\"Set decoded video *chroma* and dimensions.\n        This only works in combination with :func:`video_set_callbacks`,\n        and is mutually exclusive with :func:`video_set_format_callbacks`.\n\n        :param chroma: a four-characters string identifying the chroma.\n            (e.g. \"RV32\" or \"YUYV\").\n        :param width: pixel width.\n        :param height: pixel height.\n        :param pitch: line pitch (in bytes).\n\n        :version: LibVLC 1.1.1 or later.\n        :bug: All pixel planes are expected to have the same *pitch*.\n            To use the YCbCr color space with chrominance subsampling,\n            consider using :func:`video_set_format_callbacks` instead.\n        \"\"\"\n        return libvlc_video_set_format(self, str_to_bytes(chroma), width, height, pitch)\n\n    def video_set_format_callbacks(self, setup, cleanup):\n        \"\"\"Set decoded video chroma and dimensions. This only works in combination with\n        :func:`video_set_callbacks`.\n\n        :param setup: callback to select the video format (cannot be None).\n        :param cleanup: callback to release any allocated resources (or None).\n\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_video_set_format_callbacks(self, setup, cleanup)\n\n    def video_set_key_input(self, on):\n        \"\"\"Enable or disable key press events handling, according to the LibVLC hotkeys\n        configuration. By default and for historical reasons, keyboard events are\n        handled by the LibVLC video widget.\n\n        .. note:: On X11, there can be only one subscriber for key press and mouse\n            click events per window. If your application has subscribed to those events\n            for the X window ID of the video widget, then LibVLC will not be able to\n            handle key presses and mouse clicks in any case.\n\n        .. warning:: This function is only implemented for X11 and Win32 at the moment.\n\n        :param on: true to handle key press events, false to ignore them.\n        \"\"\"\n        return libvlc_video_set_key_input(self, on)\n\n    def video_set_logo_int(self, option, value):\n        \"\"\"Set logo *option* as integer. Options that take a different type value\n        are ignored.\n        Passing libvlc_logo_enable as *option* *value* has the side effect of\n        starting (arg !0) or stopping (arg 0) the logo filter.\n\n        :param option: logo option to set, values of :class:`VideoLogoOption`.\n        :param value: logo option value.\n        \"\"\"\n        return libvlc_video_set_logo_int(self, option, value)\n\n    def video_set_logo_string(self, option, psz_value):\n        \"\"\"Set logo *option* as string. Options that take a different type value\n        are ignored.\n\n        :param option: logo option to set, values of :class:`VideoLogoOption`.\n        :param psz_value: logo option value.\n        \"\"\"\n        return libvlc_video_set_logo_string(self, option, str_to_bytes(psz_value))\n\n    def video_set_marquee_int(self, option, i_val):\n        \"\"\"Enable, disable or set an integer marquee option\n\n        Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)\n        or disabling (arg 0) the marq filter.\n\n        :param option: marq option to set See libvlc_video_marquee_int_option_t.\n        :param i_val: marq option value.\n        \"\"\"\n        return libvlc_video_set_marquee_int(self, option, i_val)\n\n    def video_set_marquee_string(self, option, psz_text):\n        \"\"\"Set a marquee string option\n\n        :param option: marq option to set See libvlc_video_marquee_string_option_t.\n        :param psz_text: marq option value.\n        \"\"\"\n        return libvlc_video_set_marquee_string(self, option, str_to_bytes(psz_text))\n\n    def video_set_mouse_input(self, on):\n        \"\"\"Enable or disable mouse click events handling. By default, those events are\n        handled. This is needed for DVD menus to work, as well as a few video\n        filters such as \"puzzle\".\n\n        See :func:`video_set_key_input`.\n\n        .. warning:: This function is only implemented for X11 and Win32 at the moment.\n\n        :param on: true to handle mouse click events, false to ignore them.\n        \"\"\"\n        return libvlc_video_set_mouse_input(self, on)\n\n    def video_set_scale(self, f_factor):\n        \"\"\"Set the video scaling factor. That is the ratio of the number of pixels on\n        screen to the number of pixels in the original decoded video in each\n        dimension. Zero is a special value; it will adjust the video to the output\n        window/drawable (in windowed mode) or the entire screen.\n\n        Note that not all video outputs support scaling.\n\n        :param f_factor: the scaling factor, or zero.\n        \"\"\"\n        return libvlc_video_set_scale(self, f_factor)\n\n    def video_set_spu(self, i_spu):\n        \"\"\"Set new video subtitle.\n\n        :param i_spu: video subtitle track to select (i_id from track description).\n\n        :return: 0 on success, -1 if out of range.\n        \"\"\"\n        return libvlc_video_set_spu(self, i_spu)\n\n    def video_set_spu_delay(self, i_delay):\n        \"\"\"Set the subtitle delay. This affects the timing of when the subtitle will\n        be displayed. Positive values result in subtitles being displayed later,\n        while negative values will result in subtitles being displayed earlier.\n\n        The subtitle delay will be reset to zero each time the media changes.\n\n        :param i_delay: time (in microseconds) the display of subtitles should be delayed.\n\n        :return: 0 on success, -1 on error.\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_video_set_spu_delay(self, i_delay)\n\n    def video_set_subtitle_file(self, psz_subtitle):\n        \"\"\"Set new video subtitle file.\n\n        .. warning:: **Deprecated!** Use :func:`add_slave` instead.\n\n        :param psz_subtitle: new video subtitle file.\n\n        :return: the success status (boolean).\n        \"\"\"\n        return libvlc_video_set_subtitle_file(self, str_to_bytes(psz_subtitle))\n\n    def video_set_teletext(self, i_page):\n        \"\"\"Set new teletext page to retrieve.\n\n        This function can also be used to send a teletext key.\n\n        :param i_page: teletex page number requested. This value can be 0 to disable.\n            teletext, a number in the range ]0;1000[ to show the requested page, or a.\n            :class:`TeletextKey`. 100 is the default teletext page.\n        \"\"\"\n        return libvlc_video_set_teletext(self, i_page)\n\n    def video_set_track(self, i_track):\n        \"\"\"Set video track.\n\n        :param i_track: the track ID (i_id field from track description).\n\n        :return: 0 on success, -1 if out of range.\n        \"\"\"\n        return libvlc_video_set_track(self, i_track)\n\n    def video_take_snapshot(self, num, psz_filepath, i_width, i_height):\n        \"\"\"Take a snapshot of the current video window.\n\n        If *i_width* AND *i_height* is 0, original size is used.\n        If *i_width* XOR *i_height* is 0, original aspect-ratio is preserved.\n\n        :param num: number of video output (typically 0 for the first/only one).\n        :param psz_filepath: the path of a file or a folder to save the screenshot into.\n        :param i_width: the snapshot's width.\n        :param i_height: the snapshot's height.\n\n        :return: 0 on success, -1 if the video was not found.\n        \"\"\"\n        return libvlc_video_take_snapshot(\n            self, num, str_to_bytes(psz_filepath), i_width, i_height\n        )\n\n    def video_update_viewpoint(self, p_viewpoint, b_absolute):\n        \"\"\"Update the video viewpoint information.\n\n        .. note:: It is safe to call this function before the media player is started.\n\n        .. note:: the values are set asynchronously, it will be used by the next frame displayed.\n\n        :param p_viewpoint: video viewpoint allocated via :func:`video_new_viewpoint`.\n        :param b_absolute: if true replace the old viewpoint with the new one. If.\n            false, increase/decrease it.\n\n        :return: -1 in case of error, 0 otherwise.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_video_update_viewpoint(self, p_viewpoint, b_absolute)\n\n\nclass Renderer(_Ctype):\n    def __new__(cls, ptr=_internal_guard):\n        \"\"\"(INTERNAL) ctypes wrapper constructor.\"\"\"\n        return _Constructor(cls, ptr)\n\n    def flags(self):\n        \"\"\"Get the flags of a renderer item\n\n        See LIBVLC_RENDERER_CAN_AUDIO\n        See LIBVLC_RENDERER_CAN_VIDEO\n\n        :return: bitwise flag: capabilities of the renderer, see.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_flags(self)\n\n    def hold(self):\n        \"\"\"Hold a renderer item, i.e. creates a new reference\n\n        This functions need to called from the libvlc_RendererDiscovererItemAdded\n        callback if the libvlc user wants to use this item after. (for display or\n        for passing it to the mediaplayer for example).\n\n        :return: the current item.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_hold(self)\n\n    def icon_uri(self):\n        \"\"\"Get the icon uri of a renderer item\n\n        :return: the uri of the item's icon (can be None, must *not* be freed).\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_icon_uri(self)\n\n    def name(self):\n        \"\"\"Get the human readable name of a renderer item\n\n        :return: the name of the item (can't be None, must *not* be freed).\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_name(self)\n\n    def release(self):\n        \"\"\"Releases a renderer item, i.e. decrements its reference counter\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_release(self)\n\n    def type(self):\n        \"\"\"Get the type (not translated) of a renderer item. For now, the type can only\n        be \"chromecast\" (\"upnp\", \"airplay\" may come later).\n\n        :return: the type of the item (can't be None, must *not* be freed).\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_type(self)\n\n\nclass RendererDiscoverer(_Ctype):\n    def __new__(cls, ptr=_internal_guard):\n        \"\"\"(INTERNAL) ctypes wrapper constructor.\"\"\"\n        return _Constructor(cls, ptr)\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Get the event manager of the renderer discoverer\n\n        The possible events to attach are libvlc_RendererDiscovererItemAdded\n        and libvlc_RendererDiscovererItemDeleted.\n\n        The :class:`Renderer` struct passed to event callbacks is owned by\n        VLC, users should take care of holding/releasing this struct for their\n        internal usage.\n\n        See :class:`Event`.u.renderer_discoverer_item_added.item\n        See :class:`Event`.u.renderer_discoverer_item_removed.item\n\n        :return: a valid event manager (can't fail).\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_discoverer_event_manager(self)\n\n    def release(self):\n        \"\"\"Release a renderer discoverer object\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_discoverer_release(self)\n\n    def start(self):\n        \"\"\"Start renderer discovery\n\n        To stop it, call :func:`stop` or\n        :func:`release` directly.\n\n        See :func:`stop`\n\n        :return: -1 in case of error, 0 otherwise.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_discoverer_start(self)\n\n    def stop(self):\n        \"\"\"Stop renderer discovery.\n\n        See :func:`start`\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_discoverer_stop(self)\n\n\n# End of generated wrappers #\n\n\n# Generated enum types #\nclass AudioOutputChannel(_Enum):\n    \"\"\"Audio channels.\n\n    Defined symbols:\n      * ``vlc.AudioOutputChannel.Error``\n      * ``vlc.AudioOutputChannel.Stereo``\n      * ``vlc.AudioOutputChannel.RStereo``\n      * ``vlc.AudioOutputChannel.Left``\n      * ``vlc.AudioOutputChannel.Right``\n      * ``vlc.AudioOutputChannel.Dolbys``\n    \"\"\"\n\n    _enum_names_ = {\n        -1: \"Error\",\n        1: \"Stereo\",\n        2: \"RStereo\",\n        3: \"Left\",\n        4: \"Right\",\n        5: \"Dolbys\",\n    }\n\n\nAudioOutputChannel.Dolbys = AudioOutputChannel(5)\nAudioOutputChannel.Error = AudioOutputChannel(-1)\nAudioOutputChannel.Left = AudioOutputChannel(3)\nAudioOutputChannel.RStereo = AudioOutputChannel(2)\nAudioOutputChannel.Right = AudioOutputChannel(4)\nAudioOutputChannel.Stereo = AudioOutputChannel(1)\n\n\nclass AudioOutputDeviceTypes(_Enum):\n    \"\"\"Audio device types.\n\n    Defined symbols:\n      * ``vlc.AudioOutputDeviceTypes.Error``\n      * ``vlc.AudioOutputDeviceTypes.Mono``\n      * ``vlc.AudioOutputDeviceTypes.Stereo``\n      * ``vlc.AudioOutputDeviceTypes._2F2R``\n      * ``vlc.AudioOutputDeviceTypes._3F2R``\n      * ``vlc.AudioOutputDeviceTypes._5_1``\n      * ``vlc.AudioOutputDeviceTypes._6_1``\n      * ``vlc.AudioOutputDeviceTypes._7_1``\n      * ``vlc.AudioOutputDeviceTypes.SPDIF``\n    \"\"\"\n\n    _enum_names_ = {\n        -1: \"Error\",\n        1: \"Mono\",\n        2: \"Stereo\",\n        4: \"_2F2R\",\n        5: \"_3F2R\",\n        6: \"_5_1\",\n        7: \"_6_1\",\n        8: \"_7_1\",\n        10: \"SPDIF\",\n    }\n\n\nAudioOutputDeviceTypes.Error = AudioOutputDeviceTypes(-1)\nAudioOutputDeviceTypes.Mono = AudioOutputDeviceTypes(1)\nAudioOutputDeviceTypes.SPDIF = AudioOutputDeviceTypes(10)\nAudioOutputDeviceTypes.Stereo = AudioOutputDeviceTypes(2)\nAudioOutputDeviceTypes._2F2R = AudioOutputDeviceTypes(4)\nAudioOutputDeviceTypes._3F2R = AudioOutputDeviceTypes(5)\nAudioOutputDeviceTypes._5_1 = AudioOutputDeviceTypes(6)\nAudioOutputDeviceTypes._6_1 = AudioOutputDeviceTypes(7)\nAudioOutputDeviceTypes._7_1 = AudioOutputDeviceTypes(8)\n\n\nclass DialogQuestionType(_Enum):\n    \"\"\"\n\n    Defined symbols:\n      * ``vlc.DialogQuestionType.DIALOG_QUESTION_NORMAL``\n      * ``vlc.DialogQuestionType.DIALOG_QUESTION_WARNING``\n      * ``vlc.DialogQuestionType.DIALOG_QUESTION_CRITICAL``\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"DIALOG_QUESTION_NORMAL\",\n        1: \"DIALOG_QUESTION_WARNING\",\n        2: \"DIALOG_QUESTION_CRITICAL\",\n    }\n\n\nDialogQuestionType.DIALOG_QUESTION_CRITICAL = DialogQuestionType(2)\nDialogQuestionType.DIALOG_QUESTION_NORMAL = DialogQuestionType(0)\nDialogQuestionType.DIALOG_QUESTION_WARNING = DialogQuestionType(1)\n\n\nclass EventType(_Enum):\n    \"\"\"Event types.\n\n    Defined symbols:\n      * ``vlc.EventType.MediaMetaChanged``\n      * ``vlc.EventType.MediaSubItemAdded``\n      * ``vlc.EventType.MediaDurationChanged``\n      * ``vlc.EventType.MediaParsedChanged``\n      * ``vlc.EventType.MediaFreed``\n      * ``vlc.EventType.MediaStateChanged``\n      * ``vlc.EventType.MediaSubItemTreeAdded``\n      * ``vlc.EventType.MediaPlayerMediaChanged``\n      * ``vlc.EventType.MediaPlayerNothingSpecial``\n      * ``vlc.EventType.MediaPlayerOpening``\n      * ``vlc.EventType.MediaPlayerBuffering``\n      * ``vlc.EventType.MediaPlayerPlaying``\n      * ``vlc.EventType.MediaPlayerPaused``\n      * ``vlc.EventType.MediaPlayerStopped``\n      * ``vlc.EventType.MediaPlayerForward``\n      * ``vlc.EventType.MediaPlayerBackward``\n      * ``vlc.EventType.MediaPlayerEndReached``\n      * ``vlc.EventType.MediaPlayerEncounteredError``\n      * ``vlc.EventType.MediaPlayerTimeChanged``\n      * ``vlc.EventType.MediaPlayerPositionChanged``\n      * ``vlc.EventType.MediaPlayerSeekableChanged``\n      * ``vlc.EventType.MediaPlayerPausableChanged``\n      * ``vlc.EventType.MediaPlayerTitleChanged``\n      * ``vlc.EventType.MediaPlayerSnapshotTaken``\n      * ``vlc.EventType.MediaPlayerLengthChanged``\n      * ``vlc.EventType.MediaPlayerVout``\n      * ``vlc.EventType.MediaPlayerScrambledChanged``\n      * ``vlc.EventType.MediaPlayerESAdded``\n      * ``vlc.EventType.MediaPlayerESDeleted``\n      * ``vlc.EventType.MediaPlayerESSelected``\n      * ``vlc.EventType.MediaPlayerCorked``\n      * ``vlc.EventType.MediaPlayerUncorked``\n      * ``vlc.EventType.MediaPlayerMuted``\n      * ``vlc.EventType.MediaPlayerUnmuted``\n      * ``vlc.EventType.MediaPlayerAudioVolume``\n      * ``vlc.EventType.MediaPlayerAudioDevice``\n      * ``vlc.EventType.MediaPlayerChapterChanged``\n      * ``vlc.EventType.MediaListItemAdded``\n      * ``vlc.EventType.MediaListWillAddItem``\n      * ``vlc.EventType.MediaListItemDeleted``\n      * ``vlc.EventType.MediaListWillDeleteItem``\n      * ``vlc.EventType.MediaListEndReached``\n      * ``vlc.EventType.MediaListViewItemAdded``\n      * ``vlc.EventType.MediaListViewWillAddItem``\n      * ``vlc.EventType.MediaListViewItemDeleted``\n      * ``vlc.EventType.MediaListViewWillDeleteItem``\n      * ``vlc.EventType.MediaListPlayerPlayed``\n      * ``vlc.EventType.MediaListPlayerNextItemSet``\n      * ``vlc.EventType.MediaListPlayerStopped``\n      * ``vlc.EventType.MediaDiscovererStarted``\n    .. warning:: **Deprecated!** Useless event, it will be triggered only when calling\n    libvlc_media_discoverer_start()\n      * ``vlc.EventType.MediaDiscovererEnded``\n    .. warning:: **Deprecated!** Useless event, it will be triggered only when calling\n    libvlc_media_discoverer_stop()\n      * ``vlc.EventType.RendererDiscovererItemAdded``\n      * ``vlc.EventType.RendererDiscovererItemDeleted``\n      * ``vlc.EventType.VlmMediaAdded``\n      * ``vlc.EventType.VlmMediaRemoved``\n      * ``vlc.EventType.VlmMediaChanged``\n      * ``vlc.EventType.VlmMediaInstanceStarted``\n      * ``vlc.EventType.VlmMediaInstanceStopped``\n      * ``vlc.EventType.VlmMediaInstanceStatusInit``\n      * ``vlc.EventType.VlmMediaInstanceStatusOpening``\n      * ``vlc.EventType.VlmMediaInstanceStatusPlaying``\n      * ``vlc.EventType.VlmMediaInstanceStatusPause``\n      * ``vlc.EventType.VlmMediaInstanceStatusEnd``\n      * ``vlc.EventType.VlmMediaInstanceStatusError``\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"MediaMetaChanged\",\n        1: \"MediaSubItemAdded\",\n        2: \"MediaDurationChanged\",\n        3: \"MediaParsedChanged\",\n        4: \"MediaFreed\",\n        5: \"MediaStateChanged\",\n        6: \"MediaSubItemTreeAdded\",\n        0x100: \"MediaPlayerMediaChanged\",\n        257: \"MediaPlayerNothingSpecial\",\n        258: \"MediaPlayerOpening\",\n        259: \"MediaPlayerBuffering\",\n        260: \"MediaPlayerPlaying\",\n        261: \"MediaPlayerPaused\",\n        262: \"MediaPlayerStopped\",\n        263: \"MediaPlayerForward\",\n        264: \"MediaPlayerBackward\",\n        265: \"MediaPlayerEndReached\",\n        266: \"MediaPlayerEncounteredError\",\n        267: \"MediaPlayerTimeChanged\",\n        268: \"MediaPlayerPositionChanged\",\n        269: \"MediaPlayerSeekableChanged\",\n        270: \"MediaPlayerPausableChanged\",\n        271: \"MediaPlayerTitleChanged\",\n        272: \"MediaPlayerSnapshotTaken\",\n        273: \"MediaPlayerLengthChanged\",\n        274: \"MediaPlayerVout\",\n        275: \"MediaPlayerScrambledChanged\",\n        276: \"MediaPlayerESAdded\",\n        277: \"MediaPlayerESDeleted\",\n        278: \"MediaPlayerESSelected\",\n        279: \"MediaPlayerCorked\",\n        280: \"MediaPlayerUncorked\",\n        281: \"MediaPlayerMuted\",\n        282: \"MediaPlayerUnmuted\",\n        283: \"MediaPlayerAudioVolume\",\n        284: \"MediaPlayerAudioDevice\",\n        285: \"MediaPlayerChapterChanged\",\n        0x200: \"MediaListItemAdded\",\n        513: \"MediaListWillAddItem\",\n        514: \"MediaListItemDeleted\",\n        515: \"MediaListWillDeleteItem\",\n        516: \"MediaListEndReached\",\n        0x300: \"MediaListViewItemAdded\",\n        769: \"MediaListViewWillAddItem\",\n        770: \"MediaListViewItemDeleted\",\n        771: \"MediaListViewWillDeleteItem\",\n        0x400: \"MediaListPlayerPlayed\",\n        1025: \"MediaListPlayerNextItemSet\",\n        1026: \"MediaListPlayerStopped\",\n        0x500: \"MediaDiscovererStarted\",\n        1281: \"MediaDiscovererEnded\",\n        1282: \"RendererDiscovererItemAdded\",\n        1283: \"RendererDiscovererItemDeleted\",\n        0x600: \"VlmMediaAdded\",\n        1537: \"VlmMediaRemoved\",\n        1538: \"VlmMediaChanged\",\n        1539: \"VlmMediaInstanceStarted\",\n        1540: \"VlmMediaInstanceStopped\",\n        1541: \"VlmMediaInstanceStatusInit\",\n        1542: \"VlmMediaInstanceStatusOpening\",\n        1543: \"VlmMediaInstanceStatusPlaying\",\n        1544: \"VlmMediaInstanceStatusPause\",\n        1545: \"VlmMediaInstanceStatusEnd\",\n        1546: \"VlmMediaInstanceStatusError\",\n    }\n\n\nEventType.MediaDiscovererEnded = EventType(1281)\nEventType.MediaDiscovererStarted = EventType(0x500)\nEventType.MediaDurationChanged = EventType(2)\nEventType.MediaFreed = EventType(4)\nEventType.MediaListEndReached = EventType(516)\nEventType.MediaListItemAdded = EventType(0x200)\nEventType.MediaListItemDeleted = EventType(514)\nEventType.MediaListPlayerNextItemSet = EventType(1025)\nEventType.MediaListPlayerPlayed = EventType(0x400)\nEventType.MediaListPlayerStopped = EventType(1026)\nEventType.MediaListViewItemAdded = EventType(0x300)\nEventType.MediaListViewItemDeleted = EventType(770)\nEventType.MediaListViewWillAddItem = EventType(769)\nEventType.MediaListViewWillDeleteItem = EventType(771)\nEventType.MediaListWillAddItem = EventType(513)\nEventType.MediaListWillDeleteItem = EventType(515)\nEventType.MediaMetaChanged = EventType(0)\nEventType.MediaParsedChanged = EventType(3)\nEventType.MediaPlayerAudioDevice = EventType(284)\nEventType.MediaPlayerAudioVolume = EventType(283)\nEventType.MediaPlayerBackward = EventType(264)\nEventType.MediaPlayerBuffering = EventType(259)\nEventType.MediaPlayerChapterChanged = EventType(285)\nEventType.MediaPlayerCorked = EventType(279)\nEventType.MediaPlayerESAdded = EventType(276)\nEventType.MediaPlayerESDeleted = EventType(277)\nEventType.MediaPlayerESSelected = EventType(278)\nEventType.MediaPlayerEncounteredError = EventType(266)\nEventType.MediaPlayerEndReached = EventType(265)\nEventType.MediaPlayerForward = EventType(263)\nEventType.MediaPlayerLengthChanged = EventType(273)\nEventType.MediaPlayerMediaChanged = EventType(0x100)\nEventType.MediaPlayerMuted = EventType(281)\nEventType.MediaPlayerNothingSpecial = EventType(257)\nEventType.MediaPlayerOpening = EventType(258)\nEventType.MediaPlayerPausableChanged = EventType(270)\nEventType.MediaPlayerPaused = EventType(261)\nEventType.MediaPlayerPlaying = EventType(260)\nEventType.MediaPlayerPositionChanged = EventType(268)\nEventType.MediaPlayerScrambledChanged = EventType(275)\nEventType.MediaPlayerSeekableChanged = EventType(269)\nEventType.MediaPlayerSnapshotTaken = EventType(272)\nEventType.MediaPlayerStopped = EventType(262)\nEventType.MediaPlayerTimeChanged = EventType(267)\nEventType.MediaPlayerTitleChanged = EventType(271)\nEventType.MediaPlayerUncorked = EventType(280)\nEventType.MediaPlayerUnmuted = EventType(282)\nEventType.MediaPlayerVout = EventType(274)\nEventType.MediaStateChanged = EventType(5)\nEventType.MediaSubItemAdded = EventType(1)\nEventType.MediaSubItemTreeAdded = EventType(6)\nEventType.RendererDiscovererItemAdded = EventType(1282)\nEventType.RendererDiscovererItemDeleted = EventType(1283)\nEventType.VlmMediaAdded = EventType(0x600)\nEventType.VlmMediaChanged = EventType(1538)\nEventType.VlmMediaInstanceStarted = EventType(1539)\nEventType.VlmMediaInstanceStatusEnd = EventType(1545)\nEventType.VlmMediaInstanceStatusError = EventType(1546)\nEventType.VlmMediaInstanceStatusInit = EventType(1541)\nEventType.VlmMediaInstanceStatusOpening = EventType(1542)\nEventType.VlmMediaInstanceStatusPause = EventType(1544)\nEventType.VlmMediaInstanceStatusPlaying = EventType(1543)\nEventType.VlmMediaInstanceStopped = EventType(1540)\nEventType.VlmMediaRemoved = EventType(1537)\n\n\nclass LogLevel(_Enum):\n    \"\"\"Logging messages level.\n\n    .. note:: Future LibVLC versions may define new levels.\n\n    Defined symbols:\n      * ``vlc.LogLevel.DEBUG`` < Debug message\n      * ``vlc.LogLevel.NOTICE`` < Important informational message\n      * ``vlc.LogLevel.WARNING`` < Warning (potential error) message\n      * ``vlc.LogLevel.ERROR`` < Error message\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"DEBUG\",\n        2: \"NOTICE\",\n        3: \"WARNING\",\n        4: \"ERROR\",\n    }\n\n\nLogLevel.DEBUG = LogLevel(0)\nLogLevel.ERROR = LogLevel(4)\nLogLevel.NOTICE = LogLevel(2)\nLogLevel.WARNING = LogLevel(3)\n\n\nclass MediaDiscovererCategory(_Enum):\n    \"\"\"Category of a media discoverer\n    See :func:`libvlc_media_discoverer_list_get`.\n\n    Defined symbols:\n      * ``vlc.MediaDiscovererCategory.devices`` devices, like portable music player\n      * ``vlc.MediaDiscovererCategory.lan`` LAN/WAN services, like Upnp, SMB, or SAP\n      * ``vlc.MediaDiscovererCategory.podcasts`` Podcasts\n      * ``vlc.MediaDiscovererCategory.localdirs`` Local directories, like Video, Music or Pictures directories\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"devices\",\n        1: \"lan\",\n        2: \"podcasts\",\n        3: \"localdirs\",\n    }\n\n\nMediaDiscovererCategory.devices = MediaDiscovererCategory(0)\nMediaDiscovererCategory.lan = MediaDiscovererCategory(1)\nMediaDiscovererCategory.localdirs = MediaDiscovererCategory(3)\nMediaDiscovererCategory.podcasts = MediaDiscovererCategory(2)\n\n\nclass MediaParseFlag(_Enum):\n    \"\"\"Parse flags used by :func:`libvlc_media_parse_with_options`\n\n    See :func:`libvlc_media_parse_with_options`.\n\n    Defined symbols:\n      * ``vlc.MediaParseFlag.local`` Parse media if it's a local file\n      * ``vlc.MediaParseFlag.network`` Parse media even if it's a network file\n      * ``vlc.MediaParseFlag.fetch_local`` Fetch meta and covert art using local resources\n      * ``vlc.MediaParseFlag.fetch_network`` Fetch meta and covert art using network resources\n      * ``vlc.MediaParseFlag.do_interact`` Interact with the user (via libvlc_dialog_cbs) when preparsing this item\n    (and not its sub items). Set this flag in order to receive a callback\n    when the input is asking for credentials.\n    \"\"\"\n\n    _enum_names_ = {\n        0x0: \"local\",\n        0x1: \"network\",\n        0x2: \"fetch_local\",\n        0x4: \"fetch_network\",\n        0x8: \"do_interact\",\n    }\n\n\nMediaParseFlag.do_interact = MediaParseFlag(0x8)\nMediaParseFlag.fetch_local = MediaParseFlag(0x2)\nMediaParseFlag.fetch_network = MediaParseFlag(0x4)\nMediaParseFlag.local = MediaParseFlag(0x0)\nMediaParseFlag.network = MediaParseFlag(0x1)\n\n\nclass MediaParsedStatus(_Enum):\n    \"\"\"Parse status used sent by :func:`libvlc_media_parse_with_options` or returned by\n    :func:`libvlc_media_get_parsed_status`\n\n    See :func:`libvlc_media_parse_with_options`\n    See :func:`libvlc_media_get_parsed_status`.\n\n    Defined symbols:\n      * ``vlc.MediaParsedStatus.skipped``\n      * ``vlc.MediaParsedStatus.failed``\n      * ``vlc.MediaParsedStatus.timeout``\n      * ``vlc.MediaParsedStatus.done``\n    \"\"\"\n\n    _enum_names_ = {\n        1: \"skipped\",\n        2: \"failed\",\n        3: \"timeout\",\n        4: \"done\",\n    }\n\n\nMediaParsedStatus.done = MediaParsedStatus(4)\nMediaParsedStatus.failed = MediaParsedStatus(2)\nMediaParsedStatus.skipped = MediaParsedStatus(1)\nMediaParsedStatus.timeout = MediaParsedStatus(3)\n\n\nclass MediaPlayerRole(_Enum):\n    \"\"\"Media player roles.\n\n    :version: LibVLC 3.0.0 and later.\n\n    See :func:`libvlc_media_player_set_role`.\n\n    Defined symbols:\n      * ``vlc.MediaPlayerRole._None`` < Don't use a media player role\n      * ``vlc.MediaPlayerRole.Music`` < Music (or radio) playback\n      * ``vlc.MediaPlayerRole.Video`` < Video playback\n      * ``vlc.MediaPlayerRole.Communication`` < Speech, real-time communication\n      * ``vlc.MediaPlayerRole.Game`` < Video game\n      * ``vlc.MediaPlayerRole.Notification`` < User interaction feedback\n      * ``vlc.MediaPlayerRole.Animation`` < Embedded animation (e.g. in web page)\n      * ``vlc.MediaPlayerRole.Production`` < Audio editting/production\n      * ``vlc.MediaPlayerRole.Accessibility`` < Accessibility\n      * ``vlc.MediaPlayerRole.Test`` Testing\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"_None\",\n        1: \"Music\",\n        2: \"Video\",\n        3: \"Communication\",\n        4: \"Game\",\n        5: \"Notification\",\n        6: \"Animation\",\n        7: \"Production\",\n        8: \"Accessibility\",\n        9: \"Test\",\n    }\n\n\nMediaPlayerRole.Accessibility = MediaPlayerRole(8)\nMediaPlayerRole.Animation = MediaPlayerRole(6)\nMediaPlayerRole.Communication = MediaPlayerRole(3)\nMediaPlayerRole.Game = MediaPlayerRole(4)\nMediaPlayerRole.Music = MediaPlayerRole(1)\nMediaPlayerRole.Notification = MediaPlayerRole(5)\nMediaPlayerRole.Production = MediaPlayerRole(7)\nMediaPlayerRole.Test = MediaPlayerRole(9)\nMediaPlayerRole.Video = MediaPlayerRole(2)\nMediaPlayerRole._None = MediaPlayerRole(0)\n\n\nclass MediaSlaveType(_Enum):\n    \"\"\"Type of a media slave: subtitle or audio.\n\n    Defined symbols:\n      * ``vlc.MediaSlaveType.subtitle``\n      * ``vlc.MediaSlaveType.audio``\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"subtitle\",\n        1: \"audio\",\n    }\n\n\nMediaSlaveType.audio = MediaSlaveType(1)\nMediaSlaveType.subtitle = MediaSlaveType(0)\n\n\nclass MediaType(_Enum):\n    \"\"\"Media type\n\n    See :func:`libvlc_media_get_type`.\n\n    Defined symbols:\n      * ``vlc.MediaType.unknown``\n      * ``vlc.MediaType.file``\n      * ``vlc.MediaType.directory``\n      * ``vlc.MediaType.disc``\n      * ``vlc.MediaType.stream``\n      * ``vlc.MediaType.playlist``\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"unknown\",\n        1: \"file\",\n        2: \"directory\",\n        3: \"disc\",\n        4: \"stream\",\n        5: \"playlist\",\n    }\n\n\nMediaType.directory = MediaType(2)\nMediaType.disc = MediaType(3)\nMediaType.file = MediaType(1)\nMediaType.playlist = MediaType(5)\nMediaType.stream = MediaType(4)\nMediaType.unknown = MediaType(0)\n\n\nclass Meta(_Enum):\n    \"\"\"Meta data types.\n\n    Defined symbols:\n      * ``vlc.Meta.Title``\n      * ``vlc.Meta.Artist``\n      * ``vlc.Meta.Genre``\n      * ``vlc.Meta.Copyright``\n      * ``vlc.Meta.Album``\n      * ``vlc.Meta.TrackNumber``\n      * ``vlc.Meta.Description``\n      * ``vlc.Meta.Rating``\n      * ``vlc.Meta.Date``\n      * ``vlc.Meta.Setting``\n      * ``vlc.Meta.URL``\n      * ``vlc.Meta.Language``\n      * ``vlc.Meta.NowPlaying``\n      * ``vlc.Meta.Publisher``\n      * ``vlc.Meta.EncodedBy``\n      * ``vlc.Meta.ArtworkURL``\n      * ``vlc.Meta.TrackID``\n      * ``vlc.Meta.TrackTotal``\n      * ``vlc.Meta.Director``\n      * ``vlc.Meta.Season``\n      * ``vlc.Meta.Episode``\n      * ``vlc.Meta.ShowName``\n      * ``vlc.Meta.Actors``\n      * ``vlc.Meta.AlbumArtist``\n      * ``vlc.Meta.DiscNumber``\n      * ``vlc.Meta.DiscTotal``\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"Title\",\n        1: \"Artist\",\n        2: \"Genre\",\n        3: \"Copyright\",\n        4: \"Album\",\n        5: \"TrackNumber\",\n        6: \"Description\",\n        7: \"Rating\",\n        8: \"Date\",\n        9: \"Setting\",\n        10: \"URL\",\n        11: \"Language\",\n        12: \"NowPlaying\",\n        13: \"Publisher\",\n        14: \"EncodedBy\",\n        15: \"ArtworkURL\",\n        16: \"TrackID\",\n        17: \"TrackTotal\",\n        18: \"Director\",\n        19: \"Season\",\n        20: \"Episode\",\n        21: \"ShowName\",\n        22: \"Actors\",\n        23: \"AlbumArtist\",\n        24: \"DiscNumber\",\n        25: \"DiscTotal\",\n    }\n\n\nMeta.Actors = Meta(22)\nMeta.Album = Meta(4)\nMeta.AlbumArtist = Meta(23)\nMeta.Artist = Meta(1)\nMeta.ArtworkURL = Meta(15)\nMeta.Copyright = Meta(3)\nMeta.Date = Meta(8)\nMeta.Description = Meta(6)\nMeta.Director = Meta(18)\nMeta.DiscNumber = Meta(24)\nMeta.DiscTotal = Meta(25)\nMeta.EncodedBy = Meta(14)\nMeta.Episode = Meta(20)\nMeta.Genre = Meta(2)\nMeta.Language = Meta(11)\nMeta.NowPlaying = Meta(12)\nMeta.Publisher = Meta(13)\nMeta.Rating = Meta(7)\nMeta.Season = Meta(19)\nMeta.Setting = Meta(9)\nMeta.ShowName = Meta(21)\nMeta.Title = Meta(0)\nMeta.TrackID = Meta(16)\nMeta.TrackNumber = Meta(5)\nMeta.TrackTotal = Meta(17)\nMeta.URL = Meta(10)\n\n\nclass NavigateMode(_Enum):\n    \"\"\"Navigation mode.\n\n    Defined symbols:\n      * ``vlc.NavigateMode.activate``\n      * ``vlc.NavigateMode.up``\n      * ``vlc.NavigateMode.down``\n      * ``vlc.NavigateMode.left``\n      * ``vlc.NavigateMode.right``\n      * ``vlc.NavigateMode.popup``\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"activate\",\n        1: \"up\",\n        2: \"down\",\n        3: \"left\",\n        4: \"right\",\n        5: \"popup\",\n    }\n\n\nNavigateMode.activate = NavigateMode(0)\nNavigateMode.down = NavigateMode(2)\nNavigateMode.left = NavigateMode(3)\nNavigateMode.popup = NavigateMode(5)\nNavigateMode.right = NavigateMode(4)\nNavigateMode.up = NavigateMode(1)\n\n\nclass PlaybackMode(_Enum):\n    \"\"\"Defines playback modes for playlist.\n\n    Defined symbols:\n      * ``vlc.PlaybackMode.default``\n      * ``vlc.PlaybackMode.loop``\n      * ``vlc.PlaybackMode.repeat``\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"default\",\n        1: \"loop\",\n        2: \"repeat\",\n    }\n\n\nPlaybackMode.default = PlaybackMode(0)\nPlaybackMode.loop = PlaybackMode(1)\nPlaybackMode.repeat = PlaybackMode(2)\n\n\nclass Position(_Enum):\n    \"\"\"Enumeration of values used to set position (e.g. of video title).\n\n    Defined symbols:\n      * ``vlc.Position.disable``\n      * ``vlc.Position.center``\n      * ``vlc.Position.left``\n      * ``vlc.Position.right``\n      * ``vlc.Position.top``\n      * ``vlc.Position.top_left``\n      * ``vlc.Position.top_right``\n      * ``vlc.Position.bottom``\n      * ``vlc.Position.bottom_left``\n      * ``vlc.Position.bottom_right``\n    \"\"\"\n\n    _enum_names_ = {\n        -1: \"disable\",\n        0: \"center\",\n        1: \"left\",\n        2: \"right\",\n        3: \"top\",\n        4: \"top_left\",\n        5: \"top_right\",\n        6: \"bottom\",\n        7: \"bottom_left\",\n        8: \"bottom_right\",\n    }\n\n\nPosition.bottom = Position(6)\nPosition.bottom_left = Position(7)\nPosition.bottom_right = Position(8)\nPosition.center = Position(0)\nPosition.disable = Position(-1)\nPosition.left = Position(1)\nPosition.right = Position(2)\nPosition.top = Position(3)\nPosition.top_left = Position(4)\nPosition.top_right = Position(5)\n\n\nclass State(_Enum):\n    \"\"\"Note the order of :class:`State` enum must match exactly the order of\n    See mediacontrol_PlayerStatus, See input_state_e enums,\n    and VideoLAN.LibVLC.State (at bindings/cil/src/media.cs).\n\n    Expected states by web plugins are:\n    IDLE/CLOSE=0, OPENING=1, PLAYING=3, PAUSED=4,\n    STOPPING=5, ENDED=6, ERROR=7.\n\n    Defined symbols:\n      * ``vlc.State.NothingSpecial``\n      * ``vlc.State.Opening``\n      * ``vlc.State.Buffering``\n      * ``vlc.State.Playing``\n      * ``vlc.State.Paused``\n      * ``vlc.State.Stopped``\n      * ``vlc.State.Ended``\n      * ``vlc.State.Error``\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"NothingSpecial\",\n        1: \"Opening\",\n        2: \"Buffering\",\n        3: \"Playing\",\n        4: \"Paused\",\n        5: \"Stopped\",\n        6: \"Ended\",\n        7: \"Error\",\n    }\n\n\nState.Buffering = State(2)\nState.Ended = State(6)\nState.Error = State(7)\nState.NothingSpecial = State(0)\nState.Opening = State(1)\nState.Paused = State(4)\nState.Playing = State(3)\nState.Stopped = State(5)\n\n\nclass TeletextKey(_Enum):\n    \"\"\"Enumeration of teletext keys than can be passed via\n    :func:`libvlc_video_set_teletext`.\n\n    Defined symbols:\n      * ``vlc.TeletextKey.red``\n      * ``vlc.TeletextKey.green``\n      * ``vlc.TeletextKey.yellow``\n      * ``vlc.TeletextKey.blue``\n      * ``vlc.TeletextKey.index``\n    \"\"\"\n\n    _enum_names_ = {\n        7471104: \"red\",\n        6750208: \"green\",\n        7929856: \"yellow\",\n        6422528: \"blue\",\n        6881280: \"index\",\n    }\n\n\nTeletextKey.blue = TeletextKey(6422528)\nTeletextKey.green = TeletextKey(6750208)\nTeletextKey.index = TeletextKey(6881280)\nTeletextKey.red = TeletextKey(7471104)\nTeletextKey.yellow = TeletextKey(7929856)\n\n\nclass TrackType(_Enum):\n    \"\"\"\n\n    Defined symbols:\n      * ``vlc.TrackType.unknown``\n      * ``vlc.TrackType.audio``\n      * ``vlc.TrackType.video``\n      * ``vlc.TrackType.ext``\n    \"\"\"\n\n    _enum_names_ = {\n        -1: \"unknown\",\n        0: \"audio\",\n        1: \"video\",\n        2: \"ext\",\n    }\n\n\nTrackType.audio = TrackType(0)\nTrackType.ext = TrackType(2)\nTrackType.unknown = TrackType(-1)\nTrackType.video = TrackType(1)\n\n\nclass VideoAdjustOption(_Enum):\n    \"\"\"option values for libvlc_video_get,set_adjust_int,float,bool.\n\n    Defined symbols:\n      * ``vlc.VideoAdjustOption.Enable``\n      * ``vlc.VideoAdjustOption.Contrast``\n      * ``vlc.VideoAdjustOption.Brightness``\n      * ``vlc.VideoAdjustOption.Hue``\n      * ``vlc.VideoAdjustOption.Saturation``\n      * ``vlc.VideoAdjustOption.Gamma``\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"Enable\",\n        1: \"Contrast\",\n        2: \"Brightness\",\n        3: \"Hue\",\n        4: \"Saturation\",\n        5: \"Gamma\",\n    }\n\n\nVideoAdjustOption.Brightness = VideoAdjustOption(2)\nVideoAdjustOption.Contrast = VideoAdjustOption(1)\nVideoAdjustOption.Enable = VideoAdjustOption(0)\nVideoAdjustOption.Gamma = VideoAdjustOption(5)\nVideoAdjustOption.Hue = VideoAdjustOption(3)\nVideoAdjustOption.Saturation = VideoAdjustOption(4)\n\n\nclass VideoLogoOption(_Enum):\n    \"\"\"option values for libvlc_video_get,set_logo_int,string.\n\n    Defined symbols:\n      * ``vlc.VideoLogoOption.logo_enable``\n      * ``vlc.VideoLogoOption.logo_file`` < string argument, \"file,d,t;file,d,t;...\"\n      * ``vlc.VideoLogoOption.logo_x`` < string argument, \"file,d,t;file,d,t;...\"\n      * ``vlc.VideoLogoOption.logo_y``\n      * ``vlc.VideoLogoOption.logo_delay``\n      * ``vlc.VideoLogoOption.logo_repeat``\n      * ``vlc.VideoLogoOption.logo_opacity``\n      * ``vlc.VideoLogoOption.logo_position``\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"logo_enable\",\n        1: \"logo_file\",\n        2: \"logo_x\",\n        3: \"logo_y\",\n        4: \"logo_delay\",\n        5: \"logo_repeat\",\n        6: \"logo_opacity\",\n        7: \"logo_position\",\n    }\n\n\nVideoLogoOption.logo_delay = VideoLogoOption(4)\nVideoLogoOption.logo_enable = VideoLogoOption(0)\nVideoLogoOption.logo_file = VideoLogoOption(1)\nVideoLogoOption.logo_opacity = VideoLogoOption(6)\nVideoLogoOption.logo_position = VideoLogoOption(7)\nVideoLogoOption.logo_repeat = VideoLogoOption(5)\nVideoLogoOption.logo_x = VideoLogoOption(2)\nVideoLogoOption.logo_y = VideoLogoOption(3)\n\n\nclass VideoMarqueeOption(_Enum):\n    \"\"\"Marq options definition.\n\n    Defined symbols:\n      * ``vlc.VideoMarqueeOption.Enable``\n      * ``vlc.VideoMarqueeOption.Text`` string argument\n      * ``vlc.VideoMarqueeOption.Color`` string argument\n      * ``vlc.VideoMarqueeOption.Opacity``\n      * ``vlc.VideoMarqueeOption.Position``\n      * ``vlc.VideoMarqueeOption.Refresh``\n      * ``vlc.VideoMarqueeOption.Size``\n      * ``vlc.VideoMarqueeOption.Timeout``\n      * ``vlc.VideoMarqueeOption.X``\n      * ``vlc.VideoMarqueeOption.Y``\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"Enable\",\n        1: \"Text\",\n        2: \"Color\",\n        3: \"Opacity\",\n        4: \"Position\",\n        5: \"Refresh\",\n        6: \"Size\",\n        7: \"Timeout\",\n        8: \"X\",\n        9: \"Y\",\n    }\n\n\nVideoMarqueeOption.Color = VideoMarqueeOption(2)\nVideoMarqueeOption.Enable = VideoMarqueeOption(0)\nVideoMarqueeOption.Opacity = VideoMarqueeOption(3)\nVideoMarqueeOption.Position = VideoMarqueeOption(4)\nVideoMarqueeOption.Refresh = VideoMarqueeOption(5)\nVideoMarqueeOption.Size = VideoMarqueeOption(6)\nVideoMarqueeOption.Text = VideoMarqueeOption(1)\nVideoMarqueeOption.Timeout = VideoMarqueeOption(7)\nVideoMarqueeOption.X = VideoMarqueeOption(8)\nVideoMarqueeOption.Y = VideoMarqueeOption(9)\n\n\nclass VideoOrient(_Enum):\n    \"\"\"\n\n    Defined symbols:\n      * ``vlc.VideoOrient.top_left`` < Normal. Top line represents top, left column left.\n      * ``vlc.VideoOrient.top_right`` < Flipped horizontally\n      * ``vlc.VideoOrient.bottom_left`` < Flipped vertically\n      * ``vlc.VideoOrient.bottom_right`` < Rotated 180 degrees\n      * ``vlc.VideoOrient.left_top`` < Transposed\n      * ``vlc.VideoOrient.left_bottom`` < Rotated 90 degrees clockwise (or 270 anti-clockwise)\n      * ``vlc.VideoOrient.right_top`` < Rotated 90 degrees anti-clockwise\n      * ``vlc.VideoOrient.right_bottom`` < Anti-transposed\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"top_left\",\n        1: \"top_right\",\n        2: \"bottom_left\",\n        3: \"bottom_right\",\n        4: \"left_top\",\n        5: \"left_bottom\",\n        6: \"right_top\",\n        7: \"right_bottom\",\n    }\n\n\nVideoOrient.bottom_left = VideoOrient(2)\nVideoOrient.bottom_right = VideoOrient(3)\nVideoOrient.left_bottom = VideoOrient(5)\nVideoOrient.left_top = VideoOrient(4)\nVideoOrient.right_bottom = VideoOrient(7)\nVideoOrient.right_top = VideoOrient(6)\nVideoOrient.top_left = VideoOrient(0)\nVideoOrient.top_right = VideoOrient(1)\n\n\nclass VideoProjection(_Enum):\n    \"\"\"\n\n    Defined symbols:\n      * ``vlc.VideoProjection.rectangular``\n      * ``vlc.VideoProjection.equirectangular`` < 360 spherical\n      * ``vlc.VideoProjection.cubemap_layout_standard`` < 360 spherical\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"rectangular\",\n        1: \"equirectangular\",\n        0x100: \"cubemap_layout_standard\",\n    }\n\n\nVideoProjection.cubemap_layout_standard = VideoProjection(0x100)\nVideoProjection.equirectangular = VideoProjection(1)\nVideoProjection.rectangular = VideoProjection(0)\n\n# End of generated enum types #\n\n\n# Generated structs #\nclass ModuleDescription(_Cstruct):\n    \"\"\"Description of a module.\"\"\"\n\n    pass\n\n\nModuleDescription._fields_ = (\n    (\"name\", ctypes.c_char_p),\n    (\"shortname\", ctypes.c_char_p),\n    (\"longname\", ctypes.c_char_p),\n    (\"help\", ctypes.c_char_p),\n    (\"next\", ctypes.POINTER(ModuleDescription)),\n)\n\n\nclass RdDescription(_Cstruct):\n    \"\"\"Renderer discoverer description\n\n    See :func:`libvlc_renderer_discoverer_list_get`.\n    \"\"\"\n\n    pass\n\n\nRdDescription._fields_ = (\n    (\"name\", ctypes.c_char_p),\n    (\"longname\", ctypes.c_char_p),\n)\n\n\nclass MediaStats(_Cstruct):\n    pass\n\n\nMediaStats._fields_ = (\n    (\"read_bytes\", ctypes.c_int),\n    (\"input_bitrate\", ctypes.c_float),\n    (\"demux_read_bytes\", ctypes.c_int),\n    (\"demux_bitrate\", ctypes.c_float),\n    (\"demux_corrupted\", ctypes.c_int),\n    (\"demux_discontinuity\", ctypes.c_int),\n    (\"decoded_video\", ctypes.c_int),\n    (\"decoded_audio\", ctypes.c_int),\n    (\"displayed_pictures\", ctypes.c_int),\n    (\"lost_pictures\", ctypes.c_int),\n    (\"played_abuffers\", ctypes.c_int),\n    (\"lost_abuffers\", ctypes.c_int),\n    (\"sent_packets\", ctypes.c_int),\n    (\"sent_bytes\", ctypes.c_int),\n    (\"send_bitrate\", ctypes.c_float),\n)\n\n\nclass MediaTrackInfo(_Cstruct):\n    class U(ctypes.Union):\n        class Audio(_Cstruct):\n            pass\n\n        Audio._fields_ = (\n            (\"channels\", ctypes.c_uint),\n            (\"rate\", ctypes.c_uint),\n        )\n\n        class Video(_Cstruct):\n            pass\n\n        Video._fields_ = (\n            (\"height\", ctypes.c_uint),\n            (\"width\", ctypes.c_uint),\n        )\n\n        pass\n\n    U._fields_ = (\n        (\"audio\", U.Audio),\n        (\"video\", U.Video),\n    )\n\n    pass\n\n\nMediaTrackInfo._fields_ = (\n    (\"codec\", ctypes.c_uint32),\n    (\"id\", ctypes.c_int),\n    (\"type\", TrackType),\n    (\"profile\", ctypes.c_int),\n    (\"level\", ctypes.c_int),\n    (\"u\", MediaTrackInfo.U),\n)\n\n\nclass AudioTrack(_Cstruct):\n    pass\n\n\nAudioTrack._fields_ = (\n    (\"channels\", ctypes.c_uint),\n    (\"rate\", ctypes.c_uint),\n)\n\n\nclass VideoViewpoint(_Cstruct):\n    \"\"\"Viewpoint\n\n    .. warning:: allocate using :func:`libvlc_video_new_viewpoint`.\n    \"\"\"\n\n    pass\n\n\nVideoViewpoint._fields_ = (\n    (\"yaw\", ctypes.c_float),\n    (\"pitch\", ctypes.c_float),\n    (\"roll\", ctypes.c_float),\n    (\"field_of_view\", ctypes.c_float),\n)\n\n\nclass VideoTrack(_Cstruct):\n    pass\n\n\nVideoTrack._fields_ = (\n    (\"height\", ctypes.c_uint),\n    (\"width\", ctypes.c_uint),\n    (\"sar_num\", ctypes.c_uint),\n    (\"sar_den\", ctypes.c_uint),\n    (\"frame_rate_num\", ctypes.c_uint),\n    (\"frame_rate_den\", ctypes.c_uint),\n    (\"orientation\", VideoOrient),\n    (\"projection\", VideoProjection),\n    (\"pose\", VideoViewpoint),\n)\n\n\nclass SubtitleTrack(_Cstruct):\n    pass\n\n\nSubtitleTrack._fields_ = ((\"encoding\", ctypes.c_char_p),)\n\n\nclass MediaTrack(_Cstruct):\n    pass\n\n\nMediaTrack._fields_ = (\n    (\"codec\", ctypes.c_uint32),\n    (\"original_fourcc\", ctypes.c_uint32),\n    (\"id\", ctypes.c_int),\n    (\"type\", TrackType),\n    (\"profile\", ctypes.c_int),\n    (\"level\", ctypes.c_int),\n    (\"audio\", ctypes.POINTER(AudioTrack)),\n    (\"video\", ctypes.POINTER(VideoTrack)),\n    (\"subtitle\", ctypes.POINTER(SubtitleTrack)),\n    (\"bitrate\", ctypes.c_uint),\n    (\"language\", ctypes.c_char_p),\n    (\"description\", ctypes.c_char_p),\n)\n\n\nclass MediaSlave(_Cstruct):\n    \"\"\"A slave of a :class:`Media`\n    See :func:`libvlc_media_slaves_get`.\n    \"\"\"\n\n    pass\n\n\nMediaSlave._fields_ = (\n    (\"uri\", ctypes.c_char_p),\n    (\"type\", MediaSlaveType),\n    (\"priority\", ctypes.c_uint),\n)\n\n\nclass TrackDescription(_Cstruct):\n    \"\"\"Description for video, audio tracks and subtitles. It contains\n    id, name (description string) and pointer to next record.\n    \"\"\"\n\n    pass\n\n\nTrackDescription._fields_ = (\n    (\"id\", ctypes.c_int),\n    (\"name\", ctypes.c_char_p),\n    (\"next\", ctypes.POINTER(TrackDescription)),\n)\n\n\nclass TitleDescription(_Cstruct):\n    pass\n\n\nTitleDescription._fields_ = (\n    (\"duration\", ctypes.c_int64),\n    (\"name\", ctypes.c_char_p),\n    (\"flags\", ctypes.c_uint),\n)\n\n\nclass ChapterDescription(_Cstruct):\n    \"\"\"Description for chapters.\"\"\"\n\n    pass\n\n\nChapterDescription._fields_ = (\n    (\"time_offset\", ctypes.c_int64),\n    (\"duration\", ctypes.c_int64),\n    (\"name\", ctypes.c_char_p),\n)\n\n\nclass AudioOutput(_Cstruct):\n    \"\"\"Description for audio output. It contains\n    name, description and pointer to next record.\n    \"\"\"\n\n    pass\n\n\nAudioOutput._fields_ = (\n    (\"name\", ctypes.c_char_p),\n    (\"description\", ctypes.c_char_p),\n    (\"next\", ctypes.POINTER(AudioOutput)),\n)\n\n\nclass AudioOutputDevice(_Cstruct):\n    \"\"\"Description for audio output device.\"\"\"\n\n    pass\n\n\nAudioOutputDevice._fields_ = (\n    (\"next\", ctypes.POINTER(AudioOutputDevice)),\n    (\"device\", ctypes.c_char_p),\n    (\"description\", ctypes.c_char_p),\n)\n\n\nclass MediaDiscovererDescription(_Cstruct):\n    \"\"\"Media discoverer description\n    See :func:`libvlc_media_discoverer_list_get`.\n    \"\"\"\n\n    pass\n\n\nMediaDiscovererDescription._fields_ = (\n    (\"name\", ctypes.c_char_p),\n    (\"longname\", ctypes.c_char_p),\n    (\"cat\", MediaDiscovererCategory),\n)\n\n\nclass Event(_Cstruct):\n    \"\"\"A LibVLC event.\"\"\"\n\n    class U(ctypes.Union):\n        \"\"\"< Object emitting the event.\"\"\"\n\n        class MediaMetaChanged(_Cstruct):\n            pass\n\n        MediaMetaChanged._fields_ = ((\"meta_type\", Meta),)\n\n        class MediaSubitemAdded(_Cstruct):\n            pass\n\n        MediaSubitemAdded._fields_ = ()\n\n        class MediaDurationChanged(_Cstruct):\n            pass\n\n        MediaDurationChanged._fields_ = ((\"new_duration\", ctypes.c_int64),)\n\n        class MediaParsedChanged(_Cstruct):\n            pass\n\n        MediaParsedChanged._fields_ = ((\"new_status\", ctypes.c_int),)\n\n        class MediaFreed(_Cstruct):\n            pass\n\n        MediaFreed._fields_ = ()\n\n        class MediaStateChanged(_Cstruct):\n            pass\n\n        MediaStateChanged._fields_ = ((\"new_state\", ctypes.c_int),)\n\n        class MediaSubitemtreeAdded(_Cstruct):\n            pass\n\n        MediaSubitemtreeAdded._fields_ = ()\n\n        class MediaPlayerBuffering(_Cstruct):\n            pass\n\n        MediaPlayerBuffering._fields_ = ((\"new_cache\", ctypes.c_float),)\n\n        class MediaPlayerChapterChanged(_Cstruct):\n            pass\n\n        MediaPlayerChapterChanged._fields_ = ((\"new_chapter\", ctypes.c_int),)\n\n        class MediaPlayerPositionChanged(_Cstruct):\n            pass\n\n        MediaPlayerPositionChanged._fields_ = ((\"new_position\", ctypes.c_float),)\n\n        class MediaPlayerTimeChanged(_Cstruct):\n            pass\n\n        MediaPlayerTimeChanged._fields_ = ((\"new_time\", ctypes.c_longlong),)\n\n        class MediaPlayerTitleChanged(_Cstruct):\n            pass\n\n        MediaPlayerTitleChanged._fields_ = ((\"new_title\", ctypes.c_int),)\n\n        class MediaPlayerSeekableChanged(_Cstruct):\n            pass\n\n        MediaPlayerSeekableChanged._fields_ = ((\"new_seekable\", ctypes.c_int),)\n\n        class MediaPlayerPausableChanged(_Cstruct):\n            pass\n\n        MediaPlayerPausableChanged._fields_ = ((\"new_pausable\", ctypes.c_int),)\n\n        class MediaPlayerScrambledChanged(_Cstruct):\n            pass\n\n        MediaPlayerScrambledChanged._fields_ = ((\"new_scrambled\", ctypes.c_int),)\n\n        class MediaPlayerVout(_Cstruct):\n            pass\n\n        MediaPlayerVout._fields_ = ((\"new_count\", ctypes.c_int),)\n\n        class MediaListItemAdded(_Cstruct):\n            pass\n\n        MediaListItemAdded._fields_ = ((\"index\", ctypes.c_int),)\n\n        class MediaListWillAddItem(_Cstruct):\n            pass\n\n        MediaListWillAddItem._fields_ = ((\"index\", ctypes.c_int),)\n\n        class MediaListItemDeleted(_Cstruct):\n            pass\n\n        MediaListItemDeleted._fields_ = ((\"index\", ctypes.c_int),)\n\n        class MediaListWillDeleteItem(_Cstruct):\n            pass\n\n        MediaListWillDeleteItem._fields_ = ((\"index\", ctypes.c_int),)\n\n        class MediaListPlayerNextItemSet(_Cstruct):\n            pass\n\n        MediaListPlayerNextItemSet._fields_ = ()\n\n        class MediaPlayerSnapshotTaken(_Cstruct):\n            pass\n\n        MediaPlayerSnapshotTaken._fields_ = ((\"filename\", ctypes.c_char_p),)\n\n        class MediaPlayerLengthChanged(_Cstruct):\n            pass\n\n        MediaPlayerLengthChanged._fields_ = ((\"new_length\", ctypes.c_longlong),)\n\n        class VlmMediaEvent(_Cstruct):\n            pass\n\n        VlmMediaEvent._fields_ = (\n            (\"media_name\", ctypes.c_char_p),\n            (\"instance_name\", ctypes.c_char_p),\n        )\n\n        class MediaPlayerMediaChanged(_Cstruct):\n            pass\n\n        MediaPlayerMediaChanged._fields_ = ()\n\n        class MediaPlayerEsChanged(_Cstruct):\n            pass\n\n        MediaPlayerEsChanged._fields_ = (\n            (\"type\", TrackType),\n            (\"id\", ctypes.c_int),\n        )\n\n        class MediaPlayerAudioVolume(_Cstruct):\n            pass\n\n        MediaPlayerAudioVolume._fields_ = ((\"volume\", ctypes.c_float),)\n\n        class MediaPlayerAudioDevice(_Cstruct):\n            pass\n\n        MediaPlayerAudioDevice._fields_ = ((\"device\", ctypes.c_char_p),)\n\n        class RendererDiscovererItemAdded(_Cstruct):\n            pass\n\n        RendererDiscovererItemAdded._fields_ = ()\n\n        class RendererDiscovererItemDeleted(_Cstruct):\n            pass\n\n        RendererDiscovererItemDeleted._fields_ = ()\n\n        pass\n\n    U._fields_ = (\n        (\"media_meta_changed\", U.MediaMetaChanged),\n        (\"media_subitem_added\", U.MediaSubitemAdded),\n        (\"media_duration_changed\", U.MediaDurationChanged),\n        (\"media_parsed_changed\", U.MediaParsedChanged),\n        (\"media_freed\", U.MediaFreed),\n        (\"media_state_changed\", U.MediaStateChanged),\n        (\"media_subitemtree_added\", U.MediaSubitemtreeAdded),\n        (\"media_player_buffering\", U.MediaPlayerBuffering),\n        (\"media_player_chapter_changed\", U.MediaPlayerChapterChanged),\n        (\"media_player_position_changed\", U.MediaPlayerPositionChanged),\n        (\"media_player_time_changed\", U.MediaPlayerTimeChanged),\n        (\"media_player_title_changed\", U.MediaPlayerTitleChanged),\n        (\"media_player_seekable_changed\", U.MediaPlayerSeekableChanged),\n        (\"media_player_pausable_changed\", U.MediaPlayerPausableChanged),\n        (\"media_player_scrambled_changed\", U.MediaPlayerScrambledChanged),\n        (\"media_player_vout\", U.MediaPlayerVout),\n        (\"media_list_item_added\", U.MediaListItemAdded),\n        (\"media_list_will_add_item\", U.MediaListWillAddItem),\n        (\"media_list_item_deleted\", U.MediaListItemDeleted),\n        (\"media_list_will_delete_item\", U.MediaListWillDeleteItem),\n        (\"media_list_player_next_item_set\", U.MediaListPlayerNextItemSet),\n        (\"media_player_snapshot_taken\", U.MediaPlayerSnapshotTaken),\n        (\"media_player_length_changed\", U.MediaPlayerLengthChanged),\n        (\"vlm_media_event\", U.VlmMediaEvent),\n        (\"media_player_media_changed\", U.MediaPlayerMediaChanged),\n        (\"media_player_es_changed\", U.MediaPlayerEsChanged),\n        (\"media_player_audio_volume\", U.MediaPlayerAudioVolume),\n        (\"media_player_audio_device\", U.MediaPlayerAudioDevice),\n        (\"renderer_discoverer_item_added\", U.RendererDiscovererItemAdded),\n        (\"renderer_discoverer_item_deleted\", U.RendererDiscovererItemDeleted),\n    )\n\n    pass\n\n\nclass EventUnion(ctypes.Union):\n    \"\"\"A wrapper around the nested union :class:`Event.U` for backard compatibility.\"\"\"\n\n    _fields_ = [\n        (\"meta_type\", ctypes.c_uint),\n        (\"new_child\", ctypes.c_uint),\n        (\"new_duration\", ctypes.c_longlong),\n        (\"new_status\", ctypes.c_int),\n        (\"media\", ctypes.c_void_p),\n        (\"new_state\", ctypes.c_uint),\n        # FIXME: Media instance\n        (\"new_cache\", ctypes.c_float),\n        (\"new_position\", ctypes.c_float),\n        (\"new_time\", ctypes.c_longlong),\n        (\"new_title\", ctypes.c_int),\n        (\"new_seekable\", ctypes.c_longlong),\n        (\"new_pausable\", ctypes.c_longlong),\n        (\"new_scrambled\", ctypes.c_longlong),\n        (\"new_count\", ctypes.c_longlong),\n        # FIXME: Skipped MediaList and MediaListView...\n        (\"filename\", ctypes.c_char_p),\n        (\"new_length\", ctypes.c_longlong),\n    ]\n\n\nEvent._fields_ = (\n    (\"type\", EventType),\n    (\"obj\", ctypes.c_void_p),\n    (\"u\", EventUnion),\n)\n\n\nclass DialogCbs(_Cstruct):\n    \"\"\"Dialog callbacks to be implemented.\"\"\"\n\n    PfDisplayError = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p\n    )\n    PfDisplayError.__doc__ = \"\"\"Called when an error message needs to be displayed\n\n:param p_data: opaque pointer for the callback.\n:param psz_title: title of the dialog.\n:param psz_text: text of the dialog.\"\"\"\n\n    PfDisplayLogin = ctypes.CFUNCTYPE(\n        None,\n        ctypes.c_void_p,\n        ctypes.c_void_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_bool,\n    )\n    PfDisplayLogin.__doc__ = \"\"\"Called when a login dialog needs to be displayed\n\nYou can interact with this dialog by calling :func:`libvlc_dialog_post_login`\nto post an answer or :func:`libvlc_dialog_dismiss` to cancel this dialog.\n\n.. note:: to receive this callback, :class:`DialogCbs`.pf_cancel should not be\n    None.\n\n:param p_data: opaque pointer for the callback.\n:param p_id: id used to interact with the dialog.\n:param psz_title: title of the dialog.\n:param psz_text: text of the dialog.\n:param psz_default_username: user name that should be set on the user form.\n:param b_ask_store: if true, ask the user if he wants to save the.\n    credentials.\"\"\"\n\n    PfDisplayQuestion = ctypes.CFUNCTYPE(\n        None,\n        ctypes.c_void_p,\n        ctypes.c_void_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        DialogQuestionType,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    PfDisplayQuestion.__doc__ = \"\"\"Called when a question dialog needs to be displayed\n\nYou can interact with this dialog by calling :func:`libvlc_dialog_post_action`\nto post an answer or :func:`libvlc_dialog_dismiss` to cancel this dialog.\n\n.. note:: to receive this callback, :class:`DialogCbs`.pf_cancel should not be\n    None.\n\n:param p_data: opaque pointer for the callback.\n:param p_id: id used to interact with the dialog.\n:param psz_title: title of the dialog.\n:param psz_text: text of the dialog.\n:param i_type: question type (or severity) of the dialog.\n:param psz_cancel: text of the cancel button.\n:param psz_action1: text of the first button, if None, don't display this.\n    button.\n:param psz_action2: text of the second button, if None, don't display.\n    this button.\"\"\"\n\n    PfDisplayProgress = ctypes.CFUNCTYPE(\n        None,\n        ctypes.c_void_p,\n        ctypes.c_void_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_bool,\n        ctypes.c_float,\n        ctypes.c_char_p,\n    )\n    PfDisplayProgress.__doc__ = \"\"\"Called when a progress dialog needs to be displayed\n\nIf cancellable (*psz_cancel* != None), you can cancel this dialog by\ncalling :func:`libvlc_dialog_dismiss`\n\n.. note:: to receive this callback, :class:`DialogCbs`.pf_cancel and\n    :class:`DialogCbs`.pf_update_progress should not be None.\n\n:param p_data: opaque pointer for the callback.\n:param p_id: id used to interact with the dialog.\n:param psz_title: title of the dialog.\n:param psz_text: text of the dialog.\n:param b_indeterminate: true if the progress dialog is indeterminate.\n:param f_position: initial position of the progress bar (between 0.0 and.\n    1.0).\n:param psz_cancel: text of the cancel button, if None the dialog is not.\n    cancellable.\"\"\"\n\n    PfCancel = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p)\n    PfCancel.__doc__ = \"\"\"Called when a displayed dialog needs to be cancelled\n\nThe implementation must call :func:`libvlc_dialog_dismiss` to really release\nthe dialog.\n\n:param p_data: opaque pointer for the callback.\n:param p_id: id of the dialog.\"\"\"\n\n    PfUpdateProgress = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_float, ctypes.c_char_p\n    )\n    PfUpdateProgress.__doc__ = \"\"\"Called when a progress dialog needs to be updated\n\n:param p_data: opaque pointer for the callback.\n:param p_id: id of the dialog.\n:param f_position: osition of the progress bar (between 0.0 and 1.0).\n:param psz_text: new text of the progress dialog.\"\"\"\n\n    pass\n\n\nDialogCbs._fields_ = (\n    (\"pf_display_error\", DialogCbs.PfDisplayError),\n    (\"pf_display_login\", DialogCbs.PfDisplayLogin),\n    (\"pf_display_question\", DialogCbs.PfDisplayQuestion),\n    (\"pf_display_progress\", DialogCbs.PfDisplayProgress),\n    (\"pf_cancel\", DialogCbs.PfCancel),\n    (\"pf_update_progress\", DialogCbs.PfUpdateProgress),\n)\n\n\nclass LogMessage(_Cstruct):\n    pass\n\n\nLogMessage._fields_ = (\n    (\"severity\", ctypes.c_int),\n    (\"type\", ctypes.c_char_p),\n    (\"name\", ctypes.c_char_p),\n    (\"header\", ctypes.c_char_p),\n    (\"message\", ctypes.c_char_p),\n)\n\n# End of generated structs #\n\n\n# Generated callback definitions #\nclass AudioCleanupCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio playback cleanup.\n\n    This is called when the media player no longer needs an audio output.\n\n    :param opaque: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    \"\"\"\n\n    pass\n\n\nclass AudioDrainCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio buffer drain.\n\n    LibVLC may invoke this callback when the decoded audio track is ending.\n    There will be no further decoded samples for the track, but playback should\n    nevertheless continue until all already pending buffers are rendered.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    \"\"\"\n\n    pass\n\n\nclass AudioFlushCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio buffer flush.\n\n    LibVLC invokes this callback if it needs to discard all pending buffers and\n    stop playback as soon as possible. This typically occurs when the media is\n    stopped.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    \"\"\"\n\n    pass\n\n\nclass AudioPauseCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio pause.\n\n    LibVLC invokes this callback to pause audio playback.\n\n    .. note:: The pause callback is never called if the audio is already paused.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    :param pts: time stamp of the pause request (should be elapsed already).\n    \"\"\"\n\n    pass\n\n\nclass AudioPlayCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio playback.\n\n    The LibVLC media player decodes and post-processes the audio signal\n    asynchronously (in an internal thread). Whenever audio *samples* are ready\n    to be queued to the output, this callback is invoked.\n\n    The number of *samples* provided per invocation may depend on the file format,\n    the audio coding algorithm, the decoder plug-in, the post-processing\n    filters and timing. Application must not assume a certain number of *samples*.\n\n    The exact format of audio *samples* is determined by :func:`libvlc_audio_set_format`\n    or :func:`libvlc_audio_set_format_callbacks` as is the channels layout.\n\n    Note that the number of *samples* is per channel. For instance, if the audio\n    track sampling rate is 48000 Hz, then 1200 *samples* represent 25 milliseconds\n    of audio signal - regardless of the number of audio channels.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    :param samples: pointer to a table of audio samples to play back [IN].\n    :param count: number of audio samples to play back.\n    :param pts: expected play time stamp (see libvlc_delay).\n    \"\"\"\n\n    pass\n\n\nclass AudioResumeCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio resumption.\n\n    LibVLC invokes this callback to resume audio playback after it was\n    previously paused.\n\n    .. note:: The resume callback is never called if the audio is not paused.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    :param pts: time stamp of the resumption request (should be elapsed already).\n    \"\"\"\n\n    pass\n\n\nclass AudioSetVolumeCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio *volume* change.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    :param volume: software volume (1. = nominal, 0. = mute).\n    :param mute: muted flag.\n    \"\"\"\n\n    pass\n\n\nclass AudioSetupCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to setup the audio playback.\n\n    This is called when the media player needs to create a new audio output.\n\n    :param opaque: pointer to the data pointer passed to.\n        :func:`libvlc_audio_set_callbacks` [IN/OUT].\n    :param format: 4 bytes sample format [IN/OUT].\n    :param rate: sample rate [IN/OUT].\n    :param channels: channels count [IN/OUT].\n\n    :return: 0 on success, anything else to skip audio playback.\n    \"\"\"\n\n    pass\n\n\nclass Callback(ctypes.c_void_p):\n    \"\"\"Callback function notification.\n\n    :param p_event: the event triggering the callback.\n    \"\"\"\n\n    pass\n\n\nclass LogCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for LibVLC log message handler.\n\n\n    .. note:: Log message handlers **must** be thread-safe.\n    .. warning:: The message context pointer, the format string parameters and the\n        variable arguments are only valid until the callback returns.\n\n    :param data: data pointer as given to :func:`libvlc_log_set`.\n    :param level: message level (libvlc_log_level).\n    :param ctx: message context (meta-information about the message).\n    :param fmt: printf() format string (as defined by ISO C11).\n    :param args: variable argument list for the format.\n    \"\"\"\n\n    pass\n\n\nclass MediaCloseCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to close a custom bitstream input media.\n\n    :param opaque: private pointer as set by the :class:`MediaOpenCb`.\n        callback.\n    \"\"\"\n\n    pass\n\n\nclass MediaOpenCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to open a custom bitstream input media.\n\n    The same media item can be opened multiple times. Each time, this callback\n    is invoked. It should allocate and initialize any instance-specific\n    resources, then store them in **datap*. The instance resources can be freed\n    in the :class:`MediaCloseCb` callback.\n\n    .. note:: For convenience, **datap* is initially None and **sizep* is initially 0.\n\n    :param opaque: private pointer as passed to :func:`libvlc_media_new_callbacks`.\n    :param datap: storage space for a private data pointer [OUT].\n    :param sizep: byte length of the bitstream or UINT64_MAX if unknown [OUT].\n\n    :return: 0 on success, non-zero on error. In case of failure, the other.\n        callbacks will not be invoked and any value stored in **datap* and **sizep* is.\n        discarded.\n    \"\"\"\n\n    pass\n\n\nclass MediaReadCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to read data from a custom bitstream input media.\n\n    .. note:: If no data is immediately available, then the callback should sleep.\n    .. warning:: The application is responsible for avoiding deadlock situations.\n        In particular, the callback should return an error if playback is stopped;\n        if it does not return, then :func:`libvlc_media_player_stop` will never return.\n\n    :param opaque: private pointer as set by the :class:`MediaOpenCb`.\n        callback.\n    :param buf: start address of the buffer to read data into.\n    :param len: bytes length of the buffer.\n\n    :return: strictly positive number of bytes read, 0 on end-of-stream,\n        or -1 on non-recoverable error.\n    \"\"\"\n\n    pass\n\n\nclass MediaSeekCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to seek a custom bitstream input media.\n\n    :param opaque: private pointer as set by the :class:`MediaOpenCb`.\n        callback.\n    :param offset: absolute byte offset to seek to.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n\n    pass\n\n\nclass VideoCleanupCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to configure picture buffers format.\n\n    :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks`.\n        (and possibly modified by libvlc_video_format_cb) [IN].\n    \"\"\"\n\n    pass\n\n\nclass VideoDisplayCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to display a *picture*.\n\n    When the video frame needs to be shown, as determined by the media playback\n    clock, the display callback is invoked.\n\n    :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n    :param picture: private pointer returned from the :class:`VideoLockCb`.\n        callback [IN].\n    \"\"\"\n\n    pass\n\n\nclass VideoFormatCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to configure picture buffers format.\n    This callback gets the format of the video as output by the video decoder\n    and the chain of video filters (if any). It can opt to change any parameter\n    as it needs. In that case, LibVLC will attempt to convert the video format\n    (rescaling and *chroma* conversion) but these operations can be CPU intensive.\n\n    .. note::\n        For each pixels plane, the scanline pitch must be bigger than or equal to\n        the number of bytes per pixel multiplied by the pixel *width*.\n        Similarly, the number of scanlines must be bigger than of equal to\n        the pixel *height*.\n        Furthermore, we recommend that *pitches* and *lines* be multiple of 32\n        to not break assumptions that might be held by optimized code\n        in the video decoders, video filters and/or video converters.\n\n    :param opaque: pointer to the private pointer passed to.\n        :func:`libvlc_video_set_callbacks` [IN/OUT].\n    :param chroma: pointer to the 4 bytes video format identifier [IN/OUT].\n    :param width: pointer to the pixel width [IN/OUT].\n    :param height: pointer to the pixel height [IN/OUT].\n    :param pitches: table of scanline pitches in bytes for each pixel plane.\n        (the table is allocated by LibVLC) [OUT].\n    :param lines: table of scanlines count for each plane [OUT].\n\n    :return: the number of picture buffers allocated, 0 indicates failure.\n    \"\"\"\n\n    pass\n\n\nclass VideoLockCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to allocate and lock a picture buffer.\n\n    Whenever a new video frame needs to be decoded, the lock callback is\n    invoked. Depending on the video chroma, one or three pixel *planes* of\n    adequate dimensions must be returned via the second parameter. Those\n    planes must be aligned on 32-bytes boundaries.\n\n    :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n    :param planes: start address of the pixel planes (LibVLC allocates the array.\n        of void pointers, this callback must initialize the array) [OUT].\n\n    :return: a private pointer for the display and unlock callbacks to identify.\n        the picture buffers.\n    \"\"\"\n\n    pass\n\n\nclass VideoUnlockCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to unlock a *picture* buffer.\n\n    When the video frame decoding is complete, the unlock callback is invoked.\n    This callback might not be needed at all. It is only an indication that the\n    application can now read the pixel values if it needs to.\n\n    .. note:: A *picture* buffer is unlocked after the *picture* is decoded,\n        but before the *picture* is displayed.\n\n    :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n    :param picture: private pointer returned from the :class:`VideoLockCb`.\n        callback [IN].\n    :param planes: pixel planes as defined by the :class:`VideoLockCb`.\n        callback (this parameter is only for convenience) [IN].\n    \"\"\"\n\n    pass\n\n\nclass CallbackDecorators(object):\n    \"\"\"Class holding various method decorators for callback functions.\"\"\"\n\n    AudioCleanupCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p)\n    AudioCleanupCb.__doc__ = \"\"\"Callback prototype for audio playback cleanup.\n\nThis is called when the media player no longer needs an audio output.\n\n:param opaque: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\"\"\"\n\n    AudioDrainCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p)\n    AudioDrainCb.__doc__ = \"\"\"Callback prototype for audio buffer drain.\n\nLibVLC may invoke this callback when the decoded audio track is ending.\nThere will be no further decoded samples for the track, but playback should\nnevertheless continue until all already pending buffers are rendered.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\"\"\"\n\n    AudioFlushCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64)\n    AudioFlushCb.__doc__ = \"\"\"Callback prototype for audio buffer flush.\n\nLibVLC invokes this callback if it needs to discard all pending buffers and\nstop playback as soon as possible. This typically occurs when the media is\nstopped.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\"\"\"\n\n    AudioPauseCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64)\n    AudioPauseCb.__doc__ = \"\"\"Callback prototype for audio pause.\n\nLibVLC invokes this callback to pause audio playback.\n\n.. note:: The pause callback is never called if the audio is already paused.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n:param pts: time stamp of the pause request (should be elapsed already).\"\"\"\n\n    AudioPlayCb = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint, ctypes.c_int64\n    )\n    AudioPlayCb.__doc__ = \"\"\"Callback prototype for audio playback.\n\nThe LibVLC media player decodes and post-processes the audio signal\nasynchronously (in an internal thread). Whenever audio *samples* are ready\nto be queued to the output, this callback is invoked.\n\nThe number of *samples* provided per invocation may depend on the file format,\nthe audio coding algorithm, the decoder plug-in, the post-processing\nfilters and timing. Application must not assume a certain number of *samples*.\n\nThe exact format of audio *samples* is determined by :func:`libvlc_audio_set_format`\nor :func:`libvlc_audio_set_format_callbacks` as is the channels layout.\n\nNote that the number of *samples* is per channel. For instance, if the audio\ntrack sampling rate is 48000 Hz, then 1200 *samples* represent 25 milliseconds\nof audio signal - regardless of the number of audio channels.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n:param samples: pointer to a table of audio samples to play back [IN].\n:param count: number of audio samples to play back.\n:param pts: expected play time stamp (see libvlc_delay).\"\"\"\n\n    AudioResumeCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64)\n    AudioResumeCb.__doc__ = \"\"\"Callback prototype for audio resumption.\n\nLibVLC invokes this callback to resume audio playback after it was\npreviously paused.\n\n.. note:: The resume callback is never called if the audio is not paused.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n:param pts: time stamp of the resumption request (should be elapsed already).\"\"\"\n\n    AudioSetVolumeCb = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_float, ctypes.c_bool\n    )\n    AudioSetVolumeCb.__doc__ = \"\"\"Callback prototype for audio *volume* change.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n:param volume: software volume (1. = nominal, 0. = mute).\n:param mute: muted flag.\"\"\"\n\n    AudioSetupCb = ctypes.CFUNCTYPE(\n        ctypes.c_int,\n        ctypes.POINTER(ctypes.c_void_p),\n        ctypes.c_char_p,\n        ctypes.POINTER(ctypes.c_uint),\n        ctypes.POINTER(ctypes.c_uint),\n    )\n    AudioSetupCb.__doc__ = \"\"\"Callback prototype to setup the audio playback.\n\nThis is called when the media player needs to create a new audio output.\n\n:param opaque: pointer to the data pointer passed to.\n    :func:`libvlc_audio_set_callbacks` [IN/OUT].\n:param format: 4 bytes sample format [IN/OUT].\n:param rate: sample rate [IN/OUT].\n:param channels: channels count [IN/OUT].\n\n:return: 0 on success, anything else to skip audio playback.\"\"\"\n\n    Callback = ctypes.CFUNCTYPE(None, ctypes.POINTER(Event), ctypes.c_void_p)\n    Callback.__doc__ = \"\"\"Callback function notification.\n\n:param p_event: the event triggering the callback.\"\"\"\n\n    LogCb = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_int, Log_ptr, ctypes.c_char_p, ctypes.c_void_p\n    )\n    LogCb.__doc__ = \"\"\"Callback prototype for LibVLC log message handler.\n\n\n.. note:: Log message handlers **must** be thread-safe.\n.. warning:: The message context pointer, the format string parameters and the\n    variable arguments are only valid until the callback returns.\n\n:param data: data pointer as given to :func:`libvlc_log_set`.\n:param level: message level (libvlc_log_level).\n:param ctx: message context (meta-information about the message).\n:param fmt: printf() format string (as defined by ISO C11).\n:param args: variable argument list for the format.\"\"\"\n\n    MediaCloseCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p)\n    MediaCloseCb.__doc__ = \"\"\"Callback prototype to close a custom bitstream input media.\n\n:param opaque: private pointer as set by the :class:`MediaOpenCb`.\n    callback.\"\"\"\n\n    MediaOpenCb = ctypes.CFUNCTYPE(\n        ctypes.c_int,\n        ctypes.c_void_p,\n        ctypes.POINTER(ctypes.c_void_p),\n        ctypes.POINTER(ctypes.c_uint64),\n    )\n    MediaOpenCb.__doc__ = \"\"\"Callback prototype to open a custom bitstream input media.\n\nThe same media item can be opened multiple times. Each time, this callback\nis invoked. It should allocate and initialize any instance-specific\nresources, then store them in **datap*. The instance resources can be freed\nin the :class:`MediaCloseCb` callback.\n\n.. note:: For convenience, **datap* is initially None and **sizep* is initially 0.\n\n:param opaque: private pointer as passed to :func:`libvlc_media_new_callbacks`.\n:param datap: storage space for a private data pointer [OUT].\n:param sizep: byte length of the bitstream or UINT64_MAX if unknown [OUT].\n\n:return: 0 on success, non-zero on error. In case of failure, the other.\n    callbacks will not be invoked and any value stored in **datap* and **sizep* is.\n    discarded.\"\"\"\n\n    MediaReadCb = ctypes.CFUNCTYPE(\n        ctypes.c_ssize_t,\n        ctypes.c_void_p,\n        ctypes.POINTER(ctypes.c_char),\n        ctypes.c_size_t,\n    )\n    MediaReadCb.__doc__ = \"\"\"Callback prototype to read data from a custom bitstream input media.\n\n.. note:: If no data is immediately available, then the callback should sleep.\n.. warning:: The application is responsible for avoiding deadlock situations.\n    In particular, the callback should return an error if playback is stopped;\n    if it does not return, then :func:`libvlc_media_player_stop` will never return.\n\n:param opaque: private pointer as set by the :class:`MediaOpenCb`.\n    callback.\n:param buf: start address of the buffer to read data into.\n:param len: bytes length of the buffer.\n\n:return: strictly positive number of bytes read, 0 on end-of-stream,\n    or -1 on non-recoverable error.\"\"\"\n\n    MediaSeekCb = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_uint64)\n    MediaSeekCb.__doc__ = \"\"\"Callback prototype to seek a custom bitstream input media.\n\n:param opaque: private pointer as set by the :class:`MediaOpenCb`.\n    callback.\n:param offset: absolute byte offset to seek to.\n\n:return: 0 on success, -1 on error.\"\"\"\n\n    VideoCleanupCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p)\n    VideoCleanupCb.__doc__ = \"\"\"Callback prototype to configure picture buffers format.\n\n:param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks`.\n    (and possibly modified by libvlc_video_format_cb) [IN].\"\"\"\n\n    VideoDisplayCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p)\n    VideoDisplayCb.__doc__ = \"\"\"Callback prototype to display a *picture*.\n\nWhen the video frame needs to be shown, as determined by the media playback\nclock, the display callback is invoked.\n\n:param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n:param picture: private pointer returned from the :class:`VideoLockCb`.\n    callback [IN].\"\"\"\n\n    VideoFormatCb = ctypes.CFUNCTYPE(\n        ctypes.c_uint,\n        ctypes.POINTER(ctypes.c_void_p),\n        ctypes.c_char_p,\n        ctypes.POINTER(ctypes.c_uint),\n        ctypes.POINTER(ctypes.c_uint),\n        ctypes.POINTER(ctypes.c_uint),\n        ctypes.POINTER(ctypes.c_uint),\n    )\n    VideoFormatCb.__doc__ = \"\"\"Callback prototype to configure picture buffers format.\nThis callback gets the format of the video as output by the video decoder\nand the chain of video filters (if any). It can opt to change any parameter\nas it needs. In that case, LibVLC will attempt to convert the video format\n(rescaling and *chroma* conversion) but these operations can be CPU intensive.\n\n.. note::\n    For each pixels plane, the scanline pitch must be bigger than or equal to\n    the number of bytes per pixel multiplied by the pixel *width*.\n    Similarly, the number of scanlines must be bigger than of equal to\n    the pixel *height*.\n    Furthermore, we recommend that *pitches* and *lines* be multiple of 32\n    to not break assumptions that might be held by optimized code\n    in the video decoders, video filters and/or video converters.\n\n:param opaque: pointer to the private pointer passed to.\n    :func:`libvlc_video_set_callbacks` [IN/OUT].\n:param chroma: pointer to the 4 bytes video format identifier [IN/OUT].\n:param width: pointer to the pixel width [IN/OUT].\n:param height: pointer to the pixel height [IN/OUT].\n:param pitches: table of scanline pitches in bytes for each pixel plane.\n    (the table is allocated by LibVLC) [OUT].\n:param lines: table of scanlines count for each plane [OUT].\n\n:return: the number of picture buffers allocated, 0 indicates failure.\"\"\"\n\n    VideoLockCb = ctypes.CFUNCTYPE(\n        ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)\n    )\n    VideoLockCb.__doc__ = \"\"\"Callback prototype to allocate and lock a picture buffer.\n\nWhenever a new video frame needs to be decoded, the lock callback is\ninvoked. Depending on the video chroma, one or three pixel *planes* of\nadequate dimensions must be returned via the second parameter. Those\nplanes must be aligned on 32-bytes boundaries.\n\n:param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n:param planes: start address of the pixel planes (LibVLC allocates the array.\n    of void pointers, this callback must initialize the array) [OUT].\n\n:return: a private pointer for the display and unlock callbacks to identify.\n    the picture buffers.\"\"\"\n\n    VideoUnlockCb = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)\n    )\n    VideoUnlockCb.__doc__ = \"\"\"Callback prototype to unlock a *picture* buffer.\n\nWhen the video frame decoding is complete, the unlock callback is invoked.\nThis callback might not be needed at all. It is only an indication that the\napplication can now read the pixel values if it needs to.\n\n.. note:: A *picture* buffer is unlocked after the *picture* is decoded,\n    but before the *picture* is displayed.\n\n:param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n:param picture: private pointer returned from the :class:`VideoLockCb`.\n    callback [IN].\n:param planes: pixel planes as defined by the :class:`VideoLockCb`.\n    callback (this parameter is only for convenience) [IN].\"\"\"\n\n\ncb = CallbackDecorators\n# End of generated callback definitions #\n\n\n# Generated functions #\ndef libvlc_add_intf(p_instance, name):\n    \"\"\"Try to start a user interface for the libvlc instance.\n\n    :param p_instance: the instance.\n    :param name: interface name, or None for default.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_add_intf\", None) or _Cfunction(\n        \"libvlc_add_intf\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, name)\n\n\ndef libvlc_audio_equalizer_get_amp_at_index(p_equalizer, u_band):\n    \"\"\"Get the amplification value for a particular equalizer frequency band.\n\n    :param p_equalizer: valid equalizer handle, must not be None.\n    :param u_band: index, counting from zero, of the frequency band to get.\n\n    :return: amplification value (Hz); NaN if there is no such frequency band.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_get_amp_at_index\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_get_amp_at_index\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_float,\n        AudioEqualizer,\n        ctypes.c_uint,\n    )\n    return f(p_equalizer, u_band)\n\n\ndef libvlc_audio_equalizer_get_band_count():\n    \"\"\"Get the number of distinct frequency bands for an equalizer.\n\n    :return: number of frequency bands.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_get_band_count\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_get_band_count\", (), None, ctypes.c_uint\n    )\n    return f()\n\n\ndef libvlc_audio_equalizer_get_band_frequency(u_index):\n    \"\"\"Get a particular equalizer band frequency.\n\n    This value can be used, for example, to create a label for an equalizer band control\n    in a user interface.\n\n    :param u_index: index of the band, counting from zero.\n\n    :return: equalizer band frequency (Hz), or -1 if there is no such band.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_audio_equalizer_get_band_frequency\", None\n    ) or _Cfunction(\n        \"libvlc_audio_equalizer_get_band_frequency\",\n        ((1,),),\n        None,\n        ctypes.c_float,\n        ctypes.c_uint,\n    )\n    return f(u_index)\n\n\ndef libvlc_audio_equalizer_get_preamp(p_equalizer):\n    \"\"\"Get the current pre-amplification value from an equalizer.\n\n    :param p_equalizer: valid equalizer handle, must not be None.\n\n    :return: preamp value (Hz).\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_get_preamp\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_get_preamp\",\n        ((1,),),\n        None,\n        ctypes.c_float,\n        AudioEqualizer,\n    )\n    return f(p_equalizer)\n\n\ndef libvlc_audio_equalizer_get_preset_count():\n    \"\"\"Get the number of equalizer presets.\n\n    :return: number of presets.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_get_preset_count\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_get_preset_count\", (), None, ctypes.c_uint\n    )\n    return f()\n\n\ndef libvlc_audio_equalizer_get_preset_name(u_index):\n    \"\"\"Get the name of a particular equalizer preset.\n\n    This name can be used, for example, to prepare a preset label or menu in a user\n    interface.\n\n    :param u_index: index of the preset, counting from zero.\n\n    :return: preset name, or None if there is no such preset.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_get_preset_name\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_get_preset_name\",\n        ((1,),),\n        None,\n        ctypes.c_char_p,\n        ctypes.c_uint,\n    )\n    return f(u_index)\n\n\ndef libvlc_audio_equalizer_new():\n    \"\"\"Create a new default equalizer, with all frequency values zeroed.\n\n    The new equalizer can subsequently be applied to a media player by invoking\n    :func:`libvlc_media_player_set_equalizer`.\n\n    The returned handle should be freed via :func:`libvlc_audio_equalizer_release` when\n    it is no longer needed.\n\n    :return: opaque equalizer handle, or None on error.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_new\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_new\", (), class_result(AudioEqualizer), ctypes.c_void_p\n    )\n    return f()\n\n\ndef libvlc_audio_equalizer_new_from_preset(u_index):\n    \"\"\"Create a new equalizer, with initial frequency values copied from an existing\n    preset.\n\n    The new equalizer can subsequently be applied to a media player by invoking\n    :func:`libvlc_media_player_set_equalizer`.\n\n    The returned handle should be freed via :func:`libvlc_audio_equalizer_release` when\n    it is no longer needed.\n\n    :param u_index: index of the preset, counting from zero.\n\n    :return: opaque equalizer handle, or None on error.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_new_from_preset\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_new_from_preset\",\n        ((1,),),\n        class_result(AudioEqualizer),\n        ctypes.c_void_p,\n        ctypes.c_uint,\n    )\n    return f(u_index)\n\n\ndef libvlc_audio_equalizer_release(p_equalizer):\n    \"\"\"Release a previously created equalizer instance.\n\n    The equalizer was previously created by using :func:`libvlc_audio_equalizer_new` or\n    :func:`libvlc_audio_equalizer_new_from_preset`.\n\n    It is safe to invoke this method with a None *p_equalizer* parameter for no effect.\n\n    :param p_equalizer: opaque equalizer handle, or None.\n\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_release\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_release\", ((1,),), None, None, AudioEqualizer\n    )\n    return f(p_equalizer)\n\n\ndef libvlc_audio_equalizer_set_amp_at_index(p_equalizer, f_amp, u_band):\n    \"\"\"Set a new amplification value for a particular equalizer frequency band.\n\n    The new equalizer settings are subsequently applied to a media player by invoking\n    :func:`libvlc_media_player_set_equalizer`.\n\n    The supplied amplification value will be clamped to the -20.0 to +20.0 range.\n\n    :param p_equalizer: valid equalizer handle, must not be None.\n    :param f_amp: amplification value (-20.0 to 20.0 Hz).\n    :param u_band: index, counting from zero, of the frequency band to set.\n\n    :return: zero on success, -1 on error.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_set_amp_at_index\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_set_amp_at_index\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        AudioEqualizer,\n        ctypes.c_float,\n        ctypes.c_uint,\n    )\n    return f(p_equalizer, f_amp, u_band)\n\n\ndef libvlc_audio_equalizer_set_preamp(p_equalizer, f_preamp):\n    \"\"\"Set a new pre-amplification value for an equalizer.\n\n    The new equalizer settings are subsequently applied to a media player by invoking\n    :func:`libvlc_media_player_set_equalizer`.\n\n    The supplied amplification value will be clamped to the -20.0 to +20.0 range.\n\n    :param p_equalizer: valid equalizer handle, must not be None.\n    :param f_preamp: preamp value (-20.0 to 20.0 Hz).\n\n    :return: zero on success, -1 on error.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_set_preamp\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_set_preamp\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        AudioEqualizer,\n        ctypes.c_float,\n    )\n    return f(p_equalizer, f_preamp)\n\n\ndef libvlc_audio_filter_list_get(p_instance):\n    \"\"\"Returns a list of audio filters that are available.\n\n    See :class:`ModuleDescription`\n    See :func:`libvlc_module_description_list_release`.\n\n    :param p_instance: libvlc instance.\n\n    :return: a list of module descriptions. It should be freed with :func:`libvlc_module_description_list_release`.\n        In case of an error, None is returned.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_filter_list_get\", None) or _Cfunction(\n        \"libvlc_audio_filter_list_get\",\n        ((1,),),\n        None,\n        ctypes.POINTER(ModuleDescription),\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_audio_get_channel(p_mi):\n    \"\"\"Get current audio channel.\n\n    :param p_mi: media player.\n\n    :return: the audio channel See :class:`AudioOutputChannel`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_channel\", None) or _Cfunction(\n        \"libvlc_audio_get_channel\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_delay(p_mi):\n    \"\"\"Get current audio delay.\n\n    :param p_mi: media player.\n\n    :return: the audio delay (microseconds).\n    :version: LibVLC 1.1.1 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_delay\", None) or _Cfunction(\n        \"libvlc_audio_get_delay\", ((1,),), None, ctypes.c_int64, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_mute(p_mi):\n    \"\"\"Get current mute status.\n\n    :param p_mi: media player.\n\n    :return: the mute status (boolean) if defined, -1 if undefined/unapplicable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_mute\", None) or _Cfunction(\n        \"libvlc_audio_get_mute\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_track(p_mi):\n    \"\"\"Get current audio track.\n\n    :param p_mi: media player.\n\n    :return: the audio track ID or -1 if no active input.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_track\", None) or _Cfunction(\n        \"libvlc_audio_get_track\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_track_count(p_mi):\n    \"\"\"Get number of available audio tracks.\n\n    :param p_mi: media player.\n\n    :return: the number of available audio tracks (int), or -1 if unavailable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_track_count\", None) or _Cfunction(\n        \"libvlc_audio_get_track_count\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_track_description(p_mi):\n    \"\"\"Get the description of available audio tracks.\n\n    :param p_mi: media player.\n\n    :return: list with description of available audio tracks, or None.\n        It must be freed with :func:`libvlc_track_description_list_release`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_track_description\", None) or _Cfunction(\n        \"libvlc_audio_get_track_description\",\n        ((1,),),\n        None,\n        ctypes.POINTER(TrackDescription),\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_volume(p_mi):\n    \"\"\"Get current software audio volume.\n\n    :param p_mi: media player.\n\n    :return: the software volume in percents.\n        (0 = mute, 100 = nominal / 0dB).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_volume\", None) or _Cfunction(\n        \"libvlc_audio_get_volume\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_output_device_count(p_instance, psz_audio_output):\n    \"\"\"Backward compatibility stub. Do not use in new code.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_audio_output_device_list_get` instead.\n\n    :return: always 0.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_count\", None) or _Cfunction(\n        \"libvlc_audio_output_device_count\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_audio_output)\n\n\ndef libvlc_audio_output_device_enum(mp):\n    \"\"\"Gets a list of potential audio output devices,\n    See :func:`libvlc_audio_output_device_set`.\n\n    .. note:: Not all audio outputs support enumerating devices.\n        The audio output may be functional even if the list is empty (None).\n\n    .. note:: The list may not be exhaustive.\n\n    .. warning:: Some audio output devices in the list might not actually work in\n        some circumstances. By default, it is recommended to not specify any\n        explicit audio device.\n\n    :param mp: media player.\n\n    :return: A None-terminated linked list of potential audio output devices.\n        It must be freed with :func:`libvlc_audio_output_device_list_release`.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_enum\", None) or _Cfunction(\n        \"libvlc_audio_output_device_enum\",\n        ((1,),),\n        None,\n        ctypes.POINTER(AudioOutputDevice),\n        MediaPlayer,\n    )\n    return f(mp)\n\n\ndef libvlc_audio_output_device_get(mp):\n    \"\"\"Get the current audio output device identifier.\n\n    This complements :func:`libvlc_audio_output_device_set`.\n\n    .. warning:: The initial value for the current audio output device identifier\n        may not be set or may be some unknown value. A LibVLC application should\n        compare this value against the known device identifiers (e.g. those that\n        were previously retrieved by a call to :func:`libvlc_audio_output_device_enum` or\n        libvlc_audio_output_device_list_get) to find the current audio output device.\n\n    It is possible that the selected audio output device changes (an external\n    change) without a call to :func:`libvlc_audio_output_device_set`. That may make this\n    method unsuitable to use if a LibVLC application is attempting to track\n    dynamic audio device changes as they happen.\n\n    :param mp: media player.\n\n    :return: the current audio output device identifier.\n        None if no device is selected or in case of error.\n        (the result must be released with free() or libvlc_free).\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_get\", None) or _Cfunction(\n        \"libvlc_audio_output_device_get\",\n        ((1,),),\n        string_result,\n        ctypes.c_void_p,\n        MediaPlayer,\n    )\n    return f(mp)\n\n\ndef libvlc_audio_output_device_id(p_instance, psz_audio_output, i_device):\n    \"\"\"Backward compatibility stub. Do not use in new code.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_audio_output_device_list_get` instead.\n\n    :return: always None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_id\", None) or _Cfunction(\n        \"libvlc_audio_output_device_id\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        string_result,\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_audio_output, i_device)\n\n\ndef libvlc_audio_output_device_list_get(p_instance, aout):\n    \"\"\"Gets a list of audio output devices for a given audio output module,\n    See :func:`libvlc_audio_output_device_set`.\n\n    .. note:: Not all audio outputs support this. In particular, an empty (None)\n        list of devices does **not** imply that the specified audio output does\n        not work.\n\n    .. note:: The list might not be exhaustive.\n\n    .. warning:: Some audio output devices in the list might not actually work in\n        some circumstances. By default, it is recommended to not specify any\n        explicit audio device.\n\n    :param p_instance: libvlc instance.\n    :param aout: audio output name.\n        (as returned by libvlc_audio_output_list_get).\n\n    :return: A None-terminated linked list of potential audio output devices.\n        It must be freed with :func:`libvlc_audio_output_device_list_release`.\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_list_get\", None) or _Cfunction(\n        \"libvlc_audio_output_device_list_get\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.POINTER(AudioOutputDevice),\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, aout)\n\n\ndef libvlc_audio_output_device_list_release(p_list):\n    \"\"\"Frees a list of available audio output devices.\n\n    :param p_list: list with audio outputs for release.\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_list_release\", None) or _Cfunction(\n        \"libvlc_audio_output_device_list_release\",\n        ((1,),),\n        None,\n        None,\n        ctypes.POINTER(AudioOutputDevice),\n    )\n    return f(p_list)\n\n\ndef libvlc_audio_output_device_longname(p_instance, psz_output, i_device):\n    \"\"\"Backward compatibility stub. Do not use in new code.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_audio_output_device_list_get` instead.\n\n    :return: always None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_longname\", None) or _Cfunction(\n        \"libvlc_audio_output_device_longname\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        string_result,\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_output, i_device)\n\n\ndef libvlc_audio_output_device_set(mp, module, device_id):\n    \"\"\"Configures an explicit audio output device.\n\n    If the *module* paramater is None, audio output will be moved to the device\n    specified by the device identifier string immediately. This is the\n    recommended usage.\n\n    A list of adequate potential device strings can be obtained with\n    :func:`libvlc_audio_output_device_enum`.\n\n    However passing None is supported in LibVLC version 2.2.0 and later only;\n    in earlier versions, this function would have no effects when the module\n    parameter was None.\n\n    If the *module* parameter is not None, the device parameter of the\n    corresponding audio output, if it exists, will be set to the specified\n    string. Note that some audio output modules do not have such a parameter\n    (notably MMDevice and PulseAudio).\n\n    A list of adequate potential device strings can be obtained with\n    :func:`libvlc_audio_output_device_list_get`.\n\n    .. note:: This function does not select the specified audio output plugin.\n        :func:`libvlc_audio_output_set` is used for that purpose.\n\n    .. warning:: The syntax for the device parameter depends on the audio output.\n\n    Some audio output modules require further parameters (e.g. a channels map\n    in the case of ALSA).\n\n    :param mp: media player.\n    :param module: If None, current audio output module.\n        if non-None, name of audio output module.\n        (See libvlc_audio_output_t).\n    :param device_id: device identifier string.\n\n    :return: Nothing. Errors are ignored (this is a design bug).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_set\", None) or _Cfunction(\n        \"libvlc_audio_output_device_set\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(mp, module, device_id)\n\n\ndef libvlc_audio_output_get_device_type(p_mi):\n    \"\"\"Stub for backward compatibility.\n\n    :return: always -1.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_get_device_type\", None) or _Cfunction(\n        \"libvlc_audio_output_get_device_type\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_output_list_get(p_instance):\n    \"\"\"Gets the list of available audio output modules.\n\n    :param p_instance: libvlc instance.\n\n    :return: list of available audio outputs. It must be freed with.\n        See :func:`libvlc_audio_output_list_release` See :class:`AudioOutput` .\n        In case of error, None is returned.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_list_get\", None) or _Cfunction(\n        \"libvlc_audio_output_list_get\",\n        ((1,),),\n        None,\n        ctypes.POINTER(AudioOutput),\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_audio_output_list_release(p_list):\n    \"\"\"Frees the list of available audio output modules.\n\n    :param p_list: list with audio outputs for release.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_list_release\", None) or _Cfunction(\n        \"libvlc_audio_output_list_release\",\n        ((1,),),\n        None,\n        None,\n        ctypes.POINTER(AudioOutput),\n    )\n    return f(p_list)\n\n\ndef libvlc_audio_output_set(p_mi, psz_name):\n    \"\"\"Selects an audio output module.\n\n    .. note:: Any change will take be effect only after playback is stopped and\n        restarted. Audio output cannot be changed while playing.\n\n    :param p_mi: media player.\n    :param psz_name: name of audio output,\n        use psz_name of See :class:`AudioOutput`.\n\n    :return: 0 if function succeeded, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_set\", None) or _Cfunction(\n        \"libvlc_audio_output_set\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, psz_name)\n\n\ndef libvlc_audio_output_set_device_type(p_mp, device_type):\n    \"\"\"Stub for backward compatibility.\"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_set_device_type\", None) or _Cfunction(\n        \"libvlc_audio_output_set_device_type\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mp, device_type)\n\n\ndef libvlc_audio_set_callbacks(mp, play, pause, resume, flush, drain, opaque):\n    \"\"\"Sets callbacks and private data for decoded audio.\n\n    Use :func:`libvlc_audio_set_format` or :func:`libvlc_audio_set_format_callbacks`\n    to configure the decoded audio format.\n\n    .. note:: The audio callbacks override any other audio output mechanism.\n        If the callbacks are set, LibVLC will **not** output audio in any way.\n\n    :param mp: the media player.\n    :param play: callback to play audio samples (must not be None).\n    :param pause: callback to pause playback (or None to ignore).\n    :param resume: callback to resume playback (or None to ignore).\n    :param flush: callback to flush audio buffers (or None to ignore).\n    :param drain: callback to drain audio buffers (or None to ignore).\n    :param opaque: private pointer for the audio callbacks (as first parameter).\n\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_callbacks\", None) or _Cfunction(\n        \"libvlc_audio_set_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        AudioPlayCb,\n        AudioPauseCb,\n        AudioResumeCb,\n        AudioFlushCb,\n        AudioDrainCb,\n        ctypes.c_void_p,\n    )\n    return f(mp, play, pause, resume, flush, drain, opaque)\n\n\ndef libvlc_audio_set_channel(p_mi, channel):\n    \"\"\"Set current audio *channel*.\n\n    :param p_mi: media player.\n    :param channel: the audio channel, See :class:`AudioOutputChannel`.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_channel\", None) or _Cfunction(\n        \"libvlc_audio_set_channel\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, channel)\n\n\ndef libvlc_audio_set_delay(p_mi, i_delay):\n    \"\"\"Set current audio delay. The audio delay will be reset to zero each time the media changes.\n\n    :param p_mi: media player.\n    :param i_delay: the audio delay (microseconds).\n\n    :return: 0 on success, -1 on error.\n    :version: LibVLC 1.1.1 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_delay\", None) or _Cfunction(\n        \"libvlc_audio_set_delay\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int64,\n    )\n    return f(p_mi, i_delay)\n\n\ndef libvlc_audio_set_format(mp, format, rate, channels):\n    \"\"\"Sets a fixed decoded audio *format*.\n\n    This only works in combination with :func:`libvlc_audio_set_callbacks`,\n    and is mutually exclusive with :func:`libvlc_audio_set_format_callbacks`.\n\n    :param mp: the media player.\n    :param format: a four-characters string identifying the sample format.\n        (e.g. \"S16N\" or \"f32l\").\n    :param rate: sample rate (expressed in Hz).\n    :param channels: channels count.\n\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_format\", None) or _Cfunction(\n        \"libvlc_audio_set_format\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n        ctypes.c_uint,\n        ctypes.c_uint,\n    )\n    return f(mp, format, rate, channels)\n\n\ndef libvlc_audio_set_format_callbacks(mp, setup, cleanup):\n    \"\"\"Sets decoded audio format via callbacks.\n\n    This only works in combination with :func:`libvlc_audio_set_callbacks`.\n\n    :param mp: the media player.\n    :param setup: callback to select the audio format (cannot be None).\n    :param cleanup: callback to release any allocated resources (or None).\n\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_format_callbacks\", None) or _Cfunction(\n        \"libvlc_audio_set_format_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        AudioSetupCb,\n        AudioCleanupCb,\n    )\n    return f(mp, setup, cleanup)\n\n\ndef libvlc_audio_set_mute(p_mi, status):\n    \"\"\"Set mute *status*.\n\n    .. warning:: This function does not always work. If there are no active audio\n        playback stream, the mute *status* might not be available. If digital\n        pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also\n        some audio output plugins do not support muting at all.\n\n    .. note:: To force silent playback, disable all audio tracks. This is more\n        efficient and reliable than mute.\n\n    :param p_mi: media player.\n    :param status: If status is true then mute, otherwise unmute.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_mute\", None) or _Cfunction(\n        \"libvlc_audio_set_mute\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, status)\n\n\ndef libvlc_audio_set_track(p_mi, i_track):\n    \"\"\"Set current audio track.\n\n    :param p_mi: media player.\n    :param i_track: the track ID (i_id field from track description).\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_track\", None) or _Cfunction(\n        \"libvlc_audio_set_track\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_track)\n\n\ndef libvlc_audio_set_volume(p_mi, i_volume):\n    \"\"\"Set current software audio volume.\n\n    :param p_mi: media player.\n    :param i_volume: the volume in percents (0 = mute, 100 = 0dB).\n\n    :return: 0 if the volume was set, -1 if it was out of range.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_volume\", None) or _Cfunction(\n        \"libvlc_audio_set_volume\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_volume)\n\n\ndef libvlc_audio_set_volume_callback(mp, set_volume):\n    \"\"\"Set callbacks and private data for decoded audio. This only works in\n    combination with :func:`libvlc_audio_set_callbacks`.\n    Use :func:`libvlc_audio_set_format` or :func:`libvlc_audio_set_format_callbacks`\n    to configure the decoded audio format.\n\n    :param mp: the media player.\n    :param set_volume: callback to apply audio volume,\n        or None to apply volume in software.\n\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_volume_callback\", None) or _Cfunction(\n        \"libvlc_audio_set_volume_callback\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        AudioSetVolumeCb,\n    )\n    return f(mp, set_volume)\n\n\ndef libvlc_audio_toggle_mute(p_mi):\n    \"\"\"Toggle mute status.\n\n    .. warning:: Toggling mute atomically is not always possible: On some platforms,\n        other processes can mute the VLC audio playback stream asynchronously. Thus,\n        there is a small race condition where toggling will not work.\n        See also the limitations of :func:`libvlc_audio_set_mute`.\n\n    :param p_mi: media player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_toggle_mute\", None) or _Cfunction(\n        \"libvlc_audio_toggle_mute\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_chapter_descriptions_release(p_chapters, i_count):\n    \"\"\"Release a chapter description\n\n    :param p_chapters: chapter description array to release.\n    :param i_count: number of chapter descriptions to release.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_chapter_descriptions_release\", None) or _Cfunction(\n        \"libvlc_chapter_descriptions_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(ChapterDescription)),\n        ctypes.c_uint,\n    )\n    return f(p_chapters, i_count)\n\n\ndef libvlc_clearerr():\n    \"\"\"Clears the LibVLC error status for the current thread. This is optional.\n    By default, the error status is automatically overridden when a new error\n    occurs, and destroyed when the thread exits.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_clearerr\", None) or _Cfunction(\n        \"libvlc_clearerr\", (), None, None\n    )\n    return f()\n\n\ndef libvlc_clock():\n    \"\"\"Return the current time as defined by LibVLC. The unit is the microsecond.\n    Time increases monotonically (regardless of time zone changes and RTC\n    adjustements).\n    The origin is arbitrary but consistent across the whole system\n    (e.g. the system uptim, the time since the system was booted).\n\n    .. note:: On systems that support it, the POSIX monotonic clock is used.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_clock\", None) or _Cfunction(\n        \"libvlc_clock\", (), None, ctypes.c_int64\n    )\n    return f()\n\n\ndef libvlc_dialog_dismiss(p_id):\n    \"\"\"Dismiss a dialog\n\n    After this call, *p_id* won't be valid anymore\n\n    See :class:`DialogCbs`.pf_cancel\n\n    :param p_id: id of the dialog.\n\n    :return: 0 on success, or -1 on error.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_dismiss\", None) or _Cfunction(\n        \"libvlc_dialog_dismiss\", ((1,),), None, ctypes.c_int, ctypes.c_void_p\n    )\n    return f(p_id)\n\n\ndef libvlc_dialog_get_context(p_id):\n    \"\"\"Return the opaque pointer associated with the dialog id\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_get_context\", None) or _Cfunction(\n        \"libvlc_dialog_get_context\", ((1,),), None, ctypes.c_void_p, ctypes.c_void_p\n    )\n    return f(p_id)\n\n\ndef libvlc_dialog_post_action(p_id, i_action):\n    \"\"\"Post a question answer\n\n    After this call, *p_id* won't be valid anymore\n\n    See :class:`DialogCbs`.pf_display_question\n\n    :param p_id: id of the dialog.\n    :param i_action: 1 for action1, 2 for action2.\n\n    :return: 0 on success, or -1 on error.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_post_action\", None) or _Cfunction(\n        \"libvlc_dialog_post_action\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        ctypes.c_void_p,\n        ctypes.c_int,\n    )\n    return f(p_id, i_action)\n\n\ndef libvlc_dialog_post_login(p_id, psz_username, psz_password, b_store):\n    \"\"\"Post a login answer\n\n    After this call, *p_id* won't be valid anymore\n\n    See :class:`DialogCbs`.pf_display_login\n\n    :param p_id: id of the dialog.\n    :param psz_username: valid and non empty string.\n    :param psz_password: valid string (can be empty).\n    :param b_store: if true, store the credentials.\n\n    :return: 0 on success, or -1 on error.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_post_login\", None) or _Cfunction(\n        \"libvlc_dialog_post_login\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        ctypes.c_void_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_bool,\n    )\n    return f(p_id, psz_username, psz_password, b_store)\n\n\ndef libvlc_dialog_set_callbacks(p_instance, p_cbs, p_data):\n    \"\"\"Register callbacks in order to handle VLC dialogs\n\n    :param p_cbs: a pointer to callbacks, or None to unregister callbacks.\n    :param p_data: opaque pointer for the callback.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_set_callbacks\", None) or _Cfunction(\n        \"libvlc_dialog_set_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        ctypes.POINTER(DialogCbs),\n        ctypes.c_void_p,\n    )\n    return f(p_instance, p_cbs, p_data)\n\n\ndef libvlc_dialog_set_context(p_id, p_context):\n    \"\"\"Associate an opaque pointer with the dialog id\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_set_context\", None) or _Cfunction(\n        \"libvlc_dialog_set_context\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.c_void_p,\n        ctypes.c_void_p,\n    )\n    return f(p_id, p_context)\n\n\ndef libvlc_errmsg():\n    \"\"\"A human-readable error message for the last LibVLC error in the calling\n    thread. The resulting string is valid until another error occurs (at least\n    until the next LibVLC call).\n\n    .. warning::\n        This will be None if there was no error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_errmsg\", None) or _Cfunction(\n        \"libvlc_errmsg\", (), None, ctypes.c_char_p\n    )\n    return f()\n\n\ndef libvlc_event_attach(p_event_manager, i_event_type, f_callback, user_data):\n    \"\"\"Register for an event notification.\n\n    :param p_event_manager: the event manager to which you want to attach to.\n        Generally it is obtained by vlc_my_object_event_manager() where.\n        my_object is the object you want to listen to.\n    :param i_event_type: the desired event to which we want to listen.\n    :param f_callback: the function to call when i_event_type occurs.\n    :param user_data: user provided data to carry with the event.\n\n    :return: 0 on success, ENOMEM on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_event_attach\", None) or _Cfunction(\n        \"libvlc_event_attach\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        EventManager,\n        ctypes.c_uint,\n        Callback,\n        ctypes.c_void_p,\n    )\n    return f(p_event_manager, i_event_type, f_callback, user_data)\n\n\ndef libvlc_event_detach(p_event_manager, i_event_type, f_callback, p_user_data):\n    \"\"\"Unregister an event notification.\n\n    :param p_event_manager: the event manager.\n    :param i_event_type: the desired event to which we want to unregister.\n    :param f_callback: the function to call when i_event_type occurs.\n    :param p_user_data: user provided data to carry with the event.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_event_detach\", None) or _Cfunction(\n        \"libvlc_event_detach\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        EventManager,\n        ctypes.c_uint,\n        Callback,\n        ctypes.c_void_p,\n    )\n    return f(p_event_manager, i_event_type, f_callback, p_user_data)\n\n\ndef libvlc_event_type_name(event_type):\n    \"\"\"Get an event's type name.\n\n    :param event_type: the desired event.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_event_type_name\", None) or _Cfunction(\n        \"libvlc_event_type_name\", ((1,),), None, ctypes.c_char_p, ctypes.c_uint\n    )\n    return f(event_type)\n\n\ndef libvlc_free(ptr):\n    \"\"\"Frees an heap allocation returned by a LibVLC function.\n    If you know you're using the same underlying C run-time as the LibVLC\n    implementation, then you can call ANSI C free() directly instead.\n\n    :param ptr: the pointer.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_free\", None) or _Cfunction(\n        \"libvlc_free\", ((1,),), None, None, ctypes.c_void_p\n    )\n    return f(ptr)\n\n\ndef libvlc_get_changeset():\n    \"\"\"Retrieve libvlc changeset.\n\n    Example: \"aa9bce0bc4\"\n\n    :return: a string containing the libvlc changeset.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_get_changeset\", None) or _Cfunction(\n        \"libvlc_get_changeset\", (), None, ctypes.c_char_p\n    )\n    return f()\n\n\ndef libvlc_get_compiler():\n    \"\"\"Retrieve libvlc compiler version.\n\n    Example: \"gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)\"\n\n    :return: a string containing the libvlc compiler version.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_get_compiler\", None) or _Cfunction(\n        \"libvlc_get_compiler\", (), None, ctypes.c_char_p\n    )\n    return f()\n\n\ndef libvlc_get_fullscreen(p_mi):\n    \"\"\"Get current fullscreen status.\n\n    :param p_mi: the media player.\n\n    :return: the fullscreen status (boolean).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_get_fullscreen\", None) or _Cfunction(\n        \"libvlc_get_fullscreen\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_get_log_verbosity(p_instance):\n    \"\"\"Always returns minus one.\n    This function is only provided for backward compatibility.\n\n    :param p_instance: ignored.\n\n    :return: always -1.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_get_log_verbosity\", None) or _Cfunction(\n        \"libvlc_get_log_verbosity\", ((1,),), None, ctypes.c_uint, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_get_version():\n    \"\"\"Retrieve libvlc version.\n\n    Example: \"1.1.0-git The Luggage\"\n\n    :return: a string containing the libvlc version.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_get_version\", None) or _Cfunction(\n        \"libvlc_get_version\", (), None, ctypes.c_char_p\n    )\n    return f()\n\n\ndef libvlc_log_clear(p_log):\n    \"\"\"This function does nothing.\n    It is only provided for backward compatibility.\n\n    :param p_log: ignored.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_clear\", None) or _Cfunction(\n        \"libvlc_log_clear\", ((1,),), None, None, Log_ptr\n    )\n    return f(p_log)\n\n\ndef libvlc_log_close(p_log):\n    \"\"\"Frees memory allocated by :func:`libvlc_log_open`.\n\n    :param p_log: libvlc log instance or None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_close\", None) or _Cfunction(\n        \"libvlc_log_close\", ((1,),), None, None, Log_ptr\n    )\n    return f(p_log)\n\n\ndef libvlc_log_count(p_log):\n    \"\"\"Always returns zero.\n    This function is only provided for backward compatibility.\n\n    :param p_log: ignored.\n\n    :return: always zero.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_count\", None) or _Cfunction(\n        \"libvlc_log_count\", ((1,),), None, ctypes.c_uint, Log_ptr\n    )\n    return f(p_log)\n\n\ndef libvlc_log_get_context(ctx, module, file):\n    \"\"\"Gets log message debug infos.\n\n    This function retrieves self-debug information about a log message:\n\n    * the name of the VLC *module* emitting the message,\n    * the name of the source code *module* (i.e. *file*) and\n    * the *line* number within the source code *module*.\n\n    The returned *module* name and *file* name will be None if unknown.\n    The returned *line* number will similarly be zero if unknown.\n\n    .. warning:: The returned *module* name and source code *file* name, if non-None,\n        are only valid until the logging callback returns.\n\n    :param ctx: message context (as passed to the :class:`LogCb` callback).\n    :param module: module name storage (or None) [OUT].\n    :param file: source code file name storage (or None) [OUT].\n    :param line: source code file line number storage (or None) [OUT].\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_get_context\", None) or _Cfunction(\n        \"libvlc_log_get_context\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (2,),\n        ),\n        None,\n        None,\n        Log_ptr,\n        ListPOINTER(ctypes.c_char_p),\n        ListPOINTER(ctypes.c_char_p),\n        ctypes.POINTER(ctypes.c_uint),\n    )\n    return f(ctx, module, file)\n\n\ndef libvlc_log_get_iterator(p_log):\n    \"\"\"This function does nothing useful.\n    It is only provided for backward compatibility.\n\n    :param p_log: ignored.\n\n    :return: an unique pointer or None on error or if the parameter was None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_get_iterator\", None) or _Cfunction(\n        \"libvlc_log_get_iterator\",\n        ((1,),),\n        class_result(LogIterator),\n        ctypes.c_void_p,\n        Log_ptr,\n    )\n    return f(p_log)\n\n\ndef libvlc_log_get_object(ctx, name, header, id):\n    \"\"\"Gets log message info.\n\n    This function retrieves meta-information about a log message:\n\n    * the type *name* of the VLC object emitting the message,\n    * the object *header* if any, and\n    * a temporaly-unique object identifier.\n\n    This information is mainly meant for **manual** troubleshooting.\n\n    The returned type *name* may be \"generic\" if unknown, but it cannot be None.\n    The returned *header* will be None if unset; in current versions, the header\n    is used to distinguish for VLM inputs.\n    The returned object ID will be zero if the message is not associated with\n    any VLC object.\n\n    .. warning:: The returned module *name* and source code file *name*, if non-None,\n        are only valid until the logging callback returns.\n\n    :param ctx: message context (as passed to the :class:`LogCb` callback).\n    :param name: object name storage (or None) [OUT].\n    :param header: object header (or None) [OUT].\n    :param line: source code file line number storage (or None) [OUT].\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_get_object\", None) or _Cfunction(\n        \"libvlc_log_get_object\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Log_ptr,\n        ListPOINTER(ctypes.c_char_p),\n        ListPOINTER(ctypes.c_char_p),\n        ctypes.POINTER(ctypes.c_uint),\n    )\n    return f(ctx, name, header, id)\n\n\ndef libvlc_log_iterator_free(p_iter):\n    \"\"\"Frees memory allocated by :func:`libvlc_log_get_iterator`.\n\n    :param p_iter: libvlc log iterator or None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_iterator_free\", None) or _Cfunction(\n        \"libvlc_log_iterator_free\", ((1,),), None, None, LogIterator\n    )\n    return f(p_iter)\n\n\ndef libvlc_log_iterator_has_next(p_iter):\n    \"\"\"Always returns zero.\n    This function is only provided for backward compatibility.\n\n    :param p_iter: ignored.\n\n    :return: always zero.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_iterator_has_next\", None) or _Cfunction(\n        \"libvlc_log_iterator_has_next\", ((1,),), None, ctypes.c_int, LogIterator\n    )\n    return f(p_iter)\n\n\ndef libvlc_log_iterator_next(p_iter, p_buf):\n    \"\"\"Always returns None.\n    This function is only provided for backward compatibility.\n\n    :param p_iter: libvlc log iterator or None.\n    :param p_buf: ignored.\n\n    :return: always None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_iterator_next\", None) or _Cfunction(\n        \"libvlc_log_iterator_next\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.POINTER(LogMessage),\n        LogIterator,\n        ctypes.POINTER(LogMessage),\n    )\n    return f(p_iter, p_buf)\n\n\ndef libvlc_log_open(p_instance):\n    \"\"\"This function does nothing useful.\n    It is only provided for backward compatibility.\n\n    :param p_instance: libvlc instance.\n\n    :return: an unique pointer or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_open\", None) or _Cfunction(\n        \"libvlc_log_open\", ((1,),), None, Log_ptr, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_log_set(p_instance, cb, data):\n    \"\"\"Sets the logging callback for a LibVLC instance.\n\n    This function is thread-safe: it will wait for any pending callbacks\n    invocation to complete.\n\n    .. note:: Some log messages (especially debug) are emitted by LibVLC while\n        is being initialized. These messages cannot be captured with this interface.\n\n    .. warning:: A deadlock may occur if this function is called from the callback.\n\n    :param cb: callback function pointer.\n    :param data: opaque data pointer for the callback function.\n\n    :param p_instance: libvlc instance.\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_set\", None) or _Cfunction(\n        \"libvlc_log_set\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        LogCb,\n        ctypes.c_void_p,\n    )\n    return f(p_instance, cb, data)\n\n\ndef libvlc_log_set_file(p_instance, stream):\n    \"\"\"Sets up logging to a file.\n\n    :param p_instance: libvlc instance.\n    :param stream: FILE pointer opened for writing.\n        (the FILE pointer must remain valid until libvlc_log_unset).\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_set_file\", None) or _Cfunction(\n        \"libvlc_log_set_file\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        FILE_ptr,\n    )\n    return f(p_instance, stream)\n\n\ndef libvlc_log_unset(p_instance):\n    \"\"\"Unsets the logging callback.\n\n    This function deregisters the logging callback for a LibVLC instance.\n    This is rarely needed as the callback is implicitly unset when the instance\n    is destroyed.\n\n    .. note:: This function will wait for any pending callbacks invocation to\n        complete (causing a deadlock if called from within the callback).\n\n    :param p_instance: libvlc instance.\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_unset\", None) or _Cfunction(\n        \"libvlc_log_unset\", ((1,),), None, None, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_media_add_option(p_md, psz_options):\n    \"\"\"Add an option to the media.\n\n    This option will be used to determine how the media_player will\n    read the media. This allows to use VLC's advanced\n    reading/streaming options on a per-media basis.\n\n    .. note:: The options are listed in 'vlc --long-help' from the command line,\n        e.g. \"-sout-all\". Keep in mind that available options and their semantics\n        vary across LibVLC versions and builds.\n    .. warning:: Not all options affects :class:`Media` objects:\n        Specifically, due to architectural issues most audio and video options,\n        such as text renderer options, have no effects on an individual media.\n        These options must be set through :func:`libvlc_new` instead.\n\n    :param p_md: the media descriptor.\n    :param psz_options: the options (as a string).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_add_option\", None) or _Cfunction(\n        \"libvlc_media_add_option\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Media,\n        ctypes.c_char_p,\n    )\n    return f(p_md, psz_options)\n\n\ndef libvlc_media_add_option_flag(p_md, psz_options, i_flags):\n    \"\"\"Add an option to the media with configurable flags.\n\n    This option will be used to determine how the media_player will\n    read the media. This allows to use VLC's advanced\n    reading/streaming options on a per-media basis.\n\n    The options are detailed in vlc --long-help, for instance\n    \"--sout-all\". Note that all options are not usable on medias:\n    specifically, due to architectural issues, video-related options\n    such as text renderer options cannot be set on a single media. They\n    must be set on the whole libvlc instance instead.\n\n    :param p_md: the media descriptor.\n    :param psz_options: the options (as a string).\n    :param i_flags: the flags for this option.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_add_option_flag\", None) or _Cfunction(\n        \"libvlc_media_add_option_flag\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Media,\n        ctypes.c_char_p,\n        ctypes.c_uint,\n    )\n    return f(p_md, psz_options, i_flags)\n\n\ndef libvlc_media_discoverer_event_manager(p_mdis):\n    \"\"\"Get event manager from media service discover object.\n\n\n    .. warning:: **Deprecated!** Useless, media_discoverer events are only triggered when calling\n        :func:`libvlc_media_discoverer_start` and :func:`libvlc_media_discoverer_stop`.\n\n    :param p_mdis: media service discover object.\n\n    :return: event manager object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_event_manager\", None) or _Cfunction(\n        \"libvlc_media_discoverer_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        MediaDiscoverer,\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_is_running(p_mdis):\n    \"\"\"Query if media service discover object is running.\n\n    :param p_mdis: media service discover object.\n\n    :return: true if running, false if not.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_is_running\", None) or _Cfunction(\n        \"libvlc_media_discoverer_is_running\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        MediaDiscoverer,\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_list_get(p_inst, i_cat, ppp_services):\n    \"\"\"Get media discoverer services by category\n\n    :param p_inst: libvlc instance.\n    :param i_cat: category of services to fetch.\n    :param ppp_services: address to store an allocated array of media discoverer.\n        services (must be freed with :func:`libvlc_media_discoverer_list_release` by.\n        the caller) [OUT].\n\n    :return: the number of media discoverer services (0 on error).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_list_get\", None) or _Cfunction(\n        \"libvlc_media_discoverer_list_get\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_size_t,\n        Instance,\n        MediaDiscovererCategory,\n        ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(MediaDiscovererDescription))),\n    )\n    return f(p_inst, i_cat, ppp_services)\n\n\ndef libvlc_media_discoverer_list_release(pp_services, i_count):\n    \"\"\"Release an array of media discoverer services\n\n    See :func:`libvlc_media_discoverer_list_get`\n\n    :param pp_services: array to release.\n    :param i_count: number of elements in the array.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_list_release\", None) or _Cfunction(\n        \"libvlc_media_discoverer_list_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(MediaDiscovererDescription)),\n        ctypes.c_size_t,\n    )\n    return f(pp_services, i_count)\n\n\ndef libvlc_media_discoverer_localized_name(p_mdis):\n    \"\"\"Get media service discover object its localized name.\n\n\n    .. warning:: **Deprecated!** Useless, use :func:`libvlc_media_discoverer_list_get` to get the\n        longname of the service discovery.\n\n    :param p_mdis: media discover object.\n\n    :return: localized name or None if the media_discoverer is not started.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_localized_name\", None) or _Cfunction(\n        \"libvlc_media_discoverer_localized_name\",\n        ((1,),),\n        string_result,\n        ctypes.c_void_p,\n        MediaDiscoverer,\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_media_list(p_mdis):\n    \"\"\"Get media service discover media list.\n\n    :param p_mdis: media service discover object.\n\n    :return: list of media items.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_media_list\", None) or _Cfunction(\n        \"libvlc_media_discoverer_media_list\",\n        ((1,),),\n        class_result(MediaList),\n        ctypes.c_void_p,\n        MediaDiscoverer,\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_new(p_inst, psz_name):\n    \"\"\"Create a media discoverer object by name.\n\n    After this object is created, you should attach to media_list events in\n    order to be notified of new items discovered.\n\n    You need to call :func:`libvlc_media_discoverer_start` in order to start the\n    discovery.\n\n    See :func:`libvlc_media_discoverer_media_list`\n    See :func:`libvlc_media_discoverer_event_manager`\n    See :func:`libvlc_media_discoverer_start`\n\n    :param p_inst: libvlc instance.\n    :param psz_name: service name; use :func:`libvlc_media_discoverer_list_get` to get.\n        a list of the discoverer names available in this libVLC instance.\n\n    :return: media discover object or None in case of error.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_new\", None) or _Cfunction(\n        \"libvlc_media_discoverer_new\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(MediaDiscoverer),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_inst, psz_name)\n\n\ndef libvlc_media_discoverer_new_from_name(p_inst, psz_name):\n    \"\"\".. warning:: **Deprecated!** Use :func:`libvlc_media_discoverer_new` and :func:`libvlc_media_discoverer_start`.\"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_new_from_name\", None) or _Cfunction(\n        \"libvlc_media_discoverer_new_from_name\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(MediaDiscoverer),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_inst, psz_name)\n\n\ndef libvlc_media_discoverer_release(p_mdis):\n    \"\"\"Release media discover object. If the reference count reaches 0, then\n    the object will be released.\n\n    :param p_mdis: media service discover object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_release\", None) or _Cfunction(\n        \"libvlc_media_discoverer_release\", ((1,),), None, None, MediaDiscoverer\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_start(p_mdis):\n    \"\"\"Start media discovery.\n\n    To stop it, call :func:`libvlc_media_discoverer_stop` or\n    :func:`libvlc_media_discoverer_list_release` directly.\n\n    See :func:`libvlc_media_discoverer_stop`\n\n    :param p_mdis: media discover object.\n\n    :return: -1 in case of error, 0 otherwise.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_start\", None) or _Cfunction(\n        \"libvlc_media_discoverer_start\", ((1,),), None, ctypes.c_int, MediaDiscoverer\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_stop(p_mdis):\n    \"\"\"Stop media discovery.\n\n    See :func:`libvlc_media_discoverer_start`\n\n    :param p_mdis: media discover object.\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_stop\", None) or _Cfunction(\n        \"libvlc_media_discoverer_stop\", ((1,),), None, None, MediaDiscoverer\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_duplicate(p_md):\n    \"\"\"Duplicate a media descriptor object.\n\n    :param p_md: a media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_duplicate\", None) or _Cfunction(\n        \"libvlc_media_duplicate\", ((1,),), class_result(Media), ctypes.c_void_p, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_event_manager(p_md):\n    \"\"\"Get event manager from media descriptor object.\n    NOTE: this function doesn't increment reference counting.\n\n    :param p_md: a media descriptor object.\n\n    :return: event manager object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_event_manager\", None) or _Cfunction(\n        \"libvlc_media_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        Media,\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_codec_description(i_type, i_codec):\n    \"\"\"Get codec description from media elementary stream\n\n    See :class:`MediaTrack`\n\n    :param i_type: i_type from :class:`MediaTrack`.\n    :param i_codec: i_codec or i_original_fourcc from :class:`MediaTrack`.\n\n    :return: codec description.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_codec_description\", None) or _Cfunction(\n        \"libvlc_media_get_codec_description\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_char_p,\n        TrackType,\n        ctypes.c_uint32,\n    )\n    return f(i_type, i_codec)\n\n\ndef libvlc_media_get_duration(p_md):\n    \"\"\"Get duration (in ms) of media descriptor object item.\n\n    :param p_md: media descriptor object.\n\n    :return: duration of media item or -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_duration\", None) or _Cfunction(\n        \"libvlc_media_get_duration\", ((1,),), None, ctypes.c_longlong, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_meta(p_md, e_meta):\n    \"\"\"Read the meta of the media.\n\n    If the media has not yet been parsed this will return None.\n\n    See :func:`libvlc_media_parse`\n    See :func:`libvlc_media_parse_with_options`\n    See libvlc_MediaMetaChanged\n\n    :param p_md: the media descriptor.\n    :param e_meta: the meta to read.\n\n    :return: the media's meta.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_meta\", None) or _Cfunction(\n        \"libvlc_media_get_meta\",\n        (\n            (1,),\n            (1,),\n        ),\n        string_result,\n        ctypes.c_void_p,\n        Media,\n        Meta,\n    )\n    return f(p_md, e_meta)\n\n\ndef libvlc_media_get_mrl(p_md):\n    \"\"\"Get the media resource locator (mrl) from a media descriptor object\n\n    :param p_md: a media descriptor object.\n\n    :return: string with mrl of media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_mrl\", None) or _Cfunction(\n        \"libvlc_media_get_mrl\", ((1,),), string_result, ctypes.c_void_p, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_parsed_status(p_md):\n    \"\"\"Get Parsed status for media descriptor object.\n\n    See libvlc_MediaParsedChanged\n    See :class:`MediaParsedStatus`\n\n    :param p_md: media descriptor object.\n\n    :return: a value of the :class:`MediaParsedStatus` enum.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_parsed_status\", None) or _Cfunction(\n        \"libvlc_media_get_parsed_status\", ((1,),), None, MediaParsedStatus, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_state(p_md):\n    \"\"\"Get current state of media descriptor object. Possible media states are\n    libvlc_NothingSpecial=0, libvlc_Opening, libvlc_Playing, libvlc_Paused,\n    libvlc_Stopped, libvlc_Ended, libvlc_Error.\n\n    See :class:`State`.\n\n    :param p_md: a media descriptor object.\n\n    :return: state of media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_state\", None) or _Cfunction(\n        \"libvlc_media_get_state\", ((1,),), None, State, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_stats(p_md, p_stats):\n    \"\"\"Get the current statistics about the media.\n\n    :param p_md:: media descriptor object.\n    :param p_stats:: structure that contain the statistics about the media.\n        (this structure must be allocated by the caller).\n\n    :return: true if the statistics are available, false otherwise.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_stats\", None) or _Cfunction(\n        \"libvlc_media_get_stats\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Media,\n        ctypes.POINTER(MediaStats),\n    )\n    return f(p_md, p_stats)\n\n\ndef libvlc_media_get_tracks_info(p_md):\n    \"\"\"Get media descriptor's elementary streams description\n\n    Note, you need to call :func:`libvlc_media_parse` or play the media at least once\n    before calling this function.\n    Not doing this will result in an empty array.\n\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_media_tracks_get` instead\n\n    :param p_md: media descriptor object.\n    :param tracks: address to store an allocated array of Elementary Streams.\n        descriptions (must be freed by the caller) [OUT].\n\n    :return: the number of Elementary Streams.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_tracks_info\", None) or _Cfunction(\n        \"libvlc_media_get_tracks_info\",\n        (\n            (1,),\n            (2,),\n        ),\n        None,\n        ctypes.c_int,\n        Media,\n        ctypes.POINTER(ctypes.POINTER(MediaTrackInfo)),\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_type(p_md):\n    \"\"\"Get the media type of the media descriptor object\n\n    See :class:`MediaType`\n\n    :param p_md: media descriptor object.\n\n    :return: media type.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_type\", None) or _Cfunction(\n        \"libvlc_media_get_type\", ((1,),), None, MediaType, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_user_data(p_md):\n    \"\"\"Get media descriptor's user_data. user_data is specialized data\n    accessed by the host application, VLC.framework uses it as a pointer to\n    an native object that references a :class:`Media` pointer\n\n    :param p_md: media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_user_data\", None) or _Cfunction(\n        \"libvlc_media_get_user_data\", ((1,),), None, ctypes.c_void_p, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_is_parsed(p_md):\n    \"\"\"Return true is the media descriptor object is parsed\n\n\n    .. warning:: **Deprecated!** This can return true in case of failure.\n        Use :func:`libvlc_media_get_parsed_status` instead\n\n    See libvlc_MediaParsedChanged\n\n    :param p_md: media descriptor object.\n\n    :return: true if media object has been parsed otherwise it returns false.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_is_parsed\", None) or _Cfunction(\n        \"libvlc_media_is_parsed\", ((1,),), None, ctypes.c_int, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_library_load(p_mlib):\n    \"\"\"Load media library.\n\n    :param p_mlib: media library object.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_library_load\", None) or _Cfunction(\n        \"libvlc_media_library_load\", ((1,),), None, ctypes.c_int, MediaLibrary\n    )\n    return f(p_mlib)\n\n\ndef libvlc_media_library_media_list(p_mlib):\n    \"\"\"Get media library subitems.\n\n    :param p_mlib: media library object.\n\n    :return: media list subitems.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_library_media_list\", None) or _Cfunction(\n        \"libvlc_media_library_media_list\",\n        ((1,),),\n        class_result(MediaList),\n        ctypes.c_void_p,\n        MediaLibrary,\n    )\n    return f(p_mlib)\n\n\ndef libvlc_media_library_new(p_instance):\n    \"\"\"Create an new Media Library object\n\n    :param p_instance: the libvlc instance.\n\n    :return: a new object or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_library_new\", None) or _Cfunction(\n        \"libvlc_media_library_new\",\n        ((1,),),\n        class_result(MediaLibrary),\n        ctypes.c_void_p,\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_media_library_release(p_mlib):\n    \"\"\"Release media library object. This functions decrements the\n    reference count of the media library object. If it reaches 0,\n    then the object will be released.\n\n    :param p_mlib: media library object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_library_release\", None) or _Cfunction(\n        \"libvlc_media_library_release\", ((1,),), None, None, MediaLibrary\n    )\n    return f(p_mlib)\n\n\ndef libvlc_media_library_retain(p_mlib):\n    \"\"\"Retain a reference to a media library object. This function will\n    increment the reference counting for this object. Use\n    :func:`libvlc_media_library_release` to decrement the reference count.\n\n    :param p_mlib: media library object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_library_retain\", None) or _Cfunction(\n        \"libvlc_media_library_retain\", ((1,),), None, None, MediaLibrary\n    )\n    return f(p_mlib)\n\n\ndef libvlc_media_list_add_media(p_ml, p_md):\n    \"\"\"Add media instance to media list\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param p_md: a media instance.\n\n    :return: 0 on success, -1 if the media list is read-only.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_add_media\", None) or _Cfunction(\n        \"libvlc_media_list_add_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaList,\n        Media,\n    )\n    return f(p_ml, p_md)\n\n\ndef libvlc_media_list_count(p_ml):\n    \"\"\"Get count on media list items\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n\n    :return: number of items in media list.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_count\", None) or _Cfunction(\n        \"libvlc_media_list_count\", ((1,),), None, ctypes.c_int, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_event_manager(p_ml):\n    \"\"\"Get libvlc_event_manager from this media list instance.\n    The p_event_manager is immutable, so you don't have to hold the lock\n\n    :param p_ml: a media list instance.\n\n    :return: libvlc_event_manager.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_event_manager\", None) or _Cfunction(\n        \"libvlc_media_list_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        MediaList,\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_index_of_item(p_ml, p_md):\n    \"\"\"Find index position of List media instance in media list.\n    Warning: the function will return the first matched position.\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param p_md: media instance.\n\n    :return: position of media instance or -1 if media not found.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_index_of_item\", None) or _Cfunction(\n        \"libvlc_media_list_index_of_item\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaList,\n        Media,\n    )\n    return f(p_ml, p_md)\n\n\ndef libvlc_media_list_insert_media(p_ml, p_md, i_pos):\n    \"\"\"Insert media instance in media list on a position\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param p_md: a media instance.\n    :param i_pos: position in array where to insert.\n\n    :return: 0 on success, -1 if the media list is read-only.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_insert_media\", None) or _Cfunction(\n        \"libvlc_media_list_insert_media\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaList,\n        Media,\n        ctypes.c_int,\n    )\n    return f(p_ml, p_md, i_pos)\n\n\ndef libvlc_media_list_is_readonly(p_ml):\n    \"\"\"This indicates if this media list is read-only from a user point of view\n\n    :param p_ml: media list instance.\n\n    :return: 1 on readonly, 0 on readwrite.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_is_readonly\", None) or _Cfunction(\n        \"libvlc_media_list_is_readonly\", ((1,),), None, ctypes.c_int, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_item_at_index(p_ml, i_pos):\n    \"\"\"List media instance in media list at a position\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param i_pos: position in array where to insert.\n\n    :return: media instance at position *i_pos*, or None if not found.\n        In case of success, :func:`libvlc_media_retain` is called to increase the refcount.\n        on the media.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_item_at_index\", None) or _Cfunction(\n        \"libvlc_media_list_item_at_index\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        MediaList,\n        ctypes.c_int,\n    )\n    return f(p_ml, i_pos)\n\n\ndef libvlc_media_list_lock(p_ml):\n    \"\"\"Get lock on media list items\n\n    :param p_ml: a media list instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_lock\", None) or _Cfunction(\n        \"libvlc_media_list_lock\", ((1,),), None, None, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_media(p_ml):\n    \"\"\"Get media instance from this media list instance. This action will increase\n    the refcount on the media instance.\n    The :func:`libvlc_media_list_lock` should NOT be held upon entering this function.\n\n    :param p_ml: a media list instance.\n\n    :return: media instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_media\", None) or _Cfunction(\n        \"libvlc_media_list_media\",\n        ((1,),),\n        class_result(Media),\n        ctypes.c_void_p,\n        MediaList,\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_new(p_instance):\n    \"\"\"Create an empty media list.\n\n    :param p_instance: libvlc instance.\n\n    :return: empty media list, or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_new\", None) or _Cfunction(\n        \"libvlc_media_list_new\",\n        ((1,),),\n        class_result(MediaList),\n        ctypes.c_void_p,\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_media_list_player_event_manager(p_mlp):\n    \"\"\"Return the event manager of this media_list_player.\n\n    :param p_mlp: media list player instance.\n\n    :return: the event manager.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_event_manager\", None) or _Cfunction(\n        \"libvlc_media_list_player_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        MediaListPlayer,\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_get_media_player(p_mlp):\n    \"\"\"Get media player of the media_list_player instance.\n\n\n    .. note:: the caller is responsible for releasing the returned instance.\n\n    :param p_mlp: media list player instance.\n\n    :return: media player instance.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_list_player_get_media_player\", None\n    ) or _Cfunction(\n        \"libvlc_media_list_player_get_media_player\",\n        ((1,),),\n        class_result(MediaPlayer),\n        ctypes.c_void_p,\n        MediaListPlayer,\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_get_state(p_mlp):\n    \"\"\"Get current libvlc_state of media list player\n\n    :param p_mlp: media list player instance.\n\n    :return: :class:`State` for media list player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_get_state\", None) or _Cfunction(\n        \"libvlc_media_list_player_get_state\", ((1,),), None, State, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_is_playing(p_mlp):\n    \"\"\"Is media list playing?\n\n    :param p_mlp: media list player instance.\n\n    :return: true for playing and false for not playing.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_is_playing\", None) or _Cfunction(\n        \"libvlc_media_list_player_is_playing\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        MediaListPlayer,\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_new(p_instance):\n    \"\"\"Create new media_list_player.\n\n    :param p_instance: libvlc instance.\n\n    :return: media list player instance or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_new\", None) or _Cfunction(\n        \"libvlc_media_list_player_new\",\n        ((1,),),\n        class_result(MediaListPlayer),\n        ctypes.c_void_p,\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_media_list_player_next(p_mlp):\n    \"\"\"Play next item from media list\n\n    :param p_mlp: media list player instance.\n\n    :return: 0 upon success -1 if there is no next item.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_next\", None) or _Cfunction(\n        \"libvlc_media_list_player_next\", ((1,),), None, ctypes.c_int, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_pause(p_mlp):\n    \"\"\"Toggle pause (or resume) media list\n\n    :param p_mlp: media list player instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_pause\", None) or _Cfunction(\n        \"libvlc_media_list_player_pause\", ((1,),), None, None, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_play(p_mlp):\n    \"\"\"Play media list\n\n    :param p_mlp: media list player instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_play\", None) or _Cfunction(\n        \"libvlc_media_list_player_play\", ((1,),), None, None, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_play_item(p_mlp, p_md):\n    \"\"\"Play the given media item\n\n    :param p_mlp: media list player instance.\n    :param p_md: the media instance.\n\n    :return: 0 upon success, -1 if the media is not part of the media list.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_play_item\", None) or _Cfunction(\n        \"libvlc_media_list_player_play_item\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaListPlayer,\n        Media,\n    )\n    return f(p_mlp, p_md)\n\n\ndef libvlc_media_list_player_play_item_at_index(p_mlp, i_index):\n    \"\"\"Play media list item at position index\n\n    :param p_mlp: media list player instance.\n    :param i_index: index in media list to play.\n\n    :return: 0 upon success -1 if the item wasn't found.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_list_player_play_item_at_index\", None\n    ) or _Cfunction(\n        \"libvlc_media_list_player_play_item_at_index\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaListPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mlp, i_index)\n\n\ndef libvlc_media_list_player_previous(p_mlp):\n    \"\"\"Play previous item from media list\n\n    :param p_mlp: media list player instance.\n\n    :return: 0 upon success -1 if there is no previous item.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_previous\", None) or _Cfunction(\n        \"libvlc_media_list_player_previous\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        MediaListPlayer,\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_release(p_mlp):\n    \"\"\"Release a media_list_player after use\n    Decrement the reference count of a media player object. If the\n    reference count is 0, then :func:`libvlc_media_list_player_release` will\n    release the media player object. If the media player object\n    has been released, then it should not be used again.\n\n    :param p_mlp: media list player instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_release\", None) or _Cfunction(\n        \"libvlc_media_list_player_release\", ((1,),), None, None, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_retain(p_mlp):\n    \"\"\"Retain a reference to a media player list object. Use\n    :func:`libvlc_media_list_player_release` to decrement reference count.\n\n    :param p_mlp: media player list object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_retain\", None) or _Cfunction(\n        \"libvlc_media_list_player_retain\", ((1,),), None, None, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_set_media_list(p_mlp, p_mlist):\n    \"\"\"Set the media list associated with the player\n\n    :param p_mlp: media list player instance.\n    :param p_mlist: list of media.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_set_media_list\", None) or _Cfunction(\n        \"libvlc_media_list_player_set_media_list\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaListPlayer,\n        MediaList,\n    )\n    return f(p_mlp, p_mlist)\n\n\ndef libvlc_media_list_player_set_media_player(p_mlp, p_mi):\n    \"\"\"Replace media player in media_list_player with this instance.\n\n    :param p_mlp: media list player instance.\n    :param p_mi: media player instance.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_list_player_set_media_player\", None\n    ) or _Cfunction(\n        \"libvlc_media_list_player_set_media_player\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaListPlayer,\n        MediaPlayer,\n    )\n    return f(p_mlp, p_mi)\n\n\ndef libvlc_media_list_player_set_pause(p_mlp, do_pause):\n    \"\"\"Pause or resume media list\n\n    :param p_mlp: media list player instance.\n    :param do_pause: play/resume if zero, pause if non-zero.\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_set_pause\", None) or _Cfunction(\n        \"libvlc_media_list_player_set_pause\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaListPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mlp, do_pause)\n\n\ndef libvlc_media_list_player_set_playback_mode(p_mlp, e_mode):\n    \"\"\"Sets the playback mode for the playlist\n\n    :param p_mlp: media list player instance.\n    :param e_mode: playback mode specification.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_list_player_set_playback_mode\", None\n    ) or _Cfunction(\n        \"libvlc_media_list_player_set_playback_mode\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaListPlayer,\n        PlaybackMode,\n    )\n    return f(p_mlp, e_mode)\n\n\ndef libvlc_media_list_player_stop(p_mlp):\n    \"\"\"Stop playing media list\n\n    :param p_mlp: media list player instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_stop\", None) or _Cfunction(\n        \"libvlc_media_list_player_stop\", ((1,),), None, None, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_release(p_ml):\n    \"\"\"Release media list created with :func:`libvlc_media_list_new`.\n\n    :param p_ml: a media list created with :func:`libvlc_media_list_new`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_release\", None) or _Cfunction(\n        \"libvlc_media_list_release\", ((1,),), None, None, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_remove_index(p_ml, i_pos):\n    \"\"\"Remove media instance from media list on a position\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param i_pos: position in array where to insert.\n\n    :return: 0 on success, -1 if the list is read-only or the item was not found.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_remove_index\", None) or _Cfunction(\n        \"libvlc_media_list_remove_index\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaList,\n        ctypes.c_int,\n    )\n    return f(p_ml, i_pos)\n\n\ndef libvlc_media_list_retain(p_ml):\n    \"\"\"Retain reference to a media list\n\n    :param p_ml: a media list created with :func:`libvlc_media_list_new`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_retain\", None) or _Cfunction(\n        \"libvlc_media_list_retain\", ((1,),), None, None, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_set_media(p_ml, p_md):\n    \"\"\"Associate media instance with this media list instance.\n    If another media instance was present it will be released.\n    The :func:`libvlc_media_list_lock` should NOT be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param p_md: media instance to add.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_set_media\", None) or _Cfunction(\n        \"libvlc_media_list_set_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaList,\n        Media,\n    )\n    return f(p_ml, p_md)\n\n\ndef libvlc_media_list_unlock(p_ml):\n    \"\"\"Release lock on media list items\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_unlock\", None) or _Cfunction(\n        \"libvlc_media_list_unlock\", ((1,),), None, None, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_new_as_node(p_instance, psz_name):\n    \"\"\"Create a media as an empty node with a given name.\n\n    See :func:`libvlc_media_release`\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the node.\n\n    :return: the new empty media or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_new_as_node\", None) or _Cfunction(\n        \"libvlc_media_new_as_node\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_media_new_callbacks(instance, open_cb, read_cb, seek_cb, close_cb, opaque):\n    \"\"\"Create a media with custom callbacks to read the data from.\n\n    .. note:: If *open_cb* is None, the *opaque* pointer will be passed to *read_cb*,\n        *seek_cb* and *close_cb*, and the stream size will be treated as unknown.\n\n    .. note:: The callbacks may be called asynchronously (from another thread).\n        A single stream *instance* need not be reentrant. However the *open_cb* needs to\n        be reentrant if the media is used by multiple player instances.\n\n    .. warning:: The callbacks may be used until all or any player instances\n        that were supplied the media item are stopped.\n\n    See :func:`libvlc_media_release`\n\n    :param instance: LibVLC instance.\n    :param open_cb: callback to open the custom bitstream input media.\n    :param read_cb: callback to read data (must not be None).\n    :param seek_cb: callback to seek, or None if seeking is not supported.\n    :param close_cb: callback to close the media, or None if unnecessary.\n    :param opaque: data pointer for the open callback.\n\n    :return: the newly created media or None on error.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_new_callbacks\", None) or _Cfunction(\n        \"libvlc_media_new_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        Instance,\n        MediaOpenCb,\n        MediaReadCb,\n        MediaSeekCb,\n        MediaCloseCb,\n        ctypes.c_void_p,\n    )\n    return f(instance, open_cb, read_cb, seek_cb, close_cb, opaque)\n\n\ndef libvlc_media_new_fd(p_instance, fd):\n    \"\"\"Create a media for an already open file descriptor.\n    The file descriptor shall be open for reading (or reading and writing).\n\n    Regular file descriptors, pipe read descriptors and character device\n    descriptors (including TTYs) are supported on all platforms.\n    Block device descriptors are supported where available.\n    Directory descriptors are supported on systems that provide fdopendir().\n    Sockets are supported on all platforms where they are file descriptors,\n    i.e. all except Windows.\n\n    .. note:: This library will **not** automatically close the file descriptor\n        under any circumstance. Nevertheless, a file descriptor can usually only be\n        rendered once in a media player. To render it a second time, the file\n        descriptor should probably be rewound to the beginning with lseek().\n\n    See :func:`libvlc_media_release`\n\n    :param p_instance: the instance.\n    :param fd: open file descriptor.\n\n    :return: the newly created media or None on error.\n    :version: LibVLC 1.1.5 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_new_fd\", None) or _Cfunction(\n        \"libvlc_media_new_fd\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_int,\n    )\n    return f(p_instance, fd)\n\n\ndef libvlc_media_new_location(p_instance, psz_mrl):\n    \"\"\"Create a media with a certain given media resource location,\n    for instance a valid URL.\n\n    .. note:: To refer to a local file with this function,\n        the file://... URI syntax **must** be used (see IETF RFC3986).\n        We recommend using :func:`libvlc_media_new_path` instead when dealing with\n        local files.\n\n    See :func:`libvlc_media_release`\n\n    :param p_instance: the instance.\n    :param psz_mrl: the media location.\n\n    :return: the newly created media or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_new_location\", None) or _Cfunction(\n        \"libvlc_media_new_location\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_mrl)\n\n\ndef libvlc_media_new_path(p_instance, path):\n    \"\"\"Create a media for a certain file *path*.\n\n    See :func:`libvlc_media_release`\n\n    :param p_instance: the instance.\n    :param path: local filesystem path.\n\n    :return: the newly created media or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_new_path\", None) or _Cfunction(\n        \"libvlc_media_new_path\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, path)\n\n\ndef libvlc_media_parse(p_md):\n    \"\"\"Parse a media.\n\n    This fetches (local) art, meta data and tracks information.\n    The method is synchronous.\n\n\n    .. warning:: **Deprecated!** This function could block indefinitely.\n        Use :func:`libvlc_media_parse_with_options` instead\n\n    See :func:`libvlc_media_parse_with_options`\n    See :func:`libvlc_media_get_meta`\n    See :func:`libvlc_media_get_tracks_info`\n\n    :param p_md: media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_parse\", None) or _Cfunction(\n        \"libvlc_media_parse\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_parse_async(p_md):\n    \"\"\"Parse a media.\n\n    This fetches (local) art, meta data and tracks information.\n    The method is the asynchronous of :func:`libvlc_media_parse`.\n\n    To track when this is over you can listen to libvlc_MediaParsedChanged\n    event. However if the media was already parsed you will not receive this\n    event.\n\n\n    .. warning:: **Deprecated!** You can't be sure to receive the libvlc_MediaParsedChanged\n        event (you can wait indefinitely for this event).\n        Use :func:`libvlc_media_parse_with_options` instead\n\n    See :func:`libvlc_media_parse`\n    See libvlc_MediaParsedChanged\n    See :func:`libvlc_media_get_meta`\n    See :func:`libvlc_media_get_tracks_info`\n\n    :param p_md: media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_parse_async\", None) or _Cfunction(\n        \"libvlc_media_parse_async\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_parse_stop(p_md):\n    \"\"\"Stop the parsing of the media\n\n    When the media parsing is stopped, the libvlc_MediaParsedChanged event will\n    be sent with the libvlc_media_parsed_status_timeout status.\n\n    See :func:`libvlc_media_parse_with_options`\n\n    :param p_md: media descriptor object.\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_parse_stop\", None) or _Cfunction(\n        \"libvlc_media_parse_stop\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_parse_with_options(p_md, parse_flag, timeout):\n    \"\"\"Parse the media asynchronously with options.\n\n    This fetches (local or network) art, meta data and/or tracks information.\n    This method is the extended version of :func:`libvlc_media_parse_with_options`.\n\n    To track when this is over you can listen to libvlc_MediaParsedChanged\n    event. However if this functions returns an error, you will not receive any\n    events.\n\n    It uses a flag to specify parse options (see libvlc_media_parse_flag_t). All\n    these flags can be combined. By default, media is parsed if it's a local\n    file.\n\n    .. note:: Parsing can be aborted with :func:`libvlc_media_parse_stop`.\n\n    See libvlc_MediaParsedChanged\n    See :func:`libvlc_media_get_meta`\n    See :func:`libvlc_media_tracks_get`\n    See :func:`libvlc_media_get_parsed_status`\n    See :class:`MediaParseFlag`\n\n    :param p_md: media descriptor object.\n    :param parse_flag: parse options:\n    :param timeout: maximum time allowed to preparse the media. If -1, the.\n        default \"preparse-timeout\" option will be used as a timeout. If 0, it will.\n        wait indefinitely. If > 0, the timeout will be used (in milliseconds).\n\n    :return: -1 in case of error, 0 otherwise.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_parse_with_options\", None) or _Cfunction(\n        \"libvlc_media_parse_with_options\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Media,\n        MediaParseFlag,\n        ctypes.c_int,\n    )\n    return f(p_md, parse_flag, timeout)\n\n\ndef libvlc_media_player_add_slave(p_mi, i_type, psz_uri, b_select):\n    \"\"\"Add a slave to the current media player.\n\n    .. note:: If the player is playing, the slave will be added directly. This call\n        will also update the slave list of the attached :class:`Media`.\n\n    See :func:`libvlc_media_slaves_add`\n\n    :param p_mi: the media player.\n    :param i_type: subtitle or audio.\n    :param psz_uri: Uri of the slave (should contain a valid scheme).\n    :param b_select: True if this slave should be selected when it's loaded.\n\n    :return: 0 on success, -1 on error.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_add_slave\", None) or _Cfunction(\n        \"libvlc_media_player_add_slave\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        MediaSlaveType,\n        ctypes.c_char_p,\n        ctypes.c_bool,\n    )\n    return f(p_mi, i_type, psz_uri, b_select)\n\n\ndef libvlc_media_player_can_pause(p_mi):\n    \"\"\"Can this media player be paused?\n\n    :param p_mi: the media player.\n\n    :return: true if the media player can pause.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_can_pause\", None) or _Cfunction(\n        \"libvlc_media_player_can_pause\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_event_manager(p_mi):\n    \"\"\"Get the Event Manager from which the media player send event.\n\n    :param p_mi: the Media Player.\n\n    :return: the event manager associated with p_mi.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_event_manager\", None) or _Cfunction(\n        \"libvlc_media_player_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_agl(p_mi):\n    \"\"\".. warning:: **Deprecated!** Use :func:`libvlc_media_player_get_nsobject` instead.\"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_agl\", None) or _Cfunction(\n        \"libvlc_media_player_get_agl\", ((1,),), None, ctypes.c_uint32, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_chapter(p_mi):\n    \"\"\"Get movie chapter.\n\n    :param p_mi: the Media Player.\n\n    :return: chapter number currently playing, or -1 if there is no media.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_chapter\", None) or _Cfunction(\n        \"libvlc_media_player_get_chapter\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_chapter_count(p_mi):\n    \"\"\"Get movie chapter count\n\n    :param p_mi: the Media Player.\n\n    :return: number of chapters in movie, or -1.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_chapter_count\", None) or _Cfunction(\n        \"libvlc_media_player_get_chapter_count\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_chapter_count_for_title(p_mi, i_title):\n    \"\"\"Get title chapter count\n\n    :param p_mi: the Media Player.\n    :param i_title: title.\n\n    :return: number of chapters in title, or -1.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_player_get_chapter_count_for_title\", None\n    ) or _Cfunction(\n        \"libvlc_media_player_get_chapter_count_for_title\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_title)\n\n\ndef libvlc_media_player_get_fps(p_mi):\n    \"\"\"Get movie fps rate\n\n    This function is provided for backward compatibility. It cannot deal with\n    multiple video tracks. In LibVLC versions prior to 3.0, it would also fail\n    if the file format did not convey the frame rate explicitly.\n\n\n    .. warning:: **Deprecated!** Consider using :func:`libvlc_media_tracks_get` instead.\n\n    :param p_mi: the Media Player.\n\n    :return: frames per second (fps) for this playing movie, or 0 if unspecified.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_fps\", None) or _Cfunction(\n        \"libvlc_media_player_get_fps\", ((1,),), None, ctypes.c_float, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_full_chapter_descriptions(\n    p_mi, i_chapters_of_title, pp_chapters\n):\n    \"\"\"Get the full description of available chapters\n\n    :param p_mi: the media player.\n    :param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1).\n    :param pp_chapters: address to store an allocated array of chapter descriptions.\n        descriptions (must be freed with :func:`libvlc_chapter_descriptions_release`.\n        by the caller) [OUT].\n\n    :return: the number of chapters (-1 on error).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_player_get_full_chapter_descriptions\", None\n    ) or _Cfunction(\n        \"libvlc_media_player_get_full_chapter_descriptions\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n        ctypes.POINTER(ctypes.POINTER(ChapterDescription)),\n    )\n    return f(p_mi, i_chapters_of_title, pp_chapters)\n\n\ndef libvlc_media_player_get_full_title_descriptions(p_mi, titles):\n    \"\"\"Get the full description of available titles\n\n    :param p_mi: the media player.\n    :param titles: address to store an allocated array of title descriptions.\n        descriptions (must be freed with :func:`libvlc_title_descriptions_release`.\n        by the caller) [OUT].\n\n    :return: the number of *titles* (-1 on error).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_player_get_full_title_descriptions\", None\n    ) or _Cfunction(\n        \"libvlc_media_player_get_full_title_descriptions\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.POINTER(ctypes.POINTER(TitleDescription)),\n    )\n    return f(p_mi, titles)\n\n\ndef libvlc_media_player_get_hwnd(p_mi):\n    \"\"\"Get the Windows API window handle (HWND) previously set with\n    :func:`libvlc_media_player_set_hwnd`. The handle will be returned even if LibVLC\n    is not currently outputting any video to it.\n\n    :param p_mi: the Media Player.\n\n    :return: a window handle or None if there are none.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_hwnd\", None) or _Cfunction(\n        \"libvlc_media_player_get_hwnd\", ((1,),), None, ctypes.c_void_p, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_length(p_mi):\n    \"\"\"Get the current movie length (in ms).\n\n    :param p_mi: the Media Player.\n\n    :return: the movie length (in ms), or -1 if there is no media.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_length\", None) or _Cfunction(\n        \"libvlc_media_player_get_length\", ((1,),), None, ctypes.c_longlong, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_media(p_mi):\n    \"\"\"Get the media used by the media_player.\n\n    :param p_mi: the Media Player.\n\n    :return: the media associated with *p_mi*, or None if no.\n        media is associated.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_media\", None) or _Cfunction(\n        \"libvlc_media_player_get_media\",\n        ((1,),),\n        class_result(Media),\n        ctypes.c_void_p,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_nsobject(p_mi):\n    \"\"\"Get the NSView handler previously set with :func:`libvlc_media_player_set_nsobject`.\n\n    :param p_mi: the Media Player.\n\n    :return: the NSView handler or 0 if none where set.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_nsobject\", None) or _Cfunction(\n        \"libvlc_media_player_get_nsobject\", ((1,),), None, ctypes.c_void_p, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_position(p_mi):\n    \"\"\"Get movie position as percentage between 0.0 and 1.0.\n\n    :param p_mi: the Media Player.\n\n    :return: movie position, or -1. in case of error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_position\", None) or _Cfunction(\n        \"libvlc_media_player_get_position\", ((1,),), None, ctypes.c_float, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_rate(p_mi):\n    \"\"\"Get the requested movie play rate.\n    .. warning:: Depending on the underlying media, the requested rate may be\n        different from the real playback rate.\n\n    :param p_mi: the Media Player.\n\n    :return: movie play rate.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_rate\", None) or _Cfunction(\n        \"libvlc_media_player_get_rate\", ((1,),), None, ctypes.c_float, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_role(p_mi):\n    \"\"\"Gets the media role.\n\n    :param p_mi: media player.\n\n    :return: the media player role (libvlc_media_player_role_t).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_role\", None) or _Cfunction(\n        \"libvlc_media_player_get_role\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_state(p_mi):\n    \"\"\"Get current movie state\n\n    :param p_mi: the Media Player.\n\n    :return: the current state of the media player (playing, paused, ...) See :class:`State`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_state\", None) or _Cfunction(\n        \"libvlc_media_player_get_state\", ((1,),), None, State, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_time(p_mi):\n    \"\"\"Get the current movie time (in ms).\n\n    :param p_mi: the Media Player.\n\n    :return: the movie time (in ms), or -1 if there is no media.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_time\", None) or _Cfunction(\n        \"libvlc_media_player_get_time\", ((1,),), None, ctypes.c_longlong, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_title(p_mi):\n    \"\"\"Get movie title\n\n    :param p_mi: the Media Player.\n\n    :return: title number currently playing, or -1.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_title\", None) or _Cfunction(\n        \"libvlc_media_player_get_title\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_title_count(p_mi):\n    \"\"\"Get movie title count\n\n    :param p_mi: the Media Player.\n\n    :return: title number count, or -1.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_title_count\", None) or _Cfunction(\n        \"libvlc_media_player_get_title_count\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_xwindow(p_mi):\n    \"\"\"Get the X Window System window identifier previously set with\n    :func:`libvlc_media_player_set_xwindow`. Note that this will return the identifier\n    even if VLC is not currently using it (for instance if it is playing an\n    audio-only input).\n\n    :param p_mi: the Media Player.\n\n    :return: an X window ID, or 0 if none where set.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_xwindow\", None) or _Cfunction(\n        \"libvlc_media_player_get_xwindow\", ((1,),), None, ctypes.c_uint32, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_has_vout(p_mi):\n    \"\"\"How many video outputs does this media player have?\n\n    :param p_mi: the media player.\n\n    :return: the number of video outputs.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_has_vout\", None) or _Cfunction(\n        \"libvlc_media_player_has_vout\", ((1,),), None, ctypes.c_uint, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_is_playing(p_mi):\n    \"\"\"is_playing\n\n    :param p_mi: the Media Player.\n\n    :return: 1 if the media player is playing, 0 otherwise.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_is_playing\", None) or _Cfunction(\n        \"libvlc_media_player_is_playing\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_is_seekable(p_mi):\n    \"\"\"Is this media player seekable?\n\n    :param p_mi: the media player.\n\n    :return: true if the media player can seek.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_is_seekable\", None) or _Cfunction(\n        \"libvlc_media_player_is_seekable\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_navigate(p_mi, navigate):\n    \"\"\"Navigate through DVD Menu\n\n    :param p_mi: the Media Player.\n    :param navigate: the Navigation mode.\n\n    :version: libVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_navigate\", None) or _Cfunction(\n        \"libvlc_media_player_navigate\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, navigate)\n\n\ndef libvlc_media_player_new(p_libvlc_instance):\n    \"\"\"Create an empty Media Player object\n\n    :param p_libvlc_instance: the libvlc instance in which the Media Player.\n        should be created.\n\n    :return: a new media player object, or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_new\", None) or _Cfunction(\n        \"libvlc_media_player_new\",\n        ((1,),),\n        class_result(MediaPlayer),\n        ctypes.c_void_p,\n        Instance,\n    )\n    return f(p_libvlc_instance)\n\n\ndef libvlc_media_player_new_from_media(p_md):\n    \"\"\"Create a Media Player object from a Media\n\n    :param p_md: the media. Afterwards the p_md can be safely.\n        destroyed.\n\n    :return: a new media player object, or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_new_from_media\", None) or _Cfunction(\n        \"libvlc_media_player_new_from_media\",\n        ((1,),),\n        class_result(MediaPlayer),\n        ctypes.c_void_p,\n        Media,\n    )\n    return f(p_md)\n\n\ndef libvlc_media_player_next_chapter(p_mi):\n    \"\"\"Set next chapter (if applicable)\n\n    :param p_mi: the Media Player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_next_chapter\", None) or _Cfunction(\n        \"libvlc_media_player_next_chapter\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_next_frame(p_mi):\n    \"\"\"Display the next frame (if supported)\n\n    :param p_mi: the media player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_next_frame\", None) or _Cfunction(\n        \"libvlc_media_player_next_frame\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_pause(p_mi):\n    \"\"\"Toggle pause (no effect if there is no media)\n\n    :param p_mi: the Media Player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_pause\", None) or _Cfunction(\n        \"libvlc_media_player_pause\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_play(p_mi):\n    \"\"\"Play\n\n    :param p_mi: the Media Player.\n\n    :return: 0 if playback started (and was already started), or -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_play\", None) or _Cfunction(\n        \"libvlc_media_player_play\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_previous_chapter(p_mi):\n    \"\"\"Set previous chapter (if applicable)\n\n    :param p_mi: the Media Player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_previous_chapter\", None) or _Cfunction(\n        \"libvlc_media_player_previous_chapter\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_program_scrambled(p_mi):\n    \"\"\"Check if the current program is scrambled\n\n    :param p_mi: the media player.\n\n    :return: true if the current program is scrambled.\n\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_program_scrambled\", None) or _Cfunction(\n        \"libvlc_media_player_program_scrambled\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_release(p_mi):\n    \"\"\"Release a media_player after use\n    Decrement the reference count of a media player object. If the\n    reference count is 0, then :func:`libvlc_media_player_release` will\n    release the media player object. If the media player object\n    has been released, then it should not be used again.\n\n    :param p_mi: the Media Player to free.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_release\", None) or _Cfunction(\n        \"libvlc_media_player_release\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_retain(p_mi):\n    \"\"\"Retain a reference to a media player object. Use\n    :func:`libvlc_media_player_release` to decrement reference count.\n\n    :param p_mi: media player object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_retain\", None) or _Cfunction(\n        \"libvlc_media_player_retain\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_set_agl(p_mi, drawable):\n    \"\"\".. warning:: **Deprecated!** Use :func:`libvlc_media_player_set_nsobject` instead.\"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_agl\", None) or _Cfunction(\n        \"libvlc_media_player_set_agl\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint32,\n    )\n    return f(p_mi, drawable)\n\n\ndef libvlc_media_player_set_android_context(p_mi, p_awindow_handler):\n    \"\"\"Set the android context.\n\n    :param p_mi: the media player.\n    :param p_awindow_handler: org.videolan.libvlc.AWindow jobject owned by the.\n        org.videolan.libvlc.MediaPlayer class from the libvlc-android project.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_android_context\", None) or _Cfunction(\n        \"libvlc_media_player_set_android_context\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_void_p,\n    )\n    return f(p_mi, p_awindow_handler)\n\n\ndef libvlc_media_player_set_chapter(p_mi, i_chapter):\n    \"\"\"Set movie chapter (if applicable).\n\n    :param p_mi: the Media Player.\n    :param i_chapter: chapter number to play.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_chapter\", None) or _Cfunction(\n        \"libvlc_media_player_set_chapter\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_chapter)\n\n\ndef libvlc_media_player_set_equalizer(p_mi, p_equalizer):\n    \"\"\"Apply new equalizer settings to a media player.\n\n    The equalizer is first created by invoking :func:`libvlc_audio_equalizer_new` or\n    :func:`libvlc_audio_equalizer_new_from_preset`.\n\n    It is possible to apply new equalizer settings to a media player whether the media\n    player is currently playing media or not.\n\n    Invoking this method will immediately apply the new equalizer settings to the audio\n    output of the currently playing media if there is any.\n\n    If there is no currently playing media, the new equalizer settings will be applied\n    later if and when new media is played.\n\n    Equalizer settings will automatically be applied to subsequently played media.\n\n    To disable the equalizer for a media player invoke this method passing None for the\n    p_equalizer parameter.\n\n    The media player does not keep a reference to the supplied equalizer so it is safe\n    for an application to release the equalizer reference any time after this method\n    returns.\n\n    :param p_mi: opaque media player handle.\n    :param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player.\n\n    :return: zero on success, -1 on error.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_equalizer\", None) or _Cfunction(\n        \"libvlc_media_player_set_equalizer\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        AudioEqualizer,\n    )\n    return f(p_mi, p_equalizer)\n\n\ndef libvlc_media_player_set_evas_object(p_mi, p_evas_object):\n    \"\"\"Set the EFL Evas Object.\n\n    :param p_mi: the media player.\n    :param p_evas_object: a valid EFL Evas Object (Evas_Object).\n\n    :return: -1 if an error was detected, 0 otherwise.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_evas_object\", None) or _Cfunction(\n        \"libvlc_media_player_set_evas_object\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_void_p,\n    )\n    return f(p_mi, p_evas_object)\n\n\ndef libvlc_media_player_set_hwnd(p_mi, drawable):\n    \"\"\"Set a Win32/Win64 API window handle (HWND) where the media player should\n    render its video output. If LibVLC was built without Win32/Win64 API output\n    support, then this has no effects.\n\n    .. warning:: the HWND must have the WS_CLIPCHILDREN set in its style.\n\n    :param p_mi: the Media Player.\n    :param drawable: windows handle of the drawable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_hwnd\", None) or _Cfunction(\n        \"libvlc_media_player_set_hwnd\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_void_p,\n    )\n    return f(p_mi, drawable)\n\n\ndef libvlc_media_player_set_media(p_mi, p_md):\n    \"\"\"Set the media that will be used by the media_player. If any,\n    previous md will be released.\n\n    :param p_mi: the Media Player.\n    :param p_md: the Media. Afterwards the p_md can be safely.\n        destroyed.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_media\", None) or _Cfunction(\n        \"libvlc_media_player_set_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        Media,\n    )\n    return f(p_mi, p_md)\n\n\ndef libvlc_media_player_set_nsobject(p_mi, drawable):\n    \"\"\"Set the NSView handler where the media player should render its video output.\n\n    Use the vout called \"macosx\".\n\n    The *drawable* is an NSObject that follow the VLCOpenGLVideoViewEmbedding\n    protocol:\n\n    .. code-block:: objectivec++\n\n        @protocol VLCOpenGLVideoViewEmbedding <NSObject>\n        - (void)addVoutSubview:(NSView *)view;\n        - (void)removeVoutSubview:(NSView *)view;\n        @end\n\n    Or it can be an NSView object.\n\n    If you want to use it along with Qt see the QMacCocoaViewContainer. Then\n    the following code should work:\n\n    .. code-block:: objectivec++\n\n        NSView *video = [[NSView alloc] init];\n        QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);\n        libvlc_media_player_set_nsobject(mp, video);\n        [video release];\n\n\n    You can find a live example in VLCVideoView in VLCKit.framework.\n\n    :param p_mi: the Media Player.\n    :param drawable: the drawable that is either an NSView or an object following.\n        the VLCOpenGLVideoViewEmbedding protocol.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_nsobject\", None) or _Cfunction(\n        \"libvlc_media_player_set_nsobject\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_void_p,\n    )\n    return f(p_mi, drawable)\n\n\ndef libvlc_media_player_set_pause(mp, do_pause):\n    \"\"\"Pause or resume (no effect if there is no media)\n\n    :param mp: the Media Player.\n    :param do_pause: play/resume if zero, pause if non-zero.\n\n    :version: LibVLC 1.1.1 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_pause\", None) or _Cfunction(\n        \"libvlc_media_player_set_pause\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(mp, do_pause)\n\n\ndef libvlc_media_player_set_position(p_mi, f_pos):\n    \"\"\"Set movie position as percentage between 0.0 and 1.0.\n    This has no effect if playback is not enabled.\n    This might not work depending on the underlying input format and protocol.\n\n    :param p_mi: the Media Player.\n    :param f_pos: the position.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_position\", None) or _Cfunction(\n        \"libvlc_media_player_set_position\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_float,\n    )\n    return f(p_mi, f_pos)\n\n\ndef libvlc_media_player_set_rate(p_mi, rate):\n    \"\"\"Set movie play rate\n\n    :param p_mi: the Media Player.\n    :param rate: movie play rate to set.\n\n    :return: -1 if an error was detected, 0 otherwise (but even then, it might.\n        not actually work depending on the underlying media protocol).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_rate\", None) or _Cfunction(\n        \"libvlc_media_player_set_rate\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_float,\n    )\n    return f(p_mi, rate)\n\n\ndef libvlc_media_player_set_renderer(p_mi, p_item):\n    \"\"\"Set a renderer to the media player\n\n    .. note:: must be called before the first call of :func:`libvlc_media_player_play` to\n        take effect.\n\n    See :func:`libvlc_renderer_discoverer_new`\n\n    :param p_mi: the Media Player.\n    :param p_item: an item discovered by :func:`libvlc_renderer_discoverer_start`.\n\n    :return: 0 on success, -1 on error.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_renderer\", None) or _Cfunction(\n        \"libvlc_media_player_set_renderer\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        Renderer,\n    )\n    return f(p_mi, p_item)\n\n\ndef libvlc_media_player_set_role(p_mi, role):\n    \"\"\"Sets the media *role*.\n\n    :param p_mi: media player.\n    :param role: the media player role (libvlc_media_player_role_t).\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_role\", None) or _Cfunction(\n        \"libvlc_media_player_set_role\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, role)\n\n\ndef libvlc_media_player_set_time(p_mi, i_time):\n    \"\"\"Set the movie time (in ms). This has no effect if no media is being played.\n    Not all formats and protocols support this.\n\n    :param p_mi: the Media Player.\n    :param i_time: the movie time (in ms).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_time\", None) or _Cfunction(\n        \"libvlc_media_player_set_time\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_longlong,\n    )\n    return f(p_mi, i_time)\n\n\ndef libvlc_media_player_set_title(p_mi, i_title):\n    \"\"\"Set movie title\n\n    :param p_mi: the Media Player.\n    :param i_title: title number to play.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_title\", None) or _Cfunction(\n        \"libvlc_media_player_set_title\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_title)\n\n\ndef libvlc_media_player_set_video_title_display(p_mi, position, timeout):\n    \"\"\"Set if, and how, the video title will be shown when media is played.\n\n    :param p_mi: the media player.\n    :param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed.\n    :param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable).\n\n    :version: libVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_player_set_video_title_display\", None\n    ) or _Cfunction(\n        \"libvlc_media_player_set_video_title_display\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        Position,\n        ctypes.c_uint,\n    )\n    return f(p_mi, position, timeout)\n\n\ndef libvlc_media_player_set_xwindow(p_mi, drawable):\n    \"\"\"Set an X Window System *drawable* where the media player should render its\n    video output. The call takes effect when the playback starts. If it is\n    already started, it might need to be stopped before changes apply.\n    If LibVLC was built without X11 output support, then this function has no\n    effects.\n\n    By default, LibVLC will capture input events on the video rendering area.\n    Use :func:`libvlc_video_set_mouse_input` and :func:`libvlc_video_set_key_input` to\n    disable that and deliver events to the parent window / to the application\n    instead. By design, the X11 protocol delivers input events to only one\n    recipient.\n\n    .. warning::\n        The application must call the XInitThreads() function from Xlib before\n        :func:`libvlc_new`, and before any call to XOpenDisplay() directly or via any\n        other library. Failure to call XInitThreads() will seriously impede LibVLC\n        performance. Calling XOpenDisplay() before XInitThreads() will eventually\n        crash the process. That is a limitation of Xlib.\n\n    .. note::\n        The specified identifier must correspond to an existing Input/Output class\n        X11 window. Pixmaps are **not** currently supported. The default X11\n        server is assumed, i.e. that specified in the DISPLAY environment variable.\n\n    .. warning::\n        LibVLC can deal with invalid X11 handle errors, however some display drivers\n        (EGL, GLX, VA and/or VDPAU) can unfortunately not. Thus the window handle\n        must remain valid until playback is stopped, otherwise the process may\n        abort or crash.\n\n    :param p_mi: media player.\n    :param drawable: X11 window ID.\n\n    :bug:\n        No more than one window handle per media player instance can be specified.\n        If the media has multiple simultaneously active video tracks, extra tracks.\n        will be rendered into external windows beyond the control of the.\n        application.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_xwindow\", None) or _Cfunction(\n        \"libvlc_media_player_set_xwindow\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint32,\n    )\n    return f(p_mi, drawable)\n\n\ndef libvlc_media_player_stop(p_mi):\n    \"\"\"Stop (no effect if there is no media)\n\n    :param p_mi: the Media Player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_stop\", None) or _Cfunction(\n        \"libvlc_media_player_stop\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_will_play(p_mi):\n    \"\"\"Is the player able to play\n\n    :param p_mi: the Media Player.\n\n    :return: boolean.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_will_play\", None) or _Cfunction(\n        \"libvlc_media_player_will_play\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_release(p_md):\n    \"\"\"Decrement the reference count of a media descriptor object. If the\n    reference count is 0, then :func:`libvlc_media_release` will release the\n    media descriptor object. It will send out an libvlc_MediaFreed event\n    to all listeners. If the media descriptor object has been released it\n    should not be used again.\n\n    :param p_md: the media descriptor.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_release\", None) or _Cfunction(\n        \"libvlc_media_release\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_retain(p_md):\n    \"\"\"Retain a reference to a media descriptor object (libvlc_media_t). Use\n    :func:`libvlc_media_release` to decrement the reference count of a\n    media descriptor object.\n\n    :param p_md: the media descriptor.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_retain\", None) or _Cfunction(\n        \"libvlc_media_retain\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_save_meta(p_md):\n    \"\"\"Save the meta previously set\n\n    :param p_md: the media desriptor.\n\n    :return: true if the write operation was successful.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_save_meta\", None) or _Cfunction(\n        \"libvlc_media_save_meta\", ((1,),), None, ctypes.c_int, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_set_meta(p_md, e_meta, psz_value):\n    \"\"\"Set the meta of the media (this function will not save the meta, call\n    :func:`libvlc_media_save_meta` in order to save the meta)\n\n    :param p_md: the media descriptor.\n    :param e_meta: the meta to write.\n    :param psz_value: the media's meta.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_set_meta\", None) or _Cfunction(\n        \"libvlc_media_set_meta\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Media,\n        Meta,\n        ctypes.c_char_p,\n    )\n    return f(p_md, e_meta, psz_value)\n\n\ndef libvlc_media_set_user_data(p_md, p_new_user_data):\n    \"\"\"Sets media descriptor's user_data. user_data is specialized data\n    accessed by the host application, VLC.framework uses it as a pointer to\n    an native object that references a :class:`Media` pointer\n\n    :param p_md: media descriptor object.\n    :param p_new_user_data: pointer to user data.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_set_user_data\", None) or _Cfunction(\n        \"libvlc_media_set_user_data\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Media,\n        ctypes.c_void_p,\n    )\n    return f(p_md, p_new_user_data)\n\n\ndef libvlc_media_slaves_add(p_md, i_type, i_priority, psz_uri):\n    \"\"\"Add a slave to the current media.\n\n    A slave is an external input source that may contains an additional subtitle\n    track (like a .srt) or an additional audio track (like a .ac3).\n\n    .. note:: This function must be called before the media is parsed (via\n        libvlc_media_parse_with_options) or before the media is played (via\n        libvlc_media_player_play)\n\n    :param p_md: media descriptor object.\n    :param i_type: subtitle or audio.\n    :param i_priority: from 0 (low priority) to 4 (high priority).\n    :param psz_uri: Uri of the slave (should contain a valid scheme).\n\n    :return: 0 on success, -1 on error.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_slaves_add\", None) or _Cfunction(\n        \"libvlc_media_slaves_add\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Media,\n        MediaSlaveType,\n        ctypes.c_uint,\n        ctypes.c_char_p,\n    )\n    return f(p_md, i_type, i_priority, psz_uri)\n\n\ndef libvlc_media_slaves_clear(p_md):\n    \"\"\"Clear all slaves previously added by :func:`libvlc_media_slaves_add` or\n    internally.\n\n    :param p_md: media descriptor object.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_slaves_clear\", None) or _Cfunction(\n        \"libvlc_media_slaves_clear\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_slaves_get(p_md, ppp_slaves):\n    \"\"\"Get a media descriptor's slave list\n\n    The list will contain slaves parsed by VLC or previously added by\n    :func:`libvlc_media_slaves_add`. The typical use case of this function is to save\n    a list of slave in a database for a later use.\n\n    See :func:`libvlc_media_slaves_add`\n\n    :param p_md: media descriptor object.\n    :param ppp_slaves: address to store an allocated array of slaves (must be.\n        freed with libvlc_media_slaves_release) [OUT].\n\n    :return: the number of slaves (zero on error).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_slaves_get\", None) or _Cfunction(\n        \"libvlc_media_slaves_get\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_uint,\n        Media,\n        ctypes.POINTER(ctypes.POINTER(MediaSlave)),\n    )\n    return f(p_md, ppp_slaves)\n\n\ndef libvlc_media_slaves_release(pp_slaves, i_count):\n    \"\"\"Release a media descriptor's slave list\n\n    :param pp_slaves: slave array to release.\n    :param i_count: number of elements in the array.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_slaves_release\", None) or _Cfunction(\n        \"libvlc_media_slaves_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(MediaSlave)),\n        ctypes.c_uint,\n    )\n    return f(pp_slaves, i_count)\n\n\ndef libvlc_media_subitems(p_md):\n    \"\"\"Get subitems of media descriptor object. This will increment\n    the reference count of supplied media descriptor object. Use\n    :func:`libvlc_media_list_release` to decrement the reference counting.\n\n    :param p_md: media descriptor object.\n\n    :return: list of media descriptor subitems or None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_subitems\", None) or _Cfunction(\n        \"libvlc_media_subitems\",\n        ((1,),),\n        class_result(MediaList),\n        ctypes.c_void_p,\n        Media,\n    )\n    return f(p_md)\n\n\ndef libvlc_media_tracks_get(p_md, tracks):\n    \"\"\"Get media descriptor's elementary streams description\n\n    Note, you need to call :func:`libvlc_media_parse` or play the media at least once\n    before calling this function.\n    Not doing this will result in an empty array.\n\n    :param p_md: media descriptor object.\n    :param tracks: address to store an allocated array of Elementary Streams.\n        descriptions (must be freed with :func:`libvlc_media_tracks_release`.\n        by the caller) [OUT].\n\n    :return: the number of Elementary Streams (zero on error).\n    :version: LibVLC 2.1.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_tracks_get\", None) or _Cfunction(\n        \"libvlc_media_tracks_get\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_uint,\n        Media,\n        ctypes.POINTER(ctypes.POINTER(MediaTrack)),\n    )\n    return f(p_md, tracks)\n\n\ndef libvlc_media_tracks_release(p_tracks, i_count):\n    \"\"\"Release media descriptor's elementary streams description array\n\n    :param p_tracks: tracks info array to release.\n    :param i_count: number of elements in the array.\n\n    :version: LibVLC 2.1.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_tracks_release\", None) or _Cfunction(\n        \"libvlc_media_tracks_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(MediaTrack)),\n        ctypes.c_uint,\n    )\n    return f(p_tracks, i_count)\n\n\ndef libvlc_module_description_list_release(p_list):\n    \"\"\"Release a list of module descriptions.\n\n    :param p_list: the list to be released.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_module_description_list_release\", None) or _Cfunction(\n        \"libvlc_module_description_list_release\",\n        ((1,),),\n        None,\n        None,\n        ctypes.POINTER(ModuleDescription),\n    )\n    return f(p_list)\n\n\ndef libvlc_new(argc, argv):\n    \"\"\"Create and initialize a libvlc instance.\n    This functions accept a list of \"command line\" arguments similar to the\n    main(). These arguments affect the LibVLC instance default configuration.\n\n    .. note::\n        LibVLC may create threads. Therefore, any thread-unsafe process\n        initialization must be performed before calling :func:`libvlc_new`. In particular\n        and where applicable:\n\n            * setlocale() and textdomain(),\n            * setenv(), unsetenv() and putenv(),\n            * with the X11 display system, XInitThreads()\n                (see also libvlc_media_player_set_xwindow) and\n            * on Microsoft Windows, SetErrorMode().\n            * sigprocmask() shall never be invoked; pthread_sigmask() can be used.\n\n    On POSIX systems, the SIGCHLD signal **must not** be ignored, i.e. the\n    signal handler must set to SIG_DFL or a function pointer, not SIG_IGN.\n    Also while LibVLC is active, the wait() function shall not be called, and\n    any call to waitpid() shall use a strictly positive value for the first\n    parameter (i.e. the PID). Failure to follow those rules may lead to a\n    deadlock or a busy loop.\n    Also on POSIX systems, it is recommended that the SIGPIPE signal be blocked,\n    even if it is not, in principles, necessary, e.g.:\n\n    .. code-block:: objectivec++\n\n        sigset_t set;\n\n        signal(SIGCHLD, SIG_DFL);\n        sigemptyset(&set);\n        sigaddset(&set, SIGPIPE);\n        pthread_sigmask(SIG_BLOCK, &set, None);\n\n    On Microsoft Windows Vista/2008, the process error mode\n    SEM_FAILCRITICALERRORS flag **must** be set before using LibVLC.\n    On later versions, that is optional and unnecessary.\n    Also on Microsoft Windows (Vista and any later version), setting the default\n    DLL directories to SYSTEM32 exclusively is strongly recommended for\n    security reasons:\n\n    .. code-block:: objectivec++\n\n        SetErrorMode(SEM_FAILCRITICALERRORS);\n        SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32);\n\n    .. warning::\n        There is absolutely no warranty or promise of forward, backward and\n        cross-platform compatibility with regards to :func:`libvlc_new` arguments.\n        We recommend that you do not use them, other than when debugging.\n\n    :param argc: the number of arguments (should be 0).\n    :param argv: list of arguments (should be None).\n\n    :return: the libvlc instance or None in case of error.\n    :version:\n        Arguments are meant to be passed from the command line to LibVLC, just like.\n        VLC media player does. The list of valid arguments depends on the LibVLC.\n        version, the operating system and platform, and set of available LibVLC.\n        plugins. Invalid or unsupported arguments will cause the function to fail.\n        (i.e. return None). Also, some arguments may alter the behaviour or.\n        otherwise interfere with other LibVLC functions.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_new\", None) or _Cfunction(\n        \"libvlc_new\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Instance),\n        ctypes.c_void_p,\n        ctypes.c_int,\n        ListPOINTER(ctypes.c_char_p),\n    )\n    return f(argc, argv)\n\n\ndef libvlc_playlist_play(p_instance, i_id, i_options, ppsz_options):\n    \"\"\"Start playing (if there is any item in the playlist).\n\n    Additionnal playlist item options can be specified for addition to the\n    item before it is played.\n\n    :param p_instance: the playlist instance.\n    :param i_id: the item to play. If this is a negative number, the next.\n        item will be selected. Otherwise, the item with the given ID will be.\n        played.\n    :param i_options: the number of options to add to the item.\n    :param ppsz_options: the options to add to the item.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_playlist_play\", None) or _Cfunction(\n        \"libvlc_playlist_play\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        ctypes.c_int,\n        ctypes.c_int,\n        ListPOINTER(ctypes.c_char_p),\n    )\n    return f(p_instance, i_id, i_options, ppsz_options)\n\n\ndef libvlc_printerr(fmt):\n    \"\"\"Sets the LibVLC error status and message for the current thread.\n    Any previous error is overridden.\n\n    :param fmt: the format string.\n    :param args: the arguments.\n\n    :return: a nul terminated string in any case.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_printerr\", None) or _Cfunction(\n        \"libvlc_printerr\", ((1,),), None, ctypes.c_char_p, ctypes.c_char_p\n    )\n    return f(fmt)\n\n\ndef libvlc_release(p_instance):\n    \"\"\"Decrement the reference count of a libvlc instance, and destroy it\n    if it reaches zero.\n\n    :param p_instance: the instance to destroy.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_release\", None) or _Cfunction(\n        \"libvlc_release\", ((1,),), None, None, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_renderer_discoverer_event_manager(p_rd):\n    \"\"\"Get the event manager of the renderer discoverer\n\n    The possible events to attach are libvlc_RendererDiscovererItemAdded\n    and libvlc_RendererDiscovererItemDeleted.\n\n    The :class:`Renderer` struct passed to event callbacks is owned by\n    VLC, users should take care of holding/releasing this struct for their\n    internal usage.\n\n    See :class:`Event`.u.renderer_discoverer_item_added.item\n    See :class:`Event`.u.renderer_discoverer_item_removed.item\n\n    :return: a valid event manager (can't fail).\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_event_manager\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        RendererDiscoverer,\n    )\n    return f(p_rd)\n\n\ndef libvlc_renderer_discoverer_list_get(p_inst, ppp_services):\n    \"\"\"Get media discoverer services\n\n    See libvlc_renderer_list_release\n\n    :param p_inst: libvlc instance.\n    :param ppp_services: address to store an allocated array of renderer.\n        discoverer services (must be freed with libvlc_renderer_list_release by.\n        the caller) [OUT].\n\n    :return: the number of media discoverer services (0 on error).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_list_get\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_list_get\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_size_t,\n        Instance,\n        ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(RdDescription))),\n    )\n    return f(p_inst, ppp_services)\n\n\ndef libvlc_renderer_discoverer_list_release(pp_services, i_count):\n    \"\"\"Release an array of media discoverer services\n\n    See :func:`libvlc_renderer_discoverer_list_get`\n\n    :param pp_services: array to release.\n    :param i_count: number of elements in the array.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_list_release\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_list_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(RdDescription)),\n        ctypes.c_size_t,\n    )\n    return f(pp_services, i_count)\n\n\ndef libvlc_renderer_discoverer_new(p_inst, psz_name):\n    \"\"\"Create a renderer discoverer object by name\n\n    After this object is created, you should attach to events in order to be\n    notified of the discoverer events.\n\n    You need to call :func:`libvlc_renderer_discoverer_start` in order to start the\n    discovery.\n\n    See :func:`libvlc_renderer_discoverer_event_manager`\n    See :func:`libvlc_renderer_discoverer_start`\n\n    :param p_inst: libvlc instance.\n    :param psz_name: service name; use :func:`libvlc_renderer_discoverer_list_get` to.\n        get a list of the discoverer names available in this libVLC instance.\n\n    :return: media discover object or None in case of error.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_new\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_new\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(RendererDiscoverer),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_inst, psz_name)\n\n\ndef libvlc_renderer_discoverer_release(p_rd):\n    \"\"\"Release a renderer discoverer object\n\n    :param p_rd: renderer discoverer object.\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_release\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_release\", ((1,),), None, None, RendererDiscoverer\n    )\n    return f(p_rd)\n\n\ndef libvlc_renderer_discoverer_start(p_rd):\n    \"\"\"Start renderer discovery\n\n    To stop it, call :func:`libvlc_renderer_discoverer_stop` or\n    :func:`libvlc_renderer_discoverer_release` directly.\n\n    See :func:`libvlc_renderer_discoverer_stop`\n\n    :param p_rd: renderer discoverer object.\n\n    :return: -1 in case of error, 0 otherwise.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_start\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_start\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        RendererDiscoverer,\n    )\n    return f(p_rd)\n\n\ndef libvlc_renderer_discoverer_stop(p_rd):\n    \"\"\"Stop renderer discovery.\n\n    See :func:`libvlc_renderer_discoverer_start`\n\n    :param p_rd: renderer discoverer object.\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_stop\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_stop\", ((1,),), None, None, RendererDiscoverer\n    )\n    return f(p_rd)\n\n\ndef libvlc_renderer_item_flags(p_item):\n    \"\"\"Get the flags of a renderer item\n\n    See LIBVLC_RENDERER_CAN_AUDIO\n    See LIBVLC_RENDERER_CAN_VIDEO\n\n    :return: bitwise flag: capabilities of the renderer, see.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_flags\", None) or _Cfunction(\n        \"libvlc_renderer_item_flags\", ((1,),), None, ctypes.c_int, Renderer\n    )\n    return f(p_item)\n\n\ndef libvlc_renderer_item_hold(p_item):\n    \"\"\"Hold a renderer item, i.e. creates a new reference\n\n    This functions need to called from the libvlc_RendererDiscovererItemAdded\n    callback if the libvlc user wants to use this item after. (for display or\n    for passing it to the mediaplayer for example).\n\n    :return: the current item.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_hold\", None) or _Cfunction(\n        \"libvlc_renderer_item_hold\",\n        ((1,),),\n        class_result(Renderer),\n        ctypes.c_void_p,\n        Renderer,\n    )\n    return f(p_item)\n\n\ndef libvlc_renderer_item_icon_uri(p_item):\n    \"\"\"Get the icon uri of a renderer item\n\n    :return: the uri of the item's icon (can be None, must *not* be freed).\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_icon_uri\", None) or _Cfunction(\n        \"libvlc_renderer_item_icon_uri\", ((1,),), None, ctypes.c_char_p, Renderer\n    )\n    return f(p_item)\n\n\ndef libvlc_renderer_item_name(p_item):\n    \"\"\"Get the human readable name of a renderer item\n\n    :return: the name of the item (can't be None, must *not* be freed).\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_name\", None) or _Cfunction(\n        \"libvlc_renderer_item_name\", ((1,),), None, ctypes.c_char_p, Renderer\n    )\n    return f(p_item)\n\n\ndef libvlc_renderer_item_release(p_item):\n    \"\"\"Releases a renderer item, i.e. decrements its reference counter\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_release\", None) or _Cfunction(\n        \"libvlc_renderer_item_release\", ((1,),), None, None, Renderer\n    )\n    return f(p_item)\n\n\ndef libvlc_renderer_item_type(p_item):\n    \"\"\"Get the type (not translated) of a renderer item. For now, the type can only\n    be \"chromecast\" (\"upnp\", \"airplay\" may come later).\n\n    :return: the type of the item (can't be None, must *not* be freed).\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_type\", None) or _Cfunction(\n        \"libvlc_renderer_item_type\", ((1,),), None, ctypes.c_char_p, Renderer\n    )\n    return f(p_item)\n\n\ndef libvlc_retain(p_instance):\n    \"\"\"Increments the reference count of a libvlc instance.\n    The initial reference count is 1 after :func:`libvlc_new` returns.\n\n    :param p_instance: the instance to reference.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_retain\", None) or _Cfunction(\n        \"libvlc_retain\", ((1,),), None, None, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_set_app_id(p_instance, id, version, icon):\n    \"\"\"Sets some meta-information about the application.\n    See also :func:`libvlc_set_user_agent`.\n\n    :param p_instance: LibVLC instance.\n    :param id: Java-style application identifier, e.g. \"com.acme.foobar\".\n    :param version: application version numbers, e.g. \"1.2.3\".\n    :param icon: application icon name, e.g. \"foobar\".\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_set_app_id\", None) or _Cfunction(\n        \"libvlc_set_app_id\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, id, version, icon)\n\n\nLibvlcSetExitHandlerCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p)\n\n\ndef libvlc_set_exit_handler(p_instance, cb, opaque):\n    \"\"\"Registers a callback for the LibVLC exit event. This is mostly useful if\n    the VLC playlist and/or at least one interface are started with\n    :func:`libvlc_playlist_play` or :func:`libvlc_add_intf` respectively.\n    Typically, this function will wake up your application main loop (from\n    another thread).\n\n    .. note:: This function should be called before the playlist or interface are\n        started. Otherwise, there is a small race condition: the exit event could\n        be raised before the handler is registered.\n\n    .. warning:: This function and :func:`libvlc_wait` cannot be used at the same time.\n\n    :param p_instance: LibVLC instance.\n    :param cb: callback to invoke when LibVLC wants to exit,\n        or None to disable the exit handler (as by default).\n    :param opaque: data pointer for the callback.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_set_exit_handler\", None) or _Cfunction(\n        \"libvlc_set_exit_handler\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        LibvlcSetExitHandlerCb,\n        ctypes.c_void_p,\n    )\n    return f(p_instance, cb, opaque)\n\n\ndef libvlc_set_fullscreen(p_mi, b_fullscreen):\n    \"\"\"Enable or disable fullscreen.\n\n    .. warning:: With most window managers, only a top-level windows can be in\n        full-screen mode. Hence, this function will not operate properly if\n        :func:`libvlc_media_player_set_xwindow` was used to embed the video in a\n        non-top-level window. In that case, the embedding window must be reparented\n        to the root window **before** fullscreen mode is enabled. You will want\n        to reparent it back to its normal parent when disabling fullscreen.\n\n    :param p_mi: the media player.\n    :param b_fullscreen: boolean for fullscreen status.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_set_fullscreen\", None) or _Cfunction(\n        \"libvlc_set_fullscreen\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, b_fullscreen)\n\n\ndef libvlc_set_log_verbosity(p_instance, level):\n    \"\"\"This function does nothing.\n    It is only provided for backward compatibility.\n\n    :param p_instance: ignored.\n    :param level: ignored.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_set_log_verbosity\", None) or _Cfunction(\n        \"libvlc_set_log_verbosity\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        ctypes.c_uint,\n    )\n    return f(p_instance, level)\n\n\ndef libvlc_set_user_agent(p_instance, name, http):\n    \"\"\"Sets the application *name*. LibVLC passes this as the user agent string\n    when a protocol requires it.\n\n    :param p_instance: LibVLC instance.\n    :param name: human-readable application name, e.g. \"FooBar player 1.2.3\".\n    :param http: HTTP User Agent, e.g. \"FooBar/1.2.3 Python/2.6.0\".\n\n    :version: LibVLC 1.1.1 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_set_user_agent\", None) or _Cfunction(\n        \"libvlc_set_user_agent\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, name, http)\n\n\ndef libvlc_title_descriptions_release(p_titles, i_count):\n    \"\"\"Release a title description\n\n    :param p_titles: title description array to release.\n    :param i_count: number of title descriptions to release.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_title_descriptions_release\", None) or _Cfunction(\n        \"libvlc_title_descriptions_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(TitleDescription)),\n        ctypes.c_uint,\n    )\n    return f(p_titles, i_count)\n\n\ndef libvlc_toggle_fullscreen(p_mi):\n    \"\"\"Toggle fullscreen status on non-embedded video outputs.\n\n    .. warning:: The same limitations applies to this function\n        as to :func:`libvlc_set_fullscreen`.\n\n    :param p_mi: the media player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_toggle_fullscreen\", None) or _Cfunction(\n        \"libvlc_toggle_fullscreen\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_toggle_teletext(p_mi):\n    \"\"\"Toggle teletext transparent status on video output.\n\n    .. warning:: **Deprecated!** use :func:`libvlc_video_set_teletext` instead.\n\n    :param p_mi: the media player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_toggle_teletext\", None) or _Cfunction(\n        \"libvlc_toggle_teletext\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_track_description_list_release(p_track_description):\n    \"\"\"Release (free) :class:`TrackDescription`\n\n    :param p_track_description: the structure to release.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_track_description_list_release\", None) or _Cfunction(\n        \"libvlc_track_description_list_release\",\n        ((1,),),\n        None,\n        None,\n        ctypes.POINTER(TrackDescription),\n    )\n    return f(p_track_description)\n\n\ndef libvlc_track_description_release(p_track_description):\n    \"\"\".. warning:: **Deprecated!** Use :func:`libvlc_track_description_list_release` instead.\"\"\"\n    f = _Cfunctions.get(\"libvlc_track_description_release\", None) or _Cfunction(\n        \"libvlc_track_description_release\",\n        ((1,),),\n        None,\n        None,\n        ctypes.POINTER(TrackDescription),\n    )\n    return f(p_track_description)\n\n\ndef libvlc_video_filter_list_get(p_instance):\n    \"\"\"Returns a list of video filters that are available.\n\n    See :class:`ModuleDescription`\n    See :func:`libvlc_module_description_list_release`.\n\n    :param p_instance: libvlc instance.\n\n    :return: a list of module descriptions. It should be freed with :func:`libvlc_module_description_list_release`.\n        In case of an error, None is returned.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_filter_list_get\", None) or _Cfunction(\n        \"libvlc_video_filter_list_get\",\n        ((1,),),\n        None,\n        ctypes.POINTER(ModuleDescription),\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_video_get_adjust_float(p_mi, option):\n    \"\"\"Get float adjust *option*.\n\n    :param p_mi: libvlc media player instance.\n    :param option: adjust option to get, values of :class:`VideoAdjustOption`.\n\n    :version: LibVLC 1.1.1 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_adjust_float\", None) or _Cfunction(\n        \"libvlc_video_get_adjust_float\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_float,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, option)\n\n\ndef libvlc_video_get_adjust_int(p_mi, option):\n    \"\"\"Get integer adjust *option*.\n\n    :param p_mi: libvlc media player instance.\n    :param option: adjust option to get, values of :class:`VideoAdjustOption`.\n\n    :version: LibVLC 1.1.1 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_adjust_int\", None) or _Cfunction(\n        \"libvlc_video_get_adjust_int\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, option)\n\n\ndef libvlc_video_get_aspect_ratio(p_mi):\n    \"\"\"Get current video aspect ratio.\n\n    :param p_mi: the media player.\n\n    :return: the video aspect ratio or None if unspecified.\n        (the result must be released with free() or libvlc_free).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_aspect_ratio\", None) or _Cfunction(\n        \"libvlc_video_get_aspect_ratio\",\n        ((1,),),\n        string_result,\n        ctypes.c_void_p,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_chapter_description(p_mi, i_title):\n    \"\"\"Get the description of available chapters for specific title.\n\n    :param p_mi: the media player.\n    :param i_title: selected title.\n\n    :return: list containing description of available chapter for title *i_title*.\n        It must be freed with :func:`libvlc_track_description_list_release`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_chapter_description\", None) or _Cfunction(\n        \"libvlc_video_get_chapter_description\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.POINTER(TrackDescription),\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_title)\n\n\ndef libvlc_video_get_crop_geometry(p_mi):\n    \"\"\"Get current crop filter geometry.\n\n    :param p_mi: the media player.\n\n    :return: the crop filter geometry or None if unset.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_crop_geometry\", None) or _Cfunction(\n        \"libvlc_video_get_crop_geometry\",\n        ((1,),),\n        string_result,\n        ctypes.c_void_p,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_cursor(p_mi, num):\n    \"\"\"Get the mouse pointer coordinates over a video.\n    Coordinates are expressed in terms of the decoded video resolution,\n    **not** in terms of pixels on the screen/viewport (to get the latter,\n    you can query your windowing system directly).\n\n    Either of the coordinates may be negative or larger than the corresponding\n    dimension of the video, if the cursor is outside the rendering area.\n\n    .. warning:: The coordinates may be out-of-date if the pointer is not located\n        on the video rendering area. LibVLC does not track the pointer if it is\n        outside of the video widget.\n\n    .. note:: LibVLC does not support multiple pointers (it does of course support\n        multiple input devices sharing the same pointer) at the moment.\n\n    :param p_mi: media player.\n    :param num: number of the video (starting from, and most commonly 0).\n    :param px: abscissa [OUT].\n    :param py: ordinate [OUT].\n\n    :return: 0 on success, -1 if the specified video does not exist.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_cursor\", None) or _Cfunction(\n        \"libvlc_video_get_cursor\",\n        (\n            (1,),\n            (1,),\n            (2,),\n            (2,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.POINTER(ctypes.c_int),\n        ctypes.POINTER(ctypes.c_int),\n    )\n    return f(p_mi, num)\n\n\ndef libvlc_video_get_height(p_mi):\n    \"\"\"Get current video height.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_video_get_size` instead.\n\n    :param p_mi: the media player.\n\n    :return: the video pixel height or 0 if not applicable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_height\", None) or _Cfunction(\n        \"libvlc_video_get_height\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_logo_int(p_mi, option):\n    \"\"\"Get integer logo *option*.\n\n    :param p_mi: libvlc media player instance.\n    :param option: logo option to get, values of :class:`VideoLogoOption`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_logo_int\", None) or _Cfunction(\n        \"libvlc_video_get_logo_int\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, option)\n\n\ndef libvlc_video_get_marquee_int(p_mi, option):\n    \"\"\"Get an integer marquee *option* value\n\n    :param p_mi: libvlc media player.\n    :param option: marq option to get See libvlc_video_marquee_int_option_t.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_marquee_int\", None) or _Cfunction(\n        \"libvlc_video_get_marquee_int\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, option)\n\n\ndef libvlc_video_get_marquee_string(p_mi, option):\n    \"\"\"Get a string marquee *option* value\n\n    :param p_mi: libvlc media player.\n    :param option: marq option to get See libvlc_video_marquee_string_option_t.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_marquee_string\", None) or _Cfunction(\n        \"libvlc_video_get_marquee_string\",\n        (\n            (1,),\n            (1,),\n        ),\n        string_result,\n        ctypes.c_void_p,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, option)\n\n\ndef libvlc_video_get_scale(p_mi):\n    \"\"\"Get the current video scaling factor.\n    See also :func:`libvlc_video_set_scale`.\n\n    :param p_mi: the media player.\n\n    :return: the currently configured zoom factor, or 0. if the video is set.\n        to fit to the output window/drawable automatically.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_scale\", None) or _Cfunction(\n        \"libvlc_video_get_scale\", ((1,),), None, ctypes.c_float, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_size(p_mi, num):\n    \"\"\"Get the pixel dimensions of a video.\n\n    :param p_mi: media player.\n    :param num: number of the video (starting from, and most commonly 0).\n    :param px: pixel width [OUT].\n    :param py: pixel height [OUT].\n\n    :return: 0 on success, -1 if the specified video does not exist.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_size\", None) or _Cfunction(\n        \"libvlc_video_get_size\",\n        (\n            (1,),\n            (1,),\n            (2,),\n            (2,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.POINTER(ctypes.c_uint),\n        ctypes.POINTER(ctypes.c_uint),\n    )\n    return f(p_mi, num)\n\n\ndef libvlc_video_get_spu(p_mi):\n    \"\"\"Get current video subtitle.\n\n    :param p_mi: the media player.\n\n    :return: the video subtitle selected, or -1 if none.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_spu\", None) or _Cfunction(\n        \"libvlc_video_get_spu\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_spu_count(p_mi):\n    \"\"\"Get the number of available video subtitles.\n\n    :param p_mi: the media player.\n\n    :return: the number of available video subtitles.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_spu_count\", None) or _Cfunction(\n        \"libvlc_video_get_spu_count\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_spu_delay(p_mi):\n    \"\"\"Get the current subtitle delay. Positive values means subtitles are being\n    displayed later, negative values earlier.\n\n    :param p_mi: media player.\n\n    :return: time (in microseconds) the display of subtitles is being delayed.\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_spu_delay\", None) or _Cfunction(\n        \"libvlc_video_get_spu_delay\", ((1,),), None, ctypes.c_int64, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_spu_description(p_mi):\n    \"\"\"Get the description of available video subtitles.\n\n    :param p_mi: the media player.\n\n    :return: list containing description of available video subtitles.\n        It must be freed with :func:`libvlc_track_description_list_release`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_spu_description\", None) or _Cfunction(\n        \"libvlc_video_get_spu_description\",\n        ((1,),),\n        None,\n        ctypes.POINTER(TrackDescription),\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_teletext(p_mi):\n    \"\"\"Get current teletext page requested or 0 if it's disabled.\n\n    Teletext is disabled by default, call :func:`libvlc_video_set_teletext` to enable\n    it.\n\n    :param p_mi: the media player.\n\n    :return: the current teletext page requested.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_teletext\", None) or _Cfunction(\n        \"libvlc_video_get_teletext\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_title_description(p_mi):\n    \"\"\"Get the description of available titles.\n\n    :param p_mi: the media player.\n\n    :return: list containing description of available titles.\n        It must be freed with :func:`libvlc_track_description_list_release`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_title_description\", None) or _Cfunction(\n        \"libvlc_video_get_title_description\",\n        ((1,),),\n        None,\n        ctypes.POINTER(TrackDescription),\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_track(p_mi):\n    \"\"\"Get current video track.\n\n    :param p_mi: media player.\n\n    :return: the video track ID (int) or -1 if no active input.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_track\", None) or _Cfunction(\n        \"libvlc_video_get_track\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_track_count(p_mi):\n    \"\"\"Get number of available video tracks.\n\n    :param p_mi: media player.\n\n    :return: the number of available video tracks (int).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_track_count\", None) or _Cfunction(\n        \"libvlc_video_get_track_count\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_track_description(p_mi):\n    \"\"\"Get the description of available video tracks.\n\n    :param p_mi: media player.\n\n    :return: list with description of available video tracks, or None on error.\n        It must be freed with :func:`libvlc_track_description_list_release`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_track_description\", None) or _Cfunction(\n        \"libvlc_video_get_track_description\",\n        ((1,),),\n        None,\n        ctypes.POINTER(TrackDescription),\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_width(p_mi):\n    \"\"\"Get current video width.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_video_get_size` instead.\n\n    :param p_mi: the media player.\n\n    :return: the video pixel width or 0 if not applicable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_width\", None) or _Cfunction(\n        \"libvlc_video_get_width\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_new_viewpoint():\n    \"\"\"Create a video viewpoint structure.\n\n    :return: video viewpoint or None.\n        (the result must be released with free() or libvlc_free).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_new_viewpoint\", None) or _Cfunction(\n        \"libvlc_video_new_viewpoint\", (), None, ctypes.POINTER(VideoViewpoint)\n    )\n    return f()\n\n\ndef libvlc_video_set_adjust_float(p_mi, option, value):\n    \"\"\"Set adjust *option* as float. Options that take a different type value\n    are ignored.\n\n    :param p_mi: libvlc media player instance.\n    :param option: adust option to set, values of :class:`VideoAdjustOption`.\n    :param value: adjust option value.\n\n    :version: LibVLC 1.1.1 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_adjust_float\", None) or _Cfunction(\n        \"libvlc_video_set_adjust_float\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_float,\n    )\n    return f(p_mi, option, value)\n\n\ndef libvlc_video_set_adjust_int(p_mi, option, value):\n    \"\"\"Set adjust *option* as integer. Options that take a different type value\n    are ignored.\n    Passing libvlc_adjust_enable as *option* *value* has the side effect of\n    starting (arg !0) or stopping (arg 0) the adjust filter.\n\n    :param p_mi: libvlc media player instance.\n    :param option: adust option to set, values of :class:`VideoAdjustOption`.\n    :param value: adjust option value.\n\n    :version: LibVLC 1.1.1 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_adjust_int\", None) or _Cfunction(\n        \"libvlc_video_set_adjust_int\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_int,\n    )\n    return f(p_mi, option, value)\n\n\ndef libvlc_video_set_aspect_ratio(p_mi, psz_aspect):\n    \"\"\"Set new video aspect ratio.\n\n\n    .. note:: Invalid aspect ratios are ignored.\n\n    :param p_mi: the media player.\n    :param psz_aspect: new video aspect-ratio or None to reset to default.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_aspect_ratio\", None) or _Cfunction(\n        \"libvlc_video_set_aspect_ratio\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, psz_aspect)\n\n\ndef libvlc_video_set_callbacks(mp, lock, unlock, display, opaque):\n    \"\"\"Set callbacks and private data to render decoded video to a custom area\n    in memory.\n    Use :func:`libvlc_video_set_format` or :func:`libvlc_video_set_format_callbacks`\n    to configure the decoded format.\n\n    .. warning:: Rendering video into custom memory buffers is considerably less\n        efficient than rendering in a custom window as normal.\n\n    For optimal perfomances, VLC media player renders into a custom window, and\n    does not use this function and associated callbacks. It is **highly\n    recommended** that other LibVLC-based application do likewise.\n    To embed video in a window, use libvlc_media_player_set_xid or equivalent\n    depending on the operating system.\n\n    If window embedding does not fit the application use case, then a custom\n    LibVLC video output *display* plugin is required to maintain optimal video\n    rendering performances.\n\n    The following limitations affect performance:\n\n    * Hardware video decoding acceleration will either be disabled completely,\n        or require (relatively slow) copy from video/DSP memory to main memory.\n    * Sub-pictures (subtitles, on-screen *display*, etc.) must be blent into the\n        main picture by the CPU instead of the GPU.\n    * Depending on the video format, pixel format conversion, picture scaling,\n        cropping and/or picture re-orientation, must be performed by the CPU\n        instead of the GPU.\n    * Memory copying is required between LibVLC reference picture buffers and\n        application buffers (between *lock* and *unlock* callbacks).\n\n    :param mp: the media player.\n    :param lock: callback to lock video memory (must not be None).\n    :param unlock: callback to unlock video memory (or None if not needed).\n    :param display: callback to display video (or None if not needed).\n    :param opaque: private pointer for the three callbacks (as first parameter).\n\n    :version: LibVLC 1.1.1 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_callbacks\", None) or _Cfunction(\n        \"libvlc_video_set_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        VideoLockCb,\n        VideoUnlockCb,\n        VideoDisplayCb,\n        ctypes.c_void_p,\n    )\n    return f(mp, lock, unlock, display, opaque)\n\n\ndef libvlc_video_set_crop_geometry(p_mi, psz_geometry):\n    \"\"\"Set new crop filter geometry.\n\n    :param p_mi: the media player.\n    :param psz_geometry: new crop filter geometry (None to unset).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_crop_geometry\", None) or _Cfunction(\n        \"libvlc_video_set_crop_geometry\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, psz_geometry)\n\n\ndef libvlc_video_set_deinterlace(p_mi, psz_mode):\n    \"\"\"Enable or disable deinterlace filter\n\n    :param p_mi: libvlc media player.\n    :param psz_mode: type of deinterlace filter, None to disable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_deinterlace\", None) or _Cfunction(\n        \"libvlc_video_set_deinterlace\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, psz_mode)\n\n\ndef libvlc_video_set_format(mp, chroma, width, height, pitch):\n    \"\"\"Set decoded video *chroma* and dimensions.\n    This only works in combination with :func:`libvlc_video_set_callbacks`,\n    and is mutually exclusive with :func:`libvlc_video_set_format_callbacks`.\n\n    :param mp: the media player.\n    :param chroma: a four-characters string identifying the chroma.\n        (e.g. \"RV32\" or \"YUYV\").\n    :param width: pixel width.\n    :param height: pixel height.\n    :param pitch: line pitch (in bytes).\n\n    :version: LibVLC 1.1.1 or later.\n    :bug: All pixel planes are expected to have the same *pitch*.\n        To use the YCbCr color space with chrominance subsampling,\n        consider using :func:`libvlc_video_set_format_callbacks` instead.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_format\", None) or _Cfunction(\n        \"libvlc_video_set_format\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n        ctypes.c_uint,\n        ctypes.c_uint,\n        ctypes.c_uint,\n    )\n    return f(mp, chroma, width, height, pitch)\n\n\ndef libvlc_video_set_format_callbacks(mp, setup, cleanup):\n    \"\"\"Set decoded video chroma and dimensions. This only works in combination with\n    :func:`libvlc_video_set_callbacks`.\n\n    :param mp: the media player.\n    :param setup: callback to select the video format (cannot be None).\n    :param cleanup: callback to release any allocated resources (or None).\n\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_format_callbacks\", None) or _Cfunction(\n        \"libvlc_video_set_format_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        VideoFormatCb,\n        VideoCleanupCb,\n    )\n    return f(mp, setup, cleanup)\n\n\ndef libvlc_video_set_key_input(p_mi, on):\n    \"\"\"Enable or disable key press events handling, according to the LibVLC hotkeys\n    configuration. By default and for historical reasons, keyboard events are\n    handled by the LibVLC video widget.\n\n    .. note:: On X11, there can be only one subscriber for key press and mouse\n        click events per window. If your application has subscribed to those events\n        for the X window ID of the video widget, then LibVLC will not be able to\n        handle key presses and mouse clicks in any case.\n\n    .. warning:: This function is only implemented for X11 and Win32 at the moment.\n\n    :param p_mi: the media player.\n    :param on: true to handle key press events, false to ignore them.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_key_input\", None) or _Cfunction(\n        \"libvlc_video_set_key_input\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, on)\n\n\ndef libvlc_video_set_logo_int(p_mi, option, value):\n    \"\"\"Set logo *option* as integer. Options that take a different type value\n    are ignored.\n    Passing libvlc_logo_enable as *option* *value* has the side effect of\n    starting (arg !0) or stopping (arg 0) the logo filter.\n\n    :param p_mi: libvlc media player instance.\n    :param option: logo option to set, values of :class:`VideoLogoOption`.\n    :param value: logo option value.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_logo_int\", None) or _Cfunction(\n        \"libvlc_video_set_logo_int\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_int,\n    )\n    return f(p_mi, option, value)\n\n\ndef libvlc_video_set_logo_string(p_mi, option, psz_value):\n    \"\"\"Set logo *option* as string. Options that take a different type value\n    are ignored.\n\n    :param p_mi: libvlc media player instance.\n    :param option: logo option to set, values of :class:`VideoLogoOption`.\n    :param psz_value: logo option value.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_logo_string\", None) or _Cfunction(\n        \"libvlc_video_set_logo_string\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, option, psz_value)\n\n\ndef libvlc_video_set_marquee_int(p_mi, option, i_val):\n    \"\"\"Enable, disable or set an integer marquee option\n\n    Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)\n    or disabling (arg 0) the marq filter.\n\n    :param p_mi: libvlc media player.\n    :param option: marq option to set See libvlc_video_marquee_int_option_t.\n    :param i_val: marq option value.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_marquee_int\", None) or _Cfunction(\n        \"libvlc_video_set_marquee_int\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_int,\n    )\n    return f(p_mi, option, i_val)\n\n\ndef libvlc_video_set_marquee_string(p_mi, option, psz_text):\n    \"\"\"Set a marquee string option\n\n    :param p_mi: libvlc media player.\n    :param option: marq option to set See libvlc_video_marquee_string_option_t.\n    :param psz_text: marq option value.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_marquee_string\", None) or _Cfunction(\n        \"libvlc_video_set_marquee_string\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, option, psz_text)\n\n\ndef libvlc_video_set_mouse_input(p_mi, on):\n    \"\"\"Enable or disable mouse click events handling. By default, those events are\n    handled. This is needed for DVD menus to work, as well as a few video\n    filters such as \"puzzle\".\n\n    See :func:`libvlc_video_set_key_input`.\n\n    .. warning:: This function is only implemented for X11 and Win32 at the moment.\n\n    :param p_mi: the media player.\n    :param on: true to handle mouse click events, false to ignore them.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_mouse_input\", None) or _Cfunction(\n        \"libvlc_video_set_mouse_input\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, on)\n\n\ndef libvlc_video_set_scale(p_mi, f_factor):\n    \"\"\"Set the video scaling factor. That is the ratio of the number of pixels on\n    screen to the number of pixels in the original decoded video in each\n    dimension. Zero is a special value; it will adjust the video to the output\n    window/drawable (in windowed mode) or the entire screen.\n\n    Note that not all video outputs support scaling.\n\n    :param p_mi: the media player.\n    :param f_factor: the scaling factor, or zero.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_scale\", None) or _Cfunction(\n        \"libvlc_video_set_scale\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_float,\n    )\n    return f(p_mi, f_factor)\n\n\ndef libvlc_video_set_spu(p_mi, i_spu):\n    \"\"\"Set new video subtitle.\n\n    :param p_mi: the media player.\n    :param i_spu: video subtitle track to select (i_id from track description).\n\n    :return: 0 on success, -1 if out of range.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_spu\", None) or _Cfunction(\n        \"libvlc_video_set_spu\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_spu)\n\n\ndef libvlc_video_set_spu_delay(p_mi, i_delay):\n    \"\"\"Set the subtitle delay. This affects the timing of when the subtitle will\n    be displayed. Positive values result in subtitles being displayed later,\n    while negative values will result in subtitles being displayed earlier.\n\n    The subtitle delay will be reset to zero each time the media changes.\n\n    :param p_mi: media player.\n    :param i_delay: time (in microseconds) the display of subtitles should be delayed.\n\n    :return: 0 on success, -1 on error.\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_spu_delay\", None) or _Cfunction(\n        \"libvlc_video_set_spu_delay\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int64,\n    )\n    return f(p_mi, i_delay)\n\n\ndef libvlc_video_set_subtitle_file(p_mi, psz_subtitle):\n    \"\"\"Set new video subtitle file.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_media_player_add_slave` instead.\n\n    :param p_mi: the media player.\n    :param psz_subtitle: new video subtitle file.\n\n    :return: the success status (boolean).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_subtitle_file\", None) or _Cfunction(\n        \"libvlc_video_set_subtitle_file\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, psz_subtitle)\n\n\ndef libvlc_video_set_teletext(p_mi, i_page):\n    \"\"\"Set new teletext page to retrieve.\n\n    This function can also be used to send a teletext key.\n\n    :param p_mi: the media player.\n    :param i_page: teletex page number requested. This value can be 0 to disable.\n        teletext, a number in the range ]0;1000[ to show the requested page, or a.\n        :class:`TeletextKey`. 100 is the default teletext page.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_teletext\", None) or _Cfunction(\n        \"libvlc_video_set_teletext\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_page)\n\n\ndef libvlc_video_set_track(p_mi, i_track):\n    \"\"\"Set video track.\n\n    :param p_mi: media player.\n    :param i_track: the track ID (i_id field from track description).\n\n    :return: 0 on success, -1 if out of range.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_track\", None) or _Cfunction(\n        \"libvlc_video_set_track\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_track)\n\n\ndef libvlc_video_take_snapshot(p_mi, num, psz_filepath, i_width, i_height):\n    \"\"\"Take a snapshot of the current video window.\n\n    If *i_width* AND *i_height* is 0, original size is used.\n    If *i_width* XOR *i_height* is 0, original aspect-ratio is preserved.\n\n    :param p_mi: media player instance.\n    :param num: number of video output (typically 0 for the first/only one).\n    :param psz_filepath: the path of a file or a folder to save the screenshot into.\n    :param i_width: the snapshot's width.\n    :param i_height: the snapshot's height.\n\n    :return: 0 on success, -1 if the video was not found.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_take_snapshot\", None) or _Cfunction(\n        \"libvlc_video_take_snapshot\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_char_p,\n        ctypes.c_uint,\n        ctypes.c_uint,\n    )\n    return f(p_mi, num, psz_filepath, i_width, i_height)\n\n\ndef libvlc_video_update_viewpoint(p_mi, p_viewpoint, b_absolute):\n    \"\"\"Update the video viewpoint information.\n\n    .. note:: It is safe to call this function before the media player is started.\n\n    .. note:: the values are set asynchronously, it will be used by the next frame displayed.\n\n    :param p_mi: the media player.\n    :param p_viewpoint: video viewpoint allocated via :func:`libvlc_video_new_viewpoint`.\n    :param b_absolute: if true replace the old viewpoint with the new one. If.\n        false, increase/decrease it.\n\n    :return: -1 in case of error, 0 otherwise.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_update_viewpoint\", None) or _Cfunction(\n        \"libvlc_video_update_viewpoint\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.POINTER(VideoViewpoint),\n        ctypes.c_bool,\n    )\n    return f(p_mi, p_viewpoint, b_absolute)\n\n\ndef libvlc_vlm_add_broadcast(\n    p_instance,\n    psz_name,\n    psz_input,\n    psz_output,\n    i_options,\n    ppsz_options,\n    b_enabled,\n    b_loop,\n):\n    \"\"\"Add a broadcast, with one input.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the new broadcast.\n    :param psz_input: the input MRL.\n    :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n    :param i_options: number of additional options.\n    :param ppsz_options: additional options.\n    :param b_enabled: boolean for enabling the new broadcast.\n    :param b_loop: Should this broadcast be played in loop ?\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_add_broadcast\", None) or _Cfunction(\n        \"libvlc_vlm_add_broadcast\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_int,\n        ListPOINTER(ctypes.c_char_p),\n        ctypes.c_int,\n        ctypes.c_int,\n    )\n    return f(\n        p_instance,\n        psz_name,\n        psz_input,\n        psz_output,\n        i_options,\n        ppsz_options,\n        b_enabled,\n        b_loop,\n    )\n\n\ndef libvlc_vlm_add_input(p_instance, psz_name, psz_input):\n    \"\"\"Add a media's input MRL. This will add the specified one.\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param psz_input: the input MRL.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_add_input\", None) or _Cfunction(\n        \"libvlc_vlm_add_input\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name, psz_input)\n\n\ndef libvlc_vlm_add_vod(\n    p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux\n):\n    \"\"\"Add a vod, with one input.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the new vod media.\n    :param psz_input: the input MRL.\n    :param i_options: number of additional options.\n    :param ppsz_options: additional options.\n    :param b_enabled: boolean for enabling the new vod.\n    :param psz_mux: the muxer of the vod media.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_add_vod\", None) or _Cfunction(\n        \"libvlc_vlm_add_vod\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_int,\n        ListPOINTER(ctypes.c_char_p),\n        ctypes.c_int,\n        ctypes.c_char_p,\n    )\n    return f(\n        p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux\n    )\n\n\ndef libvlc_vlm_change_media(\n    p_instance,\n    psz_name,\n    psz_input,\n    psz_output,\n    i_options,\n    ppsz_options,\n    b_enabled,\n    b_loop,\n):\n    \"\"\"Edit the parameters of a media. This will delete all existing inputs and\n    add the specified one.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the new broadcast.\n    :param psz_input: the input MRL.\n    :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n    :param i_options: number of additional options.\n    :param ppsz_options: additional options.\n    :param b_enabled: boolean for enabling the new broadcast.\n    :param b_loop: Should this broadcast be played in loop ?\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_change_media\", None) or _Cfunction(\n        \"libvlc_vlm_change_media\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_int,\n        ListPOINTER(ctypes.c_char_p),\n        ctypes.c_int,\n        ctypes.c_int,\n    )\n    return f(\n        p_instance,\n        psz_name,\n        psz_input,\n        psz_output,\n        i_options,\n        ppsz_options,\n        b_enabled,\n        b_loop,\n    )\n\n\ndef libvlc_vlm_del_media(p_instance, psz_name):\n    \"\"\"Delete a media (VOD or broadcast).\n\n    :param p_instance: the instance.\n    :param psz_name: the media to delete.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_del_media\", None) or _Cfunction(\n        \"libvlc_vlm_del_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_vlm_get_event_manager(p_instance):\n    \"\"\"Get libvlc_event_manager from a vlm media.\n    The p_event_manager is immutable, so you don't have to hold the lock\n\n    :param p_instance: a libvlc instance.\n\n    :return: libvlc_event_manager.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_get_event_manager\", None) or _Cfunction(\n        \"libvlc_vlm_get_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_vlm_get_media_instance_length(p_instance, psz_name, i_instance):\n    \"\"\"Get vlm_media instance length by name or instance id\n\n    :param p_instance: a libvlc instance.\n    :param psz_name: name of vlm media instance.\n    :param i_instance: instance id.\n\n    :return: length of media item or -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_get_media_instance_length\", None) or _Cfunction(\n        \"libvlc_vlm_get_media_instance_length\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, i_instance)\n\n\ndef libvlc_vlm_get_media_instance_position(p_instance, psz_name, i_instance):\n    \"\"\"Get vlm_media instance position by name or instance id\n\n    :param p_instance: a libvlc instance.\n    :param psz_name: name of vlm media instance.\n    :param i_instance: instance id.\n\n    :return: position as float or -1. on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_get_media_instance_position\", None) or _Cfunction(\n        \"libvlc_vlm_get_media_instance_position\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_float,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, i_instance)\n\n\ndef libvlc_vlm_get_media_instance_rate(p_instance, psz_name, i_instance):\n    \"\"\"Get vlm_media instance playback rate by name or instance id\n\n    :param p_instance: a libvlc instance.\n    :param psz_name: name of vlm media instance.\n    :param i_instance: instance id.\n\n    :return: playback rate or -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_get_media_instance_rate\", None) or _Cfunction(\n        \"libvlc_vlm_get_media_instance_rate\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, i_instance)\n\n\ndef libvlc_vlm_get_media_instance_time(p_instance, psz_name, i_instance):\n    \"\"\"Get vlm_media instance time by name or instance id\n\n    :param p_instance: a libvlc instance.\n    :param psz_name: name of vlm media instance.\n    :param i_instance: instance id.\n\n    :return: time as integer or -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_get_media_instance_time\", None) or _Cfunction(\n        \"libvlc_vlm_get_media_instance_time\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, i_instance)\n\n\ndef libvlc_vlm_pause_media(p_instance, psz_name):\n    \"\"\"Pause the named broadcast.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the broadcast.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_pause_media\", None) or _Cfunction(\n        \"libvlc_vlm_pause_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_vlm_play_media(p_instance, psz_name):\n    \"\"\"Play the named broadcast.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the broadcast.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_play_media\", None) or _Cfunction(\n        \"libvlc_vlm_play_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_vlm_release(p_instance):\n    \"\"\"Release the vlm instance related to the given :class:`Instance`\n\n    :param p_instance: the instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_release\", None) or _Cfunction(\n        \"libvlc_vlm_release\", ((1,),), None, None, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_vlm_seek_media(p_instance, psz_name, f_percentage):\n    \"\"\"Seek in the named broadcast.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the broadcast.\n    :param f_percentage: the percentage to seek to.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_seek_media\", None) or _Cfunction(\n        \"libvlc_vlm_seek_media\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_float,\n    )\n    return f(p_instance, psz_name, f_percentage)\n\n\ndef libvlc_vlm_set_enabled(p_instance, psz_name, b_enabled):\n    \"\"\"Enable or disable a media (VOD or broadcast).\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param b_enabled: the new status.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_set_enabled\", None) or _Cfunction(\n        \"libvlc_vlm_set_enabled\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, b_enabled)\n\n\ndef libvlc_vlm_set_input(p_instance, psz_name, psz_input):\n    \"\"\"Set a media's input MRL. This will delete all existing inputs and\n    add the specified one.\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param psz_input: the input MRL.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_set_input\", None) or _Cfunction(\n        \"libvlc_vlm_set_input\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name, psz_input)\n\n\ndef libvlc_vlm_set_loop(p_instance, psz_name, b_loop):\n    \"\"\"Set a media's loop status.\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param b_loop: the new status.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_set_loop\", None) or _Cfunction(\n        \"libvlc_vlm_set_loop\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, b_loop)\n\n\ndef libvlc_vlm_set_mux(p_instance, psz_name, psz_mux):\n    \"\"\"Set a media's vod muxer.\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param psz_mux: the new muxer.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_set_mux\", None) or _Cfunction(\n        \"libvlc_vlm_set_mux\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name, psz_mux)\n\n\ndef libvlc_vlm_set_output(p_instance, psz_name, psz_output):\n    \"\"\"Set the output for a media.\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_set_output\", None) or _Cfunction(\n        \"libvlc_vlm_set_output\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name, psz_output)\n\n\ndef libvlc_vlm_show_media(p_instance, psz_name):\n    \"\"\"Return information about the named media as a JSON\n    string representation.\n\n    This function is mainly intended for debugging use,\n    if you want programmatic access to the state of\n    a vlm_media_instance_t, please use the corresponding\n    libvlc_vlm_get_media_instance_xxx -functions.\n    Currently there are no such functions available for\n    vlm_media_t though.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the media,\n        if the name is an empty string, all media is described.\n\n    :return: string with information about named media, or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_show_media\", None) or _Cfunction(\n        \"libvlc_vlm_show_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        string_result,\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_vlm_stop_media(p_instance, psz_name):\n    \"\"\"Stop the named broadcast.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the broadcast.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_stop_media\", None) or _Cfunction(\n        \"libvlc_vlm_stop_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_vprinterr(fmt, ap):\n    \"\"\"Sets the LibVLC error status and message for the current thread.\n    Any previous error is overridden.\n\n    :param fmt: the format string.\n    :param ap: the arguments.\n\n    :return: a nul terminated string in any case.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vprinterr\", None) or _Cfunction(\n        \"libvlc_vprinterr\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_void_p,\n    )\n    return f(fmt, ap)\n\n\ndef libvlc_wait(p_instance):\n    \"\"\"Waits until an interface causes the instance to exit.\n    You should start at least one interface first, using :func:`libvlc_add_intf`.\n\n    .. warning:: This function wastes one thread doing basically nothing.\n        :func:`libvlc_set_exit_handler` should be used instead.\n\n    :param p_instance: the instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_wait\", None) or _Cfunction(\n        \"libvlc_wait\", ((1,),), None, None, Instance\n    )\n    return f(p_instance)\n\n\n# End of generated functions #\n\n# End of header.py #\n\n# 34 function(s) deprecated:\n#    libvlc_audio_output_device_count\n#    libvlc_audio_output_device_id\n#    libvlc_audio_output_device_longname\n#    libvlc_audio_output_get_device_type\n#    libvlc_audio_output_set_device_type\n#    libvlc_get_log_verbosity\n#    libvlc_log_clear\n#    libvlc_log_close\n#    libvlc_log_count\n#    libvlc_log_get_iterator\n#    libvlc_log_iterator_free\n#    libvlc_log_iterator_has_next\n#    libvlc_log_iterator_next\n#    libvlc_log_open\n#    libvlc_media_discoverer_event_manager\n#    libvlc_media_discoverer_localized_name\n#    libvlc_media_discoverer_new_from_name\n#    libvlc_media_get_tracks_info\n#    libvlc_media_is_parsed\n#    libvlc_media_parse\n#    libvlc_media_parse_async\n#    libvlc_media_player_get_agl\n#    libvlc_media_player_get_fps\n#    libvlc_media_player_set_agl\n#    libvlc_playlist_play\n#    libvlc_set_log_verbosity\n#    libvlc_toggle_teletext\n#    libvlc_track_description_release\n#    libvlc_video_get_chapter_description\n#    libvlc_video_get_height\n#    libvlc_video_get_title_description\n#    libvlc_video_get_width\n#    libvlc_video_set_subtitle_file\n#    libvlc_wait\n\n# 41 function(s) not wrapped as methods:\n#    libvlc_audio_equalizer_get_band_count\n#    libvlc_audio_equalizer_get_band_frequency\n#    libvlc_audio_equalizer_get_preset_count\n#    libvlc_audio_equalizer_get_preset_name\n#    libvlc_audio_equalizer_new\n#    libvlc_audio_equalizer_new_from_preset\n#    libvlc_audio_output_device_list_release\n#    libvlc_audio_output_list_release\n#    libvlc_chapter_descriptions_release\n#    libvlc_clearerr\n#    libvlc_clock\n#    libvlc_dialog_dismiss\n#    libvlc_dialog_get_context\n#    libvlc_dialog_post_action\n#    libvlc_dialog_post_login\n#    libvlc_dialog_set_context\n#    libvlc_errmsg\n#    libvlc_event_type_name\n#    libvlc_free\n#    libvlc_get_changeset\n#    libvlc_get_compiler\n#    libvlc_get_version\n#    libvlc_log_clear\n#    libvlc_log_close\n#    libvlc_log_count\n#    libvlc_log_get_context\n#    libvlc_log_get_iterator\n#    libvlc_log_get_object\n#    libvlc_media_discoverer_list_release\n#    libvlc_media_get_codec_description\n#    libvlc_media_slaves_release\n#    libvlc_media_tracks_release\n#    libvlc_module_description_list_release\n#    libvlc_new\n#    libvlc_printerr\n#    libvlc_renderer_discoverer_list_release\n#    libvlc_title_descriptions_release\n#    libvlc_track_description_list_release\n#    libvlc_track_description_release\n#    libvlc_video_new_viewpoint\n#    libvlc_vprinterr\n# Start of footer.py #\n\n\n# Backward compatibility\ndef callbackmethod(callback):\n    \"\"\"Now obsolete ``@callbackmethod`` decorator.\"\"\"\n    return callback\n\n\n# libvlc_free is not present in some versions of libvlc. If it is not\n# in the library, then emulate it by calling libc.free\nif not hasattr(dll, \"libvlc_free\"):\n    # need to find the free function in the C runtime. This is\n    # platform specific.\n    # For Linux and MacOSX\n    libc_path = find_library(\"c\")\n    if libc_path:\n        libc = ctypes.CDLL(libc_path)\n        libvlc_free = libc.free\n    else:\n        # On win32, it is impossible to guess the proper lib to call\n        # (msvcrt, mingw...). Just ignore the call: it will memleak,\n        # but not prevent to run the application.\n        def libvlc_free(p):\n            pass\n\n    # ensure argtypes is right, because default type of int won't\n    # work on 64-bit systems\n    libvlc_free.argtypes = [ctypes.c_void_p]\n\n\n# Version functions\ndef _dot2int(v):\n    \"\"\"(INTERNAL) Convert 'i.i.i[.i]' str to int.\"\"\"\n    t = [int(i) for i in v.split(\".\")]\n    if len(t) == 3:\n        if t[2] < 100:\n            t.append(0)\n        else:  # 100 is arbitrary\n            t[2:4] = divmod(t[2], 100)\n    elif len(t) != 4:\n        raise ValueError('\"i.i.i[.i]\": %r' % (v,))\n    if min(t) < 0 or max(t) > 255:\n        raise ValueError(\"[0..255]: %r\" % (v,))\n    i = t.pop(0)\n    while t:\n        i = (i << 8) + t.pop(0)\n    return i\n\n\ndef hex_version():\n    \"\"\"Return the version of these bindings in hex or 0 if unavailable.\"\"\"\n    try:\n        return _dot2int(__version__)\n    except (NameError, ValueError):\n        return 0\n\n\ndef libvlc_hex_version():\n    \"\"\"Return the libvlc version in hex or 0 if unavailable.\"\"\"\n    try:\n        return _dot2int(bytes_to_str(libvlc_get_version()).split()[0])\n    except ValueError:\n        return 0\n\n\ndef debug_callback(event, *args, **kwds):\n    \"\"\"Example callback, useful for debugging.\"\"\"\n    l = [\"event %s\" % (event.type,)]\n    if args:\n        l.extend(map(str, args))\n    if kwds:\n        l.extend(sorted(\"%s=%s\" % t for t in kwds.items()))\n    print(\"Debug callback (%s)\" % \", \".join(l))\n\n\ndef print_python():\n    from platform import architecture, mac_ver, machine, uname, win32_ver\n\n    if \"intelpython\" in sys.executable:\n        t = \"Intel-\"\n    # elif 'PyPy ' in sys.version:\n    #     t = 'PyPy-'\n    else:\n        t = \"\"\n    t = \"%sPython: %s (%s)\" % (t, sys.version.split()[0], architecture()[0])\n    if win32_ver()[0]:\n        t = t, \"Windows\", win32_ver()[0]\n    elif mac_ver()[0]:\n        t = t, (\"iOS\" if sys.platform == \"ios\" else \"macOS\"), mac_ver()[0], machine()\n    else:\n        try:\n            import distro  # <https://github.com/nir0s/distro>\n\n            t = t, bytes_to_str(distro.name()), bytes_to_str(distro.version())\n        except ImportError:\n            t = (t,) + uname()[0:3:2]\n    print(\" \".join(t))\n\n\ndef print_version():\n    \"\"\"Print version of this vlc.py and of the libvlc\"\"\"\n    try:\n        print(\"%s: %s (%s)\" % (os.path.basename(__file__), __version__, build_date))\n        print(\n            \"libVLC: %s (%#x)\"\n            % (bytes_to_str(libvlc_get_version()), libvlc_hex_version())\n        )\n        # print('libVLC %s' % bytes_to_str(libvlc_get_compiler()))\n        if plugin_path:\n            print(\"plugins: %s\" % plugin_path)\n    except Exception:\n        print(\"Error: %s\" % sys.exc_info()[1])\n\n\nif __name__ == \"__main__\":\n    logging.basicConfig(level=logging.DEBUG)\n    try:\n        from msvcrt import getch\n    except ImportError:\n        import termios\n        import tty\n\n        def getch():  # getchar(), getc(stdin)  #PYCHOK flake\n            fd = sys.stdin.fileno()\n            old = termios.tcgetattr(fd)\n            try:\n                tty.setraw(fd)\n                ch = sys.stdin.read(1)\n            finally:\n                termios.tcsetattr(fd, termios.TCSADRAIN, old)\n            return ch\n\n    def end_callback(event):\n        print(\"End of media stream (event %s)\" % event.type)\n        sys.exit(0)\n\n    echo_position = False\n\n    def pos_callback(event, player):\n        if echo_position:\n            sys.stdout.write(\n                \"\\r%s to %.2f%% (%.2f%%)\"\n                % (event.type, event.u.new_position * 100, player.get_position() * 100)\n            )\n            sys.stdout.flush()\n\n    if \"-h\" in sys.argv[:2] or \"--help\" in sys.argv[:2]:\n        print(\"Usage: %s [options] <movie_filename>\" % sys.argv[0])\n        print(\"Once launched, type ? for help.\")\n        print(\"\")\n\n    elif \"-v\" in sys.argv[:2] or \"--version\" in sys.argv[:2]:\n        print_version()\n        print_python()\n        print(\"\")\n\n    else:\n        movie = os.path.expanduser(sys.argv.pop())\n        if not os.access(movie, os.R_OK):\n            print(\"Error: %s file not readable\" % movie)\n            sys.exit(1)\n\n        # Need --sub-source=marq in order to use marquee below\n        instance = Instance([\"--sub-source=marq\"] + sys.argv[1:])\n        try:\n            media = instance.media_new(movie)\n        except (AttributeError, NameError) as e:\n            print(\n                \"%s: %s (%s %s vs LibVLC %s)\"\n                % (\n                    e.__class__.__name__,\n                    e,\n                    sys.argv[0],\n                    __version__,\n                    libvlc_get_version(),\n                )\n            )\n            sys.exit(1)\n        player = instance.media_player_new()\n        player.set_media(media)\n        player.play()\n\n        # Some marquee examples.  Marquee requires '--sub-source marq' in the\n        # Instance() call above, see <https://www.videolan.org/doc/play-howto/en/ch04.html>\n        player.video_set_marquee_int(VideoMarqueeOption.Enable, 1)\n        player.video_set_marquee_int(VideoMarqueeOption.Size, 24)  # pixels\n        # FIXME: This crashes the module - it should be investigated\n        # player.video_set_marquee_int(VideoMarqueeOption.Position, Position.bottom)\n        if False:  # only one marquee can be specified\n            player.video_set_marquee_int(\n                VideoMarqueeOption.Timeout, 5000\n            )  # millisec, 0==forever\n            t = media.get_mrl()  # movie\n        else:  # update marquee text periodically\n            player.video_set_marquee_int(\n                VideoMarqueeOption.Timeout, 0\n            )  # millisec, 0==forever\n            player.video_set_marquee_int(\n                VideoMarqueeOption.Refresh, 1000\n            )  # millisec (or sec?)\n            ##t = '$L / $D or $P at $T'\n            t = \"%Y-%m-%d  %H:%M:%S\"\n        player.video_set_marquee_string(VideoMarqueeOption.Text, str_to_bytes(t))\n\n        # Some event manager examples.  Note, the callback can be any Python\n        # callable and does not need to be decorated.  Optionally, specify\n        # any number of positional and/or keyword arguments to be passed\n        # to the callback (in addition to the first one, an Event instance).\n        event_manager = player.event_manager()\n        event_manager.event_attach(EventType.MediaPlayerEndReached, end_callback)\n        event_manager.event_attach(\n            EventType.MediaPlayerPositionChanged, pos_callback, player\n        )\n\n        def mspf():\n            \"\"\"Milliseconds per frame\"\"\"\n            return int(1000 // (player.get_fps() or 25))\n\n        def print_info():\n            \"\"\"Print information about the media\"\"\"\n            try:\n                print_version()\n                media = player.get_media()\n                print(\"State: %s\" % player.get_state())\n                print(\"Media: %s\" % bytes_to_str(media.get_mrl()))\n                print(\n                    \"Track: %s/%s\"\n                    % (player.video_get_track(), player.video_get_track_count())\n                )\n                print(\"Current time: %s/%s\" % (player.get_time(), media.get_duration()))\n                print(\"Position: %s\" % player.get_position())\n                print(\"FPS: %s (%d ms)\" % (player.get_fps(), mspf()))\n                print(\"Rate: %s\" % player.get_rate())\n                print(\"Video size: %s\" % str(player.video_get_size(0)))  # num=0\n                print(\"Scale: %s\" % player.video_get_scale())\n                print(\"Aspect ratio: %s\" % player.video_get_aspect_ratio())\n            # print('Window:' % player.get_hwnd()\n            except Exception:\n                print(\"Error: %s\" % sys.exc_info()[1])\n\n        def sec_forward():\n            \"\"\"Go forward one sec\"\"\"\n            player.set_time(player.get_time() + 1000)\n\n        def sec_backward():\n            \"\"\"Go backward one sec\"\"\"\n            player.set_time(player.get_time() - 1000)\n\n        def frame_forward():\n            \"\"\"Go forward one frame\"\"\"\n            player.set_time(player.get_time() + mspf())\n\n        def frame_backward():\n            \"\"\"Go backward one frame\"\"\"\n            player.set_time(player.get_time() - mspf())\n\n        def print_help():\n            \"\"\"Print help\"\"\"\n            print(\"Single-character commands:\")\n            for k, m in sorted(keybindings.items()):\n                m = (m.__doc__ or m.__name__).splitlines()[0]\n                print(\"  %s: %s.\" % (k, m.rstrip(\".\")))\n            print(\"0-9: go to that fraction of the movie\")\n\n        def quit_app():\n            \"\"\"Stop and exit\"\"\"\n            sys.exit(0)\n\n        def toggle_echo_position():\n            \"\"\"Toggle echoing of media position\"\"\"\n            global echo_position\n            echo_position = not echo_position\n\n        keybindings = {\n            \" \": player.pause,\n            \"+\": sec_forward,\n            \"-\": sec_backward,\n            \".\": frame_forward,\n            \",\": frame_backward,\n            \"f\": player.toggle_fullscreen,\n            \"i\": print_info,\n            \"p\": toggle_echo_position,\n            \"q\": quit_app,\n            \"?\": print_help,\n        }\n\n        print(\"Press q to quit, ? to get help.%s\" % os.linesep)\n        while True:\n            k = getch()\n            print(\"> %s\" % k)\n            if k in keybindings:\n                keybindings[k]()\n            elif k.isdigit():\n                # jump to fraction of the movie.\n                player.set_position(float(\"0.\" + k))\n"
  },
  {
    "path": "generated/__init__.py",
    "content": ""
  },
  {
    "path": "generated/dev/vlc.py",
    "content": "#! /usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Python ctypes bindings for VLC\n#\n# Copyright (C) 2009-2017 the VideoLAN team\n# $Id: $\n#\n# Authors: Olivier Aubert <contact at olivieraubert.net>\n#          Jean Brouwers <MrJean1 at gmail.com>\n#          Geoff Salmon <geoff.salmon at gmail.com>\n#\n# This library is free software; you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License as\n# published by the Free Software Foundation; either version 2.1 of the\n# License, or (at your option) any later version.\n#\n# This library is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this library; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA\n\n\"\"\"This module provides bindings for the LibVLC public API, see\nhttp://wiki.videolan.org/LibVLC.\n\nYou can find the documentation and a README file with some examples\nat https://www.olivieraubert.net/vlc/python-ctypes/.\n\nBasically, the most important class is :class:`Instance`, which is used\nto create a libvlc instance. From this instance, you then create\n:class:`MediaPlayer` and :class:`MediaListPlayer` instances.\n\nAlternatively, you may create instances of the :class:`MediaPlayer` and\n:class:`MediaListPlayer` class directly and an instance of :class:`Instance`\nwill be implicitly created. The latter can be obtained using the\n:meth:`MediaPlayer.get_instance` and :class:`MediaListPlayer`.\n\"\"\"\n\nimport ctypes\nimport functools\n\n# Used by EventManager in override.py\nimport inspect as _inspect\nimport logging\nimport os\nimport sys\nfrom ctypes.util import find_library\n\nlogger = logging.getLogger(__name__)\n\n__version__ = \"3.0.20200\"\n__libvlc_version__ = \"3.0.20\"\n__generator_version__ = \"2.0\"\nbuild_date = \"Fri May 17 13:44:06 2024 3.0.20\"\n\n# The libvlc doc states that filenames are expected to be in UTF8, do\n# not rely on sys.getfilesystemencoding() which will be confused,\n# esp. on windows.\nDEFAULT_ENCODING = \"utf-8\"\n\nif sys.version_info[0] > 2:\n    str = str\n    unicode = str\n    bytes = bytes\n    basestring = (str, bytes)\n    PYTHON3 = True\n\n    def str_to_bytes(s):\n        \"\"\"Translate string or bytes to bytes.\"\"\"\n        if isinstance(s, str):\n            return bytes(s, DEFAULT_ENCODING)\n        else:\n            return s\n\n    def bytes_to_str(b):\n        \"\"\"Translate bytes to string.\"\"\"\n        if isinstance(b, bytes):\n            return b.decode(DEFAULT_ENCODING)\n        else:\n            return b\n\n    def len_args(func):\n        \"\"\"Return number of positional arguments.\"\"\"\n        return len(_inspect.signature(func).parameters)\n\nelse:\n    str = str\n    unicode = unicode\n    bytes = str\n    basestring = basestring\n    PYTHON3 = False\n\n    def str_to_bytes(s):\n        \"\"\"Translate string or bytes to bytes.\"\"\"\n        if isinstance(s, unicode):\n            return s.encode(DEFAULT_ENCODING)\n        else:\n            return s\n\n    def bytes_to_str(b):\n        \"\"\"Translate bytes to unicode string.\"\"\"\n        if isinstance(b, str):\n            return unicode(b, DEFAULT_ENCODING)\n        else:\n            return b\n\n    def len_args(func):\n        \"\"\"Return number of positional arguments.\"\"\"\n        return len(_inspect.getargspec(func).args)\n\n\n# Internal guard to prevent internal classes to be directly\n# instanciated.\n_internal_guard = object()\n\n\ndef find_lib():\n    dll = None\n    plugin_path = os.environ.get(\"PYTHON_VLC_MODULE_PATH\", None)\n    if \"PYTHON_VLC_LIB_PATH\" in os.environ:\n        try:\n            dll = ctypes.CDLL(os.environ[\"PYTHON_VLC_LIB_PATH\"])\n        except OSError:\n            logger.error(\n                \"Cannot load lib specified by PYTHON_VLC_LIB_PATH env. variable\"\n            )\n            sys.exit(1)\n    if plugin_path and not os.path.isdir(plugin_path):\n        logger.error(\"Invalid PYTHON_VLC_MODULE_PATH specified. Please fix.\")\n        sys.exit(1)\n    if dll is not None:\n        return dll, plugin_path\n\n    if sys.platform.startswith(\"win\"):\n        libname = \"libvlc.dll\"\n        p = find_library(libname)\n        if p is None:\n            try:  # some registry settings\n                # leaner than win32api, win32con\n                if PYTHON3:\n                    import winreg as w\n                else:\n                    import _winreg as w\n                for r in w.HKEY_LOCAL_MACHINE, w.HKEY_CURRENT_USER:\n                    try:\n                        r = w.OpenKey(r, \"Software\\\\VideoLAN\\\\VLC\")\n                        plugin_path, _ = w.QueryValueEx(r, \"InstallDir\")\n                        w.CloseKey(r)\n                        break\n                    except w.error:\n                        pass\n            except ImportError:  # no PyWin32\n                pass\n            if plugin_path is None:\n                # try some standard locations.\n                programfiles = os.environ[\"ProgramFiles\"]\n                homedir = os.environ[\"HOMEDRIVE\"]\n                for p in (\n                    \"{programfiles}\\\\VideoLan{libname}\",\n                    \"{homedir}:\\\\VideoLan{libname}\",\n                    \"{programfiles}{libname}\",\n                    \"{homedir}:{libname}\",\n                ):\n                    p = p.format(\n                        homedir=homedir,\n                        programfiles=programfiles,\n                        libname=\"\\\\VLC\\\\\" + libname,\n                    )\n                    if os.path.exists(p):\n                        plugin_path = os.path.dirname(p)\n                        break\n            if plugin_path is not None:  # try loading\n                # PyInstaller Windows fix\n                if \"PyInstallerCDLL\" in ctypes.CDLL.__name__:\n                    ctypes.windll.kernel32.SetDllDirectoryW(None)\n                p = os.getcwd()\n                os.chdir(plugin_path)\n                # if chdir failed, this will raise an exception\n                dll = ctypes.CDLL(\".\\\\\" + libname)\n                # restore cwd after dll has been loaded\n                os.chdir(p)\n            else:  # may fail\n                dll = ctypes.CDLL(\".\\\\\" + libname)\n        else:\n            plugin_path = os.path.dirname(p)\n            dll = ctypes.CDLL(p)\n\n    elif sys.platform.startswith(\"darwin\"):\n        # FIXME: should find a means to configure path\n        d = \"/Applications/VLC.app/Contents/MacOS/\"\n        c = d + \"lib/libvlccore.dylib\"\n        p = d + \"lib/libvlc.dylib\"\n        if os.path.exists(p) and os.path.exists(c):\n            # pre-load libvlccore VLC 2.2.8+\n            ctypes.CDLL(c)\n            dll = ctypes.CDLL(p)\n            for p in (\"modules\", \"plugins\"):\n                p = d + p\n                if os.path.isdir(p):\n                    plugin_path = p\n                    break\n        else:  # hope, some [DY]LD_LIBRARY_PATH is set...\n            # pre-load libvlccore VLC 2.2.8+\n            ctypes.CDLL(\"libvlccore.dylib\")\n            dll = ctypes.CDLL(\"libvlc.dylib\")\n\n    else:\n        # All other OSes (linux, freebsd...)\n        p = find_library(\"vlc\")\n        try:\n            dll = ctypes.CDLL(p)\n        except OSError:  # may fail\n            dll = None\n        if dll is None:\n            try:\n                dll = ctypes.CDLL(\"libvlc.so.5\")\n            except:\n                raise NotImplementedError(\"Cannot find libvlc lib\")\n\n    return (dll, plugin_path)\n\n\n# plugin_path used on win32 and MacOS in override.py\ndll, plugin_path = find_lib()\n\n\nclass VLCException(Exception):\n    \"\"\"Exception raised by libvlc methods.\"\"\"\n\n    pass\n\n\ntry:\n    _Ints = (int, long)\nexcept NameError:  # no long in Python 3+\n    _Ints = int\n_Seqs = (list, tuple)\n\n\n# Used for handling *event_manager() methods.\nclass memoize_parameterless(object):\n    \"\"\"Decorator. Caches a parameterless method's return value each time it is called.\n\n    If called later with the same arguments, the cached value is returned (not reevaluated).\n\n    Adapted from https://wiki.python.org/moin/PythonDecoratorLibrary.\n    \"\"\"\n\n    def __init__(self, func):\n        self.func = func\n        self._cache = {}\n\n    def __call__(self, obj):\n        try:\n            return self._cache[obj]\n        except KeyError:\n            v = self._cache[obj] = self.func(obj)\n            return v\n\n    def __repr__(self):\n        \"\"\"Return the function's docstring.\"\"\"\n        return self.func.__doc__\n\n    def __get__(self, obj, objtype):\n        \"\"\"Support instance methods.\"\"\"\n        return functools.partial(self.__call__, obj)\n\n\n# Default instance. It is used to instanciate classes directly in the\n# OO-wrapper.\n_default_instance = None\n\n\ndef get_default_instance():\n    \"\"\"Returns the default :class:`Instance`.\"\"\"\n    global _default_instance\n    if _default_instance is None:\n        _default_instance = Instance()\n    return _default_instance\n\n\ndef try_fspath(path):\n    \"\"\"Try calling ``os.fspath``.\n\n    ``os.fspath`` is only available from py3.6.\n    \"\"\"\n    try:\n        return os.fspath(path)\n    except (AttributeError, TypeError):\n        return path\n\n\n_Cfunctions = {}  # from LibVLC __version__\n_Globals = globals()  # sys.modules[__name__].__dict__\n\n\ndef _Cfunction(name, flags, errcheck, *types):\n    \"\"\"(INTERNAL) New ctypes function binding.\"\"\"\n    if hasattr(dll, name) and name in _Globals:\n        p = ctypes.CFUNCTYPE(*types)\n        f = p((name, dll), flags)\n        if errcheck is not None:\n            f.errcheck = errcheck\n        # replace the Python function\n        # in this module, but only when\n        # running as python -O or -OO\n        if __debug__:\n            _Cfunctions[name] = f\n        else:\n            _Globals[name] = f\n        return f\n    raise NameError(\"no function %r\" % (name,))\n\n\ndef _Cobject(cls, ctype):\n    \"\"\"(INTERNAL) New instance from ctypes.\"\"\"\n    o = object.__new__(cls)\n    o._as_parameter_ = ctype\n    return o\n\n\ndef _Constructor(cls, ptr=_internal_guard):\n    \"\"\"(INTERNAL) New wrapper from ctypes.\"\"\"\n    if ptr == _internal_guard:\n        raise VLCException(\n            \"(INTERNAL) ctypes class. You should get references for this class through methods of the LibVLC API.\"\n        )\n    if ptr is None or ptr == 0:\n        return None\n    return _Cobject(cls, ctypes.c_void_p(ptr))\n\n\nclass _Cstruct(ctypes.Structure):\n    \"\"\"(INTERNAL) Base class for ctypes structures.\"\"\"\n\n    _fields_ = []  # list of 2-tuples ('name', ctypes.<type>)\n\n    def __str__(self):\n        l = [\" %s:\\t%s\" % (n, getattr(self, n)) for n, _ in self._fields_]\n        return \"\\n\".join([self.__class__.__name__] + l)\n\n    def __repr__(self):\n        return \"%s.%s\" % (self.__class__.__module__, self)\n\n\nclass _Ctype(object):\n    \"\"\"(INTERNAL) Base class for ctypes.\"\"\"\n\n    @staticmethod\n    def from_param(this):  # not self\n        \"\"\"(INTERNAL) ctypes parameter conversion method.\"\"\"\n        if this is None:\n            return None\n        return this._as_parameter_\n\n\nclass ListPOINTER(object):\n    \"\"\"Just like a POINTER but accept a list of etype elements as an argument.\"\"\"\n\n    def __init__(self, etype):\n        self.etype = etype\n\n    def from_param(self, param):\n        if isinstance(param, _Seqs):\n            return (self.etype * len(param))(*param)\n        else:\n            return ctypes.POINTER(param)\n\n\n# errcheck functions for some native functions.\ndef string_result(result, func, arguments):\n    \"\"\"Errcheck function. Returns a string and frees the original pointer.\n\n    It assumes the result is a ``char*``.\n    \"\"\"\n    if result:\n        # make a python string copy\n        s = bytes_to_str(ctypes.string_at(result))\n        # free original string ptr\n        libvlc_free(result)\n        return s\n    return None\n\n\ndef class_result(classname):\n    \"\"\"Errcheck function. Returns a function that creates the specified class.\"\"\"\n\n    def wrap_errcheck(result, func, arguments):\n        if result is None:\n            return None\n        return classname(result)\n\n    return wrap_errcheck\n\n\n# Wrapper for the opaque struct libvlc_log_t\nclass Log(ctypes.Structure):\n    pass\n\n\nLog_ptr = ctypes.POINTER(Log)\n\n\n# Wrapper for the opaque struct libvlc_media_thumbnail_request_t\nclass MediaThumbnailRequest:\n    def __new__(cls, *args):\n        if len(args) == 1 and isinstance(args[0], _Ints):\n            return _Constructor(cls, args[0])\n\n\n# FILE* ctypes wrapper, copied from\n# http://svn.python.org/projects/ctypes/trunk/ctypeslib/ctypeslib/contrib/pythonhdr.py\nclass FILE(ctypes.Structure):\n    pass\n\n\nFILE_ptr = ctypes.POINTER(FILE)\n\nif PYTHON3:\n    PyFile_FromFd = ctypes.pythonapi.PyFile_FromFd\n    PyFile_FromFd.restype = ctypes.py_object\n    PyFile_FromFd.argtypes = [\n        ctypes.c_int,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_int,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    ]\n\n    PyFile_AsFd = ctypes.pythonapi.PyObject_AsFileDescriptor\n    PyFile_AsFd.restype = ctypes.c_int\n    PyFile_AsFd.argtypes = [ctypes.py_object]\nelse:\n    PyFile_FromFile = ctypes.pythonapi.PyFile_FromFile\n    PyFile_FromFile.restype = ctypes.py_object\n    PyFile_FromFile.argtypes = [\n        FILE_ptr,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.CFUNCTYPE(ctypes.c_int, FILE_ptr),\n    ]\n\n    PyFile_AsFile = ctypes.pythonapi.PyFile_AsFile\n    PyFile_AsFile.restype = FILE_ptr\n    PyFile_AsFile.argtypes = [ctypes.py_object]\n\n\ndef module_description_list(head):\n    \"\"\"Convert a ModuleDescription linked list to a Python list (and release the former).\"\"\"\n    r = []\n    if head:\n        item = head\n        while item:\n            item = item.contents\n            r.append((item.name, item.shortname, item.longname, item.help))\n            item = item.next\n        libvlc_module_description_list_release(head)\n    return r\n\n\ndef track_description_list(head):\n    \"\"\"Convert a TrackDescription linked list to a Python list (and release the former).\"\"\"\n    r = []\n    if head:\n        item = head\n        while item:\n            item = item.contents\n            r.append((item.id, item.name))\n            item = item.next\n        try:\n            libvlc_track_description_release(head)\n        except NameError:\n            libvlc_track_description_list_release(head)\n\n    return r\n\n\nclass _Enum(ctypes.c_uint):\n    \"\"\"(INTERNAL) Base class\"\"\"\n\n    _enum_names_ = {}\n\n    def __str__(self):\n        n = self._enum_names_.get(self.value, \"\") or (\"FIXME_(%r)\" % (self.value,))\n        return \".\".join((self.__class__.__name__, n))\n\n    def __hash__(self):\n        return self.value\n\n    def __repr__(self):\n        return \".\".join((self.__class__.__module__, self.__str__()))\n\n    def __eq__(self, other):\n        return (isinstance(other, _Enum) and self.value == other.value) or (\n            isinstance(other, _Ints) and self.value == other\n        )\n\n    def __ne__(self, other):\n        return not self.__eq__(other)\n\n\n# Generated wrappers #\nclass AudioEqualizer(_Ctype):\n    \"\"\"Create a new default equalizer, with all frequency values zeroed.\n\n    The new equalizer can subsequently be applied to a media player by invoking\n    :meth:`MediaPlayer.set_equalizer`.\n\n    The returned handle should be freed via :meth:`release` when\n    it is no longer needed.\n\n    \"\"\"\n\n    def __new__(cls, *args):\n        if len(args) == 1 and isinstance(args[0], _Ints):\n            return _Constructor(cls, args[0])\n        return libvlc_audio_equalizer_new()\n\n    def get_amp_at_index(self, u_band):\n        \"\"\"Get the amplification value for a particular equalizer frequency band.\n\n        :param u_band: index, counting from zero, of the frequency band to get.\n\n        :return: amplification value (Hz); NaN if there is no such frequency band.\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_equalizer_get_amp_at_index(self, u_band)\n\n    def get_preamp(self):\n        \"\"\"Get the current pre-amplification value from an equalizer.\n\n        :return: preamp value (Hz).\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_equalizer_get_preamp(self)\n\n    def release(self):\n        \"\"\"Release a previously created equalizer instance.\n\n        The equalizer was previously created by using :func:`new` or\n        :func:`new_from_preset`.\n\n        It is safe to invoke this method with a None *p_equalizer* parameter for no effect.\n\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_equalizer_release(self)\n\n    def set_amp_at_index(self, f_amp, u_band):\n        \"\"\"Set a new amplification value for a particular equalizer frequency band.\n\n        The new equalizer settings are subsequently applied to a media player by invoking\n        :func:`media_player_set_equalizer`.\n\n        The supplied amplification value will be clamped to the -20.0 to +20.0 range.\n\n        :param f_amp: amplification value (-20.0 to 20.0 Hz).\n        :param u_band: index, counting from zero, of the frequency band to set.\n\n        :return: zero on success, -1 on error.\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_equalizer_set_amp_at_index(self, f_amp, u_band)\n\n    def set_preamp(self, f_preamp):\n        \"\"\"Set a new pre-amplification value for an equalizer.\n\n        The new equalizer settings are subsequently applied to a media player by invoking\n        :func:`media_player_set_equalizer`.\n\n        The supplied amplification value will be clamped to the -20.0 to +20.0 range.\n\n        :param f_preamp: preamp value (-20.0 to 20.0 Hz).\n\n        :return: zero on success, -1 on error.\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_equalizer_set_preamp(self, f_preamp)\n\n\nclass EventManager(_Ctype):\n    \"\"\"Create an event manager with callback handler.\n\n    This class interposes the registration and handling of\n    event notifications in order to (a) remove the need for\n    decorating each callback functions with the decorator\n    ``@callbackmethod``, (b) allow any number of positional\n    and/or keyword arguments to the callback (in addition\n    to the :class:`Event` instance) and (c) to preserve the Python\n    objects such that the callback and argument objects\n    remain alive (i.e. are not garbage collected) until\n    **after** the notification has been unregistered.\n\n    .. note::\n        Only a single notification can be registered\n        for each event type in an :class:`EventManager` instance.\n\n    \"\"\"\n\n    _callback_handler = None\n    _callbacks = {}\n\n    def __new__(cls, ptr=_internal_guard):\n        if ptr == _internal_guard:\n            raise VLCException(\n                \"(INTERNAL) ctypes class.\\nYou should get a reference to EventManager through the MediaPlayer.event_manager() method.\"\n            )\n        return _Constructor(cls, ptr)\n\n    def event_attach(self, eventtype, callback, *args, **kwds):\n        \"\"\"Register an event notification.\n\n        :param eventtype: the desired event type to be notified about.\n        :param callback: the function to call when the event occurs.\n        :param args: optional positional arguments for the callback.\n        :param kwds: optional keyword arguments for the callback.\n\n        :return: 0 on success, ENOMEM on error.\n\n        .. note::\n            The callback function must have at least one argument,\n            an :class:`Event` instance. Any other, optional positional and keyword\n            arguments are in **addition** to the first one.\n\n        .. warning::\n            LibVLC is not reentrant, i.e. you cannot call libvlc functions from an event handler.\n            They must be called from the main application thread.\n        \"\"\"\n        if not isinstance(eventtype, EventType):\n            raise VLCException(\"%s required: %r\" % (\"EventType\", eventtype))\n        if not hasattr(callback, \"__call__\"):  # callable()\n            raise VLCException(\"%s required: %r\" % (\"callable\", callback))\n        # check that the callback expects arguments\n        if len_args(callback) < 1:  # list(...)\n            raise VLCException(\"%s required: %r\" % (\"argument\", callback))\n\n        if self._callback_handler is None:\n            _called_from_ctypes = ctypes.CFUNCTYPE(\n                None, ctypes.POINTER(Event), ctypes.c_void_p\n            )\n\n            @_called_from_ctypes\n            def _callback_handler(event, k):\n                \"\"\"(INTERNAL) handle callback call from ctypes.\n\n                .. note::\n                    We cannot simply make this an :class:`EventManager`\n                    method since ctypes does not prepend self as the\n                    first parameter, hence this closure.\n                \"\"\"\n                try:  # retrieve Python callback and arguments\n                    call, args, kwds = self._callbacks[k]\n                except KeyError:  # detached?\n                    pass\n                else:\n                    # deref event.contents to simplify callback code\n                    call(event.contents, *args, **kwds)\n\n            self._callback_handler = _callback_handler\n            self._callbacks = {}\n\n        k = eventtype.value\n        r = libvlc_event_attach(self, k, self._callback_handler, k)\n        if not r:\n            self._callbacks[k] = (callback, args, kwds)\n        return r\n\n    def event_detach(self, eventtype):\n        \"\"\"Unregister an event notification.\n\n        :param eventtype: the event type notification to be removed.\n        \"\"\"\n        if not isinstance(eventtype, EventType):\n            raise VLCException(\"%s required: %r\" % (\"EventType\", eventtype))\n\n        k = eventtype.value\n        if k in self._callbacks:\n            del self._callbacks[k]  # remove, regardless of libvlc return value\n            libvlc_event_detach(self, k, self._callback_handler, k)\n\n\nclass Instance(_Ctype):\n    \"\"\"It may take as parameter either:\n\n    * a string\n    * a list of strings as first parameters\n    * the parameters given as the constructor parameters (must be strings)\n\n    \"\"\"\n\n    def __new__(cls, *args):\n        if len(args) == 1:\n            # Only 1 arg. It is either a C pointer, or an arg string,\n            # or a tuple.\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            elif isinstance(i, basestring):\n                args = i.strip().split()\n            elif isinstance(i, _Seqs):\n                args = list(i)\n            else:\n                raise VLCException(\"Instance %r\" % (args,))\n        else:\n            args = list(args)\n\n        if not args:  # no parameters passed\n            args = [\"vlc\"]\n        elif args[0] != \"vlc\":\n            args.insert(0, \"vlc\")\n\n        if plugin_path is not None:\n            # set plugin_path if detected, win32 and MacOS,\n            # if the user did not specify it itself.\n            os.environ.setdefault(\"VLC_PLUGIN_PATH\", plugin_path)\n\n        if PYTHON3:\n            args = [str_to_bytes(a) for a in args]\n        return libvlc_new(len(args), args)\n\n    def media_player_new(self, uri=None):\n        \"\"\"Create a new :class:`MediaPlayer` instance.\n\n        :param uri: an optional URI to play in the player as a str, bytes or PathLike object.\n        \"\"\"\n        p = libvlc_media_player_new(self)\n        if uri:\n            p.set_media(self.media_new(uri))\n        p._instance = self\n        return p\n\n    def media_list_player_new(self):\n        \"\"\"Create a new :class:`MediaListPlayer` instance.\"\"\"\n        p = libvlc_media_list_player_new(self)\n        p._instance = self\n        return p\n\n    def media_new(self, mrl, *options):\n        \"\"\"Create a new :class:`Media` instance.\n\n        If mrl contains a colon (:) preceded by more than 1 letter, it\n        will be treated as a URL. Else, it will be considered as a\n        local path. If you need more control, directly use\n        :meth:`media_new_location` or :meth:`media_new_path`.\n\n        Options can be specified as supplementary string parameters,\n        but note that many options cannot be set at the media level,\n        and rather at the :class:`Instance` level. For instance, the marquee\n        filter must be specified when creating the :class:`Instance` or\n        :class:`MediaPlayer`.\n\n        Alternatively, options can be added to the media using the\n        :meth:`Media.add_options` method (with the same limitation).\n\n        :param mrl: A str, bytes or PathLike object\n        :param options: optional media option=value strings\n        \"\"\"\n        mrl = try_fspath(mrl)\n        if \":\" in mrl and mrl.index(\":\") > 1:\n            # Assume it is a URL\n            m = libvlc_media_new_location(self, str_to_bytes(mrl))\n        else:\n            # Else it should be a local path.\n            m = libvlc_media_new_path(self, str_to_bytes(os.path.normpath(mrl)))\n        for o in options:\n            libvlc_media_add_option(m, str_to_bytes(o))\n        m._instance = self\n        return m\n\n    def media_new_path(self, path):\n        \"\"\"Create a media for a certain file path. See :meth:`media_release`.\n\n        :param path: A str, byte, or PathLike object representing a local filesystem path.\n\n        :return: the newly created media or None on error.\n        \"\"\"\n        path = try_fspath(path)\n        return libvlc_media_new_path(self, str_to_bytes(path))\n\n    def media_list_new(self, mrls=None):\n        \"\"\"Create a new :class:`MediaList` instance.\n\n        :param mrls: optional list of MRL strings, bytes, or PathLike objects.\n        \"\"\"\n        # API 3 vs 4: libvlc_media_list_new does not take any\n        # parameter as input anymore.\n        if len_args(libvlc_media_list_new) == 1:  # API <= 3\n            l = libvlc_media_list_new(self)\n        else:  # API >= 4\n            l = libvlc_media_list_new()\n        # We should take the lock, but since we did not leak the\n        # reference, nobody else can access it.\n        if mrls:\n            for m in mrls:\n                l.add_media(m)\n        l._instance = self\n        return l\n\n    def audio_output_enumerate_devices(self):\n        \"\"\"Enumerate the defined audio output devices.\n\n        :return: list of dicts {name:, description:, devices:}\n        \"\"\"\n        r = []\n        head = libvlc_audio_output_list_get(self)\n        if head:\n            i = head\n            while i:\n                i = i.contents\n                r.append({\"name\": i.name, \"description\": i.description})\n                i = i.next\n            libvlc_audio_output_list_release(head)\n        return r\n\n    def audio_filter_list_get(self):\n        \"\"\"Returns a list of available audio filters.\"\"\"\n        return module_description_list(libvlc_audio_filter_list_get(self))\n\n    def video_filter_list_get(self):\n        \"\"\"Returns a list of available video filters.\"\"\"\n        return module_description_list(libvlc_video_filter_list_get(self))\n\n    def add_intf(self, name):\n        \"\"\"Try to start a user interface for the libvlc instance.\n\n        :param name: interface name, or None for default.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_add_intf(self, str_to_bytes(name))\n\n    def audio_output_device_count(self, psz_audio_output):\n        \"\"\"Backward compatibility stub. Do not use in new code.\n\n        .. warning:: **Deprecated!** Use :func:`audio_output_device_list_get` instead.\n\n        :return: always 0.\n        \"\"\"\n        return libvlc_audio_output_device_count(self, str_to_bytes(psz_audio_output))\n\n    def audio_output_device_id(self, psz_audio_output, i_device):\n        \"\"\"Backward compatibility stub. Do not use in new code.\n\n        .. warning:: **Deprecated!** Use :func:`audio_output_device_list_get` instead.\n\n        :return: always None.\n        \"\"\"\n        return libvlc_audio_output_device_id(\n            self, str_to_bytes(psz_audio_output), i_device\n        )\n\n    def audio_output_device_list_get(self, aout):\n        \"\"\"Gets a list of audio output devices for a given audio output module,\n        :func:`audio_output_device_set`.\n\n        .. note:: Not all audio outputs support this. In particular, an empty (None)\n            list of devices does **not** imply that the specified audio output does\n            not work.\n\n        .. note:: The list might not be exhaustive.\n\n        .. warning:: Some audio output devices in the list might not actually work in\n            some circumstances. By default, it is recommended to not specify any\n            explicit audio device.\n\n        :param aout: audio output name.\n            (as returned by libvlc_audio_output_list_get).\n\n        :return: A None-terminated linked list of potential audio output devices.\n            It must be freed with :func:`audio_output_device_list_release`.\n        :version: LibVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_audio_output_device_list_get(self, str_to_bytes(aout))\n\n    def audio_output_device_longname(self, psz_output, i_device):\n        \"\"\"Backward compatibility stub. Do not use in new code.\n\n        .. warning:: **Deprecated!** Use :func:`audio_output_device_list_get` instead.\n\n        :return: always None.\n        \"\"\"\n        return libvlc_audio_output_device_longname(\n            self, str_to_bytes(psz_output), i_device\n        )\n\n    def audio_output_list_get(self):\n        \"\"\"Gets the list of available audio output modules.\n\n        :return: list of available audio outputs. It must be freed with.\n            :func:`audio_output_list_release` :class:`AudioOutput` .\n            In case of error, None is returned.\n        \"\"\"\n        return libvlc_audio_output_list_get(self)\n\n    def dialog_set_callbacks(self, p_cbs, p_data):\n        \"\"\"Register callbacks in order to handle VLC dialogs\n\n        :param p_data: opaque pointer for the callback.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_dialog_set_callbacks(self, p_cbs, p_data)\n\n    def get_log_verbosity(self):\n        \"\"\"Always returns minus one.\n        This function is only provided for backward compatibility.\n\n        :return: always -1.\n        \"\"\"\n        return libvlc_get_log_verbosity(self)\n\n    def log_open(self):\n        \"\"\"This function does nothing useful.\n        It is only provided for backward compatibility.\n\n        :return: an unique pointer or None on error.\n        \"\"\"\n        return libvlc_log_open(self)\n\n    def log_set(self, cb, data):\n        \"\"\"Sets the logging callback for a LibVLC instance.\n\n        This function is thread-safe: it will wait for any pending callbacks\n        invocation to complete.\n\n        .. note:: Some log messages (especially debug) are emitted by LibVLC while\n            is being initialized. These messages cannot be captured with this interface.\n\n        .. warning:: A deadlock may occur if this function is called from the callback.\n\n        :param data: opaque data pointer for the callback function.\n\n        :param p_instance: libvlc instance.\n\n        :version: LibVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_log_set(self, cb, data)\n\n    def log_set_file(self, stream):\n        \"\"\"Sets up logging to a file.\n\n        :param stream: FILE pointer opened for writing.\n            (the FILE pointer must remain valid until libvlc_log_unset).\n\n        :version: LibVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_log_set_file(self, stream)\n\n    def log_unset(self):\n        \"\"\"Unsets the logging callback.\n\n        This function deregisters the logging callback for a LibVLC instance.\n        This is rarely needed as the callback is implicitly unset when the instance\n        is destroyed.\n\n        .. note:: This function will wait for any pending callbacks invocation to\n            complete (causing a deadlock if called from within the callback).\n\n        :version: LibVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_log_unset(self)\n\n    def media_discoverer_list_get(self, i_cat, ppp_services):\n        \"\"\"Get media discoverer services by category\n\n        :param i_cat: category of services to fetch.\n        :param ppp_services: address to store an allocated array of media discoverer.\n            services (must be freed with :func:`media_discoverer_list_release` by.\n            the caller) [OUT].\n\n        :return: the number of media discoverer services (0 on error).\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_discoverer_list_get(self, i_cat, ppp_services)\n\n    def media_discoverer_new(self, psz_name):\n        \"\"\"Create a media discoverer object by name.\n\n        After this object is created, you should attach to media_list events in\n        order to be notified of new items discovered.\n\n        You need to call :func:`media_discoverer_start` in order to start the\n        discovery.\n\n        :func:`media_discoverer_media_list`\n        :func:`media_discoverer_event_manager`\n        :func:`media_discoverer_start`\n\n        :param psz_name: service name; use :func:`media_discoverer_list_get` to get.\n            a list of the discoverer names available in this libVLC instance.\n\n        :return: media discover object or None in case of error.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_discoverer_new(self, str_to_bytes(psz_name))\n\n    def media_discoverer_new_from_name(self, psz_name):\n        \"\"\".. warning:: **Deprecated!** Use :func:`media_discoverer_new` and :func:`media_discoverer_start`.\"\"\"\n        return libvlc_media_discoverer_new_from_name(self, str_to_bytes(psz_name))\n\n    def media_library_new(self):\n        \"\"\"Create an new Media Library object\n\n        :return: a new object or None on error.\n        \"\"\"\n        return libvlc_media_library_new(self)\n\n    def media_new_as_node(self, psz_name):\n        \"\"\"Create a media as an empty node with a given name.\n\n        :func:`media_release`\n\n        :param psz_name: the name of the node.\n\n        :return: the new empty media or None on error.\n        \"\"\"\n        return libvlc_media_new_as_node(self, str_to_bytes(psz_name))\n\n    def media_new_callbacks(self, open_cb, read_cb, seek_cb, close_cb, opaque):\n        \"\"\"Create a media with custom callbacks to read the data from.\n\n        .. note:: If *open_cb* is None, the *opaque* pointer will be passed to *read_cb*,\n            *seek_cb* and *close_cb*, and the stream size will be treated as unknown.\n\n        .. note:: The callbacks may be called asynchronously (from another thread).\n            A single stream *instance* need not be reentrant. However the *open_cb* needs to\n            be reentrant if the media is used by multiple player instances.\n\n        .. warning:: The callbacks may be used until all or any player instances\n            that were supplied the media item are stopped.\n\n        :func:`media_release`\n\n        :param open_cb: callback to open the custom bitstream input media.\n        :param read_cb: callback to read data (must not be None).\n        :param seek_cb: callback to seek, or None if seeking is not supported.\n        :param close_cb: callback to close the media, or None if unnecessary.\n        :param opaque: data pointer for the open callback.\n\n        :return: the newly created media or None on error.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_new_callbacks(\n            self, open_cb, read_cb, seek_cb, close_cb, opaque\n        )\n\n    def media_new_fd(self, fd):\n        \"\"\"Create a media for an already open file descriptor.\n        The file descriptor shall be open for reading (or reading and writing).\n\n        Regular file descriptors, pipe read descriptors and character device\n        descriptors (including TTYs) are supported on all platforms.\n        Block device descriptors are supported where available.\n        Directory descriptors are supported on systems that provide fdopendir().\n        Sockets are supported on all platforms where they are file descriptors,\n        i.e. all except Windows.\n\n        .. note:: This library will **not** automatically close the file descriptor\n            under any circumstance. Nevertheless, a file descriptor can usually only be\n            rendered once in a media player. To render it a second time, the file\n            descriptor should probably be rewound to the beginning with lseek().\n\n        :func:`media_release`\n\n        :param fd: open file descriptor.\n\n        :return: the newly created media or None on error.\n        :version: LibVLC 1.1.5 and later.\n        \"\"\"\n        return libvlc_media_new_fd(self, fd)\n\n    def media_new_location(self, psz_mrl):\n        \"\"\"Create a media with a certain given media resource location,\n        for instance a valid URL.\n\n        .. note:: To refer to a local file with this function,\n            the file://... URI syntax **must** be used (see IETF RFC3986).\n            We recommend using :func:`media_new_path` instead when dealing with\n            local files.\n\n        :func:`media_release`\n\n        :param psz_mrl: the media location.\n\n        :return: the newly created media or None on error.\n        \"\"\"\n        return libvlc_media_new_location(self, str_to_bytes(psz_mrl))\n\n    def playlist_play(self, i_id, i_options, ppsz_options):\n        \"\"\"Start playing (if there is any item in the playlist).\n\n        Additionnal playlist item options can be specified for addition to the\n        item before it is played.\n\n        :param i_id: the item to play. If this is a negative number, the next.\n            item will be selected. Otherwise, the item with the given ID will be.\n            played.\n        :param i_options: the number of options to add to the item.\n        :param ppsz_options: the options to add to the item.\n        \"\"\"\n        return libvlc_playlist_play(self, i_id, i_options, ppsz_options)\n\n    def release(self):\n        \"\"\"Decrement the reference count of a libvlc instance, and destroy it\n        if it reaches zero.\n        \"\"\"\n        return libvlc_release(self)\n\n    def renderer_discoverer_list_get(self, ppp_services):\n        \"\"\"Get media discoverer services\n\n        libvlc_renderer_list_release\n\n        :param ppp_services: address to store an allocated array of renderer.\n            discoverer services (must be freed with libvlc_renderer_list_release by.\n            the caller) [OUT].\n\n        :return: the number of media discoverer services (0 on error).\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_renderer_discoverer_list_get(self, ppp_services)\n\n    def renderer_discoverer_new(self, psz_name):\n        \"\"\"Create a renderer discoverer object by name\n\n        After this object is created, you should attach to events in order to be\n        notified of the discoverer events.\n\n        You need to call :func:`renderer_discoverer_start` in order to start the\n        discovery.\n\n        :func:`renderer_discoverer_event_manager`\n        :func:`renderer_discoverer_start`\n\n        :param psz_name: service name; use :func:`renderer_discoverer_list_get` to.\n            get a list of the discoverer names available in this libVLC instance.\n\n        :return: media discover object or None in case of error.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_discoverer_new(self, str_to_bytes(psz_name))\n\n    def retain(self):\n        \"\"\"Increments the reference count of a libvlc instance.\n        The initial reference count is 1 after :func:`new` returns.\n        \"\"\"\n        return libvlc_retain(self)\n\n    def set_app_id(self, id, version, icon):\n        \"\"\"Sets some meta-information about the application.\n        See also :func:`set_user_agent`.\n\n        :param id: Java-style application identifier, e.g. \"com.acme.foobar\".\n        :param version: application version numbers, e.g. \"1.2.3\".\n        :param icon: application icon name, e.g. \"foobar\".\n\n        :version: LibVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_set_app_id(\n            self, str_to_bytes(id), str_to_bytes(version), str_to_bytes(icon)\n        )\n\n    def set_exit_handler(self, cb, opaque):\n        \"\"\"Registers a callback for the LibVLC exit event. This is mostly useful if\n        the VLC playlist and/or at least one interface are started with\n        :func:`playlist_play` or :func:`add_intf` respectively.\n        Typically, this function will wake up your application main loop (from\n        another thread).\n\n        .. note:: This function should be called before the playlist or interface are\n            started. Otherwise, there is a small race condition: the exit event could\n            be raised before the handler is registered.\n\n        .. warning:: This function and :func:`wait` cannot be used at the same time.\n\n        :param cb: callback to invoke when LibVLC wants to exit,\n            or None to disable the exit handler (as by default).\n        :param opaque: data pointer for the callback.\n        \"\"\"\n        return libvlc_set_exit_handler(self, cb, opaque)\n\n    def set_log_verbosity(self, level):\n        \"\"\"This function does nothing.\n        It is only provided for backward compatibility.\n\n        :param level: ignored.\n        \"\"\"\n        return libvlc_set_log_verbosity(self, level)\n\n    def set_user_agent(self, name, http):\n        \"\"\"Sets the application *name*. LibVLC passes this as the user agent string\n        when a protocol requires it.\n\n        :param name: human-readable application name, e.g. \"FooBar player 1.2.3\".\n        :param http: HTTP User Agent, e.g. \"FooBar/1.2.3 Python/2.6.0\".\n\n        :version: LibVLC 1.1.1 or later.\n        \"\"\"\n        return libvlc_set_user_agent(self, str_to_bytes(name), str_to_bytes(http))\n\n    def vlm_add_broadcast(\n        self,\n        psz_name,\n        psz_input,\n        psz_output,\n        i_options,\n        ppsz_options,\n        b_enabled,\n        b_loop,\n    ):\n        \"\"\"Add a broadcast, with one input.\n\n        :param psz_name: the name of the new broadcast.\n        :param psz_input: the input MRL.\n        :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n        :param i_options: number of additional options.\n        :param ppsz_options: additional options.\n        :param b_enabled: boolean for enabling the new broadcast.\n        :param b_loop: Should this broadcast be played in loop ?\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_add_broadcast(\n            self,\n            str_to_bytes(psz_name),\n            str_to_bytes(psz_input),\n            str_to_bytes(psz_output),\n            i_options,\n            ppsz_options,\n            b_enabled,\n            b_loop,\n        )\n\n    def vlm_add_input(self, psz_name, psz_input):\n        \"\"\"Add a media's input MRL. This will add the specified one.\n\n        :param psz_name: the media to work on.\n        :param psz_input: the input MRL.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_add_input(\n            self, str_to_bytes(psz_name), str_to_bytes(psz_input)\n        )\n\n    def vlm_add_vod(\n        self, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux\n    ):\n        \"\"\"Add a vod, with one input.\n\n        :param psz_name: the name of the new vod media.\n        :param psz_input: the input MRL.\n        :param i_options: number of additional options.\n        :param ppsz_options: additional options.\n        :param b_enabled: boolean for enabling the new vod.\n        :param psz_mux: the muxer of the vod media.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_add_vod(\n            self,\n            str_to_bytes(psz_name),\n            str_to_bytes(psz_input),\n            i_options,\n            ppsz_options,\n            b_enabled,\n            str_to_bytes(psz_mux),\n        )\n\n    def vlm_change_media(\n        self,\n        psz_name,\n        psz_input,\n        psz_output,\n        i_options,\n        ppsz_options,\n        b_enabled,\n        b_loop,\n    ):\n        \"\"\"Edit the parameters of a media. This will delete all existing inputs and\n        add the specified one.\n\n        :param psz_name: the name of the new broadcast.\n        :param psz_input: the input MRL.\n        :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n        :param i_options: number of additional options.\n        :param ppsz_options: additional options.\n        :param b_enabled: boolean for enabling the new broadcast.\n        :param b_loop: Should this broadcast be played in loop ?\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_change_media(\n            self,\n            str_to_bytes(psz_name),\n            str_to_bytes(psz_input),\n            str_to_bytes(psz_output),\n            i_options,\n            ppsz_options,\n            b_enabled,\n            b_loop,\n        )\n\n    def vlm_del_media(self, psz_name):\n        \"\"\"Delete a media (VOD or broadcast).\n\n        :param psz_name: the media to delete.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_del_media(self, str_to_bytes(psz_name))\n\n    @memoize_parameterless\n    def vlm_get_event_manager(self):\n        \"\"\"Get libvlc_event_manager from a vlm media.\n        The p_event_manager is immutable, so you don't have to hold the lock\n\n        :return: libvlc_event_manager.\n        \"\"\"\n        return libvlc_vlm_get_event_manager(self)\n\n    def vlm_get_media_instance_length(self, psz_name, i_instance):\n        \"\"\"Get vlm_media instance length by name or instance id\n\n        :param psz_name: name of vlm media instance.\n        :param i_instance: instance id.\n\n        :return: length of media item or -1 on error.\n        \"\"\"\n        return libvlc_vlm_get_media_instance_length(\n            self, str_to_bytes(psz_name), i_instance\n        )\n\n    def vlm_get_media_instance_position(self, psz_name, i_instance):\n        \"\"\"Get vlm_media instance position by name or instance id\n\n        :param psz_name: name of vlm media instance.\n        :param i_instance: instance id.\n\n        :return: position as float or -1. on error.\n        \"\"\"\n        return libvlc_vlm_get_media_instance_position(\n            self, str_to_bytes(psz_name), i_instance\n        )\n\n    def vlm_get_media_instance_rate(self, psz_name, i_instance):\n        \"\"\"Get vlm_media instance playback rate by name or instance id\n\n        :param psz_name: name of vlm media instance.\n        :param i_instance: instance id.\n\n        :return: playback rate or -1 on error.\n        \"\"\"\n        return libvlc_vlm_get_media_instance_rate(\n            self, str_to_bytes(psz_name), i_instance\n        )\n\n    def vlm_get_media_instance_time(self, psz_name, i_instance):\n        \"\"\"Get vlm_media instance time by name or instance id\n\n        :param psz_name: name of vlm media instance.\n        :param i_instance: instance id.\n\n        :return: time as integer or -1 on error.\n        \"\"\"\n        return libvlc_vlm_get_media_instance_time(\n            self, str_to_bytes(psz_name), i_instance\n        )\n\n    def vlm_pause_media(self, psz_name):\n        \"\"\"Pause the named broadcast.\n\n        :param psz_name: the name of the broadcast.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_pause_media(self, str_to_bytes(psz_name))\n\n    def vlm_play_media(self, psz_name):\n        \"\"\"Play the named broadcast.\n\n        :param psz_name: the name of the broadcast.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_play_media(self, str_to_bytes(psz_name))\n\n    def vlm_release(self):\n        \"\"\"Release the vlm instance related to the given :class:`Instance`\"\"\"\n        return libvlc_vlm_release(self)\n\n    def vlm_seek_media(self, psz_name, f_percentage):\n        \"\"\"Seek in the named broadcast.\n\n        :param psz_name: the name of the broadcast.\n        :param f_percentage: the percentage to seek to.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_seek_media(self, str_to_bytes(psz_name), f_percentage)\n\n    def vlm_set_enabled(self, psz_name, b_enabled):\n        \"\"\"Enable or disable a media (VOD or broadcast).\n\n        :param psz_name: the media to work on.\n        :param b_enabled: the new status.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_set_enabled(self, str_to_bytes(psz_name), b_enabled)\n\n    def vlm_set_input(self, psz_name, psz_input):\n        \"\"\"Set a media's input MRL. This will delete all existing inputs and\n        add the specified one.\n\n        :param psz_name: the media to work on.\n        :param psz_input: the input MRL.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_set_input(\n            self, str_to_bytes(psz_name), str_to_bytes(psz_input)\n        )\n\n    def vlm_set_loop(self, psz_name, b_loop):\n        \"\"\"Set a media's loop status.\n\n        :param psz_name: the media to work on.\n        :param b_loop: the new status.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_set_loop(self, str_to_bytes(psz_name), b_loop)\n\n    def vlm_set_mux(self, psz_name, psz_mux):\n        \"\"\"Set a media's vod muxer.\n\n        :param psz_name: the media to work on.\n        :param psz_mux: the new muxer.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_set_mux(self, str_to_bytes(psz_name), str_to_bytes(psz_mux))\n\n    def vlm_set_output(self, psz_name, psz_output):\n        \"\"\"Set the output for a media.\n\n        :param psz_name: the media to work on.\n        :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_set_output(\n            self, str_to_bytes(psz_name), str_to_bytes(psz_output)\n        )\n\n    def vlm_show_media(self, psz_name):\n        \"\"\"Return information about the named media as a JSON\n        string representation.\n\n        This function is mainly intended for debugging use,\n        if you want programmatic access to the state of\n        a vlm_media_instance_t, please use the corresponding\n        libvlc_vlm_get_media_instance_xxx -functions.\n        Currently there are no such functions available for\n        vlm_media_t though.\n\n        :param psz_name: the name of the media,\n            if the name is an empty string, all media is described.\n\n        :return: string with information about named media, or None on error.\n        \"\"\"\n        return libvlc_vlm_show_media(self, str_to_bytes(psz_name))\n\n    def vlm_stop_media(self, psz_name):\n        \"\"\"Stop the named broadcast.\n\n        :param psz_name: the name of the broadcast.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_vlm_stop_media(self, str_to_bytes(psz_name))\n\n    def wait(self):\n        \"\"\"Waits until an interface causes the instance to exit.\n        You should start at least one interface first, using :func:`add_intf`.\n\n        .. warning:: This function wastes one thread doing basically nothing.\n            :func:`set_exit_handler` should be used instead.\n        \"\"\"\n        return libvlc_wait(self)\n\n\nclass LogIterator(_Ctype):\n    \"\"\"Create a new VLC log iterator.\"\"\"\n\n    def __new__(cls, ptr=_internal_guard):\n        \"\"\"(INTERNAL) ctypes wrapper constructor.\"\"\"\n        return _Constructor(cls, ptr)\n\n    def __iter__(self):\n        return self\n\n    def next(self):\n        if self.has_next():\n            b = LogMessage()\n            i = libvlc_log_iterator_next(self, b)\n            return i.contents\n        raise StopIteration\n\n    def __next__(self):\n        return self.next()\n\n    def free(self):\n        \"\"\"Frees memory allocated by :func:`log_get_iterator`.\"\"\"\n        return libvlc_log_iterator_free(self)\n\n    def has_next(self):\n        \"\"\"Always returns zero.\n        This function is only provided for backward compatibility.\n\n        :return: always zero.\n        \"\"\"\n        return libvlc_log_iterator_has_next(self)\n\n\nclass Media(_Ctype):\n    \"\"\"Usage:\n\n    .. code-block:: python\n\n        Media(MRL, *options)\n\n    See :meth:`Instance.media_new` documentation for details.\n\n    \"\"\"\n\n    def __new__(cls, *args):\n        if args:\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            if isinstance(i, Instance):\n                return i.media_new(*args[1:])\n\n        o = get_default_instance().media_new(*args)\n        return o\n\n    def get_instance(self):\n        return getattr(self, \"_instance\", None)\n\n    def add_options(self, *options):\n        \"\"\"Add a list of options to the media.\n\n        .. note::\n            Options must be written without the double-dash.\n\n        .. warning::\n            Most audio and video options, such as text renderer, have no\n            effects on an individual media. These options must be set at\n            the :class:`Instance` or :class:`MediaPlayer` instanciation.\n\n        :param options: optional media option=value strings\n        \"\"\"\n        for o in options:\n            self.add_option(o)\n\n    def tracks_get(self):\n        \"\"\"Get media descriptor's elementary streams description.\n\n        .. note::\n            You need to call :meth:`parse` or play the media at least once\n            before calling this function.\n            Not doing this will result in an empty array.\n\n        .. note::\n            The result must be freed with :meth:`tracks_release`.\n\n        :version: LibVLC 2.1.0 and later.\n        \"\"\"\n        mediaTrack_pp = ctypes.POINTER(MediaTrack)()\n        n = libvlc_media_tracks_get(self, ctypes.byref(mediaTrack_pp))\n        info = ctypes.cast(\n            mediaTrack_pp, ctypes.POINTER(ctypes.POINTER(MediaTrack) * n)\n        )\n        try:\n            contents = info.contents\n        except ValueError:\n            # Media not parsed, no info.\n            return None\n        tracks = (contents[i].contents for i in range(len(contents)))\n        # libvlc_media_tracks_release(mediaTrack_pp, n)\n        return tracks\n\n    def add_option(self, psz_options):\n        \"\"\"Add an option to the media.\n\n        This option will be used to determine how the media_player will\n        read the media. This allows to use VLC's advanced\n        reading/streaming options on a per-media basis.\n\n        .. note:: The options are listed in 'vlc --long-help' from the command line,\n            e.g. \"-sout-all\". Keep in mind that available options and their semantics\n            vary across LibVLC versions and builds.\n        .. warning:: Not all options affects :class:`Media` objects:\n            Specifically, due to architectural issues most audio and video options,\n            such as text renderer options, have no effects on an individual media.\n            These options must be set through :func:`new` instead.\n\n        :param psz_options: the options (as a string).\n        \"\"\"\n        return libvlc_media_add_option(self, str_to_bytes(psz_options))\n\n    def add_option_flag(self, psz_options, i_flags):\n        \"\"\"Add an option to the media with configurable flags.\n\n        This option will be used to determine how the media_player will\n        read the media. This allows to use VLC's advanced\n        reading/streaming options on a per-media basis.\n\n        The options are detailed in vlc --long-help, for instance\n        \"--sout-all\". Note that all options are not usable on medias:\n        specifically, due to architectural issues, video-related options\n        such as text renderer options cannot be set on a single media. They\n        must be set on the whole libvlc instance instead.\n\n        :param psz_options: the options (as a string).\n        :param i_flags: the flags for this option.\n        \"\"\"\n        return libvlc_media_add_option_flag(self, str_to_bytes(psz_options), i_flags)\n\n    def duplicate(self):\n        \"\"\"Duplicate a media descriptor object.\"\"\"\n        return libvlc_media_duplicate(self)\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Get event manager from media descriptor object.\n        NOTE: this function doesn't increment reference counting.\n\n        :return: event manager object.\n        \"\"\"\n        return libvlc_media_event_manager(self)\n\n    def get_duration(self):\n        \"\"\"Get duration (in ms) of media descriptor object item.\n\n        :return: duration of media item or -1 on error.\n        \"\"\"\n        return libvlc_media_get_duration(self)\n\n    def get_meta(self, e_meta):\n        \"\"\"Read the meta of the media.\n\n        If the media has not yet been parsed this will return None.\n\n        :func:`parse`\n        :func:`parse_with_options`\n        libvlc_MediaMetaChanged\n\n        :param e_meta: the meta to read.\n\n        :return: the media's meta.\n        \"\"\"\n        return libvlc_media_get_meta(self, e_meta)\n\n    def get_mrl(self):\n        \"\"\"Get the media resource locator (mrl) from a media descriptor object\n\n        :return: string with mrl of media descriptor object.\n        \"\"\"\n        return libvlc_media_get_mrl(self)\n\n    def get_parsed_status(self):\n        \"\"\"Get Parsed status for media descriptor object.\n\n        libvlc_MediaParsedChanged\n        :class:`MediaParsedStatus`\n\n        :return: a value of the :class:`MediaParsedStatus` enum.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_get_parsed_status(self)\n\n    def get_state(self):\n        \"\"\"Get current state of media descriptor object. Possible media states are\n        libvlc_NothingSpecial=0, libvlc_Opening, libvlc_Playing, libvlc_Paused,\n        libvlc_Stopped, libvlc_Ended, libvlc_Error.\n\n        :class:`State`.\n\n        :return: state of media descriptor object.\n        \"\"\"\n        return libvlc_media_get_state(self)\n\n    def get_stats(self, p_stats):\n        \"\"\"Get the current statistics about the media.\n\n        :param p_stats:: structure that contain the statistics about the media.\n            (this structure must be allocated by the caller).\n\n        :return: true if the statistics are available, false otherwise.\n        \"\"\"\n        return libvlc_media_get_stats(self, p_stats)\n\n    def get_tracks_info(self):\n        \"\"\"Get media descriptor's elementary streams description\n\n        Note, you need to call :func:`parse` or play the media at least once\n        before calling this function.\n        Not doing this will result in an empty array.\n\n\n        .. warning:: **Deprecated!** Use :func:`tracks_get` instead\n\n        :param tracks: address to store an allocated array of Elementary Streams.\n            descriptions (must be freed by the caller) [OUT].\n\n        :return: the number of Elementary Streams.\n        \"\"\"\n        return libvlc_media_get_tracks_info(self)\n\n    def get_type(self):\n        \"\"\"Get the media type of the media descriptor object\n\n        :class:`MediaType`\n\n        :return: media type.\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_get_type(self)\n\n    def get_user_data(self):\n        \"\"\"Get media descriptor's user_data. user_data is specialized data\n        accessed by the host application, VLC.framework uses it as a pointer to\n        an native object that references a :class:`Media` pointer\n        \"\"\"\n        return libvlc_media_get_user_data(self)\n\n    def is_parsed(self):\n        \"\"\"Return true is the media descriptor object is parsed\n\n\n        .. warning:: **Deprecated!** This can return true in case of failure.\n            Use :func:`get_parsed_status` instead\n\n        libvlc_MediaParsedChanged\n\n        :return: true if media object has been parsed otherwise it returns false.\n        \"\"\"\n        return libvlc_media_is_parsed(self)\n\n    def parse(self):\n        \"\"\"Parse a media.\n\n        This fetches (local) art, meta data and tracks information.\n        The method is synchronous.\n\n\n        .. warning:: **Deprecated!** This function could block indefinitely.\n            Use :func:`parse_with_options` instead\n\n        :func:`parse_with_options`\n        :func:`get_meta`\n        :func:`get_tracks_info`\n        \"\"\"\n        return libvlc_media_parse(self)\n\n    def parse_async(self):\n        \"\"\"Parse a media.\n\n        This fetches (local) art, meta data and tracks information.\n        The method is the asynchronous of :func:`parse`.\n\n        To track when this is over you can listen to libvlc_MediaParsedChanged\n        event. However if the media was already parsed you will not receive this\n        event.\n\n\n        .. warning:: **Deprecated!** You can't be sure to receive the libvlc_MediaParsedChanged\n            event (you can wait indefinitely for this event).\n            Use :func:`parse_with_options` instead\n\n        :func:`parse`\n        libvlc_MediaParsedChanged\n        :func:`get_meta`\n        :func:`get_tracks_info`\n        \"\"\"\n        return libvlc_media_parse_async(self)\n\n    def parse_stop(self):\n        \"\"\"Stop the parsing of the media\n\n        When the media parsing is stopped, the libvlc_MediaParsedChanged event will\n        be sent with the libvlc_media_parsed_status_timeout status.\n\n        :func:`parse_with_options`\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_parse_stop(self)\n\n    def parse_with_options(self, parse_flag, timeout):\n        \"\"\"Parse the media asynchronously with options.\n\n        This fetches (local or network) art, meta data and/or tracks information.\n        This method is the extended version of :func:`parse_with_options`.\n\n        To track when this is over you can listen to libvlc_MediaParsedChanged\n        event. However if this functions returns an error, you will not receive any\n        events.\n\n        It uses a flag to specify parse options (see libvlc_media_parse_flag_t). All\n        these flags can be combined. By default, media is parsed if it's a local\n        file.\n\n        .. note:: Parsing can be aborted with :func:`parse_stop`.\n\n        libvlc_MediaParsedChanged\n        :func:`get_meta`\n        :func:`tracks_get`\n        :func:`get_parsed_status`\n        :class:`MediaParseFlag`\n\n        :param parse_flag: parse options:\n        :param timeout: maximum time allowed to preparse the media. If -1, the.\n            default \"preparse-timeout\" option will be used as a timeout. If 0, it will.\n            wait indefinitely. If > 0, the timeout will be used (in milliseconds).\n\n        :return: -1 in case of error, 0 otherwise.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_parse_with_options(self, parse_flag, timeout)\n\n    def player_new_from_media(self):\n        \"\"\"Create a Media Player object from a Media\n\n            destroyed.\n\n        :return: a new media player object, or None on error.\n        \"\"\"\n        return libvlc_media_player_new_from_media(self)\n\n    def release(self):\n        \"\"\"Decrement the reference count of a media descriptor object. If the\n        reference count is 0, then :func:`release` will release the\n        media descriptor object. It will send out an libvlc_MediaFreed event\n        to all listeners. If the media descriptor object has been released it\n        should not be used again.\n        \"\"\"\n        return libvlc_media_release(self)\n\n    def retain(self):\n        \"\"\"Retain a reference to a media descriptor object (libvlc_media_t). Use\n        :func:`release` to decrement the reference count of a\n        media descriptor object.\n        \"\"\"\n        return libvlc_media_retain(self)\n\n    def save_meta(self):\n        \"\"\"Save the meta previously set\n\n        :return: true if the write operation was successful.\n        \"\"\"\n        return libvlc_media_save_meta(self)\n\n    def set_meta(self, e_meta, psz_value):\n        \"\"\"Set the meta of the media (this function will not save the meta, call\n        :func:`save_meta` in order to save the meta)\n\n        :param e_meta: the meta to write.\n        :param psz_value: the media's meta.\n        \"\"\"\n        return libvlc_media_set_meta(self, e_meta, str_to_bytes(psz_value))\n\n    def set_user_data(self, p_new_user_data):\n        \"\"\"Sets media descriptor's user_data. user_data is specialized data\n        accessed by the host application, VLC.framework uses it as a pointer to\n        an native object that references a :class:`Media` pointer\n\n        :param p_new_user_data: pointer to user data.\n        \"\"\"\n        return libvlc_media_set_user_data(self, p_new_user_data)\n\n    def slaves_add(self, i_type, i_priority, psz_uri):\n        \"\"\"Add a slave to the current media.\n\n        A slave is an external input source that may contains an additional subtitle\n        track (like a .srt) or an additional audio track (like a .ac3).\n\n        .. note:: This function must be called before the media is parsed (via\n            libvlc_media_parse_with_options) or before the media is played (via\n            libvlc_media_player_play)\n\n        :param i_type: subtitle or audio.\n        :param i_priority: from 0 (low priority) to 4 (high priority).\n        :param psz_uri: Uri of the slave (should contain a valid scheme).\n\n        :return: 0 on success, -1 on error.\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_slaves_add(self, i_type, i_priority, str_to_bytes(psz_uri))\n\n    def slaves_clear(self):\n        \"\"\"Clear all slaves previously added by :func:`slaves_add` or\n        internally.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_slaves_clear(self)\n\n    def slaves_get(self, ppp_slaves):\n        \"\"\"Get a media descriptor's slave list\n\n        The list will contain slaves parsed by VLC or previously added by\n        :func:`slaves_add`. The typical use case of this function is to save\n        a list of slave in a database for a later use.\n\n        :func:`slaves_add`\n\n        :param ppp_slaves: address to store an allocated array of slaves (must be.\n            freed with libvlc_media_slaves_release) [OUT].\n\n        :return: the number of slaves (zero on error).\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_slaves_get(self, ppp_slaves)\n\n    def subitems(self):\n        \"\"\"Get subitems of media descriptor object. This will increment\n        the reference count of supplied media descriptor object. Use\n        :func:`list_release` to decrement the reference counting.\n\n        :return: list of media descriptor subitems or None.\n        \"\"\"\n        return libvlc_media_subitems(self)\n\n\nclass MediaDiscoverer(_Ctype):\n    def __new__(cls, ptr=_internal_guard):\n        \"\"\"(INTERNAL) ctypes wrapper constructor.\"\"\"\n        return _Constructor(cls, ptr)\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Get event manager from media service discover object.\n\n\n        .. warning:: **Deprecated!** Useless, media_discoverer events are only triggered when calling\n            :func:`start` and :func:`stop`.\n\n        :return: event manager object.\n        \"\"\"\n        return libvlc_media_discoverer_event_manager(self)\n\n    def is_running(self):\n        \"\"\"Query if media service discover object is running.\n\n        :return: true if running, false if not.\n        \"\"\"\n        return libvlc_media_discoverer_is_running(self)\n\n    def localized_name(self):\n        \"\"\"Get media service discover object its localized name.\n\n\n        .. warning:: **Deprecated!** Useless, use :func:`list_get` to get the\n            longname of the service discovery.\n\n        :return: localized name or None if the media_discoverer is not started.\n        \"\"\"\n        return libvlc_media_discoverer_localized_name(self)\n\n    def media_list(self):\n        \"\"\"Get media service discover media list.\n\n        :return: list of media items.\n        \"\"\"\n        return libvlc_media_discoverer_media_list(self)\n\n    def release(self):\n        \"\"\"Release media discover object. If the reference count reaches 0, then\n        the object will be released.\n        \"\"\"\n        return libvlc_media_discoverer_release(self)\n\n    def start(self):\n        \"\"\"Start media discovery.\n\n        To stop it, call :func:`stop` or\n        :func:`list_release` directly.\n\n        :func:`stop`\n\n        :return: -1 in case of error, 0 otherwise.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_discoverer_start(self)\n\n    def stop(self):\n        \"\"\"Stop media discovery.\n\n        :func:`start`\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_discoverer_stop(self)\n\n\nclass MediaLibrary(_Ctype):\n    def __new__(cls, ptr=_internal_guard):\n        \"\"\"(INTERNAL) ctypes wrapper constructor.\"\"\"\n        return _Constructor(cls, ptr)\n\n    def load(self):\n        \"\"\"Load media library.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_media_library_load(self)\n\n    def media_list(self):\n        \"\"\"Get media library subitems.\n\n        :return: media list subitems.\n        \"\"\"\n        return libvlc_media_library_media_list(self)\n\n    def release(self):\n        \"\"\"Release media library object. This functions decrements the\n        reference count of the media library object. If it reaches 0,\n        then the object will be released.\n        \"\"\"\n        return libvlc_media_library_release(self)\n\n    def retain(self):\n        \"\"\"Retain a reference to a media library object. This function will\n        increment the reference counting for this object. Use\n        :func:`release` to decrement the reference count.\n        \"\"\"\n        return libvlc_media_library_retain(self)\n\n\nclass MediaList(_Ctype):\n    \"\"\"Usage:\n\n    .. code-block:: python\n\n        MediaList(list_of_MRLs)\n\n    See :meth:`Instance.media_list_new` documentation for details.\n\n    \"\"\"\n\n    def __new__(cls, *args):\n        if args:\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            if isinstance(i, Instance):\n                return i.media_list_new(*args[1:])\n\n        o = get_default_instance().media_list_new(*args)\n        return o\n\n    def get_instance(self):\n        return getattr(self, \"_instance\", None)\n\n    def add_media(self, mrl):\n        \"\"\"Add :class:`Media` instance to media list.\n\n        .. note::\n            The lock should be held upon entering this function.\n\n        :param mrl: A :class:`Media` instance or a MRL.\n\n        :return: 0 on success, -1 if the media list is read-only.\n        \"\"\"\n        mrl = try_fspath(mrl)\n        if isinstance(mrl, basestring):\n            mrl = (self.get_instance() or get_default_instance()).media_new(mrl)\n        return libvlc_media_list_add_media(self, mrl)\n\n    def count(self):\n        \"\"\"Get count on media list items\n        The :func:`lock` should be held upon entering this function.\n\n        :return: number of items in media list.\n        \"\"\"\n        return libvlc_media_list_count(self)\n\n    def __len__(self):\n        return libvlc_media_list_count(self)\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Get libvlc_event_manager from this media list instance.\n        The p_event_manager is immutable, so you don't have to hold the lock\n\n        :return: libvlc_event_manager.\n        \"\"\"\n        return libvlc_media_list_event_manager(self)\n\n    def index_of_item(self, p_md):\n        \"\"\"Find index position of List media instance in media list.\n        Warning: the function will return the first matched position.\n        The :func:`lock` should be held upon entering this function.\n\n        :param p_md: media instance.\n\n        :return: position of media instance or -1 if media not found.\n        \"\"\"\n        return libvlc_media_list_index_of_item(self, p_md)\n\n    def insert_media(self, p_md, i_pos):\n        \"\"\"Insert media instance in media list on a position\n        The :func:`lock` should be held upon entering this function.\n\n        :param p_md: a media instance.\n        :param i_pos: position in array where to insert.\n\n        :return: 0 on success, -1 if the media list is read-only.\n        \"\"\"\n        return libvlc_media_list_insert_media(self, p_md, i_pos)\n\n    def is_readonly(self):\n        \"\"\"This indicates if this media list is read-only from a user point of view\n\n        :return: 1 on readonly, 0 on readwrite.\n        \"\"\"\n        return libvlc_media_list_is_readonly(self)\n\n    def item_at_index(self, i_pos):\n        \"\"\"List media instance in media list at a position\n        The :func:`lock` should be held upon entering this function.\n\n        :param i_pos: position in array where to insert.\n\n        :return: media instance at position *i_pos*, or None if not found.\n            In case of success, :func:`media_retain` is called to increase the refcount.\n            on the media.\n        \"\"\"\n        return libvlc_media_list_item_at_index(self, i_pos)\n\n    def __getitem__(self, i):\n        return libvlc_media_list_item_at_index(self, i)\n\n    def __iter__(self):\n        for i in range(len(self)):\n            yield self[i]\n\n    def lock(self):\n        \"\"\"Get lock on media list items\"\"\"\n        return libvlc_media_list_lock(self)\n\n    def media(self):\n        \"\"\"Get media instance from this media list instance. This action will increase\n        the refcount on the media instance.\n        The :func:`lock` should NOT be held upon entering this function.\n\n        :return: media instance.\n        \"\"\"\n        return libvlc_media_list_media(self)\n\n    def release(self):\n        \"\"\"Release media list created with :func:`new`.\"\"\"\n        return libvlc_media_list_release(self)\n\n    def remove_index(self, i_pos):\n        \"\"\"Remove media instance from media list on a position\n        The :func:`lock` should be held upon entering this function.\n\n        :param i_pos: position in array where to insert.\n\n        :return: 0 on success, -1 if the list is read-only or the item was not found.\n        \"\"\"\n        return libvlc_media_list_remove_index(self, i_pos)\n\n    def retain(self):\n        \"\"\"Retain reference to a media list\"\"\"\n        return libvlc_media_list_retain(self)\n\n    def set_media(self, p_md):\n        \"\"\"Associate media instance with this media list instance.\n        If another media instance was present it will be released.\n        The :func:`lock` should NOT be held upon entering this function.\n\n        :param p_md: media instance to add.\n        \"\"\"\n        return libvlc_media_list_set_media(self, p_md)\n\n    def unlock(self):\n        \"\"\"Release lock on media list items\n        The :func:`lock` should be held upon entering this function.\n        \"\"\"\n        return libvlc_media_list_unlock(self)\n\n\nclass MediaListPlayer(_Ctype):\n    \"\"\"It may take as parameter either:\n\n    * an :class:`Instance`\n    * nothing\n\n    \"\"\"\n\n    def __new__(cls, arg=None):\n        if arg is None:\n            i = get_default_instance()\n        elif isinstance(arg, Instance):\n            i = arg\n        elif isinstance(arg, _Ints):\n            return _Constructor(cls, arg)\n        else:\n            raise TypeError(\"MediaListPlayer %r\" % (arg,))\n\n        return i.media_list_player_new()\n\n    def get_instance(self):\n        \"\"\"Return the associated :class:`Instance`.\"\"\"\n        return self._instance\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Return the event manager of this media_list_player.\n\n        :return: the event manager.\n        \"\"\"\n        return libvlc_media_list_player_event_manager(self)\n\n    def get_media_player(self):\n        \"\"\"Get media player of the media_list_player instance.\n\n\n        .. note:: the caller is responsible for releasing the returned instance.\n\n        :return: media player instance.\n        \"\"\"\n        return libvlc_media_list_player_get_media_player(self)\n\n    def get_state(self):\n        \"\"\"Get current libvlc_state of media list player\n\n        :return: :class:`State` for media list player.\n        \"\"\"\n        return libvlc_media_list_player_get_state(self)\n\n    def is_playing(self):\n        \"\"\"Is media list playing?\n\n        :return: true for playing and false for not playing.\n        \"\"\"\n        return libvlc_media_list_player_is_playing(self)\n\n    def next(self):\n        \"\"\"Play next item from media list\n\n        :return: 0 upon success -1 if there is no next item.\n        \"\"\"\n        return libvlc_media_list_player_next(self)\n\n    def pause(self):\n        \"\"\"Toggle pause (or resume) media list\"\"\"\n        return libvlc_media_list_player_pause(self)\n\n    def play(self):\n        \"\"\"Play media list\"\"\"\n        return libvlc_media_list_player_play(self)\n\n    def play_item(self, p_md):\n        \"\"\"Play the given media item\n\n        :param p_md: the media instance.\n\n        :return: 0 upon success, -1 if the media is not part of the media list.\n        \"\"\"\n        return libvlc_media_list_player_play_item(self, p_md)\n\n    def play_item_at_index(self, i_index):\n        \"\"\"Play media list item at position index\n\n        :param i_index: index in media list to play.\n\n        :return: 0 upon success -1 if the item wasn't found.\n        \"\"\"\n        return libvlc_media_list_player_play_item_at_index(self, i_index)\n\n    def __getitem__(self, i):\n        return libvlc_media_list_player_play_item_at_index(self, i)\n\n    def __iter__(self):\n        for i in range(len(self)):\n            yield self[i]\n\n    def previous(self):\n        \"\"\"Play previous item from media list\n\n        :return: 0 upon success -1 if there is no previous item.\n        \"\"\"\n        return libvlc_media_list_player_previous(self)\n\n    def release(self):\n        \"\"\"Release a media_list_player after use\n        Decrement the reference count of a media player object. If the\n        reference count is 0, then :func:`release` will\n        release the media player object. If the media player object\n        has been released, then it should not be used again.\n        \"\"\"\n        return libvlc_media_list_player_release(self)\n\n    def retain(self):\n        \"\"\"Retain a reference to a media player list object. Use\n        :func:`release` to decrement reference count.\n        \"\"\"\n        return libvlc_media_list_player_retain(self)\n\n    def set_media_list(self, p_mlist):\n        \"\"\"Set the media list associated with the player\n\n        :param p_mlist: list of media.\n        \"\"\"\n        return libvlc_media_list_player_set_media_list(self, p_mlist)\n\n    def set_media_player(self, p_mi):\n        \"\"\"Replace media player in media_list_player with this instance.\n\n        :param p_mi: media player instance.\n        \"\"\"\n        return libvlc_media_list_player_set_media_player(self, p_mi)\n\n    def set_pause(self, do_pause):\n        \"\"\"Pause or resume media list\n\n        :param do_pause: play/resume if zero, pause if non-zero.\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_list_player_set_pause(self, do_pause)\n\n    def set_playback_mode(self, e_mode):\n        \"\"\"Sets the playback mode for the playlist\n\n        :param e_mode: playback mode specification.\n        \"\"\"\n        return libvlc_media_list_player_set_playback_mode(self, e_mode)\n\n    def stop(self):\n        \"\"\"Stop playing media list\"\"\"\n        return libvlc_media_list_player_stop(self)\n\n\nclass MediaPlayer(_Ctype):\n    \"\"\"It may take as parameter either:\n\n    * a string (media URI), options... In this case, an :class:`Instance` will be created.\n    * an :class:`Instance`, a string (media URI), options...\n\n    \"\"\"\n\n    def __new__(cls, *args):\n        if len(args) == 1 and isinstance(args[0], _Ints):\n            return _Constructor(cls, args[0])\n\n        if args and isinstance(args[0], Instance):\n            instance = args[0]\n            args = args[1:]\n        else:\n            instance = get_default_instance()\n\n        o = instance.media_player_new()\n        if args:\n            o.set_media(instance.media_new(*args))\n        return o\n\n    def get_instance(self):\n        \"\"\"Return the associated :class:`Instance`.\"\"\"\n        return self._instance\n\n    def set_mrl(self, mrl, *options):\n        \"\"\"Set the MRL to play.\n\n        .. warning::\n            Most audio and video options, such as text renderer,\n            have no effects on an individual media. These options must be\n            set at the :class:`Instance` or :class:`MediaPlayer` instanciation.\n\n        :param mrl: The MRL\n        :param options: optional media option=value strings\n\n        :return: the Media object\n        \"\"\"\n        m = self.get_instance().media_new(mrl, *options)\n        self.set_media(m)\n        return m\n\n    def video_get_spu_description(self):\n        \"\"\"Get the description of available video subtitles.\"\"\"\n        return track_description_list(libvlc_video_get_spu_description(self))\n\n    def video_get_track_description(self):\n        \"\"\"Get the description of available video tracks.\"\"\"\n        return track_description_list(libvlc_video_get_track_description(self))\n\n    def audio_get_track_description(self):\n        \"\"\"Get the description of available audio tracks.\"\"\"\n        return track_description_list(libvlc_audio_get_track_description(self))\n\n    def get_full_title_descriptions(self):\n        \"\"\"Get the full description of available titles.\n\n        :return: The titles list.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        titleDescription_pp = ctypes.POINTER(TitleDescription)()\n        n = libvlc_media_player_get_full_title_descriptions(\n            self, ctypes.byref(titleDescription_pp)\n        )\n        info = ctypes.cast(\n            titleDescription_pp, ctypes.POINTER(ctypes.POINTER(TitleDescription) * n)\n        )\n        try:\n            contents = info.contents\n        except ValueError:\n            # Media not parsed, no info.\n            return None\n        descr = (contents[i].contents for i in range(len(contents)))\n        return descr\n\n    def get_full_chapter_descriptions(self, i_chapters_of_title):\n        \"\"\"Get the full description of available chapters.\n\n        :param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1).\n\n        :return: the chapters list\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        chapterDescription_pp = ctypes.POINTER(ChapterDescription)()\n        n = libvlc_media_player_get_full_chapter_descriptions(\n            self, i_chapters_of_title, ctypes.byref(chapterDescription_pp)\n        )\n        info = ctypes.cast(\n            chapterDescription_pp,\n            ctypes.POINTER(ctypes.POINTER(ChapterDescription) * n),\n        )\n        try:\n            contents = info.contents\n        except ValueError:\n            # Media not parsed, no info.\n            return None\n        descr = (contents[i].contents for i in range(len(contents)))\n        return descr\n\n    def video_get_size(self, num=0):\n        \"\"\"Get the video size in pixels as 2-tuple (width, height).\n\n        :param num: video number (default 0).\n        \"\"\"\n        r = libvlc_video_get_size(self, num)\n        if isinstance(r, tuple) and len(r) == 2:\n            return r\n        else:\n            raise VLCException(\"invalid video number (%s)\" % (num,))\n\n    def set_hwnd(self, drawable):\n        \"\"\"Set a Win32/Win64 API window handle (HWND).\n\n        Specify where the media player should render its video\n        output. If LibVLC was built without Win32/Win64 API output\n        support, then this has no effects.\n\n        :param drawable: windows handle of the drawable.\n        \"\"\"\n        if not isinstance(drawable, ctypes.c_void_p):\n            drawable = ctypes.c_void_p(int(drawable))\n        libvlc_media_player_set_hwnd(self, drawable)\n\n    def video_get_width(self, num=0):\n        \"\"\"Get the width of a video in pixels.\n\n        :param num: video number (default 0).\n        \"\"\"\n        return self.video_get_size(num)[0]\n\n    def video_get_height(self, num=0):\n        \"\"\"Get the height of a video in pixels.\n\n        :param num: video number (default 0).\n        \"\"\"\n        return self.video_get_size(num)[1]\n\n    def video_get_cursor(self, num=0):\n        \"\"\"Get the mouse pointer coordinates over a video as 2-tuple (x, y).\n\n        Coordinates are expressed in terms of the decoded video resolution,\n        **not** in terms of pixels on the screen/viewport. To get the\n        latter, you must query your windowing system directly.\n\n        Either coordinate may be negative or larger than the corresponding\n        size of the video, if the cursor is outside the rendering area.\n\n        .. warning::\n            The coordinates may be out-of-date if the pointer is not\n            located on the video rendering area. LibVLC does not track the\n            mouse pointer if the latter is outside the video widget.\n\n        .. note::\n            LibVLC does not support multiple mouse pointers (but does\n            support multiple input devices sharing the same pointer).\n\n        :param num: video number (default 0).\n        \"\"\"\n        r = libvlc_video_get_cursor(self, num)\n        if isinstance(r, tuple) and len(r) == 2:\n            return r\n        raise VLCException(\"invalid video number (%s)\" % (num,))\n\n    def audio_get_channel(self):\n        \"\"\"Get current audio channel.\n\n        :return: the audio channel :class:`AudioOutputChannel`.\n        \"\"\"\n        return libvlc_audio_get_channel(self)\n\n    def audio_get_delay(self):\n        \"\"\"Get current audio delay.\n\n        :return: the audio delay (microseconds).\n        :version: LibVLC 1.1.1 or later.\n        \"\"\"\n        return libvlc_audio_get_delay(self)\n\n    def audio_get_mute(self):\n        \"\"\"Get current mute status.\n\n        :return: the mute status (boolean) if defined, -1 if undefined/unapplicable.\n        \"\"\"\n        return libvlc_audio_get_mute(self)\n\n    def audio_get_track(self):\n        \"\"\"Get current audio track.\n\n        :return: the audio track ID or -1 if no active input.\n        \"\"\"\n        return libvlc_audio_get_track(self)\n\n    def audio_get_track_count(self):\n        \"\"\"Get number of available audio tracks.\n\n        :return: the number of available audio tracks (int), or -1 if unavailable.\n        \"\"\"\n        return libvlc_audio_get_track_count(self)\n\n    def audio_get_volume(self):\n        \"\"\"Get current software audio volume.\n\n        :return: the software volume in percents.\n            (0 = mute, 100 = nominal / 0dB).\n        \"\"\"\n        return libvlc_audio_get_volume(self)\n\n    def audio_output_device_enum(self):\n        \"\"\"Gets a list of potential audio output devices,\n        :func:`audio_output_device_set`.\n\n        .. note:: Not all audio outputs support enumerating devices.\n            The audio output may be functional even if the list is empty (None).\n\n        .. note:: The list may not be exhaustive.\n\n        .. warning:: Some audio output devices in the list might not actually work in\n            some circumstances. By default, it is recommended to not specify any\n            explicit audio device.\n\n        :return: A None-terminated linked list of potential audio output devices.\n            It must be freed with :func:`audio_output_device_list_release`.\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_audio_output_device_enum(self)\n\n    def audio_output_device_get(self):\n        \"\"\"Get the current audio output device identifier.\n\n        This complements :func:`audio_output_device_set`.\n\n        .. warning:: The initial value for the current audio output device identifier\n            may not be set or may be some unknown value. A LibVLC application should\n            compare this value against the known device identifiers (e.g. those that\n            were previously retrieved by a call to :func:`audio_output_device_enum` or\n            libvlc_audio_output_device_list_get) to find the current audio output device.\n\n        It is possible that the selected audio output device changes (an external\n        change) without a call to :func:`audio_output_device_set`. That may make this\n        method unsuitable to use if a LibVLC application is attempting to track\n        dynamic audio device changes as they happen.\n\n        :return: the current audio output device identifier.\n            None if no device is selected or in case of error.\n            (the result must be released with free() or libvlc_free).\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_audio_output_device_get(self)\n\n    def audio_output_device_set(self, module, device_id):\n        \"\"\"Configures an explicit audio output device.\n\n        If the *module* paramater is None, audio output will be moved to the device\n        specified by the device identifier string immediately. This is the\n        recommended usage.\n\n        A list of adequate potential device strings can be obtained with\n        :func:`audio_output_device_enum`.\n\n        However passing None is supported in LibVLC version 2.2.0 and later only;\n        in earlier versions, this function would have no effects when the module\n        parameter was None.\n\n        If the *module* parameter is not None, the device parameter of the\n        corresponding audio output, if it exists, will be set to the specified\n        string. Note that some audio output modules do not have such a parameter\n        (notably MMDevice and PulseAudio).\n\n        A list of adequate potential device strings can be obtained with\n        :func:`audio_output_device_list_get`.\n\n        .. note:: This function does not select the specified audio output plugin.\n            :func:`audio_output_set` is used for that purpose.\n\n        .. warning:: The syntax for the device parameter depends on the audio output.\n\n        Some audio output modules require further parameters (e.g. a channels map\n        in the case of ALSA).\n\n        :param module: If None, current audio output module.\n            if non-None, name of audio output module.\n            (libvlc_audio_output_t).\n        :param device_id: device identifier string.\n\n        :return: Nothing. Errors are ignored (this is a design bug).\n        \"\"\"\n        return libvlc_audio_output_device_set(\n            self, str_to_bytes(module), str_to_bytes(device_id)\n        )\n\n    def audio_output_get_device_type(self):\n        \"\"\"Stub for backward compatibility.\n\n        :return: always -1.\n        \"\"\"\n        return libvlc_audio_output_get_device_type(self)\n\n    def audio_output_set(self, psz_name):\n        \"\"\"Selects an audio output module.\n\n        .. note:: Any change will take be effect only after playback is stopped and\n            restarted. Audio output cannot be changed while playing.\n\n        :param psz_name: name of audio output,\n            use psz_name of :class:`AudioOutput`.\n\n        :return: 0 if function succeeded, -1 on error.\n        \"\"\"\n        return libvlc_audio_output_set(self, str_to_bytes(psz_name))\n\n    def audio_output_set_device_type(self, device_type):\n        \"\"\"Stub for backward compatibility.\"\"\"\n        return libvlc_audio_output_set_device_type(self, device_type)\n\n    def audio_set_callbacks(self, play, pause, resume, flush, drain, opaque):\n        \"\"\"Sets callbacks and private data for decoded audio.\n\n        Use :func:`audio_set_format` or :func:`audio_set_format_callbacks`\n        to configure the decoded audio format.\n\n        .. note:: The audio callbacks override any other audio output mechanism.\n            If the callbacks are set, LibVLC will **not** output audio in any way.\n\n        :param play: callback to play audio samples (must not be None).\n        :param pause: callback to pause playback (or None to ignore).\n        :param resume: callback to resume playback (or None to ignore).\n        :param flush: callback to flush audio buffers (or None to ignore).\n        :param drain: callback to drain audio buffers (or None to ignore).\n        :param opaque: private pointer for the audio callbacks (as first parameter).\n\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_audio_set_callbacks(\n            self, play, pause, resume, flush, drain, opaque\n        )\n\n    def audio_set_channel(self, channel):\n        \"\"\"Set current audio *channel*.\n\n        :param channel: the audio channel, :class:`AudioOutputChannel`.\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_audio_set_channel(self, channel)\n\n    def audio_set_delay(self, i_delay):\n        \"\"\"Set current audio delay. The audio delay will be reset to zero each time the media changes.\n\n        :param i_delay: the audio delay (microseconds).\n\n        :return: 0 on success, -1 on error.\n        :version: LibVLC 1.1.1 or later.\n        \"\"\"\n        return libvlc_audio_set_delay(self, i_delay)\n\n    def audio_set_format(self, format, rate, channels):\n        \"\"\"Sets a fixed decoded audio *format*.\n\n        This only works in combination with :func:`audio_set_callbacks`,\n        and is mutually exclusive with :func:`audio_set_format_callbacks`.\n\n        :param format: a four-characters string identifying the sample format.\n            (e.g. \"S16N\" or \"f32l\").\n        :param rate: sample rate (expressed in Hz).\n        :param channels: channels count.\n\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_audio_set_format(self, str_to_bytes(format), rate, channels)\n\n    def audio_set_format_callbacks(self, setup, cleanup):\n        \"\"\"Sets decoded audio format via callbacks.\n\n        This only works in combination with :func:`audio_set_callbacks`.\n\n        :param setup: callback to select the audio format (cannot be None).\n        :param cleanup: callback to release any allocated resources (or None).\n\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_audio_set_format_callbacks(self, setup, cleanup)\n\n    def audio_set_mute(self, status):\n        \"\"\"Set mute *status*.\n\n        .. warning:: This function does not always work. If there are no active audio\n            playback stream, the mute *status* might not be available. If digital\n            pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also\n            some audio output plugins do not support muting at all.\n\n        .. note:: To force silent playback, disable all audio tracks. This is more\n            efficient and reliable than mute.\n\n        :param status: If status is true then mute, otherwise unmute.\n        \"\"\"\n        return libvlc_audio_set_mute(self, status)\n\n    def audio_set_track(self, i_track):\n        \"\"\"Set current audio track.\n\n        :param i_track: the track ID (i_id field from track description).\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_audio_set_track(self, i_track)\n\n    def audio_set_volume(self, i_volume):\n        \"\"\"Set current software audio volume.\n\n        :param i_volume: the volume in percents (0 = mute, 100 = 0dB).\n\n        :return: 0 if the volume was set, -1 if it was out of range.\n        \"\"\"\n        return libvlc_audio_set_volume(self, i_volume)\n\n    def audio_set_volume_callback(self, set_volume):\n        \"\"\"Set callbacks and private data for decoded audio. This only works in\n        combination with :func:`audio_set_callbacks`.\n        Use :func:`audio_set_format` or :func:`audio_set_format_callbacks`\n        to configure the decoded audio format.\n\n        :param set_volume: callback to apply audio volume,\n            or None to apply volume in software.\n\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_audio_set_volume_callback(self, set_volume)\n\n    def audio_toggle_mute(self):\n        \"\"\"Toggle mute status.\n\n        .. warning:: Toggling mute atomically is not always possible: On some platforms,\n            other processes can mute the VLC audio playback stream asynchronously. Thus,\n            there is a small race condition where toggling will not work.\n            See also the limitations of :func:`audio_set_mute`.\n        \"\"\"\n        return libvlc_audio_toggle_mute(self)\n\n    def get_fullscreen(self):\n        \"\"\"Get current fullscreen status.\n\n        :return: the fullscreen status (boolean).\n        \"\"\"\n        return libvlc_get_fullscreen(self)\n\n    def add_slave(self, i_type, psz_uri, b_select):\n        \"\"\"Add a slave to the current media player.\n\n        .. note:: If the player is playing, the slave will be added directly. This call\n            will also update the slave list of the attached :class:`Media`.\n\n        :func:`media_slaves_add`\n\n        :param i_type: subtitle or audio.\n        :param psz_uri: Uri of the slave (should contain a valid scheme).\n        :param b_select: True if this slave should be selected when it's loaded.\n\n        :return: 0 on success, -1 on error.\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_player_add_slave(\n            self, i_type, str_to_bytes(psz_uri), b_select\n        )\n\n    def can_pause(self):\n        \"\"\"Can this media player be paused?\n\n        :return: true if the media player can pause.\n        \"\"\"\n        return libvlc_media_player_can_pause(self)\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Get the Event Manager from which the media player send event.\n\n        :return: the event manager associated with p_mi.\n        \"\"\"\n        return libvlc_media_player_event_manager(self)\n\n    def get_agl(self):\n        \"\"\".. warning:: **Deprecated!** Use :func:`get_nsobject` instead.\"\"\"\n        return libvlc_media_player_get_agl(self)\n\n    def get_chapter(self):\n        \"\"\"Get movie chapter.\n\n        :return: chapter number currently playing, or -1 if there is no media.\n        \"\"\"\n        return libvlc_media_player_get_chapter(self)\n\n    def get_chapter_count(self):\n        \"\"\"Get movie chapter count\n\n        :return: number of chapters in movie, or -1.\n        \"\"\"\n        return libvlc_media_player_get_chapter_count(self)\n\n    def get_chapter_count_for_title(self, i_title):\n        \"\"\"Get title chapter count\n\n        :param i_title: title.\n\n        :return: number of chapters in title, or -1.\n        \"\"\"\n        return libvlc_media_player_get_chapter_count_for_title(self, i_title)\n\n    def get_fps(self):\n        \"\"\"Get movie fps rate\n\n        This function is provided for backward compatibility. It cannot deal with\n        multiple video tracks. In LibVLC versions prior to 3.0, it would also fail\n        if the file format did not convey the frame rate explicitly.\n\n\n        .. warning:: **Deprecated!** Consider using :func:`media_tracks_get` instead.\n\n        :return: frames per second (fps) for this playing movie, or 0 if unspecified.\n        \"\"\"\n        return libvlc_media_player_get_fps(self)\n\n    def get_hwnd(self):\n        \"\"\"Get the Windows API window handle (HWND) previously set with\n        :func:`set_hwnd`. The handle will be returned even if LibVLC\n        is not currently outputting any video to it.\n\n        :return: a window handle or None if there are none.\n        \"\"\"\n        return libvlc_media_player_get_hwnd(self)\n\n    def get_length(self):\n        \"\"\"Get the current movie length (in ms).\n\n        :return: the movie length (in ms), or -1 if there is no media.\n        \"\"\"\n        return libvlc_media_player_get_length(self)\n\n    def get_media(self):\n        \"\"\"Get the media used by the media_player.\n\n        :return: the media associated with *p_mi*, or None if no.\n            media is associated.\n        \"\"\"\n        return libvlc_media_player_get_media(self)\n\n    def get_nsobject(self):\n        \"\"\"Get the NSView handler previously set with :func:`set_nsobject`.\n\n        :return: the NSView handler or 0 if none where set.\n        \"\"\"\n        return libvlc_media_player_get_nsobject(self)\n\n    def get_position(self):\n        \"\"\"Get movie position as percentage between 0.0 and 1.0.\n\n        :return: movie position, or -1. in case of error.\n        \"\"\"\n        return libvlc_media_player_get_position(self)\n\n    def get_rate(self):\n        \"\"\"Get the requested movie play rate.\n        .. warning:: Depending on the underlying media, the requested rate may be\n            different from the real playback rate.\n\n        :return: movie play rate.\n        \"\"\"\n        return libvlc_media_player_get_rate(self)\n\n    def get_role(self):\n        \"\"\"Gets the media role.\n\n        :return: the media player role (libvlc_media_player_role_t).\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_player_get_role(self)\n\n    def get_state(self):\n        \"\"\"Get current movie state\n\n        :return: the current state of the media player (playing, paused, ...) :class:`State`.\n        \"\"\"\n        return libvlc_media_player_get_state(self)\n\n    def get_time(self):\n        \"\"\"Get the current movie time (in ms).\n\n        :return: the movie time (in ms), or -1 if there is no media.\n        \"\"\"\n        return libvlc_media_player_get_time(self)\n\n    def get_title(self):\n        \"\"\"Get movie title\n\n        :return: title number currently playing, or -1.\n        \"\"\"\n        return libvlc_media_player_get_title(self)\n\n    def get_title_count(self):\n        \"\"\"Get movie title count\n\n        :return: title number count, or -1.\n        \"\"\"\n        return libvlc_media_player_get_title_count(self)\n\n    def get_xwindow(self):\n        \"\"\"Get the X Window System window identifier previously set with\n        :func:`set_xwindow`. Note that this will return the identifier\n        even if VLC is not currently using it (for instance if it is playing an\n        audio-only input).\n\n        :return: an X window ID, or 0 if none where set.\n        \"\"\"\n        return libvlc_media_player_get_xwindow(self)\n\n    def has_vout(self):\n        \"\"\"How many video outputs does this media player have?\n\n        :return: the number of video outputs.\n        \"\"\"\n        return libvlc_media_player_has_vout(self)\n\n    def is_playing(self):\n        \"\"\"is_playing\n\n        :return: 1 if the media player is playing, 0 otherwise.\n        \"\"\"\n        return libvlc_media_player_is_playing(self)\n\n    def is_seekable(self):\n        \"\"\"Is this media player seekable?\n\n        :return: true if the media player can seek.\n        \"\"\"\n        return libvlc_media_player_is_seekable(self)\n\n    def navigate(self, navigate):\n        \"\"\"Navigate through DVD Menu\n\n        :param navigate: the Navigation mode.\n\n        :version: libVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_media_player_navigate(self, navigate)\n\n    def next_chapter(self):\n        \"\"\"Set next chapter (if applicable)\"\"\"\n        return libvlc_media_player_next_chapter(self)\n\n    def next_frame(self):\n        \"\"\"Display the next frame (if supported)\"\"\"\n        return libvlc_media_player_next_frame(self)\n\n    def pause(self):\n        \"\"\"Toggle pause (no effect if there is no media)\"\"\"\n        return libvlc_media_player_pause(self)\n\n    def play(self):\n        \"\"\"Play\n\n        :return: 0 if playback started (and was already started), or -1 on error.\n        \"\"\"\n        return libvlc_media_player_play(self)\n\n    def previous_chapter(self):\n        \"\"\"Set previous chapter (if applicable)\"\"\"\n        return libvlc_media_player_previous_chapter(self)\n\n    def program_scrambled(self):\n        \"\"\"Check if the current program is scrambled\n\n        :return: true if the current program is scrambled.\n\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_media_player_program_scrambled(self)\n\n    def release(self):\n        \"\"\"Release a media_player after use\n        Decrement the reference count of a media player object. If the\n        reference count is 0, then :func:`release` will\n        release the media player object. If the media player object\n        has been released, then it should not be used again.\n        \"\"\"\n        return libvlc_media_player_release(self)\n\n    def retain(self):\n        \"\"\"Retain a reference to a media player object. Use\n        :func:`release` to decrement reference count.\n        \"\"\"\n        return libvlc_media_player_retain(self)\n\n    def set_agl(self, drawable):\n        \"\"\".. warning:: **Deprecated!** Use :func:`set_nsobject` instead.\"\"\"\n        return libvlc_media_player_set_agl(self, drawable)\n\n    def set_android_context(self, p_awindow_handler):\n        \"\"\"Set the android context.\n\n        :param p_awindow_handler: org.videolan.libvlc.AWindow jobject owned by the.\n            org.videolan.libvlc.MediaPlayer class from the libvlc-android project.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_player_set_android_context(self, p_awindow_handler)\n\n    def set_chapter(self, i_chapter):\n        \"\"\"Set movie chapter (if applicable).\n\n        :param i_chapter: chapter number to play.\n        \"\"\"\n        return libvlc_media_player_set_chapter(self, i_chapter)\n\n    def set_equalizer(self, p_equalizer):\n        \"\"\"Apply new equalizer settings to a media player.\n\n        The equalizer is first created by invoking :func:`audio_equalizer_new` or\n        :func:`audio_equalizer_new_from_preset`.\n\n        It is possible to apply new equalizer settings to a media player whether the media\n        player is currently playing media or not.\n\n        Invoking this method will immediately apply the new equalizer settings to the audio\n        output of the currently playing media if there is any.\n\n        If there is no currently playing media, the new equalizer settings will be applied\n        later if and when new media is played.\n\n        Equalizer settings will automatically be applied to subsequently played media.\n\n        To disable the equalizer for a media player invoke this method passing None for the\n        p_equalizer parameter.\n\n        The media player does not keep a reference to the supplied equalizer so it is safe\n        for an application to release the equalizer reference any time after this method\n        returns.\n\n        :param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player.\n\n        :return: zero on success, -1 on error.\n        :version: LibVLC 2.2.0 or later.\n        \"\"\"\n        return libvlc_media_player_set_equalizer(self, p_equalizer)\n\n    def set_evas_object(self, p_evas_object):\n        \"\"\"Set the EFL Evas Object.\n\n        :param p_evas_object: a valid EFL Evas Object (Evas_Object).\n\n        :return: -1 if an error was detected, 0 otherwise.\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_media_player_set_evas_object(self, p_evas_object)\n\n    def set_media(self, p_md):\n        \"\"\"Set the media that will be used by the media_player. If any,\n        previous md will be released.\n\n        :param p_md: the Media. Afterwards the p_md can be safely.\n            destroyed.\n        \"\"\"\n        return libvlc_media_player_set_media(self, p_md)\n\n    def set_nsobject(self, drawable):\n        \"\"\"Set the NSView handler where the media player should render its video output.\n\n        Use the vout called \"macosx\".\n\n        The *drawable* is an NSObject that follow the VLCOpenGLVideoViewEmbedding\n        protocol:\n\n        .. code-block:: objectivec++\n\n            @protocol VLCOpenGLVideoViewEmbedding <NSObject>\n            - (void)addVoutSubview:(NSView *)view;\n            - (void)removeVoutSubview:(NSView *)view;\n            @end\n\n        Or it can be an NSView object.\n\n        If you want to use it along with Qt see the QMacCocoaViewContainer. Then\n        the following code should work:\n\n        .. code-block:: objectivec++\n\n            NSView *video = [[NSView alloc] init];\n            QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);\n            libvlc_media_player_set_nsobject(mp, video);\n            [video release];\n\n\n        You can find a live example in VLCVideoView in VLCKit.framework.\n\n        :param drawable: the drawable that is either an NSView or an object following.\n            the VLCOpenGLVideoViewEmbedding protocol.\n        \"\"\"\n        return libvlc_media_player_set_nsobject(self, drawable)\n\n    def set_pause(self, do_pause):\n        \"\"\"Pause or resume (no effect if there is no media)\n\n        :param do_pause: play/resume if zero, pause if non-zero.\n\n        :version: LibVLC 1.1.1 or later.\n        \"\"\"\n        return libvlc_media_player_set_pause(self, do_pause)\n\n    def set_position(self, f_pos):\n        \"\"\"Set movie position as percentage between 0.0 and 1.0.\n        This has no effect if playback is not enabled.\n        This might not work depending on the underlying input format and protocol.\n\n        :param f_pos: the position.\n        \"\"\"\n        return libvlc_media_player_set_position(self, f_pos)\n\n    def set_rate(self, rate):\n        \"\"\"Set movie play rate\n\n        :param rate: movie play rate to set.\n\n        :return: -1 if an error was detected, 0 otherwise (but even then, it might.\n            not actually work depending on the underlying media protocol).\n        \"\"\"\n        return libvlc_media_player_set_rate(self, rate)\n\n    def set_renderer(self, p_item):\n        \"\"\"Set a renderer to the media player\n\n        .. note:: must be called before the first call of :func:`play` to\n            take effect.\n\n        :func:`renderer_discoverer_new`\n\n        :param p_item: an item discovered by :func:`renderer_discoverer_start`.\n\n        :return: 0 on success, -1 on error.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_media_player_set_renderer(self, p_item)\n\n    def set_role(self, role):\n        \"\"\"Sets the media *role*.\n\n        :param role: the media player role (libvlc_media_player_role_t).\n\n        :return: 0 on success, -1 on error.\n        \"\"\"\n        return libvlc_media_player_set_role(self, role)\n\n    def set_time(self, i_time):\n        \"\"\"Set the movie time (in ms). This has no effect if no media is being played.\n        Not all formats and protocols support this.\n\n        :param i_time: the movie time (in ms).\n        \"\"\"\n        return libvlc_media_player_set_time(self, i_time)\n\n    def set_title(self, i_title):\n        \"\"\"Set movie title\n\n        :param i_title: title number to play.\n        \"\"\"\n        return libvlc_media_player_set_title(self, i_title)\n\n    def set_video_title_display(self, position, timeout):\n        \"\"\"Set if, and how, the video title will be shown when media is played.\n\n        :param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed.\n        :param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable).\n\n        :version: libVLC 2.1.0 or later.\n        \"\"\"\n        return libvlc_media_player_set_video_title_display(self, position, timeout)\n\n    def set_xwindow(self, drawable):\n        \"\"\"Set an X Window System *drawable* where the media player should render its\n        video output. The call takes effect when the playback starts. If it is\n        already started, it might need to be stopped before changes apply.\n        If LibVLC was built without X11 output support, then this function has no\n        effects.\n\n        By default, LibVLC will capture input events on the video rendering area.\n        Use :func:`video_set_mouse_input` and :func:`video_set_key_input` to\n        disable that and deliver events to the parent window / to the application\n        instead. By design, the X11 protocol delivers input events to only one\n        recipient.\n\n        .. warning::\n            The application must call the XInitThreads() function from Xlib before\n            :func:`new`, and before any call to XOpenDisplay() directly or via any\n            other library. Failure to call XInitThreads() will seriously impede LibVLC\n            performance. Calling XOpenDisplay() before XInitThreads() will eventually\n            crash the process. That is a limitation of Xlib.\n\n        .. note::\n            The specified identifier must correspond to an existing Input/Output class\n            X11 window. Pixmaps are **not** currently supported. The default X11\n            server is assumed, i.e. that specified in the DISPLAY environment variable.\n\n        .. warning::\n            LibVLC can deal with invalid X11 handle errors, however some display drivers\n            (EGL, GLX, VA and/or VDPAU) can unfortunately not. Thus the window handle\n            must remain valid until playback is stopped, otherwise the process may\n            abort or crash.\n\n        :param drawable: X11 window ID.\n\n        :bug:\n            No more than one window handle per media player instance can be specified.\n            If the media has multiple simultaneously active video tracks, extra tracks.\n            will be rendered into external windows beyond the control of the.\n            application.\n        \"\"\"\n        return libvlc_media_player_set_xwindow(self, drawable)\n\n    def stop(self):\n        \"\"\"Stop (no effect if there is no media)\"\"\"\n        return libvlc_media_player_stop(self)\n\n    def will_play(self):\n        \"\"\"Is the player able to play\n\n        :return: boolean.\n        \"\"\"\n        return libvlc_media_player_will_play(self)\n\n    def set_fullscreen(self, b_fullscreen):\n        \"\"\"Enable or disable fullscreen.\n\n        .. warning:: With most window managers, only a top-level windows can be in\n            full-screen mode. Hence, this function will not operate properly if\n            :func:`set_xwindow` was used to embed the video in a\n            non-top-level window. In that case, the embedding window must be reparented\n            to the root window **before** fullscreen mode is enabled. You will want\n            to reparent it back to its normal parent when disabling fullscreen.\n\n        :param b_fullscreen: boolean for fullscreen status.\n        \"\"\"\n        return libvlc_set_fullscreen(self, b_fullscreen)\n\n    def toggle_fullscreen(self):\n        \"\"\"Toggle fullscreen status on non-embedded video outputs.\n\n        .. warning:: The same limitations applies to this function\n            as to :func:`set_fullscreen`.\n        \"\"\"\n        return libvlc_toggle_fullscreen(self)\n\n    def toggle_teletext(self):\n        \"\"\"Toggle teletext transparent status on video output.\n\n        .. warning:: **Deprecated!** use :func:`video_set_teletext` instead.\n        \"\"\"\n        return libvlc_toggle_teletext(self)\n\n    def video_get_adjust_float(self, option):\n        \"\"\"Get float adjust *option*.\n\n        :param option: adjust option to get, values of :class:`VideoAdjustOption`.\n\n        :version: LibVLC 1.1.1 and later.\n        \"\"\"\n        return libvlc_video_get_adjust_float(self, option)\n\n    def video_get_adjust_int(self, option):\n        \"\"\"Get integer adjust *option*.\n\n        :param option: adjust option to get, values of :class:`VideoAdjustOption`.\n\n        :version: LibVLC 1.1.1 and later.\n        \"\"\"\n        return libvlc_video_get_adjust_int(self, option)\n\n    def video_get_aspect_ratio(self):\n        \"\"\"Get current video aspect ratio.\n\n        :return: the video aspect ratio or None if unspecified.\n            (the result must be released with free() or libvlc_free).\n        \"\"\"\n        return libvlc_video_get_aspect_ratio(self)\n\n    def video_get_chapter_description(self, i_title):\n        \"\"\"Get the description of available chapters for specific title.\n\n        :param i_title: selected title.\n\n        :return: list containing description of available chapter for title *i_title*.\n            It must be freed with :func:`track_description_list_release`.\n        \"\"\"\n        return libvlc_video_get_chapter_description(self, i_title)\n\n    def video_get_crop_geometry(self):\n        \"\"\"Get current crop filter geometry.\n\n        :return: the crop filter geometry or None if unset.\n        \"\"\"\n        return libvlc_video_get_crop_geometry(self)\n\n    def video_get_logo_int(self, option):\n        \"\"\"Get integer logo *option*.\n\n        :param option: logo option to get, values of :class:`VideoLogoOption`.\n        \"\"\"\n        return libvlc_video_get_logo_int(self, option)\n\n    def video_get_marquee_int(self, option):\n        \"\"\"Get an integer marquee *option* value\n\n        :param option: marq option to get libvlc_video_marquee_int_option_t.\n        \"\"\"\n        return libvlc_video_get_marquee_int(self, option)\n\n    def video_get_marquee_string(self, option):\n        \"\"\"Get a string marquee *option* value\n\n        :param option: marq option to get libvlc_video_marquee_string_option_t.\n        \"\"\"\n        return libvlc_video_get_marquee_string(self, option)\n\n    def video_get_scale(self):\n        \"\"\"Get the current video scaling factor.\n        See also :func:`video_set_scale`.\n\n        :return: the currently configured zoom factor, or 0. if the video is set.\n            to fit to the output window/drawable automatically.\n        \"\"\"\n        return libvlc_video_get_scale(self)\n\n    def video_get_spu(self):\n        \"\"\"Get current video subtitle.\n\n        :return: the video subtitle selected, or -1 if none.\n        \"\"\"\n        return libvlc_video_get_spu(self)\n\n    def video_get_spu_count(self):\n        \"\"\"Get the number of available video subtitles.\n\n        :return: the number of available video subtitles.\n        \"\"\"\n        return libvlc_video_get_spu_count(self)\n\n    def video_get_spu_delay(self):\n        \"\"\"Get the current subtitle delay. Positive values means subtitles are being\n        displayed later, negative values earlier.\n\n        :return: time (in microseconds) the display of subtitles is being delayed.\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_video_get_spu_delay(self)\n\n    def video_get_teletext(self):\n        \"\"\"Get current teletext page requested or 0 if it's disabled.\n\n        Teletext is disabled by default, call :func:`video_set_teletext` to enable\n        it.\n\n        :return: the current teletext page requested.\n        \"\"\"\n        return libvlc_video_get_teletext(self)\n\n    def video_get_title_description(self):\n        \"\"\"Get the description of available titles.\n\n        :return: list containing description of available titles.\n            It must be freed with :func:`track_description_list_release`.\n        \"\"\"\n        return libvlc_video_get_title_description(self)\n\n    def video_get_track(self):\n        \"\"\"Get current video track.\n\n        :return: the video track ID (int) or -1 if no active input.\n        \"\"\"\n        return libvlc_video_get_track(self)\n\n    def video_get_track_count(self):\n        \"\"\"Get number of available video tracks.\n\n        :return: the number of available video tracks (int).\n        \"\"\"\n        return libvlc_video_get_track_count(self)\n\n    def video_set_adjust_float(self, option, value):\n        \"\"\"Set adjust *option* as float. Options that take a different type value\n        are ignored.\n\n        :param option: adust option to set, values of :class:`VideoAdjustOption`.\n        :param value: adjust option value.\n\n        :version: LibVLC 1.1.1 and later.\n        \"\"\"\n        return libvlc_video_set_adjust_float(self, option, value)\n\n    def video_set_adjust_int(self, option, value):\n        \"\"\"Set adjust *option* as integer. Options that take a different type value\n        are ignored.\n        Passing libvlc_adjust_enable as *option* *value* has the side effect of\n        starting (arg !0) or stopping (arg 0) the adjust filter.\n\n        :param option: adust option to set, values of :class:`VideoAdjustOption`.\n        :param value: adjust option value.\n\n        :version: LibVLC 1.1.1 and later.\n        \"\"\"\n        return libvlc_video_set_adjust_int(self, option, value)\n\n    def video_set_aspect_ratio(self, psz_aspect):\n        \"\"\"Set new video aspect ratio.\n\n\n        .. note:: Invalid aspect ratios are ignored.\n\n        :param psz_aspect: new video aspect-ratio or None to reset to default.\n        \"\"\"\n        return libvlc_video_set_aspect_ratio(self, str_to_bytes(psz_aspect))\n\n    def video_set_callbacks(self, lock, unlock, display, opaque):\n        \"\"\"Set callbacks and private data to render decoded video to a custom area\n        in memory.\n        Use :func:`video_set_format` or :func:`video_set_format_callbacks`\n        to configure the decoded format.\n\n        .. warning:: Rendering video into custom memory buffers is considerably less\n            efficient than rendering in a custom window as normal.\n\n        For optimal perfomances, VLC media player renders into a custom window, and\n        does not use this function and associated callbacks. It is **highly\n        recommended** that other LibVLC-based application do likewise.\n        To embed video in a window, use libvlc_media_player_set_xid or equivalent\n        depending on the operating system.\n\n        If window embedding does not fit the application use case, then a custom\n        LibVLC video output *display* plugin is required to maintain optimal video\n        rendering performances.\n\n        The following limitations affect performance:\n\n        * Hardware video decoding acceleration will either be disabled completely,\n            or require (relatively slow) copy from video/DSP memory to main memory.\n        * Sub-pictures (subtitles, on-screen *display*, etc.) must be blent into the\n            main picture by the CPU instead of the GPU.\n        * Depending on the video format, pixel format conversion, picture scaling,\n            cropping and/or picture re-orientation, must be performed by the CPU\n            instead of the GPU.\n        * Memory copying is required between LibVLC reference picture buffers and\n            application buffers (between *lock* and *unlock* callbacks).\n\n        :param lock: callback to lock video memory (must not be None).\n        :param unlock: callback to unlock video memory (or None if not needed).\n        :param display: callback to display video (or None if not needed).\n        :param opaque: private pointer for the three callbacks (as first parameter).\n\n        :version: LibVLC 1.1.1 or later.\n        \"\"\"\n        return libvlc_video_set_callbacks(self, lock, unlock, display, opaque)\n\n    def video_set_crop_geometry(self, psz_geometry):\n        \"\"\"Set new crop filter geometry.\n\n        :param psz_geometry: new crop filter geometry (None to unset).\n        \"\"\"\n        return libvlc_video_set_crop_geometry(self, str_to_bytes(psz_geometry))\n\n    def video_set_deinterlace(self, psz_mode):\n        \"\"\"Enable or disable deinterlace filter\n\n        :param psz_mode: type of deinterlace filter, None to disable.\n        \"\"\"\n        return libvlc_video_set_deinterlace(self, str_to_bytes(psz_mode))\n\n    def video_set_format(self, chroma, width, height, pitch):\n        \"\"\"Set decoded video *chroma* and dimensions.\n        This only works in combination with :func:`video_set_callbacks`,\n        and is mutually exclusive with :func:`video_set_format_callbacks`.\n\n        :param chroma: a four-characters string identifying the chroma.\n            (e.g. \"RV32\" or \"YUYV\").\n        :param width: pixel width.\n        :param height: pixel height.\n        :param pitch: line pitch (in bytes).\n\n        :version: LibVLC 1.1.1 or later.\n        :bug: All pixel planes are expected to have the same *pitch*.\n            To use the YCbCr color space with chrominance subsampling,\n            consider using :func:`video_set_format_callbacks` instead.\n        \"\"\"\n        return libvlc_video_set_format(self, str_to_bytes(chroma), width, height, pitch)\n\n    def video_set_format_callbacks(self, setup, cleanup):\n        \"\"\"Set decoded video chroma and dimensions. This only works in combination with\n        :func:`video_set_callbacks`.\n\n        :param setup: callback to select the video format (cannot be None).\n        :param cleanup: callback to release any allocated resources (or None).\n\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_video_set_format_callbacks(self, setup, cleanup)\n\n    def video_set_key_input(self, on):\n        \"\"\"Enable or disable key press events handling, according to the LibVLC hotkeys\n        configuration. By default and for historical reasons, keyboard events are\n        handled by the LibVLC video widget.\n\n        .. note:: On X11, there can be only one subscriber for key press and mouse\n            click events per window. If your application has subscribed to those events\n            for the X window ID of the video widget, then LibVLC will not be able to\n            handle key presses and mouse clicks in any case.\n\n        .. warning:: This function is only implemented for X11 and Win32 at the moment.\n\n        :param on: true to handle key press events, false to ignore them.\n        \"\"\"\n        return libvlc_video_set_key_input(self, on)\n\n    def video_set_logo_int(self, option, value):\n        \"\"\"Set logo *option* as integer. Options that take a different type value\n        are ignored.\n        Passing libvlc_logo_enable as *option* *value* has the side effect of\n        starting (arg !0) or stopping (arg 0) the logo filter.\n\n        :param option: logo option to set, values of :class:`VideoLogoOption`.\n        :param value: logo option value.\n        \"\"\"\n        return libvlc_video_set_logo_int(self, option, value)\n\n    def video_set_logo_string(self, option, psz_value):\n        \"\"\"Set logo *option* as string. Options that take a different type value\n        are ignored.\n\n        :param option: logo option to set, values of :class:`VideoLogoOption`.\n        :param psz_value: logo option value.\n        \"\"\"\n        return libvlc_video_set_logo_string(self, option, str_to_bytes(psz_value))\n\n    def video_set_marquee_int(self, option, i_val):\n        \"\"\"Enable, disable or set an integer marquee option\n\n        Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)\n        or disabling (arg 0) the marq filter.\n\n        :param option: marq option to set libvlc_video_marquee_int_option_t.\n        :param i_val: marq option value.\n        \"\"\"\n        return libvlc_video_set_marquee_int(self, option, i_val)\n\n    def video_set_marquee_string(self, option, psz_text):\n        \"\"\"Set a marquee string option\n\n        :param option: marq option to set libvlc_video_marquee_string_option_t.\n        :param psz_text: marq option value.\n        \"\"\"\n        return libvlc_video_set_marquee_string(self, option, str_to_bytes(psz_text))\n\n    def video_set_mouse_input(self, on):\n        \"\"\"Enable or disable mouse click events handling. By default, those events are\n        handled. This is needed for DVD menus to work, as well as a few video\n        filters such as \"puzzle\".\n\n        :func:`video_set_key_input`.\n\n        .. warning:: This function is only implemented for X11 and Win32 at the moment.\n\n        :param on: true to handle mouse click events, false to ignore them.\n        \"\"\"\n        return libvlc_video_set_mouse_input(self, on)\n\n    def video_set_scale(self, f_factor):\n        \"\"\"Set the video scaling factor. That is the ratio of the number of pixels on\n        screen to the number of pixels in the original decoded video in each\n        dimension. Zero is a special value; it will adjust the video to the output\n        window/drawable (in windowed mode) or the entire screen.\n\n        Note that not all video outputs support scaling.\n\n        :param f_factor: the scaling factor, or zero.\n        \"\"\"\n        return libvlc_video_set_scale(self, f_factor)\n\n    def video_set_spu(self, i_spu):\n        \"\"\"Set new video subtitle.\n\n        :param i_spu: video subtitle track to select (i_id from track description).\n\n        :return: 0 on success, -1 if out of range.\n        \"\"\"\n        return libvlc_video_set_spu(self, i_spu)\n\n    def video_set_spu_delay(self, i_delay):\n        \"\"\"Set the subtitle delay. This affects the timing of when the subtitle will\n        be displayed. Positive values result in subtitles being displayed later,\n        while negative values will result in subtitles being displayed earlier.\n\n        The subtitle delay will be reset to zero each time the media changes.\n\n        :param i_delay: time (in microseconds) the display of subtitles should be delayed.\n\n        :return: 0 on success, -1 on error.\n        :version: LibVLC 2.0.0 or later.\n        \"\"\"\n        return libvlc_video_set_spu_delay(self, i_delay)\n\n    def video_set_subtitle_file(self, psz_subtitle):\n        \"\"\"Set new video subtitle file.\n\n        .. warning:: **Deprecated!** Use :func:`add_slave` instead.\n\n        :param psz_subtitle: new video subtitle file.\n\n        :return: the success status (boolean).\n        \"\"\"\n        return libvlc_video_set_subtitle_file(self, str_to_bytes(psz_subtitle))\n\n    def video_set_teletext(self, i_page):\n        \"\"\"Set new teletext page to retrieve.\n\n        This function can also be used to send a teletext key.\n\n        :param i_page: teletex page number requested. This value can be 0 to disable.\n            teletext, a number in the range ]0;1000[ to show the requested page, or a.\n            :class:`TeletextKey`. 100 is the default teletext page.\n        \"\"\"\n        return libvlc_video_set_teletext(self, i_page)\n\n    def video_set_track(self, i_track):\n        \"\"\"Set video track.\n\n        :param i_track: the track ID (i_id field from track description).\n\n        :return: 0 on success, -1 if out of range.\n        \"\"\"\n        return libvlc_video_set_track(self, i_track)\n\n    def video_take_snapshot(self, num, psz_filepath, i_width, i_height):\n        \"\"\"Take a snapshot of the current video window.\n\n        If *i_width* AND *i_height* is 0, original size is used.\n        If *i_width* XOR *i_height* is 0, original aspect-ratio is preserved.\n\n        :param num: number of video output (typically 0 for the first/only one).\n        :param psz_filepath: the path of a file or a folder to save the screenshot into.\n        :param i_width: the snapshot's width.\n        :param i_height: the snapshot's height.\n\n        :return: 0 on success, -1 if the video was not found.\n        \"\"\"\n        return libvlc_video_take_snapshot(\n            self, num, str_to_bytes(psz_filepath), i_width, i_height\n        )\n\n    def video_update_viewpoint(self, p_viewpoint, b_absolute):\n        \"\"\"Update the video viewpoint information.\n\n        .. note:: It is safe to call this function before the media player is started.\n\n        .. note:: the values are set asynchronously, it will be used by the next frame displayed.\n\n        :param p_viewpoint: video viewpoint allocated via :func:`video_new_viewpoint`.\n        :param b_absolute: if true replace the old viewpoint with the new one. If.\n            false, increase/decrease it.\n\n        :return: -1 in case of error, 0 otherwise.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        return libvlc_video_update_viewpoint(self, p_viewpoint, b_absolute)\n\n\nclass Renderer(_Ctype):\n    def __new__(cls, ptr=_internal_guard):\n        \"\"\"(INTERNAL) ctypes wrapper constructor.\"\"\"\n        return _Constructor(cls, ptr)\n\n    def flags(self):\n        \"\"\"Get the flags of a renderer item\n\n        LIBVLC_RENDERER_CAN_AUDIO\n        LIBVLC_RENDERER_CAN_VIDEO\n\n        :return: bitwise flag: capabilities of the renderer, see.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_flags(self)\n\n    def hold(self):\n        \"\"\"Hold a renderer item, i.e. creates a new reference\n\n        This functions need to called from the libvlc_RendererDiscovererItemAdded\n        callback if the libvlc user wants to use this item after. (for display or\n        for passing it to the mediaplayer for example).\n\n        :return: the current item.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_hold(self)\n\n    def icon_uri(self):\n        \"\"\"Get the icon uri of a renderer item\n\n        :return: the uri of the item's icon (can be None, must *not* be freed).\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_icon_uri(self)\n\n    def name(self):\n        \"\"\"Get the human readable name of a renderer item\n\n        :return: the name of the item (can't be None, must *not* be freed).\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_name(self)\n\n    def release(self):\n        \"\"\"Releases a renderer item, i.e. decrements its reference counter\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_release(self)\n\n    def type(self):\n        \"\"\"Get the type (not translated) of a renderer item. For now, the type can only\n        be \"chromecast\" (\"upnp\", \"airplay\" may come later).\n\n        :return: the type of the item (can't be None, must *not* be freed).\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_item_type(self)\n\n\nclass RendererDiscoverer(_Ctype):\n    def __new__(cls, ptr=_internal_guard):\n        \"\"\"(INTERNAL) ctypes wrapper constructor.\"\"\"\n        return _Constructor(cls, ptr)\n\n    @memoize_parameterless\n    def event_manager(self):\n        \"\"\"Get the event manager of the renderer discoverer\n\n        The possible events to attach are libvlc_RendererDiscovererItemAdded\n        and libvlc_RendererDiscovererItemDeleted.\n\n        The :class:`Renderer` struct passed to event callbacks is owned by\n        VLC, users should take care of holding/releasing this struct for their\n        internal usage.\n\n        :class:`Event`.u.renderer_discoverer_item_added.item\n        :class:`Event`.u.renderer_discoverer_item_removed.item\n\n        :return: a valid event manager (can't fail).\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_discoverer_event_manager(self)\n\n    def release(self):\n        \"\"\"Release a renderer discoverer object\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_discoverer_release(self)\n\n    def start(self):\n        \"\"\"Start renderer discovery\n\n        To stop it, call :func:`stop` or\n        :func:`release` directly.\n\n        :func:`stop`\n\n        :return: -1 in case of error, 0 otherwise.\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_discoverer_start(self)\n\n    def stop(self):\n        \"\"\"Stop renderer discovery.\n\n        :func:`start`\n\n        :version: LibVLC 3.0.0 or later.\n        \"\"\"\n        return libvlc_renderer_discoverer_stop(self)\n\n\n# End of generated wrappers #\n\n\n# Generated enum types #\nclass AudioOutputChannel(_Enum):\n    \"\"\"Audio channels.\"\"\"\n\n    _enum_names_ = {\n        -1: \"Error\",\n        1: \"Stereo\",\n        2: \"RStereo\",\n        3: \"Left\",\n        4: \"Right\",\n        5: \"Dolbys\",\n    }\n\n\nAudioOutputChannel.Dolbys = AudioOutputChannel(5)\nAudioOutputChannel.Error = AudioOutputChannel(-1)\nAudioOutputChannel.Left = AudioOutputChannel(3)\nAudioOutputChannel.RStereo = AudioOutputChannel(2)\nAudioOutputChannel.Right = AudioOutputChannel(4)\nAudioOutputChannel.Stereo = AudioOutputChannel(1)\n\n\nclass AudioOutputDeviceTypes(_Enum):\n    \"\"\"Audio device types.\"\"\"\n\n    _enum_names_ = {\n        -1: \"Error\",\n        1: \"Mono\",\n        2: \"Stereo\",\n        4: \"_2F2R\",\n        5: \"_3F2R\",\n        6: \"_5_1\",\n        7: \"_6_1\",\n        8: \"_7_1\",\n        10: \"SPDIF\",\n    }\n\n\nAudioOutputDeviceTypes.Error = AudioOutputDeviceTypes(-1)\nAudioOutputDeviceTypes.Mono = AudioOutputDeviceTypes(1)\nAudioOutputDeviceTypes.SPDIF = AudioOutputDeviceTypes(10)\nAudioOutputDeviceTypes.Stereo = AudioOutputDeviceTypes(2)\nAudioOutputDeviceTypes._2F2R = AudioOutputDeviceTypes(4)\nAudioOutputDeviceTypes._3F2R = AudioOutputDeviceTypes(5)\nAudioOutputDeviceTypes._5_1 = AudioOutputDeviceTypes(6)\nAudioOutputDeviceTypes._6_1 = AudioOutputDeviceTypes(7)\nAudioOutputDeviceTypes._7_1 = AudioOutputDeviceTypes(8)\n\n\nclass DialogQuestionType(_Enum):\n    _enum_names_ = {\n        0: \"DIALOG_QUESTION_NORMAL\",\n        1: \"DIALOG_QUESTION_WARNING\",\n        2: \"DIALOG_QUESTION_CRITICAL\",\n    }\n\n\nDialogQuestionType.DIALOG_QUESTION_CRITICAL = DialogQuestionType(2)\nDialogQuestionType.DIALOG_QUESTION_NORMAL = DialogQuestionType(0)\nDialogQuestionType.DIALOG_QUESTION_WARNING = DialogQuestionType(1)\n\n\nclass EventType(_Enum):\n    \"\"\"Event types.\"\"\"\n\n    _enum_names_ = {\n        0: \"MediaMetaChanged\",\n        1: \"MediaSubItemAdded\",\n        2: \"MediaDurationChanged\",\n        3: \"MediaParsedChanged\",\n        4: \"MediaFreed\",\n        5: \"MediaStateChanged\",\n        6: \"MediaSubItemTreeAdded\",\n        0x100: \"MediaPlayerMediaChanged\",\n        257: \"MediaPlayerNothingSpecial\",\n        258: \"MediaPlayerOpening\",\n        259: \"MediaPlayerBuffering\",\n        260: \"MediaPlayerPlaying\",\n        261: \"MediaPlayerPaused\",\n        262: \"MediaPlayerStopped\",\n        263: \"MediaPlayerForward\",\n        264: \"MediaPlayerBackward\",\n        265: \"MediaPlayerEndReached\",\n        266: \"MediaPlayerEncounteredError\",\n        267: \"MediaPlayerTimeChanged\",\n        268: \"MediaPlayerPositionChanged\",\n        269: \"MediaPlayerSeekableChanged\",\n        270: \"MediaPlayerPausableChanged\",\n        271: \"MediaPlayerTitleChanged\",\n        272: \"MediaPlayerSnapshotTaken\",\n        273: \"MediaPlayerLengthChanged\",\n        274: \"MediaPlayerVout\",\n        275: \"MediaPlayerScrambledChanged\",\n        276: \"MediaPlayerESAdded\",\n        277: \"MediaPlayerESDeleted\",\n        278: \"MediaPlayerESSelected\",\n        279: \"MediaPlayerCorked\",\n        280: \"MediaPlayerUncorked\",\n        281: \"MediaPlayerMuted\",\n        282: \"MediaPlayerUnmuted\",\n        283: \"MediaPlayerAudioVolume\",\n        284: \"MediaPlayerAudioDevice\",\n        285: \"MediaPlayerChapterChanged\",\n        0x200: \"MediaListItemAdded\",\n        513: \"MediaListWillAddItem\",\n        514: \"MediaListItemDeleted\",\n        515: \"MediaListWillDeleteItem\",\n        516: \"MediaListEndReached\",\n        0x300: \"MediaListViewItemAdded\",\n        769: \"MediaListViewWillAddItem\",\n        770: \"MediaListViewItemDeleted\",\n        771: \"MediaListViewWillDeleteItem\",\n        0x400: \"MediaListPlayerPlayed\",\n        1025: \"MediaListPlayerNextItemSet\",\n        1026: \"MediaListPlayerStopped\",\n        0x500: \"MediaDiscovererStarted\",\n        1281: \"MediaDiscovererEnded\",\n        1282: \"RendererDiscovererItemAdded\",\n        1283: \"RendererDiscovererItemDeleted\",\n        0x600: \"VlmMediaAdded\",\n        1537: \"VlmMediaRemoved\",\n        1538: \"VlmMediaChanged\",\n        1539: \"VlmMediaInstanceStarted\",\n        1540: \"VlmMediaInstanceStopped\",\n        1541: \"VlmMediaInstanceStatusInit\",\n        1542: \"VlmMediaInstanceStatusOpening\",\n        1543: \"VlmMediaInstanceStatusPlaying\",\n        1544: \"VlmMediaInstanceStatusPause\",\n        1545: \"VlmMediaInstanceStatusEnd\",\n        1546: \"VlmMediaInstanceStatusError\",\n    }\n\n\nEventType.MediaDiscovererEnded = EventType(1281)\nEventType.MediaDiscovererStarted = EventType(0x500)\nEventType.MediaDurationChanged = EventType(2)\nEventType.MediaFreed = EventType(4)\nEventType.MediaListEndReached = EventType(516)\nEventType.MediaListItemAdded = EventType(0x200)\nEventType.MediaListItemDeleted = EventType(514)\nEventType.MediaListPlayerNextItemSet = EventType(1025)\nEventType.MediaListPlayerPlayed = EventType(0x400)\nEventType.MediaListPlayerStopped = EventType(1026)\nEventType.MediaListViewItemAdded = EventType(0x300)\nEventType.MediaListViewItemDeleted = EventType(770)\nEventType.MediaListViewWillAddItem = EventType(769)\nEventType.MediaListViewWillDeleteItem = EventType(771)\nEventType.MediaListWillAddItem = EventType(513)\nEventType.MediaListWillDeleteItem = EventType(515)\nEventType.MediaMetaChanged = EventType(0)\nEventType.MediaParsedChanged = EventType(3)\nEventType.MediaPlayerAudioDevice = EventType(284)\nEventType.MediaPlayerAudioVolume = EventType(283)\nEventType.MediaPlayerBackward = EventType(264)\nEventType.MediaPlayerBuffering = EventType(259)\nEventType.MediaPlayerChapterChanged = EventType(285)\nEventType.MediaPlayerCorked = EventType(279)\nEventType.MediaPlayerESAdded = EventType(276)\nEventType.MediaPlayerESDeleted = EventType(277)\nEventType.MediaPlayerESSelected = EventType(278)\nEventType.MediaPlayerEncounteredError = EventType(266)\nEventType.MediaPlayerEndReached = EventType(265)\nEventType.MediaPlayerForward = EventType(263)\nEventType.MediaPlayerLengthChanged = EventType(273)\nEventType.MediaPlayerMediaChanged = EventType(0x100)\nEventType.MediaPlayerMuted = EventType(281)\nEventType.MediaPlayerNothingSpecial = EventType(257)\nEventType.MediaPlayerOpening = EventType(258)\nEventType.MediaPlayerPausableChanged = EventType(270)\nEventType.MediaPlayerPaused = EventType(261)\nEventType.MediaPlayerPlaying = EventType(260)\nEventType.MediaPlayerPositionChanged = EventType(268)\nEventType.MediaPlayerScrambledChanged = EventType(275)\nEventType.MediaPlayerSeekableChanged = EventType(269)\nEventType.MediaPlayerSnapshotTaken = EventType(272)\nEventType.MediaPlayerStopped = EventType(262)\nEventType.MediaPlayerTimeChanged = EventType(267)\nEventType.MediaPlayerTitleChanged = EventType(271)\nEventType.MediaPlayerUncorked = EventType(280)\nEventType.MediaPlayerUnmuted = EventType(282)\nEventType.MediaPlayerVout = EventType(274)\nEventType.MediaStateChanged = EventType(5)\nEventType.MediaSubItemAdded = EventType(1)\nEventType.MediaSubItemTreeAdded = EventType(6)\nEventType.RendererDiscovererItemAdded = EventType(1282)\nEventType.RendererDiscovererItemDeleted = EventType(1283)\nEventType.VlmMediaAdded = EventType(0x600)\nEventType.VlmMediaChanged = EventType(1538)\nEventType.VlmMediaInstanceStarted = EventType(1539)\nEventType.VlmMediaInstanceStatusEnd = EventType(1545)\nEventType.VlmMediaInstanceStatusError = EventType(1546)\nEventType.VlmMediaInstanceStatusInit = EventType(1541)\nEventType.VlmMediaInstanceStatusOpening = EventType(1542)\nEventType.VlmMediaInstanceStatusPause = EventType(1544)\nEventType.VlmMediaInstanceStatusPlaying = EventType(1543)\nEventType.VlmMediaInstanceStopped = EventType(1540)\nEventType.VlmMediaRemoved = EventType(1537)\n\n\nclass LogLevel(_Enum):\n    \"\"\"Logging messages level.\n\n    .. note:: Future LibVLC versions may define new levels.\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"DEBUG\",\n        2: \"NOTICE\",\n        3: \"WARNING\",\n        4: \"ERROR\",\n    }\n\n\nLogLevel.DEBUG = LogLevel(0)\nLogLevel.ERROR = LogLevel(4)\nLogLevel.NOTICE = LogLevel(2)\nLogLevel.WARNING = LogLevel(3)\n\n\nclass MediaDiscovererCategory(_Enum):\n    \"\"\"Category of a media discoverer\n    See :func:`libvlc_media_discoverer_list_get`.\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"devices\",\n        1: \"lan\",\n        2: \"podcasts\",\n        3: \"localdirs\",\n    }\n\n\nMediaDiscovererCategory.devices = MediaDiscovererCategory(0)\nMediaDiscovererCategory.lan = MediaDiscovererCategory(1)\nMediaDiscovererCategory.localdirs = MediaDiscovererCategory(3)\nMediaDiscovererCategory.podcasts = MediaDiscovererCategory(2)\n\n\nclass MediaParseFlag(_Enum):\n    \"\"\"Parse flags used by :func:`libvlc_media_parse_with_options`\n\n    See :func:`libvlc_media_parse_with_options`.\n    \"\"\"\n\n    _enum_names_ = {\n        0x0: \"local\",\n        0x1: \"network\",\n        0x2: \"fetch_local\",\n        0x4: \"fetch_network\",\n        0x8: \"do_interact\",\n    }\n\n\nMediaParseFlag.do_interact = MediaParseFlag(0x8)\nMediaParseFlag.fetch_local = MediaParseFlag(0x2)\nMediaParseFlag.fetch_network = MediaParseFlag(0x4)\nMediaParseFlag.local = MediaParseFlag(0x0)\nMediaParseFlag.network = MediaParseFlag(0x1)\n\n\nclass MediaParsedStatus(_Enum):\n    \"\"\"Parse status used sent by :func:`libvlc_media_parse_with_options` or returned by\n    :func:`libvlc_media_get_parsed_status`\n\n    See :func:`libvlc_media_parse_with_options`\n    See :func:`libvlc_media_get_parsed_status`.\n    \"\"\"\n\n    _enum_names_ = {\n        1: \"skipped\",\n        2: \"failed\",\n        3: \"timeout\",\n        4: \"done\",\n    }\n\n\nMediaParsedStatus.done = MediaParsedStatus(4)\nMediaParsedStatus.failed = MediaParsedStatus(2)\nMediaParsedStatus.skipped = MediaParsedStatus(1)\nMediaParsedStatus.timeout = MediaParsedStatus(3)\n\n\nclass MediaPlayerRole(_Enum):\n    \"\"\"Media player roles.\n\n    :version: LibVLC 3.0.0 and later.\n\n    See :func:`libvlc_media_player_set_role`.\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"_None\",\n        1: \"Music\",\n        2: \"Video\",\n        3: \"Communication\",\n        4: \"Game\",\n        5: \"Notification\",\n        6: \"Animation\",\n        7: \"Production\",\n        8: \"Accessibility\",\n        9: \"Test\",\n    }\n\n\nMediaPlayerRole.Accessibility = MediaPlayerRole(8)\nMediaPlayerRole.Animation = MediaPlayerRole(6)\nMediaPlayerRole.Communication = MediaPlayerRole(3)\nMediaPlayerRole.Game = MediaPlayerRole(4)\nMediaPlayerRole.Music = MediaPlayerRole(1)\nMediaPlayerRole.Notification = MediaPlayerRole(5)\nMediaPlayerRole.Production = MediaPlayerRole(7)\nMediaPlayerRole.Test = MediaPlayerRole(9)\nMediaPlayerRole.Video = MediaPlayerRole(2)\nMediaPlayerRole._None = MediaPlayerRole(0)\n\n\nclass MediaSlaveType(_Enum):\n    \"\"\"Type of a media slave: subtitle or audio.\"\"\"\n\n    _enum_names_ = {\n        0: \"subtitle\",\n        1: \"audio\",\n    }\n\n\nMediaSlaveType.audio = MediaSlaveType(1)\nMediaSlaveType.subtitle = MediaSlaveType(0)\n\n\nclass MediaType(_Enum):\n    \"\"\"Media type\n\n    See :func:`libvlc_media_get_type`.\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"unknown\",\n        1: \"file\",\n        2: \"directory\",\n        3: \"disc\",\n        4: \"stream\",\n        5: \"playlist\",\n    }\n\n\nMediaType.directory = MediaType(2)\nMediaType.disc = MediaType(3)\nMediaType.file = MediaType(1)\nMediaType.playlist = MediaType(5)\nMediaType.stream = MediaType(4)\nMediaType.unknown = MediaType(0)\n\n\nclass Meta(_Enum):\n    \"\"\"Meta data types.\"\"\"\n\n    _enum_names_ = {\n        0: \"Title\",\n        1: \"Artist\",\n        2: \"Genre\",\n        3: \"Copyright\",\n        4: \"Album\",\n        5: \"TrackNumber\",\n        6: \"Description\",\n        7: \"Rating\",\n        8: \"Date\",\n        9: \"Setting\",\n        10: \"URL\",\n        11: \"Language\",\n        12: \"NowPlaying\",\n        13: \"Publisher\",\n        14: \"EncodedBy\",\n        15: \"ArtworkURL\",\n        16: \"TrackID\",\n        17: \"TrackTotal\",\n        18: \"Director\",\n        19: \"Season\",\n        20: \"Episode\",\n        21: \"ShowName\",\n        22: \"Actors\",\n        23: \"AlbumArtist\",\n        24: \"DiscNumber\",\n        25: \"DiscTotal\",\n    }\n\n\nMeta.Actors = Meta(22)\nMeta.Album = Meta(4)\nMeta.AlbumArtist = Meta(23)\nMeta.Artist = Meta(1)\nMeta.ArtworkURL = Meta(15)\nMeta.Copyright = Meta(3)\nMeta.Date = Meta(8)\nMeta.Description = Meta(6)\nMeta.Director = Meta(18)\nMeta.DiscNumber = Meta(24)\nMeta.DiscTotal = Meta(25)\nMeta.EncodedBy = Meta(14)\nMeta.Episode = Meta(20)\nMeta.Genre = Meta(2)\nMeta.Language = Meta(11)\nMeta.NowPlaying = Meta(12)\nMeta.Publisher = Meta(13)\nMeta.Rating = Meta(7)\nMeta.Season = Meta(19)\nMeta.Setting = Meta(9)\nMeta.ShowName = Meta(21)\nMeta.Title = Meta(0)\nMeta.TrackID = Meta(16)\nMeta.TrackNumber = Meta(5)\nMeta.TrackTotal = Meta(17)\nMeta.URL = Meta(10)\n\n\nclass NavigateMode(_Enum):\n    \"\"\"Navigation mode.\"\"\"\n\n    _enum_names_ = {\n        0: \"activate\",\n        1: \"up\",\n        2: \"down\",\n        3: \"left\",\n        4: \"right\",\n        5: \"popup\",\n    }\n\n\nNavigateMode.activate = NavigateMode(0)\nNavigateMode.down = NavigateMode(2)\nNavigateMode.left = NavigateMode(3)\nNavigateMode.popup = NavigateMode(5)\nNavigateMode.right = NavigateMode(4)\nNavigateMode.up = NavigateMode(1)\n\n\nclass PlaybackMode(_Enum):\n    \"\"\"Defines playback modes for playlist.\"\"\"\n\n    _enum_names_ = {\n        0: \"default\",\n        1: \"loop\",\n        2: \"repeat\",\n    }\n\n\nPlaybackMode.default = PlaybackMode(0)\nPlaybackMode.loop = PlaybackMode(1)\nPlaybackMode.repeat = PlaybackMode(2)\n\n\nclass Position(_Enum):\n    \"\"\"Enumeration of values used to set position (e.g. of video title).\"\"\"\n\n    _enum_names_ = {\n        -1: \"disable\",\n        0: \"center\",\n        1: \"left\",\n        2: \"right\",\n        3: \"top\",\n        4: \"top_left\",\n        5: \"top_right\",\n        6: \"bottom\",\n        7: \"bottom_left\",\n        8: \"bottom_right\",\n    }\n\n\nPosition.bottom = Position(6)\nPosition.bottom_left = Position(7)\nPosition.bottom_right = Position(8)\nPosition.center = Position(0)\nPosition.disable = Position(-1)\nPosition.left = Position(1)\nPosition.right = Position(2)\nPosition.top = Position(3)\nPosition.top_left = Position(4)\nPosition.top_right = Position(5)\n\n\nclass State(_Enum):\n    \"\"\"Note the order of :class:`State` enum must match exactly the order of\n    See mediacontrol_PlayerStatus, See input_state_e enums,\n    and VideoLAN.LibVLC.State (at bindings/cil/src/media.cs).\n\n    Expected states by web plugins are:\n    IDLE/CLOSE=0, OPENING=1, PLAYING=3, PAUSED=4,\n    STOPPING=5, ENDED=6, ERROR=7.\n    \"\"\"\n\n    _enum_names_ = {\n        0: \"NothingSpecial\",\n        1: \"Opening\",\n        2: \"Buffering\",\n        3: \"Playing\",\n        4: \"Paused\",\n        5: \"Stopped\",\n        6: \"Ended\",\n        7: \"Error\",\n    }\n\n\nState.Buffering = State(2)\nState.Ended = State(6)\nState.Error = State(7)\nState.NothingSpecial = State(0)\nState.Opening = State(1)\nState.Paused = State(4)\nState.Playing = State(3)\nState.Stopped = State(5)\n\n\nclass TeletextKey(_Enum):\n    \"\"\"Enumeration of teletext keys than can be passed via\n    :func:`libvlc_video_set_teletext`.\n    \"\"\"\n\n    _enum_names_ = {\n        7471104: \"red\",\n        6750208: \"green\",\n        7929856: \"yellow\",\n        6422528: \"blue\",\n        6881280: \"index\",\n    }\n\n\nTeletextKey.blue = TeletextKey(6422528)\nTeletextKey.green = TeletextKey(6750208)\nTeletextKey.index = TeletextKey(6881280)\nTeletextKey.red = TeletextKey(7471104)\nTeletextKey.yellow = TeletextKey(7929856)\n\n\nclass TrackType(_Enum):\n    _enum_names_ = {\n        -1: \"unknown\",\n        0: \"audio\",\n        1: \"video\",\n        2: \"ext\",\n    }\n\n\nTrackType.audio = TrackType(0)\nTrackType.ext = TrackType(2)\nTrackType.unknown = TrackType(-1)\nTrackType.video = TrackType(1)\n\n\nclass VideoAdjustOption(_Enum):\n    \"\"\"option values for libvlc_video_{get,set}_adjust_{int,float,bool}.\"\"\"\n\n    _enum_names_ = {\n        0: \"Enable\",\n        1: \"Contrast\",\n        2: \"Brightness\",\n        3: \"Hue\",\n        4: \"Saturation\",\n        5: \"Gamma\",\n    }\n\n\nVideoAdjustOption.Brightness = VideoAdjustOption(2)\nVideoAdjustOption.Contrast = VideoAdjustOption(1)\nVideoAdjustOption.Enable = VideoAdjustOption(0)\nVideoAdjustOption.Gamma = VideoAdjustOption(5)\nVideoAdjustOption.Hue = VideoAdjustOption(3)\nVideoAdjustOption.Saturation = VideoAdjustOption(4)\n\n\nclass VideoLogoOption(_Enum):\n    \"\"\"option values for libvlc_video_{get,set}_logo_{int,string}.\"\"\"\n\n    _enum_names_ = {\n        0: \"logo_enable\",\n        1: \"logo_file\",\n        2: \"logo_x\",\n        3: \"logo_y\",\n        4: \"logo_delay\",\n        5: \"logo_repeat\",\n        6: \"logo_opacity\",\n        7: \"logo_position\",\n    }\n\n\nVideoLogoOption.logo_delay = VideoLogoOption(4)\nVideoLogoOption.logo_enable = VideoLogoOption(0)\nVideoLogoOption.logo_file = VideoLogoOption(1)\nVideoLogoOption.logo_opacity = VideoLogoOption(6)\nVideoLogoOption.logo_position = VideoLogoOption(7)\nVideoLogoOption.logo_repeat = VideoLogoOption(5)\nVideoLogoOption.logo_x = VideoLogoOption(2)\nVideoLogoOption.logo_y = VideoLogoOption(3)\n\n\nclass VideoMarqueeOption(_Enum):\n    \"\"\"Marq options definition.\"\"\"\n\n    _enum_names_ = {\n        0: \"Enable\",\n        1: \"Text\",\n        2: \"Color\",\n        3: \"Opacity\",\n        4: \"Position\",\n        5: \"Refresh\",\n        6: \"Size\",\n        7: \"Timeout\",\n        8: \"X\",\n        9: \"Y\",\n    }\n\n\nVideoMarqueeOption.Color = VideoMarqueeOption(2)\nVideoMarqueeOption.Enable = VideoMarqueeOption(0)\nVideoMarqueeOption.Opacity = VideoMarqueeOption(3)\nVideoMarqueeOption.Position = VideoMarqueeOption(4)\nVideoMarqueeOption.Refresh = VideoMarqueeOption(5)\nVideoMarqueeOption.Size = VideoMarqueeOption(6)\nVideoMarqueeOption.Text = VideoMarqueeOption(1)\nVideoMarqueeOption.Timeout = VideoMarqueeOption(7)\nVideoMarqueeOption.X = VideoMarqueeOption(8)\nVideoMarqueeOption.Y = VideoMarqueeOption(9)\n\n\nclass VideoOrient(_Enum):\n    _enum_names_ = {\n        0: \"top_left\",\n        1: \"top_right\",\n        2: \"bottom_left\",\n        3: \"bottom_right\",\n        4: \"left_top\",\n        5: \"left_bottom\",\n        6: \"right_top\",\n        7: \"right_bottom\",\n    }\n\n\nVideoOrient.bottom_left = VideoOrient(2)\nVideoOrient.bottom_right = VideoOrient(3)\nVideoOrient.left_bottom = VideoOrient(5)\nVideoOrient.left_top = VideoOrient(4)\nVideoOrient.right_bottom = VideoOrient(7)\nVideoOrient.right_top = VideoOrient(6)\nVideoOrient.top_left = VideoOrient(0)\nVideoOrient.top_right = VideoOrient(1)\n\n\nclass VideoProjection(_Enum):\n    _enum_names_ = {\n        0: \"rectangular\",\n        1: \"equirectangular\",\n        0x100: \"cubemap_layout_standard\",\n    }\n\n\nVideoProjection.cubemap_layout_standard = VideoProjection(0x100)\nVideoProjection.equirectangular = VideoProjection(1)\nVideoProjection.rectangular = VideoProjection(0)\n\n# End of generated enum types #\n\n\n# Generated structs #\nclass ModuleDescription(_Cstruct):\n    \"\"\"Description of a module.\"\"\"\n\n    pass\n\n\nModuleDescription._fields_ = (\n    (\"name\", ctypes.c_char_p),\n    (\"shortname\", ctypes.c_char_p),\n    (\"longname\", ctypes.c_char_p),\n    (\"help\", ctypes.c_char_p),\n    (\"next\", ctypes.POINTER(ModuleDescription)),\n)\n\n\nclass RdDescription(_Cstruct):\n    \"\"\"Renderer discoverer description\n\n    See :func:`libvlc_renderer_discoverer_list_get`.\n    \"\"\"\n\n    pass\n\n\nRdDescription._fields_ = (\n    (\"name\", ctypes.c_char_p),\n    (\"longname\", ctypes.c_char_p),\n)\n\n\nclass MediaStats(_Cstruct):\n    pass\n\n\nMediaStats._fields_ = (\n    (\"read_bytes\", ctypes.c_int),\n    (\"input_bitrate\", ctypes.c_float),\n    (\"demux_read_bytes\", ctypes.c_int),\n    (\"demux_bitrate\", ctypes.c_float),\n    (\"demux_corrupted\", ctypes.c_int),\n    (\"demux_discontinuity\", ctypes.c_int),\n    (\"decoded_video\", ctypes.c_int),\n    (\"decoded_audio\", ctypes.c_int),\n    (\"displayed_pictures\", ctypes.c_int),\n    (\"lost_pictures\", ctypes.c_int),\n    (\"played_abuffers\", ctypes.c_int),\n    (\"lost_abuffers\", ctypes.c_int),\n    (\"sent_packets\", ctypes.c_int),\n    (\"sent_bytes\", ctypes.c_int),\n    (\"send_bitrate\", ctypes.c_float),\n)\n\n\nclass MediaTrackInfo(_Cstruct):\n    class U(ctypes.Union):\n        class Audio(_Cstruct):\n            pass\n\n        Audio._fields_ = (\n            (\"channels\", ctypes.c_uint),\n            (\"rate\", ctypes.c_uint),\n        )\n\n        class Video(_Cstruct):\n            pass\n\n        Video._fields_ = (\n            (\"height\", ctypes.c_uint),\n            (\"width\", ctypes.c_uint),\n        )\n\n        pass\n\n    U._fields_ = (\n        (\"audio\", U.Audio),\n        (\"video\", U.Video),\n    )\n\n    pass\n\n\nMediaTrackInfo._fields_ = (\n    (\"codec\", ctypes.c_uint32),\n    (\"id\", ctypes.c_int),\n    (\"type\", TrackType),\n    (\"profile\", ctypes.c_int),\n    (\"level\", ctypes.c_int),\n    (\"u\", MediaTrackInfo.U),\n)\n\n\nclass AudioTrack(_Cstruct):\n    pass\n\n\nAudioTrack._fields_ = (\n    (\"channels\", ctypes.c_uint),\n    (\"rate\", ctypes.c_uint),\n)\n\n\nclass VideoViewpoint(_Cstruct):\n    \"\"\"Viewpoint\n\n    .. warning:: allocate using :func:`libvlc_video_new_viewpoint`.\n    \"\"\"\n\n    pass\n\n\nVideoViewpoint._fields_ = (\n    (\"yaw\", ctypes.c_float),\n    (\"pitch\", ctypes.c_float),\n    (\"roll\", ctypes.c_float),\n    (\"field_of_view\", ctypes.c_float),\n)\n\n\nclass VideoTrack(_Cstruct):\n    pass\n\n\nVideoTrack._fields_ = (\n    (\"height\", ctypes.c_uint),\n    (\"width\", ctypes.c_uint),\n    (\"sar_num\", ctypes.c_uint),\n    (\"sar_den\", ctypes.c_uint),\n    (\"frame_rate_num\", ctypes.c_uint),\n    (\"frame_rate_den\", ctypes.c_uint),\n    (\"orientation\", VideoOrient),\n    (\"projection\", VideoProjection),\n    (\"pose\", VideoViewpoint),\n)\n\n\nclass SubtitleTrack(_Cstruct):\n    pass\n\n\nSubtitleTrack._fields_ = ((\"encoding\", ctypes.c_char_p),)\n\n\nclass MediaTrack(_Cstruct):\n    pass\n\n\nMediaTrack._fields_ = (\n    (\"codec\", ctypes.c_uint32),\n    (\"original_fourcc\", ctypes.c_uint32),\n    (\"id\", ctypes.c_int),\n    (\"type\", TrackType),\n    (\"profile\", ctypes.c_int),\n    (\"level\", ctypes.c_int),\n    (\"audio\", ctypes.POINTER(AudioTrack)),\n    (\"video\", ctypes.POINTER(VideoTrack)),\n    (\"subtitle\", ctypes.POINTER(SubtitleTrack)),\n    (\"bitrate\", ctypes.c_uint),\n    (\"language\", ctypes.c_char_p),\n    (\"description\", ctypes.c_char_p),\n)\n\n\nclass MediaSlave(_Cstruct):\n    \"\"\"A slave of a :class:`Media`\n    See :func:`libvlc_media_slaves_get`.\n    \"\"\"\n\n    pass\n\n\nMediaSlave._fields_ = (\n    (\"uri\", ctypes.c_char_p),\n    (\"type\", MediaSlaveType),\n    (\"priority\", ctypes.c_uint),\n)\n\n\nclass TrackDescription(_Cstruct):\n    \"\"\"Description for video, audio tracks and subtitles. It contains\n    id, name (description string) and pointer to next record.\n    \"\"\"\n\n    pass\n\n\nTrackDescription._fields_ = (\n    (\"id\", ctypes.c_int),\n    (\"name\", ctypes.c_char_p),\n    (\"next\", ctypes.POINTER(TrackDescription)),\n)\n\n\nclass TitleDescription(_Cstruct):\n    pass\n\n\nTitleDescription._fields_ = (\n    (\"duration\", ctypes.c_int64),\n    (\"name\", ctypes.c_char_p),\n    (\"flags\", ctypes.c_uint),\n)\n\n\nclass ChapterDescription(_Cstruct):\n    \"\"\"Description for chapters.\"\"\"\n\n    pass\n\n\nChapterDescription._fields_ = (\n    (\"time_offset\", ctypes.c_int64),\n    (\"duration\", ctypes.c_int64),\n    (\"name\", ctypes.c_char_p),\n)\n\n\nclass AudioOutput(_Cstruct):\n    \"\"\"Description for audio output. It contains\n    name, description and pointer to next record.\n    \"\"\"\n\n    pass\n\n\nAudioOutput._fields_ = (\n    (\"name\", ctypes.c_char_p),\n    (\"description\", ctypes.c_char_p),\n    (\"next\", ctypes.POINTER(AudioOutput)),\n)\n\n\nclass AudioOutputDevice(_Cstruct):\n    \"\"\"Description for audio output device.\"\"\"\n\n    pass\n\n\nAudioOutputDevice._fields_ = (\n    (\"next\", ctypes.POINTER(AudioOutputDevice)),\n    (\"device\", ctypes.c_char_p),\n    (\"description\", ctypes.c_char_p),\n)\n\n\nclass MediaDiscovererDescription(_Cstruct):\n    \"\"\"Media discoverer description\n    See :func:`libvlc_media_discoverer_list_get`.\n    \"\"\"\n\n    pass\n\n\nMediaDiscovererDescription._fields_ = (\n    (\"name\", ctypes.c_char_p),\n    (\"longname\", ctypes.c_char_p),\n    (\"cat\", MediaDiscovererCategory),\n)\n\n\nclass Event(_Cstruct):\n    \"\"\"A LibVLC event.\"\"\"\n\n    class U(ctypes.Union):\n        \"\"\"< Object emitting the event\"\"\"\n\n        class MediaMetaChanged(_Cstruct):\n            pass\n\n        MediaMetaChanged._fields_ = ((\"meta_type\", Meta),)\n\n        class MediaSubitemAdded(_Cstruct):\n            pass\n\n        MediaSubitemAdded._fields_ = ()\n\n        class MediaDurationChanged(_Cstruct):\n            pass\n\n        MediaDurationChanged._fields_ = ((\"new_duration\", ctypes.c_int64),)\n\n        class MediaParsedChanged(_Cstruct):\n            pass\n\n        MediaParsedChanged._fields_ = ((\"new_status\", ctypes.c_int),)\n\n        class MediaFreed(_Cstruct):\n            pass\n\n        MediaFreed._fields_ = ()\n\n        class MediaStateChanged(_Cstruct):\n            pass\n\n        MediaStateChanged._fields_ = ((\"new_state\", ctypes.c_int),)\n\n        class MediaSubitemtreeAdded(_Cstruct):\n            pass\n\n        MediaSubitemtreeAdded._fields_ = ()\n\n        class MediaPlayerBuffering(_Cstruct):\n            pass\n\n        MediaPlayerBuffering._fields_ = ((\"new_cache\", ctypes.c_float),)\n\n        class MediaPlayerChapterChanged(_Cstruct):\n            pass\n\n        MediaPlayerChapterChanged._fields_ = ((\"new_chapter\", ctypes.c_int),)\n\n        class MediaPlayerPositionChanged(_Cstruct):\n            pass\n\n        MediaPlayerPositionChanged._fields_ = ((\"new_position\", ctypes.c_float),)\n\n        class MediaPlayerTimeChanged(_Cstruct):\n            pass\n\n        MediaPlayerTimeChanged._fields_ = ((\"new_time\", ctypes.c_longlong),)\n\n        class MediaPlayerTitleChanged(_Cstruct):\n            pass\n\n        MediaPlayerTitleChanged._fields_ = ((\"new_title\", ctypes.c_int),)\n\n        class MediaPlayerSeekableChanged(_Cstruct):\n            pass\n\n        MediaPlayerSeekableChanged._fields_ = ((\"new_seekable\", ctypes.c_int),)\n\n        class MediaPlayerPausableChanged(_Cstruct):\n            pass\n\n        MediaPlayerPausableChanged._fields_ = ((\"new_pausable\", ctypes.c_int),)\n\n        class MediaPlayerScrambledChanged(_Cstruct):\n            pass\n\n        MediaPlayerScrambledChanged._fields_ = ((\"new_scrambled\", ctypes.c_int),)\n\n        class MediaPlayerVout(_Cstruct):\n            pass\n\n        MediaPlayerVout._fields_ = ((\"new_count\", ctypes.c_int),)\n\n        class MediaListItemAdded(_Cstruct):\n            pass\n\n        MediaListItemAdded._fields_ = ((\"index\", ctypes.c_int),)\n\n        class MediaListWillAddItem(_Cstruct):\n            pass\n\n        MediaListWillAddItem._fields_ = ((\"index\", ctypes.c_int),)\n\n        class MediaListItemDeleted(_Cstruct):\n            pass\n\n        MediaListItemDeleted._fields_ = ((\"index\", ctypes.c_int),)\n\n        class MediaListWillDeleteItem(_Cstruct):\n            pass\n\n        MediaListWillDeleteItem._fields_ = ((\"index\", ctypes.c_int),)\n\n        class MediaListPlayerNextItemSet(_Cstruct):\n            pass\n\n        MediaListPlayerNextItemSet._fields_ = ()\n\n        class MediaPlayerSnapshotTaken(_Cstruct):\n            pass\n\n        MediaPlayerSnapshotTaken._fields_ = ((\"filename\", ctypes.c_char_p),)\n\n        class MediaPlayerLengthChanged(_Cstruct):\n            pass\n\n        MediaPlayerLengthChanged._fields_ = ((\"new_length\", ctypes.c_longlong),)\n\n        class VlmMediaEvent(_Cstruct):\n            pass\n\n        VlmMediaEvent._fields_ = (\n            (\"media_name\", ctypes.c_char_p),\n            (\"instance_name\", ctypes.c_char_p),\n        )\n\n        class MediaPlayerMediaChanged(_Cstruct):\n            pass\n\n        MediaPlayerMediaChanged._fields_ = ()\n\n        class MediaPlayerEsChanged(_Cstruct):\n            pass\n\n        MediaPlayerEsChanged._fields_ = (\n            (\"type\", TrackType),\n            (\"id\", ctypes.c_int),\n        )\n\n        class MediaPlayerAudioVolume(_Cstruct):\n            pass\n\n        MediaPlayerAudioVolume._fields_ = ((\"volume\", ctypes.c_float),)\n\n        class MediaPlayerAudioDevice(_Cstruct):\n            pass\n\n        MediaPlayerAudioDevice._fields_ = ((\"device\", ctypes.c_char_p),)\n\n        class RendererDiscovererItemAdded(_Cstruct):\n            pass\n\n        RendererDiscovererItemAdded._fields_ = ()\n\n        class RendererDiscovererItemDeleted(_Cstruct):\n            pass\n\n        RendererDiscovererItemDeleted._fields_ = ()\n\n        pass\n\n    U._fields_ = (\n        (\"media_meta_changed\", U.MediaMetaChanged),\n        (\"media_subitem_added\", U.MediaSubitemAdded),\n        (\"media_duration_changed\", U.MediaDurationChanged),\n        (\"media_parsed_changed\", U.MediaParsedChanged),\n        (\"media_freed\", U.MediaFreed),\n        (\"media_state_changed\", U.MediaStateChanged),\n        (\"media_subitemtree_added\", U.MediaSubitemtreeAdded),\n        (\"media_player_buffering\", U.MediaPlayerBuffering),\n        (\"media_player_chapter_changed\", U.MediaPlayerChapterChanged),\n        (\"media_player_position_changed\", U.MediaPlayerPositionChanged),\n        (\"media_player_time_changed\", U.MediaPlayerTimeChanged),\n        (\"media_player_title_changed\", U.MediaPlayerTitleChanged),\n        (\"media_player_seekable_changed\", U.MediaPlayerSeekableChanged),\n        (\"media_player_pausable_changed\", U.MediaPlayerPausableChanged),\n        (\"media_player_scrambled_changed\", U.MediaPlayerScrambledChanged),\n        (\"media_player_vout\", U.MediaPlayerVout),\n        (\"media_list_item_added\", U.MediaListItemAdded),\n        (\"media_list_will_add_item\", U.MediaListWillAddItem),\n        (\"media_list_item_deleted\", U.MediaListItemDeleted),\n        (\"media_list_will_delete_item\", U.MediaListWillDeleteItem),\n        (\"media_list_player_next_item_set\", U.MediaListPlayerNextItemSet),\n        (\"media_player_snapshot_taken\", U.MediaPlayerSnapshotTaken),\n        (\"media_player_length_changed\", U.MediaPlayerLengthChanged),\n        (\"vlm_media_event\", U.VlmMediaEvent),\n        (\"media_player_media_changed\", U.MediaPlayerMediaChanged),\n        (\"media_player_es_changed\", U.MediaPlayerEsChanged),\n        (\"media_player_audio_volume\", U.MediaPlayerAudioVolume),\n        (\"media_player_audio_device\", U.MediaPlayerAudioDevice),\n        (\"renderer_discoverer_item_added\", U.RendererDiscovererItemAdded),\n        (\"renderer_discoverer_item_deleted\", U.RendererDiscovererItemDeleted),\n    )\n\n    pass\n\n\nclass EventUnion(ctypes.Union):\n    \"\"\"A wrapper around the nested union :class:`Event.U` for backard compatibility.\"\"\"\n\n    _fields_ = [\n        (\"meta_type\", ctypes.c_uint),\n        (\"new_child\", ctypes.c_uint),\n        (\"new_duration\", ctypes.c_longlong),\n        (\"new_status\", ctypes.c_int),\n        (\"media\", ctypes.c_void_p),\n        (\"new_state\", ctypes.c_uint),\n        # FIXME: Media instance\n        (\"new_cache\", ctypes.c_float),\n        (\"new_position\", ctypes.c_float),\n        (\"new_time\", ctypes.c_longlong),\n        (\"new_title\", ctypes.c_int),\n        (\"new_seekable\", ctypes.c_longlong),\n        (\"new_pausable\", ctypes.c_longlong),\n        (\"new_scrambled\", ctypes.c_longlong),\n        (\"new_count\", ctypes.c_longlong),\n        # FIXME: Skipped MediaList and MediaListView...\n        (\"filename\", ctypes.c_char_p),\n        (\"new_length\", ctypes.c_longlong),\n    ]\n\n\nEvent._fields_ = (\n    (\"type\", EventType),\n    (\"obj\", ctypes.c_void_p),\n    (\"u\", EventUnion),\n)\n\n\nclass DialogCbs(_Cstruct):\n    \"\"\"Dialog callbacks to be implemented.\"\"\"\n\n    PfDisplayError = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p\n    )\n    PfDisplayError.__doc__ = \"\"\"Called when an error message needs to be displayed\n\n:param p_data: opaque pointer for the callback.\n:param psz_title: title of the dialog.\n:param psz_text: text of the dialog.\"\"\"\n\n    PfDisplayLogin = ctypes.CFUNCTYPE(\n        None,\n        ctypes.c_void_p,\n        ctypes.c_void_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_bool,\n    )\n    PfDisplayLogin.__doc__ = \"\"\"Called when a login dialog needs to be displayed\n\nYou can interact with this dialog by calling :func:`libvlc_dialog_post_login`\nto post an answer or :func:`libvlc_dialog_dismiss` to cancel this dialog.\n\n.. note:: to receive this callback, :class:`DialogCbs`.pf_cancel should not be\n    None.\n\n:param p_data: opaque pointer for the callback.\n:param p_id: id used to interact with the dialog.\n:param psz_title: title of the dialog.\n:param psz_text: text of the dialog.\n:param psz_default_username: user name that should be set on the user form.\n:param b_ask_store: if true, ask the user if he wants to save the.\n    credentials.\"\"\"\n\n    PfDisplayQuestion = ctypes.CFUNCTYPE(\n        None,\n        ctypes.c_void_p,\n        ctypes.c_void_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        DialogQuestionType,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    PfDisplayQuestion.__doc__ = \"\"\"Called when a question dialog needs to be displayed\n\nYou can interact with this dialog by calling :func:`libvlc_dialog_post_action`\nto post an answer or :func:`libvlc_dialog_dismiss` to cancel this dialog.\n\n.. note:: to receive this callback, :class:`DialogCbs`.pf_cancel should not be\n    None.\n\n:param p_data: opaque pointer for the callback.\n:param p_id: id used to interact with the dialog.\n:param psz_title: title of the dialog.\n:param psz_text: text of the dialog.\n:param i_type: question type (or severity) of the dialog.\n:param psz_cancel: text of the cancel button.\n:param psz_action1: text of the first button, if None, don't display this.\n    button.\n:param psz_action2: text of the second button, if None, don't display.\n    this button.\"\"\"\n\n    PfDisplayProgress = ctypes.CFUNCTYPE(\n        None,\n        ctypes.c_void_p,\n        ctypes.c_void_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_bool,\n        ctypes.c_float,\n        ctypes.c_char_p,\n    )\n    PfDisplayProgress.__doc__ = \"\"\"Called when a progress dialog needs to be displayed\n\nIf cancellable (*psz_cancel* != None), you can cancel this dialog by\ncalling :func:`libvlc_dialog_dismiss`\n\n.. note:: to receive this callback, :class:`DialogCbs`.pf_cancel and\n    :class:`DialogCbs`.pf_update_progress should not be None.\n\n:param p_data: opaque pointer for the callback.\n:param p_id: id used to interact with the dialog.\n:param psz_title: title of the dialog.\n:param psz_text: text of the dialog.\n:param b_indeterminate: true if the progress dialog is indeterminate.\n:param f_position: initial position of the progress bar (between 0.0 and.\n    1.0).\n:param psz_cancel: text of the cancel button, if None the dialog is not.\n    cancellable.\"\"\"\n\n    PfCancel = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p)\n    PfCancel.__doc__ = \"\"\"Called when a displayed dialog needs to be cancelled\n\nThe implementation must call :func:`libvlc_dialog_dismiss` to really release\nthe dialog.\n\n:param p_data: opaque pointer for the callback.\n:param p_id: id of the dialog.\"\"\"\n\n    PfUpdateProgress = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_float, ctypes.c_char_p\n    )\n    PfUpdateProgress.__doc__ = \"\"\"Called when a progress dialog needs to be updated\n\n:param p_data: opaque pointer for the callback.\n:param p_id: id of the dialog.\n:param f_position: osition of the progress bar (between 0.0 and 1.0).\n:param psz_text: new text of the progress dialog.\"\"\"\n\n    pass\n\n\nDialogCbs._fields_ = (\n    (\"pf_display_error\", DialogCbs.PfDisplayError),\n    (\"pf_display_login\", DialogCbs.PfDisplayLogin),\n    (\"pf_display_question\", DialogCbs.PfDisplayQuestion),\n    (\"pf_display_progress\", DialogCbs.PfDisplayProgress),\n    (\"pf_cancel\", DialogCbs.PfCancel),\n    (\"pf_update_progress\", DialogCbs.PfUpdateProgress),\n)\n\n\nclass LogMessage(_Cstruct):\n    pass\n\n\nLogMessage._fields_ = (\n    (\"severity\", ctypes.c_int),\n    (\"type\", ctypes.c_char_p),\n    (\"name\", ctypes.c_char_p),\n    (\"header\", ctypes.c_char_p),\n    (\"message\", ctypes.c_char_p),\n)\n\n# End of generated structs #\n\n\n# Generated callback definitions #\nclass AudioCleanupCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio playback cleanup.\n\n    This is called when the media player no longer needs an audio output.\n\n    :param opaque: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    \"\"\"\n\n    pass\n\n\nclass AudioDrainCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio buffer drain.\n\n    LibVLC may invoke this callback when the decoded audio track is ending.\n    There will be no further decoded samples for the track, but playback should\n    nevertheless continue until all already pending buffers are rendered.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    \"\"\"\n\n    pass\n\n\nclass AudioFlushCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio buffer flush.\n\n    LibVLC invokes this callback if it needs to discard all pending buffers and\n    stop playback as soon as possible. This typically occurs when the media is\n    stopped.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    \"\"\"\n\n    pass\n\n\nclass AudioPauseCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio pause.\n\n    LibVLC invokes this callback to pause audio playback.\n\n    .. note:: The pause callback is never called if the audio is already paused.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    :param pts: time stamp of the pause request (should be elapsed already).\n    \"\"\"\n\n    pass\n\n\nclass AudioPlayCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio playback.\n\n    The LibVLC media player decodes and post-processes the audio signal\n    asynchronously (in an internal thread). Whenever audio *samples* are ready\n    to be queued to the output, this callback is invoked.\n\n    The number of *samples* provided per invocation may depend on the file format,\n    the audio coding algorithm, the decoder plug-in, the post-processing\n    filters and timing. Application must not assume a certain number of *samples*.\n\n    The exact format of audio *samples* is determined by :func:`libvlc_audio_set_format`\n    or :func:`libvlc_audio_set_format_callbacks` as is the channels layout.\n\n    Note that the number of *samples* is per channel. For instance, if the audio\n    track sampling rate is 48000 Hz, then 1200 *samples* represent 25 milliseconds\n    of audio signal - regardless of the number of audio channels.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    :param samples: pointer to a table of audio samples to play back [IN].\n    :param count: number of audio samples to play back.\n    :param pts: expected play time stamp (see libvlc_delay).\n    \"\"\"\n\n    pass\n\n\nclass AudioResumeCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio resumption.\n\n    LibVLC invokes this callback to resume audio playback after it was\n    previously paused.\n\n    .. note:: The resume callback is never called if the audio is not paused.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    :param pts: time stamp of the resumption request (should be elapsed already).\n    \"\"\"\n\n    pass\n\n\nclass AudioSetVolumeCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for audio *volume* change.\n\n    :param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n    :param volume: software volume (1. = nominal, 0. = mute).\n    :param mute: muted flag.\n    \"\"\"\n\n    pass\n\n\nclass AudioSetupCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to setup the audio playback.\n\n    This is called when the media player needs to create a new audio output.\n\n    :param opaque: pointer to the data pointer passed to.\n        :func:`libvlc_audio_set_callbacks` [IN/OUT].\n    :param format: 4 bytes sample format [IN/OUT].\n    :param rate: sample rate [IN/OUT].\n    :param channels: channels count [IN/OUT].\n\n    :return: 0 on success, anything else to skip audio playback.\n    \"\"\"\n\n    pass\n\n\nclass Callback(ctypes.c_void_p):\n    \"\"\"Callback function notification.\n\n    :param p_event: the event triggering the callback.\n    \"\"\"\n\n    pass\n\n\nclass LogCb(ctypes.c_void_p):\n    \"\"\"Callback prototype for LibVLC log message handler.\n\n\n    .. note:: Log message handlers **must** be thread-safe.\n    .. warning:: The message context pointer, the format string parameters and the\n        variable arguments are only valid until the callback returns.\n\n    :param data: data pointer as given to :func:`libvlc_log_set`.\n    :param level: message level (libvlc_log_level).\n    :param ctx: message context (meta-information about the message).\n    :param fmt: printf() format string (as defined by ISO C11).\n    :param args: variable argument list for the format.\n    \"\"\"\n\n    pass\n\n\nclass MediaCloseCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to close a custom bitstream input media.\n\n    :param opaque: private pointer as set by the :class:`MediaOpenCb`.\n        callback.\n    \"\"\"\n\n    pass\n\n\nclass MediaOpenCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to open a custom bitstream input media.\n\n    The same media item can be opened multiple times. Each time, this callback\n    is invoked. It should allocate and initialize any instance-specific\n    resources, then store them in **datap*. The instance resources can be freed\n    in the :class:`MediaCloseCb` callback.\n\n    .. note:: For convenience, **datap* is initially None and **sizep* is initially 0.\n\n    :param opaque: private pointer as passed to :func:`libvlc_media_new_callbacks`.\n    :param datap: storage space for a private data pointer [OUT].\n    :param sizep: byte length of the bitstream or UINT64_MAX if unknown [OUT].\n\n    :return: 0 on success, non-zero on error. In case of failure, the other.\n        callbacks will not be invoked and any value stored in **datap* and **sizep* is.\n        discarded.\n    \"\"\"\n\n    pass\n\n\nclass MediaReadCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to read data from a custom bitstream input media.\n\n    .. note:: If no data is immediately available, then the callback should sleep.\n    .. warning:: The application is responsible for avoiding deadlock situations.\n        In particular, the callback should return an error if playback is stopped;\n        if it does not return, then :func:`libvlc_media_player_stop` will never return.\n\n    :param opaque: private pointer as set by the :class:`MediaOpenCb`.\n        callback.\n    :param buf: start address of the buffer to read data into.\n    :param len: bytes length of the buffer.\n\n    :return: strictly positive number of bytes read, 0 on end-of-stream,\n        or -1 on non-recoverable error.\n    \"\"\"\n\n    pass\n\n\nclass MediaSeekCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to seek a custom bitstream input media.\n\n    :param opaque: private pointer as set by the :class:`MediaOpenCb`.\n        callback.\n    :param offset: absolute byte offset to seek to.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n\n    pass\n\n\nclass VideoCleanupCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to configure picture buffers format.\n\n    :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks`.\n        (and possibly modified by libvlc_video_format_cb) [IN].\n    \"\"\"\n\n    pass\n\n\nclass VideoDisplayCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to display a *picture*.\n\n    When the video frame needs to be shown, as determined by the media playback\n    clock, the display callback is invoked.\n\n    :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n    :param picture: private pointer returned from the :class:`VideoLockCb`.\n        callback [IN].\n    \"\"\"\n\n    pass\n\n\nclass VideoFormatCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to configure picture buffers format.\n    This callback gets the format of the video as output by the video decoder\n    and the chain of video filters (if any). It can opt to change any parameter\n    as it needs. In that case, LibVLC will attempt to convert the video format\n    (rescaling and *chroma* conversion) but these operations can be CPU intensive.\n\n    .. note::\n        For each pixels plane, the scanline pitch must be bigger than or equal to\n        the number of bytes per pixel multiplied by the pixel *width*.\n        Similarly, the number of scanlines must be bigger than of equal to\n        the pixel *height*.\n        Furthermore, we recommend that *pitches* and *lines* be multiple of 32\n        to not break assumptions that might be held by optimized code\n        in the video decoders, video filters and/or video converters.\n\n    :param opaque: pointer to the private pointer passed to.\n        :func:`libvlc_video_set_callbacks` [IN/OUT].\n    :param chroma: pointer to the 4 bytes video format identifier [IN/OUT].\n    :param width: pointer to the pixel width [IN/OUT].\n    :param height: pointer to the pixel height [IN/OUT].\n    :param pitches: table of scanline pitches in bytes for each pixel plane.\n        (the table is allocated by LibVLC) [OUT].\n    :param lines: table of scanlines count for each plane [OUT].\n\n    :return: the number of picture buffers allocated, 0 indicates failure.\n    \"\"\"\n\n    pass\n\n\nclass VideoLockCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to allocate and lock a picture buffer.\n\n    Whenever a new video frame needs to be decoded, the lock callback is\n    invoked. Depending on the video chroma, one or three pixel *planes* of\n    adequate dimensions must be returned via the second parameter. Those\n    planes must be aligned on 32-bytes boundaries.\n\n    :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n    :param planes: start address of the pixel planes (LibVLC allocates the array.\n        of void pointers, this callback must initialize the array) [OUT].\n\n    :return: a private pointer for the display and unlock callbacks to identify.\n        the picture buffers.\n    \"\"\"\n\n    pass\n\n\nclass VideoUnlockCb(ctypes.c_void_p):\n    \"\"\"Callback prototype to unlock a *picture* buffer.\n\n    When the video frame decoding is complete, the unlock callback is invoked.\n    This callback might not be needed at all. It is only an indication that the\n    application can now read the pixel values if it needs to.\n\n    .. note:: A *picture* buffer is unlocked after the *picture* is decoded,\n        but before the *picture* is displayed.\n\n    :param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n    :param picture: private pointer returned from the :class:`VideoLockCb`.\n        callback [IN].\n    :param planes: pixel planes as defined by the :class:`VideoLockCb`.\n        callback (this parameter is only for convenience) [IN].\n    \"\"\"\n\n    pass\n\n\nclass CallbackDecorators(object):\n    \"\"\"Class holding various method decorators for callback functions.\"\"\"\n\n    AudioCleanupCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p)\n    AudioCleanupCb.__doc__ = \"\"\"Callback prototype for audio playback cleanup.\n\nThis is called when the media player no longer needs an audio output.\n\n:param opaque: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\"\"\"\n\n    AudioDrainCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p)\n    AudioDrainCb.__doc__ = \"\"\"Callback prototype for audio buffer drain.\n\nLibVLC may invoke this callback when the decoded audio track is ending.\nThere will be no further decoded samples for the track, but playback should\nnevertheless continue until all already pending buffers are rendered.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\"\"\"\n\n    AudioFlushCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64)\n    AudioFlushCb.__doc__ = \"\"\"Callback prototype for audio buffer flush.\n\nLibVLC invokes this callback if it needs to discard all pending buffers and\nstop playback as soon as possible. This typically occurs when the media is\nstopped.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\"\"\"\n\n    AudioPauseCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64)\n    AudioPauseCb.__doc__ = \"\"\"Callback prototype for audio pause.\n\nLibVLC invokes this callback to pause audio playback.\n\n.. note:: The pause callback is never called if the audio is already paused.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n:param pts: time stamp of the pause request (should be elapsed already).\"\"\"\n\n    AudioPlayCb = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint, ctypes.c_int64\n    )\n    AudioPlayCb.__doc__ = \"\"\"Callback prototype for audio playback.\n\nThe LibVLC media player decodes and post-processes the audio signal\nasynchronously (in an internal thread). Whenever audio *samples* are ready\nto be queued to the output, this callback is invoked.\n\nThe number of *samples* provided per invocation may depend on the file format,\nthe audio coding algorithm, the decoder plug-in, the post-processing\nfilters and timing. Application must not assume a certain number of *samples*.\n\nThe exact format of audio *samples* is determined by :func:`libvlc_audio_set_format`\nor :func:`libvlc_audio_set_format_callbacks` as is the channels layout.\n\nNote that the number of *samples* is per channel. For instance, if the audio\ntrack sampling rate is 48000 Hz, then 1200 *samples* represent 25 milliseconds\nof audio signal - regardless of the number of audio channels.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n:param samples: pointer to a table of audio samples to play back [IN].\n:param count: number of audio samples to play back.\n:param pts: expected play time stamp (see libvlc_delay).\"\"\"\n\n    AudioResumeCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_int64)\n    AudioResumeCb.__doc__ = \"\"\"Callback prototype for audio resumption.\n\nLibVLC invokes this callback to resume audio playback after it was\npreviously paused.\n\n.. note:: The resume callback is never called if the audio is not paused.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n:param pts: time stamp of the resumption request (should be elapsed already).\"\"\"\n\n    AudioSetVolumeCb = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_float, ctypes.c_bool\n    )\n    AudioSetVolumeCb.__doc__ = \"\"\"Callback prototype for audio *volume* change.\n\n:param data: data pointer as passed to :func:`libvlc_audio_set_callbacks` [IN].\n:param volume: software volume (1. = nominal, 0. = mute).\n:param mute: muted flag.\"\"\"\n\n    AudioSetupCb = ctypes.CFUNCTYPE(\n        ctypes.c_int,\n        ctypes.POINTER(ctypes.c_void_p),\n        ctypes.c_char_p,\n        ctypes.POINTER(ctypes.c_uint),\n        ctypes.POINTER(ctypes.c_uint),\n    )\n    AudioSetupCb.__doc__ = \"\"\"Callback prototype to setup the audio playback.\n\nThis is called when the media player needs to create a new audio output.\n\n:param opaque: pointer to the data pointer passed to.\n    :func:`libvlc_audio_set_callbacks` [IN/OUT].\n:param format: 4 bytes sample format [IN/OUT].\n:param rate: sample rate [IN/OUT].\n:param channels: channels count [IN/OUT].\n\n:return: 0 on success, anything else to skip audio playback.\"\"\"\n\n    Callback = ctypes.CFUNCTYPE(None, ctypes.POINTER(Event), ctypes.c_void_p)\n    Callback.__doc__ = \"\"\"Callback function notification.\n\n:param p_event: the event triggering the callback.\"\"\"\n\n    LogCb = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_int, Log_ptr, ctypes.c_char_p, ctypes.c_void_p\n    )\n    LogCb.__doc__ = \"\"\"Callback prototype for LibVLC log message handler.\n\n\n.. note:: Log message handlers **must** be thread-safe.\n.. warning:: The message context pointer, the format string parameters and the\n    variable arguments are only valid until the callback returns.\n\n:param data: data pointer as given to :func:`libvlc_log_set`.\n:param level: message level (libvlc_log_level).\n:param ctx: message context (meta-information about the message).\n:param fmt: printf() format string (as defined by ISO C11).\n:param args: variable argument list for the format.\"\"\"\n\n    MediaCloseCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p)\n    MediaCloseCb.__doc__ = \"\"\"Callback prototype to close a custom bitstream input media.\n\n:param opaque: private pointer as set by the :class:`MediaOpenCb`.\n    callback.\"\"\"\n\n    MediaOpenCb = ctypes.CFUNCTYPE(\n        ctypes.c_int,\n        ctypes.c_void_p,\n        ctypes.POINTER(ctypes.c_void_p),\n        ctypes.POINTER(ctypes.c_uint64),\n    )\n    MediaOpenCb.__doc__ = \"\"\"Callback prototype to open a custom bitstream input media.\n\nThe same media item can be opened multiple times. Each time, this callback\nis invoked. It should allocate and initialize any instance-specific\nresources, then store them in **datap*. The instance resources can be freed\nin the :class:`MediaCloseCb` callback.\n\n.. note:: For convenience, **datap* is initially None and **sizep* is initially 0.\n\n:param opaque: private pointer as passed to :func:`libvlc_media_new_callbacks`.\n:param datap: storage space for a private data pointer [OUT].\n:param sizep: byte length of the bitstream or UINT64_MAX if unknown [OUT].\n\n:return: 0 on success, non-zero on error. In case of failure, the other.\n    callbacks will not be invoked and any value stored in **datap* and **sizep* is.\n    discarded.\"\"\"\n\n    MediaReadCb = ctypes.CFUNCTYPE(\n        ctypes.c_ssize_t,\n        ctypes.c_void_p,\n        ctypes.POINTER(ctypes.c_char),\n        ctypes.c_size_t,\n    )\n    MediaReadCb.__doc__ = \"\"\"Callback prototype to read data from a custom bitstream input media.\n\n.. note:: If no data is immediately available, then the callback should sleep.\n.. warning:: The application is responsible for avoiding deadlock situations.\n    In particular, the callback should return an error if playback is stopped;\n    if it does not return, then :func:`libvlc_media_player_stop` will never return.\n\n:param opaque: private pointer as set by the :class:`MediaOpenCb`.\n    callback.\n:param buf: start address of the buffer to read data into.\n:param len: bytes length of the buffer.\n\n:return: strictly positive number of bytes read, 0 on end-of-stream,\n    or -1 on non-recoverable error.\"\"\"\n\n    MediaSeekCb = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_uint64)\n    MediaSeekCb.__doc__ = \"\"\"Callback prototype to seek a custom bitstream input media.\n\n:param opaque: private pointer as set by the :class:`MediaOpenCb`.\n    callback.\n:param offset: absolute byte offset to seek to.\n\n:return: 0 on success, -1 on error.\"\"\"\n\n    VideoCleanupCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p)\n    VideoCleanupCb.__doc__ = \"\"\"Callback prototype to configure picture buffers format.\n\n:param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks`.\n    (and possibly modified by libvlc_video_format_cb) [IN].\"\"\"\n\n    VideoDisplayCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_void_p)\n    VideoDisplayCb.__doc__ = \"\"\"Callback prototype to display a *picture*.\n\nWhen the video frame needs to be shown, as determined by the media playback\nclock, the display callback is invoked.\n\n:param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n:param picture: private pointer returned from the :class:`VideoLockCb`.\n    callback [IN].\"\"\"\n\n    VideoFormatCb = ctypes.CFUNCTYPE(\n        ctypes.c_uint,\n        ctypes.POINTER(ctypes.c_void_p),\n        ctypes.c_char_p,\n        ctypes.POINTER(ctypes.c_uint),\n        ctypes.POINTER(ctypes.c_uint),\n        ctypes.POINTER(ctypes.c_uint),\n        ctypes.POINTER(ctypes.c_uint),\n    )\n    VideoFormatCb.__doc__ = \"\"\"Callback prototype to configure picture buffers format.\nThis callback gets the format of the video as output by the video decoder\nand the chain of video filters (if any). It can opt to change any parameter\nas it needs. In that case, LibVLC will attempt to convert the video format\n(rescaling and *chroma* conversion) but these operations can be CPU intensive.\n\n.. note::\n    For each pixels plane, the scanline pitch must be bigger than or equal to\n    the number of bytes per pixel multiplied by the pixel *width*.\n    Similarly, the number of scanlines must be bigger than of equal to\n    the pixel *height*.\n    Furthermore, we recommend that *pitches* and *lines* be multiple of 32\n    to not break assumptions that might be held by optimized code\n    in the video decoders, video filters and/or video converters.\n\n:param opaque: pointer to the private pointer passed to.\n    :func:`libvlc_video_set_callbacks` [IN/OUT].\n:param chroma: pointer to the 4 bytes video format identifier [IN/OUT].\n:param width: pointer to the pixel width [IN/OUT].\n:param height: pointer to the pixel height [IN/OUT].\n:param pitches: table of scanline pitches in bytes for each pixel plane.\n    (the table is allocated by LibVLC) [OUT].\n:param lines: table of scanlines count for each plane [OUT].\n\n:return: the number of picture buffers allocated, 0 indicates failure.\"\"\"\n\n    VideoLockCb = ctypes.CFUNCTYPE(\n        ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)\n    )\n    VideoLockCb.__doc__ = \"\"\"Callback prototype to allocate and lock a picture buffer.\n\nWhenever a new video frame needs to be decoded, the lock callback is\ninvoked. Depending on the video chroma, one or three pixel *planes* of\nadequate dimensions must be returned via the second parameter. Those\nplanes must be aligned on 32-bytes boundaries.\n\n:param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n:param planes: start address of the pixel planes (LibVLC allocates the array.\n    of void pointers, this callback must initialize the array) [OUT].\n\n:return: a private pointer for the display and unlock callbacks to identify.\n    the picture buffers.\"\"\"\n\n    VideoUnlockCb = ctypes.CFUNCTYPE(\n        None, ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)\n    )\n    VideoUnlockCb.__doc__ = \"\"\"Callback prototype to unlock a *picture* buffer.\n\nWhen the video frame decoding is complete, the unlock callback is invoked.\nThis callback might not be needed at all. It is only an indication that the\napplication can now read the pixel values if it needs to.\n\n.. note:: A *picture* buffer is unlocked after the *picture* is decoded,\n    but before the *picture* is displayed.\n\n:param opaque: private pointer as passed to :func:`libvlc_video_set_callbacks` [IN].\n:param picture: private pointer returned from the :class:`VideoLockCb`.\n    callback [IN].\n:param planes: pixel planes as defined by the :class:`VideoLockCb`.\n    callback (this parameter is only for convenience) [IN].\"\"\"\n\n\ncb = CallbackDecorators\n# End of generated callback definitions #\n\n\n# Generated functions #\ndef libvlc_add_intf(p_instance, name):\n    \"\"\"Try to start a user interface for the libvlc instance.\n\n    :param p_instance: the instance.\n    :param name: interface name, or None for default.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_add_intf\", None) or _Cfunction(\n        \"libvlc_add_intf\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, name)\n\n\ndef libvlc_audio_equalizer_get_amp_at_index(p_equalizer, u_band):\n    \"\"\"Get the amplification value for a particular equalizer frequency band.\n\n    :param p_equalizer: valid equalizer handle, must not be None.\n    :param u_band: index, counting from zero, of the frequency band to get.\n\n    :return: amplification value (Hz); NaN if there is no such frequency band.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_get_amp_at_index\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_get_amp_at_index\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_float,\n        AudioEqualizer,\n        ctypes.c_uint,\n    )\n    return f(p_equalizer, u_band)\n\n\ndef libvlc_audio_equalizer_get_band_count():\n    \"\"\"Get the number of distinct frequency bands for an equalizer.\n\n    :return: number of frequency bands.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_get_band_count\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_get_band_count\", (), None, ctypes.c_uint\n    )\n    return f()\n\n\ndef libvlc_audio_equalizer_get_band_frequency(u_index):\n    \"\"\"Get a particular equalizer band frequency.\n\n    This value can be used, for example, to create a label for an equalizer band control\n    in a user interface.\n\n    :param u_index: index of the band, counting from zero.\n\n    :return: equalizer band frequency (Hz), or -1 if there is no such band.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_audio_equalizer_get_band_frequency\", None\n    ) or _Cfunction(\n        \"libvlc_audio_equalizer_get_band_frequency\",\n        ((1,),),\n        None,\n        ctypes.c_float,\n        ctypes.c_uint,\n    )\n    return f(u_index)\n\n\ndef libvlc_audio_equalizer_get_preamp(p_equalizer):\n    \"\"\"Get the current pre-amplification value from an equalizer.\n\n    :param p_equalizer: valid equalizer handle, must not be None.\n\n    :return: preamp value (Hz).\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_get_preamp\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_get_preamp\",\n        ((1,),),\n        None,\n        ctypes.c_float,\n        AudioEqualizer,\n    )\n    return f(p_equalizer)\n\n\ndef libvlc_audio_equalizer_get_preset_count():\n    \"\"\"Get the number of equalizer presets.\n\n    :return: number of presets.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_get_preset_count\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_get_preset_count\", (), None, ctypes.c_uint\n    )\n    return f()\n\n\ndef libvlc_audio_equalizer_get_preset_name(u_index):\n    \"\"\"Get the name of a particular equalizer preset.\n\n    This name can be used, for example, to prepare a preset label or menu in a user\n    interface.\n\n    :param u_index: index of the preset, counting from zero.\n\n    :return: preset name, or None if there is no such preset.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_get_preset_name\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_get_preset_name\",\n        ((1,),),\n        None,\n        ctypes.c_char_p,\n        ctypes.c_uint,\n    )\n    return f(u_index)\n\n\ndef libvlc_audio_equalizer_new():\n    \"\"\"Create a new default equalizer, with all frequency values zeroed.\n\n    The new equalizer can subsequently be applied to a media player by invoking\n    :func:`libvlc_media_player_set_equalizer`.\n\n    The returned handle should be freed via :func:`libvlc_audio_equalizer_release` when\n    it is no longer needed.\n\n    :return: opaque equalizer handle, or None on error.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_new\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_new\", (), class_result(AudioEqualizer), ctypes.c_void_p\n    )\n    return f()\n\n\ndef libvlc_audio_equalizer_new_from_preset(u_index):\n    \"\"\"Create a new equalizer, with initial frequency values copied from an existing\n    preset.\n\n    The new equalizer can subsequently be applied to a media player by invoking\n    :func:`libvlc_media_player_set_equalizer`.\n\n    The returned handle should be freed via :func:`libvlc_audio_equalizer_release` when\n    it is no longer needed.\n\n    :param u_index: index of the preset, counting from zero.\n\n    :return: opaque equalizer handle, or None on error.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_new_from_preset\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_new_from_preset\",\n        ((1,),),\n        class_result(AudioEqualizer),\n        ctypes.c_void_p,\n        ctypes.c_uint,\n    )\n    return f(u_index)\n\n\ndef libvlc_audio_equalizer_release(p_equalizer):\n    \"\"\"Release a previously created equalizer instance.\n\n    The equalizer was previously created by using :func:`libvlc_audio_equalizer_new` or\n    :func:`libvlc_audio_equalizer_new_from_preset`.\n\n    It is safe to invoke this method with a None *p_equalizer* parameter for no effect.\n\n    :param p_equalizer: opaque equalizer handle, or None.\n\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_release\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_release\", ((1,),), None, None, AudioEqualizer\n    )\n    return f(p_equalizer)\n\n\ndef libvlc_audio_equalizer_set_amp_at_index(p_equalizer, f_amp, u_band):\n    \"\"\"Set a new amplification value for a particular equalizer frequency band.\n\n    The new equalizer settings are subsequently applied to a media player by invoking\n    :func:`libvlc_media_player_set_equalizer`.\n\n    The supplied amplification value will be clamped to the -20.0 to +20.0 range.\n\n    :param p_equalizer: valid equalizer handle, must not be None.\n    :param f_amp: amplification value (-20.0 to 20.0 Hz).\n    :param u_band: index, counting from zero, of the frequency band to set.\n\n    :return: zero on success, -1 on error.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_set_amp_at_index\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_set_amp_at_index\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        AudioEqualizer,\n        ctypes.c_float,\n        ctypes.c_uint,\n    )\n    return f(p_equalizer, f_amp, u_band)\n\n\ndef libvlc_audio_equalizer_set_preamp(p_equalizer, f_preamp):\n    \"\"\"Set a new pre-amplification value for an equalizer.\n\n    The new equalizer settings are subsequently applied to a media player by invoking\n    :func:`libvlc_media_player_set_equalizer`.\n\n    The supplied amplification value will be clamped to the -20.0 to +20.0 range.\n\n    :param p_equalizer: valid equalizer handle, must not be None.\n    :param f_preamp: preamp value (-20.0 to 20.0 Hz).\n\n    :return: zero on success, -1 on error.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_equalizer_set_preamp\", None) or _Cfunction(\n        \"libvlc_audio_equalizer_set_preamp\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        AudioEqualizer,\n        ctypes.c_float,\n    )\n    return f(p_equalizer, f_preamp)\n\n\ndef libvlc_audio_filter_list_get(p_instance):\n    \"\"\"Returns a list of audio filters that are available.\n\n    :class:`ModuleDescription`\n    :func:`libvlc_module_description_list_release`.\n\n    :param p_instance: libvlc instance.\n\n    :return: a list of module descriptions. It should be freed with :func:`libvlc_module_description_list_release`.\n        In case of an error, None is returned.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_filter_list_get\", None) or _Cfunction(\n        \"libvlc_audio_filter_list_get\",\n        ((1,),),\n        None,\n        ctypes.POINTER(ModuleDescription),\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_audio_get_channel(p_mi):\n    \"\"\"Get current audio channel.\n\n    :param p_mi: media player.\n\n    :return: the audio channel :class:`AudioOutputChannel`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_channel\", None) or _Cfunction(\n        \"libvlc_audio_get_channel\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_delay(p_mi):\n    \"\"\"Get current audio delay.\n\n    :param p_mi: media player.\n\n    :return: the audio delay (microseconds).\n    :version: LibVLC 1.1.1 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_delay\", None) or _Cfunction(\n        \"libvlc_audio_get_delay\", ((1,),), None, ctypes.c_int64, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_mute(p_mi):\n    \"\"\"Get current mute status.\n\n    :param p_mi: media player.\n\n    :return: the mute status (boolean) if defined, -1 if undefined/unapplicable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_mute\", None) or _Cfunction(\n        \"libvlc_audio_get_mute\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_track(p_mi):\n    \"\"\"Get current audio track.\n\n    :param p_mi: media player.\n\n    :return: the audio track ID or -1 if no active input.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_track\", None) or _Cfunction(\n        \"libvlc_audio_get_track\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_track_count(p_mi):\n    \"\"\"Get number of available audio tracks.\n\n    :param p_mi: media player.\n\n    :return: the number of available audio tracks (int), or -1 if unavailable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_track_count\", None) or _Cfunction(\n        \"libvlc_audio_get_track_count\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_track_description(p_mi):\n    \"\"\"Get the description of available audio tracks.\n\n    :param p_mi: media player.\n\n    :return: list with description of available audio tracks, or None.\n        It must be freed with :func:`libvlc_track_description_list_release`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_track_description\", None) or _Cfunction(\n        \"libvlc_audio_get_track_description\",\n        ((1,),),\n        None,\n        ctypes.POINTER(TrackDescription),\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_get_volume(p_mi):\n    \"\"\"Get current software audio volume.\n\n    :param p_mi: media player.\n\n    :return: the software volume in percents.\n        (0 = mute, 100 = nominal / 0dB).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_get_volume\", None) or _Cfunction(\n        \"libvlc_audio_get_volume\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_output_device_count(p_instance, psz_audio_output):\n    \"\"\"Backward compatibility stub. Do not use in new code.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_audio_output_device_list_get` instead.\n\n    :return: always 0.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_count\", None) or _Cfunction(\n        \"libvlc_audio_output_device_count\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_audio_output)\n\n\ndef libvlc_audio_output_device_enum(mp):\n    \"\"\"Gets a list of potential audio output devices,\n    :func:`libvlc_audio_output_device_set`.\n\n    .. note:: Not all audio outputs support enumerating devices.\n        The audio output may be functional even if the list is empty (None).\n\n    .. note:: The list may not be exhaustive.\n\n    .. warning:: Some audio output devices in the list might not actually work in\n        some circumstances. By default, it is recommended to not specify any\n        explicit audio device.\n\n    :param mp: media player.\n\n    :return: A None-terminated linked list of potential audio output devices.\n        It must be freed with :func:`libvlc_audio_output_device_list_release`.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_enum\", None) or _Cfunction(\n        \"libvlc_audio_output_device_enum\",\n        ((1,),),\n        None,\n        ctypes.POINTER(AudioOutputDevice),\n        MediaPlayer,\n    )\n    return f(mp)\n\n\ndef libvlc_audio_output_device_get(mp):\n    \"\"\"Get the current audio output device identifier.\n\n    This complements :func:`libvlc_audio_output_device_set`.\n\n    .. warning:: The initial value for the current audio output device identifier\n        may not be set or may be some unknown value. A LibVLC application should\n        compare this value against the known device identifiers (e.g. those that\n        were previously retrieved by a call to :func:`libvlc_audio_output_device_enum` or\n        libvlc_audio_output_device_list_get) to find the current audio output device.\n\n    It is possible that the selected audio output device changes (an external\n    change) without a call to :func:`libvlc_audio_output_device_set`. That may make this\n    method unsuitable to use if a LibVLC application is attempting to track\n    dynamic audio device changes as they happen.\n\n    :param mp: media player.\n\n    :return: the current audio output device identifier.\n        None if no device is selected or in case of error.\n        (the result must be released with free() or libvlc_free).\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_get\", None) or _Cfunction(\n        \"libvlc_audio_output_device_get\",\n        ((1,),),\n        string_result,\n        ctypes.c_void_p,\n        MediaPlayer,\n    )\n    return f(mp)\n\n\ndef libvlc_audio_output_device_id(p_instance, psz_audio_output, i_device):\n    \"\"\"Backward compatibility stub. Do not use in new code.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_audio_output_device_list_get` instead.\n\n    :return: always None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_id\", None) or _Cfunction(\n        \"libvlc_audio_output_device_id\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        string_result,\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_audio_output, i_device)\n\n\ndef libvlc_audio_output_device_list_get(p_instance, aout):\n    \"\"\"Gets a list of audio output devices for a given audio output module,\n    :func:`libvlc_audio_output_device_set`.\n\n    .. note:: Not all audio outputs support this. In particular, an empty (None)\n        list of devices does **not** imply that the specified audio output does\n        not work.\n\n    .. note:: The list might not be exhaustive.\n\n    .. warning:: Some audio output devices in the list might not actually work in\n        some circumstances. By default, it is recommended to not specify any\n        explicit audio device.\n\n    :param p_instance: libvlc instance.\n    :param aout: audio output name.\n        (as returned by libvlc_audio_output_list_get).\n\n    :return: A None-terminated linked list of potential audio output devices.\n        It must be freed with :func:`libvlc_audio_output_device_list_release`.\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_list_get\", None) or _Cfunction(\n        \"libvlc_audio_output_device_list_get\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.POINTER(AudioOutputDevice),\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, aout)\n\n\ndef libvlc_audio_output_device_list_release(p_list):\n    \"\"\"Frees a list of available audio output devices.\n\n    :param p_list: list with audio outputs for release.\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_list_release\", None) or _Cfunction(\n        \"libvlc_audio_output_device_list_release\",\n        ((1,),),\n        None,\n        None,\n        ctypes.POINTER(AudioOutputDevice),\n    )\n    return f(p_list)\n\n\ndef libvlc_audio_output_device_longname(p_instance, psz_output, i_device):\n    \"\"\"Backward compatibility stub. Do not use in new code.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_audio_output_device_list_get` instead.\n\n    :return: always None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_longname\", None) or _Cfunction(\n        \"libvlc_audio_output_device_longname\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        string_result,\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_output, i_device)\n\n\ndef libvlc_audio_output_device_set(mp, module, device_id):\n    \"\"\"Configures an explicit audio output device.\n\n    If the *module* paramater is None, audio output will be moved to the device\n    specified by the device identifier string immediately. This is the\n    recommended usage.\n\n    A list of adequate potential device strings can be obtained with\n    :func:`libvlc_audio_output_device_enum`.\n\n    However passing None is supported in LibVLC version 2.2.0 and later only;\n    in earlier versions, this function would have no effects when the module\n    parameter was None.\n\n    If the *module* parameter is not None, the device parameter of the\n    corresponding audio output, if it exists, will be set to the specified\n    string. Note that some audio output modules do not have such a parameter\n    (notably MMDevice and PulseAudio).\n\n    A list of adequate potential device strings can be obtained with\n    :func:`libvlc_audio_output_device_list_get`.\n\n    .. note:: This function does not select the specified audio output plugin.\n        :func:`libvlc_audio_output_set` is used for that purpose.\n\n    .. warning:: The syntax for the device parameter depends on the audio output.\n\n    Some audio output modules require further parameters (e.g. a channels map\n    in the case of ALSA).\n\n    :param mp: media player.\n    :param module: If None, current audio output module.\n        if non-None, name of audio output module.\n        (libvlc_audio_output_t).\n    :param device_id: device identifier string.\n\n    :return: Nothing. Errors are ignored (this is a design bug).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_device_set\", None) or _Cfunction(\n        \"libvlc_audio_output_device_set\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(mp, module, device_id)\n\n\ndef libvlc_audio_output_get_device_type(p_mi):\n    \"\"\"Stub for backward compatibility.\n\n    :return: always -1.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_get_device_type\", None) or _Cfunction(\n        \"libvlc_audio_output_get_device_type\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_audio_output_list_get(p_instance):\n    \"\"\"Gets the list of available audio output modules.\n\n    :param p_instance: libvlc instance.\n\n    :return: list of available audio outputs. It must be freed with.\n        :func:`libvlc_audio_output_list_release` :class:`AudioOutput` .\n        In case of error, None is returned.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_list_get\", None) or _Cfunction(\n        \"libvlc_audio_output_list_get\",\n        ((1,),),\n        None,\n        ctypes.POINTER(AudioOutput),\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_audio_output_list_release(p_list):\n    \"\"\"Frees the list of available audio output modules.\n\n    :param p_list: list with audio outputs for release.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_list_release\", None) or _Cfunction(\n        \"libvlc_audio_output_list_release\",\n        ((1,),),\n        None,\n        None,\n        ctypes.POINTER(AudioOutput),\n    )\n    return f(p_list)\n\n\ndef libvlc_audio_output_set(p_mi, psz_name):\n    \"\"\"Selects an audio output module.\n\n    .. note:: Any change will take be effect only after playback is stopped and\n        restarted. Audio output cannot be changed while playing.\n\n    :param p_mi: media player.\n    :param psz_name: name of audio output,\n        use psz_name of :class:`AudioOutput`.\n\n    :return: 0 if function succeeded, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_set\", None) or _Cfunction(\n        \"libvlc_audio_output_set\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, psz_name)\n\n\ndef libvlc_audio_output_set_device_type(p_mp, device_type):\n    \"\"\"Stub for backward compatibility.\"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_output_set_device_type\", None) or _Cfunction(\n        \"libvlc_audio_output_set_device_type\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mp, device_type)\n\n\ndef libvlc_audio_set_callbacks(mp, play, pause, resume, flush, drain, opaque):\n    \"\"\"Sets callbacks and private data for decoded audio.\n\n    Use :func:`libvlc_audio_set_format` or :func:`libvlc_audio_set_format_callbacks`\n    to configure the decoded audio format.\n\n    .. note:: The audio callbacks override any other audio output mechanism.\n        If the callbacks are set, LibVLC will **not** output audio in any way.\n\n    :param mp: the media player.\n    :param play: callback to play audio samples (must not be None).\n    :param pause: callback to pause playback (or None to ignore).\n    :param resume: callback to resume playback (or None to ignore).\n    :param flush: callback to flush audio buffers (or None to ignore).\n    :param drain: callback to drain audio buffers (or None to ignore).\n    :param opaque: private pointer for the audio callbacks (as first parameter).\n\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_callbacks\", None) or _Cfunction(\n        \"libvlc_audio_set_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        AudioPlayCb,\n        AudioPauseCb,\n        AudioResumeCb,\n        AudioFlushCb,\n        AudioDrainCb,\n        ctypes.c_void_p,\n    )\n    return f(mp, play, pause, resume, flush, drain, opaque)\n\n\ndef libvlc_audio_set_channel(p_mi, channel):\n    \"\"\"Set current audio *channel*.\n\n    :param p_mi: media player.\n    :param channel: the audio channel, :class:`AudioOutputChannel`.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_channel\", None) or _Cfunction(\n        \"libvlc_audio_set_channel\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, channel)\n\n\ndef libvlc_audio_set_delay(p_mi, i_delay):\n    \"\"\"Set current audio delay. The audio delay will be reset to zero each time the media changes.\n\n    :param p_mi: media player.\n    :param i_delay: the audio delay (microseconds).\n\n    :return: 0 on success, -1 on error.\n    :version: LibVLC 1.1.1 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_delay\", None) or _Cfunction(\n        \"libvlc_audio_set_delay\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int64,\n    )\n    return f(p_mi, i_delay)\n\n\ndef libvlc_audio_set_format(mp, format, rate, channels):\n    \"\"\"Sets a fixed decoded audio *format*.\n\n    This only works in combination with :func:`libvlc_audio_set_callbacks`,\n    and is mutually exclusive with :func:`libvlc_audio_set_format_callbacks`.\n\n    :param mp: the media player.\n    :param format: a four-characters string identifying the sample format.\n        (e.g. \"S16N\" or \"f32l\").\n    :param rate: sample rate (expressed in Hz).\n    :param channels: channels count.\n\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_format\", None) or _Cfunction(\n        \"libvlc_audio_set_format\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n        ctypes.c_uint,\n        ctypes.c_uint,\n    )\n    return f(mp, format, rate, channels)\n\n\ndef libvlc_audio_set_format_callbacks(mp, setup, cleanup):\n    \"\"\"Sets decoded audio format via callbacks.\n\n    This only works in combination with :func:`libvlc_audio_set_callbacks`.\n\n    :param mp: the media player.\n    :param setup: callback to select the audio format (cannot be None).\n    :param cleanup: callback to release any allocated resources (or None).\n\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_format_callbacks\", None) or _Cfunction(\n        \"libvlc_audio_set_format_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        AudioSetupCb,\n        AudioCleanupCb,\n    )\n    return f(mp, setup, cleanup)\n\n\ndef libvlc_audio_set_mute(p_mi, status):\n    \"\"\"Set mute *status*.\n\n    .. warning:: This function does not always work. If there are no active audio\n        playback stream, the mute *status* might not be available. If digital\n        pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also\n        some audio output plugins do not support muting at all.\n\n    .. note:: To force silent playback, disable all audio tracks. This is more\n        efficient and reliable than mute.\n\n    :param p_mi: media player.\n    :param status: If status is true then mute, otherwise unmute.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_mute\", None) or _Cfunction(\n        \"libvlc_audio_set_mute\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, status)\n\n\ndef libvlc_audio_set_track(p_mi, i_track):\n    \"\"\"Set current audio track.\n\n    :param p_mi: media player.\n    :param i_track: the track ID (i_id field from track description).\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_track\", None) or _Cfunction(\n        \"libvlc_audio_set_track\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_track)\n\n\ndef libvlc_audio_set_volume(p_mi, i_volume):\n    \"\"\"Set current software audio volume.\n\n    :param p_mi: media player.\n    :param i_volume: the volume in percents (0 = mute, 100 = 0dB).\n\n    :return: 0 if the volume was set, -1 if it was out of range.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_volume\", None) or _Cfunction(\n        \"libvlc_audio_set_volume\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_volume)\n\n\ndef libvlc_audio_set_volume_callback(mp, set_volume):\n    \"\"\"Set callbacks and private data for decoded audio. This only works in\n    combination with :func:`libvlc_audio_set_callbacks`.\n    Use :func:`libvlc_audio_set_format` or :func:`libvlc_audio_set_format_callbacks`\n    to configure the decoded audio format.\n\n    :param mp: the media player.\n    :param set_volume: callback to apply audio volume,\n        or None to apply volume in software.\n\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_set_volume_callback\", None) or _Cfunction(\n        \"libvlc_audio_set_volume_callback\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        AudioSetVolumeCb,\n    )\n    return f(mp, set_volume)\n\n\ndef libvlc_audio_toggle_mute(p_mi):\n    \"\"\"Toggle mute status.\n\n    .. warning:: Toggling mute atomically is not always possible: On some platforms,\n        other processes can mute the VLC audio playback stream asynchronously. Thus,\n        there is a small race condition where toggling will not work.\n        See also the limitations of :func:`libvlc_audio_set_mute`.\n\n    :param p_mi: media player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_audio_toggle_mute\", None) or _Cfunction(\n        \"libvlc_audio_toggle_mute\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_chapter_descriptions_release(p_chapters, i_count):\n    \"\"\"Release a chapter description\n\n    :param p_chapters: chapter description array to release.\n    :param i_count: number of chapter descriptions to release.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_chapter_descriptions_release\", None) or _Cfunction(\n        \"libvlc_chapter_descriptions_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(ChapterDescription)),\n        ctypes.c_uint,\n    )\n    return f(p_chapters, i_count)\n\n\ndef libvlc_clearerr():\n    \"\"\"Clears the LibVLC error status for the current thread. This is optional.\n    By default, the error status is automatically overridden when a new error\n    occurs, and destroyed when the thread exits.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_clearerr\", None) or _Cfunction(\n        \"libvlc_clearerr\", (), None, None\n    )\n    return f()\n\n\ndef libvlc_clock():\n    \"\"\"Return the current time as defined by LibVLC. The unit is the microsecond.\n    Time increases monotonically (regardless of time zone changes and RTC\n    adjustements).\n    The origin is arbitrary but consistent across the whole system\n    (e.g. the system uptim, the time since the system was booted).\n\n    .. note:: On systems that support it, the POSIX monotonic clock is used.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_clock\", None) or _Cfunction(\n        \"libvlc_clock\", (), None, ctypes.c_int64\n    )\n    return f()\n\n\ndef libvlc_dialog_dismiss(p_id):\n    \"\"\"Dismiss a dialog\n\n    After this call, *p_id* won't be valid anymore\n\n    :class:`DialogCbs`.pf_cancel\n\n    :param p_id: id of the dialog.\n\n    :return: 0 on success, or -1 on error.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_dismiss\", None) or _Cfunction(\n        \"libvlc_dialog_dismiss\", ((1,),), None, ctypes.c_int, ctypes.c_void_p\n    )\n    return f(p_id)\n\n\ndef libvlc_dialog_get_context(p_id):\n    \"\"\"Return the opaque pointer associated with the dialog id\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_get_context\", None) or _Cfunction(\n        \"libvlc_dialog_get_context\", ((1,),), None, ctypes.c_void_p, ctypes.c_void_p\n    )\n    return f(p_id)\n\n\ndef libvlc_dialog_post_action(p_id, i_action):\n    \"\"\"Post a question answer\n\n    After this call, *p_id* won't be valid anymore\n\n    :class:`DialogCbs`.pf_display_question\n\n    :param p_id: id of the dialog.\n    :param i_action: 1 for action1, 2 for action2.\n\n    :return: 0 on success, or -1 on error.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_post_action\", None) or _Cfunction(\n        \"libvlc_dialog_post_action\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        ctypes.c_void_p,\n        ctypes.c_int,\n    )\n    return f(p_id, i_action)\n\n\ndef libvlc_dialog_post_login(p_id, psz_username, psz_password, b_store):\n    \"\"\"Post a login answer\n\n    After this call, *p_id* won't be valid anymore\n\n    :class:`DialogCbs`.pf_display_login\n\n    :param p_id: id of the dialog.\n    :param psz_username: valid and non empty string.\n    :param psz_password: valid string (can be empty).\n    :param b_store: if true, store the credentials.\n\n    :return: 0 on success, or -1 on error.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_post_login\", None) or _Cfunction(\n        \"libvlc_dialog_post_login\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        ctypes.c_void_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_bool,\n    )\n    return f(p_id, psz_username, psz_password, b_store)\n\n\ndef libvlc_dialog_set_callbacks(p_instance, p_cbs, p_data):\n    \"\"\"Register callbacks in order to handle VLC dialogs\n\n    :param p_cbs: a pointer to callbacks, or None to unregister callbacks.\n    :param p_data: opaque pointer for the callback.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_set_callbacks\", None) or _Cfunction(\n        \"libvlc_dialog_set_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        ctypes.POINTER(DialogCbs),\n        ctypes.c_void_p,\n    )\n    return f(p_instance, p_cbs, p_data)\n\n\ndef libvlc_dialog_set_context(p_id, p_context):\n    \"\"\"Associate an opaque pointer with the dialog id\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_dialog_set_context\", None) or _Cfunction(\n        \"libvlc_dialog_set_context\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.c_void_p,\n        ctypes.c_void_p,\n    )\n    return f(p_id, p_context)\n\n\ndef libvlc_errmsg():\n    \"\"\"A human-readable error message for the last LibVLC error in the calling\n    thread. The resulting string is valid until another error occurs (at least\n    until the next LibVLC call).\n\n    .. warning::\n        This will be None if there was no error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_errmsg\", None) or _Cfunction(\n        \"libvlc_errmsg\", (), None, ctypes.c_char_p\n    )\n    return f()\n\n\ndef libvlc_event_attach(p_event_manager, i_event_type, f_callback, user_data):\n    \"\"\"Register for an event notification.\n\n    :param p_event_manager: the event manager to which you want to attach to.\n        Generally it is obtained by vlc_my_object_event_manager() where.\n        my_object is the object you want to listen to.\n    :param i_event_type: the desired event to which we want to listen.\n    :param f_callback: the function to call when i_event_type occurs.\n    :param user_data: user provided data to carry with the event.\n\n    :return: 0 on success, ENOMEM on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_event_attach\", None) or _Cfunction(\n        \"libvlc_event_attach\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        EventManager,\n        ctypes.c_uint,\n        Callback,\n        ctypes.c_void_p,\n    )\n    return f(p_event_manager, i_event_type, f_callback, user_data)\n\n\ndef libvlc_event_detach(p_event_manager, i_event_type, f_callback, p_user_data):\n    \"\"\"Unregister an event notification.\n\n    :param p_event_manager: the event manager.\n    :param i_event_type: the desired event to which we want to unregister.\n    :param f_callback: the function to call when i_event_type occurs.\n    :param p_user_data: user provided data to carry with the event.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_event_detach\", None) or _Cfunction(\n        \"libvlc_event_detach\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        EventManager,\n        ctypes.c_uint,\n        Callback,\n        ctypes.c_void_p,\n    )\n    return f(p_event_manager, i_event_type, f_callback, p_user_data)\n\n\ndef libvlc_event_type_name(event_type):\n    \"\"\"Get an event's type name.\n\n    :param event_type: the desired event.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_event_type_name\", None) or _Cfunction(\n        \"libvlc_event_type_name\", ((1,),), None, ctypes.c_char_p, ctypes.c_uint\n    )\n    return f(event_type)\n\n\ndef libvlc_free(ptr):\n    \"\"\"Frees an heap allocation returned by a LibVLC function.\n    If you know you're using the same underlying C run-time as the LibVLC\n    implementation, then you can call ANSI C free() directly instead.\n\n    :param ptr: the pointer.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_free\", None) or _Cfunction(\n        \"libvlc_free\", ((1,),), None, None, ctypes.c_void_p\n    )\n    return f(ptr)\n\n\ndef libvlc_get_changeset():\n    \"\"\"Retrieve libvlc changeset.\n\n    Example: \"aa9bce0bc4\"\n\n    :return: a string containing the libvlc changeset.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_get_changeset\", None) or _Cfunction(\n        \"libvlc_get_changeset\", (), None, ctypes.c_char_p\n    )\n    return f()\n\n\ndef libvlc_get_compiler():\n    \"\"\"Retrieve libvlc compiler version.\n\n    Example: \"gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)\"\n\n    :return: a string containing the libvlc compiler version.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_get_compiler\", None) or _Cfunction(\n        \"libvlc_get_compiler\", (), None, ctypes.c_char_p\n    )\n    return f()\n\n\ndef libvlc_get_fullscreen(p_mi):\n    \"\"\"Get current fullscreen status.\n\n    :param p_mi: the media player.\n\n    :return: the fullscreen status (boolean).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_get_fullscreen\", None) or _Cfunction(\n        \"libvlc_get_fullscreen\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_get_log_verbosity(p_instance):\n    \"\"\"Always returns minus one.\n    This function is only provided for backward compatibility.\n\n    :param p_instance: ignored.\n\n    :return: always -1.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_get_log_verbosity\", None) or _Cfunction(\n        \"libvlc_get_log_verbosity\", ((1,),), None, ctypes.c_uint, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_get_version():\n    \"\"\"Retrieve libvlc version.\n\n    Example: \"1.1.0-git The Luggage\"\n\n    :return: a string containing the libvlc version.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_get_version\", None) or _Cfunction(\n        \"libvlc_get_version\", (), None, ctypes.c_char_p\n    )\n    return f()\n\n\ndef libvlc_log_clear(p_log):\n    \"\"\"This function does nothing.\n    It is only provided for backward compatibility.\n\n    :param p_log: ignored.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_clear\", None) or _Cfunction(\n        \"libvlc_log_clear\", ((1,),), None, None, Log_ptr\n    )\n    return f(p_log)\n\n\ndef libvlc_log_close(p_log):\n    \"\"\"Frees memory allocated by :func:`libvlc_log_open`.\n\n    :param p_log: libvlc log instance or None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_close\", None) or _Cfunction(\n        \"libvlc_log_close\", ((1,),), None, None, Log_ptr\n    )\n    return f(p_log)\n\n\ndef libvlc_log_count(p_log):\n    \"\"\"Always returns zero.\n    This function is only provided for backward compatibility.\n\n    :param p_log: ignored.\n\n    :return: always zero.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_count\", None) or _Cfunction(\n        \"libvlc_log_count\", ((1,),), None, ctypes.c_uint, Log_ptr\n    )\n    return f(p_log)\n\n\ndef libvlc_log_get_context(ctx, module, file):\n    \"\"\"Gets log message debug infos.\n\n    This function retrieves self-debug information about a log message:\n\n    * the name of the VLC *module* emitting the message,\n    * the name of the source code *module* (i.e. *file*) and\n    * the *line* number within the source code *module*.\n\n    The returned *module* name and *file* name will be None if unknown.\n    The returned *line* number will similarly be zero if unknown.\n\n    .. warning:: The returned *module* name and source code *file* name, if non-None,\n        are only valid until the logging callback returns.\n\n    :param ctx: message context (as passed to the :class:`LogCb` callback).\n    :param module: module name storage (or None) [OUT].\n    :param file: source code file name storage (or None) [OUT].\n    :param line: source code file line number storage (or None) [OUT].\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_get_context\", None) or _Cfunction(\n        \"libvlc_log_get_context\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (2,),\n        ),\n        None,\n        None,\n        Log_ptr,\n        ListPOINTER(ctypes.c_char_p),\n        ListPOINTER(ctypes.c_char_p),\n        ctypes.POINTER(ctypes.c_uint),\n    )\n    return f(ctx, module, file)\n\n\ndef libvlc_log_get_iterator(p_log):\n    \"\"\"This function does nothing useful.\n    It is only provided for backward compatibility.\n\n    :param p_log: ignored.\n\n    :return: an unique pointer or None on error or if the parameter was None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_get_iterator\", None) or _Cfunction(\n        \"libvlc_log_get_iterator\",\n        ((1,),),\n        class_result(LogIterator),\n        ctypes.c_void_p,\n        Log_ptr,\n    )\n    return f(p_log)\n\n\ndef libvlc_log_get_object(ctx, name, header, id):\n    \"\"\"Gets log message info.\n\n    This function retrieves meta-information about a log message:\n\n    * the type *name* of the VLC object emitting the message,\n    * the object *header* if any, and\n    * a temporaly-unique object identifier.\n\n    This information is mainly meant for **manual** troubleshooting.\n\n    The returned type *name* may be \"generic\" if unknown, but it cannot be None.\n    The returned *header* will be None if unset; in current versions, the header\n    is used to distinguish for VLM inputs.\n    The returned object ID will be zero if the message is not associated with\n    any VLC object.\n\n    .. warning:: The returned module *name* and source code file *name*, if non-None,\n        are only valid until the logging callback returns.\n\n    :param ctx: message context (as passed to the :class:`LogCb` callback).\n    :param name: object name storage (or None) [OUT].\n    :param header: object header (or None) [OUT].\n    :param line: source code file line number storage (or None) [OUT].\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_get_object\", None) or _Cfunction(\n        \"libvlc_log_get_object\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Log_ptr,\n        ListPOINTER(ctypes.c_char_p),\n        ListPOINTER(ctypes.c_char_p),\n        ctypes.POINTER(ctypes.c_uint),\n    )\n    return f(ctx, name, header, id)\n\n\ndef libvlc_log_iterator_free(p_iter):\n    \"\"\"Frees memory allocated by :func:`libvlc_log_get_iterator`.\n\n    :param p_iter: libvlc log iterator or None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_iterator_free\", None) or _Cfunction(\n        \"libvlc_log_iterator_free\", ((1,),), None, None, LogIterator\n    )\n    return f(p_iter)\n\n\ndef libvlc_log_iterator_has_next(p_iter):\n    \"\"\"Always returns zero.\n    This function is only provided for backward compatibility.\n\n    :param p_iter: ignored.\n\n    :return: always zero.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_iterator_has_next\", None) or _Cfunction(\n        \"libvlc_log_iterator_has_next\", ((1,),), None, ctypes.c_int, LogIterator\n    )\n    return f(p_iter)\n\n\ndef libvlc_log_iterator_next(p_iter, p_buf):\n    \"\"\"Always returns None.\n    This function is only provided for backward compatibility.\n\n    :param p_iter: libvlc log iterator or None.\n    :param p_buf: ignored.\n\n    :return: always None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_iterator_next\", None) or _Cfunction(\n        \"libvlc_log_iterator_next\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.POINTER(LogMessage),\n        LogIterator,\n        ctypes.POINTER(LogMessage),\n    )\n    return f(p_iter, p_buf)\n\n\ndef libvlc_log_open(p_instance):\n    \"\"\"This function does nothing useful.\n    It is only provided for backward compatibility.\n\n    :param p_instance: libvlc instance.\n\n    :return: an unique pointer or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_open\", None) or _Cfunction(\n        \"libvlc_log_open\", ((1,),), None, Log_ptr, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_log_set(p_instance, cb, data):\n    \"\"\"Sets the logging callback for a LibVLC instance.\n\n    This function is thread-safe: it will wait for any pending callbacks\n    invocation to complete.\n\n    .. note:: Some log messages (especially debug) are emitted by LibVLC while\n        is being initialized. These messages cannot be captured with this interface.\n\n    .. warning:: A deadlock may occur if this function is called from the callback.\n\n    :param cb: callback function pointer.\n    :param data: opaque data pointer for the callback function.\n\n    :param p_instance: libvlc instance.\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_set\", None) or _Cfunction(\n        \"libvlc_log_set\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        LogCb,\n        ctypes.c_void_p,\n    )\n    return f(p_instance, cb, data)\n\n\ndef libvlc_log_set_file(p_instance, stream):\n    \"\"\"Sets up logging to a file.\n\n    :param p_instance: libvlc instance.\n    :param stream: FILE pointer opened for writing.\n        (the FILE pointer must remain valid until libvlc_log_unset).\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_set_file\", None) or _Cfunction(\n        \"libvlc_log_set_file\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        FILE_ptr,\n    )\n    return f(p_instance, stream)\n\n\ndef libvlc_log_unset(p_instance):\n    \"\"\"Unsets the logging callback.\n\n    This function deregisters the logging callback for a LibVLC instance.\n    This is rarely needed as the callback is implicitly unset when the instance\n    is destroyed.\n\n    .. note:: This function will wait for any pending callbacks invocation to\n        complete (causing a deadlock if called from within the callback).\n\n    :param p_instance: libvlc instance.\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_log_unset\", None) or _Cfunction(\n        \"libvlc_log_unset\", ((1,),), None, None, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_media_add_option(p_md, psz_options):\n    \"\"\"Add an option to the media.\n\n    This option will be used to determine how the media_player will\n    read the media. This allows to use VLC's advanced\n    reading/streaming options on a per-media basis.\n\n    .. note:: The options are listed in 'vlc --long-help' from the command line,\n        e.g. \"-sout-all\". Keep in mind that available options and their semantics\n        vary across LibVLC versions and builds.\n    .. warning:: Not all options affects :class:`Media` objects:\n        Specifically, due to architectural issues most audio and video options,\n        such as text renderer options, have no effects on an individual media.\n        These options must be set through :func:`libvlc_new` instead.\n\n    :param p_md: the media descriptor.\n    :param psz_options: the options (as a string).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_add_option\", None) or _Cfunction(\n        \"libvlc_media_add_option\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Media,\n        ctypes.c_char_p,\n    )\n    return f(p_md, psz_options)\n\n\ndef libvlc_media_add_option_flag(p_md, psz_options, i_flags):\n    \"\"\"Add an option to the media with configurable flags.\n\n    This option will be used to determine how the media_player will\n    read the media. This allows to use VLC's advanced\n    reading/streaming options on a per-media basis.\n\n    The options are detailed in vlc --long-help, for instance\n    \"--sout-all\". Note that all options are not usable on medias:\n    specifically, due to architectural issues, video-related options\n    such as text renderer options cannot be set on a single media. They\n    must be set on the whole libvlc instance instead.\n\n    :param p_md: the media descriptor.\n    :param psz_options: the options (as a string).\n    :param i_flags: the flags for this option.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_add_option_flag\", None) or _Cfunction(\n        \"libvlc_media_add_option_flag\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Media,\n        ctypes.c_char_p,\n        ctypes.c_uint,\n    )\n    return f(p_md, psz_options, i_flags)\n\n\ndef libvlc_media_discoverer_event_manager(p_mdis):\n    \"\"\"Get event manager from media service discover object.\n\n\n    .. warning:: **Deprecated!** Useless, media_discoverer events are only triggered when calling\n        :func:`libvlc_media_discoverer_start` and :func:`libvlc_media_discoverer_stop`.\n\n    :param p_mdis: media service discover object.\n\n    :return: event manager object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_event_manager\", None) or _Cfunction(\n        \"libvlc_media_discoverer_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        MediaDiscoverer,\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_is_running(p_mdis):\n    \"\"\"Query if media service discover object is running.\n\n    :param p_mdis: media service discover object.\n\n    :return: true if running, false if not.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_is_running\", None) or _Cfunction(\n        \"libvlc_media_discoverer_is_running\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        MediaDiscoverer,\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_list_get(p_inst, i_cat, ppp_services):\n    \"\"\"Get media discoverer services by category\n\n    :param p_inst: libvlc instance.\n    :param i_cat: category of services to fetch.\n    :param ppp_services: address to store an allocated array of media discoverer.\n        services (must be freed with :func:`libvlc_media_discoverer_list_release` by.\n        the caller) [OUT].\n\n    :return: the number of media discoverer services (0 on error).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_list_get\", None) or _Cfunction(\n        \"libvlc_media_discoverer_list_get\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_size_t,\n        Instance,\n        MediaDiscovererCategory,\n        ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(MediaDiscovererDescription))),\n    )\n    return f(p_inst, i_cat, ppp_services)\n\n\ndef libvlc_media_discoverer_list_release(pp_services, i_count):\n    \"\"\"Release an array of media discoverer services\n\n    :func:`libvlc_media_discoverer_list_get`\n\n    :param pp_services: array to release.\n    :param i_count: number of elements in the array.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_list_release\", None) or _Cfunction(\n        \"libvlc_media_discoverer_list_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(MediaDiscovererDescription)),\n        ctypes.c_size_t,\n    )\n    return f(pp_services, i_count)\n\n\ndef libvlc_media_discoverer_localized_name(p_mdis):\n    \"\"\"Get media service discover object its localized name.\n\n\n    .. warning:: **Deprecated!** Useless, use :func:`libvlc_media_discoverer_list_get` to get the\n        longname of the service discovery.\n\n    :param p_mdis: media discover object.\n\n    :return: localized name or None if the media_discoverer is not started.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_localized_name\", None) or _Cfunction(\n        \"libvlc_media_discoverer_localized_name\",\n        ((1,),),\n        string_result,\n        ctypes.c_void_p,\n        MediaDiscoverer,\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_media_list(p_mdis):\n    \"\"\"Get media service discover media list.\n\n    :param p_mdis: media service discover object.\n\n    :return: list of media items.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_media_list\", None) or _Cfunction(\n        \"libvlc_media_discoverer_media_list\",\n        ((1,),),\n        class_result(MediaList),\n        ctypes.c_void_p,\n        MediaDiscoverer,\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_new(p_inst, psz_name):\n    \"\"\"Create a media discoverer object by name.\n\n    After this object is created, you should attach to media_list events in\n    order to be notified of new items discovered.\n\n    You need to call :func:`libvlc_media_discoverer_start` in order to start the\n    discovery.\n\n    :func:`libvlc_media_discoverer_media_list`\n    :func:`libvlc_media_discoverer_event_manager`\n    :func:`libvlc_media_discoverer_start`\n\n    :param p_inst: libvlc instance.\n    :param psz_name: service name; use :func:`libvlc_media_discoverer_list_get` to get.\n        a list of the discoverer names available in this libVLC instance.\n\n    :return: media discover object or None in case of error.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_new\", None) or _Cfunction(\n        \"libvlc_media_discoverer_new\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(MediaDiscoverer),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_inst, psz_name)\n\n\ndef libvlc_media_discoverer_new_from_name(p_inst, psz_name):\n    \"\"\".. warning:: **Deprecated!** Use :func:`libvlc_media_discoverer_new` and :func:`libvlc_media_discoverer_start`.\"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_new_from_name\", None) or _Cfunction(\n        \"libvlc_media_discoverer_new_from_name\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(MediaDiscoverer),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_inst, psz_name)\n\n\ndef libvlc_media_discoverer_release(p_mdis):\n    \"\"\"Release media discover object. If the reference count reaches 0, then\n    the object will be released.\n\n    :param p_mdis: media service discover object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_release\", None) or _Cfunction(\n        \"libvlc_media_discoverer_release\", ((1,),), None, None, MediaDiscoverer\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_start(p_mdis):\n    \"\"\"Start media discovery.\n\n    To stop it, call :func:`libvlc_media_discoverer_stop` or\n    :func:`libvlc_media_discoverer_list_release` directly.\n\n    :func:`libvlc_media_discoverer_stop`\n\n    :param p_mdis: media discover object.\n\n    :return: -1 in case of error, 0 otherwise.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_start\", None) or _Cfunction(\n        \"libvlc_media_discoverer_start\", ((1,),), None, ctypes.c_int, MediaDiscoverer\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_discoverer_stop(p_mdis):\n    \"\"\"Stop media discovery.\n\n    :func:`libvlc_media_discoverer_start`\n\n    :param p_mdis: media discover object.\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_discoverer_stop\", None) or _Cfunction(\n        \"libvlc_media_discoverer_stop\", ((1,),), None, None, MediaDiscoverer\n    )\n    return f(p_mdis)\n\n\ndef libvlc_media_duplicate(p_md):\n    \"\"\"Duplicate a media descriptor object.\n\n    :param p_md: a media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_duplicate\", None) or _Cfunction(\n        \"libvlc_media_duplicate\", ((1,),), class_result(Media), ctypes.c_void_p, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_event_manager(p_md):\n    \"\"\"Get event manager from media descriptor object.\n    NOTE: this function doesn't increment reference counting.\n\n    :param p_md: a media descriptor object.\n\n    :return: event manager object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_event_manager\", None) or _Cfunction(\n        \"libvlc_media_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        Media,\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_codec_description(i_type, i_codec):\n    \"\"\"Get codec description from media elementary stream\n\n    :class:`MediaTrack`\n\n    :param i_type: i_type from :class:`MediaTrack`.\n    :param i_codec: i_codec or i_original_fourcc from :class:`MediaTrack`.\n\n    :return: codec description.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_codec_description\", None) or _Cfunction(\n        \"libvlc_media_get_codec_description\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_char_p,\n        TrackType,\n        ctypes.c_uint32,\n    )\n    return f(i_type, i_codec)\n\n\ndef libvlc_media_get_duration(p_md):\n    \"\"\"Get duration (in ms) of media descriptor object item.\n\n    :param p_md: media descriptor object.\n\n    :return: duration of media item or -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_duration\", None) or _Cfunction(\n        \"libvlc_media_get_duration\", ((1,),), None, ctypes.c_longlong, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_meta(p_md, e_meta):\n    \"\"\"Read the meta of the media.\n\n    If the media has not yet been parsed this will return None.\n\n    :func:`libvlc_media_parse`\n    :func:`libvlc_media_parse_with_options`\n    libvlc_MediaMetaChanged\n\n    :param p_md: the media descriptor.\n    :param e_meta: the meta to read.\n\n    :return: the media's meta.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_meta\", None) or _Cfunction(\n        \"libvlc_media_get_meta\",\n        (\n            (1,),\n            (1,),\n        ),\n        string_result,\n        ctypes.c_void_p,\n        Media,\n        Meta,\n    )\n    return f(p_md, e_meta)\n\n\ndef libvlc_media_get_mrl(p_md):\n    \"\"\"Get the media resource locator (mrl) from a media descriptor object\n\n    :param p_md: a media descriptor object.\n\n    :return: string with mrl of media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_mrl\", None) or _Cfunction(\n        \"libvlc_media_get_mrl\", ((1,),), string_result, ctypes.c_void_p, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_parsed_status(p_md):\n    \"\"\"Get Parsed status for media descriptor object.\n\n    libvlc_MediaParsedChanged\n    :class:`MediaParsedStatus`\n\n    :param p_md: media descriptor object.\n\n    :return: a value of the :class:`MediaParsedStatus` enum.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_parsed_status\", None) or _Cfunction(\n        \"libvlc_media_get_parsed_status\", ((1,),), None, MediaParsedStatus, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_state(p_md):\n    \"\"\"Get current state of media descriptor object. Possible media states are\n    libvlc_NothingSpecial=0, libvlc_Opening, libvlc_Playing, libvlc_Paused,\n    libvlc_Stopped, libvlc_Ended, libvlc_Error.\n\n    :class:`State`.\n\n    :param p_md: a media descriptor object.\n\n    :return: state of media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_state\", None) or _Cfunction(\n        \"libvlc_media_get_state\", ((1,),), None, State, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_stats(p_md, p_stats):\n    \"\"\"Get the current statistics about the media.\n\n    :param p_md:: media descriptor object.\n    :param p_stats:: structure that contain the statistics about the media.\n        (this structure must be allocated by the caller).\n\n    :return: true if the statistics are available, false otherwise.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_stats\", None) or _Cfunction(\n        \"libvlc_media_get_stats\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Media,\n        ctypes.POINTER(MediaStats),\n    )\n    return f(p_md, p_stats)\n\n\ndef libvlc_media_get_tracks_info(p_md):\n    \"\"\"Get media descriptor's elementary streams description\n\n    Note, you need to call :func:`libvlc_media_parse` or play the media at least once\n    before calling this function.\n    Not doing this will result in an empty array.\n\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_media_tracks_get` instead\n\n    :param p_md: media descriptor object.\n    :param tracks: address to store an allocated array of Elementary Streams.\n        descriptions (must be freed by the caller) [OUT].\n\n    :return: the number of Elementary Streams.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_tracks_info\", None) or _Cfunction(\n        \"libvlc_media_get_tracks_info\",\n        (\n            (1,),\n            (2,),\n        ),\n        None,\n        ctypes.c_int,\n        Media,\n        ctypes.POINTER(ctypes.POINTER(MediaTrackInfo)),\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_type(p_md):\n    \"\"\"Get the media type of the media descriptor object\n\n    :class:`MediaType`\n\n    :param p_md: media descriptor object.\n\n    :return: media type.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_type\", None) or _Cfunction(\n        \"libvlc_media_get_type\", ((1,),), None, MediaType, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_get_user_data(p_md):\n    \"\"\"Get media descriptor's user_data. user_data is specialized data\n    accessed by the host application, VLC.framework uses it as a pointer to\n    an native object that references a :class:`Media` pointer\n\n    :param p_md: media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_get_user_data\", None) or _Cfunction(\n        \"libvlc_media_get_user_data\", ((1,),), None, ctypes.c_void_p, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_is_parsed(p_md):\n    \"\"\"Return true is the media descriptor object is parsed\n\n\n    .. warning:: **Deprecated!** This can return true in case of failure.\n        Use :func:`libvlc_media_get_parsed_status` instead\n\n    libvlc_MediaParsedChanged\n\n    :param p_md: media descriptor object.\n\n    :return: true if media object has been parsed otherwise it returns false.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_is_parsed\", None) or _Cfunction(\n        \"libvlc_media_is_parsed\", ((1,),), None, ctypes.c_int, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_library_load(p_mlib):\n    \"\"\"Load media library.\n\n    :param p_mlib: media library object.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_library_load\", None) or _Cfunction(\n        \"libvlc_media_library_load\", ((1,),), None, ctypes.c_int, MediaLibrary\n    )\n    return f(p_mlib)\n\n\ndef libvlc_media_library_media_list(p_mlib):\n    \"\"\"Get media library subitems.\n\n    :param p_mlib: media library object.\n\n    :return: media list subitems.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_library_media_list\", None) or _Cfunction(\n        \"libvlc_media_library_media_list\",\n        ((1,),),\n        class_result(MediaList),\n        ctypes.c_void_p,\n        MediaLibrary,\n    )\n    return f(p_mlib)\n\n\ndef libvlc_media_library_new(p_instance):\n    \"\"\"Create an new Media Library object\n\n    :param p_instance: the libvlc instance.\n\n    :return: a new object or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_library_new\", None) or _Cfunction(\n        \"libvlc_media_library_new\",\n        ((1,),),\n        class_result(MediaLibrary),\n        ctypes.c_void_p,\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_media_library_release(p_mlib):\n    \"\"\"Release media library object. This functions decrements the\n    reference count of the media library object. If it reaches 0,\n    then the object will be released.\n\n    :param p_mlib: media library object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_library_release\", None) or _Cfunction(\n        \"libvlc_media_library_release\", ((1,),), None, None, MediaLibrary\n    )\n    return f(p_mlib)\n\n\ndef libvlc_media_library_retain(p_mlib):\n    \"\"\"Retain a reference to a media library object. This function will\n    increment the reference counting for this object. Use\n    :func:`libvlc_media_library_release` to decrement the reference count.\n\n    :param p_mlib: media library object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_library_retain\", None) or _Cfunction(\n        \"libvlc_media_library_retain\", ((1,),), None, None, MediaLibrary\n    )\n    return f(p_mlib)\n\n\ndef libvlc_media_list_add_media(p_ml, p_md):\n    \"\"\"Add media instance to media list\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param p_md: a media instance.\n\n    :return: 0 on success, -1 if the media list is read-only.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_add_media\", None) or _Cfunction(\n        \"libvlc_media_list_add_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaList,\n        Media,\n    )\n    return f(p_ml, p_md)\n\n\ndef libvlc_media_list_count(p_ml):\n    \"\"\"Get count on media list items\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n\n    :return: number of items in media list.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_count\", None) or _Cfunction(\n        \"libvlc_media_list_count\", ((1,),), None, ctypes.c_int, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_event_manager(p_ml):\n    \"\"\"Get libvlc_event_manager from this media list instance.\n    The p_event_manager is immutable, so you don't have to hold the lock\n\n    :param p_ml: a media list instance.\n\n    :return: libvlc_event_manager.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_event_manager\", None) or _Cfunction(\n        \"libvlc_media_list_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        MediaList,\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_index_of_item(p_ml, p_md):\n    \"\"\"Find index position of List media instance in media list.\n    Warning: the function will return the first matched position.\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param p_md: media instance.\n\n    :return: position of media instance or -1 if media not found.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_index_of_item\", None) or _Cfunction(\n        \"libvlc_media_list_index_of_item\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaList,\n        Media,\n    )\n    return f(p_ml, p_md)\n\n\ndef libvlc_media_list_insert_media(p_ml, p_md, i_pos):\n    \"\"\"Insert media instance in media list on a position\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param p_md: a media instance.\n    :param i_pos: position in array where to insert.\n\n    :return: 0 on success, -1 if the media list is read-only.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_insert_media\", None) or _Cfunction(\n        \"libvlc_media_list_insert_media\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaList,\n        Media,\n        ctypes.c_int,\n    )\n    return f(p_ml, p_md, i_pos)\n\n\ndef libvlc_media_list_is_readonly(p_ml):\n    \"\"\"This indicates if this media list is read-only from a user point of view\n\n    :param p_ml: media list instance.\n\n    :return: 1 on readonly, 0 on readwrite.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_is_readonly\", None) or _Cfunction(\n        \"libvlc_media_list_is_readonly\", ((1,),), None, ctypes.c_int, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_item_at_index(p_ml, i_pos):\n    \"\"\"List media instance in media list at a position\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param i_pos: position in array where to insert.\n\n    :return: media instance at position *i_pos*, or None if not found.\n        In case of success, :func:`libvlc_media_retain` is called to increase the refcount.\n        on the media.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_item_at_index\", None) or _Cfunction(\n        \"libvlc_media_list_item_at_index\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        MediaList,\n        ctypes.c_int,\n    )\n    return f(p_ml, i_pos)\n\n\ndef libvlc_media_list_lock(p_ml):\n    \"\"\"Get lock on media list items\n\n    :param p_ml: a media list instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_lock\", None) or _Cfunction(\n        \"libvlc_media_list_lock\", ((1,),), None, None, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_media(p_ml):\n    \"\"\"Get media instance from this media list instance. This action will increase\n    the refcount on the media instance.\n    The :func:`libvlc_media_list_lock` should NOT be held upon entering this function.\n\n    :param p_ml: a media list instance.\n\n    :return: media instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_media\", None) or _Cfunction(\n        \"libvlc_media_list_media\",\n        ((1,),),\n        class_result(Media),\n        ctypes.c_void_p,\n        MediaList,\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_new(p_instance):\n    \"\"\"Create an empty media list.\n\n    :param p_instance: libvlc instance.\n\n    :return: empty media list, or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_new\", None) or _Cfunction(\n        \"libvlc_media_list_new\",\n        ((1,),),\n        class_result(MediaList),\n        ctypes.c_void_p,\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_media_list_player_event_manager(p_mlp):\n    \"\"\"Return the event manager of this media_list_player.\n\n    :param p_mlp: media list player instance.\n\n    :return: the event manager.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_event_manager\", None) or _Cfunction(\n        \"libvlc_media_list_player_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        MediaListPlayer,\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_get_media_player(p_mlp):\n    \"\"\"Get media player of the media_list_player instance.\n\n\n    .. note:: the caller is responsible for releasing the returned instance.\n\n    :param p_mlp: media list player instance.\n\n    :return: media player instance.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_list_player_get_media_player\", None\n    ) or _Cfunction(\n        \"libvlc_media_list_player_get_media_player\",\n        ((1,),),\n        class_result(MediaPlayer),\n        ctypes.c_void_p,\n        MediaListPlayer,\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_get_state(p_mlp):\n    \"\"\"Get current libvlc_state of media list player\n\n    :param p_mlp: media list player instance.\n\n    :return: :class:`State` for media list player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_get_state\", None) or _Cfunction(\n        \"libvlc_media_list_player_get_state\", ((1,),), None, State, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_is_playing(p_mlp):\n    \"\"\"Is media list playing?\n\n    :param p_mlp: media list player instance.\n\n    :return: true for playing and false for not playing.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_is_playing\", None) or _Cfunction(\n        \"libvlc_media_list_player_is_playing\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        MediaListPlayer,\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_new(p_instance):\n    \"\"\"Create new media_list_player.\n\n    :param p_instance: libvlc instance.\n\n    :return: media list player instance or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_new\", None) or _Cfunction(\n        \"libvlc_media_list_player_new\",\n        ((1,),),\n        class_result(MediaListPlayer),\n        ctypes.c_void_p,\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_media_list_player_next(p_mlp):\n    \"\"\"Play next item from media list\n\n    :param p_mlp: media list player instance.\n\n    :return: 0 upon success -1 if there is no next item.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_next\", None) or _Cfunction(\n        \"libvlc_media_list_player_next\", ((1,),), None, ctypes.c_int, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_pause(p_mlp):\n    \"\"\"Toggle pause (or resume) media list\n\n    :param p_mlp: media list player instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_pause\", None) or _Cfunction(\n        \"libvlc_media_list_player_pause\", ((1,),), None, None, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_play(p_mlp):\n    \"\"\"Play media list\n\n    :param p_mlp: media list player instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_play\", None) or _Cfunction(\n        \"libvlc_media_list_player_play\", ((1,),), None, None, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_play_item(p_mlp, p_md):\n    \"\"\"Play the given media item\n\n    :param p_mlp: media list player instance.\n    :param p_md: the media instance.\n\n    :return: 0 upon success, -1 if the media is not part of the media list.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_play_item\", None) or _Cfunction(\n        \"libvlc_media_list_player_play_item\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaListPlayer,\n        Media,\n    )\n    return f(p_mlp, p_md)\n\n\ndef libvlc_media_list_player_play_item_at_index(p_mlp, i_index):\n    \"\"\"Play media list item at position index\n\n    :param p_mlp: media list player instance.\n    :param i_index: index in media list to play.\n\n    :return: 0 upon success -1 if the item wasn't found.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_list_player_play_item_at_index\", None\n    ) or _Cfunction(\n        \"libvlc_media_list_player_play_item_at_index\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaListPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mlp, i_index)\n\n\ndef libvlc_media_list_player_previous(p_mlp):\n    \"\"\"Play previous item from media list\n\n    :param p_mlp: media list player instance.\n\n    :return: 0 upon success -1 if there is no previous item.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_previous\", None) or _Cfunction(\n        \"libvlc_media_list_player_previous\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        MediaListPlayer,\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_release(p_mlp):\n    \"\"\"Release a media_list_player after use\n    Decrement the reference count of a media player object. If the\n    reference count is 0, then :func:`libvlc_media_list_player_release` will\n    release the media player object. If the media player object\n    has been released, then it should not be used again.\n\n    :param p_mlp: media list player instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_release\", None) or _Cfunction(\n        \"libvlc_media_list_player_release\", ((1,),), None, None, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_retain(p_mlp):\n    \"\"\"Retain a reference to a media player list object. Use\n    :func:`libvlc_media_list_player_release` to decrement reference count.\n\n    :param p_mlp: media player list object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_retain\", None) or _Cfunction(\n        \"libvlc_media_list_player_retain\", ((1,),), None, None, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_player_set_media_list(p_mlp, p_mlist):\n    \"\"\"Set the media list associated with the player\n\n    :param p_mlp: media list player instance.\n    :param p_mlist: list of media.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_set_media_list\", None) or _Cfunction(\n        \"libvlc_media_list_player_set_media_list\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaListPlayer,\n        MediaList,\n    )\n    return f(p_mlp, p_mlist)\n\n\ndef libvlc_media_list_player_set_media_player(p_mlp, p_mi):\n    \"\"\"Replace media player in media_list_player with this instance.\n\n    :param p_mlp: media list player instance.\n    :param p_mi: media player instance.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_list_player_set_media_player\", None\n    ) or _Cfunction(\n        \"libvlc_media_list_player_set_media_player\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaListPlayer,\n        MediaPlayer,\n    )\n    return f(p_mlp, p_mi)\n\n\ndef libvlc_media_list_player_set_pause(p_mlp, do_pause):\n    \"\"\"Pause or resume media list\n\n    :param p_mlp: media list player instance.\n    :param do_pause: play/resume if zero, pause if non-zero.\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_set_pause\", None) or _Cfunction(\n        \"libvlc_media_list_player_set_pause\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaListPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mlp, do_pause)\n\n\ndef libvlc_media_list_player_set_playback_mode(p_mlp, e_mode):\n    \"\"\"Sets the playback mode for the playlist\n\n    :param p_mlp: media list player instance.\n    :param e_mode: playback mode specification.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_list_player_set_playback_mode\", None\n    ) or _Cfunction(\n        \"libvlc_media_list_player_set_playback_mode\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaListPlayer,\n        PlaybackMode,\n    )\n    return f(p_mlp, e_mode)\n\n\ndef libvlc_media_list_player_stop(p_mlp):\n    \"\"\"Stop playing media list\n\n    :param p_mlp: media list player instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_player_stop\", None) or _Cfunction(\n        \"libvlc_media_list_player_stop\", ((1,),), None, None, MediaListPlayer\n    )\n    return f(p_mlp)\n\n\ndef libvlc_media_list_release(p_ml):\n    \"\"\"Release media list created with :func:`libvlc_media_list_new`.\n\n    :param p_ml: a media list created with :func:`libvlc_media_list_new`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_release\", None) or _Cfunction(\n        \"libvlc_media_list_release\", ((1,),), None, None, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_remove_index(p_ml, i_pos):\n    \"\"\"Remove media instance from media list on a position\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param i_pos: position in array where to insert.\n\n    :return: 0 on success, -1 if the list is read-only or the item was not found.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_remove_index\", None) or _Cfunction(\n        \"libvlc_media_list_remove_index\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaList,\n        ctypes.c_int,\n    )\n    return f(p_ml, i_pos)\n\n\ndef libvlc_media_list_retain(p_ml):\n    \"\"\"Retain reference to a media list\n\n    :param p_ml: a media list created with :func:`libvlc_media_list_new`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_retain\", None) or _Cfunction(\n        \"libvlc_media_list_retain\", ((1,),), None, None, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_list_set_media(p_ml, p_md):\n    \"\"\"Associate media instance with this media list instance.\n    If another media instance was present it will be released.\n    The :func:`libvlc_media_list_lock` should NOT be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    :param p_md: media instance to add.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_set_media\", None) or _Cfunction(\n        \"libvlc_media_list_set_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaList,\n        Media,\n    )\n    return f(p_ml, p_md)\n\n\ndef libvlc_media_list_unlock(p_ml):\n    \"\"\"Release lock on media list items\n    The :func:`libvlc_media_list_lock` should be held upon entering this function.\n\n    :param p_ml: a media list instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_list_unlock\", None) or _Cfunction(\n        \"libvlc_media_list_unlock\", ((1,),), None, None, MediaList\n    )\n    return f(p_ml)\n\n\ndef libvlc_media_new_as_node(p_instance, psz_name):\n    \"\"\"Create a media as an empty node with a given name.\n\n    :func:`libvlc_media_release`\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the node.\n\n    :return: the new empty media or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_new_as_node\", None) or _Cfunction(\n        \"libvlc_media_new_as_node\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_media_new_callbacks(instance, open_cb, read_cb, seek_cb, close_cb, opaque):\n    \"\"\"Create a media with custom callbacks to read the data from.\n\n    .. note:: If *open_cb* is None, the *opaque* pointer will be passed to *read_cb*,\n        *seek_cb* and *close_cb*, and the stream size will be treated as unknown.\n\n    .. note:: The callbacks may be called asynchronously (from another thread).\n        A single stream *instance* need not be reentrant. However the *open_cb* needs to\n        be reentrant if the media is used by multiple player instances.\n\n    .. warning:: The callbacks may be used until all or any player instances\n        that were supplied the media item are stopped.\n\n    :func:`libvlc_media_release`\n\n    :param instance: LibVLC instance.\n    :param open_cb: callback to open the custom bitstream input media.\n    :param read_cb: callback to read data (must not be None).\n    :param seek_cb: callback to seek, or None if seeking is not supported.\n    :param close_cb: callback to close the media, or None if unnecessary.\n    :param opaque: data pointer for the open callback.\n\n    :return: the newly created media or None on error.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_new_callbacks\", None) or _Cfunction(\n        \"libvlc_media_new_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        Instance,\n        MediaOpenCb,\n        MediaReadCb,\n        MediaSeekCb,\n        MediaCloseCb,\n        ctypes.c_void_p,\n    )\n    return f(instance, open_cb, read_cb, seek_cb, close_cb, opaque)\n\n\ndef libvlc_media_new_fd(p_instance, fd):\n    \"\"\"Create a media for an already open file descriptor.\n    The file descriptor shall be open for reading (or reading and writing).\n\n    Regular file descriptors, pipe read descriptors and character device\n    descriptors (including TTYs) are supported on all platforms.\n    Block device descriptors are supported where available.\n    Directory descriptors are supported on systems that provide fdopendir().\n    Sockets are supported on all platforms where they are file descriptors,\n    i.e. all except Windows.\n\n    .. note:: This library will **not** automatically close the file descriptor\n        under any circumstance. Nevertheless, a file descriptor can usually only be\n        rendered once in a media player. To render it a second time, the file\n        descriptor should probably be rewound to the beginning with lseek().\n\n    :func:`libvlc_media_release`\n\n    :param p_instance: the instance.\n    :param fd: open file descriptor.\n\n    :return: the newly created media or None on error.\n    :version: LibVLC 1.1.5 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_new_fd\", None) or _Cfunction(\n        \"libvlc_media_new_fd\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_int,\n    )\n    return f(p_instance, fd)\n\n\ndef libvlc_media_new_location(p_instance, psz_mrl):\n    \"\"\"Create a media with a certain given media resource location,\n    for instance a valid URL.\n\n    .. note:: To refer to a local file with this function,\n        the file://... URI syntax **must** be used (see IETF RFC3986).\n        We recommend using :func:`libvlc_media_new_path` instead when dealing with\n        local files.\n\n    :func:`libvlc_media_release`\n\n    :param p_instance: the instance.\n    :param psz_mrl: the media location.\n\n    :return: the newly created media or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_new_location\", None) or _Cfunction(\n        \"libvlc_media_new_location\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_mrl)\n\n\ndef libvlc_media_new_path(p_instance, path):\n    \"\"\"Create a media for a certain file *path*.\n\n    :func:`libvlc_media_release`\n\n    :param p_instance: the instance.\n    :param path: local filesystem path.\n\n    :return: the newly created media or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_new_path\", None) or _Cfunction(\n        \"libvlc_media_new_path\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Media),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, path)\n\n\ndef libvlc_media_parse(p_md):\n    \"\"\"Parse a media.\n\n    This fetches (local) art, meta data and tracks information.\n    The method is synchronous.\n\n\n    .. warning:: **Deprecated!** This function could block indefinitely.\n        Use :func:`libvlc_media_parse_with_options` instead\n\n    :func:`libvlc_media_parse_with_options`\n    :func:`libvlc_media_get_meta`\n    :func:`libvlc_media_get_tracks_info`\n\n    :param p_md: media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_parse\", None) or _Cfunction(\n        \"libvlc_media_parse\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_parse_async(p_md):\n    \"\"\"Parse a media.\n\n    This fetches (local) art, meta data and tracks information.\n    The method is the asynchronous of :func:`libvlc_media_parse`.\n\n    To track when this is over you can listen to libvlc_MediaParsedChanged\n    event. However if the media was already parsed you will not receive this\n    event.\n\n\n    .. warning:: **Deprecated!** You can't be sure to receive the libvlc_MediaParsedChanged\n        event (you can wait indefinitely for this event).\n        Use :func:`libvlc_media_parse_with_options` instead\n\n    :func:`libvlc_media_parse`\n    libvlc_MediaParsedChanged\n    :func:`libvlc_media_get_meta`\n    :func:`libvlc_media_get_tracks_info`\n\n    :param p_md: media descriptor object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_parse_async\", None) or _Cfunction(\n        \"libvlc_media_parse_async\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_parse_stop(p_md):\n    \"\"\"Stop the parsing of the media\n\n    When the media parsing is stopped, the libvlc_MediaParsedChanged event will\n    be sent with the libvlc_media_parsed_status_timeout status.\n\n    :func:`libvlc_media_parse_with_options`\n\n    :param p_md: media descriptor object.\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_parse_stop\", None) or _Cfunction(\n        \"libvlc_media_parse_stop\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_parse_with_options(p_md, parse_flag, timeout):\n    \"\"\"Parse the media asynchronously with options.\n\n    This fetches (local or network) art, meta data and/or tracks information.\n    This method is the extended version of :func:`libvlc_media_parse_with_options`.\n\n    To track when this is over you can listen to libvlc_MediaParsedChanged\n    event. However if this functions returns an error, you will not receive any\n    events.\n\n    It uses a flag to specify parse options (see libvlc_media_parse_flag_t). All\n    these flags can be combined. By default, media is parsed if it's a local\n    file.\n\n    .. note:: Parsing can be aborted with :func:`libvlc_media_parse_stop`.\n\n    libvlc_MediaParsedChanged\n    :func:`libvlc_media_get_meta`\n    :func:`libvlc_media_tracks_get`\n    :func:`libvlc_media_get_parsed_status`\n    :class:`MediaParseFlag`\n\n    :param p_md: media descriptor object.\n    :param parse_flag: parse options:\n    :param timeout: maximum time allowed to preparse the media. If -1, the.\n        default \"preparse-timeout\" option will be used as a timeout. If 0, it will.\n        wait indefinitely. If > 0, the timeout will be used (in milliseconds).\n\n    :return: -1 in case of error, 0 otherwise.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_parse_with_options\", None) or _Cfunction(\n        \"libvlc_media_parse_with_options\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Media,\n        MediaParseFlag,\n        ctypes.c_int,\n    )\n    return f(p_md, parse_flag, timeout)\n\n\ndef libvlc_media_player_add_slave(p_mi, i_type, psz_uri, b_select):\n    \"\"\"Add a slave to the current media player.\n\n    .. note:: If the player is playing, the slave will be added directly. This call\n        will also update the slave list of the attached :class:`Media`.\n\n    :func:`libvlc_media_slaves_add`\n\n    :param p_mi: the media player.\n    :param i_type: subtitle or audio.\n    :param psz_uri: Uri of the slave (should contain a valid scheme).\n    :param b_select: True if this slave should be selected when it's loaded.\n\n    :return: 0 on success, -1 on error.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_add_slave\", None) or _Cfunction(\n        \"libvlc_media_player_add_slave\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        MediaSlaveType,\n        ctypes.c_char_p,\n        ctypes.c_bool,\n    )\n    return f(p_mi, i_type, psz_uri, b_select)\n\n\ndef libvlc_media_player_can_pause(p_mi):\n    \"\"\"Can this media player be paused?\n\n    :param p_mi: the media player.\n\n    :return: true if the media player can pause.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_can_pause\", None) or _Cfunction(\n        \"libvlc_media_player_can_pause\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_event_manager(p_mi):\n    \"\"\"Get the Event Manager from which the media player send event.\n\n    :param p_mi: the Media Player.\n\n    :return: the event manager associated with p_mi.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_event_manager\", None) or _Cfunction(\n        \"libvlc_media_player_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_agl(p_mi):\n    \"\"\".. warning:: **Deprecated!** Use :func:`libvlc_media_player_get_nsobject` instead.\"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_agl\", None) or _Cfunction(\n        \"libvlc_media_player_get_agl\", ((1,),), None, ctypes.c_uint32, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_chapter(p_mi):\n    \"\"\"Get movie chapter.\n\n    :param p_mi: the Media Player.\n\n    :return: chapter number currently playing, or -1 if there is no media.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_chapter\", None) or _Cfunction(\n        \"libvlc_media_player_get_chapter\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_chapter_count(p_mi):\n    \"\"\"Get movie chapter count\n\n    :param p_mi: the Media Player.\n\n    :return: number of chapters in movie, or -1.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_chapter_count\", None) or _Cfunction(\n        \"libvlc_media_player_get_chapter_count\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_chapter_count_for_title(p_mi, i_title):\n    \"\"\"Get title chapter count\n\n    :param p_mi: the Media Player.\n    :param i_title: title.\n\n    :return: number of chapters in title, or -1.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_player_get_chapter_count_for_title\", None\n    ) or _Cfunction(\n        \"libvlc_media_player_get_chapter_count_for_title\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_title)\n\n\ndef libvlc_media_player_get_fps(p_mi):\n    \"\"\"Get movie fps rate\n\n    This function is provided for backward compatibility. It cannot deal with\n    multiple video tracks. In LibVLC versions prior to 3.0, it would also fail\n    if the file format did not convey the frame rate explicitly.\n\n\n    .. warning:: **Deprecated!** Consider using :func:`libvlc_media_tracks_get` instead.\n\n    :param p_mi: the Media Player.\n\n    :return: frames per second (fps) for this playing movie, or 0 if unspecified.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_fps\", None) or _Cfunction(\n        \"libvlc_media_player_get_fps\", ((1,),), None, ctypes.c_float, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_full_chapter_descriptions(\n    p_mi, i_chapters_of_title, pp_chapters\n):\n    \"\"\"Get the full description of available chapters\n\n    :param p_mi: the media player.\n    :param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1).\n    :param pp_chapters: address to store an allocated array of chapter descriptions.\n        descriptions (must be freed with :func:`libvlc_chapter_descriptions_release`.\n        by the caller) [OUT].\n\n    :return: the number of chapters (-1 on error).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_player_get_full_chapter_descriptions\", None\n    ) or _Cfunction(\n        \"libvlc_media_player_get_full_chapter_descriptions\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n        ctypes.POINTER(ctypes.POINTER(ChapterDescription)),\n    )\n    return f(p_mi, i_chapters_of_title, pp_chapters)\n\n\ndef libvlc_media_player_get_full_title_descriptions(p_mi, titles):\n    \"\"\"Get the full description of available titles\n\n    :param p_mi: the media player.\n    :param titles: address to store an allocated array of title descriptions.\n        descriptions (must be freed with :func:`libvlc_title_descriptions_release`.\n        by the caller) [OUT].\n\n    :return: the number of *titles* (-1 on error).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_player_get_full_title_descriptions\", None\n    ) or _Cfunction(\n        \"libvlc_media_player_get_full_title_descriptions\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.POINTER(ctypes.POINTER(TitleDescription)),\n    )\n    return f(p_mi, titles)\n\n\ndef libvlc_media_player_get_hwnd(p_mi):\n    \"\"\"Get the Windows API window handle (HWND) previously set with\n    :func:`libvlc_media_player_set_hwnd`. The handle will be returned even if LibVLC\n    is not currently outputting any video to it.\n\n    :param p_mi: the Media Player.\n\n    :return: a window handle or None if there are none.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_hwnd\", None) or _Cfunction(\n        \"libvlc_media_player_get_hwnd\", ((1,),), None, ctypes.c_void_p, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_length(p_mi):\n    \"\"\"Get the current movie length (in ms).\n\n    :param p_mi: the Media Player.\n\n    :return: the movie length (in ms), or -1 if there is no media.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_length\", None) or _Cfunction(\n        \"libvlc_media_player_get_length\", ((1,),), None, ctypes.c_longlong, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_media(p_mi):\n    \"\"\"Get the media used by the media_player.\n\n    :param p_mi: the Media Player.\n\n    :return: the media associated with *p_mi*, or None if no.\n        media is associated.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_media\", None) or _Cfunction(\n        \"libvlc_media_player_get_media\",\n        ((1,),),\n        class_result(Media),\n        ctypes.c_void_p,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_nsobject(p_mi):\n    \"\"\"Get the NSView handler previously set with :func:`libvlc_media_player_set_nsobject`.\n\n    :param p_mi: the Media Player.\n\n    :return: the NSView handler or 0 if none where set.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_nsobject\", None) or _Cfunction(\n        \"libvlc_media_player_get_nsobject\", ((1,),), None, ctypes.c_void_p, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_position(p_mi):\n    \"\"\"Get movie position as percentage between 0.0 and 1.0.\n\n    :param p_mi: the Media Player.\n\n    :return: movie position, or -1. in case of error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_position\", None) or _Cfunction(\n        \"libvlc_media_player_get_position\", ((1,),), None, ctypes.c_float, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_rate(p_mi):\n    \"\"\"Get the requested movie play rate.\n    .. warning:: Depending on the underlying media, the requested rate may be\n        different from the real playback rate.\n\n    :param p_mi: the Media Player.\n\n    :return: movie play rate.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_rate\", None) or _Cfunction(\n        \"libvlc_media_player_get_rate\", ((1,),), None, ctypes.c_float, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_role(p_mi):\n    \"\"\"Gets the media role.\n\n    :param p_mi: media player.\n\n    :return: the media player role (libvlc_media_player_role_t).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_role\", None) or _Cfunction(\n        \"libvlc_media_player_get_role\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_state(p_mi):\n    \"\"\"Get current movie state\n\n    :param p_mi: the Media Player.\n\n    :return: the current state of the media player (playing, paused, ...) :class:`State`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_state\", None) or _Cfunction(\n        \"libvlc_media_player_get_state\", ((1,),), None, State, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_time(p_mi):\n    \"\"\"Get the current movie time (in ms).\n\n    :param p_mi: the Media Player.\n\n    :return: the movie time (in ms), or -1 if there is no media.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_time\", None) or _Cfunction(\n        \"libvlc_media_player_get_time\", ((1,),), None, ctypes.c_longlong, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_title(p_mi):\n    \"\"\"Get movie title\n\n    :param p_mi: the Media Player.\n\n    :return: title number currently playing, or -1.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_title\", None) or _Cfunction(\n        \"libvlc_media_player_get_title\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_title_count(p_mi):\n    \"\"\"Get movie title count\n\n    :param p_mi: the Media Player.\n\n    :return: title number count, or -1.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_title_count\", None) or _Cfunction(\n        \"libvlc_media_player_get_title_count\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_get_xwindow(p_mi):\n    \"\"\"Get the X Window System window identifier previously set with\n    :func:`libvlc_media_player_set_xwindow`. Note that this will return the identifier\n    even if VLC is not currently using it (for instance if it is playing an\n    audio-only input).\n\n    :param p_mi: the Media Player.\n\n    :return: an X window ID, or 0 if none where set.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_get_xwindow\", None) or _Cfunction(\n        \"libvlc_media_player_get_xwindow\", ((1,),), None, ctypes.c_uint32, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_has_vout(p_mi):\n    \"\"\"How many video outputs does this media player have?\n\n    :param p_mi: the media player.\n\n    :return: the number of video outputs.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_has_vout\", None) or _Cfunction(\n        \"libvlc_media_player_has_vout\", ((1,),), None, ctypes.c_uint, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_is_playing(p_mi):\n    \"\"\"is_playing\n\n    :param p_mi: the Media Player.\n\n    :return: 1 if the media player is playing, 0 otherwise.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_is_playing\", None) or _Cfunction(\n        \"libvlc_media_player_is_playing\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_is_seekable(p_mi):\n    \"\"\"Is this media player seekable?\n\n    :param p_mi: the media player.\n\n    :return: true if the media player can seek.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_is_seekable\", None) or _Cfunction(\n        \"libvlc_media_player_is_seekable\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_navigate(p_mi, navigate):\n    \"\"\"Navigate through DVD Menu\n\n    :param p_mi: the Media Player.\n    :param navigate: the Navigation mode.\n\n    :version: libVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_navigate\", None) or _Cfunction(\n        \"libvlc_media_player_navigate\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, navigate)\n\n\ndef libvlc_media_player_new(p_libvlc_instance):\n    \"\"\"Create an empty Media Player object\n\n    :param p_libvlc_instance: the libvlc instance in which the Media Player.\n        should be created.\n\n    :return: a new media player object, or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_new\", None) or _Cfunction(\n        \"libvlc_media_player_new\",\n        ((1,),),\n        class_result(MediaPlayer),\n        ctypes.c_void_p,\n        Instance,\n    )\n    return f(p_libvlc_instance)\n\n\ndef libvlc_media_player_new_from_media(p_md):\n    \"\"\"Create a Media Player object from a Media\n\n    :param p_md: the media. Afterwards the p_md can be safely.\n        destroyed.\n\n    :return: a new media player object, or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_new_from_media\", None) or _Cfunction(\n        \"libvlc_media_player_new_from_media\",\n        ((1,),),\n        class_result(MediaPlayer),\n        ctypes.c_void_p,\n        Media,\n    )\n    return f(p_md)\n\n\ndef libvlc_media_player_next_chapter(p_mi):\n    \"\"\"Set next chapter (if applicable)\n\n    :param p_mi: the Media Player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_next_chapter\", None) or _Cfunction(\n        \"libvlc_media_player_next_chapter\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_next_frame(p_mi):\n    \"\"\"Display the next frame (if supported)\n\n    :param p_mi: the media player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_next_frame\", None) or _Cfunction(\n        \"libvlc_media_player_next_frame\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_pause(p_mi):\n    \"\"\"Toggle pause (no effect if there is no media)\n\n    :param p_mi: the Media Player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_pause\", None) or _Cfunction(\n        \"libvlc_media_player_pause\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_play(p_mi):\n    \"\"\"Play\n\n    :param p_mi: the Media Player.\n\n    :return: 0 if playback started (and was already started), or -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_play\", None) or _Cfunction(\n        \"libvlc_media_player_play\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_previous_chapter(p_mi):\n    \"\"\"Set previous chapter (if applicable)\n\n    :param p_mi: the Media Player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_previous_chapter\", None) or _Cfunction(\n        \"libvlc_media_player_previous_chapter\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_program_scrambled(p_mi):\n    \"\"\"Check if the current program is scrambled\n\n    :param p_mi: the media player.\n\n    :return: true if the current program is scrambled.\n\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_program_scrambled\", None) or _Cfunction(\n        \"libvlc_media_player_program_scrambled\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_release(p_mi):\n    \"\"\"Release a media_player after use\n    Decrement the reference count of a media player object. If the\n    reference count is 0, then :func:`libvlc_media_player_release` will\n    release the media player object. If the media player object\n    has been released, then it should not be used again.\n\n    :param p_mi: the Media Player to free.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_release\", None) or _Cfunction(\n        \"libvlc_media_player_release\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_retain(p_mi):\n    \"\"\"Retain a reference to a media player object. Use\n    :func:`libvlc_media_player_release` to decrement reference count.\n\n    :param p_mi: media player object.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_retain\", None) or _Cfunction(\n        \"libvlc_media_player_retain\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_set_agl(p_mi, drawable):\n    \"\"\".. warning:: **Deprecated!** Use :func:`libvlc_media_player_set_nsobject` instead.\"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_agl\", None) or _Cfunction(\n        \"libvlc_media_player_set_agl\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint32,\n    )\n    return f(p_mi, drawable)\n\n\ndef libvlc_media_player_set_android_context(p_mi, p_awindow_handler):\n    \"\"\"Set the android context.\n\n    :param p_mi: the media player.\n    :param p_awindow_handler: org.videolan.libvlc.AWindow jobject owned by the.\n        org.videolan.libvlc.MediaPlayer class from the libvlc-android project.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_android_context\", None) or _Cfunction(\n        \"libvlc_media_player_set_android_context\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_void_p,\n    )\n    return f(p_mi, p_awindow_handler)\n\n\ndef libvlc_media_player_set_chapter(p_mi, i_chapter):\n    \"\"\"Set movie chapter (if applicable).\n\n    :param p_mi: the Media Player.\n    :param i_chapter: chapter number to play.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_chapter\", None) or _Cfunction(\n        \"libvlc_media_player_set_chapter\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_chapter)\n\n\ndef libvlc_media_player_set_equalizer(p_mi, p_equalizer):\n    \"\"\"Apply new equalizer settings to a media player.\n\n    The equalizer is first created by invoking :func:`libvlc_audio_equalizer_new` or\n    :func:`libvlc_audio_equalizer_new_from_preset`.\n\n    It is possible to apply new equalizer settings to a media player whether the media\n    player is currently playing media or not.\n\n    Invoking this method will immediately apply the new equalizer settings to the audio\n    output of the currently playing media if there is any.\n\n    If there is no currently playing media, the new equalizer settings will be applied\n    later if and when new media is played.\n\n    Equalizer settings will automatically be applied to subsequently played media.\n\n    To disable the equalizer for a media player invoke this method passing None for the\n    p_equalizer parameter.\n\n    The media player does not keep a reference to the supplied equalizer so it is safe\n    for an application to release the equalizer reference any time after this method\n    returns.\n\n    :param p_mi: opaque media player handle.\n    :param p_equalizer: opaque equalizer handle, or None to disable the equalizer for this media player.\n\n    :return: zero on success, -1 on error.\n    :version: LibVLC 2.2.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_equalizer\", None) or _Cfunction(\n        \"libvlc_media_player_set_equalizer\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        AudioEqualizer,\n    )\n    return f(p_mi, p_equalizer)\n\n\ndef libvlc_media_player_set_evas_object(p_mi, p_evas_object):\n    \"\"\"Set the EFL Evas Object.\n\n    :param p_mi: the media player.\n    :param p_evas_object: a valid EFL Evas Object (Evas_Object).\n\n    :return: -1 if an error was detected, 0 otherwise.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_evas_object\", None) or _Cfunction(\n        \"libvlc_media_player_set_evas_object\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_void_p,\n    )\n    return f(p_mi, p_evas_object)\n\n\ndef libvlc_media_player_set_hwnd(p_mi, drawable):\n    \"\"\"Set a Win32/Win64 API window handle (HWND) where the media player should\n    render its video output. If LibVLC was built without Win32/Win64 API output\n    support, then this has no effects.\n\n    :param p_mi: the Media Player.\n    :param drawable: windows handle of the drawable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_hwnd\", None) or _Cfunction(\n        \"libvlc_media_player_set_hwnd\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_void_p,\n    )\n    return f(p_mi, drawable)\n\n\ndef libvlc_media_player_set_media(p_mi, p_md):\n    \"\"\"Set the media that will be used by the media_player. If any,\n    previous md will be released.\n\n    :param p_mi: the Media Player.\n    :param p_md: the Media. Afterwards the p_md can be safely.\n        destroyed.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_media\", None) or _Cfunction(\n        \"libvlc_media_player_set_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        Media,\n    )\n    return f(p_mi, p_md)\n\n\ndef libvlc_media_player_set_nsobject(p_mi, drawable):\n    \"\"\"Set the NSView handler where the media player should render its video output.\n\n    Use the vout called \"macosx\".\n\n    The *drawable* is an NSObject that follow the VLCOpenGLVideoViewEmbedding\n    protocol:\n\n    .. code-block:: objectivec++\n\n        @protocol VLCOpenGLVideoViewEmbedding <NSObject>\n        - (void)addVoutSubview:(NSView *)view;\n        - (void)removeVoutSubview:(NSView *)view;\n        @end\n\n    Or it can be an NSView object.\n\n    If you want to use it along with Qt see the QMacCocoaViewContainer. Then\n    the following code should work:\n\n    .. code-block:: objectivec++\n\n        NSView *video = [[NSView alloc] init];\n        QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);\n        libvlc_media_player_set_nsobject(mp, video);\n        [video release];\n\n\n    You can find a live example in VLCVideoView in VLCKit.framework.\n\n    :param p_mi: the Media Player.\n    :param drawable: the drawable that is either an NSView or an object following.\n        the VLCOpenGLVideoViewEmbedding protocol.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_nsobject\", None) or _Cfunction(\n        \"libvlc_media_player_set_nsobject\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_void_p,\n    )\n    return f(p_mi, drawable)\n\n\ndef libvlc_media_player_set_pause(mp, do_pause):\n    \"\"\"Pause or resume (no effect if there is no media)\n\n    :param mp: the Media Player.\n    :param do_pause: play/resume if zero, pause if non-zero.\n\n    :version: LibVLC 1.1.1 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_pause\", None) or _Cfunction(\n        \"libvlc_media_player_set_pause\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(mp, do_pause)\n\n\ndef libvlc_media_player_set_position(p_mi, f_pos):\n    \"\"\"Set movie position as percentage between 0.0 and 1.0.\n    This has no effect if playback is not enabled.\n    This might not work depending on the underlying input format and protocol.\n\n    :param p_mi: the Media Player.\n    :param f_pos: the position.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_position\", None) or _Cfunction(\n        \"libvlc_media_player_set_position\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_float,\n    )\n    return f(p_mi, f_pos)\n\n\ndef libvlc_media_player_set_rate(p_mi, rate):\n    \"\"\"Set movie play rate\n\n    :param p_mi: the Media Player.\n    :param rate: movie play rate to set.\n\n    :return: -1 if an error was detected, 0 otherwise (but even then, it might.\n        not actually work depending on the underlying media protocol).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_rate\", None) or _Cfunction(\n        \"libvlc_media_player_set_rate\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_float,\n    )\n    return f(p_mi, rate)\n\n\ndef libvlc_media_player_set_renderer(p_mi, p_item):\n    \"\"\"Set a renderer to the media player\n\n    .. note:: must be called before the first call of :func:`libvlc_media_player_play` to\n        take effect.\n\n    :func:`libvlc_renderer_discoverer_new`\n\n    :param p_mi: the Media Player.\n    :param p_item: an item discovered by :func:`libvlc_renderer_discoverer_start`.\n\n    :return: 0 on success, -1 on error.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_renderer\", None) or _Cfunction(\n        \"libvlc_media_player_set_renderer\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        Renderer,\n    )\n    return f(p_mi, p_item)\n\n\ndef libvlc_media_player_set_role(p_mi, role):\n    \"\"\"Sets the media *role*.\n\n    :param p_mi: media player.\n    :param role: the media player role (libvlc_media_player_role_t).\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_role\", None) or _Cfunction(\n        \"libvlc_media_player_set_role\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, role)\n\n\ndef libvlc_media_player_set_time(p_mi, i_time):\n    \"\"\"Set the movie time (in ms). This has no effect if no media is being played.\n    Not all formats and protocols support this.\n\n    :param p_mi: the Media Player.\n    :param i_time: the movie time (in ms).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_time\", None) or _Cfunction(\n        \"libvlc_media_player_set_time\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_longlong,\n    )\n    return f(p_mi, i_time)\n\n\ndef libvlc_media_player_set_title(p_mi, i_title):\n    \"\"\"Set movie title\n\n    :param p_mi: the Media Player.\n    :param i_title: title number to play.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_title\", None) or _Cfunction(\n        \"libvlc_media_player_set_title\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_title)\n\n\ndef libvlc_media_player_set_video_title_display(p_mi, position, timeout):\n    \"\"\"Set if, and how, the video title will be shown when media is played.\n\n    :param p_mi: the media player.\n    :param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed.\n    :param timeout: title display timeout in milliseconds (ignored if libvlc_position_disable).\n\n    :version: libVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\n        \"libvlc_media_player_set_video_title_display\", None\n    ) or _Cfunction(\n        \"libvlc_media_player_set_video_title_display\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        Position,\n        ctypes.c_uint,\n    )\n    return f(p_mi, position, timeout)\n\n\ndef libvlc_media_player_set_xwindow(p_mi, drawable):\n    \"\"\"Set an X Window System *drawable* where the media player should render its\n    video output. The call takes effect when the playback starts. If it is\n    already started, it might need to be stopped before changes apply.\n    If LibVLC was built without X11 output support, then this function has no\n    effects.\n\n    By default, LibVLC will capture input events on the video rendering area.\n    Use :func:`libvlc_video_set_mouse_input` and :func:`libvlc_video_set_key_input` to\n    disable that and deliver events to the parent window / to the application\n    instead. By design, the X11 protocol delivers input events to only one\n    recipient.\n\n    .. warning::\n        The application must call the XInitThreads() function from Xlib before\n        :func:`libvlc_new`, and before any call to XOpenDisplay() directly or via any\n        other library. Failure to call XInitThreads() will seriously impede LibVLC\n        performance. Calling XOpenDisplay() before XInitThreads() will eventually\n        crash the process. That is a limitation of Xlib.\n\n    .. note::\n        The specified identifier must correspond to an existing Input/Output class\n        X11 window. Pixmaps are **not** currently supported. The default X11\n        server is assumed, i.e. that specified in the DISPLAY environment variable.\n\n    .. warning::\n        LibVLC can deal with invalid X11 handle errors, however some display drivers\n        (EGL, GLX, VA and/or VDPAU) can unfortunately not. Thus the window handle\n        must remain valid until playback is stopped, otherwise the process may\n        abort or crash.\n\n    :param p_mi: media player.\n    :param drawable: X11 window ID.\n\n    :bug:\n        No more than one window handle per media player instance can be specified.\n        If the media has multiple simultaneously active video tracks, extra tracks.\n        will be rendered into external windows beyond the control of the.\n        application.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_set_xwindow\", None) or _Cfunction(\n        \"libvlc_media_player_set_xwindow\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint32,\n    )\n    return f(p_mi, drawable)\n\n\ndef libvlc_media_player_stop(p_mi):\n    \"\"\"Stop (no effect if there is no media)\n\n    :param p_mi: the Media Player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_stop\", None) or _Cfunction(\n        \"libvlc_media_player_stop\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_player_will_play(p_mi):\n    \"\"\"Is the player able to play\n\n    :param p_mi: the Media Player.\n\n    :return: boolean.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_player_will_play\", None) or _Cfunction(\n        \"libvlc_media_player_will_play\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_media_release(p_md):\n    \"\"\"Decrement the reference count of a media descriptor object. If the\n    reference count is 0, then :func:`libvlc_media_release` will release the\n    media descriptor object. It will send out an libvlc_MediaFreed event\n    to all listeners. If the media descriptor object has been released it\n    should not be used again.\n\n    :param p_md: the media descriptor.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_release\", None) or _Cfunction(\n        \"libvlc_media_release\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_retain(p_md):\n    \"\"\"Retain a reference to a media descriptor object (libvlc_media_t). Use\n    :func:`libvlc_media_release` to decrement the reference count of a\n    media descriptor object.\n\n    :param p_md: the media descriptor.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_retain\", None) or _Cfunction(\n        \"libvlc_media_retain\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_save_meta(p_md):\n    \"\"\"Save the meta previously set\n\n    :param p_md: the media desriptor.\n\n    :return: true if the write operation was successful.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_save_meta\", None) or _Cfunction(\n        \"libvlc_media_save_meta\", ((1,),), None, ctypes.c_int, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_set_meta(p_md, e_meta, psz_value):\n    \"\"\"Set the meta of the media (this function will not save the meta, call\n    :func:`libvlc_media_save_meta` in order to save the meta)\n\n    :param p_md: the media descriptor.\n    :param e_meta: the meta to write.\n    :param psz_value: the media's meta.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_set_meta\", None) or _Cfunction(\n        \"libvlc_media_set_meta\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Media,\n        Meta,\n        ctypes.c_char_p,\n    )\n    return f(p_md, e_meta, psz_value)\n\n\ndef libvlc_media_set_user_data(p_md, p_new_user_data):\n    \"\"\"Sets media descriptor's user_data. user_data is specialized data\n    accessed by the host application, VLC.framework uses it as a pointer to\n    an native object that references a :class:`Media` pointer\n\n    :param p_md: media descriptor object.\n    :param p_new_user_data: pointer to user data.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_set_user_data\", None) or _Cfunction(\n        \"libvlc_media_set_user_data\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Media,\n        ctypes.c_void_p,\n    )\n    return f(p_md, p_new_user_data)\n\n\ndef libvlc_media_slaves_add(p_md, i_type, i_priority, psz_uri):\n    \"\"\"Add a slave to the current media.\n\n    A slave is an external input source that may contains an additional subtitle\n    track (like a .srt) or an additional audio track (like a .ac3).\n\n    .. note:: This function must be called before the media is parsed (via\n        libvlc_media_parse_with_options) or before the media is played (via\n        libvlc_media_player_play)\n\n    :param p_md: media descriptor object.\n    :param i_type: subtitle or audio.\n    :param i_priority: from 0 (low priority) to 4 (high priority).\n    :param psz_uri: Uri of the slave (should contain a valid scheme).\n\n    :return: 0 on success, -1 on error.\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_slaves_add\", None) or _Cfunction(\n        \"libvlc_media_slaves_add\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Media,\n        MediaSlaveType,\n        ctypes.c_uint,\n        ctypes.c_char_p,\n    )\n    return f(p_md, i_type, i_priority, psz_uri)\n\n\ndef libvlc_media_slaves_clear(p_md):\n    \"\"\"Clear all slaves previously added by :func:`libvlc_media_slaves_add` or\n    internally.\n\n    :param p_md: media descriptor object.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_slaves_clear\", None) or _Cfunction(\n        \"libvlc_media_slaves_clear\", ((1,),), None, None, Media\n    )\n    return f(p_md)\n\n\ndef libvlc_media_slaves_get(p_md, ppp_slaves):\n    \"\"\"Get a media descriptor's slave list\n\n    The list will contain slaves parsed by VLC or previously added by\n    :func:`libvlc_media_slaves_add`. The typical use case of this function is to save\n    a list of slave in a database for a later use.\n\n    :func:`libvlc_media_slaves_add`\n\n    :param p_md: media descriptor object.\n    :param ppp_slaves: address to store an allocated array of slaves (must be.\n        freed with libvlc_media_slaves_release) [OUT].\n\n    :return: the number of slaves (zero on error).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_slaves_get\", None) or _Cfunction(\n        \"libvlc_media_slaves_get\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_uint,\n        Media,\n        ctypes.POINTER(ctypes.POINTER(MediaSlave)),\n    )\n    return f(p_md, ppp_slaves)\n\n\ndef libvlc_media_slaves_release(pp_slaves, i_count):\n    \"\"\"Release a media descriptor's slave list\n\n    :param pp_slaves: slave array to release.\n    :param i_count: number of elements in the array.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_slaves_release\", None) or _Cfunction(\n        \"libvlc_media_slaves_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(MediaSlave)),\n        ctypes.c_uint,\n    )\n    return f(pp_slaves, i_count)\n\n\ndef libvlc_media_subitems(p_md):\n    \"\"\"Get subitems of media descriptor object. This will increment\n    the reference count of supplied media descriptor object. Use\n    :func:`libvlc_media_list_release` to decrement the reference counting.\n\n    :param p_md: media descriptor object.\n\n    :return: list of media descriptor subitems or None.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_subitems\", None) or _Cfunction(\n        \"libvlc_media_subitems\",\n        ((1,),),\n        class_result(MediaList),\n        ctypes.c_void_p,\n        Media,\n    )\n    return f(p_md)\n\n\ndef libvlc_media_tracks_get(p_md, tracks):\n    \"\"\"Get media descriptor's elementary streams description\n\n    Note, you need to call :func:`libvlc_media_parse` or play the media at least once\n    before calling this function.\n    Not doing this will result in an empty array.\n\n    :param p_md: media descriptor object.\n    :param tracks: address to store an allocated array of Elementary Streams.\n        descriptions (must be freed with :func:`libvlc_media_tracks_release`.\n        by the caller) [OUT].\n\n    :return: the number of Elementary Streams (zero on error).\n    :version: LibVLC 2.1.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_tracks_get\", None) or _Cfunction(\n        \"libvlc_media_tracks_get\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_uint,\n        Media,\n        ctypes.POINTER(ctypes.POINTER(MediaTrack)),\n    )\n    return f(p_md, tracks)\n\n\ndef libvlc_media_tracks_release(p_tracks, i_count):\n    \"\"\"Release media descriptor's elementary streams description array\n\n    :param p_tracks: tracks info array to release.\n    :param i_count: number of elements in the array.\n\n    :version: LibVLC 2.1.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_media_tracks_release\", None) or _Cfunction(\n        \"libvlc_media_tracks_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(MediaTrack)),\n        ctypes.c_uint,\n    )\n    return f(p_tracks, i_count)\n\n\ndef libvlc_module_description_list_release(p_list):\n    \"\"\"Release a list of module descriptions.\n\n    :param p_list: the list to be released.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_module_description_list_release\", None) or _Cfunction(\n        \"libvlc_module_description_list_release\",\n        ((1,),),\n        None,\n        None,\n        ctypes.POINTER(ModuleDescription),\n    )\n    return f(p_list)\n\n\ndef libvlc_new(argc, argv):\n    \"\"\"Create and initialize a libvlc instance.\n    This functions accept a list of \"command line\" arguments similar to the\n    main(). These arguments affect the LibVLC instance default configuration.\n\n    .. note::\n        LibVLC may create threads. Therefore, any thread-unsafe process\n        initialization must be performed before calling :func:`libvlc_new`. In particular\n        and where applicable:\n\n            * setlocale() and textdomain(),\n            * setenv(), unsetenv() and putenv(),\n            * with the X11 display system, XInitThreads()\n                (see also libvlc_media_player_set_xwindow) and\n            * on Microsoft Windows, SetErrorMode().\n            * sigprocmask() shall never be invoked; pthread_sigmask() can be used.\n\n    On POSIX systems, the SIGCHLD signal **must not** be ignored, i.e. the\n    signal handler must set to SIG_DFL or a function pointer, not SIG_IGN.\n    Also while LibVLC is active, the wait() function shall not be called, and\n    any call to waitpid() shall use a strictly positive value for the first\n    parameter (i.e. the PID). Failure to follow those rules may lead to a\n    deadlock or a busy loop.\n    Also on POSIX systems, it is recommended that the SIGPIPE signal be blocked,\n    even if it is not, in principles, necessary, e.g.:\n\n    .. code-block:: objectivec++\n\n        sigset_t set;\n\n        signal(SIGCHLD, SIG_DFL);\n        sigemptyset(&set);\n        sigaddset(&set, SIGPIPE);\n        pthread_sigmask(SIG_BLOCK, &set, None);\n\n    On Microsoft Windows Vista/2008, the process error mode\n    SEM_FAILCRITICALERRORS flag **must** be set before using LibVLC.\n    On later versions, that is optional and unnecessary.\n    Also on Microsoft Windows (Vista and any later version), setting the default\n    DLL directories to SYSTEM32 exclusively is strongly recommended for\n    security reasons:\n\n    .. code-block:: objectivec++\n\n        SetErrorMode(SEM_FAILCRITICALERRORS);\n        SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32);\n\n    .. warning::\n        There is absolutely no warranty or promise of forward, backward and\n        cross-platform compatibility with regards to :func:`libvlc_new` arguments.\n        We recommend that you do not use them, other than when debugging.\n\n    :param argc: the number of arguments (should be 0).\n    :param argv: list of arguments (should be None).\n\n    :return: the libvlc instance or None in case of error.\n    :version:\n        Arguments are meant to be passed from the command line to LibVLC, just like.\n        VLC media player does. The list of valid arguments depends on the LibVLC.\n        version, the operating system and platform, and set of available LibVLC.\n        plugins. Invalid or unsupported arguments will cause the function to fail.\n        (i.e. return None). Also, some arguments may alter the behaviour or.\n        otherwise interfere with other LibVLC functions.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_new\", None) or _Cfunction(\n        \"libvlc_new\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(Instance),\n        ctypes.c_void_p,\n        ctypes.c_int,\n        ListPOINTER(ctypes.c_char_p),\n    )\n    return f(argc, argv)\n\n\ndef libvlc_playlist_play(p_instance, i_id, i_options, ppsz_options):\n    \"\"\"Start playing (if there is any item in the playlist).\n\n    Additionnal playlist item options can be specified for addition to the\n    item before it is played.\n\n    :param p_instance: the playlist instance.\n    :param i_id: the item to play. If this is a negative number, the next.\n        item will be selected. Otherwise, the item with the given ID will be.\n        played.\n    :param i_options: the number of options to add to the item.\n    :param ppsz_options: the options to add to the item.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_playlist_play\", None) or _Cfunction(\n        \"libvlc_playlist_play\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        ctypes.c_int,\n        ctypes.c_int,\n        ListPOINTER(ctypes.c_char_p),\n    )\n    return f(p_instance, i_id, i_options, ppsz_options)\n\n\ndef libvlc_printerr(fmt):\n    \"\"\"Sets the LibVLC error status and message for the current thread.\n    Any previous error is overridden.\n\n    :param fmt: the format string.\n    :param args: the arguments.\n\n    :return: a nul terminated string in any case.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_printerr\", None) or _Cfunction(\n        \"libvlc_printerr\", ((1,),), None, ctypes.c_char_p, ctypes.c_char_p\n    )\n    return f(fmt)\n\n\ndef libvlc_release(p_instance):\n    \"\"\"Decrement the reference count of a libvlc instance, and destroy it\n    if it reaches zero.\n\n    :param p_instance: the instance to destroy.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_release\", None) or _Cfunction(\n        \"libvlc_release\", ((1,),), None, None, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_renderer_discoverer_event_manager(p_rd):\n    \"\"\"Get the event manager of the renderer discoverer\n\n    The possible events to attach are libvlc_RendererDiscovererItemAdded\n    and libvlc_RendererDiscovererItemDeleted.\n\n    The :class:`Renderer` struct passed to event callbacks is owned by\n    VLC, users should take care of holding/releasing this struct for their\n    internal usage.\n\n    :class:`Event`.u.renderer_discoverer_item_added.item\n    :class:`Event`.u.renderer_discoverer_item_removed.item\n\n    :return: a valid event manager (can't fail).\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_event_manager\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        RendererDiscoverer,\n    )\n    return f(p_rd)\n\n\ndef libvlc_renderer_discoverer_list_get(p_inst, ppp_services):\n    \"\"\"Get media discoverer services\n\n    libvlc_renderer_list_release\n\n    :param p_inst: libvlc instance.\n    :param ppp_services: address to store an allocated array of renderer.\n        discoverer services (must be freed with libvlc_renderer_list_release by.\n        the caller) [OUT].\n\n    :return: the number of media discoverer services (0 on error).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_list_get\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_list_get\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_size_t,\n        Instance,\n        ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(RdDescription))),\n    )\n    return f(p_inst, ppp_services)\n\n\ndef libvlc_renderer_discoverer_list_release(pp_services, i_count):\n    \"\"\"Release an array of media discoverer services\n\n    :func:`libvlc_renderer_discoverer_list_get`\n\n    :param pp_services: array to release.\n    :param i_count: number of elements in the array.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_list_release\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_list_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(RdDescription)),\n        ctypes.c_size_t,\n    )\n    return f(pp_services, i_count)\n\n\ndef libvlc_renderer_discoverer_new(p_inst, psz_name):\n    \"\"\"Create a renderer discoverer object by name\n\n    After this object is created, you should attach to events in order to be\n    notified of the discoverer events.\n\n    You need to call :func:`libvlc_renderer_discoverer_start` in order to start the\n    discovery.\n\n    :func:`libvlc_renderer_discoverer_event_manager`\n    :func:`libvlc_renderer_discoverer_start`\n\n    :param p_inst: libvlc instance.\n    :param psz_name: service name; use :func:`libvlc_renderer_discoverer_list_get` to.\n        get a list of the discoverer names available in this libVLC instance.\n\n    :return: media discover object or None in case of error.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_new\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_new\",\n        (\n            (1,),\n            (1,),\n        ),\n        class_result(RendererDiscoverer),\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_inst, psz_name)\n\n\ndef libvlc_renderer_discoverer_release(p_rd):\n    \"\"\"Release a renderer discoverer object\n\n    :param p_rd: renderer discoverer object.\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_release\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_release\", ((1,),), None, None, RendererDiscoverer\n    )\n    return f(p_rd)\n\n\ndef libvlc_renderer_discoverer_start(p_rd):\n    \"\"\"Start renderer discovery\n\n    To stop it, call :func:`libvlc_renderer_discoverer_stop` or\n    :func:`libvlc_renderer_discoverer_release` directly.\n\n    :func:`libvlc_renderer_discoverer_stop`\n\n    :param p_rd: renderer discoverer object.\n\n    :return: -1 in case of error, 0 otherwise.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_start\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_start\",\n        ((1,),),\n        None,\n        ctypes.c_int,\n        RendererDiscoverer,\n    )\n    return f(p_rd)\n\n\ndef libvlc_renderer_discoverer_stop(p_rd):\n    \"\"\"Stop renderer discovery.\n\n    :func:`libvlc_renderer_discoverer_start`\n\n    :param p_rd: renderer discoverer object.\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_discoverer_stop\", None) or _Cfunction(\n        \"libvlc_renderer_discoverer_stop\", ((1,),), None, None, RendererDiscoverer\n    )\n    return f(p_rd)\n\n\ndef libvlc_renderer_item_flags(p_item):\n    \"\"\"Get the flags of a renderer item\n\n    LIBVLC_RENDERER_CAN_AUDIO\n    LIBVLC_RENDERER_CAN_VIDEO\n\n    :return: bitwise flag: capabilities of the renderer, see.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_flags\", None) or _Cfunction(\n        \"libvlc_renderer_item_flags\", ((1,),), None, ctypes.c_int, Renderer\n    )\n    return f(p_item)\n\n\ndef libvlc_renderer_item_hold(p_item):\n    \"\"\"Hold a renderer item, i.e. creates a new reference\n\n    This functions need to called from the libvlc_RendererDiscovererItemAdded\n    callback if the libvlc user wants to use this item after. (for display or\n    for passing it to the mediaplayer for example).\n\n    :return: the current item.\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_hold\", None) or _Cfunction(\n        \"libvlc_renderer_item_hold\",\n        ((1,),),\n        class_result(Renderer),\n        ctypes.c_void_p,\n        Renderer,\n    )\n    return f(p_item)\n\n\ndef libvlc_renderer_item_icon_uri(p_item):\n    \"\"\"Get the icon uri of a renderer item\n\n    :return: the uri of the item's icon (can be None, must *not* be freed).\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_icon_uri\", None) or _Cfunction(\n        \"libvlc_renderer_item_icon_uri\", ((1,),), None, ctypes.c_char_p, Renderer\n    )\n    return f(p_item)\n\n\ndef libvlc_renderer_item_name(p_item):\n    \"\"\"Get the human readable name of a renderer item\n\n    :return: the name of the item (can't be None, must *not* be freed).\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_name\", None) or _Cfunction(\n        \"libvlc_renderer_item_name\", ((1,),), None, ctypes.c_char_p, Renderer\n    )\n    return f(p_item)\n\n\ndef libvlc_renderer_item_release(p_item):\n    \"\"\"Releases a renderer item, i.e. decrements its reference counter\n\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_release\", None) or _Cfunction(\n        \"libvlc_renderer_item_release\", ((1,),), None, None, Renderer\n    )\n    return f(p_item)\n\n\ndef libvlc_renderer_item_type(p_item):\n    \"\"\"Get the type (not translated) of a renderer item. For now, the type can only\n    be \"chromecast\" (\"upnp\", \"airplay\" may come later).\n\n    :return: the type of the item (can't be None, must *not* be freed).\n    :version: LibVLC 3.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_renderer_item_type\", None) or _Cfunction(\n        \"libvlc_renderer_item_type\", ((1,),), None, ctypes.c_char_p, Renderer\n    )\n    return f(p_item)\n\n\ndef libvlc_retain(p_instance):\n    \"\"\"Increments the reference count of a libvlc instance.\n    The initial reference count is 1 after :func:`libvlc_new` returns.\n\n    :param p_instance: the instance to reference.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_retain\", None) or _Cfunction(\n        \"libvlc_retain\", ((1,),), None, None, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_set_app_id(p_instance, id, version, icon):\n    \"\"\"Sets some meta-information about the application.\n    See also :func:`libvlc_set_user_agent`.\n\n    :param p_instance: LibVLC instance.\n    :param id: Java-style application identifier, e.g. \"com.acme.foobar\".\n    :param version: application version numbers, e.g. \"1.2.3\".\n    :param icon: application icon name, e.g. \"foobar\".\n\n    :version: LibVLC 2.1.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_set_app_id\", None) or _Cfunction(\n        \"libvlc_set_app_id\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, id, version, icon)\n\n\nLibvlcSetExitHandlerCb = ctypes.CFUNCTYPE(None, ctypes.c_void_p)\n\n\ndef libvlc_set_exit_handler(p_instance, cb, opaque):\n    \"\"\"Registers a callback for the LibVLC exit event. This is mostly useful if\n    the VLC playlist and/or at least one interface are started with\n    :func:`libvlc_playlist_play` or :func:`libvlc_add_intf` respectively.\n    Typically, this function will wake up your application main loop (from\n    another thread).\n\n    .. note:: This function should be called before the playlist or interface are\n        started. Otherwise, there is a small race condition: the exit event could\n        be raised before the handler is registered.\n\n    .. warning:: This function and :func:`libvlc_wait` cannot be used at the same time.\n\n    :param p_instance: LibVLC instance.\n    :param cb: callback to invoke when LibVLC wants to exit,\n        or None to disable the exit handler (as by default).\n    :param opaque: data pointer for the callback.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_set_exit_handler\", None) or _Cfunction(\n        \"libvlc_set_exit_handler\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        LibvlcSetExitHandlerCb,\n        ctypes.c_void_p,\n    )\n    return f(p_instance, cb, opaque)\n\n\ndef libvlc_set_fullscreen(p_mi, b_fullscreen):\n    \"\"\"Enable or disable fullscreen.\n\n    .. warning:: With most window managers, only a top-level windows can be in\n        full-screen mode. Hence, this function will not operate properly if\n        :func:`libvlc_media_player_set_xwindow` was used to embed the video in a\n        non-top-level window. In that case, the embedding window must be reparented\n        to the root window **before** fullscreen mode is enabled. You will want\n        to reparent it back to its normal parent when disabling fullscreen.\n\n    :param p_mi: the media player.\n    :param b_fullscreen: boolean for fullscreen status.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_set_fullscreen\", None) or _Cfunction(\n        \"libvlc_set_fullscreen\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, b_fullscreen)\n\n\ndef libvlc_set_log_verbosity(p_instance, level):\n    \"\"\"This function does nothing.\n    It is only provided for backward compatibility.\n\n    :param p_instance: ignored.\n    :param level: ignored.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_set_log_verbosity\", None) or _Cfunction(\n        \"libvlc_set_log_verbosity\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        ctypes.c_uint,\n    )\n    return f(p_instance, level)\n\n\ndef libvlc_set_user_agent(p_instance, name, http):\n    \"\"\"Sets the application *name*. LibVLC passes this as the user agent string\n    when a protocol requires it.\n\n    :param p_instance: LibVLC instance.\n    :param name: human-readable application name, e.g. \"FooBar player 1.2.3\".\n    :param http: HTTP User Agent, e.g. \"FooBar/1.2.3 Python/2.6.0\".\n\n    :version: LibVLC 1.1.1 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_set_user_agent\", None) or _Cfunction(\n        \"libvlc_set_user_agent\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, name, http)\n\n\ndef libvlc_title_descriptions_release(p_titles, i_count):\n    \"\"\"Release a title description\n\n    :param p_titles: title description array to release.\n    :param i_count: number of title descriptions to release.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_title_descriptions_release\", None) or _Cfunction(\n        \"libvlc_title_descriptions_release\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        ctypes.POINTER(ctypes.POINTER(TitleDescription)),\n        ctypes.c_uint,\n    )\n    return f(p_titles, i_count)\n\n\ndef libvlc_toggle_fullscreen(p_mi):\n    \"\"\"Toggle fullscreen status on non-embedded video outputs.\n\n    .. warning:: The same limitations applies to this function\n        as to :func:`libvlc_set_fullscreen`.\n\n    :param p_mi: the media player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_toggle_fullscreen\", None) or _Cfunction(\n        \"libvlc_toggle_fullscreen\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_toggle_teletext(p_mi):\n    \"\"\"Toggle teletext transparent status on video output.\n\n    .. warning:: **Deprecated!** use :func:`libvlc_video_set_teletext` instead.\n\n    :param p_mi: the media player.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_toggle_teletext\", None) or _Cfunction(\n        \"libvlc_toggle_teletext\", ((1,),), None, None, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_track_description_list_release(p_track_description):\n    \"\"\"Release (free) :class:`TrackDescription`\n\n    :param p_track_description: the structure to release.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_track_description_list_release\", None) or _Cfunction(\n        \"libvlc_track_description_list_release\",\n        ((1,),),\n        None,\n        None,\n        ctypes.POINTER(TrackDescription),\n    )\n    return f(p_track_description)\n\n\ndef libvlc_track_description_release(p_track_description):\n    \"\"\".. warning:: **Deprecated!** Use :func:`libvlc_track_description_list_release` instead.\"\"\"\n    f = _Cfunctions.get(\"libvlc_track_description_release\", None) or _Cfunction(\n        \"libvlc_track_description_release\",\n        ((1,),),\n        None,\n        None,\n        ctypes.POINTER(TrackDescription),\n    )\n    return f(p_track_description)\n\n\ndef libvlc_video_filter_list_get(p_instance):\n    \"\"\"Returns a list of video filters that are available.\n\n    :class:`ModuleDescription`\n    :func:`libvlc_module_description_list_release`.\n\n    :param p_instance: libvlc instance.\n\n    :return: a list of module descriptions. It should be freed with :func:`libvlc_module_description_list_release`.\n        In case of an error, None is returned.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_filter_list_get\", None) or _Cfunction(\n        \"libvlc_video_filter_list_get\",\n        ((1,),),\n        None,\n        ctypes.POINTER(ModuleDescription),\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_video_get_adjust_float(p_mi, option):\n    \"\"\"Get float adjust *option*.\n\n    :param p_mi: libvlc media player instance.\n    :param option: adjust option to get, values of :class:`VideoAdjustOption`.\n\n    :version: LibVLC 1.1.1 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_adjust_float\", None) or _Cfunction(\n        \"libvlc_video_get_adjust_float\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_float,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, option)\n\n\ndef libvlc_video_get_adjust_int(p_mi, option):\n    \"\"\"Get integer adjust *option*.\n\n    :param p_mi: libvlc media player instance.\n    :param option: adjust option to get, values of :class:`VideoAdjustOption`.\n\n    :version: LibVLC 1.1.1 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_adjust_int\", None) or _Cfunction(\n        \"libvlc_video_get_adjust_int\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, option)\n\n\ndef libvlc_video_get_aspect_ratio(p_mi):\n    \"\"\"Get current video aspect ratio.\n\n    :param p_mi: the media player.\n\n    :return: the video aspect ratio or None if unspecified.\n        (the result must be released with free() or libvlc_free).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_aspect_ratio\", None) or _Cfunction(\n        \"libvlc_video_get_aspect_ratio\",\n        ((1,),),\n        string_result,\n        ctypes.c_void_p,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_chapter_description(p_mi, i_title):\n    \"\"\"Get the description of available chapters for specific title.\n\n    :param p_mi: the media player.\n    :param i_title: selected title.\n\n    :return: list containing description of available chapter for title *i_title*.\n        It must be freed with :func:`libvlc_track_description_list_release`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_chapter_description\", None) or _Cfunction(\n        \"libvlc_video_get_chapter_description\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.POINTER(TrackDescription),\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_title)\n\n\ndef libvlc_video_get_crop_geometry(p_mi):\n    \"\"\"Get current crop filter geometry.\n\n    :param p_mi: the media player.\n\n    :return: the crop filter geometry or None if unset.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_crop_geometry\", None) or _Cfunction(\n        \"libvlc_video_get_crop_geometry\",\n        ((1,),),\n        string_result,\n        ctypes.c_void_p,\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_cursor(p_mi, num):\n    \"\"\"Get the mouse pointer coordinates over a video.\n    Coordinates are expressed in terms of the decoded video resolution,\n    **not** in terms of pixels on the screen/viewport (to get the latter,\n    you can query your windowing system directly).\n\n    Either of the coordinates may be negative or larger than the corresponding\n    dimension of the video, if the cursor is outside the rendering area.\n\n    .. warning:: The coordinates may be out-of-date if the pointer is not located\n        on the video rendering area. LibVLC does not track the pointer if it is\n        outside of the video widget.\n\n    .. note:: LibVLC does not support multiple pointers (it does of course support\n        multiple input devices sharing the same pointer) at the moment.\n\n    :param p_mi: media player.\n    :param num: number of the video (starting from, and most commonly 0).\n    :param px: abscissa [OUT].\n    :param py: ordinate [OUT].\n\n    :return: 0 on success, -1 if the specified video does not exist.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_cursor\", None) or _Cfunction(\n        \"libvlc_video_get_cursor\",\n        (\n            (1,),\n            (1,),\n            (2,),\n            (2,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.POINTER(ctypes.c_int),\n        ctypes.POINTER(ctypes.c_int),\n    )\n    return f(p_mi, num)\n\n\ndef libvlc_video_get_height(p_mi):\n    \"\"\"Get current video height.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_video_get_size` instead.\n\n    :param p_mi: the media player.\n\n    :return: the video pixel height or 0 if not applicable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_height\", None) or _Cfunction(\n        \"libvlc_video_get_height\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_logo_int(p_mi, option):\n    \"\"\"Get integer logo *option*.\n\n    :param p_mi: libvlc media player instance.\n    :param option: logo option to get, values of :class:`VideoLogoOption`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_logo_int\", None) or _Cfunction(\n        \"libvlc_video_get_logo_int\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, option)\n\n\ndef libvlc_video_get_marquee_int(p_mi, option):\n    \"\"\"Get an integer marquee *option* value\n\n    :param p_mi: libvlc media player.\n    :param option: marq option to get libvlc_video_marquee_int_option_t.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_marquee_int\", None) or _Cfunction(\n        \"libvlc_video_get_marquee_int\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, option)\n\n\ndef libvlc_video_get_marquee_string(p_mi, option):\n    \"\"\"Get a string marquee *option* value\n\n    :param p_mi: libvlc media player.\n    :param option: marq option to get libvlc_video_marquee_string_option_t.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_marquee_string\", None) or _Cfunction(\n        \"libvlc_video_get_marquee_string\",\n        (\n            (1,),\n            (1,),\n        ),\n        string_result,\n        ctypes.c_void_p,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, option)\n\n\ndef libvlc_video_get_scale(p_mi):\n    \"\"\"Get the current video scaling factor.\n    See also :func:`libvlc_video_set_scale`.\n\n    :param p_mi: the media player.\n\n    :return: the currently configured zoom factor, or 0. if the video is set.\n        to fit to the output window/drawable automatically.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_scale\", None) or _Cfunction(\n        \"libvlc_video_get_scale\", ((1,),), None, ctypes.c_float, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_size(p_mi, num):\n    \"\"\"Get the pixel dimensions of a video.\n\n    :param p_mi: media player.\n    :param num: number of the video (starting from, and most commonly 0).\n    :param px: pixel width [OUT].\n    :param py: pixel height [OUT].\n\n    :return: 0 on success, -1 if the specified video does not exist.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_size\", None) or _Cfunction(\n        \"libvlc_video_get_size\",\n        (\n            (1,),\n            (1,),\n            (2,),\n            (2,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.POINTER(ctypes.c_uint),\n        ctypes.POINTER(ctypes.c_uint),\n    )\n    return f(p_mi, num)\n\n\ndef libvlc_video_get_spu(p_mi):\n    \"\"\"Get current video subtitle.\n\n    :param p_mi: the media player.\n\n    :return: the video subtitle selected, or -1 if none.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_spu\", None) or _Cfunction(\n        \"libvlc_video_get_spu\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_spu_count(p_mi):\n    \"\"\"Get the number of available video subtitles.\n\n    :param p_mi: the media player.\n\n    :return: the number of available video subtitles.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_spu_count\", None) or _Cfunction(\n        \"libvlc_video_get_spu_count\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_spu_delay(p_mi):\n    \"\"\"Get the current subtitle delay. Positive values means subtitles are being\n    displayed later, negative values earlier.\n\n    :param p_mi: media player.\n\n    :return: time (in microseconds) the display of subtitles is being delayed.\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_spu_delay\", None) or _Cfunction(\n        \"libvlc_video_get_spu_delay\", ((1,),), None, ctypes.c_int64, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_spu_description(p_mi):\n    \"\"\"Get the description of available video subtitles.\n\n    :param p_mi: the media player.\n\n    :return: list containing description of available video subtitles.\n        It must be freed with :func:`libvlc_track_description_list_release`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_spu_description\", None) or _Cfunction(\n        \"libvlc_video_get_spu_description\",\n        ((1,),),\n        None,\n        ctypes.POINTER(TrackDescription),\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_teletext(p_mi):\n    \"\"\"Get current teletext page requested or 0 if it's disabled.\n\n    Teletext is disabled by default, call :func:`libvlc_video_set_teletext` to enable\n    it.\n\n    :param p_mi: the media player.\n\n    :return: the current teletext page requested.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_teletext\", None) or _Cfunction(\n        \"libvlc_video_get_teletext\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_title_description(p_mi):\n    \"\"\"Get the description of available titles.\n\n    :param p_mi: the media player.\n\n    :return: list containing description of available titles.\n        It must be freed with :func:`libvlc_track_description_list_release`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_title_description\", None) or _Cfunction(\n        \"libvlc_video_get_title_description\",\n        ((1,),),\n        None,\n        ctypes.POINTER(TrackDescription),\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_track(p_mi):\n    \"\"\"Get current video track.\n\n    :param p_mi: media player.\n\n    :return: the video track ID (int) or -1 if no active input.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_track\", None) or _Cfunction(\n        \"libvlc_video_get_track\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_track_count(p_mi):\n    \"\"\"Get number of available video tracks.\n\n    :param p_mi: media player.\n\n    :return: the number of available video tracks (int).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_track_count\", None) or _Cfunction(\n        \"libvlc_video_get_track_count\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_track_description(p_mi):\n    \"\"\"Get the description of available video tracks.\n\n    :param p_mi: media player.\n\n    :return: list with description of available video tracks, or None on error.\n        It must be freed with :func:`libvlc_track_description_list_release`.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_track_description\", None) or _Cfunction(\n        \"libvlc_video_get_track_description\",\n        ((1,),),\n        None,\n        ctypes.POINTER(TrackDescription),\n        MediaPlayer,\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_get_width(p_mi):\n    \"\"\"Get current video width.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_video_get_size` instead.\n\n    :param p_mi: the media player.\n\n    :return: the video pixel width or 0 if not applicable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_get_width\", None) or _Cfunction(\n        \"libvlc_video_get_width\", ((1,),), None, ctypes.c_int, MediaPlayer\n    )\n    return f(p_mi)\n\n\ndef libvlc_video_new_viewpoint():\n    \"\"\"Create a video viewpoint structure.\n\n    :return: video viewpoint or None.\n        (the result must be released with free() or libvlc_free).\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_new_viewpoint\", None) or _Cfunction(\n        \"libvlc_video_new_viewpoint\", (), None, ctypes.POINTER(VideoViewpoint)\n    )\n    return f()\n\n\ndef libvlc_video_set_adjust_float(p_mi, option, value):\n    \"\"\"Set adjust *option* as float. Options that take a different type value\n    are ignored.\n\n    :param p_mi: libvlc media player instance.\n    :param option: adust option to set, values of :class:`VideoAdjustOption`.\n    :param value: adjust option value.\n\n    :version: LibVLC 1.1.1 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_adjust_float\", None) or _Cfunction(\n        \"libvlc_video_set_adjust_float\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_float,\n    )\n    return f(p_mi, option, value)\n\n\ndef libvlc_video_set_adjust_int(p_mi, option, value):\n    \"\"\"Set adjust *option* as integer. Options that take a different type value\n    are ignored.\n    Passing libvlc_adjust_enable as *option* *value* has the side effect of\n    starting (arg !0) or stopping (arg 0) the adjust filter.\n\n    :param p_mi: libvlc media player instance.\n    :param option: adust option to set, values of :class:`VideoAdjustOption`.\n    :param value: adjust option value.\n\n    :version: LibVLC 1.1.1 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_adjust_int\", None) or _Cfunction(\n        \"libvlc_video_set_adjust_int\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_int,\n    )\n    return f(p_mi, option, value)\n\n\ndef libvlc_video_set_aspect_ratio(p_mi, psz_aspect):\n    \"\"\"Set new video aspect ratio.\n\n\n    .. note:: Invalid aspect ratios are ignored.\n\n    :param p_mi: the media player.\n    :param psz_aspect: new video aspect-ratio or None to reset to default.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_aspect_ratio\", None) or _Cfunction(\n        \"libvlc_video_set_aspect_ratio\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, psz_aspect)\n\n\ndef libvlc_video_set_callbacks(mp, lock, unlock, display, opaque):\n    \"\"\"Set callbacks and private data to render decoded video to a custom area\n    in memory.\n    Use :func:`libvlc_video_set_format` or :func:`libvlc_video_set_format_callbacks`\n    to configure the decoded format.\n\n    .. warning:: Rendering video into custom memory buffers is considerably less\n        efficient than rendering in a custom window as normal.\n\n    For optimal perfomances, VLC media player renders into a custom window, and\n    does not use this function and associated callbacks. It is **highly\n    recommended** that other LibVLC-based application do likewise.\n    To embed video in a window, use libvlc_media_player_set_xid or equivalent\n    depending on the operating system.\n\n    If window embedding does not fit the application use case, then a custom\n    LibVLC video output *display* plugin is required to maintain optimal video\n    rendering performances.\n\n    The following limitations affect performance:\n\n    * Hardware video decoding acceleration will either be disabled completely,\n        or require (relatively slow) copy from video/DSP memory to main memory.\n    * Sub-pictures (subtitles, on-screen *display*, etc.) must be blent into the\n        main picture by the CPU instead of the GPU.\n    * Depending on the video format, pixel format conversion, picture scaling,\n        cropping and/or picture re-orientation, must be performed by the CPU\n        instead of the GPU.\n    * Memory copying is required between LibVLC reference picture buffers and\n        application buffers (between *lock* and *unlock* callbacks).\n\n    :param mp: the media player.\n    :param lock: callback to lock video memory (must not be None).\n    :param unlock: callback to unlock video memory (or None if not needed).\n    :param display: callback to display video (or None if not needed).\n    :param opaque: private pointer for the three callbacks (as first parameter).\n\n    :version: LibVLC 1.1.1 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_callbacks\", None) or _Cfunction(\n        \"libvlc_video_set_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        VideoLockCb,\n        VideoUnlockCb,\n        VideoDisplayCb,\n        ctypes.c_void_p,\n    )\n    return f(mp, lock, unlock, display, opaque)\n\n\ndef libvlc_video_set_crop_geometry(p_mi, psz_geometry):\n    \"\"\"Set new crop filter geometry.\n\n    :param p_mi: the media player.\n    :param psz_geometry: new crop filter geometry (None to unset).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_crop_geometry\", None) or _Cfunction(\n        \"libvlc_video_set_crop_geometry\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, psz_geometry)\n\n\ndef libvlc_video_set_deinterlace(p_mi, psz_mode):\n    \"\"\"Enable or disable deinterlace filter\n\n    :param p_mi: libvlc media player.\n    :param psz_mode: type of deinterlace filter, None to disable.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_deinterlace\", None) or _Cfunction(\n        \"libvlc_video_set_deinterlace\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, psz_mode)\n\n\ndef libvlc_video_set_format(mp, chroma, width, height, pitch):\n    \"\"\"Set decoded video *chroma* and dimensions.\n    This only works in combination with :func:`libvlc_video_set_callbacks`,\n    and is mutually exclusive with :func:`libvlc_video_set_format_callbacks`.\n\n    :param mp: the media player.\n    :param chroma: a four-characters string identifying the chroma.\n        (e.g. \"RV32\" or \"YUYV\").\n    :param width: pixel width.\n    :param height: pixel height.\n    :param pitch: line pitch (in bytes).\n\n    :version: LibVLC 1.1.1 or later.\n    :bug: All pixel planes are expected to have the same *pitch*.\n        To use the YCbCr color space with chrominance subsampling,\n        consider using :func:`libvlc_video_set_format_callbacks` instead.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_format\", None) or _Cfunction(\n        \"libvlc_video_set_format\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_char_p,\n        ctypes.c_uint,\n        ctypes.c_uint,\n        ctypes.c_uint,\n    )\n    return f(mp, chroma, width, height, pitch)\n\n\ndef libvlc_video_set_format_callbacks(mp, setup, cleanup):\n    \"\"\"Set decoded video chroma and dimensions. This only works in combination with\n    :func:`libvlc_video_set_callbacks`.\n\n    :param mp: the media player.\n    :param setup: callback to select the video format (cannot be None).\n    :param cleanup: callback to release any allocated resources (or None).\n\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_format_callbacks\", None) or _Cfunction(\n        \"libvlc_video_set_format_callbacks\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        VideoFormatCb,\n        VideoCleanupCb,\n    )\n    return f(mp, setup, cleanup)\n\n\ndef libvlc_video_set_key_input(p_mi, on):\n    \"\"\"Enable or disable key press events handling, according to the LibVLC hotkeys\n    configuration. By default and for historical reasons, keyboard events are\n    handled by the LibVLC video widget.\n\n    .. note:: On X11, there can be only one subscriber for key press and mouse\n        click events per window. If your application has subscribed to those events\n        for the X window ID of the video widget, then LibVLC will not be able to\n        handle key presses and mouse clicks in any case.\n\n    .. warning:: This function is only implemented for X11 and Win32 at the moment.\n\n    :param p_mi: the media player.\n    :param on: true to handle key press events, false to ignore them.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_key_input\", None) or _Cfunction(\n        \"libvlc_video_set_key_input\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, on)\n\n\ndef libvlc_video_set_logo_int(p_mi, option, value):\n    \"\"\"Set logo *option* as integer. Options that take a different type value\n    are ignored.\n    Passing libvlc_logo_enable as *option* *value* has the side effect of\n    starting (arg !0) or stopping (arg 0) the logo filter.\n\n    :param p_mi: libvlc media player instance.\n    :param option: logo option to set, values of :class:`VideoLogoOption`.\n    :param value: logo option value.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_logo_int\", None) or _Cfunction(\n        \"libvlc_video_set_logo_int\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_int,\n    )\n    return f(p_mi, option, value)\n\n\ndef libvlc_video_set_logo_string(p_mi, option, psz_value):\n    \"\"\"Set logo *option* as string. Options that take a different type value\n    are ignored.\n\n    :param p_mi: libvlc media player instance.\n    :param option: logo option to set, values of :class:`VideoLogoOption`.\n    :param psz_value: logo option value.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_logo_string\", None) or _Cfunction(\n        \"libvlc_video_set_logo_string\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, option, psz_value)\n\n\ndef libvlc_video_set_marquee_int(p_mi, option, i_val):\n    \"\"\"Enable, disable or set an integer marquee option\n\n    Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)\n    or disabling (arg 0) the marq filter.\n\n    :param p_mi: libvlc media player.\n    :param option: marq option to set libvlc_video_marquee_int_option_t.\n    :param i_val: marq option value.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_marquee_int\", None) or _Cfunction(\n        \"libvlc_video_set_marquee_int\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_int,\n    )\n    return f(p_mi, option, i_val)\n\n\ndef libvlc_video_set_marquee_string(p_mi, option, psz_text):\n    \"\"\"Set a marquee string option\n\n    :param p_mi: libvlc media player.\n    :param option: marq option to set libvlc_video_marquee_string_option_t.\n    :param psz_text: marq option value.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_marquee_string\", None) or _Cfunction(\n        \"libvlc_video_set_marquee_string\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, option, psz_text)\n\n\ndef libvlc_video_set_mouse_input(p_mi, on):\n    \"\"\"Enable or disable mouse click events handling. By default, those events are\n    handled. This is needed for DVD menus to work, as well as a few video\n    filters such as \"puzzle\".\n\n    :func:`libvlc_video_set_key_input`.\n\n    .. warning:: This function is only implemented for X11 and Win32 at the moment.\n\n    :param p_mi: the media player.\n    :param on: true to handle mouse click events, false to ignore them.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_mouse_input\", None) or _Cfunction(\n        \"libvlc_video_set_mouse_input\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_uint,\n    )\n    return f(p_mi, on)\n\n\ndef libvlc_video_set_scale(p_mi, f_factor):\n    \"\"\"Set the video scaling factor. That is the ratio of the number of pixels on\n    screen to the number of pixels in the original decoded video in each\n    dimension. Zero is a special value; it will adjust the video to the output\n    window/drawable (in windowed mode) or the entire screen.\n\n    Note that not all video outputs support scaling.\n\n    :param p_mi: the media player.\n    :param f_factor: the scaling factor, or zero.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_scale\", None) or _Cfunction(\n        \"libvlc_video_set_scale\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_float,\n    )\n    return f(p_mi, f_factor)\n\n\ndef libvlc_video_set_spu(p_mi, i_spu):\n    \"\"\"Set new video subtitle.\n\n    :param p_mi: the media player.\n    :param i_spu: video subtitle track to select (i_id from track description).\n\n    :return: 0 on success, -1 if out of range.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_spu\", None) or _Cfunction(\n        \"libvlc_video_set_spu\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_spu)\n\n\ndef libvlc_video_set_spu_delay(p_mi, i_delay):\n    \"\"\"Set the subtitle delay. This affects the timing of when the subtitle will\n    be displayed. Positive values result in subtitles being displayed later,\n    while negative values will result in subtitles being displayed earlier.\n\n    The subtitle delay will be reset to zero each time the media changes.\n\n    :param p_mi: media player.\n    :param i_delay: time (in microseconds) the display of subtitles should be delayed.\n\n    :return: 0 on success, -1 on error.\n    :version: LibVLC 2.0.0 or later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_spu_delay\", None) or _Cfunction(\n        \"libvlc_video_set_spu_delay\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int64,\n    )\n    return f(p_mi, i_delay)\n\n\ndef libvlc_video_set_subtitle_file(p_mi, psz_subtitle):\n    \"\"\"Set new video subtitle file.\n\n    .. warning:: **Deprecated!** Use :func:`libvlc_media_player_add_slave` instead.\n\n    :param p_mi: the media player.\n    :param psz_subtitle: new video subtitle file.\n\n    :return: the success status (boolean).\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_subtitle_file\", None) or _Cfunction(\n        \"libvlc_video_set_subtitle_file\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_char_p,\n    )\n    return f(p_mi, psz_subtitle)\n\n\ndef libvlc_video_set_teletext(p_mi, i_page):\n    \"\"\"Set new teletext page to retrieve.\n\n    This function can also be used to send a teletext key.\n\n    :param p_mi: the media player.\n    :param i_page: teletex page number requested. This value can be 0 to disable.\n        teletext, a number in the range ]0;1000[ to show the requested page, or a.\n        :class:`TeletextKey`. 100 is the default teletext page.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_teletext\", None) or _Cfunction(\n        \"libvlc_video_set_teletext\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        None,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_page)\n\n\ndef libvlc_video_set_track(p_mi, i_track):\n    \"\"\"Set video track.\n\n    :param p_mi: media player.\n    :param i_track: the track ID (i_id field from track description).\n\n    :return: 0 on success, -1 if out of range.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_set_track\", None) or _Cfunction(\n        \"libvlc_video_set_track\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_int,\n    )\n    return f(p_mi, i_track)\n\n\ndef libvlc_video_take_snapshot(p_mi, num, psz_filepath, i_width, i_height):\n    \"\"\"Take a snapshot of the current video window.\n\n    If *i_width* AND *i_height* is 0, original size is used.\n    If *i_width* XOR *i_height* is 0, original aspect-ratio is preserved.\n\n    :param p_mi: media player instance.\n    :param num: number of video output (typically 0 for the first/only one).\n    :param psz_filepath: the path of a file or a folder to save the screenshot into.\n    :param i_width: the snapshot's width.\n    :param i_height: the snapshot's height.\n\n    :return: 0 on success, -1 if the video was not found.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_take_snapshot\", None) or _Cfunction(\n        \"libvlc_video_take_snapshot\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.c_uint,\n        ctypes.c_char_p,\n        ctypes.c_uint,\n        ctypes.c_uint,\n    )\n    return f(p_mi, num, psz_filepath, i_width, i_height)\n\n\ndef libvlc_video_update_viewpoint(p_mi, p_viewpoint, b_absolute):\n    \"\"\"Update the video viewpoint information.\n\n    .. note:: It is safe to call this function before the media player is started.\n\n    .. note:: the values are set asynchronously, it will be used by the next frame displayed.\n\n    :param p_mi: the media player.\n    :param p_viewpoint: video viewpoint allocated via :func:`libvlc_video_new_viewpoint`.\n    :param b_absolute: if true replace the old viewpoint with the new one. If.\n        false, increase/decrease it.\n\n    :return: -1 in case of error, 0 otherwise.\n\n    :version: LibVLC 3.0.0 and later.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_video_update_viewpoint\", None) or _Cfunction(\n        \"libvlc_video_update_viewpoint\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        MediaPlayer,\n        ctypes.POINTER(VideoViewpoint),\n        ctypes.c_bool,\n    )\n    return f(p_mi, p_viewpoint, b_absolute)\n\n\ndef libvlc_vlm_add_broadcast(\n    p_instance,\n    psz_name,\n    psz_input,\n    psz_output,\n    i_options,\n    ppsz_options,\n    b_enabled,\n    b_loop,\n):\n    \"\"\"Add a broadcast, with one input.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the new broadcast.\n    :param psz_input: the input MRL.\n    :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n    :param i_options: number of additional options.\n    :param ppsz_options: additional options.\n    :param b_enabled: boolean for enabling the new broadcast.\n    :param b_loop: Should this broadcast be played in loop ?\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_add_broadcast\", None) or _Cfunction(\n        \"libvlc_vlm_add_broadcast\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_int,\n        ListPOINTER(ctypes.c_char_p),\n        ctypes.c_int,\n        ctypes.c_int,\n    )\n    return f(\n        p_instance,\n        psz_name,\n        psz_input,\n        psz_output,\n        i_options,\n        ppsz_options,\n        b_enabled,\n        b_loop,\n    )\n\n\ndef libvlc_vlm_add_input(p_instance, psz_name, psz_input):\n    \"\"\"Add a media's input MRL. This will add the specified one.\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param psz_input: the input MRL.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_add_input\", None) or _Cfunction(\n        \"libvlc_vlm_add_input\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name, psz_input)\n\n\ndef libvlc_vlm_add_vod(\n    p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux\n):\n    \"\"\"Add a vod, with one input.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the new vod media.\n    :param psz_input: the input MRL.\n    :param i_options: number of additional options.\n    :param ppsz_options: additional options.\n    :param b_enabled: boolean for enabling the new vod.\n    :param psz_mux: the muxer of the vod media.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_add_vod\", None) or _Cfunction(\n        \"libvlc_vlm_add_vod\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_int,\n        ListPOINTER(ctypes.c_char_p),\n        ctypes.c_int,\n        ctypes.c_char_p,\n    )\n    return f(\n        p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux\n    )\n\n\ndef libvlc_vlm_change_media(\n    p_instance,\n    psz_name,\n    psz_input,\n    psz_output,\n    i_options,\n    ppsz_options,\n    b_enabled,\n    b_loop,\n):\n    \"\"\"Edit the parameters of a media. This will delete all existing inputs and\n    add the specified one.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the new broadcast.\n    :param psz_input: the input MRL.\n    :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n    :param i_options: number of additional options.\n    :param ppsz_options: additional options.\n    :param b_enabled: boolean for enabling the new broadcast.\n    :param b_loop: Should this broadcast be played in loop ?\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_change_media\", None) or _Cfunction(\n        \"libvlc_vlm_change_media\",\n        (\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_int,\n        ListPOINTER(ctypes.c_char_p),\n        ctypes.c_int,\n        ctypes.c_int,\n    )\n    return f(\n        p_instance,\n        psz_name,\n        psz_input,\n        psz_output,\n        i_options,\n        ppsz_options,\n        b_enabled,\n        b_loop,\n    )\n\n\ndef libvlc_vlm_del_media(p_instance, psz_name):\n    \"\"\"Delete a media (VOD or broadcast).\n\n    :param p_instance: the instance.\n    :param psz_name: the media to delete.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_del_media\", None) or _Cfunction(\n        \"libvlc_vlm_del_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_vlm_get_event_manager(p_instance):\n    \"\"\"Get libvlc_event_manager from a vlm media.\n    The p_event_manager is immutable, so you don't have to hold the lock\n\n    :param p_instance: a libvlc instance.\n\n    :return: libvlc_event_manager.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_get_event_manager\", None) or _Cfunction(\n        \"libvlc_vlm_get_event_manager\",\n        ((1,),),\n        class_result(EventManager),\n        ctypes.c_void_p,\n        Instance,\n    )\n    return f(p_instance)\n\n\ndef libvlc_vlm_get_media_instance_length(p_instance, psz_name, i_instance):\n    \"\"\"Get vlm_media instance length by name or instance id\n\n    :param p_instance: a libvlc instance.\n    :param psz_name: name of vlm media instance.\n    :param i_instance: instance id.\n\n    :return: length of media item or -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_get_media_instance_length\", None) or _Cfunction(\n        \"libvlc_vlm_get_media_instance_length\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, i_instance)\n\n\ndef libvlc_vlm_get_media_instance_position(p_instance, psz_name, i_instance):\n    \"\"\"Get vlm_media instance position by name or instance id\n\n    :param p_instance: a libvlc instance.\n    :param psz_name: name of vlm media instance.\n    :param i_instance: instance id.\n\n    :return: position as float or -1. on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_get_media_instance_position\", None) or _Cfunction(\n        \"libvlc_vlm_get_media_instance_position\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_float,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, i_instance)\n\n\ndef libvlc_vlm_get_media_instance_rate(p_instance, psz_name, i_instance):\n    \"\"\"Get vlm_media instance playback rate by name or instance id\n\n    :param p_instance: a libvlc instance.\n    :param psz_name: name of vlm media instance.\n    :param i_instance: instance id.\n\n    :return: playback rate or -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_get_media_instance_rate\", None) or _Cfunction(\n        \"libvlc_vlm_get_media_instance_rate\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, i_instance)\n\n\ndef libvlc_vlm_get_media_instance_time(p_instance, psz_name, i_instance):\n    \"\"\"Get vlm_media instance time by name or instance id\n\n    :param p_instance: a libvlc instance.\n    :param psz_name: name of vlm media instance.\n    :param i_instance: instance id.\n\n    :return: time as integer or -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_get_media_instance_time\", None) or _Cfunction(\n        \"libvlc_vlm_get_media_instance_time\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, i_instance)\n\n\ndef libvlc_vlm_pause_media(p_instance, psz_name):\n    \"\"\"Pause the named broadcast.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the broadcast.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_pause_media\", None) or _Cfunction(\n        \"libvlc_vlm_pause_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_vlm_play_media(p_instance, psz_name):\n    \"\"\"Play the named broadcast.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the broadcast.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_play_media\", None) or _Cfunction(\n        \"libvlc_vlm_play_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_vlm_release(p_instance):\n    \"\"\"Release the vlm instance related to the given :class:`Instance`\n\n    :param p_instance: the instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_release\", None) or _Cfunction(\n        \"libvlc_vlm_release\", ((1,),), None, None, Instance\n    )\n    return f(p_instance)\n\n\ndef libvlc_vlm_seek_media(p_instance, psz_name, f_percentage):\n    \"\"\"Seek in the named broadcast.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the broadcast.\n    :param f_percentage: the percentage to seek to.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_seek_media\", None) or _Cfunction(\n        \"libvlc_vlm_seek_media\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_float,\n    )\n    return f(p_instance, psz_name, f_percentage)\n\n\ndef libvlc_vlm_set_enabled(p_instance, psz_name, b_enabled):\n    \"\"\"Enable or disable a media (VOD or broadcast).\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param b_enabled: the new status.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_set_enabled\", None) or _Cfunction(\n        \"libvlc_vlm_set_enabled\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, b_enabled)\n\n\ndef libvlc_vlm_set_input(p_instance, psz_name, psz_input):\n    \"\"\"Set a media's input MRL. This will delete all existing inputs and\n    add the specified one.\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param psz_input: the input MRL.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_set_input\", None) or _Cfunction(\n        \"libvlc_vlm_set_input\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name, psz_input)\n\n\ndef libvlc_vlm_set_loop(p_instance, psz_name, b_loop):\n    \"\"\"Set a media's loop status.\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param b_loop: the new status.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_set_loop\", None) or _Cfunction(\n        \"libvlc_vlm_set_loop\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_int,\n    )\n    return f(p_instance, psz_name, b_loop)\n\n\ndef libvlc_vlm_set_mux(p_instance, psz_name, psz_mux):\n    \"\"\"Set a media's vod muxer.\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param psz_mux: the new muxer.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_set_mux\", None) or _Cfunction(\n        \"libvlc_vlm_set_mux\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name, psz_mux)\n\n\ndef libvlc_vlm_set_output(p_instance, psz_name, psz_output):\n    \"\"\"Set the output for a media.\n\n    :param p_instance: the instance.\n    :param psz_name: the media to work on.\n    :param psz_output: the output MRL (the parameter to the \"sout\" variable).\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_set_output\", None) or _Cfunction(\n        \"libvlc_vlm_set_output\",\n        (\n            (1,),\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name, psz_output)\n\n\ndef libvlc_vlm_show_media(p_instance, psz_name):\n    \"\"\"Return information about the named media as a JSON\n    string representation.\n\n    This function is mainly intended for debugging use,\n    if you want programmatic access to the state of\n    a vlm_media_instance_t, please use the corresponding\n    libvlc_vlm_get_media_instance_xxx -functions.\n    Currently there are no such functions available for\n    vlm_media_t though.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the media,\n        if the name is an empty string, all media is described.\n\n    :return: string with information about named media, or None on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_show_media\", None) or _Cfunction(\n        \"libvlc_vlm_show_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        string_result,\n        ctypes.c_void_p,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_vlm_stop_media(p_instance, psz_name):\n    \"\"\"Stop the named broadcast.\n\n    :param p_instance: the instance.\n    :param psz_name: the name of the broadcast.\n\n    :return: 0 on success, -1 on error.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vlm_stop_media\", None) or _Cfunction(\n        \"libvlc_vlm_stop_media\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_int,\n        Instance,\n        ctypes.c_char_p,\n    )\n    return f(p_instance, psz_name)\n\n\ndef libvlc_vprinterr(fmt, ap):\n    \"\"\"Sets the LibVLC error status and message for the current thread.\n    Any previous error is overridden.\n\n    :param fmt: the format string.\n    :param ap: the arguments.\n\n    :return: a nul terminated string in any case.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_vprinterr\", None) or _Cfunction(\n        \"libvlc_vprinterr\",\n        (\n            (1,),\n            (1,),\n        ),\n        None,\n        ctypes.c_char_p,\n        ctypes.c_char_p,\n        ctypes.c_void_p,\n    )\n    return f(fmt, ap)\n\n\ndef libvlc_wait(p_instance):\n    \"\"\"Waits until an interface causes the instance to exit.\n    You should start at least one interface first, using :func:`libvlc_add_intf`.\n\n    .. warning:: This function wastes one thread doing basically nothing.\n        :func:`libvlc_set_exit_handler` should be used instead.\n\n    :param p_instance: the instance.\n    \"\"\"\n    f = _Cfunctions.get(\"libvlc_wait\", None) or _Cfunction(\n        \"libvlc_wait\", ((1,),), None, None, Instance\n    )\n    return f(p_instance)\n\n\n# End of generated functions #\n\n# End of header.py #\n\n# 34 function(s) deprecated:\n#    libvlc_audio_output_device_count\n#    libvlc_audio_output_device_id\n#    libvlc_audio_output_device_longname\n#    libvlc_audio_output_get_device_type\n#    libvlc_audio_output_set_device_type\n#    libvlc_get_log_verbosity\n#    libvlc_log_clear\n#    libvlc_log_close\n#    libvlc_log_count\n#    libvlc_log_get_iterator\n#    libvlc_log_iterator_free\n#    libvlc_log_iterator_has_next\n#    libvlc_log_iterator_next\n#    libvlc_log_open\n#    libvlc_media_discoverer_event_manager\n#    libvlc_media_discoverer_localized_name\n#    libvlc_media_discoverer_new_from_name\n#    libvlc_media_get_tracks_info\n#    libvlc_media_is_parsed\n#    libvlc_media_parse\n#    libvlc_media_parse_async\n#    libvlc_media_player_get_agl\n#    libvlc_media_player_get_fps\n#    libvlc_media_player_set_agl\n#    libvlc_playlist_play\n#    libvlc_set_log_verbosity\n#    libvlc_toggle_teletext\n#    libvlc_track_description_release\n#    libvlc_video_get_chapter_description\n#    libvlc_video_get_height\n#    libvlc_video_get_title_description\n#    libvlc_video_get_width\n#    libvlc_video_set_subtitle_file\n#    libvlc_wait\n\n# 41 function(s) not wrapped as methods:\n#    libvlc_audio_equalizer_get_band_count\n#    libvlc_audio_equalizer_get_band_frequency\n#    libvlc_audio_equalizer_get_preset_count\n#    libvlc_audio_equalizer_get_preset_name\n#    libvlc_audio_equalizer_new\n#    libvlc_audio_equalizer_new_from_preset\n#    libvlc_audio_output_device_list_release\n#    libvlc_audio_output_list_release\n#    libvlc_chapter_descriptions_release\n#    libvlc_clearerr\n#    libvlc_clock\n#    libvlc_dialog_dismiss\n#    libvlc_dialog_get_context\n#    libvlc_dialog_post_action\n#    libvlc_dialog_post_login\n#    libvlc_dialog_set_context\n#    libvlc_errmsg\n#    libvlc_event_type_name\n#    libvlc_free\n#    libvlc_get_changeset\n#    libvlc_get_compiler\n#    libvlc_get_version\n#    libvlc_log_clear\n#    libvlc_log_close\n#    libvlc_log_count\n#    libvlc_log_get_context\n#    libvlc_log_get_iterator\n#    libvlc_log_get_object\n#    libvlc_media_discoverer_list_release\n#    libvlc_media_get_codec_description\n#    libvlc_media_slaves_release\n#    libvlc_media_tracks_release\n#    libvlc_module_description_list_release\n#    libvlc_new\n#    libvlc_printerr\n#    libvlc_renderer_discoverer_list_release\n#    libvlc_title_descriptions_release\n#    libvlc_track_description_list_release\n#    libvlc_track_description_release\n#    libvlc_video_new_viewpoint\n#    libvlc_vprinterr\n# Start of footer.py #\n\n\n# Backward compatibility\ndef callbackmethod(callback):\n    \"\"\"Now obsolete ``@callbackmethod`` decorator.\"\"\"\n    return callback\n\n\n# libvlc_free is not present in some versions of libvlc. If it is not\n# in the library, then emulate it by calling libc.free\nif not hasattr(dll, \"libvlc_free\"):\n    # need to find the free function in the C runtime. This is\n    # platform specific.\n    # For Linux and MacOSX\n    libc_path = find_library(\"c\")\n    if libc_path:\n        libc = ctypes.CDLL(libc_path)\n        libvlc_free = libc.free\n    else:\n        # On win32, it is impossible to guess the proper lib to call\n        # (msvcrt, mingw...). Just ignore the call: it will memleak,\n        # but not prevent to run the application.\n        def libvlc_free(p):\n            pass\n\n    # ensure argtypes is right, because default type of int won't\n    # work on 64-bit systems\n    libvlc_free.argtypes = [ctypes.c_void_p]\n\n\n# Version functions\ndef _dot2int(v):\n    \"\"\"(INTERNAL) Convert 'i.i.i[.i]' str to int.\"\"\"\n    t = [int(i) for i in v.split(\".\")]\n    if len(t) == 3:\n        if t[2] < 100:\n            t.append(0)\n        else:  # 100 is arbitrary\n            t[2:4] = divmod(t[2], 100)\n    elif len(t) != 4:\n        raise ValueError('\"i.i.i[.i]\": %r' % (v,))\n    if min(t) < 0 or max(t) > 255:\n        raise ValueError(\"[0..255]: %r\" % (v,))\n    i = t.pop(0)\n    while t:\n        i = (i << 8) + t.pop(0)\n    return i\n\n\ndef hex_version():\n    \"\"\"Return the version of these bindings in hex or 0 if unavailable.\"\"\"\n    try:\n        return _dot2int(__version__)\n    except (NameError, ValueError):\n        return 0\n\n\ndef libvlc_hex_version():\n    \"\"\"Return the libvlc version in hex or 0 if unavailable.\"\"\"\n    try:\n        return _dot2int(bytes_to_str(libvlc_get_version()).split()[0])\n    except ValueError:\n        return 0\n\n\ndef debug_callback(event, *args, **kwds):\n    \"\"\"Example callback, useful for debugging.\"\"\"\n    l = [\"event %s\" % (event.type,)]\n    if args:\n        l.extend(map(str, args))\n    if kwds:\n        l.extend(sorted(\"%s=%s\" % t for t in kwds.items()))\n    print(\"Debug callback (%s)\" % \", \".join(l))\n\n\ndef print_python():\n    from platform import architecture, mac_ver, machine, uname, win32_ver\n\n    if \"intelpython\" in sys.executable:\n        t = \"Intel-\"\n    # elif 'PyPy ' in sys.version:\n    #     t = 'PyPy-'\n    else:\n        t = \"\"\n    t = \"%sPython: %s (%s)\" % (t, sys.version.split()[0], architecture()[0])\n    if win32_ver()[0]:\n        t = t, \"Windows\", win32_ver()[0]\n    elif mac_ver()[0]:\n        t = t, (\"iOS\" if sys.platform == \"ios\" else \"macOS\"), mac_ver()[0], machine()\n    else:\n        try:\n            import distro  # <http://GitHub.com/nir0s/distro>\n\n            t = t, bytes_to_str(distro.name()), bytes_to_str(distro.version())\n        except ImportError:\n            t = (t,) + uname()[0:3:2]\n    print(\" \".join(t))\n\n\ndef print_version():\n    \"\"\"Print version of this vlc.py and of the libvlc\"\"\"\n    try:\n        print(\"%s: %s (%s)\" % (os.path.basename(__file__), __version__, build_date))\n        print(\n            \"libVLC: %s (%#x)\"\n            % (bytes_to_str(libvlc_get_version()), libvlc_hex_version())\n        )\n        # print('libVLC %s' % bytes_to_str(libvlc_get_compiler()))\n        if plugin_path:\n            print(\"plugins: %s\" % plugin_path)\n    except Exception:\n        print(\"Error: %s\" % sys.exc_info()[1])\n\n\nif __name__ == \"__main__\":\n    logging.basicConfig(level=logging.DEBUG)\n    try:\n        from msvcrt import getch\n    except ImportError:\n        import termios\n        import tty\n\n        def getch():  # getchar(), getc(stdin)  #PYCHOK flake\n            fd = sys.stdin.fileno()\n            old = termios.tcgetattr(fd)\n            try:\n                tty.setraw(fd)\n                ch = sys.stdin.read(1)\n            finally:\n                termios.tcsetattr(fd, termios.TCSADRAIN, old)\n            return ch\n\n    def end_callback(event):\n        print(\"End of media stream (event %s)\" % event.type)\n        sys.exit(0)\n\n    echo_position = False\n\n    def pos_callback(event, player):\n        if echo_position:\n            sys.stdout.write(\n                \"\\r%s to %.2f%% (%.2f%%)\"\n                % (event.type, event.u.new_position * 100, player.get_position() * 100)\n            )\n            sys.stdout.flush()\n\n    if \"-h\" in sys.argv[:2] or \"--help\" in sys.argv[:2]:\n        print(\"Usage: %s [options] <movie_filename>\" % sys.argv[0])\n        print(\"Once launched, type ? for help.\")\n        print(\"\")\n\n    elif \"-v\" in sys.argv[:2] or \"--version\" in sys.argv[:2]:\n        print_version()\n        print_python()\n        print(\"\")\n\n    else:\n        movie = os.path.expanduser(sys.argv.pop())\n        if not os.access(movie, os.R_OK):\n            print(\"Error: %s file not readable\" % movie)\n            sys.exit(1)\n\n        # Need --sub-source=marq in order to use marquee below\n        instance = Instance([\"--sub-source=marq\"] + sys.argv[1:])\n        try:\n            media = instance.media_new(movie)\n        except (AttributeError, NameError) as e:\n            print(\n                \"%s: %s (%s %s vs LibVLC %s)\"\n                % (\n                    e.__class__.__name__,\n                    e,\n                    sys.argv[0],\n                    __version__,\n                    libvlc_get_version(),\n                )\n            )\n            sys.exit(1)\n        player = instance.media_player_new()\n        player.set_media(media)\n        player.play()\n\n        # Some marquee examples.  Marquee requires '--sub-source marq' in the\n        # Instance() call above, see <http://www.videolan.org/doc/play-howto/en/ch04.html>\n        player.video_set_marquee_int(VideoMarqueeOption.Enable, 1)\n        player.video_set_marquee_int(VideoMarqueeOption.Size, 24)  # pixels\n        # FIXME: This crashes the module - it should be investigated\n        # player.video_set_marquee_int(VideoMarqueeOption.Position, Position.bottom)\n        if False:  # only one marquee can be specified\n            player.video_set_marquee_int(\n                VideoMarqueeOption.Timeout, 5000\n            )  # millisec, 0==forever\n            t = media.get_mrl()  # movie\n        else:  # update marquee text periodically\n            player.video_set_marquee_int(\n                VideoMarqueeOption.Timeout, 0\n            )  # millisec, 0==forever\n            player.video_set_marquee_int(\n                VideoMarqueeOption.Refresh, 1000\n            )  # millisec (or sec?)\n            ##t = '$L / $D or $P at $T'\n            t = \"%Y-%m-%d  %H:%M:%S\"\n        player.video_set_marquee_string(VideoMarqueeOption.Text, str_to_bytes(t))\n\n        # Some event manager examples.  Note, the callback can be any Python\n        # callable and does not need to be decorated.  Optionally, specify\n        # any number of positional and/or keyword arguments to be passed\n        # to the callback (in addition to the first one, an Event instance).\n        event_manager = player.event_manager()\n        event_manager.event_attach(EventType.MediaPlayerEndReached, end_callback)\n        event_manager.event_attach(\n            EventType.MediaPlayerPositionChanged, pos_callback, player\n        )\n\n        def mspf():\n            \"\"\"Milliseconds per frame\"\"\"\n            return int(1000 // (player.get_fps() or 25))\n\n        def print_info():\n            \"\"\"Print information about the media\"\"\"\n            try:\n                print_version()\n                media = player.get_media()\n                print(\"State: %s\" % player.get_state())\n                print(\"Media: %s\" % bytes_to_str(media.get_mrl()))\n                print(\n                    \"Track: %s/%s\"\n                    % (player.video_get_track(), player.video_get_track_count())\n                )\n                print(\"Current time: %s/%s\" % (player.get_time(), media.get_duration()))\n                print(\"Position: %s\" % player.get_position())\n                print(\"FPS: %s (%d ms)\" % (player.get_fps(), mspf()))\n                print(\"Rate: %s\" % player.get_rate())\n                print(\"Video size: %s\" % str(player.video_get_size(0)))  # num=0\n                print(\"Scale: %s\" % player.video_get_scale())\n                print(\"Aspect ratio: %s\" % player.video_get_aspect_ratio())\n            # print('Window:' % player.get_hwnd()\n            except Exception:\n                print(\"Error: %s\" % sys.exc_info()[1])\n\n        def sec_forward():\n            \"\"\"Go forward one sec\"\"\"\n            player.set_time(player.get_time() + 1000)\n\n        def sec_backward():\n            \"\"\"Go backward one sec\"\"\"\n            player.set_time(player.get_time() - 1000)\n\n        def frame_forward():\n            \"\"\"Go forward one frame\"\"\"\n            player.set_time(player.get_time() + mspf())\n\n        def frame_backward():\n            \"\"\"Go backward one frame\"\"\"\n            player.set_time(player.get_time() - mspf())\n\n        def print_help():\n            \"\"\"Print help\"\"\"\n            print(\"Single-character commands:\")\n            for k, m in sorted(keybindings.items()):\n                m = (m.__doc__ or m.__name__).splitlines()[0]\n                print(\"  %s: %s.\" % (k, m.rstrip(\".\")))\n            print(\"0-9: go to that fraction of the movie\")\n\n        def quit_app():\n            \"\"\"Stop and exit\"\"\"\n            sys.exit(0)\n\n        def toggle_echo_position():\n            \"\"\"Toggle echoing of media position\"\"\"\n            global echo_position\n            echo_position = not echo_position\n\n        keybindings = {\n            \" \": player.pause,\n            \"+\": sec_forward,\n            \"-\": sec_backward,\n            \".\": frame_forward,\n            \",\": frame_backward,\n            \"f\": player.toggle_fullscreen,\n            \"i\": print_info,\n            \"p\": toggle_echo_position,\n            \"q\": quit_app,\n            \"?\": print_help,\n        }\n\n        print(\"Press q to quit, ? to get help.%s\" % os.linesep)\n        while True:\n            k = getch()\n            print(\"> %s\" % k)\n            if k in keybindings:\n                keybindings[k]()\n            elif k.isdigit():\n                # jump to fraction of the movie.\n                player.set_position(float(\"0.\" + k))\n"
  },
  {
    "path": "generator/__init__.py",
    "content": "# Generator package\n"
  },
  {
    "path": "generator/generate.py",
    "content": "#! /usr/bin/env python3\n\n# Code generator for python ctypes bindings for VLC\n#\n# Copyright (C) 2009-2023 the VideoLAN team\n# $Id: $\n#\n# Authors: Olivier Aubert <contact at olivieraubert.net>\n#          Jean Brouwers <MrJean1 at gmail.com>\n#          Geoff Salmon <geoff.salmon at gmail.com>\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n\n\"\"\"This module parses VLC public API include files and generates\ncorresponding Python/ctypes bindings [1]_ code. Moreover, it\ngenerates Python class and method wrappers from the VLC functions\nand enum types.\n\nThere are 3 dependencies. Files ``header.py`` and ``footer.py``\ncontain the pre- and postamble of the generated code. Module\n``override.py`` defines a number of classes and methods overriding\nthe ones to be generated.\n\nThis module and the generated Python bindings have been formatted\nand verified using ruff, see https://github.com/astral-sh/ruff.\n\nThe generated Python bindings have been tested with\n32- and 64-bit Python 3.11 on Linux, Windows XP SP3, MacOS\nX 10.4.11 (Intel) and MacOS X 10.11.3 using the public API include\nfiles from VLC 1.1.4.1, 1.1.5, 2.1.0, 2.2.2, 3.0.3.\n\n.. [1] Java/JNA bindings for the VLC public API can be created in a\n    similar manner and depend on 3 Java files: ``boilerplate.java``,\n    ``LibVlc-footer.java`` and ``LibVlc-header.java``. Note that this code\n    has not be maintained for a while...\n\"\"\"\n\n__all__ = (\"Parser\", \"PythonGenerator\", \"JavaGenerator\")\n\n# Version number MUST have a major < 10 and a minor < 99 so that the\n# generated dist version can be correctly generated (major * 100 + minor).\n__version__ = \"2.3\"\n\n_debug = False\n\nimport enum\nimport logging\nimport operator\nimport os\nimport re\nimport shutil\nimport subprocess\nimport sys\nimport time\nfrom pathlib import Path\nfrom typing import NamedTuple\n\nfrom tree_sitter import Language, Node\nfrom tree_sitter import Parser as TSParser\n\nlogger = logging.getLogger(\"generate\")\n\nBASEDIR = os.path.abspath(os.path.dirname(__file__))\nTEMPLATEDIR = os.path.join(BASEDIR, \"templates\")\nPREPROCESSEDDIR = os.path.join(BASEDIR, \"preprocessed\")\nRUFF_CFG_FILE = os.path.join(os.path.dirname(BASEDIR), \"ruff.toml\")\n\n\ndef opener(name, mode=\"r\"):\n    return open(name, mode, encoding=\"utf8\")\n\n\n# Functions not wrapped/not referenced\n_blacklist = {}\n# Deprecated functions (their names)\n_deprecated_funcs = []\n\n# Set of functions that return a string that the caller is\n# expected to free.\nfree_string_funcs = set(\n    (\n        \"libvlc_media_discoverer_localized_name\",\n        \"libvlc_media_get_mrl\",\n        \"libvlc_media_get_meta\",\n        \"libvlc_video_get_aspect_ratio\",\n        \"libvlc_video_get_crop_geometry\",\n        \"libvlc_video_get_marquee_string\",\n        \"libvlc_audio_output_device_longname\",\n        \"libvlc_audio_output_device_id\",\n        \"libvlc_audio_output_device_get\",\n        \"libvlc_vlm_show_media\",\n    )\n)\n\n# some constants\n_NA_ = \"N/A\"\n_NL_ = \"\\n\"  # os.linesep\n_OUT_ = \"[OUT]\"\n_PNTR_ = \"pointer to get the \"  # KLUDGE: see @param ... [OUT]\n_INDENT_ = \"    \"\n_SPHINX_CODE_BLOCK_ = \".. code-block:: objectivec++\"\n\n# special keywords in header.py\n_BUILD_DATE_ = \"build_date = \"\n_GENERATED_ENUMS_ = \"# GENERATED_ENUMS\"\n_GENERATED_STRUCTS_ = \"# GENERATED_STRUCTS\"\n_GENERATED_CALLBACKS_ = \"# GENERATED_CALLBACKS\"\n_GENERATED_WRAPPERS_ = \"# GENERATED_WRAPPERS\"\n_GENERATED_FUNCTIONS_ = \"# GENERATED_FUNCTIONS\"\n\n# attributes\n_ATTR_DEPRECATED_ = \"__attribute__((deprecated))\"\n_ATTR_VISIBILITY_DEFAULT_ = '__attribute__((visibility(\"default\")))'\n_ATTR_DLL_EXPORT_ = \"__declspec(dllexport)\"\n\n# Precompiled regexps\nparam_re = re.compile(r\":param\\s+(?P<param_name>[^\\s]+)\")\nclass_re = re.compile(r\"class\\s+(\\S+?)(?:\\(\\S+\\))?:\")\ndef_re = re.compile(r\"^\\s+def\\s+(\\w+)\", re.MULTILINE)\nlibvlc_re = re.compile(r\"libvlc_[a-z_]+\\(*\\)*\")\n\n\ndef endot(text):\n    \"\"\"Terminate string with a period.\n\n    :param text: A string.\n\n    :return: `text` with a period added at the end if there weren't already one.\n    \"\"\"\n    if text and text[-1] not in \".,:;?!\":\n        text += \".\"\n    return text\n\n\ndef strip_whitespaces(seq):\n    \"\"\"Strip whitespaces (and empty strings) at the beginning and end of the\n    sequence of strings *seq* (str, list, tuple, etc.).\n\n    :param seq: A sequence of strings.\n\n    :return: The sequence stripped of its whitespaces and empty strings.\n    \"\"\"\n    whitespaces = \" \\t\\r\\n\\f\"\n    start = 0\n    while start < len(seq) and (not seq[start] or seq[start] in whitespaces):\n        start += 1\n    end = len(seq) - 1\n    while end >= 0 and (not seq[end] or seq[end] in whitespaces):\n        end -= 1\n    return seq[start : end + 1]\n\n\ndef snake_to_camel_case(name: str) -> str:\n    \"\"\"Convert snake_case to camelCase.\n\n    :param name: The string for which to convert the case.\n        The assumption is that it is written in snake case.\n\n    :return: *name* written in camel case.\n    \"\"\"\n    nl_underscores = 0\n    start = 0\n    while start < len(name) and name[start] == \"_\":\n        nl_underscores += 1\n        start += 1\n\n    nt_underscores = 0\n    end = len(name) - 1\n    while end >= 0 and name[end] == \"_\":\n        nt_underscores += 1\n        end -= 1\n\n    return (\n        (nl_underscores * \"_\")\n        + re.sub(\n            r\"_(.)\", lambda match: match.group(1).upper(), name[start : end + 1].lower()\n        )\n        + (nt_underscores * \"_\")\n    )\n\n\ndef errorf(fmt, *args):\n    r\"\"\"Print error to stderr.\n\n    :param fmt: A format string.\n    :param \\*args: A list of arguments to insert in the format string.\n    \"\"\"\n    global _nerrors\n    _nerrors += 1\n    sys.stderr.write(\"Error: \" + (fmt % args) + \"\\n\")\n\n\n_nerrors = 0\n\n\ndef errors(fmt, e=0):\n    \"\"\"Report total number of errors.\"\"\"\n    if _nerrors > e:\n        n = _nerrors - e\n        x = min(n, 9)\n        errorf(fmt + \"... exit(%s)\", n, x)\n        sys.exit(x)\n    elif _debug:\n        sys.stderr.write(fmt % (_NL_ + \"No\") + \"\\n\")\n\n\ndef format_sexp(s_exp: str, indent_size: int = 4) -> str:\n    \"\"\"Formats a Tree-sitter S-expression for better readability.\n\n    Source\n    ------\n    Code adapted from https://gist.github.com/TACIXAT/c5b2db4a80c812c4b4373b65e179a220\n\n    :param s_exp: A string containing the S-expression to format.\n    :param indent_size: The number of spaces with which to differentiate different levels of the tree.\n\n    :return: The formatted *s_exp*.\n    \"\"\"\n\n    indent_level = 0\n    output = \"\"\n    i = 0\n    # Initialize to False to avoid newline for the first token\n    need_newline = False\n    cdepth = []  # Track colons\n\n    while i < len(s_exp):\n        if s_exp[i] == \"(\":\n            if need_newline:\n                output += \"\\n\"\n            output += \" \" * (indent_level * indent_size) + \"(\"\n            indent_level += 1\n            need_newline = False  # Avoid newline after opening parenthesis\n        elif s_exp[i] == \":\":\n            indent_level += 1\n            cdepth.append(indent_level)  # Store depth where we saw colon\n            output += \":\"\n        elif s_exp[i] == \")\":\n            indent_level -= 1\n            if len(cdepth) > 0 and indent_level == cdepth[-1]:\n                # Unindent when we return to the depth we saw the last colon\n                cdepth.pop()\n                indent_level -= 1\n            output += \")\"\n            need_newline = True  # Newline needed after closing parenthesis\n        elif s_exp[i] == \" \":\n            output += \" \"\n        else:\n            j = i\n            while j < len(s_exp) and s_exp[j] not in [\"(\", \")\", \" \", \":\"]:\n                j += 1\n            # Add newline and indentation only when needed\n            if need_newline:\n                output += \"\\n\" + \" \" * (indent_level * indent_size)\n            output += s_exp[i:j]\n            i = j - 1\n            need_newline = True  # Next token should start on a new line\n        i += 1\n\n    return output\n\n\ndef tsnode_sexp(tsnode: Node) -> str:\n    \"\"\"\n    :param tsnode: A :class:`Node`.\n\n    :return: The formatted S-expression corresponding to *tsnoden*.\n    \"\"\"\n    return format_sexp(tsnode.sexp())\n\n\ndef tsnode_text(tsnode: Node, encoding: str = \"utf-8\"):\n    \"\"\"\n    :param tsnode: A :class:`Node`.\n    :param endoding: The encoding with which to decode *tsnode*'s source code.\n        Default is \"utf-8\".\n\n    :return: The source code corresponding to *tsnode*.\n    \"\"\"\n    return tsnode.text.decode(encoding)\n\n\ndef children_by_type(tsnode: Node, type: str):\n    \"\"\"\n    :param tsnode: A :class:`Node`.\n    :param type: The type (not to confuse with the name) of the children to retrieve.\n\n    :return: *tsnode*'s (named) children of type *type*.\n    \"\"\"\n    return list(filter(lambda child: child.type == type, tsnode.named_children))\n\n\ndef clean_doxygen_comment(docs: str) -> str:\n    \"\"\"Remove the ``/**``, ``*``, etc. artifacts of a Doxygen comment.\n\n    .. note::\n        This function assumes that the Doxygen comment syntax used\n        is the Javadoc style one, which consists of the block starting with ``/**``.\n        If *docs* doesn't start with ``/**``, the empty string will be returned.\n        See https://www.doxygen.nl/manual/docblocks.html#cppblock for all the ways\n        to mark a comment block.\n\n    :param docs: The Doxygen comment to clean.\n\n    :return: The cleaned Doxygen comment or the empty string if *docs*'s syntax is not Javadoc style.\n    \"\"\"\n    if not docs.startswith(\"/**\"):\n        return \"\"\n\n    lines = docs.split(\"\\n\")\n    i = 0\n    while i < len(lines):\n        # remove the /** at the beginning of first line\n        if i == 0:\n            lines[i] = re.sub(r\"/\\*\\*\\s?\", \"\", lines[i])\n        # remove the */ at the end of last line\n        if i == len(lines) - 1:\n            lines[i] = re.sub(r\"\\s*\\*/\\s*\", \"\", lines[i])\n        # remove the * at the begining of in-between lines\n        lines[i] = re.sub(r\"^\\s*\\*\\s?\", \"\", lines[i])\n\n        lines[i] = lines[i].strip()\n        i += 1\n\n    # remove potential empty lines at the beginning and end of comment block\n    start = 0\n    while start < len(lines) and lines[start] == \"\":\n        start += 1\n    end = len(lines) - 1\n    while end >= 0 and lines[end] == \"\":\n        end -= 1\n\n    cleaned_docs = []\n    for j in range(start, end + 1):\n        cleaned_docs.append(lines[j])\n    cleaned_docs = \"\\n\".join(cleaned_docs)\n\n    return cleaned_docs\n\n\ndef is_deprecated_attr(s: str) -> bool:\n    return s == _ATTR_DEPRECATED_\n\n\ndef is_public_attr(s: str) -> bool:\n    return s in [_ATTR_VISIBILITY_DEFAULT_, _ATTR_DLL_EXPORT_]\n\n\nclass _Source(object):\n    \"\"\"Base class for elements parsed from source.\"\"\"\n\n    source = \"\"\n\n    def __init__(self, file_=\"\", line=0):\n        self.source = \"%s:%s\" % (file_, line)\n        self.dump()\n\n    def base_sphinx_format(self, doc: str) -> list[str]:\n        # See https://devguide.python.org/documentation/markup/\n        lines = (\n            doc.replace(r\"\\see\", \"See\")\n            .replace(\"@see\", \"See\")\n            .replace(r\"\\sa\", \"\")\n            .replace(r\"\\p \", \"\")\n            .replace(r\"\\note\", \".. note::\")\n            .replace(\"@note\", \".. note::\")\n            .replace(r\"\\warning\", \".. warning::\")\n            .replace(\"@warning\", \".. warning::\")\n            .replace(r\"\\ref \", \"\")\n            .replace(\"@ref \", \"\")\n            .replace(r\"\\version\", \":version:\")\n            .replace(\"@version\", \":version:\")\n            .replace(r\"\\brief\", \".. brief::\")\n            .replace(\"@brief\", \".. brief::\")\n            .replace(r\"\\link\", \"\")\n            .replace(r\"\\endlink\", \"\")\n            .replace(\"@{\", \"\")\n            .replace(\"@}\", \"\")\n            .replace(r\"\\ingroup\", \"\")\n            .replace(\"{\", \"\")\n            .replace(\"}\", \"\")\n            .replace(\"<b>\", \"**\")\n            .replace(\"</b>\", \"**\")\n            .replace(r\"\\bug\", \":bug:\")\n            .replace(\"@bug\", \":bug:\")\n            .replace(r\"\\param\", \":param\")\n            .replace(\"@param\", \":param\")\n            .replace(r\"\\return\", \":return:\")\n            .replace(\"@return\", \":return:\")\n            .replace(r\"\\ref \", \"\")\n            .replace(\"@ref \", \"\")\n            .replace(r\"\\@protocol\", \"@protocol\")\n            .replace(r\"\\@end\", \"@end\")\n            .replace(r\"\\deprecated\", \"\\n.. warning:: **Deprecated!**\")\n            .replace(\"@deprecated\", \"\\n.. warning:: **Deprecated!**\")\n            .replace(\"NULL\", \"None\")\n            .replace(\n                r\"\\libvlc_return_bool\", \"\"\n            )  # special VLC doc syntax - maybe we could display something meaningful\n            .splitlines()\n        )\n        return lines\n\n    def base_sphinx_format_str(self, doc: str) -> str:\n        \"\"\"Convert string in doxygen format to a string in sphinx format.\"\"\"\n        return \"\\n\".join(self.base_sphinx_format(doc))\n\n    def docs_in_sphinx_format(self) -> str:\n        \"\"\"Converts self.docs into sphinx format.\"\"\"\n        in_block = False\n        res = []\n        lines = self.base_sphinx_format(self.docs)\n\n        for i, line in enumerate(lines):\n            if \".. note::\" in line:\n                if i - 1 >= 0 and line:\n                    res.append(\"\")\n                res.append(line)\n                in_block = True\n            elif \".. warning::\" in lines[i]:\n                if i - 1 >= 0 and lines[i - 1]:\n                    res.append(\"\")\n                res.append(line)\n                in_block = True\n            elif in_block:\n                if lines[i]:\n                    lines[i] = _INDENT_ + lines[i]\n                else:\n                    in_block = False\n                res.append(line)\n            else:\n                res.append(line)\n\n        if res:\n            res[-1] = endot(res[-1])\n\n        return _NL_.join(res)\n\n\nclass Enum(_Source):\n    \"\"\"Enum type.\"\"\"\n\n    type = \"enum\"\n\n    def __init__(self, name, type=\"enum\", vals=(), docs=\"\", **kwds):\n        if type != self.type:\n            raise TypeError(\"expected enum type: %s %s\" % (type, name))\n        self.docs = docs\n        self.name = name\n        self.vals = vals  # list/tuple of Val instances\n        if _debug:\n            _Source.__init__(self, **kwds)\n\n    def __eq__(self, other: object) -> bool:\n        if not isinstance(other, Enum):\n            return False\n\n        res = self.name == other.name\n        res &= self.type == other.type\n        res &= self.docs == other.docs\n        res &= sorted(self.vals, key=lambda v: v.name) == sorted(\n            other.vals, key=lambda v: v.name\n        )\n        return res\n\n    def __repr__(self) -> str:\n        res = format(\"%s (%s): %s\" % (self.name, self.type, self.source))\n        for v in self.vals:\n            res += \"\\n\" + _INDENT_ + str(v)\n        res += \"\\n\"\n        return res\n\n    def check(self):\n        \"\"\"Perform some consistency checks.\"\"\"\n        if not self.docs:\n            errorf(\"no comment for typedef %s %s\", self.type, self.name)\n        if self.type != \"enum\":\n            errorf(\"expected enum type: %s %s\", self.type, self.name)\n\n    def dump(self):\n        sys.stderr.write(str(self))\n\n\nclass Struct(_Source):\n    \"\"\"Struct type.\"\"\"\n\n    type = \"struct\"\n\n    def __init__(self, name, type=\"struct\", fields=(), docs=\"\", **kwds):\n        if type != self.type:\n            raise TypeError(\"expected struct type: %s %s\" % (type, name))\n        self.docs = docs\n        self.name = name\n        self.fields = fields  # list/tuple of Par instances\n        if _debug:\n            _Source.__init__(self, **kwds)\n\n    def __eq__(self, other: object) -> bool:\n        if not isinstance(other, Struct):\n            return False\n\n        res = self.name == other.name\n        res &= self.type == other.type\n        res &= self.docs == other.docs\n        res &= sorted(self.fields, key=lambda p: p.name) == sorted(\n            other.fields, key=lambda p: p.name\n        )\n        return res\n\n    def __repr__(self) -> str:\n        res = format(\"STRUCT %s (%s): %s\" % (self.name, self.type, self.source))\n        for p in self.fields:\n            res += \"\\n\" + _INDENT_ + str(p)\n        res += \"\\n\"\n        return res\n\n    def check(self):\n        \"\"\"Perform some consistency checks.\"\"\"\n        if not self.docs:\n            errorf(\"no comment for typedef %s %s\", self.type, self.name)\n        if self.type != \"struct\":\n            errorf(\"expected struct type: %s %s\", self.type, self.name)\n\n    def dump(self, indent_lvl=0):\n        for _ in range(indent_lvl):\n            sys.stderr.write(_INDENT_)\n        sys.stderr.write(\"STRUCT %s (%s): %s\\n\" % (self.name, self.type, self.source))\n        for field in self.fields:\n            field.dump(indent_lvl + 1)\n\n\nclass Union(_Source):\n    \"\"\"Union type.\"\"\"\n\n    type = \"union\"\n\n    def __init__(self, name, type=\"union\", fields=(), docs=\"\", **kwds):\n        if type != self.type:\n            raise TypeError(\"expected union type: %s %s\" % (type, name))\n        self.docs = docs\n        self.name = name\n        self.fields = fields\n        if _debug:\n            _Source.__init__(self, **kwds)\n\n    def __eq__(self, other: object) -> bool:\n        if not isinstance(other, Union):\n            return False\n\n        res = self.name == other.name\n        res &= self.type == other.type\n        res &= self.docs == other.docs\n        res &= sorted(self.fields, key=lambda p: p.name) == sorted(\n            other.fields, key=lambda p: p.name\n        )\n        return res\n\n    def __repr__(self) -> str:\n        res = format(\"UNION %s (%s): %s\" % (self.name, self.type, self.source))\n        for p in self.fields:\n            res += \"\\n\" + _INDENT_ + str(p)\n        res += \"\\n\"\n        return res\n\n    def check(self):\n        \"\"\"Perform some consistency checks.\"\"\"\n        if self.type != \"union\":\n            errorf(\"expected union type: %s %s\", self.type, self.name)\n\n    def dump(self, indent_lvl=0):\n        for _ in range(indent_lvl):\n            sys.stderr.write(_INDENT_)\n        sys.stderr.write(\"UNION %s (%s): %s\\n\" % (self.name, self.type, self.source))\n        for field in self.fields:\n            field.dump(indent_lvl + 1)\n\n\nclass Flag(object):\n    \"\"\"Enum-like, ctypes parameter direction flag constants.\"\"\"\n\n    In = 1  # input only\n    Out = 2  # output only\n    InOut = 3  # in- and output\n    InZero = 4  # input, default int 0\n\n    def __init__(self):\n        raise TypeError(\"constants only\")\n\n\nclass Func(_Source):\n    \"\"\"C function.\"\"\"\n\n    heads = ()  # docs lines without most @tags\n    out = ()  # [OUT] parameter names\n    params = ()  # @param lines, except [OUT]\n    tails = ()  # @return, @version, @bug lines\n    wrapped = 0  # number of times wrapped\n\n    def __init__(self, name, type, pars=(), docs=\"\", **kwds):\n        self.docs = docs\n        self.name = name\n        self.pars = pars  # list/tuple of Par instances\n        self.type = type\n        if _debug:\n            _Source.__init__(self, **kwds)\n\n    def __eq__(self, other: object) -> bool:\n        if not isinstance(other, Func):\n            return False\n\n        res = self.name == other.name\n        res &= self.type == other.type\n        res &= self.docs == other.docs\n        res &= sorted(self.pars, key=lambda x: x.name) == sorted(\n            other.pars, key=lambda x: x.name\n        )\n        return res\n\n    def __repr__(self) -> str:\n        res = format(\"%s (%s): %s\" % (self.name, self.type, self.source))\n        for p in self.pars:\n            res += \"\\n\" + _INDENT_ + str(p)\n        return res\n\n    def args(self, first=0):\n        \"\"\"Return the parameter names, excluding output parameters.\n        Ctypes returns all output parameter values as part of\n        the returned tuple.\n        \"\"\"\n        return [p.name for p in self.in_params(first)]\n\n    def in_params(self, first=0):\n        \"\"\"Return the parameters, excluding output parameters.\n        Ctypes returns all output parameter values as part of\n        the returned tuple.\n        \"\"\"\n        return [\n            p\n            for p in self.pars[first:]\n            if isinstance(p, Func) or p.flags(self.out)[0] != Flag.Out\n        ]\n\n    def check(self):\n        \"\"\"Perform some consistency checks.\"\"\"\n        if not self.docs:\n            errorf(\"no comment for function %s\", self.name)\n        elif len(self.pars) != self.nparams:\n            errorf(\n                \"doc parameters (%d) mismatch for function %s (%d)\",\n                self.nparams,\n                self.name,\n                len(self.pars),\n            )\n            if _debug:\n                self.dump()\n                sys.stderr.write(self.docs + \"\\n\")\n\n    def dump(self, indent_lvl=0, out=()):\n        for _ in range(indent_lvl):\n            sys.stderr.write(_INDENT_)\n\n        t = \"Out\" if self.name in out else \"\"\n        sys.stderr.write(\"%s (%s): %s %s\\n\" % (self.name, self.type, self.source, t))\n\n        for p in self.pars:\n            p.dump(indent_lvl + 1, self.out)\n\n    @property\n    def nparams(self):\n        \"\"\"Number of param lines in docstring.\"\"\"\n        return len(self.params) + len(self.out)\n\n    def wrap_params_in_asterisks(self, s: str) -> str:\n        for par in self.pars:\n            s = re.sub(rf\"([^\\w]){par.name}([^\\w])\", rf\"\\1*{par.name}*\\2\", s)\n        return s\n\n    def docs_in_sphinx_format(self, first=0) -> str:\n        \"\"\"Converts self.docs\n\n        Function documentation is a bit more complex than the generic\n        version.\n        \"\"\"\n        b = []\n        heads = []\n        out = []\n        params = []\n        r = []\n        v = []\n        block = None\n        block_is_params = False\n        last_param_name = None\n\n        lines = self.base_sphinx_format(self.docs)\n\n        i = 0\n        while i < len(lines):\n            line = lines[i]\n\n            if line.startswith(\"- \"):\n                indent = _INDENT_ * 2\n                if block is None:\n                    indent = \"\"\n                    block = heads\n                    block_is_params = False\n\n                # Check whether there is a blonk line right before the @code line.\n                # If not, add one (needed for sphinx to properly display the list).\n                if i - 1 >= 0 and lines[i - 1].strip():\n                    block.append(\"\")\n\n                while i < len(lines) and lines[i].strip():\n                    if lines[i].startswith(\"- \"):\n                        block.append(lines[i].strip().replace(\"- \", indent + \"* \"))\n                    else:\n                        block.append(indent + _INDENT_ + lines[i].strip())\n                    i += 1\n\n                block.append(\"\")\n\n                block = None\n                block_is_params = False\n            elif \":param\" in line:\n                last_param_name = line.split()[1]\n\n                if _OUT_ in line:\n                    line = line.replace(_PNTR_, \"\")\n                    out.append(last_param_name)\n\n                params.append(param_re.sub(r\":param \\g<param_name>:\", line))\n\n                block = params\n                block_is_params = True\n            elif \":return:\" in line:\n                r.append(line)\n\n                block = r\n                block_is_params = False\n            elif \":version:\" in line:\n                v.append(line)\n\n                block = v\n                block_is_params = False\n            elif \":bug:\" in line:\n                b.append(line)\n\n                block = b\n                block_is_params = False\n            elif \"@code\" in line:  # we are dealing with a code block\n                # Check whether there is a blonk line right before the @code line.\n                # If not, add one (needed for sphinx to properly display the code block).\n                if i - 1 >= 0 and lines[i - 1].strip():\n                    heads.append(\"\")\n\n                # process the first line\n                line = (\n                    line.replace(\"@code.mm\", f\"{_SPHINX_CODE_BLOCK_}\")\n                    .replace(\"@code.m\", f\"{_SPHINX_CODE_BLOCK_}\")\n                    .replace(\"@code\", f\"{_SPHINX_CODE_BLOCK_}\")\n                    .strip()\n                )\n                heads.append(line)\n\n                # Check whether there is a blonk line right after the @code line.\n                # If not, add one (needed for sphinx to properly display the code block).\n                i += 1\n                line = lines[i].strip()\n                if line:\n                    heads.append(\"\")\n\n                # process lines within block, until the end\n                while \"@endcode\" not in line:\n                    # add a tab before each non-empty line within the code block\n                    if line:\n                        heads.append(_INDENT_ + line)\n                    else:\n                        heads.append(line)\n                    # don't bother to check if out of bounds,\n                    # assume there must be more lines if starting a code block\n                    i += 1\n                    line = lines[i]\n\n                # process last line (@endcode)\n                if i + 1 < len(lines) and lines[i + 1].strip():\n                    heads.append(line.replace(\"@endcode\", \"\").strip())\n\n                block = None\n                block_is_params = False\n            elif \".. note::\" in line:\n                if i - 1 >= 0 and lines[i - 1]:\n                    heads.append(\"\")\n\n                heads.append(line)\n\n                block = heads\n                block_is_params = False\n            elif \".. warning::\" in line:\n                heads.append(line)\n\n                block = heads\n                block_is_params = False\n            elif block is not None:\n                if block_is_params and _OUT_ in line:\n                    out.append(last_param_name)\n\n                if line:\n                    block.append(_INDENT_ + line)\n                else:\n                    block.append(line)\n                    block = None\n                    block_is_params = False\n            else:\n                heads.append(line)\n\n            i += 1\n\n        if heads:\n            heads[-1] = endot(heads[-1])\n            self.heads = strip_whitespaces(\n                tuple(map(self.wrap_params_in_asterisks, heads))\n            )\n        if out:\n            self.out = tuple(out)\n        if params:\n            self.params = strip_whitespaces(tuple(map(endot, params)))\n\n        tails = (\n            list(map(self.wrap_params_in_asterisks, r))\n            + v\n            + list(map(self.wrap_params_in_asterisks, b))\n        )\n        if tails:\n            self.tails = strip_whitespaces(tuple(map(endot, tails)))\n\n        res = _NL_.join(self.heads)\n        if self.params[first:]:\n            res += _NL_ * 2\n            res += _NL_.join(self.params[first:])\n        if self.tails:\n            res += _NL_ * 2\n            res += _NL_.join(self.tails)\n        return res\n\n    def flags(self, out=(), default=None):\n        \"\"\"Returns the flags tuple (in case this Func is a function parameter).\"\"\"\n        f = Flag.In\n        if self.name in out:\n            f = Flag.Out\n\n        if default is None:\n            return (f,)  # 1-tuple\n        else:  # see ctypes 15.16.2.4 Function prototypes\n            return f, self.name, default\n\n\nclass Par(object):\n    \"\"\"C function parameter.\"\"\"\n\n    def __init__(self, name, type, constness):\n        \"\"\"\n        :param name: A string containing the name of the parameter.\n        :param type: A string containing the C type of the parameter.\n        :param constness:\n            A list of bools where each index refers to the constness\n            of that level of indirection:\n            * [0] no indirection: is the value const?\n            * [1] pointer to value: is this pointer const?\n            * [2] pointer to pointer: is this pointer const?\n            * ... rare to see more than two levels of indirection\n        \"\"\"\n        self.name = name\n        self.type = type\n        self.constness = constness\n\n    def __eq__(self, other: object) -> bool:\n        if not isinstance(other, Par):\n            return False\n\n        res = self.name == other.name\n        res &= self.type == other.type\n        res &= self.constness == other.constness\n        return res\n\n    def __repr__(self):\n        return \"%s (%s) %s\" % (self.name, self.type, self.constness)\n\n    def dump(self, indent_lvl=0, out=()):\n        for _ in range(indent_lvl):\n            sys.stderr.write(_INDENT_)\n\n        if self.name in out:\n            t = _OUT_  # @param [OUT]\n        else:\n            t = {\n                Flag.In: \"\",  # default\n                Flag.Out: \"Out\",\n                Flag.InOut: \"InOut\",\n                Flag.InZero: \"InZero\",\n            }.get(self.flags()[0], \"FIXME_Flag\")\n        sys.stderr.write(\"%s %s\\n\" % (str(self), t))\n\n    # Parameter passing flags for types.  This shouldn't\n    # be hardcoded this way, but works all right for now.\n    def flags(self, out=(), default=None):\n        \"\"\"Return the parameter flags tuple.\n\n        Return the parameter flags tuple for the given parameter\n        type and name and a list of parameter names documented as\n        [OUT].\n        \"\"\"\n        if self.name in out:\n            f = Flag.Out  # @param [OUT]\n        elif not self.constness[0]:\n            t_re = re.compile(\n                r\"(int *\\*|unsigned *\\*|unsigned char *\\*|libvlc_media_track_info_t *\\* *\\*)\"\n            )\n            f = Flag.Out if t_re.match(self.type) else Flag.In\n        else:\n            f = Flag.In\n\n        if default is None:\n            return (f,)  # 1-tuple\n        else:  # see ctypes 15.16.2.4 Function prototypes\n            return f, self.name, default\n\n\nclass Val(object):\n    \"\"\"Enum name and value.\"\"\"\n\n    def __init__(self, enum, value, docs=\"\", context=None):\n        self.enum = enum  # C name\n        self.docs = docs\n        # convert name\n        t = enum.split(\"_\")\n        if context is not None:\n            # A context (enum type name) is provided. Strip out the\n            # common prefix.\n            prefix = os.path.commonprefix((enum, re.sub(r\"_t$\", r\"_\", context)))\n            n = enum.replace(prefix, \"\", 1)\n        else:\n            # No prefix. Fallback on the previous version (which\n            # considers only the last _* portion of the name)\n            n = t[-1]\n        # Special case for debug levels and roles (with non regular name)\n        n = re.sub(\n            r\"^(LIBVLC_|role_|marquee_|adjust_|AudioChannel_|AudioOutputDevice_|AudioStereoMode_)\",\n            \"\",\n            n,\n        )\n        if n[0].isdigit():  # can't start with a number\n            n = \"_\" + n\n        if n == \"None\":  # can't use a reserved python keyword\n            n = \"_\" + n\n        self.name = n\n        self.value = value\n\n    def __eq__(self, other: object) -> bool:\n        if not isinstance(other, Val):\n            return False\n\n        res = self.enum == other.enum\n        res &= self.name == other.name\n        res &= self.value == other.value\n        res &= self.docs == other.docs\n        return res\n\n    def __repr__(self) -> str:\n        return \"%s = %s\" % (self.name, self.value)\n\n    def dump(self):  # for debug\n        return str(self) + \"\\n\"\n\n\nclass Overrides(NamedTuple):\n    codes: dict\n    methods: dict\n    docstrs: dict\n\n\nclass Parser(object):\n    \"\"\"Parser of C header files.\"\"\"\n\n    def __init__(\n        self,\n        code_file: Path | str,\n        version_file: Path | str,\n        version: str = \"\",\n        with_extra: bool = True,\n    ):\n        self.with_extra = with_extra\n        if isinstance(code_file, str):\n            code_file = Path(code_file)\n        if isinstance(version_file, str):\n            version_file = Path(version_file)\n        self.code_file = code_file\n        self.version_file = version_file\n\n        # Compile the tree-sitter c module\n        Language.build_library(\n            \"build/c.so\",\n            [\"vendor/tree-sitter-c\"],\n        )\n        self.C_LANGUAGE = Language(\"build/c.so\", \"c\")\n        tsp = TSParser()\n        tsp.set_language(self.C_LANGUAGE)\n\n        with open(self.code_file, \"rb\") as file:\n            self.code_tstree = tsp.parse(file.read())\n        with open(self.version_file, \"rb\") as file:\n            self.version_tstree = tsp.parse(file.read())\n\n        self.enums = self.parse_enums()\n        self.structs = self.parse_structs()\n        self.funcs = self.parse_funcs()\n        self.callbacks = self.parse_callbacks()\n        self.version = version\n        if not self.version:\n            self.version = self.parse_version()\n\n        # Sort parsed items by name as it proves\n        # useful for debugging (diffing in particular)\n        self.enums.sort(key=lambda x: x.name)\n        self.funcs.sort(key=lambda x: x.name)\n        self.callbacks.sort(key=lambda x: x.name)\n\n        # self.dump(\"enums\")\n        # self.dump(\"structs\")\n        # self.dump(\"funcs\")\n        # self.dump(\"callbacks\")\n\n    def bindings_version(self):\n        \"\"\"Returns the bindings version number.\n\n        It is built from the VLC version number and the generator\n        version number as:\n\n            vlc_major.vlc_minor.(1000 * vlc_micro + 100 * generator_major + generator_minor)\n\n        \"\"\"\n        major, minor = [int(i) for i in __version__.split(\".\")]\n        bindings_version = \"%s%d%02d\" % (self.version, major, minor)\n        return bindings_version\n\n    def check(self):\n        \"\"\"Perform some consistency checks.\"\"\"\n        for e in self.enums:\n            e.check()\n        for f in self.funcs:\n            f.check()\n        for f in self.callbacks:\n            f.check()\n        for s in self.structs:\n            s.check()\n\n    def dump(self, attr):\n        sys.stderr.write(\"==== %s ==== %s\\n\" % (attr, self.version))\n        xs = getattr(self, attr)\n        xs.sort(key=lambda x: x.name)\n        for a in xs:\n            a.dump()\n        sys.stderr.write(_NL_)\n\n    def parse_doxygen_comment(self, tsnode: Node) -> str | None:\n        \"\"\"\n        :param tsnode: A :class:`Node` for which to get the associated Doxygen doc comment.\n\n        :return: A string containing the (cleaned) comment if it exists, None otherwise.\n        \"\"\"\n        if tsnode.prev_sibling is not None and tsnode.prev_sibling.type == \"comment\":\n            docs = tsnode_text(tsnode.prev_sibling)\n\n            # Preprocessing can cause file documentation to be placed on top of an\n            # enum, say, or any other item.\n            # Because we assume that a Doxygen comment placed above an item is\n            # documentation for that item, we can mistakenly associate a file's\n            # documentation block to an item.\n            # To filter out file documentation blocks, we rely on the assumption\n            # that they start with \"/***\".\n            # Indeed, libvld headers tend to start with something like:\n            #   /*****************************************************************************\n            #    * <filename>: <short_descrption>\n            #    *****************************************************************************\n            #    * Copyright (C) 1998-2008 VLC authors and VideoLAN\n            #    * ...\n            #    *****************************************************************************/\n            if docs.startswith(\"/***\"):\n                return None\n\n            # Similarly to the previous case, we want to ignore Doxygen blocks\n            # containing a \\file or @file tag.\n            if r\"\\file\" in docs or \"@file\" in docs:\n                return None\n\n            docs = clean_doxygen_comment(docs)\n            return docs\n        return None\n\n    def parse_type(self, tsnode: Node):\n        \"\"\"\n        :param tsnode:\n            A :class:`Node` that is expected to have a\n            direct child named ``type`` (otherwise the function will throw).\n\n        :return:\n            A string representation of the type of *tsnode*,\n            a 'constness' list of the type, and the last non-pointer\n            declaration node encountered (in a tuple, in this order).\n        \"\"\"\n        type_node = tsnode.child_by_field_name(\"type\")\n        assert (\n            type_node is not None\n        ), \"Expected `tsnode` to have a direct child named _type_.\"\n\n        constness = []\n        t = tsnode_text(type_node)\n        if (\n            type_node.prev_sibling is not None\n            and type_node.prev_sibling.type == \"type_qualifier\"\n            and tsnode_text(type_node.prev_sibling) == \"const\"\n        ) or (\n            type_node.next_sibling is not None\n            and type_node.next_sibling.type == \"type_qualifier\"\n            and tsnode_text(type_node.next_sibling) == \"const\"\n        ):\n            constness.append(True)\n        else:\n            constness.append(False)\n\n        decl_node = tsnode.child_by_field_name(\"declarator\")\n        while decl_node is not None and decl_node.type in [\n            \"pointer_declarator\",\n            \"abstract_pointer_declarator\",\n        ]:\n            t += \"*\"\n            constness.append(False)\n            type_qualifiers = children_by_type(decl_node, \"type_qualifier\")\n            if len(type_qualifiers) > 0:\n                type_qualifier_text = tsnode_text(type_qualifiers[0])\n                if type_qualifier_text == \"const\":\n                    constness[-1] = True\n            decl_node = decl_node.child_by_field_name(\"declarator\")\n\n        # remove the struct keyword, this information is currently not used\n        t = t.replace(\"struct \", \"\").strip()\n\n        return t, constness, decl_node\n\n    def parse_func_pointer(self, tsnode: Node):\n        \"\"\"\n        :param tsnode:\n            A :class:`Node` that is expected to be a ``field_declaration``\n            with a subtree matching:\n\n            .. code-block::\n\n                (function_declarator\n                    declarator: (parenthesized_declarator (pointer_declarator))\n                    parameters: (parameter_list))\n\n        :return:\n            A :class:`Func` representing a function pointer if *tsnode*\n            matches the above query, or None otherwise.\n        \"\"\"\n        query_func_p_str = \"\"\"\n(function_declarator\n\tdeclarator: (parenthesized_declarator (pointer_declarator))\n    parameters: (parameter_list)) @func\n\"\"\"\n        query_func_p = self.C_LANGUAGE.query(query_func_p_str)\n        func_caps = query_func_p.captures(tsnode)\n        if not (len(func_caps) >= 1):\n            return None\n        # Assumes the first capture is the function we are\n        # interested in, that is the one closest to the root of\n        # `tsnode`.\n        # Indeed, we can't enforce exactly one match because\n        # a function pointer can have another function pointer\n        # as parameter.\n        func_decl = func_caps[0][0]\n\n        query_func_id_str = \"\"\"\ndeclarator: (parenthesized_declarator\n                (pointer_declarator\n                    declarator: (_) @func_id))\n        \"\"\"\n        query_func_id = self.C_LANGUAGE.query(query_func_id_str)\n        func_id_caps = query_func_id.captures(func_decl)\n        assert (\n            len(func_id_caps) >= 1\n        ), \"There should be at least one identifier if we are indeed parsing a function pointer.\"\n        # Assumes the first capture is the id of the function we are\n        # interested in, that is the one closest to the root of\n        # `tsnode`.\n        # We can't enforce exactly one match for the same reason we\n        # can't enforce exactly one match for the function\n        # pointer query.\n        name = tsnode_text(func_id_caps[0][0])\n\n        type_node = tsnode.child_by_field_name(\"type\")\n        assert (\n            type_node is not None\n        ), \"Expected `tsnode` to have a child of name _type_.\"\n        return_type, _, _ = self.parse_type(tsnode)\n\n        docs = self.parse_doxygen_comment(tsnode)\n        if docs is None:\n            docs = \"\"\n\n        params = func_decl.child_by_field_name(\"parameters\")\n        assert (\n            params is not None\n        ), \"Expected `func_decl` to have a child of name _parameters_.\"\n        params = children_by_type(params, \"parameter_declaration\")\n        params = [\n            p for param in params for p in self.parse_param(param) if p is not None\n        ]\n        if len(params) == 1 and isinstance(params[0], Par) and params[0].type == \"void\":\n            params = []\n\n        return Func(\n            name,\n            return_type,\n            params,\n            docs,\n            file_=self.code_file,\n            line=tsnode.start_point[0] + 1,\n        )\n\n    def parse_callbacks(self):\n        \"\"\"\n        :return: A list of :class:`Func` representing callbacks (without blacklisted ones).\n        \"\"\"\n        typedef_query = self.C_LANGUAGE.query(\"\"\"\n(type_definition declarator: [\n\t(pointer_declarator)\n    (function_declarator)\n]) @typedef\n\"\"\")\n        typedef_captures = typedef_query.captures(self.code_tstree.root_node)\n        func_query = self.C_LANGUAGE.query(\"(function_declarator) @func_decl\")\n        func_captures = []\n        for typedef_node, _ in typedef_captures:\n            func_decl_captures = func_query.captures(typedef_node)\n            if len(func_decl_captures) >= 1:\n                # Assumes the first capture is the function we are\n                # interested in, that is the one closest to the root of\n                # `tsnode`.\n                # Indeed, we can't enforce exactly one match because\n                # a callback (aka. function pointer) can have another function\n                # pointer as parameter.\n                func_captures.append((typedef_node, func_decl_captures[0][0]))\n\n        funcs = []\n        func_id_query = self.C_LANGUAGE.query(\n            \"\"\"\n(function_declarator\n    declarator: (parenthesized_declarator\n                    (pointer_declarator\n                        declarator: (type_identifier) @func_id)))\n\"\"\"\n        )\n        for typedef_node, func_decl_node in func_captures:\n            func_id_capture = func_id_query.captures(typedef_node)\n            if len(func_id_capture) < 1:\n                # Known wrong matches (difficult to filter out with a TS query):\n                # cookie_read_function_t cookie_write_function_t cookie_seek_function_t cookie_close_function_t\n                # from cookie_io_functions_t.h (included by stdio.h)\n                if b\" cookie_\" not in typedef_node.text:\n                    # If not one of these, display a warning so that we can investigate\n                    logger.warning(\n                        f\"Cannot analyse callback signature in following line - ignoring:\\n{typedef_node.text}\"\n                    )\n                continue\n            assert (\n                len(func_id_capture) >= 1\n            ), f\"Expected the query to capture at least one node in line:\\n{typedef_node.text}\"\n            # Assumes the first capture is the id of the function we are\n            # interested in, that is the one closest to the root of\n            # `typedef_node`.\n            # We can't enforce exactly one match for the same reason we\n            # can't enforce exactly one match for the callback\n            # (aka. function pointer) query.\n            func_id_node = func_id_capture[0][0]\n            assert (\n                func_id_node is not None\n            ), \"Expected `func_id_node` to not be None. Maybe `typedef_node` doesn't have the structure assumed in `func_id_query`?\"\n            name = tsnode_text(func_id_node)\n\n            # Make the assumption that every function of interest starts with 'libvlc_'.\n            # Because the code parsed is the output of vlc.h's preprocessing, some signatures\n            # come from external libraries and are not part of libvlc's API.\n            if not name.startswith(\"libvlc_\"):\n                logger.warning(f\"Not a callback:\\n{typedef_node.text}\")\n                continue\n\n            type_node = typedef_node.child_by_field_name(\"type\")\n            assert (\n                type_node is not None\n            ), \"Expected `typedef_node` to have a child of name _type_.\"\n            return_type, _, _ = self.parse_type(typedef_node)\n\n            # Ignore if in blacklist\n            if name in _blacklist:\n                _blacklist[name] = return_type\n                continue\n\n            docs = self.parse_doxygen_comment(typedef_node)\n            if docs is None:\n                docs = \"\"\n\n            params_nodes = func_decl_node.child_by_field_name(\"parameters\")\n            assert (\n                params_nodes is not None\n            ), \"Expected `func_decl_node` to have a child of name _parameters_. Wrong query? Wrong field name for child?\"\n            params_decls = children_by_type(params_nodes, \"parameter_declaration\")\n            params = [\n                p\n                for param_decl in params_decls\n                for p in self.parse_param(param_decl)\n                if p is not None\n            ]\n            if (\n                len(params) == 1\n                and isinstance(params[0], Par)\n                and params[0].type == \"void\"\n            ):\n                params = []\n\n            funcs.append(\n                Func(\n                    name,\n                    return_type,\n                    params,\n                    docs,\n                    file_=self.code_file,\n                    line=typedef_node.start_point[0] + 1,\n                )\n            )\n\n        return funcs\n\n    def parse_enums(self):\n        enum_query = self.C_LANGUAGE.query(\"(enum_specifier) @enum\")\n        enum_captures = enum_query.captures(self.code_tstree.root_node)\n\n        enums = []\n        for node, _ in enum_captures:\n            parent = node.parent\n            name = \"\"\n            typ = \"enum\"\n            docs = \"\"\n            vals = []\n            # add one because starts from zero by default\n            line = node.start_point[0] + 1\n            e = -1\n            locs = {}\n\n            # find enum's name\n            if parent is not None and parent.type == \"type_definition\":\n                type_id = parent.child_by_field_name(\"declarator\")\n                if type_id is not None and not type_id.is_missing:\n                    name = tsnode_text(type_id)\n            else:\n                type_id = node.child_by_field_name(\"name\")\n                if type_id is not None:\n                    name = tsnode_text(type_id)\n            # ignore if anonymous enum\n            if name == \"\":\n                continue\n            # Make the assumption that every enum of interest starts with 'libvlc_'.\n            # Because the code parsed is the output of vlc.h's preprocessing, some signatures\n            # come from external libraries and are not part of libvlc's API.\n            if not name.startswith(\"libvlc_\"):\n                continue\n\n            # find enum's docs\n            if parent is not None and parent.type == \"type_definition\":\n                docs = self.parse_doxygen_comment(parent)\n            else:\n                docs = self.parse_doxygen_comment(node)\n            if docs is None:\n                docs = \"\"\n\n            # find enum's values\n            body = node.child_by_field_name(\"body\")\n            if body is None:\n                # we are dealing with an empty typedef enum\n                continue\n            for child in body.named_children:\n                if child.type != \"enumerator\":\n                    continue\n\n                # Since libvlc v4.0.0, there are enum values\n                # annotated with LIBVLC_DEPRECATED.\n                # Tree-sitter fails to parse that attribute at\n                # that place, producing an error in the subtree.\n                # To workaround this problem, we assume that\n                # when the `child` contains an error or is\n                # followed by an error, it is because\n                # LIBVLC_DEPRECATED is present.\n                if child.has_error or (\n                    child.next_sibling is not None and child.next_sibling.is_error\n                ):\n                    continue\n\n                vname = child.child_by_field_name(\"name\")\n                assert (\n                    vname is not None\n                ), \"Expected `child` to have a child of name _name_. `child` is not of type _enumerator_? Parsing malformed C code?\"\n                vname = tsnode_text(vname)\n\n                vdocs = None\n                # Find the value documentation.\n                if (\n                    child.next_named_sibling is not None\n                    and child.next_named_sibling.type == \"comment\"\n                    and child.next_named_sibling.start_point[0] == child.end_point[0]\n                ):\n                    # There is a comment following the value on the same line\n                    vdocs = clean_doxygen_comment(tsnode_text(child.next_named_sibling))\n                elif (\n                    child.prev_sibling is not None\n                    and child.prev_sibling.type == \"comment\"\n                ):\n                    # The comment is placed before the value\n                    vdocs = clean_doxygen_comment(tsnode_text(child.prev_sibling))\n                else:\n                    vdocs = \"\"\n\n                vvalue = child.child_by_field_name(\"value\")\n                if vvalue is not None:\n                    vvalue = tsnode_text(vvalue)\n\n                    # Handle bit-shifted values.\n                    # Bit-shifted characters cannot be directly evaluated in Python.\n                    m = re.search(r\"'(.)'\\s*(<<|>>)\\s*(.+)\", vvalue)\n                    if m:\n                        vvalue = \"%s %s %s\" % (ord(m.group(1)), m.group(2), m.group(3))\n\n                    # Handle expressions.\n                    try:\n                        e = eval(vvalue, locs)\n                    except (SyntaxError, TypeError, ValueError):\n                        errorf(\"%s %s (l.%s)\", typ, name, line)\n                        raise\n                    locs[vname] = e\n\n                    # Preserve hex values.\n                    if vvalue[:2] in (\"0x\", \"0X\"):\n                        vvalue = hex(e)\n                    else:\n                        vvalue = str(e)\n\n                    vals.append(Val(vname, vvalue, vdocs, context=name))\n                else:\n                    e += 1\n                    locs[vname] = e\n                    vals.append(Val(vname, str(e), vdocs, context=name))\n\n            enums.append(\n                Enum(name, typ, vals, docs, file_=self.code_file.absolute(), line=line)\n            )\n\n        return enums\n\n    def parse_param(self, tsnode: Node):\n        \"\"\"Returns a list of :class:`Par`, :class:`Struct`, :class:`Union` and/or None\n        representing the parameters of *tsnode*.\n\n        When *tsnode* is a ``parameter_declaration``, the list returned will only contain\n        one element being an instance of :class:`Par` or :class:`Func`.\n\n        When *tsnode* is a ``field_declaration``, the element can be a class:`Struct`/:class:`Union` as well.\n        Furthermore, if it happens to be an anonymous class:`Struct`/:class:`Union`, a list containing\n        the class:`Struct`/:class:`Union`'s fields will be returned instead of a list containing the\n        class:`Struct`/:class:`Union`.\n\n        None can be part of the list only when the Parser option *with_extra* is False.\n        In this case, nested structs/unions and function pointers as parameter/field are\n        ignored, meaning None is returned instead.\n\n        :param tsnode: A :class:`Node` of type ``parameter_declaration`` or ``field_declaration``.\n\n        :return: A list of :class:`Par`, :class:`Struct`, :class:`Union` and/or None\n        \"\"\"\n        accepted_node_types = [\n            \"parameter_declaration\",\n            \"field_declaration\",\n        ]\n        accepted_node_types_list = \" or \".join(accepted_node_types)\n        assert (\n            tsnode.type in accepted_node_types\n        ), f\"Expected `tsnode` to have type {accepted_node_types_list}, but got {tsnode.type}.\"\n\n        type_node = tsnode.child_by_field_name(\"type\")\n        assert (\n            type_node is not None\n        ), \"Expected `tsnode` to have a child of name _type_. Typo? Wrong assumption about `tsnode`?\"\n\n        result = None\n        if type_node.type == \"struct_specifier\":\n            result = self.parse_nested_struct(tsnode)\n        elif type_node.type == \"union_specifier\":\n            result = self.parse_nested_union(tsnode)\n        if result is not None:\n            if self.with_extra:\n                # if anonymous struct/union, return the fields directly\n                if len(result.name) == 0:\n                    return result.fields\n                else:\n                    return [result]\n            else:\n                return [None]\n\n        t, constness, decl_node = self.parse_type(tsnode)\n\n        name = \"\"\n        if decl_node is not None:\n            # Check if we are dealing with a function pointer.\n            if decl_node.type == \"function_declarator\":\n                if self.with_extra:\n                    return [self.parse_func_pointer(tsnode)]\n                else:\n                    return [None]\n\n            # Otherwise assume that the first non-pointer declaration is the declaration\n            # for the identifier/field_identifier, or is None.\n            name = tsnode_text(decl_node)\n\n        return [Par(name, t, constness)]\n\n    def parse_nested_struct(self, tsnode: Node):\n        \"\"\"Returns a :class:`Struct` representing a nested structure if *tsnode*\n        has the right structure, or None otherwise.\n\n        :param tsnode:\n            An instance of Node that is expected to match:\n\n            .. code-block::\n\n                (field_declaration\n                    type:\n                        (struct_specifier body: (field_declaration_list)))\n\n        :return:\n            A :class:`Struct` if *tsnode* matches the above query or None otherwise.\n        \"\"\"\n        query_str = \"\"\"\n(field_declaration\n\ttype:\n        (struct_specifier body: (field_declaration_list))) @field\n\"\"\"\n        query_nested_struct_or_union = self.C_LANGUAGE.query(query_str)\n        caps = query_nested_struct_or_union.captures(tsnode)\n\n        # We don't want to match subtrees, we only want to match `tsnode`.\n        # Unfortunately, there is no way to do this given the current Tree sitter API,\n        # so we assume that the first match of type field_declaration is `tsnode`.\n        if not (len(caps) != 0 and caps[0][0].type == \"field_declaration\"):\n            return None\n\n        assert (\n            caps[0][0].id == tsnode.id\n        ), \"Assumed that the first capture was `tsnode`, but it is not the case.\"\n\n        type_node = tsnode.child_by_field_name(\"type\")\n        assert (\n            type_node is not None\n        ), \"Child _type_ should exist if `tsnode` matched the query.\"\n        body = type_node.child_by_field_name(\"body\")\n        assert (\n            body is not None\n        ), \"Child _body_ should exist if `tsnode` matched the query.\"\n\n        docs = self.parse_doxygen_comment(tsnode)\n        if docs is None:\n            docs = \"\"\n\n        declarator = tsnode.child_by_field_name(\"declarator\")\n        name = \"\" if declarator is None else tsnode_text(declarator)\n\n        fields = [\n            f\n            for decl in children_by_type(body, \"field_declaration\")\n            for f in self.parse_param(decl)\n            if f is not None\n        ]\n\n        return Struct(\n            name,\n            \"struct\",\n            fields,\n            docs,\n            file_=self.code_file.absolute(),\n            line=tsnode.start_point[0] + 1,\n        )\n\n    def parse_nested_union(self, tsnode: Node):\n        \"\"\"Returns a :class:`Union` representing a nested union if *tsnode*\n        has the right structure, or None otherwise.\n\n        :param tsnode:\n            An instance of Node that is expected to match:\n\n            .. code-block::\n\n                (field_declaration\n                    type:\n                        (union_specifier body: (field_declaration_list)))\n\n        :return:\n            A :class:`Union` if *tsnode* matches the above query or None otherwise.\n        \"\"\"\n        query_str = \"\"\"\n(field_declaration\n\ttype:\n        (union_specifier body: (field_declaration_list))) @field\n\"\"\"\n        query_nested_struct_or_union = self.C_LANGUAGE.query(query_str)\n        caps = query_nested_struct_or_union.captures(tsnode)\n\n        # We don't want to match subtrees, we only want to match `tsnode`.\n        # Unfortunately, there is no way to do this given the current Tree sitter API,\n        # so we assume that the first match of type field_declaration is `tsnode`.\n        if not (len(caps) != 0 and caps[0][0].type == \"field_declaration\"):\n            return None\n\n        assert (\n            caps[0][0].id == tsnode.id\n        ), \"Assumed that the first capture was `tsnode`, but it is not the case.\"\n\n        type_node = tsnode.child_by_field_name(\"type\")\n        assert (\n            type_node is not None\n        ), \"Child _type_ should exist if `tsnode` matched the query.\"\n        body = type_node.child_by_field_name(\"body\")\n        assert (\n            body is not None\n        ), \"Child _body_ should exist if `tsnode` matched the query.\"\n\n        docs = self.parse_doxygen_comment(tsnode)\n        if docs is None:\n            docs = \"\"\n\n        declarator = tsnode.child_by_field_name(\"declarator\")\n        name = \"\" if declarator is None else tsnode_text(declarator)\n\n        fields = [\n            f\n            for decl in children_by_type(body, \"field_declaration\")\n            for f in self.parse_param(decl)\n            if f is not None\n        ]\n\n        return Union(\n            name,\n            \"union\",\n            fields,\n            docs,\n            file_=self.code_file.absolute(),\n            line=tsnode.start_point[0] + 1,\n        )\n\n    def parse_structs(self):\n        struct_query = self.C_LANGUAGE.query(\"(struct_specifier) @struct\")\n        struct_captures = struct_query.captures(self.code_tstree.root_node)\n\n        structs = []\n        for node, _ in struct_captures:\n            parent = node.parent\n            name = \"\"\n            typ = \"struct\"\n            docs = \"\"\n            fields = []\n\n            # Add one because starts from zero by default\n            line = node.start_point[0] + 1\n\n            # Find and extract struct name\n            if parent is not None and parent.type == \"type_definition\":\n                type_id = parent.child_by_field_name(\"declarator\")\n                if type_id is not None and not type_id.is_missing:\n                    name = tsnode_text(type_id)\n            else:\n                type_id = node.child_by_field_name(\"name\")\n                if type_id is not None:\n                    name = tsnode_text(type_id)\n            # ignore if anonymous struct\n            if name == \"\":\n                continue\n            # ignore if not a struct from libvlc\n            if not name.startswith(\"libvlc_\"):\n                continue\n\n            # Find structs documentation\n            if parent is not None and parent.type == \"type_definition\":\n                docs = self.parse_doxygen_comment(parent)\n            else:\n                docs = self.parse_doxygen_comment(node)\n            if docs is None:\n                docs = \"\"\n\n            # Find struct's fields\n            body = node.child_by_field_name(\"body\")\n            if body is not None:\n                fields = [\n                    f\n                    for decl in children_by_type(body, \"field_declaration\")\n                    for f in self.parse_param(decl)\n                    if f is not None\n                ]\n\n            # Ignore empty structs\n            if len(fields) == 0:\n                continue\n\n            structs.append(\n                Struct(\n                    name, typ, fields, docs, file_=self.code_file.absolute(), line=line\n                )\n            )\n\n        return structs\n\n    def parse_funcs(self):\n        \"\"\"\n        :return: A list of :class:`Func` representing the top-level functions (without blacklisted ones).\n        \"\"\"\n        decl_query = self.C_LANGUAGE.query(\"(declaration) @decl\")\n        decl_captures = decl_query.captures(self.code_tstree.root_node)\n        func_query = self.C_LANGUAGE.query(\"(function_declarator) @func_decl\")\n        func_captures = []\n        for decl_node, _ in decl_captures:\n            func_decl_captures = func_query.captures(decl_node)\n            if len(func_decl_captures) >= 1:\n                func_captures.append((decl_node, func_decl_captures[0][0]))\n\n        funcs = []\n        for decl_node, func_decl_node in func_captures:\n            func_id_node = func_decl_node.child_by_field_name(\"declarator\")\n            assert (\n                func_id_node is not None\n            ), \"Expected `func_decl_node` to have a child of name _declarator_. Wrong query? Typo for child field name?\"\n            name = tsnode_text(func_id_node)\n\n            # Make the assumption that every function of interest starts with 'libvlc_'.\n            # Because the code parsed is the output of vlc.h's preprocessing, some signatures\n            # come from external libraries and are not part of libvlc's API.\n            if not name.startswith(\"libvlc_\"):\n                continue\n\n            type_node = decl_node.child_by_field_name(\"type\")\n            assert (\n                type_node is not None\n            ), \"Expected `decl_node` to have a child of name _type_.\"\n            return_type, _, _ = self.parse_type(decl_node)\n\n            deprecated = False\n            in_api = False\n            attributes = children_by_type(decl_node, \"attribute_specifier\")\n            ms_declspecs = children_by_type(decl_node, \"ms_declspec_modifier\")\n            for a in attributes + ms_declspecs:\n                a_txt = tsnode_text(a)\n                if is_deprecated_attr(a_txt):\n                    deprecated = True\n                if is_public_attr(a_txt):\n                    in_api = True\n\n            if not in_api:\n                continue\n\n            # Ignore if in blacklist\n            if name in _blacklist:\n                _blacklist[name] = return_type\n                continue\n\n            if deprecated:\n                _deprecated_funcs.append(name)\n\n            docs = self.parse_doxygen_comment(decl_node)\n            if docs is None:\n                docs = \"\"\n\n            params_nodes = func_decl_node.child_by_field_name(\"parameters\")\n            assert (\n                params_nodes is not None\n            ), \"Expected `func_decl_node` to have a child of name _parameters_. Wrong query? Typo for child field name?\"\n            params_decls = children_by_type(params_nodes, \"parameter_declaration\")\n            params = [\n                p\n                for param_decl in params_decls\n                for p in self.parse_param(param_decl)\n                if p is not None\n            ]\n            if (\n                len(params) == 1\n                and isinstance(params[0], Par)\n                and params[0].type == \"void\"\n            ):\n                params = []\n\n            funcs.append(\n                Func(\n                    name,\n                    return_type,\n                    params,\n                    docs,\n                    file_=self.code_file.absolute(),\n                    line=decl_node.start_point[0] + 1,\n                )\n            )\n\n        return funcs\n\n    def parse_version(self):\n        \"\"\"Get the libvlc version from the C header files:\n        LIBVLC_VERSION_MAJOR, _MINOR, _REVISION, _EXTRA\n        \"\"\"\n        macro_query = self.C_LANGUAGE.query(\"(preproc_def) @macro\")\n        macros = macro_query.captures(self.version_tstree.root_node)\n\n        version = None\n        version_numbers = {\n            \"LIBVLC_VERSION_MAJOR\": -1,\n            \"LIBVLC_VERSION_MINOR\": -1,\n            \"LIBVLC_VERSION_REVISION\": -1,\n            \"LIBVLC_VERSION_EXTRA\": -1,\n        }\n        for macro, _ in macros:\n            name = tsnode_text(macro.child_by_field_name(\"name\"))\n            if name in version_numbers:\n                version_numbers[name] = int(\n                    tsnode_text(macro.child_by_field_name(\"value\"))[1:-1]\n                )\n\n        if (\n            version_numbers[\"LIBVLC_VERSION_MAJOR\"] >= 0\n            and version_numbers[\"LIBVLC_VERSION_MINOR\"] >= 0\n            and version_numbers[\"LIBVLC_VERSION_REVISION\"] >= 0\n        ):\n            version = f\"{version_numbers['LIBVLC_VERSION_MAJOR']}.{version_numbers['LIBVLC_VERSION_MINOR']}.{version_numbers['LIBVLC_VERSION_REVISION']}\"\n            if version_numbers[\"LIBVLC_VERSION_EXTRA\"] > 0:\n                version += f\".{version_numbers['LIBVLC_VERSION_EXTRA']}\"\n\n        # Version was not found in include files themselves. Try other\n        # approaches.\n        if version is None:\n            # Try to get version information from git describe\n            git_dir = self.version_file.absolute().parents[2].joinpath(\".git\")\n            if git_dir.is_dir():\n                # We are in a git tree. Let's get the version information\n                # from there if we can call git\n                try:\n                    version = (\n                        subprocess.check_output(\n                            [\"git\", \"--git-dir=%s\" % git_dir.as_posix(), \"describe\"]\n                        )\n                        .strip()\n                        .decode(\"utf-8\")\n                    )\n                except:\n                    pass\n\n        return version\n\n\nclass LnKind(enum.Enum):\n    CLASS = 1\n    FUNC = 2\n    METH = 3\n\n    def __str__(self):\n        return self.name.lower()\n\n\nclass _Generator(object):\n    \"\"\"Generator base class.\"\"\"\n\n    comment_line = \"#\"  # Python\n    file = None\n    links: dict[str, tuple[str, LnKind]] = {}  # must be overloaded\n    outdir = \"\"\n    outpath = \"\"\n    type_re = None  # must be overloaded\n    type2class = {}  # must be overloaded\n    type2class_out = {}  # Specific values for OUT parameters\n\n    def __init__(self, parser: Parser):\n        self.parser = parser\n        for s in parser.structs:\n            self.name_to_classname(s)\n        for e in parser.enums:\n            self.name_to_classname(e)\n        for cb in parser.callbacks:\n            self.name_to_classname(cb)\n\n    def check_types(self):\n        \"\"\"Make sure that all types are properly translated.\"\"\"\n        e = _nerrors\n        for f in self.parser.funcs:\n            if f.type not in self.type2class:\n                errorf(\"no type conversion for %s %s\", f.type, f.name)\n            for p in f.pars:\n                if p.type not in self.type2class:\n                    errorf(\"no type conversion for %s %s in %s\", p.type, p.name, f.name)\n        errors(\"%s type conversion(s) missing\", e)\n\n    def class4(self, type, flag=None):\n        \"\"\"Return the class name for a type or enum.\"\"\"\n        cl = None\n        if flag == Flag.Out:\n            cl = self.type2class_out.get(type)\n        if cl is None:\n            cl = self.type2class.get(\n                type, \"FIXME_%s%s\" % (\"OUT_\" if flag == Flag.Out else \"\", type)\n            )\n        return cl\n\n    def name_to_classname(self, item):\n        \"\"\"Puts the Python class name corresponding to the\n        *item*'s name in ``self.type2class``.\n\n        :param item: An :class:`Enum`, :class:`Struct`, :class:`Union` or :class:`Func`.\n        \"\"\"\n        if item.name in self.type2class:\n            # Do not override predefined values\n            return\n\n        c = self.type_re.findall(item.name)\n        if c:\n            c = c[0][0]\n        else:\n            c = item.name\n        if \"_\" in c:\n            c = c.title().replace(\"_\", \"\")\n        elif c[0].islower():\n            c = c.capitalize()\n        self.type2class[item.name] = c\n        self.type2class[item.name + \"*\"] = f\"ctypes.POINTER({c})\"\n        self.type2class[item.name + \"**\"] = f\"ctypes.POINTER(ctypes.POINTER({c}))\"\n\n    def dump_dicts(self):  # for debug\n        s = _NL_ + _INDENT_\n        for n in (\"type2class\", \"prefixes\", \"links\"):\n            d = getattr(self, n, None)\n            if d:\n                n = [\"%s==== %s ==== %s\" % (_NL_, n, self.parser.bindings_version())]\n                sys.stderr.write(s.join(n + sorted(\"%s: %s\\n\" % t for t in d.items())))\n\n    def add_sphinx_cross_refs(self, docs, striprefix=None):\n        \"\"\"Make Sphinx cross references for functions, methods and classes in *docs*.\"\"\"\n\n        def _L(m):  # re.sub callback\n            t = m.group(0).replace(\"()\", \"\")\n            n = t.strip()\n\n            k, lnkind = self.links.get(n, (\"\", None))\n            if k:\n                if striprefix:\n                    k = striprefix(k)\n                t = t.replace(n, \":%s:`%s`\" % (lnkind, k))\n\n            return t\n\n        if self.links:\n            return libvlc_re.sub(_L, docs)\n        else:\n            return docs\n\n    def generate_enums(self):\n        raise TypeError(\"must be overloaded\")\n\n    def generate_structs(self):\n        raise TypeError(\"must be overloaded\")\n\n    def generate_funcs(self):\n        raise TypeError(\"must be overloaded\")\n\n    def generate_callbacks(self):\n        raise TypeError(\"must be overloaded\")\n\n    def generate_wrappers(self):\n        raise TypeError(\"must be overloaded\")\n\n    def insert_code(self, source, generate_items: bool = False):\n        \"\"\"Include code from source file.\"\"\"\n        f = opener(source)\n        for t in f:\n            if generate_items and t.startswith(_GENERATED_ENUMS_):\n                self.generate_enums()\n            elif generate_items and t.startswith(_GENERATED_STRUCTS_):\n                self.generate_structs()\n            elif generate_items and t.startswith(_GENERATED_CALLBACKS_):\n                self.generate_callbacks()\n            elif generate_items and t.startswith(_GENERATED_WRAPPERS_):\n                self.generate_wrappers()\n            elif generate_items and t.startswith(_GENERATED_FUNCTIONS_):\n                self.generate_funcs()\n            elif t.startswith(_BUILD_DATE_):\n                v = self.parser.version or _NA_\n                self.output('__version__ = \"%s\"' % (self.parser.bindings_version(),))\n                self.output('__libvlc_version__ = \"%s\"' % (v,))\n                self.output('__generator_version__ = \"%s\"' % (__version__,))\n                self.output('%s\"%s %s\"' % (_BUILD_DATE_, time.ctime(), v))\n            else:\n                self.output(t, nt=0)\n        f.close()\n\n    def outclose(self):\n        \"\"\"Close the output file.\"\"\"\n        if self.file not in (None, sys.stdout):\n            self.file.close()\n        self.file = None\n\n    def outopen(self, name):\n        \"\"\"Open an output file.\"\"\"\n        if self.file:\n            self.outclose()\n            raise IOError(\"file left open: %s\" % (self.outpath,))\n\n        if name in (\"-\", \"stdout\"):\n            self.outpath = \"stdout\"\n            self.file = sys.stdout\n        else:\n            self.outpath = os.path.join(self.outdir, name)\n            self.file = opener(self.outpath, \"w\")\n\n    def output(self, text, nl=0, nt=1):\n        \"\"\"Write to current output file.\"\"\"\n        assert self.file is not None, \"Can't output, self.file is None.\"\n\n        if nl:  # leading newlines\n            self.file.write(_NL_ * nl)\n        self.file.write(text)\n        if nt:  # trailing newlines\n            self.file.write(_NL_ * nt)\n\n    def unwrapped(self):\n        \"\"\"Report the unwrapped, deprecated and blacklisted functions.\"\"\"\n        b = [f for f, t in _blacklist.items() if t]\n        u = [f.name for f in self.parser.funcs if not f.wrapped]\n        c = self.comment_line\n        for f, t in (\n            (b, \"blacklisted\"),\n            (_deprecated_funcs, \"deprecated\"),\n            (u, \"not wrapped as methods\"),\n        ):\n            if f:\n                self.output(\"%s %d function(s) %s:\" % (c, len(f), t), nl=1)\n                self.output(_NL_.join(\"%s    %s\" % (c, f) for f in sorted(f)))\n\n\nclass PythonGenerator(_Generator):\n    \"\"\"Generate Python bindings.\"\"\"\n\n    type_re = re.compile(r\"libvlc_(.+?)(_t)?$\")  # Python\n\n    # C-type to Python/ctypes type conversion.\n    type2class = {\n        \"libvlc_audio_output_t*\": \"ctypes.POINTER(AudioOutput)\",\n        \"libvlc_event_t*\": \"ctypes.c_void_p\",\n        #'libvlc_callback_t':           'ctypes.c_void_p',\n        \"libvlc_dialog_id*\": \"ctypes.c_void_p\",\n        \"libvlc_drawable_t\": \"ctypes.c_uint\",  # FIXME?\n        \"libvlc_event_type_t\": \"ctypes.c_uint\",\n        \"libvlc_event_manager_t*\": \"EventManager\",\n        \"libvlc_instance_t*\": \"Instance\",\n        \"libvlc_log_t*\": \"Log_ptr\",\n        \"libvlc_log_iterator_t*\": \"LogIterator\",\n        \"libvlc_log_subscriber_t*\": \"ctypes.c_void_p\",  # Opaque struct, do not mess with it.\n        \"libvlc_log_message_t*\": \"ctypes.POINTER(LogMessage)\",\n        \"libvlc_media_track_t**\": \"ctypes.POINTER(MediaTrack)\",\n        \"libvlc_media_track_t***\": \"ctypes.POINTER(ctypes.POINTER(MediaTrack))\",\n        \"libvlc_media_t*\": \"Media\",\n        \"libvlc_media_discoverer_t*\": \"MediaDiscoverer\",\n        \"libvlc_media_discoverer_description_t**\": \"ctypes.POINTER(ctypes.POINTER(MediaDiscovererDescription))\",\n        \"libvlc_media_discoverer_description_t***\": \"ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(MediaDiscovererDescription)))\",\n        \"libvlc_media_library_t*\": \"MediaLibrary\",\n        \"libvlc_media_list_t*\": \"MediaList\",\n        \"libvlc_media_list_player_t*\": \"MediaListPlayer\",\n        \"libvlc_media_list_view_t*\": \"MediaListView\",\n        \"libvlc_media_player_t*\": \"MediaPlayer\",\n        \"libvlc_video_viewpoint_t*\": \"ctypes.POINTER(VideoViewpoint)\",\n        \"libvlc_media_stats_t*\": \"ctypes.POINTER(MediaStats)\",\n        \"libvlc_picture_t*\": \"Picture\",\n        \"libvlc_media_thumbnail_request_t*\": \"MediaThumbnailRequest\",  # Opaque struct, do not mess with it.\n        \"libvlc_renderer_item_t*\": \"Renderer\",\n        \"libvlc_renderer_discoverer_t*\": \"RendererDiscoverer\",\n        \"libvlc_rd_description_t**\": \"ctypes.POINTER(ctypes.POINTER(RdDescription))\",\n        \"libvlc_rd_description_t***\": \"ctypes.POINTER(ctypes.POINTER(ctypes.POINTER(RdDescription)))\",\n        \"libvlc_media_track_info_t**\": \"ctypes.POINTER(ctypes.c_void_p)\",\n        \"libvlc_rectangle_t*\": \"ctypes.POINTER(Rectangle)\",\n        \"libvlc_time_t\": \"ctypes.c_longlong\",\n        \"libvlc_track_description_t*\": \"ctypes.POINTER(TrackDescription)\",\n        \"libvlc_title_description_t**\": \"ctypes.POINTER(TitleDescription)\",\n        \"libvlc_title_description_t***\": \"ctypes.POINTER(ctypes.POINTER(TitleDescription))\",\n        \"libvlc_chapter_description_t**\": \"ctypes.POINTER(ChapterDescription)\",\n        \"libvlc_chapter_description_t***\": \"ctypes.POINTER(ctypes.POINTER(ChapterDescription))\",\n        \"libvlc_module_description_t*\": \"ctypes.POINTER(ModuleDescription)\",\n        \"libvlc_audio_output_device_t*\": \"ctypes.POINTER(AudioOutputDevice)\",\n        \"libvlc_equalizer_t*\": \"AudioEqualizer\",\n        \"libvlc_media_slave_t**\": \"ctypes.POINTER(MediaSlave)\",\n        \"libvlc_media_slave_t***\": \"ctypes.POINTER(ctypes.POINTER(MediaSlave))\",\n        \"libvlc_video_direct3d_device_setup_t*\": \"Direct3dDeviceSetup\",\n        \"libvlc_video_direct3d_device_cfg_t*\": \"Direct3dDeviceCfg\",\n        \"libvlc_video_direct3d_cfg_t*\": \"Direct3dCfg\",\n        \"libvlc_video_output_cfg_t*\": \"VideoOutputCfg\",\n        \"libvlc_video_setup_device_cfg_t*\": \"VideoSetupDeviceCfg\",\n        \"libvlc_video_setup_device_info_t*\": \"VideoSetupDeviceInfo\",\n        \"libvlc_video_render_cfg_t*\": \"VideoRenderCfg\",\n        \"libvlc_video_direct3d_hdr10_metadata_t*\": \"Direct3dHdr10Metadata\",\n        \"libvlc_media_tracklist_t*\": \"ctypes.c_void_p\",  # Opaque struct, do not mess with it.\n        \"libvlc_media_programlist_t*\": \"ctypes.c_void_p\",  # Opaque struct, do not mess with it.\n        \"libvlc_player_programlist_t*\": \"ctypes.c_void_p\",  # Opaque struct, do not mess with it.\n        \"libvlc_picture_list_t*\": \"ctypes.c_void_p\",  # Opaque struct, do not mess with it.\n        # FIXME Temporary fix to generate valid code for the mapping of\n        # libvlc_media_read_cb\n        \"ptrdiff_t\": \"ctypes.c_void_p\",\n        \"FILE*\": \"FILE_ptr\",\n        \"...\": \"ctypes.c_void_p\",\n        \"va_list\": \"ctypes.c_void_p\",\n        \"char*\": \"ctypes.c_char_p\",\n        \"unsigned char*\": \"ctypes.c_char_p\",\n        \"_Bool\": \"ctypes.c_bool\",\n        \"_Bool*\": \"ctypes.POINTER(ctypes.c_bool)\",\n        \"char**\": \"ListPOINTER(ctypes.c_char_p)\",\n        \"char***\": \"ctypes.POINTER(ListPOINTER(ctypes.c_char_p))\",\n        \"double\": \"ctypes.c_double\",\n        \"double*\": \"ctypes.POINTER(ctypes.c_double)\",\n        \"float\": \"ctypes.c_float\",\n        \"int\": \"ctypes.c_int\",\n        \"int*\": \"ctypes.POINTER(ctypes.c_int)\",  # _video_get_cursor\n        \"uintptr_t*\": \"ctypes.POINTER(ctypes.c_uint)\",\n        \"uint16_t\": \"ctypes.c_uint16\",\n        \"int64_t\": \"ctypes.c_int64\",\n        \"int64_t*\": \"ctypes.POINTER(ctypes.c_int64)\",\n        \"uint64_t\": \"ctypes.c_uint64\",\n        \"uint64_t*\": \"ctypes.POINTER(ctypes.c_uint64)\",\n        \"short\": \"ctypes.c_short\",\n        \"uint32_t\": \"ctypes.c_uint32\",\n        \"ssize_t\": \"ctypes.c_ssize_t\",\n        \"size_t\": \"ctypes.c_size_t\",\n        \"size_t*\": \"ctypes.POINTER(ctypes.c_size_t)\",\n        \"ssize_t*\": \"ctypes.POINTER(ctypes.c_ssize_t)\",\n        \"unsigned\": \"ctypes.c_uint\",\n        \"unsigned int\": \"ctypes.c_uint\",\n        \"unsigned*\": \"ctypes.POINTER(ctypes.c_uint)\",  # _video_get_size\n        \"void\": \"None\",\n        \"void*\": \"ctypes.c_void_p\",\n        \"void**\": \"ctypes.POINTER(ctypes.c_void_p)\",\n        \"WINDOWHANDLE\": \"ctypes.c_ulong\",\n    }\n\n    type2class_out = {\n        \"char**\": \"ctypes.POINTER(ctypes.c_char_p)\",\n        \"unsigned char*\": \"ctypes.POINTER(ctypes.c_char)\",\n    }\n\n    # Python classes, i.e. classes for which we want to\n    # generate class wrappers around libvlc functions\n    defined_classes = (\n        \"AudioEqualizer\",\n        \"EventManager\",\n        \"Instance\",\n        \"Log\",\n        \"LogIterator\",\n        \"Media\",\n        \"MediaDiscoverer\",\n        \"MediaLibrary\",\n        \"MediaList\",\n        \"MediaListPlayer\",\n        \"MediaListView\",\n        \"MediaPlayer\",\n        \"Picture\",\n        \"Renderer\",\n        \"RendererDiscoverer\",\n    )\n\n    def __init__(self, parser: Parser):\n        \"\"\"\n        :param parser: a :class:`Parser` instance.\n        \"\"\"\n        _Generator.__init__(self, parser)\n\n        # Load override definitions\n        self.overrides = self.parse_override(os.path.join(TEMPLATEDIR, \"override.py\"))\n\n        # one special enum type class\n        self.type2class[\"libvlc_event_e\"] = \"EventType\"\n        # doc links to functions, methods and types\n        self.links = {\"libvlc_event_e\": (\"EventType\", LnKind.CLASS)}\n        # link enum value names to enum type/class\n        for t in self.parser.enums:\n            self.links[t.name] = (self.class4(t.name), LnKind.CLASS)\n        # prefixes to strip from method names\n        # when wrapping them into class methods\n        self.prefixes = {}\n        for t, c in self.type2class.items():\n            t = t.rstrip(\"*\")\n            if c in self.defined_classes:\n                self.links[t] = (c, LnKind.CLASS)\n                self.prefixes[c] = t[:-1]\n            elif c.startswith(\"ctypes.POINTER(\"):\n                c = c.replace(\"ctypes.POINTER(\", \"\").rstrip(\")\")\n                if c[:1].isupper():\n                    self.links[t] = (c, LnKind.CLASS)\n\n        # We have to hardcode this one, which is not regular in vlc headers\n        self.prefixes[\"AudioEqualizer\"] = \"libvlc_audio_equalizer_\"\n\n        for f in self.parser.funcs:\n            self.links[f.name] = (f.name, LnKind.FUNC)\n        self.check_types()\n\n    def generate_docstring(self, docs: str, indent_lvl: int = 0):\n        if docs:\n            indent = _INDENT_ * indent_lvl\n            lines = docs.splitlines()\n            self.output(f\"{indent}{_INDENT_}'''{lines[0]}\")\n            for line in lines[1:]:\n                self.output(f\"{indent}{_INDENT_}{line}\")\n            self.output(f\"{indent}{_INDENT_}'''\")\n\n    def generate_funcs(self):\n        \"\"\"Generate a ctypes decorator for all functions.\"\"\"\n        for f in self.parser.funcs:\n            name = f.name\n\n            # NOTE: `docs_in_sphinx_format` must be called before the `flags` method\n            # of `Par` instances, because it fills the `out` member (and other members)\n            # of the `Func`. If called after, `out` will be empty, resulting in missing\n            # out parameters in the bindings.\n            docs = self.add_sphinx_cross_refs(f.docs_in_sphinx_format())\n\n            # make decorators for parameters that are function pointers\n            pfs = {}\n            for p in f.pars:\n                if isinstance(p, Func):\n                    decorator_name = snake_to_camel_case(f\"{name}_{p.name}\")\n                    if decorator_name[\n                        0\n                    ].islower():  # decorator_name shouldn't be empty, so no check\n                        decorator_name = (\n                            decorator_name[0].capitalize() + decorator_name[1:]\n                        )\n\n                    pfs[p.name] = decorator_name\n\n                    self.generate_func_pointer_decorator(\n                        p, replacement_name=decorator_name\n                    )\n\n            # arg names, excluding output args\n            args = \", \".join(f.args())\n\n            # tuples of arg flags\n            flags = \", \".join(str(p.flags(f.out)) for p in f.pars)\n            if flags:\n                flags += \",\"\n\n            # arg classes\n            types = [\n                self.class4(p.type, p.flags(f.out)[0])\n                if p.name not in pfs\n                else pfs[p.name]\n                for p in f.pars\n            ]\n\n            # result type\n            rtype = self.class4(f.type)\n\n            if name in free_string_funcs:\n                # some functions that return strings need special treatment\n                if rtype != \"ctypes.c_char_p\":\n                    raise TypeError(\n                        \"Function %s expected to return char* not %s\" % (name, f.type)\n                    )\n                errcheck = \"string_result\"\n                types = [\"ctypes.c_void_p\"] + types\n            elif rtype in self.defined_classes:\n                # if the result is a pointer to one of the defined\n                # classes then we tell ctypes that the return type is\n                # ctypes.c_void_p so that 64-bit pointers are handled\n                # correctly, and then create a Python object of the\n                # result\n                errcheck = \"class_result(%s)\" % rtype\n                types = [\"ctypes.c_void_p\"] + types\n            else:\n                errcheck = \"None\"\n                types.insert(0, rtype)\n\n            types = \", \".join(types)\n\n            self.output(f\"def {name}({args}):\")\n            self.generate_docstring(docs)\n            self.output(\n                f\"\"\"{_INDENT_}f = _Cfunctions.get('{name}', None) or \\\\\n{_INDENT_}_Cfunction('{name}', ({flags}), {errcheck}, {types})\n{_INDENT_}return f({args})\n\"\"\"\n            )\n\n    def generate_enums(self):\n        \"\"\"Generate classes for all enum types.\"\"\"\n        for e in self.parser.enums:\n            cls = self.class4(e.name)\n            docs = self.add_sphinx_cross_refs(e.docs_in_sphinx_format())\n            # Add names in generated docstring\n            # so that they are available in Sphinx-generated doc\n            symbols = _NL_.join(\n                [\n                    f\"\"\"  * ``vlc.{cls}.{v.name}`` { e.base_sphinx_format_str(v.docs) }\"\"\"\n                    for v in e.vals\n                ]\n            )\n            docs = f\"\"\"{docs}\n\nDefined symbols:\n{symbols}\n\"\"\"\n            self.output(f\"class {cls}(_Enum):\")\n            self.generate_docstring(docs)\n            self.output(_INDENT_ + \"_enum_names_ = {\")\n\n            for v in e.vals:\n                self.output(f\"{_INDENT_ * 2}{v.value}: '{v.name}',\")\n            self.output(_INDENT_ + \"}\")\n\n            t = [f\"{cls}.{v.name} = {cls}({v.value})\" for v in e.vals]\n            self.output(_NL_.join(sorted(t)), nt=2)\n\n    def generate_func_pointer_decorator(\n        self, pf: Func, indent_lvl: int = 0, replacement_name: str = \"\"\n    ):\n        \"\"\"Generates a declarator for a struct/union field that is a function pointer.\n\n        :param pf: A field that is a function pointer (instance of :class:`Func`).\n        :param indent_lvl: A positive integer representing how many indentations\n            should precede each line generated.\n        \"\"\"\n        indent = _INDENT_ * indent_lvl\n        name = replacement_name if replacement_name else self.class4(pf.name)\n\n        # NOTE: `docs_in_sphinx_format` must be called before the `flags` method\n        # of `Par` instances, because it fills the `out` member (and other members)\n        # of the `Func`. If called after, `out` will be empty, resulting in missing\n        # out parameters in the bindings.\n        docs = self.add_sphinx_cross_refs(pf.docs_in_sphinx_format())\n\n        # return value and arg classes\n        types = \", \".join(\n            [self.class4(pf.type)]\n            + [self.class4(p.type, p.flags(pf.out)[0]) for p in pf.pars]\n        )\n\n        self.output(f\"{indent}{name} = ctypes.CFUNCTYPE({types})\")\n        if docs:\n            self.output(f\"{indent}{name}.__doc__ = '''{docs}'''\")\n        self.output(\"\")\n\n    def generate_event_union_wrapper(self, wrapper_classname: str):\n        self.output(\n            f'''class {wrapper_classname}(ctypes.Union):\n    \"\"\"A wrapper around the nested union :class:`Event.U` for backard compatibility.\"\"\"\n\n    _fields_ = [\n        (\"meta_type\", ctypes.c_uint),\n        (\"new_child\", ctypes.c_uint),\n        (\"new_duration\", ctypes.c_longlong),\n        (\"new_status\", ctypes.c_int),\n        (\"media\", ctypes.c_void_p),\n        (\"new_state\", ctypes.c_uint),\n        # FIXME: Media instance\n        (\"new_cache\", ctypes.c_float),\n        (\"new_position\", ctypes.c_float),\n        (\"new_time\", ctypes.c_longlong),\n        (\"new_title\", ctypes.c_int),\n        (\"new_seekable\", ctypes.c_longlong),\n        (\"new_pausable\", ctypes.c_longlong),\n        (\"new_scrambled\", ctypes.c_longlong),\n        (\"new_count\", ctypes.c_longlong),\n        # FIXME: Skipped MediaList and MediaListView...\n        (\"filename\", ctypes.c_char_p),\n        (\"new_length\", ctypes.c_longlong),\n    ]\n            '''\n        )\n\n    def generate_struct(self, struct: Struct, indent_lvl: int = 0):\n        \"\"\"Outputs a binding for *struct*.\n\n        :param struct: The :class:`Struct` instance for which to output the binding.\n        :param indent_lvl: A positive integer representing how many indentations\n            should precede each line generated.\n        \"\"\"\n        indent = _INDENT_ * indent_lvl\n        cls = self.class4(struct.name)\n\n        # We use a forward declaration here to allow for self-referencing structures - cf\n        # https://docs.python.org/3/library/ctypes.html#ctypes.Structure._fields_\n        self.output(f\"{indent}class {cls}(_Cstruct):\")\n        docs = self.add_sphinx_cross_refs(struct.docs_in_sphinx_format())\n        self.generate_docstring(docs, indent_lvl)\n\n        for field in struct.fields:\n            if isinstance(field, Struct):\n                self.name_to_classname(field)\n                self.generate_struct(field, indent_lvl + 1)\n            elif isinstance(field, Union):\n                self.name_to_classname(field)\n                self.generate_union(field, indent_lvl + 1)\n            elif isinstance(field, Func):\n                self.name_to_classname(field)\n                self.generate_func_pointer_decorator(field, indent_lvl + 1)\n\n        self.output(f\"{indent}{_INDENT_}pass{_NL_}\")\n\n        # We can override struct definitions (for tricky ones) in override.py\n        if cls in self.overrides.codes:\n            # Assume the overriding definition contains all code in .codes\n            self.output(self.overrides.codes[cls])\n        else:\n            # For backward-compatibility, we make a wrapper around\n            # the nested union in 'Event' so as to flatten/ignore\n            # the nested structs within it, as was done in\n            # the harcoded 'EventUnion' before.\n            event_union_wrapper = \"EventUnion\"\n            if cls == \"Event\":\n                self.generate_event_union_wrapper(event_union_wrapper)\n\n            self.output(f\"{indent}{cls}._fields_ = (\")\n\n            for field in struct.fields:\n                field_type = self.class4(field.type)\n                if (\n                    isinstance(field, Struct)\n                    or isinstance(field, Union)\n                    or isinstance(field, Func)\n                ):\n                    field_type = f\"{cls}.{self.class4(field.name)}\"\n\n                # Special case!\n                #\n                # For the struct 'Event', the field 'type' is given the\n                # type 'int' in libvlc, but it should be an 'EventType'.\n                #\n                # It was handled in override.py before, also because the\n                # field 'u' was a complicated nested union to parse for\n                # the regex-based version of this generator (that union\n                # was hardcoded in header.py, and called 'EventUnion').\n                #\n                # Now we can handle the complicated union but still\n                # want to keep the little fix of 'type', which can't\n                # be applied generally.\n                if cls == \"Event\" and field.name == \"type\":\n                    field_type = \"EventType\"\n                # Use wrapper for the nested union for backward compatibility.\n                if cls == \"Event\" and field.name == \"u\":\n                    field_type = event_union_wrapper\n\n                # FIXME: For now, ignore field if it's type is one of the wrapper classes.\n                if field_type in self.defined_classes:\n                    continue\n\n                # Strip the polish-notation prefixes from entries, to\n                # preserve compatibility in 3.x series.\n                # Preserve them in 4.x series, because it will be more consistent with the native libvlc API.\n                # See https://github.com/oaubert/python-vlc/issues/174\n                self.output(\n                    \"%s%s('%s', %s),\"\n                    % (\n                        indent,\n                        _INDENT_,\n                        re.sub(\"^(i_|f_|p_|psz_)\", \"\", field.name)\n                        if self.parser.version < \"4\"\n                        else field.name,\n                        field_type,\n                    )\n                )\n            self.output(f\"{indent}){_NL_}\")\n\n    def generate_union(self, union: Union, indent_lvl: int = 0):\n        \"\"\"Outputs a binding for *union*.\n\n        :param union: The :class:`Union` instance for which to output the binding.\n        :param indent_lvl: A positive integer representing how many indentations\n            should precede each line generated.\n        \"\"\"\n        indent = _INDENT_ * indent_lvl\n        cls = self.class4(union.name)\n\n        # We use a forward declaration here to allow for self-referencing structures - cf\n        # https://docs.python.org/3/library/ctypes.html#ctypes.Structure._fields_\n        self.output(f\"{indent}class {cls}(ctypes.Union):\")\n        docs = self.add_sphinx_cross_refs(union.docs_in_sphinx_format())\n        self.generate_docstring(docs, indent_lvl)\n\n        for field in union.fields:\n            if isinstance(field, Struct):\n                self.name_to_classname(field)\n                self.generate_struct(field, indent_lvl + 1)\n            elif isinstance(field, Union):\n                self.name_to_classname(field)\n                self.generate_union(field, indent_lvl + 1)\n            elif isinstance(field, Func):\n                self.name_to_classname(field)\n                self.generate_func_pointer_decorator(field, indent_lvl + 1)\n\n        self.output(f\"{indent}{_INDENT_}pass{_NL_}\")\n\n        self.output(f\"{indent}{cls}._fields_ = (\")\n\n        for field in union.fields:\n            field_type = self.class4(field.type)\n            if (\n                isinstance(field, Struct)\n                or isinstance(field, Union)\n                or isinstance(field, Func)\n            ):\n                field_type = f\"{cls}.{self.class4(field.name)}\"\n\n            # FIXME: For now, ignore field if it's type is one of the wrapper classes.\n            if field_type in self.defined_classes:\n                continue\n\n            # Strip the polish-notation prefixes from entries, to\n            # preserve compatibility in 3.x series.\n            # Preserve them in 4.x series, because it will be more consistent with the native libvlc API.\n            # See https://github.com/oaubert/python-vlc/issues/174\n            self.output(\n                \"%s%s('%s', %s),\"\n                % (\n                    indent,\n                    _INDENT_,\n                    re.sub(\"^(i_|f_|p_|psz_)\", \"\", field.name)\n                    if self.parser.version < \"4\"\n                    else field.name,\n                    field_type,\n                )\n            )\n        self.output(f\"{indent}){_NL_}\")\n\n    def generate_callback_class(self, cb: Func):\n        \"\"\"Outputs a class for *cb*.\n\n        :param cb: The :class:`Func` instance for which to output a corresponding class.\n        \"\"\"\n        if cb.name in _blacklist:\n            return\n\n        name = self.class4(cb.name)\n        docs = self.add_sphinx_cross_refs(cb.docs_in_sphinx_format())\n        self.output(f\"class {name}(ctypes.c_void_p):\")\n        self.generate_docstring(docs)\n        self.output(f\"{_INDENT_}pass{_NL_}\")\n\n    def generate_structs(self):\n        \"\"\"Generate classes for all structs types.\"\"\"\n        for struct in self.parser.structs:\n            self.generate_struct(struct)\n\n    def generate_callbacks(self):\n        \"\"\"Generate decorators for callback functions.\n\n        We generate both decorators (for defining functions) and\n        associated classes, to help in defining function signatures.\n        \"\"\"\n        if not self.parser.callbacks:\n            return\n\n        for cb in self.parser.callbacks:\n            self.generate_callback_class(cb)\n\n        self.output(f\"\"\"class CallbackDecorators(object):\n{_INDENT_}'''Class holding various method decorators for callback functions.'''\n\"\"\")\n        for cb in self.parser.callbacks:\n            self.generate_func_pointer_decorator(cb, 1)\n\n        self.output(\"cb = CallbackDecorators\")\n\n    def generate_wrappers(self):\n        \"\"\"Generate class wrappers for all appropriate functions.\"\"\"\n\n        def striprefix(name):\n            return name.replace(x, \"\").replace(\"libvlc_\", \"\")\n\n        # sort functions on the type/class\n        # of their first parameter\n        t = []\n        for f in self.parser.funcs:\n            if f.pars:\n                p = f.pars[0]\n                c = self.class4(p.type)\n                if c in self.defined_classes:\n                    t.append((c, f))\n\n        cls = x = \"\"  # wrap functions in class methods\n        for c, f in sorted(t, key=operator.itemgetter(0)):\n            if cls != c:\n                cls = c\n                self.output(f\"class {cls}(_Ctype):\")\n                docs = self.overrides.docstrs.get(cls, \"\")\n                if docs:\n                    self.output(f\"{_INDENT_}'''{docs}{_NL_}{_INDENT_}'''\")\n\n                c = self.overrides.codes.get(cls, \"\")\n                if \"def __new__\" not in c:\n                    self.output(\"\"\"\n    def __new__(cls, ptr=_internal_guard):\n        '''(INTERNAL) ctypes wrapper constructor.\n        '''\n        return _Constructor(cls, ptr)\"\"\")\n\n                if c:\n                    self.output(c)\n                x = self.prefixes.get(cls, \"libvlc_\")\n\n            f.wrapped += 1\n            name = f.name\n\n            # method name is function name less prefix\n            meth = striprefix(name)\n            if meth in self.overrides.methods.get(cls, []):\n                continue  # overridden\n\n            # arg names, excluding output args\n            # and rename first arg to 'self'\n            args = \", \".join([\"self\"] + f.args(1))\n            wrapped_args = \", \".join(\n                [\"self\"]\n                + [\n                    (\"str_to_bytes(%s)\" % pa.name if pa.type == \"char*\" else pa.name)\n                    for pa in f.in_params(1)\n                ]\n            )\n\n            docs = self.add_sphinx_cross_refs(\n                f.docs_in_sphinx_format(1), striprefix\n            ).strip()\n            if meth.endswith(\"event_manager\"):\n                self.output(f\"{_INDENT_}@memoize_parameterless\")\n            self.output(f\"{_INDENT_}def {meth}({args}):\")\n            self.generate_docstring(docs, indent_lvl=1)\n            self.output(f\"{_INDENT_ * 2}return {name}({wrapped_args}){_NL_}\")\n\n            # check for some standard methods\n            if meth == \"count\":\n                # has a count method, generate __len__\n                self.output(\n                    \"\"\"    def __len__(self):\n        return %s(self)\n\"\"\"\n                    % (name,)\n                )\n            elif meth.endswith(\"item_at_index\"):\n                # indexable (and thus iterable)\n                self.output(\n                    \"\"\"    def __getitem__(self, i):\n        return %s(self, i)\n\n    def __iter__(self):\n        for i in range(len(self)):\n            yield self[i]\n\"\"\"\n                    % (name,)\n                )\n\n    def parse_override(self, override):\n        \"\"\"Parse the override definitions file.\n\n        It is possible to override methods definitions in classes.\n\n        :param override: the ``override.py`` file name.\n\n        :return: a tuple (codes, methods, docstrs) of 3 dicts\n            containing the source code, the method names and the\n            class-level doc strings for each of the classes defined\n            in the *override* file.\n        \"\"\"\n        codes = {}\n        k, v = None, []\n        f = opener(override)\n        for t in f:\n            m = class_re.match(t)\n            if m:  # new class\n                if k is not None:\n                    codes[k] = \"\".join(v)\n                k, v = m.group(1), []\n            else:\n                v.append(t)\n        if k is not None:\n            codes[k] = \"\".join(v)\n        f.close()\n\n        docstrs, methods = {}, {}\n        for k, v in codes.items():\n            q = v.lstrip()[:3]\n            if q in ('\"\"\"', \"'''\"):\n                # use class comment as doc string\n                _, docstrs[k], v = v.split(q, 2)\n                codes[k] = v\n            # FIXME: not robust wrt. internal methods\n            methods[k] = def_re.findall(v)\n\n        return Overrides(codes=codes, methods=methods, docstrs=docstrs)\n\n    def save(self, path=None, format=True):\n        \"\"\"Write Python bindings to a file or ``stdout``.\n\n        and optionally format it with ruff.\n        \"\"\"\n        self.outopen(path or \"-\")\n        self.insert_code(os.path.join(TEMPLATEDIR, \"header.py\"), generate_items=True)\n        self.unwrapped()\n        self.insert_code(os.path.join(TEMPLATEDIR, \"footer.py\"))\n        self.outclose()\n\n        if path and path != \"-\" and path != \"stdout\" and format:\n            # Format the generated file using ruff\n            completed_process = subprocess.run(\n                [\n                    \"ruff\",\n                    \"format\",\n                    \"--config\",\n                    RUFF_CFG_FILE,\n                    path,\n                ],\n                stdout=subprocess.DEVNULL,\n            )\n            completed_process.check_returncode()\n            completed_process = subprocess.run(\n                [\n                    \"ruff\",\n                    \"check\",\n                    \"--fix\",\n                    \"--exit-zero\",\n                    \"--config\",\n                    RUFF_CFG_FILE,\n                    path,\n                ],\n                stdout=subprocess.DEVNULL,\n            )\n            completed_process.check_returncode()\n\n\nclass JavaGenerator(_Generator):\n    \"\"\"Generate Java/JNA bindings.\"\"\"\n\n    comment_line = \"//\"\n    type_re = re.compile(r\"libvlc_(.+?)(_[te])?$\")\n\n    # C-type to Java/JNA type conversion.\n    type2class = {\n        \"libvlc_audio_output_t*\": \"LibVlcAudioOutput\",\n        \"libvlc_callback_t\": \"LibVlcCallback\",\n        \"libvlc_event_type_t\": \"LibvlcEventType\",\n        \"libvlc_event_manager_t*\": \"LibVlcEventManager\",\n        \"libvlc_instance_t*\": \"LibVlcInstance\",\n        \"libvlc_log_t*\": \"LibVlcLog\",\n        \"libvlc_log_iterator_t*\": \"LibVlcLogIterator\",\n        \"libvlc_log_message_t*\": \"LibvlcLogMessage\",\n        \"libvlc_media_t*\": \"LibVlcMedia\",\n        \"libvlc_media_discoverer_t*\": \"LibVlcMediaDiscoverer\",\n        \"libvlc_media_library_t*\": \"LibVlcMediaLibrary\",\n        \"libvlc_media_list_t*\": \"LibVlcMediaList\",\n        \"libvlc_media_list_player_t*\": \"LibVlcMediaListPlayer\",\n        \"libvlc_media_list_view_t*\": \"LibVlcMediaListView\",\n        \"libvlc_media_player_t*\": \"LibVlcMediaPlayer\",\n        \"libvlc_media_stats_t*\": \"LibVlcMediaStats\",\n        \"libvlc_media_track_info_t**\": \"LibVlcMediaTrackInfo\",\n        \"libvlc_time_t\": \"long\",\n        \"libvlc_track_description_t*\": \"LibVlcTrackDescription\",\n        \"...\": \"FIXME_va_list\",\n        \"char*\": \"String\",\n        \"char**\": \"String[]\",\n        \"float\": \"float\",\n        \"int\": \"int\",\n        \"int*\": \"Pointer\",\n        \"int64_t\": \"long\",\n        \"short\": \"short\",\n        \"uint32_t\": \"uint32\",\n        \"unsigned\": \"int\",\n        \"unsigned*\": \"Pointer\",\n        \"void\": \"void\",\n        \"void*\": \"Pointer\",\n    }\n\n    def __init__(self, parser: Parser):\n        \"\"\"\n        :param parser: a :class:`Parser` instance.\n        \"\"\"\n        _Generator.__init__(self, parser)\n        self.check_types()\n\n    def generate_enums(self):\n        \"\"\"Generate Java/JNA glue code for enums.\"\"\"\n        for e in self.parser.enums:\n            j = self.class4(e.name)\n            self.outopen(j + \".java\")\n\n            self.insert_code(os.path.join(TEMPLATEDIR, \"boilerplate.java\"))\n            self.output(\n                \"\"\"package org.videolan.jvlc.internal;\n\npublic enum %s\n{\"\"\"\n                % (j,)\n            )\n            # FIXME: write comment\n            for v in e.vals:\n                self.output(\"        %s (%s),\" % (v.name, v.value))\n            self.output(\n                \"\"\"\n        private final int _value;\n        %s(int value) { this._value = value; }\n        public int value() { return this._value; }\n}\"\"\"\n                % (j,)\n            )\n            self.outclose()\n\n    def generate_header(self):\n        \"\"\"Generate LibVlc header.\"\"\"\n        for c, j in sorted(self.type2class.items()):\n            if c.endswith(\"*\") and j.startswith(\"LibVlc\"):\n                self.output(\n                    \"\"\"\n    public class %s extends PointerType\n    {\n    }\"\"\"\n                    % (j,)\n                )\n\n    def generate_libvlc(self):\n        \"\"\"Generate LibVlc.java Java/JNA glue code.\"\"\"\n        self.outopen(\"LibVlc.java\")\n\n        self.insert_code(os.path.join(TEMPLATEDIR, \"boilerplate.java\"))\n        self.insert_code(os.path.join(TEMPLATEDIR, \"LibVlc-header.java\"))\n\n        self.generate_header()\n        for f in self.parser.funcs:\n            f.wrapped = 1  # for now\n            p = \", \".join(\"%s %s\" % (self.class4(p.type), p.name) for p in f.pars)\n            self.output(\"%s %s(%s);\" % (self.class4(f.type), f.name, p), nt=2)\n\n        self.insert_code(os.path.join(TEMPLATEDIR, \"LibVlc-footer.java\"))\n\n        self.unwrapped()\n        self.outclose()\n\n    def save(self, dir=None, format=True):\n        \"\"\"Write Java bindings into the given directory.\"\"\"\n        if dir in (None, \"-\"):\n            d = \"internal\"\n            if not os.path.isdir(d):\n                os.makedirs(d)  # os.mkdir(d)\n        else:\n            d = dir or os.curdir\n        self.outdir = d\n\n        sys.stderr.write(\"Generating Java code in %s...\\n\" % os.path.join(d, \"\"))\n\n        self.generate_enums()\n        self.generate_libvlc()\n\n\ndef preprocess(vlc_h: Path) -> Path:\n    if vlc_h.name != \"vlc.h\":\n        raise Exception(\n            f\"Except input file to be (and end with) vlc.h, but got {vlc_h.absolute()}.\"\n        )\n\n    preprocessed_dir = Path(PREPROCESSEDDIR)\n    if not (preprocessed_dir.exists() and preprocessed_dir.is_dir()):\n        preprocessed_dir.mkdir(parents=True)\n    if not (preprocessed_dir.exists() and preprocessed_dir.is_dir()):\n        logger.error(\"Cannot create directory for preprocessed data\")\n        sys.exit(1)\n\n    preprocessed_file = Path(f\"{PREPROCESSEDDIR}/vlc.preprocessed\")\n    # call C preprocessor on vlc.h\n    completed_process = subprocess.run(\n        [\n            \"gcc\",\n            \"-E\",\n            \"-P\",\n            \"-C\",\n            \"-I\",\n            vlc_h.parent.parent.absolute(),\n            vlc_h,\n            \"-o\",\n            preprocessed_file.absolute(),\n        ]\n    )\n    completed_process.check_returncode()\n\n    return preprocessed_file\n\n\ndef prepare_package(output):\n    \"\"\"Prepare a python-vlc package for the designated module.\n\n    :param output: the location of the generated ``vlc.py`` file.\n    \"\"\"\n    # Parse the module for VLC version number\n    bindings_version = None\n    libvlc_version = None\n    with open(output, \"r\") as f:\n        for l in f:\n            m = re.search(r'__version__\\s*=\\s*\"(.+)\"', l)\n            if m:\n                bindings_version = m.group(1)\n            m = re.search(r'__libvlc_version__\\s*=\\s*\"(.+)\"', l)\n            if m:\n                libvlc_version = m.group(1)\n            if bindings_version and libvlc_version:\n                break\n\n    if bindings_version is None:\n        sys.stderr.write(\"Unable to determine bindings version.\")\n        sys.exit(1)\n\n    # Copy other files for distribution\n    outdir = os.path.dirname(output)\n\n    shutil.copyfile(\n        os.path.join(TEMPLATEDIR, \"pyproject.toml\"),\n        os.path.join(outdir, \"pyproject.toml\"),\n    )\n    shutil.copyfile(\n        os.path.join(TEMPLATEDIR, \"MANIFEST.in\"), os.path.join(outdir, \"MANIFEST.in\")\n    )\n    examples = os.path.join(outdir, \"examples\")\n    if os.path.isdir(examples):\n        shutil.rmtree(examples)\n    shutil.copytree(os.path.join(BASEDIR, \"..\", \"examples\"), examples)\n    for fname in (\"COPYING\", \"README.module\"):\n        shutil.copyfile(os.path.join(BASEDIR, \"..\", fname), os.path.join(outdir, fname))\n\n\nif __name__ == \"__main__\":\n    from optparse import OptionParser\n\n    opt = OptionParser(\n        usage=\"\"\"%prog  [options]  <include_vlc_directory> | <include_file.h> [...]\n\nParse VLC include files and generate bindings code for Python or Java.\"\"\"\n    )\n\n    opt.add_option(\n        \"-c\",\n        \"--check\",\n        dest=\"check\",\n        action=\"store_true\",\n        default=False,\n        help=\"Check mode, generates no bindings\",\n    )\n\n    opt.add_option(\n        \"-d\",\n        \"--debug\",\n        dest=\"debug\",\n        action=\"store_true\",\n        default=False,\n        help=\"Debug mode, generate no bindings\",\n    )\n\n    opt.add_option(\n        \"-j\",\n        \"--java\",\n        dest=\"java\",\n        action=\"store_true\",\n        default=False,\n        help=\"Generate Java bindings (default is Python)\",\n    )\n\n    opt.add_option(\n        \"-o\",\n        \"--output\",\n        dest=\"output\",\n        action=\"store\",\n        type=\"str\",\n        default=\"-\",\n        help=\"Output filename (for Python) or directory (for Java)\",\n    )\n\n    opt.add_option(\n        \"-v\",\n        \"--version\",\n        dest=\"version\",\n        action=\"store\",\n        type=\"str\",\n        default=\"\",\n        help=\"Version string for __version__ global\",\n    )\n\n    opt.add_option(\n        \"-p\",\n        \"--package\",\n        dest=\"package\",\n        action=\"store\",\n        type=\"str\",\n        default=\"\",\n        help=\"Prepare a package for the given python module.\",\n    )\n\n    logging.basicConfig()\n\n    opts, args = opt.parse_args()\n\n    if \"--debug\" in sys.argv:\n        _debug = True  # show source\n        logging.basicConfig(level=logging.DEBUG)\n\n    if opts.package:\n        prepare_package(opts.package)\n        sys.exit(0)\n\n    if not args:\n        opt.print_help()\n        sys.exit(1)\n    elif len(args) == 1:  # get .h files\n        # get .h files from .../include/vlc dir\n        # or .../include/vlc/*.h (especially\n        # useful on Windows, where cmd does\n        # not provide wildcard expansion)\n        p = args[0]\n        if os.path.isdir(p):\n            p = os.path.join(p, \"*.h\")\n        import glob\n\n        args = glob.glob(p)\n\n    vlc_h = \"\"\n    libvlc_version_h = \"\"\n    for h_file in args:\n        p = Path(h_file)\n        if p.name == \"vlc.h\":\n            vlc_h = h_file\n        if p.name == \"libvlc_version.h\":\n            libvlc_version_h = h_file\n    if vlc_h == \"\":\n        raise Exception(\n            \"Didn't found vlc.h amongst header files, but need it for preprocessing.\"\n        )\n    if libvlc_version_h == \"\":\n        raise Exception(\n            \"Didn't found libvlc_version.h amongst header files, but need it for finding libvlc version.\"\n        )\n    vlc_h = Path(vlc_h)\n    libvlc_version_h = Path(libvlc_version_h)\n    vlc_preprocessed = preprocess(vlc_h)\n    p = Parser(vlc_preprocessed, libvlc_version_h, opts.version)\n    if opts.debug:\n        for t in (\"structs\", \"enums\", \"funcs\", \"callbacks\"):\n            p.dump(t)\n    if opts.java:\n        g = JavaGenerator(p)\n    else:\n        g = PythonGenerator(p)\n\n    if opts.check:\n        p.check()\n    elif opts.debug:\n        g.dump_dicts()\n    elif not _nerrors:\n        g.save(opts.output)\n\n    errors(\"%s error(s) reported\")\n"
  },
  {
    "path": "generator/templates/LibVlc-footer.java",
    "content": "}\n"
  },
  {
    "path": "generator/templates/LibVlc-header.java",
    "content": "package org.videolan.jvlc.internal;\n\nimport com.sun.jna.Callback;\nimport com.sun.jna.Library;\nimport com.sun.jna.Native;\nimport com.sun.jna.NativeLong;\nimport com.sun.jna.Platform;\nimport com.sun.jna.Pointer;\nimport com.sun.jna.PointerType;\nimport com.sun.jna.Structure;\nimport com.sun.jna.Union;\n\n\npublic interface LibVlc extends Library\n{\n    LibVlc INSTANCE = (LibVlc) Native.loadLibrary(Platform.isWindows()? \"libvlc\" : \"vlc\", LibVlc.class);\n\n    LibVlc SYNC_INSTANCE = (LibVlc) Native.synchronizedLibrary(INSTANCE);\n\n    public static class libvlc_exception_t extends Structure\n    {\n        public int b_raised;\n    }\n\n    public static class libvlc_log_message_t extends Structure\n    {\n\n        public int sizeof_msg; /* sizeof() of message structure, must be filled in by user */\n\n        public int i_severity; /* 0=INFO, 1=ERR, 2=WARN, 3=DBG */\n\n        public String psz_type; /* module type */\n\n        public String psz_name; /* module name */\n\n        public String psz_header; /* optional header */\n\n        public String psz_message; /* message */\n    }\n\n    public static class libvlc_event_t extends Structure\n    {\n\n        public int type;\n\n        public Pointer p_obj;\n\n        public event_type_specific event_type_specific;\n\n    }\n\n    public class media_meta_changed extends Structure\n    {\n        // Enum !\n        public Pointer meta_type;\n    }\n\n    public class media_subitem_added extends Structure\n    {\n\n        public LibVlcMedia new_child;\n    }\n\n    public class media_duration_changed extends Structure\n    {\n\n        public NativeLong new_duration;\n    }\n\n    public class media_preparsed_changed extends Structure\n    {\n\n        public int new_status;\n    }\n\n    public class media_freed extends Structure\n    {\n\n        public LibVlcMedia md;\n    }\n\n    public class media_state_changed extends Structure\n    {\n\n        // @todo: check this one\n        public int new_state;\n    }\n\n    /* media instance */\n\n    public class media_player_position_changed extends Structure\n    {\n\n        public float new_position;\n    }\n\n    public class media_player_time_changed extends Structure\n    {\n\n        // @todo: check this one\n        public long new_time;\n    }\n\n    public class media_player_title_changed extends Structure\n    {\n        public int new_title;\n    }\n\n    public class media_player_seekable_changed extends Structure\n    {\n        public NativeLong new_seekable;\n    }\n\n    public class media_player_pausable_changed extends Structure\n    {\n        public NativeLong new_pausable;\n    }\n\n    /* media list */\n    public class media_list_item_added extends Structure\n    {\n\n        public LibVlcMedia item;\n\n        public int index;\n    }\n\n    public class media_list_will_add_item extends Structure\n    {\n\n        public LibVlcMedia item;\n\n        public int index;\n    }\n\n    public class media_list_item_deleted extends Structure\n    {\n\n        public LibVlcMedia item;\n\n        public int index;\n    }\n\n    public class media_list_will_delete_item extends Structure\n    {\n\n        public LibVlcMedia item;\n\n        public int index;\n    }\n\n    /* media list view */\n    public class media_list_view_item_added extends Structure\n    {\n\n        public LibVlcMedia item;\n\n        public int index;\n    }\n\n    public class media_list_view_will_add_item extends Structure\n    {\n\n        public LibVlcMedia item;\n\n        public int index;\n    }\n\n    public class media_list_view_item_deleted extends Structure\n    {\n\n        public LibVlcMedia item;\n\n        public int index;\n    }\n\n    public class media_list_view_will_delete_item extends Structure\n    {\n\n        public LibVlcMedia item;\n\n        public int index;\n    }\n\n    public class media_list_player_next_item_set extends Structure\n    {\n        public LibVlcMedia item;\n    }\n\n    public class media_player_snapshot_taken extends Structure\n    {\n        public String psz_filename;\n    }\n\n    public class media_player_length_changed extends Structure\n    {\n        // @todo: check the type\n        public long new_length;\n    }\n\n    public class vlm_media_event extends Structure\n    {\n        public String psz_media_name;\n        public String psz_instance_name;\n    }\n\n    public class event_type_specific extends Union\n    {\n\n        public media_meta_changed media_meta_changed;\n\n        public media_subitem_added media_subitem_added;\n\n        public media_duration_changed media_duration_changed;\n\n        public media_preparsed_changed media_preparsed_changed;\n\n        public media_freed media_freed;\n\n        public media_state_changed media_state_changed;\n\n        public media_player_position_changed media_player_position_changed;\n\n        public media_player_time_changed media_player_time_changed;\n\n        public media_player_title_changed media_player_title_changed;\n\n        public media_player_seekable_changed media_player_seekable_changed;\n\n        public media_player_pausable_changed media_player_pausable_changed;\n\n        public media_list_item_added media_list_item_added;\n\n        public media_list_will_add_item media_list_will_add_item;\n\n        public media_list_item_deleted media_list_item_deleted;\n\n        public media_list_will_delete_item media_list_will_delete_item;\n\n        public media_list_view_item_added media_list_view_item_added;\n\n        public media_list_view_will_add_item media_list_view_will_add_item;\n\n        public media_list_view_item_deleted media_list_view_item_deleted;\n\n        public media_list_view_will_delete_item media_list_view_will_delete_item;\n\n        public media_list_player_next_item_set media_list_player_next_item_set;\n\n        public media_player_snapshot_taken media_player_snapshot_taken;\n\n        public media_player_length_changed media_player_length_changed;\n\n        public vlm_media_event vlm_media_event;\n    }\n"
  },
  {
    "path": "generator/templates/MANIFEST.in",
    "content": "include setup.py\ninclude vlc.py\ninclude COPYING MANIFEST.in README.module\ninclude distribute_setup.py\nrecursive-include examples *\n"
  },
  {
    "path": "generator/templates/boilerplate.java",
    "content": "/*****************************************************************************\n * VLC Java Bindings JNA Glue\n *****************************************************************************\n * Copyright (C) 1998-2009 the VideoLAN team\n *\n * Authors: Filippo Carone <filippo@carone.org>\n *          VLC bindings generator\n *\n *\n * $Id $\n *\n * This program is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.\n *****************************************************************************/\n\n"
  },
  {
    "path": "generator/templates/footer.py",
    "content": "# Start of footer.py #\n\n# Backward compatibility\ndef callbackmethod(callback):\n    \"\"\"Now obsolete ``@callbackmethod`` decorator.\"\"\"\n    return callback\n\n\n# libvlc_free is not present in some versions of libvlc. If it is not\n# in the library, then emulate it by calling libc.free\nif not hasattr(dll, \"libvlc_free\"):\n    # need to find the free function in the C runtime. This is\n    # platform specific.\n    # For Linux and MacOSX\n    libc_path = find_library(\"c\")\n    if libc_path:\n        libc = ctypes.CDLL(libc_path)\n        libvlc_free = libc.free\n    else:\n        # On win32, it is impossible to guess the proper lib to call\n        # (msvcrt, mingw...). Just ignore the call: it will memleak,\n        # but not prevent to run the application.\n        def libvlc_free(p):\n            pass\n\n    # ensure argtypes is right, because default type of int won't\n    # work on 64-bit systems\n    libvlc_free.argtypes = [ctypes.c_void_p]\n\n\n# Version functions\ndef _dot2int(v):\n    \"\"\"(INTERNAL) Convert 'i.i.i[.i]' str to int.\"\"\"\n    t = [int(i) for i in v.split(\".\")]\n    if len(t) == 3:\n        if t[2] < 100:\n            t.append(0)\n        else:  # 100 is arbitrary\n            t[2:4] = divmod(t[2], 100)\n    elif len(t) != 4:\n        raise ValueError('\"i.i.i[.i]\": %r' % (v,))\n    if min(t) < 0 or max(t) > 255:\n        raise ValueError(\"[0..255]: %r\" % (v,))\n    i = t.pop(0)\n    while t:\n        i = (i << 8) + t.pop(0)\n    return i\n\n\ndef hex_version():\n    \"\"\"Return the version of these bindings in hex or 0 if unavailable.\"\"\"\n    try:\n        return _dot2int(__version__)\n    except (NameError, ValueError):\n        return 0\n\n\ndef libvlc_hex_version():\n    \"\"\"Return the libvlc version in hex or 0 if unavailable.\"\"\"\n    try:\n        return _dot2int(bytes_to_str(libvlc_get_version()).split()[0])\n    except ValueError:\n        return 0\n\n\ndef debug_callback(event, *args, **kwds):\n    \"\"\"Example callback, useful for debugging.\"\"\"\n    l = [\"event %s\" % (event.type,)]\n    if args:\n        l.extend(map(str, args))\n    if kwds:\n        l.extend(sorted(\"%s=%s\" % t for t in kwds.items()))\n    print(\"Debug callback (%s)\" % \", \".join(l))\n\n\ndef print_python():\n    from platform import architecture, mac_ver, machine, uname, win32_ver\n\n    if \"intelpython\" in sys.executable:\n        t = \"Intel-\"\n    # elif 'PyPy ' in sys.version:\n    #     t = 'PyPy-'\n    else:\n        t = \"\"\n    t = \"%sPython: %s (%s)\" % (t, sys.version.split()[0], architecture()[0])\n    if win32_ver()[0]:\n        t = t, \"Windows\", win32_ver()[0]\n    elif mac_ver()[0]:\n        t = t, (\"iOS\" if sys.platform == \"ios\" else \"macOS\"), mac_ver()[0], machine()\n    else:\n        try:\n            import distro  # <https://github.com/nir0s/distro>\n\n            t = t, bytes_to_str(distro.name()), bytes_to_str(distro.version())\n        except ImportError:\n            t = (t,) + uname()[0:3:2]\n    print(\" \".join(t))\n\n\ndef print_version():\n    \"\"\"Print version of this vlc.py and of the libvlc\"\"\"\n    try:\n        print(\"%s: %s (%s)\" % (os.path.basename(__file__), __version__, build_date))\n        print(\n            \"libVLC: %s (%#x)\"\n            % (bytes_to_str(libvlc_get_version()), libvlc_hex_version())\n        )\n        # print('libVLC %s' % bytes_to_str(libvlc_get_compiler()))\n        if plugin_path:\n            print(\"plugins: %s\" % plugin_path)\n    except Exception:\n        print(\"Error: %s\" % sys.exc_info()[1])\n\n\nif __name__ == \"__main__\":\n    logging.basicConfig(level=logging.DEBUG)\n    try:\n        from msvcrt import getch\n    except ImportError:\n        import termios\n        import tty\n\n        def getch():  # getchar(), getc(stdin)  #PYCHOK flake\n            fd = sys.stdin.fileno()\n            old = termios.tcgetattr(fd)\n            try:\n                tty.setraw(fd)\n                ch = sys.stdin.read(1)\n            finally:\n                termios.tcsetattr(fd, termios.TCSADRAIN, old)\n            return ch\n\n    def end_callback(event):\n        print(\"End of media stream (event %s)\" % event.type)\n        sys.exit(0)\n\n    echo_position = False\n\n    def pos_callback(event, player):\n        if echo_position:\n            sys.stdout.write(\n                \"\\r%s to %.2f%% (%.2f%%)\"\n                % (event.type, event.u.new_position * 100, player.get_position() * 100)\n            )\n            sys.stdout.flush()\n\n    if \"-h\" in sys.argv[:2] or \"--help\" in sys.argv[:2]:\n        print(\"Usage: %s [options] <movie_filename>\" % sys.argv[0])\n        print(\"Once launched, type ? for help.\")\n        print(\"\")\n\n    elif \"-v\" in sys.argv[:2] or \"--version\" in sys.argv[:2]:\n        print_version()\n        print_python()\n        print(\"\")\n\n    else:\n        movie = os.path.expanduser(sys.argv.pop())\n        if not os.access(movie, os.R_OK):\n            print(\"Error: %s file not readable\" % movie)\n            sys.exit(1)\n\n        # Need --sub-source=marq in order to use marquee below\n        instance = Instance([\"--sub-source=marq\"] + sys.argv[1:])\n        try:\n            media = instance.media_new(movie)\n        except (AttributeError, NameError) as e:\n            print(\n                \"%s: %s (%s %s vs LibVLC %s)\"\n                % (\n                    e.__class__.__name__,\n                    e,\n                    sys.argv[0],\n                    __version__,\n                    libvlc_get_version(),\n                )\n            )\n            sys.exit(1)\n        player = instance.media_player_new()\n        player.set_media(media)\n        player.play()\n\n        # Some marquee examples.  Marquee requires '--sub-source marq' in the\n        # Instance() call above, see <https://www.videolan.org/doc/play-howto/en/ch04.html>\n        player.video_set_marquee_int(VideoMarqueeOption.Enable, 1)\n        player.video_set_marquee_int(VideoMarqueeOption.Size, 24)  # pixels\n        # FIXME: This crashes the module - it should be investigated\n        # player.video_set_marquee_int(VideoMarqueeOption.Position, Position.bottom)\n        if False:  # only one marquee can be specified\n            player.video_set_marquee_int(\n                VideoMarqueeOption.Timeout, 5000\n            )  # millisec, 0==forever\n            t = media.get_mrl()  # movie\n        else:  # update marquee text periodically\n            player.video_set_marquee_int(\n                VideoMarqueeOption.Timeout, 0\n            )  # millisec, 0==forever\n            player.video_set_marquee_int(\n                VideoMarqueeOption.Refresh, 1000\n            )  # millisec (or sec?)\n            ##t = '$L / $D or $P at $T'\n            t = \"%Y-%m-%d  %H:%M:%S\"\n        player.video_set_marquee_string(VideoMarqueeOption.Text, str_to_bytes(t))\n\n        # Some event manager examples.  Note, the callback can be any Python\n        # callable and does not need to be decorated.  Optionally, specify\n        # any number of positional and/or keyword arguments to be passed\n        # to the callback (in addition to the first one, an Event instance).\n        event_manager = player.event_manager()\n        event_manager.event_attach(EventType.MediaPlayerEndReached, end_callback)\n        event_manager.event_attach(\n            EventType.MediaPlayerPositionChanged, pos_callback, player\n        )\n\n        def mspf():\n            \"\"\"Milliseconds per frame\"\"\"\n            return int(1000 // (player.get_fps() or 25))\n\n        def print_info():\n            \"\"\"Print information about the media\"\"\"\n            try:\n                print_version()\n                media = player.get_media()\n                print(\"State: %s\" % player.get_state())\n                print(\"Media: %s\" % bytes_to_str(media.get_mrl()))\n                print(\n                    \"Track: %s/%s\"\n                    % (player.video_get_track(), player.video_get_track_count())\n                )\n                print(\"Current time: %s/%s\" % (player.get_time(), media.get_duration()))\n                print(\"Position: %s\" % player.get_position())\n                print(\"FPS: %s (%d ms)\" % (player.get_fps(), mspf()))\n                print(\"Rate: %s\" % player.get_rate())\n                print(\"Video size: %s\" % str(player.video_get_size(0)))  # num=0\n                print(\"Scale: %s\" % player.video_get_scale())\n                print(\"Aspect ratio: %s\" % player.video_get_aspect_ratio())\n            # print('Window:' % player.get_hwnd()\n            except Exception:\n                print(\"Error: %s\" % sys.exc_info()[1])\n\n        def sec_forward():\n            \"\"\"Go forward one sec\"\"\"\n            player.set_time(player.get_time() + 1000)\n\n        def sec_backward():\n            \"\"\"Go backward one sec\"\"\"\n            player.set_time(player.get_time() - 1000)\n\n        def frame_forward():\n            \"\"\"Go forward one frame\"\"\"\n            player.set_time(player.get_time() + mspf())\n\n        def frame_backward():\n            \"\"\"Go backward one frame\"\"\"\n            player.set_time(player.get_time() - mspf())\n\n        def print_help():\n            \"\"\"Print help\"\"\"\n            print(\"Single-character commands:\")\n            for k, m in sorted(keybindings.items()):\n                m = (m.__doc__ or m.__name__).splitlines()[0]\n                print(\"  %s: %s.\" % (k, m.rstrip(\".\")))\n            print(\"0-9: go to that fraction of the movie\")\n\n        def quit_app():\n            \"\"\"Stop and exit\"\"\"\n            sys.exit(0)\n\n        def toggle_echo_position():\n            \"\"\"Toggle echoing of media position\"\"\"\n            global echo_position\n            echo_position = not echo_position\n\n        keybindings = {\n            \" \": player.pause,\n            \"+\": sec_forward,\n            \"-\": sec_backward,\n            \".\": frame_forward,\n            \",\": frame_backward,\n            \"f\": player.toggle_fullscreen,\n            \"i\": print_info,\n            \"p\": toggle_echo_position,\n            \"q\": quit_app,\n            \"?\": print_help,\n        }\n\n        print(\"Press q to quit, ? to get help.%s\" % os.linesep)\n        while True:\n            k = getch()\n            print(\"> %s\" % k)\n            if k in keybindings:\n                keybindings[k]()\n            elif k.isdigit():\n                # jump to fraction of the movie.\n                player.set_position(float(\"0.\" + k))\n"
  },
  {
    "path": "generator/templates/header.py",
    "content": "#! /usr/bin/python\n# -*- coding: utf-8 -*-\n\n# Python ctypes bindings for VLC\n#\n# Copyright (C) 2009-2017 the VideoLAN team\n# $Id: $\n#\n# Authors: Olivier Aubert <contact at olivieraubert.net>\n#          Jean Brouwers <MrJean1 at gmail.com>\n#          Geoff Salmon <geoff.salmon at gmail.com>\n#\n# This library is free software; you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License as\n# published by the Free Software Foundation; either version 2.1 of the\n# License, or (at your option) any later version.\n#\n# This library is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this library; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA\n\n\"\"\"This module provides bindings for the LibVLC public API, see\nhttps://wiki.videolan.org/LibVLC.\n\nYou can find the documentation and a README file with some examples\nat https://www.olivieraubert.net/vlc/python-ctypes/.\n\nBasically, the most important class is :class:`Instance`, which is used\nto create a libvlc instance. From this instance, you then create\n:class:`MediaPlayer` and :class:`MediaListPlayer` instances.\n\nAlternatively, you may create instances of the :class:`MediaPlayer` and\n:class:`MediaListPlayer` class directly and an instance of :class:`Instance`\nwill be implicitly created. The latter can be obtained using the\n:meth:`MediaPlayer.get_instance` and :class:`MediaListPlayer`.\n\"\"\"\n\nimport ctypes\nimport functools\n\n# Used by EventManager in override.py\nimport inspect as _inspect\nimport logging\nimport os\nimport sys\nfrom ctypes.util import find_library\n\nlogger = logging.getLogger(__name__)\n\nbuild_date = \"\"  # build time stamp and __version__, see generate.py\n\n# The libvlc doc states that filenames are expected to be in UTF8, do\n# not rely on sys.getfilesystemencoding() which will be confused,\n# esp. on windows.\nDEFAULT_ENCODING = \"utf-8\"\n\n\ndef str_to_bytes(s):\n    \"\"\"Translate string or bytes to bytes.\"\"\"\n    if isinstance(s, str):\n        return bytes(s, DEFAULT_ENCODING)\n    else:\n        return s\n\n\ndef bytes_to_str(b):\n    \"\"\"Translate bytes to string.\"\"\"\n    if isinstance(b, bytes):\n        return b.decode(DEFAULT_ENCODING)\n    else:\n        return b\n\n\ndef len_args(func):\n    \"\"\"Return number of positional arguments.\"\"\"\n    return len(_inspect.signature(func).parameters)\n\n\n# Internal guard to prevent internal classes to be directly\n# instanciated.\n_internal_guard = object()\n\n\ndef find_lib():\n    dll = None\n    plugin_path = os.environ.get(\"PYTHON_VLC_MODULE_PATH\", None)\n    if \"PYTHON_VLC_LIB_PATH\" in os.environ:\n        try:\n            dll = ctypes.CDLL(os.environ[\"PYTHON_VLC_LIB_PATH\"])\n        except OSError:\n            logger.error(\n                \"Cannot load lib specified by PYTHON_VLC_LIB_PATH env. variable\"\n            )\n            sys.exit(1)\n    if plugin_path and not os.path.isdir(plugin_path):\n        logger.error(\"Invalid PYTHON_VLC_MODULE_PATH specified. Please fix.\")\n        sys.exit(1)\n    if dll is not None:\n        return dll, plugin_path\n\n    if sys.platform.startswith(\"win\"):\n        libname = \"libvlc.dll\"\n        p = find_library(libname)\n        if p is None:\n            try:  # some registry settings\n                # leaner than win32api, win32con\n                import winreg as w\n\n                for r in w.HKEY_LOCAL_MACHINE, w.HKEY_CURRENT_USER:\n                    try:\n                        r = w.OpenKey(r, \"Software\\\\VideoLAN\\\\VLC\")\n                        plugin_path, _ = w.QueryValueEx(r, \"InstallDir\")\n                        w.CloseKey(r)\n                        break\n                    except w.error:\n                        pass\n            except ImportError:  # no PyWin32\n                pass\n            if plugin_path is None:\n                # try some standard locations.\n                programfiles = os.environ[\"ProgramFiles\"]\n                homedir = os.environ[\"HOMEDRIVE\"]\n                for p in (\n                    \"{programfiles}\\\\VideoLan{libname}\",\n                    \"{homedir}:\\\\VideoLan{libname}\",\n                    \"{programfiles}{libname}\",\n                    \"{homedir}:{libname}\",\n                ):\n                    p = p.format(\n                        homedir=homedir,\n                        programfiles=programfiles,\n                        libname=\"\\\\VLC\\\\\" + libname,\n                    )\n                    if os.path.exists(p):\n                        plugin_path = os.path.dirname(p)\n                        break\n            if plugin_path is not None:  # try loading\n                # PyInstaller Windows fix\n                if \"PyInstallerCDLL\" in ctypes.CDLL.__name__:\n                    ctypes.windll.kernel32.SetDllDirectoryW(None)\n                p = os.getcwd()\n                os.chdir(plugin_path)\n                # if chdir failed, this will raise an exception\n                dll = ctypes.CDLL(\".\\\\\" + libname)\n                # restore cwd after dll has been loaded\n                os.chdir(p)\n            else:  # may fail\n                dll = ctypes.CDLL(\".\\\\\" + libname)\n        else:\n            plugin_path = os.path.dirname(p)\n            dll = ctypes.CDLL(p)\n\n    elif sys.platform.startswith(\"darwin\"):\n        # FIXME: should find a means to configure path\n        d = \"/Applications/VLC.app/Contents/MacOS/\"\n        c = d + \"lib/libvlccore.dylib\"\n        p = d + \"lib/libvlc.dylib\"\n        if os.path.exists(p) and os.path.exists(c):\n            # pre-load libvlccore VLC 2.2.8+\n            ctypes.CDLL(c)\n            dll = ctypes.CDLL(p)\n            for p in (\"modules\", \"plugins\"):\n                p = d + p\n                if os.path.isdir(p):\n                    plugin_path = p\n                    break\n        else:  # hope, some [DY]LD_LIBRARY_PATH is set...\n            # pre-load libvlccore VLC 2.2.8+\n            ctypes.CDLL(\"libvlccore.dylib\")\n            dll = ctypes.CDLL(\"libvlc.dylib\")\n\n    else:\n        # All other OSes (linux, freebsd...)\n        p = find_library(\"vlc\")\n        try:\n            dll = ctypes.CDLL(p)\n        except OSError:  # may fail\n            dll = None\n        if dll is None:\n            try:\n                dll = ctypes.CDLL(\"libvlc.so.5\")\n            except:\n                raise NotImplementedError(\"Cannot find libvlc lib\")\n\n    return (dll, plugin_path)\n\n\n# plugin_path used on win32 and MacOS in override.py\ndll, plugin_path = find_lib()\n\n\nclass VLCException(Exception):\n    \"\"\"Exception raised by libvlc methods.\"\"\"\n\n    pass\n\n\ntry:\n    _Ints = (int, long)\nexcept NameError:  # no long in Python 3+\n    _Ints = int\n_Seqs = (list, tuple)\n\n\n# Used for handling *event_manager() methods.\nclass memoize_parameterless(object):\n    \"\"\"Decorator. Caches a parameterless method's return value each time it is called.\n\n    If called later with the same arguments, the cached value is returned (not reevaluated).\n\n    Adapted from https://wiki.python.org/moin/PythonDecoratorLibrary.\n    \"\"\"\n\n    def __init__(self, func):\n        self.func = func\n        self._cache = {}\n\n    def __call__(self, obj):\n        try:\n            return self._cache[obj]\n        except KeyError:\n            v = self._cache[obj] = self.func(obj)\n            return v\n\n    def __repr__(self):\n        \"\"\"Return the function's docstring.\"\"\"\n        return self.func.__doc__\n\n    def __get__(self, obj, objtype):\n        \"\"\"Support instance methods.\"\"\"\n        return functools.partial(self.__call__, obj)\n\n\n# Default instance. It is used to instanciate classes directly in the\n# OO-wrapper.\n_default_instance = None\n\n\ndef get_default_instance():\n    \"\"\"Returns the default :class:`Instance`.\"\"\"\n    global _default_instance\n    if _default_instance is None:\n        _default_instance = Instance()\n    return _default_instance\n\n\ndef try_fspath(path):\n    \"\"\"Try calling ``os.fspath``.\n\n    ``os.fspath`` is only available from py3.6.\n    \"\"\"\n    try:\n        return os.fspath(path)\n    except (AttributeError, TypeError):\n        return path\n\n\n_Cfunctions = {}  # from LibVLC __version__\n_Globals = globals()  # sys.modules[__name__].__dict__\n\n\ndef _Cfunction(name, flags, errcheck, *types):\n    \"\"\"(INTERNAL) New ctypes function binding.\"\"\"\n    if hasattr(dll, name) and name in _Globals:\n        p = ctypes.CFUNCTYPE(*types)\n        f = p((name, dll), flags)\n        if errcheck is not None:\n            f.errcheck = errcheck\n        # replace the Python function\n        # in this module, but only when\n        # running as python -O or -OO\n        if __debug__:\n            _Cfunctions[name] = f\n        else:\n            _Globals[name] = f\n        return f\n    raise NameError(\"no function %r\" % (name,))\n\n\ndef _Cobject(cls, ctype):\n    \"\"\"(INTERNAL) New instance from ctypes.\"\"\"\n    o = object.__new__(cls)\n    o._as_parameter_ = ctype\n    return o\n\n\ndef _Constructor(cls, ptr=_internal_guard):\n    \"\"\"(INTERNAL) New wrapper from ctypes.\"\"\"\n    if ptr == _internal_guard:\n        raise VLCException(\n            \"(INTERNAL) ctypes class. You should get references for this class through methods of the LibVLC API.\"\n        )\n    if ptr is None or ptr == 0:\n        return None\n    return _Cobject(cls, ctypes.c_void_p(ptr))\n\n\nclass _Cstruct(ctypes.Structure):\n    \"\"\"(INTERNAL) Base class for ctypes structures.\"\"\"\n\n    _fields_ = []  # list of 2-tuples ('name', ctypes.<type>)\n\n    def __str__(self):\n        l = [\" %s:\\t%s\" % (n, getattr(self, n)) for n, _ in self._fields_]\n        return \"\\n\".join([self.__class__.__name__] + l)\n\n    def __repr__(self):\n        return \"%s.%s\" % (self.__class__.__module__, self)\n\n\nclass _Ctype(object):\n    \"\"\"(INTERNAL) Base class for ctypes.\"\"\"\n\n    @staticmethod\n    def from_param(this):  # not self\n        \"\"\"(INTERNAL) ctypes parameter conversion method.\"\"\"\n        if this is None:\n            return None\n        return this._as_parameter_\n\n\nclass ListPOINTER(object):\n    \"\"\"Just like a POINTER but accept a list of etype elements as an argument.\"\"\"\n\n    def __init__(self, etype):\n        self.etype = etype\n\n    def from_param(self, param):\n        if isinstance(param, _Seqs):\n            return (self.etype * len(param))(*param)\n        else:\n            return ctypes.POINTER(param)\n\n\n# errcheck functions for some native functions.\ndef string_result(result, func, arguments):\n    \"\"\"Errcheck function. Returns a string and frees the original pointer.\n\n    It assumes the result is a ``char*``.\n    \"\"\"\n    if result:\n        # make a python string copy\n        s = bytes_to_str(ctypes.string_at(result))\n        # free original string ptr\n        libvlc_free(result)\n        return s\n    return None\n\n\ndef class_result(classname):\n    \"\"\"Errcheck function. Returns a function that creates the specified class.\"\"\"\n\n    def wrap_errcheck(result, func, arguments):\n        if result is None:\n            return None\n        return classname(result)\n\n    return wrap_errcheck\n\n\n# Wrapper for the opaque struct libvlc_log_t\nclass Log(ctypes.Structure):\n    pass\n\n\nLog_ptr = ctypes.POINTER(Log)\n\n\n# Wrapper for the opaque struct libvlc_media_thumbnail_request_t\nclass MediaThumbnailRequest:\n    def __new__(cls, *args):\n        if len(args) == 1 and isinstance(args[0], _Ints):\n            return _Constructor(cls, args[0])\n\n\n# FILE* ctypes wrapper, copied from\n# https://svn.python.org/projects/ctypes/trunk/ctypeslib/ctypeslib/contrib/pythonhdr.py\nclass FILE(ctypes.Structure):\n    pass\n\n\nFILE_ptr = ctypes.POINTER(FILE)\n\nPyFile_FromFd = ctypes.pythonapi.PyFile_FromFd\nPyFile_FromFd.restype = ctypes.py_object\nPyFile_FromFd.argtypes = [\n    ctypes.c_int,\n    ctypes.c_char_p,\n    ctypes.c_char_p,\n    ctypes.c_int,\n    ctypes.c_char_p,\n    ctypes.c_char_p,\n    ctypes.c_char_p,\n    ctypes.c_int,\n]\n\nPyFile_AsFd = ctypes.pythonapi.PyObject_AsFileDescriptor\nPyFile_AsFd.restype = ctypes.c_int\nPyFile_AsFd.argtypes = [ctypes.py_object]\n\n\ndef module_description_list(head):\n    \"\"\"Convert a ModuleDescription linked list to a Python list (and release the former).\"\"\"\n    r = []\n    if head:\n        item = head\n        while item:\n            item = item.contents\n            r.append((item.name, item.shortname, item.longname, item.help))\n            item = item.next\n        libvlc_module_description_list_release(head)\n    return r\n\n\ndef track_description_list(head):\n    \"\"\"Convert a TrackDescription linked list to a Python list (and release the former).\"\"\"\n    r = []\n    if head:\n        item = head\n        while item:\n            item = item.contents\n            r.append((item.id, item.name))\n            item = item.next\n        try:\n            libvlc_track_description_release(head)\n        except NameError:\n            libvlc_track_description_list_release(head)\n\n    return r\n\n\nclass _Enum(ctypes.c_uint):\n    \"\"\"(INTERNAL) Base class\"\"\"\n\n    _enum_names_ = {}\n\n    def __str__(self):\n        n = self._enum_names_.get(self.value, \"\") or (\"FIXME_(%r)\" % (self.value,))\n        return \".\".join((self.__class__.__name__, n))\n\n    def __hash__(self):\n        return self.value\n\n    def __repr__(self):\n        return \".\".join((self.__class__.__module__, self.__str__()))\n\n    def __eq__(self, other):\n        return (isinstance(other, _Enum) and self.value == other.value) or (\n            isinstance(other, _Ints) and self.value == other\n        )\n\n    def __ne__(self, other):\n        return not self.__eq__(other)\n\n\n# Generated wrappers #\n# GENERATED_WRAPPERS go here  # see generate.py\n# End of generated wrappers #\n\n# Generated enum types #\n# GENERATED_ENUMS go here  # see generate.py\n# End of generated enum types #\n\n# Generated structs #\n# GENERATED_STRUCTS go here  # see generate.py\n# End of generated structs #\n\n# Generated callback definitions #\n# GENERATED_CALLBACKS\n# End of generated callback definitions #\n\n# Generated functions #\n# GENERATED_FUNCTIONS\n# End of generated functions #\n\n# End of header.py #\n"
  },
  {
    "path": "generator/templates/override.py",
    "content": "class Instance:\n    \"\"\"It may take as parameter either:\n\n    * a string\n    * a list of strings as first parameters\n    * the parameters given as the constructor parameters (must be strings)\n    \"\"\"\n\n    def __new__(cls, *args):\n        if len(args) == 1:\n            # Only 1 arg. It is either a C pointer, or an arg string,\n            # or a tuple.\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            elif isinstance(i, str):\n                args = i.strip().split()\n            elif isinstance(i, _Seqs):\n                args = list(i)\n            else:\n                raise VLCException(\"Instance %r\" % (args,))\n        else:\n            args = list(args)\n\n        if not args:  # no parameters passed\n            args = [\"vlc\"]\n        elif args[0] != \"vlc\":\n            args.insert(0, \"vlc\")\n\n        if plugin_path is not None:\n            # set plugin_path if detected, win32 and MacOS,\n            # if the user did not specify it itself.\n            os.environ.setdefault(\"VLC_PLUGIN_PATH\", plugin_path)\n\n        args = [str_to_bytes(a) for a in args]\n        return libvlc_new(len(args), args)\n\n    def media_player_new(self, uri=None):\n        \"\"\"Create a new :class:`MediaPlayer` instance.\n\n        :param uri: an optional URI to play in the player as a str, bytes or PathLike object.\n        \"\"\"\n        p = libvlc_media_player_new(self)\n        if uri:\n            p.set_media(self.media_new(uri))\n        p._instance = self\n        return p\n\n    def media_list_player_new(self):\n        \"\"\"Create a new :class:`MediaListPlayer` instance.\"\"\"\n        p = libvlc_media_list_player_new(self)\n        p._instance = self\n        return p\n\n    def media_new(self, mrl, *options):\n        \"\"\"Create a new :class:`Media` instance.\n\n        If mrl contains a colon (:) preceded by more than 1 letter, it\n        will be treated as a URL. Else, it will be considered as a\n        local path. If you need more control, directly use\n        :meth:`media_new_location` or :meth:`media_new_path`.\n\n        Options can be specified as supplementary string parameters,\n        but note that many options cannot be set at the media level,\n        and rather at the :class:`Instance` level. For instance, the marquee\n        filter must be specified when creating the :class:`Instance` or\n        :class:`MediaPlayer`.\n\n        Alternatively, options can be added to the media using the\n        :meth:`Media.add_options` method (with the same limitation).\n\n        :param mrl: A str, bytes or PathLike object\n        :param options: optional media option=value strings\n        \"\"\"\n        mrl = try_fspath(mrl)\n        if \":\" in mrl and mrl.index(\":\") > 1:\n            # Assume it is a URL\n            if __version__ >= \"4\":\n                m = libvlc_media_new_location(str_to_bytes(mrl))\n            else:\n                m = libvlc_media_new_location(self, str_to_bytes(mrl))\n        else:\n            # Else it should be a local path.\n            m = self.media_new_path(str_to_bytes(os.path.normpath(mrl)))\n        for o in options:\n            libvlc_media_add_option(m, str_to_bytes(o))\n        m._instance = self\n        return m\n\n    def media_new_path(self, path):\n        \"\"\"Create a media for a certain file path. See :meth:`media_release`.\n\n        :param path: A str, byte, or PathLike object representing a local filesystem path.\n\n        :return: the newly created media or None on error.\n        \"\"\"\n        path = try_fspath(path)\n        if __version__ >= \"4\":\n            return libvlc_media_new_path(str_to_bytes(path))\n        else:\n            return libvlc_media_new_path(self, str_to_bytes(path))\n\n    def media_list_new(self, mrls=None):\n        \"\"\"Create a new :class:`MediaList` instance.\n\n        :param mrls: optional list of MRL strings, bytes, or PathLike objects.\n        \"\"\"\n        # API 3 vs 4: libvlc_media_list_new does not take any\n        # parameter as input anymore.\n        if len_args(libvlc_media_list_new) == 1:  # API <= 3\n            l = libvlc_media_list_new(self)\n        else:  # API >= 4\n            l = libvlc_media_list_new()\n        # We should take the lock, but since we did not leak the\n        # reference, nobody else can access it.\n        if mrls:\n            for m in mrls:\n                l.add_media(m)\n        l._instance = self\n        return l\n\n    def audio_output_enumerate_devices(self):\n        \"\"\"Enumerate the defined audio output devices.\n\n        :return: list of dicts {name:, description:, devices:}\n        \"\"\"\n        r = []\n        head = libvlc_audio_output_list_get(self)\n        if head:\n            i = head\n            while i:\n                i = i.contents\n                r.append({\"name\": i.name, \"description\": i.description})\n                i = i.next\n            libvlc_audio_output_list_release(head)\n        return r\n\n    def audio_filter_list_get(self):\n        \"\"\"Returns a list of available audio filters.\"\"\"\n        return module_description_list(libvlc_audio_filter_list_get(self))\n\n    def video_filter_list_get(self):\n        \"\"\"Returns a list of available video filters.\"\"\"\n        return module_description_list(libvlc_video_filter_list_get(self))\n\n\nclass Media:\n    \"\"\"Usage:\n\n    .. code-block:: python\n\n        Media(MRL, *options)\n\n    See :meth:`Instance.media_new` documentation for details.\n    \"\"\"\n\n    def __new__(cls, *args):\n        if args:\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            if isinstance(i, Instance):\n                return i.media_new(*args[1:])\n\n        o = get_default_instance().media_new(*args)\n        return o\n\n    def get_instance(self):\n        return getattr(self, \"_instance\", None)\n\n    def add_options(self, *options):\n        \"\"\"Add a list of options to the media.\n\n        .. note::\n            Options must be written without the double-dash.\n\n        .. warning::\n            Most audio and video options, such as text renderer, have no\n            effects on an individual media. These options must be set at\n            the :class:`Instance` or :class:`MediaPlayer` instanciation.\n\n        :param options: optional media option=value strings\n        \"\"\"\n        for o in options:\n            self.add_option(o)\n\n    def tracks_get(self):\n        \"\"\"Get media descriptor's elementary streams description.\n\n        .. note::\n            You need to call :meth:`parse` or play the media at least once\n            before calling this function.\n            Not doing this will result in an empty array.\n\n        .. note::\n            The result must be freed with :meth:`tracks_release`.\n\n        :version: LibVLC 2.1.0 and later.\n        \"\"\"\n        mediaTrack_pp = ctypes.POINTER(MediaTrack)()\n        n = libvlc_media_tracks_get(self, ctypes.byref(mediaTrack_pp))\n        info = ctypes.cast(\n            mediaTrack_pp, ctypes.POINTER(ctypes.POINTER(MediaTrack) * n)\n        )\n        try:\n            contents = info.contents\n        except ValueError:\n            # Media not parsed, no info.\n            return None\n        tracks = (contents[i].contents for i in range(len(contents)))\n        # libvlc_media_tracks_release(mediaTrack_pp, n)\n        return tracks\n\n\nclass MediaList:\n    \"\"\"Usage:\n\n    .. code-block:: python\n\n        MediaList(list_of_MRLs)\n\n    See :meth:`Instance.media_list_new` documentation for details.\n    \"\"\"\n\n    def __new__(cls, *args):\n        if args:\n            i = args[0]\n            if isinstance(i, _Ints):\n                return _Constructor(cls, i)\n            if isinstance(i, Instance):\n                return i.media_list_new(*args[1:])\n\n        o = get_default_instance().media_list_new(*args)\n        return o\n\n    def get_instance(self):\n        return getattr(self, \"_instance\", None)\n\n    def add_media(self, mrl):\n        \"\"\"Add :class:`Media` instance to media list.\n\n        .. note::\n            The lock should be held upon entering this function.\n\n        :param mrl: A :class:`Media` instance or a MRL.\n\n        :return: 0 on success, -1 if the media list is read-only.\n        \"\"\"\n        mrl = try_fspath(mrl)\n        if isinstance(mrl, str):\n            mrl = (self.get_instance() or get_default_instance()).media_new(mrl)\n        return libvlc_media_list_add_media(self, mrl)\n\n\nclass MediaPlayer:\n    \"\"\"It may take as parameter either:\n\n    * a string (media URI), options... In this case, an :class:`Instance` will be created.\n    * an :class:`Instance`, a string (media URI), options...\n    \"\"\"\n\n    def __new__(cls, *args):\n        if len(args) == 1 and isinstance(args[0], _Ints):\n            return _Constructor(cls, args[0])\n\n        if args and isinstance(args[0], Instance):\n            instance = args[0]\n            args = args[1:]\n        else:\n            instance = get_default_instance()\n\n        o = instance.media_player_new()\n        if args:\n            o.set_media(instance.media_new(*args))\n        return o\n\n    def get_instance(self):\n        \"\"\"Return the associated :class:`Instance`.\"\"\"\n        return self._instance\n\n    def set_mrl(self, mrl, *options):\n        \"\"\"Set the MRL to play.\n\n        .. warning::\n            Most audio and video options, such as text renderer,\n            have no effects on an individual media. These options must be\n            set at the :class:`Instance` or :class:`MediaPlayer` instanciation.\n\n        :param mrl: The MRL\n        :param options: optional media option=value strings\n\n        :return: the Media object\n        \"\"\"\n        m = self.get_instance().media_new(mrl, *options)\n        self.set_media(m)\n        return m\n\n    def video_get_spu_description(self):\n        \"\"\"Get the description of available video subtitles.\"\"\"\n        return track_description_list(libvlc_video_get_spu_description(self))\n\n    def video_get_track_description(self):\n        \"\"\"Get the description of available video tracks.\"\"\"\n        return track_description_list(libvlc_video_get_track_description(self))\n\n    def audio_get_track_description(self):\n        \"\"\"Get the description of available audio tracks.\"\"\"\n        return track_description_list(libvlc_audio_get_track_description(self))\n\n    def get_full_title_descriptions(self):\n        \"\"\"Get the full description of available titles.\n\n        :return: The titles list.\n\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        titleDescription_pp = ctypes.POINTER(TitleDescription)()\n        n = libvlc_media_player_get_full_title_descriptions(\n            self, ctypes.byref(titleDescription_pp)\n        )\n        info = ctypes.cast(\n            titleDescription_pp, ctypes.POINTER(ctypes.POINTER(TitleDescription) * n)\n        )\n        try:\n            contents = info.contents\n        except ValueError:\n            # Media not parsed, no info.\n            return None\n        descr = (contents[i].contents for i in range(len(contents)))\n        return descr\n\n    def get_full_chapter_descriptions(self, i_chapters_of_title):\n        \"\"\"Get the full description of available chapters.\n\n        :param i_chapters_of_title: index of the title to query for chapters (uses current title if set to -1).\n\n        :return: the chapters list\n        :version: LibVLC 3.0.0 and later.\n        \"\"\"\n        chapterDescription_pp = ctypes.POINTER(ChapterDescription)()\n        n = libvlc_media_player_get_full_chapter_descriptions(\n            self, i_chapters_of_title, ctypes.byref(chapterDescription_pp)\n        )\n        info = ctypes.cast(\n            chapterDescription_pp,\n            ctypes.POINTER(ctypes.POINTER(ChapterDescription) * n),\n        )\n        try:\n            contents = info.contents\n        except ValueError:\n            # Media not parsed, no info.\n            return None\n        descr = (contents[i].contents for i in range(len(contents)))\n        return descr\n\n    def video_get_size(self, num=0):\n        \"\"\"Get the video size in pixels as 2-tuple (width, height).\n\n        :param num: video number (default 0).\n        \"\"\"\n        r = libvlc_video_get_size(self, num)\n        if isinstance(r, tuple) and len(r) == 2:\n            return r\n        else:\n            raise VLCException(\"invalid video number (%s)\" % (num,))\n\n    def set_hwnd(self, drawable):\n        \"\"\"Set a Win32/Win64 API window handle (HWND).\n\n        Specify where the media player should render its video\n        output. If LibVLC was built without Win32/Win64 API output\n        support, then this has no effects.\n\n        :param drawable: windows handle of the drawable.\n        \"\"\"\n        if not isinstance(drawable, ctypes.c_void_p):\n            drawable = ctypes.c_void_p(int(drawable))\n        libvlc_media_player_set_hwnd(self, drawable)\n\n    def video_get_width(self, num=0):\n        \"\"\"Get the width of a video in pixels.\n\n        :param num: video number (default 0).\n        \"\"\"\n        return self.video_get_size(num)[0]\n\n    def video_get_height(self, num=0):\n        \"\"\"Get the height of a video in pixels.\n\n        :param num: video number (default 0).\n        \"\"\"\n        return self.video_get_size(num)[1]\n\n    def video_get_cursor(self, num=0):\n        \"\"\"Get the mouse pointer coordinates over a video as 2-tuple (x, y).\n\n        Coordinates are expressed in terms of the decoded video resolution,\n        **not** in terms of pixels on the screen/viewport. To get the\n        latter, you must query your windowing system directly.\n\n        Either coordinate may be negative or larger than the corresponding\n        size of the video, if the cursor is outside the rendering area.\n\n        .. warning::\n            The coordinates may be out-of-date if the pointer is not\n            located on the video rendering area. LibVLC does not track the\n            mouse pointer if the latter is outside the video widget.\n\n        .. note::\n            LibVLC does not support multiple mouse pointers (but does\n            support multiple input devices sharing the same pointer).\n\n        :param num: video number (default 0).\n        \"\"\"\n        r = libvlc_video_get_cursor(self, num)\n        if isinstance(r, tuple) and len(r) == 2:\n            return r\n        raise VLCException(\"invalid video number (%s)\" % (num,))\n\n\nclass MediaListPlayer:\n    \"\"\"It may take as parameter either:\n\n    * an :class:`Instance`\n    * nothing\n    \"\"\"\n\n    def __new__(cls, arg=None):\n        if arg is None:\n            i = get_default_instance()\n        elif isinstance(arg, Instance):\n            i = arg\n        elif isinstance(arg, _Ints):\n            return _Constructor(cls, arg)\n        else:\n            raise TypeError(\"MediaListPlayer %r\" % (arg,))\n\n        return i.media_list_player_new()\n\n    def get_instance(self):\n        \"\"\"Return the associated :class:`Instance`.\"\"\"\n        return self._instance\n\n\nclass LogIterator:\n    \"\"\"Create a new VLC log iterator.\"\"\"\n\n    def __iter__(self):\n        return self\n\n    def next(self):\n        if self.has_next():\n            b = LogMessage()\n            i = libvlc_log_iterator_next(self, b)\n            return i.contents\n        raise StopIteration\n\n    def __next__(self):\n        return self.next()\n\n\nclass Log:\n    \"\"\"Create a new VLC log instance.\"\"\"\n\n    def __iter__(self):\n        return self.get_iterator()\n\n    def dump(self):\n        return [str(m) for m in self]\n\n\nclass EventManager:\n    \"\"\"Create an event manager with callback handler.\n\n    This class interposes the registration and handling of\n    event notifications in order to (a) remove the need for\n    decorating each callback functions with the decorator\n    ``@callbackmethod``, (b) allow any number of positional\n    and/or keyword arguments to the callback (in addition\n    to the :class:`Event` instance) and (c) to preserve the Python\n    objects such that the callback and argument objects\n    remain alive (i.e. are not garbage collected) until\n    **after** the notification has been unregistered.\n\n    .. note::\n        Only a single notification can be registered\n        for each event type in an :class:`EventManager` instance.\n    \"\"\"\n\n    _callback_handler = None\n    _callbacks = {}\n\n    def __new__(cls, ptr=_internal_guard):\n        if ptr == _internal_guard:\n            raise VLCException(\n                \"(INTERNAL) ctypes class.\\nYou should get a reference to EventManager through the MediaPlayer.event_manager() method.\"\n            )\n        return _Constructor(cls, ptr)\n\n    def event_attach(self, eventtype, callback, *args, **kwds):\n        \"\"\"Register an event notification.\n\n        :param eventtype: the desired event type to be notified about.\n        :param callback: the function to call when the event occurs.\n        :param args: optional positional arguments for the callback.\n        :param kwds: optional keyword arguments for the callback.\n\n        :return: 0 on success, ENOMEM on error.\n\n        .. note::\n            The callback function must have at least one argument,\n            an :class:`Event` instance. Any other, optional positional and keyword\n            arguments are in **addition** to the first one.\n\n        .. warning::\n            LibVLC is not reentrant, i.e. you cannot call libvlc functions from an event handler.\n            They must be called from the main application thread.\n        \"\"\"\n        if not isinstance(eventtype, EventType):\n            raise VLCException(\"%s required: %r\" % (\"EventType\", eventtype))\n        if not hasattr(callback, \"__call__\"):  # callable()\n            raise VLCException(\"%s required: %r\" % (\"callable\", callback))\n        # check that the callback expects arguments\n        if len_args(callback) < 1:  # list(...)\n            raise VLCException(\"%s required: %r\" % (\"argument\", callback))\n\n        if self._callback_handler is None:\n            _called_from_ctypes = ctypes.CFUNCTYPE(\n                None, ctypes.POINTER(Event), ctypes.c_void_p\n            )\n\n            @_called_from_ctypes\n            def _callback_handler(event, k):\n                \"\"\"(INTERNAL) handle callback call from ctypes.\n\n                .. note::\n                    We cannot simply make this an :class:`EventManager`\n                    method since ctypes does not prepend self as the\n                    first parameter, hence this closure.\n                \"\"\"\n                try:  # retrieve Python callback and arguments\n                    call, args, kwds = self._callbacks[k]\n                except KeyError:  # detached?\n                    pass\n                else:\n                    # deref event.contents to simplify callback code\n                    call(event.contents, *args, **kwds)\n\n            self._callback_handler = _callback_handler\n            self._callbacks = {}\n\n        k = eventtype.value\n        r = libvlc_event_attach(self, k, self._callback_handler, k)\n        if not r:\n            self._callbacks[k] = (callback, args, kwds)\n        return r\n\n    def event_detach(self, eventtype):\n        \"\"\"Unregister an event notification.\n\n        :param eventtype: the event type notification to be removed.\n        \"\"\"\n        if not isinstance(eventtype, EventType):\n            raise VLCException(\"%s required: %r\" % (\"EventType\", eventtype))\n\n        k = eventtype.value\n        if k in self._callbacks:\n            del self._callbacks[k]  # remove, regardless of libvlc return value\n            libvlc_event_detach(self, k, self._callback_handler, k)\n\n\nclass AudioEqualizer:\n    \"\"\"Create a new default equalizer, with all frequency values zeroed.\n\n    The new equalizer can subsequently be applied to a media player by invoking\n    :meth:`MediaPlayer.set_equalizer`.\n\n    The returned handle should be freed via :meth:`release` when\n    it is no longer needed.\n    \"\"\"\n\n    def __new__(cls, *args):\n        if len(args) == 1 and isinstance(args[0], _Ints):\n            return _Constructor(cls, args[0])\n        return libvlc_audio_equalizer_new()\n"
  },
  {
    "path": "generator/templates/pyproject.toml",
    "content": "[build-system]\nrequires = [\"setuptools\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"python-vlc\"\ndynamic = [ \"version\" ]\nauthors = [\n    { name = \"Olivier Aubert\", email = \"contact@olivieraubert.net\" }\n]\nmaintainers = [\n    { name = \"Olivier Aubert\", email = \"contact@olivieraubert.net\" }\n]\nreadme = { file = \"README.module\", content-type = \"text/x-rst\" }\nlicense = { text = \"LGPL-2.1+\" }\ndescription = \"VLC bindings for python.\"\nclassifiers = [\n    \"Development Status :: 5 - Production/Stable\",\n    \"Intended Audience :: Developers\",\n    \"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)\",\n    \"Operating System :: MacOS :: MacOS X\",\n    \"Operating System :: Microsoft :: Windows\",\n    \"Operating System :: POSIX :: Linux\",\n    \"Operating System :: POSIX :: Other\",\n    \"Programming Language :: Python\",\n    \"Programming Language :: Python :: 2\",\n    \"Programming Language :: Python :: 3\",\n    \"Topic :: Multimedia\",\n    \"Topic :: Multimedia :: Sound/Audio\",\n    \"Topic :: Multimedia :: Video\"\n]\nkeywords = [\"vlc\", \"video\"]\n\n[project.urls]\nHomepage = \"https://wiki.videolan.org/PythonBinding\"\nDocumentation = \"https://python-vlc.readthedocs.io/en/latest/\"\nRepository = \"https://github.com/oaubert/python-vlc.git\"\n\"Alternate repository\" = \"https://git.videolan.org/?p=vlc/bindings/python.git;a=summary\"\n\"Bug Tracker\" = \"https://github.com/oaubert/python-vlc/issues\"\n\n[tool.setuptools.dynamic]\nversion = {attr = \"vlc.__version__\"}\n"
  },
  {
    "path": "pyproject.toml",
    "content": "[build-system]\nrequires = [\"setuptools\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"python-vlc-generator\"\ndynamic = [\"version\"]\nauthors = [\n    { name = \"Olivier Aubert\", email = \"contact@olivieraubert.net\" }\n]\nmaintainers = [\n    { name = \"Olivier Aubert\", email = \"contact@olivieraubert.net\" }\n]\nreadme = \"README.md\"\nlicense = { text = \"GPL-2+\" }\ndescription = \"VLC python bindings generator.\"\nclassifiers = [\n  \"Development Status :: 5 - Production/Stable\",\n  \"Intended Audience :: Developers\",\n  \"License :: OSI Approved :: GNU General Public License v2 or later (LGPLv2+)\",\n  \"Operating System :: MacOS :: MacOS X\",\n  \"Operating System :: Microsoft :: Windows\",\n  \"Operating System :: POSIX :: Linux\",\n  \"Operating System :: POSIX :: Other\",\n  \"Programming Language :: Python\",\n  \"Programming Language :: Python :: 2\",\n  \"Programming Language :: Python :: 3\",\n  \"Topic :: Multimedia\",\n  \"Topic :: Multimedia :: Sound/Audio\",\n  \"Topic :: Multimedia :: Video\",\n  \"Topic :: Software Development :: Code Generators\"\n]\nkeywords = [ \"vlc\", \"video\", \"bindings\" ]\n\n[project.urls]\nHomepage = \"https://wiki.videolan.org/PythonBinding\"\n\n[tool.setuptools]\npackages = [\"generator\"]\n\n[tool.setuptools.dynamic]\nversion = {attr = \"generator.generate.__version__\"}\n"
  },
  {
    "path": "requirements.txt",
    "content": "ruff==0.4.2\nSphinx==7.3.7\ntree-sitter==0.20.4\nbuild\npre-commit\nsphinx-autoapi\nsphinx_mdinclude\nsphinx_rtd_theme\n"
  },
  {
    "path": "ruff.toml",
    "content": "# Exclude a variety of commonly ignored directories.\nexclude = [\n    \".bzr\",\n    \".direnv\",\n    \".eggs\",\n    \".git\",\n    \".git-rewrite\",\n    \".hg\",\n    \".ipynb_checkpoints\",\n    \".mypy_cache\",\n    \".nox\",\n    \".pants.d\",\n    \".pyenv\",\n    \".pytest_cache\",\n    \".pytype\",\n    \".ruff_cache\",\n    \".svn\",\n    \".tox\",\n    \".venv\",\n    \".vscode\",\n    \"__pypackages__\",\n    \"_build\",\n    \"buck-out\",\n    \"build\",\n    \"dist\",\n    \"node_modules\",\n    \"site-packages\",\n    \"venv\",\n]\n\n# Same as Black.\nline-length = 88\nindent-width = 4\n\n# Assume Python 3.8\ntarget-version = \"py38\"\n\n[lint]\n# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`)  codes by default.\n# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or\n# McCabe complexity (`C901`) by default.\nselect = [\"E4\", \"E7\", \"E9\", \"F\", \"I\"]\nignore = [\n    \"E402\", # Module level import not at top of file\n    \"E722\", # Do not use bare `except`\n    \"E741\", # Ambiguous variable name\n]\n\n# Allow fix for all enabled rules (when `--fix`) is provided.\nfixable = [\"ALL\"]\nunfixable = []\n\n# Allow unused variables when underscore-prefixed.\ndummy-variable-rgx = \"^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$\"\n\n[format]\n# Like Black, use double quotes for strings.\nquote-style = \"double\"\n\n# Like Black, indent with spaces, rather than tabs.\nindent-style = \"space\"\n\n# Like Black, respect magic trailing commas.\nskip-magic-trailing-comma = false\n\n# Like Black, automatically detect the appropriate line ending.\nline-ending = \"auto\"\n\n# Enable auto-formatting of code examples in docstrings. Markdown,\n# reStructuredText code/literal blocks and doctests are all supported.\n#\n# This is currently disabled by default, but it is planned for this\n# to be opt-out in the future.\ndocstring-code-format = false\n\n# Set the line length limit used when formatting code snippets in\n# docstrings.\n#\n# This only has an effect when the `docstring-code-format` setting is\n# enabled.\ndocstring-code-line-length = \"dynamic\"\n\n"
  },
  {
    "path": "tests/gctest.py",
    "content": "#! /usr/bin/python\n\n\"\"\"Script checking for garbage collection issues with event handlers.\n\nSee https://github.com/oaubert/python-vlc/issues/2\n\nThis currently should exhibit the reported issue.\n\"\"\"\n\nimport gc\nimport sys\nimport time\n\nimport vlc\n\ni = vlc.Instance()\np = vlc.MediaPlayer()\n\n\ndef poschanged(foo):\n    print(\"poschanged\")\n\n\nfor n in range(10):\n    p.stop()\n    p.set_media(i.media_new(sys.argv[1]))\n    em = p.event_manager()\n    em.event_attach(vlc.EventType.MediaPlayerPositionChanged, poschanged)\n    p.play()\n    time.sleep(0.5)\n    p.pause()\n    gc.collect()\n    p.pause()\n    time.sleep(0.5)\n"
  },
  {
    "path": "tests/samples/README",
    "content": "These sample files are used in tests.\n\nThey were downloaded from http://techslides.com/sample-files-for-development\n"
  },
  {
    "path": "tests/test_bindings.py",
    "content": "#! /usr/bin/env python\n# This Python file uses the following encoding: utf-8\n\n#\n# Code generator for python ctypes bindings for VLC\n# Copyright (C) 2009 the VideoLAN team\n# $Id: $\n#\n# Authors: Olivier Aubert <contact at olivieraubert.net>\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\n\"\"\"Unittest module for testing the VLC bindings generated.\"\"\"\n\nimport ctypes\nimport logging\nimport os\nimport unittest\nimport urllib.parse as urllib  # python3\nfrom time import sleep\n\ntry:\n    from pathlib import Path\nexcept ImportError:\n    Path = None\n\ntry:\n    import vlc\nexcept ImportError:\n    import generated.vlc as vlc\n\nlogger = logging.getLogger(__name__)\n\nSONG = os.path.join(os.path.dirname(__file__), \"samples/song.mp3\")\nVIDEO = os.path.join(os.path.dirname(__file__), \"samples/video.mp4\")\nprint(\"Checking \" + vlc.__file__)\n\n__calls_stats__ = {}\n\n\ndef call_stats(f):\n    def wrapper(*args, **kwargs):\n        global __calls_stats__\n        ret = f(*args, **kwargs)\n        if f.__name__ in __calls_stats__:\n            __calls_stats__[f.__name__][\"n_calls\"] += 1\n            __calls_stats__[f.__name__][\"last_return_value\"] = ret\n        else:\n            __calls_stats__[f.__name__] = {\"n_calls\": 1, \"last_return_value\": ret}\n        return ret\n\n    return wrapper\n\n\nclass TestAuxMethods(unittest.TestCase):\n    if Path is not None:\n\n        def test_try_fspath_path_like_object(self):\n            test_object = Path(\"test\", \"path\")\n            result = vlc.try_fspath(test_object)\n            self.assertEqual(result, os.path.join(\"test\", \"path\"))\n\n    def test_try_fspath_str_object(self):\n        test_object = os.path.join(\"test\", \"path\")\n        result = vlc.try_fspath(test_object)\n        self.assertEqual(result, os.path.join(\"test\", \"path\"))\n\n\nclass TestVLCAPI(unittest.TestCase):\n    # def setUp(self):\n    #    self.seq = range(10)\n    # self.assert_(element in self.seq)\n\n    # We check enum definitions against hardcoded values. In case of\n    # failure, check that the reason is not a change in the .h\n    # definitions.\n    def test_enum_event_type(self):\n        self.assertEqual(vlc.EventType.MediaDurationChanged.value, 2)\n\n    def test_enum_meta(self):\n        self.assertEqual(vlc.Meta.Description.value, 6)\n\n    def test_enum_state(self):\n        self.assertEqual(vlc.State.Playing.value, 3)\n\n    def test_enum_playback_mode(self):\n        self.assertEqual(vlc.PlaybackMode.repeat.value, 2)\n\n    def test_enum_marquee_int_option(self):\n        self.assertEqual(vlc.VideoMarqueeOption.Size.value, 6)\n\n    @unittest.skipIf(not hasattr(vlc, \"AudioOutputDeviceTypes\"),\n                     \"Removed in 4.0 API\")\n    def test_enum_output_device_type(self):\n        self.assertEqual(vlc.AudioOutputDeviceTypes._2F2R.value, 4)\n\n    def test_enum_output_channel(self):\n        if vlc.__version__ >= \"4\":\n            # FIXME: maywe we should strip the first level?\n            self.assertEqual(vlc.AudioOutputStereomode.Dolbys.value, 5)\n        else:\n            self.assertEqual(vlc.AudioOutputChannel.Dolbys.value, 5)\n\n    # Basic libvlc tests\n    def test_instance_creation(self):\n        i = vlc.Instance()\n        self.assertTrue(i)\n\n    def test_libvlc_media(self):\n        # Sometimes fails in 4.0 with\n        # test_libvlc_media (__main__.TestVLCAPI.test_libvlc_media) ... Fatal glibc error: pthread_mutex_lock.c:450 (__pthread_mutex_lock_full): assertion failed: e != ESRCH || !robust\n        mrl = \"/tmp/foo.avi\"\n        i = vlc.Instance()\n        m = i.media_new(mrl)\n        self.assertEqual(m.get_mrl(), \"file://\" + mrl)\n\n    def test_wrapper_media(self):\n        mrl = \"/tmp/foo.avi\"\n        m = vlc.Media(mrl)\n        self.assertEqual(m.get_mrl(), \"file://\" + mrl)\n\n    def test_wrapper_medialist(self):\n        mrl1 = \"/tmp/foo.avi\"\n        mrl2 = \"/tmp/bar.avi\"\n        l = vlc.MediaList([mrl1, mrl2])\n        self.assertEqual(l[1].get_mrl(), \"file://\" + mrl2)\n\n    def test_libvlc_player(self):\n        # Crashes in 4.0 with Segmentation fault\n        mrl = \"/tmp/foo.avi\"\n        i = vlc.Instance()\n        p = i.media_player_new(mrl)\n        self.assertEqual(p.get_media().get_mrl(), \"file://\" + mrl)\n\n    def test_libvlc_none_object(self):\n        i = vlc.Instance()\n        p = i.media_player_new()\n        p.set_media(None)\n        self.assertEqual(p.get_media(), None)\n\n    def test_libvlc_player_state(self):\n        mrl = \"/tmp/foo.avi\"\n        i = vlc.Instance()\n        p = i.media_player_new(mrl)\n        self.assertEqual(p.get_state(), vlc.State.NothingSpecial)\n\n    # Test that the VLC bindings can handle special characters in the filenames\n    def test_libvlc_player_special_chars(self):\n        mrl = \"/tmp/Test 韓 Korean.mp4\"\n        i = vlc.Instance()\n        m = i.media_new(mrl)\n        url_encoded_mrl = urllib.quote(mrl.encode(\"utf-8\"))\n        self.assertEqual(m.get_mrl(), \"file://\" + url_encoded_mrl)\n\n    def test_libvlc_video_new_viewpoint(self):\n        vp = vlc.libvlc_video_new_viewpoint()\n        if vlc.__version__ < \"4\":\n            vp.contents.yaw = 2\n            self.assertEqual(vp.contents.yaw, 2)\n        else:\n            vp.contents.f_yaw = 2\n            self.assertEqual(vp.contents.f_yaw, 2)\n\n    def no_test_callback(self):\n        @vlc.CallbackDecorators.LogCb\n        def log_handler(instance, log_level, ctx, fmt, va_list):\n            try:\n                module, _file, _line = vlc.libvlc_log_get_context(ctx)\n            except TypeError:\n                print(\"vlc.libvlc_log_get_context(ctx)\")\n\n        instance = vlc.Instance(\"--vout dummy --aout dummy\")\n        instance.log_set(log_handler, None)\n        _player = instance.media_player_new()\n\n    def test_equalizer(self):\n        val = 9.5\n        eq = vlc.AudioEqualizer()\n        self.assertEqual(eq.get_amp_at_index(0), 0)\n        eq.set_amp_at_index(val, 1)\n        self.assertEqual(eq.get_amp_at_index(1), val)\n\n    def test_tracks_get(self):\n        self.assertTrue(os.path.exists(VIDEO))\n        m = vlc.Media(VIDEO)\n        m.parse()\n        # Audiotrack is the second one\n        audiotrack = list(m.tracks_get())[1]\n        if vlc.__version__ < \"4\":\n            self.assertEqual(audiotrack.original_fourcc, 0x6134706D)\n        else:\n            self.assertEqual(audiotrack.i_original_fourcc, 0x6134706D)\n        self.assertEqual(m.get_duration(), 5568)\n\n    def test_meta_get(self):\n        self.assertTrue(os.path.exists(VIDEO))\n        m = vlc.Media(VIDEO)\n        m.parse()\n        self.assertEqual(m.get_meta(vlc.Meta.Title), \"Title\")\n        self.assertEqual(m.get_meta(vlc.Meta.Artist), \"Artist\")\n        self.assertEqual(m.get_meta(vlc.Meta.Description), \"Comment\")\n        self.assertEqual(m.get_meta(vlc.Meta.Album), \"Album\")\n        self.assertEqual(m.get_meta(vlc.Meta.AlbumArtist), \"Album Artist\")\n        self.assertEqual(m.get_meta(vlc.Meta.Date), \"2013\")\n        self.assertEqual(m.get_meta(vlc.Meta.Genre), \"Sample\")\n\n    def notest_log_get_context(self):\n        \"\"\"Semi-working test for log_get_context.\n\n        It crashes with a Segmentation fault after displaying some\n        messages. This should be fixed + a better test should be\n        devised so that we do not clutter the terminal.\n        \"\"\"\n        libc = ctypes.cdll.LoadLibrary(\n            \"libc.{}\".format(\"so.6\" if os.uname()[0] == \"Linux\" else \"dylib\")\n        )\n\n        @vlc.CallbackDecorators.LogCb\n        def log_handler(instance, log_level, ctx, fmt, va_list):\n            bufferString = ctypes.create_string_buffer(4096)\n            libc.vsprintf(bufferString, fmt, ctypes.cast(va_list, ctypes.c_void_p))\n            msg = bufferString.value.decode(\"utf-8\")\n            module, _file, _line = vlc.libvlc_log_get_context(ctx)\n            module = module.decode(\"utf-8\")\n            try:\n                logger.warn(\n                    \"log_level={log_level}, module={module}, msg={msg}\".format(\n                        log_level=log_level, module=module, msg=msg\n                    )\n                )\n            except Exception as e:\n                logger.exception(e)\n                import pdb\n\n                pdb.set_trace()\n\n        instance = vlc.Instance(\"--vout dummy --aout dummy\")\n        instance.log_set(log_handler, None)\n        player = instance.media_player_new()\n        media = instance.media_new(VIDEO)\n        player.set_media(media)\n        player.play()\n\n    @unittest.skipIf(vlc.__version__ >= \"4\",\n            \"Blocking in 4.0 version - FIXME to investigate\")\n    def test_event_cbs(self):\n        n_event_playing = 0\n        n_event_paused = 0\n        n_event_stopped = 0\n\n        inst = vlc.Instance(\"--vout dummy --aout dummy\")\n        m = inst.media_new(SONG)\n        player = inst.media_player_new()\n        player.set_media(m)\n\n        # No need for decorator when using EventManager.event_attach,\n        # because it is handwritten and accepts a Python function directly.\n        def register_event(event, data):\n            nonlocal n_event_playing\n            nonlocal n_event_paused\n            nonlocal n_event_stopped\n\n            match str(event.type):\n                case \"EventType.MediaPlayerPlaying\":\n                    n_event_playing += 1\n                case \"EventType.MediaPlayerPaused\":\n                    n_event_paused += 1\n                case \"EventType.MediaPlayerStopped\":\n                    n_event_stopped += 1\n                case _:\n                    raise Exception(f\"Unexpected event: got {event.type}\")\n\n        # Using event_attach method\n        em = player.event_manager()\n        em.event_attach(vlc.EventType.MediaPlayerPlaying, register_event, \"some data\")\n        em.event_attach(vlc.EventType.MediaPlayerPaused, register_event, \"some data\")\n        em.event_attach(vlc.EventType.MediaPlayerStopped, register_event, \"some data\")\n\n        @vlc.CallbackDecorators.Callback\n        def register_event_cb(p_event, p_data):\n            nonlocal n_event_playing\n            nonlocal n_event_paused\n            nonlocal n_event_stopped\n\n            event = ctypes.cast(p_event, ctypes.POINTER(vlc.Event)).contents\n            _data = ctypes.cast(p_data, ctypes.c_char_p).value\n\n            match str(event.type):\n                case \"EventType.MediaPlayerPlaying\":\n                    n_event_playing += 1\n                case \"EventType.MediaPlayerPaused\":\n                    n_event_paused += 1\n                case \"EventType.MediaPlayerStopped\":\n                    n_event_stopped += 1\n                case _:\n                    raise Exception(f\"Unexpected event: got {event.type}\")\n\n        # Using the libvlc_event_attach function\n        em = player.event_manager()\n        data = b\"some data\"\n        vlc.libvlc_event_attach(\n            em, vlc.EventType.MediaPlayerPlaying, register_event_cb, data\n        )\n        vlc.libvlc_event_attach(\n            em, vlc.EventType.MediaPlayerPaused, register_event_cb, data\n        )\n        vlc.libvlc_event_attach(\n            em, vlc.EventType.MediaPlayerStopped, register_event_cb, data\n        )\n\n        n = 3\n        for _ in range(n):\n            player.play()\n            while player.get_state() != vlc.State.Playing:\n                continue\n            player.pause()\n            while player.get_state() != vlc.State.Paused:\n                continue\n            player.stop()\n\n        assert n_event_playing == 2 * n\n        assert n_event_paused == 2 * n\n        assert n_event_stopped == 2 * n\n\n        player.release()\n        m.release()\n        inst.release()\n\n    @unittest.skipIf(vlc.__version__ >= \"4\",\n            \"PfDisplayError is not available in 4.0 - we have to port this test to the new dialog.set_error API\")\n    def test_dialog_cbs(self):\n        global __calls_stats__\n        __calls_stats__ = {}\n\n        class MyData:\n            def __init__(self, data):\n                self.data = data\n\n        @vlc.DialogCbs.PfDisplayError\n        @call_stats\n        def display_error_cb(p_data, psz_title, psz_text):\n            data = ctypes.cast(\n                p_data, ctypes.POINTER(ctypes.py_object)\n            ).contents.value.data\n            return data\n\n        @vlc.DialogCbs.PfDisplayLogin\n        @call_stats\n        def display_login_cb(\n            p_data, p_id, psz_title, psz_text, psz_default_username, b_ask_store\n        ):\n            data = ctypes.cast(\n                p_data, ctypes.POINTER(ctypes.py_object)\n            ).contents.value.data\n            return data\n\n        @vlc.DialogCbs.PfDisplayQuestion\n        @call_stats\n        def display_question_cb(\n            p_data,\n            p_id,\n            psz_title,\n            psz_text,\n            i_type,\n            psz_cancel,\n            psz_actypesion1,\n            psz_actypesion2,\n        ):\n            data = ctypes.cast(\n                p_data, ctypes.POINTER(ctypes.py_object)\n            ).contents.value.data\n            return data\n\n        @vlc.DialogCbs.PfDisplayProgress\n        @call_stats\n        def display_progress_cb(\n            p_data,\n            p_id,\n            psz_title,\n            psz_text,\n            b_indeterminate,\n            f_position,\n            psz_cancel,\n        ):\n            data = ctypes.cast(\n                p_data, ctypes.POINTER(ctypes.py_object)\n            ).contents.value.data\n            return data\n\n        @vlc.DialogCbs.PfCancel\n        @call_stats\n        def cancel_cb(p_data, p_id):\n            data = ctypes.cast(\n                p_data, ctypes.POINTER(ctypes.py_object)\n            ).contents.value.data\n            return data\n\n        @vlc.DialogCbs.PfUpdateProgress\n        @call_stats\n        def update_progress_cb(p_data, p_id, f_position, psz_text):\n            data = ctypes.cast(\n                p_data, ctypes.POINTER(ctypes.py_object)\n            ).contents.value.data\n            return data\n\n        inst = vlc.Instance(\"--vout dummy --aout dummy\")\n        dialog_cbs = vlc.DialogCbs()\n        dialog_cbs.pf_display_error = display_error_cb\n        dialog_cbs.pf_display_login = display_login_cb\n        dialog_cbs.pf_display_question = display_question_cb\n        dialog_cbs.pf_display_progress = display_progress_cb\n        dialog_cbs.pf_cancel = cancel_cb\n        dialog_cbs.pf_update_progress = update_progress_cb\n        dialog_cbs_ptr = ctypes.pointer(dialog_cbs)\n        data_str = \"some data\"\n        data = MyData(data_str)\n        data_obj = ctypes.py_object(data)\n        data_ptr = ctypes.byref(data_obj)\n        vlc.libvlc_dialog_set_callbacks(inst, dialog_cbs_ptr, data_ptr)\n\n        # Check that display_error_cb gets called when an invalid MRL is played.\n        # Other callbacks are hard to trigger progammatically, so we only test the error one.\n        m = inst.media_new_path(\"invalid_path_that_will_trigger_error_dialog\")\n        mp = vlc.MediaPlayer(inst)\n        mp.set_media(m)\n        mp.play()\n        # need some time for the player to launch and the error dialog to get triggered\n        sleep(0.2)\n        mp.release()\n        m.release()\n        inst.release()\n\n        assert __calls_stats__[\"display_error_cb\"][\"n_calls\"] == 1\n        assert __calls_stats__[\"display_error_cb\"][\"last_return_value\"] == data_str\n\n    @unittest.skipIf(vlc.__version__ >= \"4\",\n            \"SetExitHandler has been removed from 4.0\")\n    def test_exit_handler(self):\n        global __calls_stats__\n        __calls_stats__ = {}\n\n        inst = vlc.Instance(\"\")\n\n        @vlc.LibvlcSetExitHandlerCb\n        @call_stats\n        def exit(opaque):\n            return ctypes.cast(opaque, ctypes.c_char_p).value\n\n        data = b\"some data\"\n        vlc.libvlc_set_exit_handler(inst, exit, data)\n\n        inst.release()\n\n        assert __calls_stats__[\"exit\"][\"n_calls\"] == 1\n        assert __calls_stats__[\"exit\"][\"last_return_value\"] == data\n\n\nif __name__ == \"__main__\":\n    logging.basicConfig()\n    unittest.main()\n"
  },
  {
    "path": "tests/test_generator.py",
    "content": "#! /usr/bin/env python\n# This Python file uses the following encoding: utf-8\n\n#\n# Code generator for python ctypes bindings for VLC\n# Copyright (C) 2009 the VideoLAN team\n# $Id: $\n#\n# Authors: Olivier Aubert <contact at olivieraubert.net>\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 2 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n#\n\n\"\"\"Unittest module for testing the generator.\"\"\"\n\nimport logging\nimport unittest\nfrom pathlib import Path\n\nfrom generator.generate import (\n    Enum,\n    Func,\n    Par,\n    Parser,\n    Struct,\n    Union,\n    Val,\n    class_re,\n    clean_doxygen_comment,\n    def_re,\n    snake_to_camel_case,\n    strip_whitespaces,\n)\n\nlogger = logging.getLogger(__name__)\n\n\n# Test internal generator only in python3\nclass TestREs(unittest.TestCase):\n    def test_class_re_method(self):\n        self.assertIsNone(class_re.match(\"    def __new__(cls, arg=None):\\n\"))\n\n    def test_class_re(self):\n        match = class_re.match(\"class Instance:\\n\")\n        self.assertEqual(match.group(1), \"Instance\")\n\n    def test_def_re(self):\n        self.assertEqual(\n            def_re.findall(\n                \"\\n    def __new__(cls, *args):\\n\\n   def get_instance(self):\\n\\n    def add_media(self, mrl):\\n\\n\"\n            ),\n            [\"__new__\", \"get_instance\", \"add_media\"],\n        )\n\n\nclass TestUtils(unittest.TestCase):\n    \"\"\"Test utility functions\"\"\"\n\n    def test_strip_whitespaces(self):\n        test_cases = [\n            ([], []),\n            ([\"a\", \"b\"], [\"a\", \"b\"]),\n            ([\"\", \"a\", \"b\", \"\"], [\"a\", \"b\"]),\n            ([\"\\n\", \"\\t\", \"a\", \"b\", \"\\n\", \" \"], [\"a\", \"b\"]),\n            ([\" \", \"a\", \"b\", \"\\n\", \"\\r\", \"\\f\"], [\"a\", \"b\"]),\n            ([\"\\n\", \"a\", \"\\n\", \"b\", \"\\n\"], [\"a\", \"\\n\", \"b\"]),\n            ((), ()),\n            ((\"\", \"a\", \"b\", \"\"), (\"a\", \"b\")),\n            ((\"\\n\", \"\\t\", \"a\", \"b\", \"\\n\", \" \"), (\"a\", \"b\")),\n            ((\" \", \"a\", \"b\", \"\\n\", \"\\r\", \"\\f\"), (\"a\", \"b\")),\n            ((\"\\n\", \"a\", \" \", \"b\", \"\\n\"), (\"a\", \" \", \"b\")),\n            (\"\", \"\"),\n            (\"ab\", \"ab\"),\n            (\"\\n\\tab\\n \", \"ab\"),\n            (\" ab\\n\\r\\f\", \"ab\"),\n            (\"\\na b\\n\", \"a b\"),\n        ]\n\n        for input, expected_result in test_cases:\n            self.assertEqual(strip_whitespaces(input), expected_result)\n\n\nclass TestParser(unittest.TestCase):\n    def get_parser(self, code_file: Path | str) -> Parser:\n        return Parser(\n            code_file,\n            \"./tests/test_parser_inputs/libvlc_version_without_extra.h\",\n        )\n\n    def test_parse_enums(self):\n        expected_enums = [\n            Enum(\n                \"libvlc_enum_no_values_specified\",\n                \"enum\",\n                [\n                    Val(\"G\", \"0\"),\n                    Val(\"H\", \"1\"),\n                    Val(\"I\", \"2\"),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_all_values_specified\",\n                \"enum\",\n                [\n                    Val(\"J\", \"2\"),\n                    Val(\"K\", \"4\"),\n                    Val(\"L\", \"6\"),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_values_specified_or_not\",\n                \"enum\",\n                [\n                    Val(\"M\", \"5\"),\n                    Val(\"N\", \"6\"),\n                    Val(\"O\", \"8\"),\n                    Val(\"P\", \"9\"),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_with_docs\",\n                \"enum\",\n                [\n                    Val(\"Q\", \"5\"),\n                    Val(\"R\", \"6\"),\n                    Val(\"S\", \"8\"),\n                    Val(\"T\", \"9\"),\n                ],\n                \"\"\"Some Doxygen\ndocumentation\nthat spans\nmultiple lines\"\"\",\n            ),\n            Enum(\n                \"libvlc_enum_with_hex_values\",\n                \"enum\",\n                [\n                    Val(\"U\", \"0x1\"),\n                    Val(\"V\", \"0xf\"),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_with_bit_shifted_values\",\n                \"enum\",\n                [\n                    Val(\"W\", \"7471104\"),\n                    Val(\"X\", \"6750208\"),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_with_deprecated_values\",\n                \"enum\",\n                [],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_with_documented_values\",\n                \"enum\",\n                [\n                    Val(\"B1\", \"0\", \"This is a single line comment for B1.\"),\n                    Val(\n                        \"B2\",\n                        \"1\",\n                        \"\"\"This is a multi line\ncomment for B2.\"\"\",\n                    ),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_no_values_specified_t\",\n                \"enum\",\n                [\n                    Val(\"GG\", \"0\"),\n                    Val(\"HH\", \"1\"),\n                    Val(\"II\", \"2\"),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_all_values_specified_t\",\n                \"enum\",\n                [\n                    Val(\"JJ\", \"2\"),\n                    Val(\"KK\", \"4\"),\n                    Val(\"LL\", \"6\"),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_values_specified_or_not_t\",\n                \"enum\",\n                [\n                    Val(\"MM\", \"5\"),\n                    Val(\"NN\", \"6\"),\n                    Val(\"OO\", \"8\"),\n                    Val(\"PP\", \"9\"),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_with_docs_t\",\n                \"enum\",\n                [\n                    Val(\"QQ\", \"5\"),\n                    Val(\"RR\", \"6\"),\n                    Val(\"SS\", \"8\"),\n                    Val(\"TT\", \"9\"),\n                ],\n                \"\"\"Some Doxygen\ndocumentation\nthat spans\nmultiple lines\"\"\",\n            ),\n            Enum(\n                \"libvlc_enum_with_hex_values_t\",\n                \"enum\",\n                [\n                    Val(\"UU\", \"0x1\"),\n                    Val(\"VV\", \"0xf\"),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_with_bit_shifted_values_t\",\n                \"enum\",\n                [\n                    Val(\"WW\", \"7471104\"),\n                    Val(\"XX\", \"6750208\"),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_t\",\n                \"enum\",\n                [\n                    Val(\"ZZ\", \"0\"),\n                ],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_with_deprecated_values_t\",\n                \"enum\",\n                [],\n                \"\",\n            ),\n            Enum(\n                \"libvlc_enum_with_documented_values_t\",\n                \"enum\",\n                [\n                    Val(\"BB1\", \"0\", \"This is a single line comment for BB1.\"),\n                    Val(\n                        \"BB2\",\n                        \"1\",\n                        \"\"\"This is a multi line\ncomment for BB2.\"\"\",\n                    ),\n                ],\n                \"\",\n            ),\n        ]\n\n        p = self.get_parser(\"./tests/test_parser_inputs/enums.h\")\n        self.assertCountEqual(p.enums, expected_enums)\n\n    def test_parse_structs(self):\n        expected_structs = [\n            Struct(\n                \"libvlc_struct_no_values_specified\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_all_values_specified\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_docs\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"double\", [False]),\n                ],\n                \"\"\"Some Doxygen\ndocumentation\nthat spans\nmultiple lines\"\"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_const\",\n                \"struct\",\n                [\n                    Par(\"x\", \"char\", [True]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_pointers\",\n                \"struct\",\n                [\n                    Par(\"x\", \"int*\", [True, False]),\n                    Par(\"y\", \"double*\", [False, True]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_anonymous_nested_union\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"char\", [False]),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_named_nested_union\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Union(\n                        \"u\",\n                        \"union\",\n                        [\n                            Par(\"b\", \"char\", [False]),\n                            Par(\"c\", \"char\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_anonymous_nested_struct\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"char\", [False]),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_named_nested_struct\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Struct(\n                        \"s\",\n                        \"struct\",\n                        [\n                            Par(\"b\", \"char\", [False]),\n                            Par(\"c\", \"char\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_nested_anonymous_union_and_struct\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"char\", [False]),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_nested_named_union_and_struct\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Union(\n                        \"u\",\n                        \"union\",\n                        [\n                            Par(\"b\", \"char\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Struct(\n                        \"s\",\n                        \"struct\",\n                        [\n                            Par(\"c\", \"char\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_nested_anonymous_union_and_nested_struct_inside\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"char\", [False]),\n                    Par(\"d\", \"char\", [False]),\n                    Par(\"e\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_nested_named_union_and_nested_struct_inside\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Union(\n                        \"u\",\n                        \"union\",\n                        [\n                            Par(\"b\", \"char\", [False]),\n                            Struct(\n                                \"s1\",\n                                \"struct\",\n                                [\n                                    Par(\"c\", \"char\", [False]),\n                                ],\n                            ),\n                            Struct(\n                                \"s2\",\n                                \"struct\",\n                                [\n                                    Par(\"d\", \"char\", [False]),\n                                ],\n                            ),\n                        ],\n                        \"\",\n                    ),\n                    Par(\"e\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_callbacks\",\n                \"struct\",\n                [\n                    Func(\"cb1\", \"void\", [], \"Some docs for cb1.\"),\n                    Func(\"cb2\", \"void\", [], \"Some docs for cb2.\"),\n                    Func(\"cb3\", \"void\", [], \"Some docs for cb3.\"),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_complex_callbacks\",\n                \"struct\",\n                [\n                    Func(\n                        \"cb1\",\n                        \"char*\",\n                        [\n                            Par(\"a\", \"int\", [False]),\n                            Par(\"b\", \"double\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Func(\n                        \"cb2\",\n                        \"char**\",\n                        [\n                            Par(\"a\", \"int\", [False]),\n                            Par(\"b\", \"double\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Func(\n                        \"cb3\",\n                        \"char***\",\n                        [\n                            Par(\"a\", \"int\", [False]),\n                            Par(\"b\", \"double\", [False]),\n                        ],\n                        \"\",\n                    ),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_cb_taking_cb_as_argument\",\n                \"struct\",\n                [\n                    Func(\n                        \"cb\",\n                        \"char*\",\n                        [\n                            Func(\n                                \"cb_param\",\n                                \"int\",\n                                [\n                                    Par(\"a\", \"int\", [False]),\n                                    Par(\"b\", \"double\", [False]),\n                                    Par(\"c\", \"char\", [False]),\n                                ],\n                                \"\",\n                            )\n                        ],\n                        \"\",\n                    )\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_no_values_specified_t\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_all_values_specified_t\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_docs_t\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"double\", [False]),\n                ],\n                \"\"\"Some Doxygen\ndocumentation\nthat spans\nmultiple lines\"\"\",\n            ),\n            Struct(\n                \"libvlc_struct_t\",\n                \"struct\",\n                [\n                    Par(\"x\", \"char\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_const_t\",\n                \"struct\",\n                [\n                    Par(\"x\", \"char\", [True]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_pointers_t\",\n                \"struct\",\n                [\n                    Par(\"x\", \"int*\", [True, False]),\n                    Par(\"y\", \"double*\", [False, True]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_anonymous_nested_union_t\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"char\", [False]),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_named_nested_union_t\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Union(\n                        \"u\",\n                        \"union\",\n                        [\n                            Par(\"b\", \"char\", [False]),\n                            Par(\"c\", \"char\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_anonymous_nested_struct_t\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"char\", [False]),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_named_nested_struct_t\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Struct(\n                        \"s\",\n                        \"struct\",\n                        [\n                            Par(\"b\", \"char\", [False]),\n                            Par(\"c\", \"char\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_nested_anonymous_union_and_struct_t\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"char\", [False]),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_nested_named_union_and_struct_t\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Union(\n                        \"u\",\n                        \"union\",\n                        [\n                            Par(\"b\", \"char\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Struct(\n                        \"s\",\n                        \"struct\",\n                        [\n                            Par(\"c\", \"char\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_nested_anonymous_union_and_nested_struct_inside_t\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"char\", [False]),\n                    Par(\"c\", \"char\", [False]),\n                    Par(\"d\", \"char\", [False]),\n                    Par(\"e\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_nested_named_union_and_nested_struct_inside_t\",\n                \"struct\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Union(\n                        \"u\",\n                        \"union\",\n                        [\n                            Par(\"b\", \"char\", [False]),\n                            Struct(\n                                \"s1\",\n                                \"struct\",\n                                [\n                                    Par(\"c\", \"char\", [False]),\n                                ],\n                            ),\n                            Struct(\n                                \"s2\",\n                                \"struct\",\n                                [\n                                    Par(\"d\", \"char\", [False]),\n                                ],\n                            ),\n                        ],\n                        \"\",\n                    ),\n                    Par(\"e\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_callbacks_t\",\n                \"struct\",\n                [\n                    Func(\"cb1\", \"void\", [], \"Some docs for cb1.\"),\n                    Func(\"cb2\", \"void\", [], \"Some docs for cb2.\"),\n                    Func(\"cb3\", \"void\", [], \"Some docs for cb3.\"),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_complex_callbacks_t\",\n                \"struct\",\n                [\n                    Func(\n                        \"cb1\",\n                        \"char*\",\n                        [\n                            Par(\"a\", \"int\", [False]),\n                            Par(\"b\", \"double\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Func(\n                        \"cb2\",\n                        \"char**\",\n                        [\n                            Par(\"a\", \"int\", [False]),\n                            Par(\"b\", \"double\", [False]),\n                        ],\n                        \"\",\n                    ),\n                    Func(\n                        \"cb3\",\n                        \"char***\",\n                        [\n                            Par(\"a\", \"int\", [False]),\n                            Par(\"b\", \"double\", [False]),\n                        ],\n                        \"\",\n                    ),\n                ],\n                \"\",\n            ),\n            Struct(\n                \"libvlc_struct_with_cb_taking_cb_as_argument_t\",\n                \"struct\",\n                [\n                    Func(\n                        \"cb\",\n                        \"char*\",\n                        [\n                            Func(\n                                \"cb_param\",\n                                \"int\",\n                                [\n                                    Par(\"a\", \"int\", [False]),\n                                    Par(\"b\", \"double\", [False]),\n                                    Par(\"c\", \"char\", [False]),\n                                ],\n                                \"\",\n                            )\n                        ],\n                        \"\",\n                    )\n                ],\n                \"\",\n            ),\n        ]\n\n        p = self.get_parser(\"./tests/test_parser_inputs/structs.h\")\n        self.assertCountEqual(p.structs, expected_structs)\n\n    def test_parse_funcs(self):\n        expected_funcs = [\n            Func(\"libvlc_simple\", \"void\", [], \"\"),\n            Func(\"libvlc_simple_with_void\", \"void\", [], \"\"),\n            Func(\"libvlc_attribute_on_the_previous_line\", \"void\", [], \"\"),\n            Func(\n                \"libvlc_with_docs\",\n                \"void\",\n                [],\n                \"\"\"Some Doxygen\ndocumentation\nthat spans\nmultiple lines\"\"\",\n            ),\n            Func(\n                \"libvlc_simple_types\",\n                \"char\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"float\", [False]),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_pointer_as_return_type\",\n                \"char*\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"float\", [False]),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_pointer_as_return_type_with_qualifier\",\n                \"char*\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"float\", [False]),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_pointers_and_qualifiers_everywhere\",\n                \"char*\",\n                [\n                    Par(\"c1\", \"char*\", [True, False]),\n                    Par(\"c2\", \"char*\", [True, False]),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_multiple_pointers\",\n                \"char**\",\n                [\n                    Par(\"c1\", \"char**\", [False, False, False]),\n                    Par(\"c2\", \"char***\", [False, False, False, False]),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_multiple_pointers_and_qualifiers\",\n                \"char**\",\n                [\n                    Par(\"c1\", \"char**\", [True, False, True]),\n                    Par(\n                        \"c2\",\n                        \"char***\",\n                        [False, True, True, True],\n                    ),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_function_pointer_as_param\",\n                \"void\",\n                [Func(\"cb\", \"void\", [], \"\")],\n                \"\",\n            ),\n            Func(\n                \"libvlc_complex_function_pointer_as_param\",\n                \"void\",\n                [\n                    Func(\n                        \"cb\",\n                        \"char*\",\n                        [Par(\"\", \"char***\", [False, True, True, False])],\n                        \"\",\n                    )\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_complex_function_pointer_as_param_with_named_params\",\n                \"void\",\n                [\n                    Func(\n                        \"cb\",\n                        \"char**\",\n                        [\n                            Par(\"c1\", \"char***\", [False, True, True, False]),\n                            Par(\"c2\", \"char***\", [False, True, False, False]),\n                        ],\n                        \"\",\n                    ),\n                    Par(\"i\", \"int\", [False]),\n                    Par(\"d\", \"double\", [False]),\n                ],\n                \"\",\n            ),\n        ]\n\n        p = self.get_parser(\"./tests/test_parser_inputs/funcs.h\")\n        self.assertCountEqual(p.funcs, expected_funcs)\n\n    def test_parse_callbacks(self):\n        expected_callbacks = [\n            Func(\"libvlc_simple_cb\", \"void\", [], \"\"),\n            Func(\"libvlc_simple_with_void_cb\", \"void\", [], \"\"),\n            Func(\n                \"libvlc_simple_with_void_pointers_cb\",\n                \"void*\",\n                [\n                    Par(\"p\", \"void*\", [False, False]),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_simple_types_cb\",\n                \"char\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"float\", [False]),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_with_docs_cb\",\n                \"char\",\n                [\n                    Par(\"a\", \"int\", [False]),\n                    Par(\"b\", \"float\", [False]),\n                ],\n                \"\"\"Some Doxygen\ndocumentation\nthat spans\nmultiple lines\"\"\",\n            ),\n            Func(\n                \"libvlc_one_pointer_cb\",\n                \"char*\",\n                [\n                    Par(\"c1\", \"char*\", [False, False]),\n                    Par(\"c2\", \"char*\", [False, False]),\n                    Par(\"c3\", \"char*\", [False, False]),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_one_pointer_and_const_cb\",\n                \"char*\",\n                [\n                    Par(\"c1\", \"char*\", [True, False]),\n                    Par(\"c2\", \"char*\", [False, False]),\n                    Par(\"c3\", \"char*\", [False, False]),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_multiple_pointers_cb\",\n                \"char**\",\n                [\n                    Par(\"c1\", \"char**\", [False, False, False]),\n                    Par(\"c2\", \"char***\", [False, False, False, False]),\n                    Par(\"c3\", \"char****\", [False, False, False, False, False]),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_multiple_pointers_with_const_cb\",\n                \"char**\",\n                [\n                    Par(\"c1\", \"char**\", [True, True, False]),\n                    Par(\"c2\", \"char***\", [False, True, True, True]),\n                    Par(\"c3\", \"char****\", [False, True, False, True, False]),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_function_pointer_as_param_cb\",\n                \"void\",\n                [\n                    Func(\"cb\", \"void\", [], \"\"),\n                ],\n                \"\",\n            ),\n            Func(\n                \"libvlc_complex_function_pointer_as_param_cb\",\n                \"void\",\n                [\n                    Func(\n                        \"cb\",\n                        \"char*\",\n                        [\n                            Par(\"\", \"char***\", [False, True, True, False]),\n                            Par(\"\", \"int\", [False]),\n                            Par(\"\", \"double\", [False]),\n                        ],\n                        \"\",\n                    ),\n                ],\n                \"\",\n            ),\n        ]\n\n        p = self.get_parser(\"./tests/test_parser_inputs/callbacks.h\")\n        self.assertCountEqual(p.callbacks, expected_callbacks)\n\n    def test_parse_version(self):\n        p = Parser(\n            # Can use any valid path, it doesn't matter\n            \"./tests/test_parser_inputs/libvlc_version_without_extra.h\",\n            # There it matters\n            \"./tests/test_parser_inputs/libvlc_version_without_extra.h\",\n        )\n        self.assertEqual(p.version, \"3.0.16\")\n\n        p = Parser(\n            # Can use any valid path, it doesn't matter\n            \"./tests/test_parser_inputs/libvlc_version_with_extra.h\",\n            # There it matters\n            \"./tests/test_parser_inputs/libvlc_version_with_extra.h\",\n        )\n        self.assertEqual(p.version, \"4.2.14.3\")\n\n\nclass TestUtilities(unittest.TestCase):\n    def test_clean_doxygen_comment(self):\n        test_cases = [\n            # non javadoc style comments should be ignored\n            (\"// regular comment\", \"\"),\n            (\n                \"\"\"/* multiline\ncomment\n */\"\"\",\n                \"\",\n            ),\n            # Then valid javadoc style comments...\n            (\n                \"/** single line doxygen comment */\",\n                \"single line doxygen comment\",\n            ),\n            (\n                \"/**single line comment with trailing spaces           */\",\n                \"single line comment with trailing spaces\",\n            ),\n            (\n                \"\"\"/**\n * extra spaces everywhere           \n *\n         */\"\"\",\n                \"extra spaces everywhere\",\n            ),\n            (\n                \"\"\"/** multiline\n * doxygen\n * comment\n */\"\"\",\n                \"\"\"multiline\ndoxygen\ncomment\"\"\",\n            ),\n            (\n                \"\"\"/** preserve\n *\n * blank lines\n *\n * in between\n */\"\"\",\n                \"\"\"preserve\n\nblank lines\n\nin between\"\"\",\n            ),\n            # real world comments (coming from liblvc)\n            (\n                r\"\"\"/**\n * Start playing (if there is any item in the playlist).\n *\n * Additionnal playlist item options can be specified for addition to the\n * item before it is played.\n *\n * \\param p_instance the playlist instance\n * \\param i_id the item to play. If this is a negative number, the next\n *        item will be selected. Otherwise, the item with the given ID will be\n *        played\n * \\param i_options the number of options to add to the item\n * \\param ppsz_options the options to add to the item\n */\"\"\",\n                r\"\"\"Start playing (if there is any item in the playlist).\n\nAdditionnal playlist item options can be specified for addition to the\nitem before it is played.\n\n\\param p_instance the playlist instance\n\\param i_id the item to play. If this is a negative number, the next\nitem will be selected. Otherwise, the item with the given ID will be\nplayed\n\\param i_options the number of options to add to the item\n\\param ppsz_options the options to add to the item\"\"\",\n            ),\n        ]\n\n        for input, expected_output in test_cases:\n            self.assertEqual(clean_doxygen_comment(input), expected_output)\n\n    def test_snake_to_camel_case(self):\n        test_cases = [\n            (\"\", \"\"),\n            (\"one\", \"one\"),\n            (\"one234\", \"one234\"),\n            (\"_one\", \"_one\"),\n            (\"__one\", \"__one\"),\n            (\"one_\", \"one_\"),\n            (\"one__\", \"one__\"),\n            (\"one_two_three_four\", \"oneTwoThreeFour\"),\n            (\"One_Two_Three_Four\", \"oneTwoThreeFour\"),\n        ]\n\n        for input, expected_output in test_cases:\n            self.assertEqual(snake_to_camel_case(input), expected_output)\n\n\nif __name__ == \"__main__\":\n    logging.basicConfig()\n    unittest.main()\n"
  },
  {
    "path": "tests/test_parser_inputs/callbacks.h",
    "content": "typedef void (*not_in_libvlc_cb)();\n\ntypedef void (*libvlc_simple_cb)();\n\ntypedef void (*libvlc_simple_with_void_cb)(void);\n\ntypedef void *(*libvlc_simple_with_void_pointers_cb)(void *p);\n\ntypedef char (*libvlc_simple_types_cb)(int a, float b);\n\n/** Some Doxygen\n * documentation\n * that spans\n * multiple lines\n */\ntypedef char (*libvlc_with_docs_cb)(int a, float b);\n\ntypedef char *(*libvlc_one_pointer_cb)(char *c1, char *c2, char *c3);\n\ntypedef const char *(*libvlc_one_pointer_and_const_cb)(const char *c1, char *c2,\n                                                       char *c3);\n\ntypedef char **(*libvlc_multiple_pointers_cb)(char **c1, char ***c2,\n                                              char ****c3);\n\ntypedef const char **(*libvlc_multiple_pointers_with_const_cb)(\n    const char *const *c1, char *const *const *const c2,\n    char *const **const *c3);\n\ntypedef void (*libvlc_function_pointer_as_param_cb)(void (*cb)());\n\ntypedef void (*libvlc_complex_function_pointer_as_param_cb)(\n    const char *(*cb)(char *const *const *, int, double));\n"
  },
  {
    "path": "tests/test_parser_inputs/enums.h",
    "content": "// ============================================================================\n// Regular enums\n// ============================================================================\nenum not_from_libvlc_enum { A, B, C };\n\n// Anonymous enum\nenum { D, E, F };\n\nenum libvlc_enum_no_values_specified { G, H, I };\n\nenum libvlc_enum_all_values_specified { J = 2, K = 4, L = 6 };\n\nenum libvlc_enum_values_specified_or_not {\n  M = 5,\n  N, // Expect 6\n  O = 8,\n  P // Expect 9\n};\n\n/** Some Doxygen\n * documentation\n * that spans\n * multiple lines\n */\nenum libvlc_enum_with_docs {\n  Q = 5,\n  R, // Expect 6\n  S = 8,\n  T // Expect 9\n};\n\nenum libvlc_enum_with_hex_values { U = 0x1, V = 0xf };\n\nenum libvlc_enum_with_bit_shifted_values { W = 'r' << 16, X = 'g' << 16 };\n\nenum libvlc_enum_with_deprecated_values {\n  A1 __attribute__((deprecated)) = 1,\n  A2 __attribute__((deprecated))\n};\n\nenum libvlc_enum_with_documented_values {\n  /** This is a single line comment for B1. */\n  B1,\n  /** This is a multi line\n   * comment for B2.\n   */\n  B2,\n};\n\n// ============================================================================\n// Typedef enums\n// ============================================================================\ntypedef enum not_from_libvlc_enum_t { AA, BB, CC } not_from_libvlc_enum_t;\n\ntypedef enum libvlc_enum_no_values_specified_t {\n  GG,\n  HH,\n  II\n} libvlc_enum_no_values_specified_t;\n\ntypedef enum libvlc_enum_all_values_specified_t {\n  JJ = 2,\n  KK = 4,\n  LL = 6\n} libvlc_enum_all_values_specified_t;\n\ntypedef enum libvlc_enum_values_specified_or_not_t {\n  MM = 5,\n  NN, // Expect 6\n  OO = 8,\n  PP // Expect 9\n} libvlc_enum_values_specified_or_not_t;\n\n/** Some Doxygen\n * documentation\n * that spans\n * multiple lines\n */\ntypedef enum libvlc_enum_with_docs_t {\n  QQ = 5,\n  RR, // Expect 6\n  SS = 8,\n  TT // Expect 9\n} libvlc_enum_with_docs_t;\n\ntypedef enum libvlc_enum_with_hex_values_t {\n  UU = 0x1,\n  VV = 0xf\n} libvlc_enum_with_hex_values_t;\n\ntypedef enum libvlc_enum_with_bit_shifted_values_t {\n  WW = 'r' << 16,\n  XX = 'g' << 16\n} libvlc_enum_with_bit_shifted_values_t;\n\n// To test that the name taken into account\n// is the typedef's name, not the enum's name.\ntypedef enum libvlc_enum { ZZ } libvlc_enum_t;\n\ntypedef enum libvlc_enum_with_deprecated_values_t {\n  AA1 __attribute__((deprecated)) = 1,\n  AA2 __attribute__((deprecated))\n} libvlc_enum_with_deprecated_values_t;\n\ntypedef enum libvlc_enum_with_documented_values_t {\n  /** This is a single line comment for BB1. */\n  BB1,\n  /** This is a multi line\n   * comment for BB2.\n   */\n  BB2,\n} libvlc_enum_with_documented_values_t;\n"
  },
  {
    "path": "tests/test_parser_inputs/funcs.h",
    "content": "void libvlc_not_in_public_api();\n\n__attribute__((visibility(\"default\"))) void not_a_libvlc_function();\n\n__attribute__((visibility(\"default\"))) void libvlc_simple();\n\n__attribute__((visibility(\"default\"))) void libvlc_simple_with_void(void);\n\n__attribute__((visibility(\"default\"))) void\nlibvlc_attribute_on_the_previous_line();\n\n/** Some Doxygen\n * documentation\n * that spans\n * multiple lines\n */\n__attribute__((visibility(\"default\"))) void libvlc_with_docs();\n\n__attribute__((visibility(\"default\"))) char libvlc_simple_types(int a, float b);\n\n__attribute__((visibility(\"default\"))) char *\nlibvlc_pointer_as_return_type(int a, float b);\n\n__attribute__((visibility(\"default\"))) const char *\nlibvlc_pointer_as_return_type_with_qualifier(int a, float b);\n\n__attribute__((visibility(\"default\"))) const char *\nlibvlc_pointers_and_qualifiers_everywhere(const char *c1, const char *c2);\n\n__attribute__((visibility(\"default\"))) const char **\nlibvlc_multiple_pointers(char **c1, char ***c2);\n\n__attribute__((visibility(\"default\"))) const char *const *\nlibvlc_multiple_pointers_and_qualifiers(const char **const c1,\n                                        char *const *const *const c2);\n\n__attribute__((visibility(\"default\"))) void\nlibvlc_function_pointer_as_param(void (*cb)());\n\n__attribute__((visibility(\"default\"))) void\nlibvlc_complex_function_pointer_as_param(\n    const char *(*cb)(char *const *const *));\n\n__attribute__((visibility(\"default\"))) void\nlibvlc_complex_function_pointer_as_param_with_named_params(\n    char **(*cb)(char *const *const *c1, char *const **c2), int i, double d);\n"
  },
  {
    "path": "tests/test_parser_inputs/libvlc_version_with_extra.h",
    "content": "/*****************************************************************************\n * libvlc_version.h\n *****************************************************************************\n * Copyright (C) 2010 Rémi Denis-Courmont\n *\n * This program is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation; either version 2.1 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * along with this program; if not, write to the Free Software Foundation,\n * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n *****************************************************************************/\n\n/**\n * \\file\n * This file defines version macros for LibVLC.\n * Those macros are primilarly intended for conditional (pre)compilation.\n * To get the run-time LibVLC version, use libvlc_get_version() instead\n * (the run-time version may be more recent than build-time one, thanks to\n * backward binary compatibility).\n *\n * \\version This header file is available in LibVLC 1.1.4 and higher.\n */\n\n#ifndef LIBVLC_VERSION_H\n#define LIBVLC_VERSION_H 1\n\n/** LibVLC major version number */\n#define LIBVLC_VERSION_MAJOR (4)\n\n/** LibVLC minor version number */\n#define LIBVLC_VERSION_MINOR (2)\n\n/** LibVLC revision */\n#define LIBVLC_VERSION_REVISION (14)\n\n#define LIBVLC_VERSION_EXTRA (3)\n\n/** Makes a single integer from a LibVLC version numbers */\n#define LIBVLC_VERSION(maj, min, rev, extra)                                   \\\n  ((maj << 24) | (min << 16) | (rev << 8) | (extra))\n\n/** LibVLC full version as a single integer (for comparison) */\n#define LIBVLC_VERSION_INT                                                     \\\n  LIBVLC_VERSION(LIBVLC_VERSION_MAJOR, LIBVLC_VERSION_MINOR,                   \\\n                 LIBVLC_VERSION_REVISION, LIBVLC_VERSION_EXTRA)\n\n#endif\n"
  },
  {
    "path": "tests/test_parser_inputs/libvlc_version_without_extra.h",
    "content": "/*****************************************************************************\n * libvlc_version.h\n *****************************************************************************\n * Copyright (C) 2010 Rémi Denis-Courmont\n *\n * This program is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation; either version 2.1 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public License\n * along with this program; if not, write to the Free Software Foundation,\n * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.\n *****************************************************************************/\n\n/**\n * \\file\n * This file defines version macros for LibVLC.\n * Those macros are primilarly intended for conditional (pre)compilation.\n * To get the run-time LibVLC version, use libvlc_get_version() instead\n * (the run-time version may be more recent than build-time one, thanks to\n * backward binary compatibility).\n *\n * \\version This header file is available in LibVLC 1.1.4 and higher.\n */\n\n#ifndef LIBVLC_VERSION_H\n#define LIBVLC_VERSION_H 1\n\n/** LibVLC major version number */\n#define LIBVLC_VERSION_MAJOR (3)\n\n/** LibVLC minor version number */\n#define LIBVLC_VERSION_MINOR (0)\n\n/** LibVLC revision */\n#define LIBVLC_VERSION_REVISION (16)\n\n#define LIBVLC_VERSION_EXTRA (0)\n\n/** Makes a single integer from a LibVLC version numbers */\n#define LIBVLC_VERSION(maj, min, rev, extra)                                   \\\n  ((maj << 24) | (min << 16) | (rev << 8) | (extra))\n\n/** LibVLC full version as a single integer (for comparison) */\n#define LIBVLC_VERSION_INT                                                     \\\n  LIBVLC_VERSION(LIBVLC_VERSION_MAJOR, LIBVLC_VERSION_MINOR,                   \\\n                 LIBVLC_VERSION_REVISION, LIBVLC_VERSION_EXTRA)\n\n#endif\n"
  },
  {
    "path": "tests/test_parser_inputs/structs.h",
    "content": "// ============================================================================\n// Regular structs\n// ============================================================================\nstruct not_from_libvlc_struct {\n  int a;\n  char b;\n  double c;\n};\n\nstruct libvlc_struct_no_values_specified {\n  int a;\n  char b;\n  double c;\n};\n\nstruct libvlc_struct_all_values_specified {\n  int a = 1;\n  char b = 'b';\n  double c = 1.1;\n};\n\n/** Some Doxygen\n * documentation\n * that spans\n * multiple lines\n */\nstruct libvlc_struct_with_docs {\n  int a = 2;\n  char b = 'c';\n  double c = 1.2;\n};\n\n// To test constness\nstruct libvlc_struct_with_const {\n  const char x;\n};\n\n// To test pointers and pointers with constness\nstruct libvlc_struct_pointers {\n  const int *x;\n  double *const y;\n};\n\nstruct libvlc_struct_with_anonymous_nested_union {\n  int a;\n  union {\n    char b;\n    char c;\n  };\n  double d;\n};\n\nstruct libvlc_struct_with_named_nested_union {\n  int a;\n  union {\n    char b;\n    char c;\n  } u;\n  double d;\n};\n\nstruct libvlc_struct_with_anonymous_nested_struct {\n  int a;\n  struct {\n    char b;\n    char c;\n  };\n  double d;\n};\n\nstruct libvlc_struct_with_named_nested_struct {\n  int a;\n  struct {\n    char b;\n    char c;\n  } s;\n  double d;\n};\n\nstruct libvlc_struct_with_nested_anonymous_union_and_struct {\n  int a;\n  union {\n    char b;\n  };\n  struct {\n    char c;\n  };\n  double d;\n};\n\nstruct libvlc_struct_with_nested_named_union_and_struct {\n  int a;\n  union {\n    char b;\n  } u;\n  struct {\n    char c;\n  } s;\n  double d;\n};\n\nstruct libvlc_struct_with_nested_anonymous_union_and_nested_struct_inside {\n  int a;\n  union {\n    char b;\n    struct {\n      char c;\n    };\n    struct {\n      char d;\n    };\n  };\n  double e;\n};\n\nstruct libvlc_struct_with_nested_named_union_and_nested_struct_inside {\n  int a;\n  union {\n    char b;\n    struct {\n      char c;\n    } s1;\n    struct {\n      char d;\n    } s2;\n  } u;\n  double e;\n};\n\nstruct libvlc_struct_with_callbacks {\n  /**\n   * Some docs for cb1.\n   */\n  void (*cb1)();\n  /**\n   * Some docs for cb2.\n   */\n  void (*cb2)();\n  /**\n   * Some docs for cb3.\n   */\n  void (*cb3)();\n};\n\nstruct libvlc_struct_with_complex_callbacks {\n  char *(*cb1)(int a, double b);\n  char **(*cb2)(int a, double b);\n  char ***(*cb3)(int a, double b);\n};\n\nstruct libvlc_struct_with_cb_taking_cb_as_argument {\n  char *(*cb)(int (*cb_param)(int a, double b, char c));\n};\n\n// ============================================================================\n// Typedef structs\n// ============================================================================\ntypedef struct not_from_libvlc_struct_t {\n  int a;\n  char b;\n  double c;\n} not_from_libvlc_struct_t;\n\ntypedef struct libvlc_struct_no_values_specified_t {\n  int a;\n  char b;\n  double c;\n} libvlc_struct_no_values_specified_t;\n\ntypedef struct libvlc_struct_all_values_specified_t {\n  int a = 1;\n  char b = 'b';\n  double c = 1.1;\n} libvlc_struct_all_values_specified_t;\n\n/** Some Doxygen\n * documentation\n * that spans\n * multiple lines\n */\ntypedef struct libvlc_struct_with_docs_t {\n  int a = 2;\n  char b = 'c';\n  double c = 1.2;\n} libvlc_struct_with_docs_t;\n\n// To test that the name taken into account\n// is the typedef's name, not the struct's name.\ntypedef struct libvlc_struct {\n  char x;\n} libvlc_struct_t;\n\n// To test constness\ntypedef struct libvlc_struct_with_const_t {\n  const char x;\n} libvlc_struct_with_const_t;\n\n// To test pointers and pointers with constness\ntypedef struct libvlc_struct_pointers_t {\n  const int *x;\n  double *const y;\n} libvlc_struct_pointers_t;\n\ntypedef struct libvlc_struct_with_anonymous_nested_union_t {\n  int a;\n  union {\n    char b;\n    char c;\n  };\n  double d;\n} libvlc_struct_with_anonymous_nested_union_t;\n\ntypedef struct libvlc_struct_with_named_nested_union_t {\n  int a;\n  union {\n    char b;\n    char c;\n  } u;\n  double d;\n} libvlc_struct_with_named_nested_union_t;\n\ntypedef struct libvlc_struct_with_anonymous_nested_struct_t {\n  int a;\n  struct {\n    char b;\n    char c;\n  };\n  double d;\n} libvlc_struct_with_anonymous_nested_struct_t;\n\ntypedef struct libvlc_struct_with_named_nested_struct_t {\n  int a;\n  struct {\n    char b;\n    char c;\n  } s;\n  double d;\n} libvlc_struct_with_named_nested_struct_t;\n\ntypedef struct libvlc_struct_with_nested_anonymous_union_and_struct_t {\n  int a;\n  union {\n    char b;\n  };\n  struct {\n    char c;\n  };\n  double d;\n} libvlc_struct_with_nested_anonymous_union_and_struct_t;\n\ntypedef struct libvlc_struct_with_nested_named_union_and_struct_t {\n  int a;\n  union {\n    char b;\n  } u;\n  struct {\n    char c;\n  } s;\n  double d;\n} libvlc_struct_with_nested_named_union_and_struct_t;\n\ntypedef struct\n    libvlc_struct_with_nested_anonymous_union_and_nested_struct_inside_t {\n  int a;\n  union {\n    char b;\n    struct {\n      char c;\n    };\n    struct {\n      char d;\n    };\n  };\n  double e;\n} libvlc_struct_with_nested_anonymous_union_and_nested_struct_inside_t;\n\ntypedef struct\n    libvlc_struct_with_nested_named_union_and_nested_struct_inside_t {\n  int a;\n  union {\n    char b;\n    struct {\n      char c;\n    } s1;\n    struct {\n      char d;\n    } s2;\n  } u;\n  double e;\n} libvlc_struct_with_nested_named_union_and_nested_struct_inside_t;\n\ntypedef struct libvlc_struct_with_callbacks_t {\n  /**\n   * Some docs for cb1.\n   */\n  void (*cb1)();\n  /**\n   * Some docs for cb2.\n   */\n  void (*cb2)();\n  /**\n   * Some docs for cb3.\n   */\n  void (*cb3)();\n} libvlc_struct_with_callbacks_t;\n\ntypedef struct libvlc_struct_with_complex_callbacks_t {\n  char *(*cb1)(int a, double b);\n  char **(*cb2)(int a, double b);\n  char ***(*cb3)(int a, double b);\n} libvlc_struct_with_complex_callbacks_t;\n\ntypedef struct libvlc_struct_with_cb_taking_cb_as_argument_t {\n  char *(*cb)(int (*cb_param)(int a, double b, char c));\n} libvlc_struct_with_cb_taking_cb_as_argument_t;\n"
  }
]