forked from oaubert/python-vlc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.module
77 lines (59 loc) · 2.26 KB
/
README.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Python ctypes-based bindings 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.
License
-------
The generated module is licensed, like libvlc, under the GNU Lesser
General Public License 2.1 or later.
Installing the module
---------------------
You can install the module through PyPI:
pip install python-vlc
Using the module
----------------
Documentation building needs epydoc. An online build is available at
<http://olivieraubert.net/vlc/python-ctypes/>
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
>>> p=vlc.MediaPlayer('file:///tmp/foo.avi')
>>> p.play()
>>> p.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
>>> i=vlc.Instance('--no-audio', '--fullscreen')
>>> i.audio_get_volume()
50
>>> p=i.media_player_new()
>>> m=i.media_new('file:///tmp/foo.avi')
>>> m.get_mrl()
'file:///tmp/foo.avi'
>>> p.set_media(m)
>>> p.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 http://olivieraubert.net/vlc/python-ctypes/
>>> import vlc
>>> vlc.libvlc_get_version()
'3.0.0-rc2 Vetinari'
>>> e=vlc.VLCException()
>>> i=vlc.libvlc_new(0, [], e)
>>> i
<vlc.Instance object at 0x8384a4c>
>>> vlc.libvlc_audio_get_volume(i,e)
50