Python ctypes-based bindings for libvlc
=======================================
The bindings use ctypes to directly call the libvlc dynamic lib, and
the code is generated from the include files defining the public
API. The same module should be compatible with various versions of
libvlc 3.*. However, there may be incompatible changes between major
versions.
Installing the module
---------------------
You can install the module through PyPI:
pip install python-vlc
Using the module
----------------
The module offers two ways of accessing the API - a raw access to all
exported methods, and more convenient wrapper classes.
Using wrapper classes
+++++++++++++++++++++
Most major structures of the libvlc API (Instance, Media, MediaPlayer,
etc) are wrapped as classes, with shorter method names and some
adaptations to provide a more pythonic API:
>>> import vlc
>>> player = vlc.MediaPlayer('file:///tmp/foo.avi')
>>> player.play()
>>> player.get_instance() # returns the corresponding instance
In this case, a default ``vlc.Instance`` will be instanciated and
stored in ``vlc._default_instance``. It will be used to instanciate
the various classes (``Media``, ``MediaList``, ``MediaPlayer``, etc).
You also can use wrapper methods closer to the original libvlc API:
>>> import vlc
>>> instance = vlc.Instance('--no-audio', '--fullscreen')
>>> player = instance.media_player_new()
>>> player.audio_get_volume()
50
>>> media = instance.media_new('file:///tmp/foo.avi')
>>> media.get_mrl()
'file:///tmp/foo.avi'
>>> player.set_media(m)
>>> player.play()
Using raw access
++++++++++++++++
Libvlc methods are available as attributes of the vlc module (as
vlc.libvlc_*). Use their docstring (any introspective shell like
ipython is your friend) to explore them, or refer to the online
documentation at https://olivieraubert.net/vlc/python-ctypes/
>>> import vlc
>>> vlc.libvlc_get_version()
'3.0.0-rc2 Vetinari'
>>> exc = vlc.VLCException()
>>> instance = vlc.libvlc_new(0, [], exc)
>>> instance
<vlc.Instance object at 0x8384a4c>
>>> vlc.libvlc_audio_get_volume(instance, exc)
50
Example code
++++++++++++
You can find [example
files](https://github.com/oaubert/python-vlc/tree/master/examples) in
the repository.
Note that the ``vlc.py`` module can itself be invoked as an
application using its own features, which also serves as a API usage
example. See the [end of the
module](https://github.com/oaubert/python-vlc/blob/master/generated/3.0/vlc.py#L12525)
after the line ``if __name__ == "__main__":``
License
-------
The generated module is licensed, like libvlc, under the GNU Lesser
General Public License 2.1 or later.
Raw data
{
"_id": null,
"home_page": null,
"name": "python-vlc",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": "Olivier Aubert <contact@olivieraubert.net>",
"keywords": "vlc, video",
"author": null,
"author_email": "Olivier Aubert <contact@olivieraubert.net>",
"download_url": "https://files.pythonhosted.org/packages/4b/5b/f9ce6f0c9877b6fe5eafbade55e0dcb6b2b30f1c2c95837aef40e390d63b/python_vlc-3.0.21203.tar.gz",
"platform": null,
"description": "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",
"bugtrack_url": null,
"license": "LGPL-2.1+",
"summary": "VLC bindings for python.",
"version": "3.0.21203",
"project_urls": {
"Alternate repository": "https://git.videolan.org/?p=vlc/bindings/python.git;a=summary",
"Bug Tracker": "https://github.com/oaubert/python-vlc/issues",
"Documentation": "https://www.olivieraubert.net/vlc/python-ctypes/doc/",
"Homepage": "https://wiki.videolan.org/PythonBinding",
"Repository": "https://github.com/oaubert/python-vlc.git"
},
"split_keywords": [
"vlc",
" video"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5bee7d76eb3b50ccb1397621f32ede0fb4d17aa55a9aa2251bc34e6b9929fdce",
"md5": "6f2ebfde1f6d230b0480f26471bae5b5",
"sha256": "1613451a31b692ec276296ceeae0c0ba82bfc2d094dabf9aceb70f58944a6320"
},
"downloads": -1,
"filename": "python_vlc-3.0.21203-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6f2ebfde1f6d230b0480f26471bae5b5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 87651,
"upload_time": "2024-10-07T14:39:50",
"upload_time_iso_8601": "2024-10-07T14:39:50.021348Z",
"url": "https://files.pythonhosted.org/packages/5b/ee/7d76eb3b50ccb1397621f32ede0fb4d17aa55a9aa2251bc34e6b9929fdce/python_vlc-3.0.21203-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4b5bf9ce6f0c9877b6fe5eafbade55e0dcb6b2b30f1c2c95837aef40e390d63b",
"md5": "66812389afaff601a247593beb9d8d82",
"sha256": "52d0544b276b11e58b6c0b748c3e0518f94f74b1b4cd328c83a59eacabead1ec"
},
"downloads": -1,
"filename": "python_vlc-3.0.21203.tar.gz",
"has_sig": false,
"md5_digest": "66812389afaff601a247593beb9d8d82",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 162211,
"upload_time": "2024-10-07T14:39:54",
"upload_time_iso_8601": "2024-10-07T14:39:54.755891Z",
"url": "https://files.pythonhosted.org/packages/4b/5b/f9ce6f0c9877b6fe5eafbade55e0dcb6b2b30f1c2c95837aef40e390d63b/python_vlc-3.0.21203.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-07 14:39:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "oaubert",
"github_project": "python-vlc",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "ruff",
"specs": [
[
"==",
"0.4.2"
]
]
},
{
"name": "Sphinx",
"specs": [
[
"==",
"7.3.7"
]
]
},
{
"name": "tree-sitter",
"specs": [
[
"==",
"0.20.4"
]
]
},
{
"name": "build",
"specs": []
},
{
"name": "pre-commit",
"specs": []
},
{
"name": "sphinx-autoapi",
"specs": []
},
{
"name": "sphinx_mdinclude",
"specs": []
},
{
"name": "sphinx_rtd_theme",
"specs": []
}
],
"lcname": "python-vlc"
}