Skip to content

Commit d488b16

Browse files
committed
Update README.module
1 parent 0f5333e commit d488b16

File tree

1 file changed

+42
-32
lines changed

1 file changed

+42
-32
lines changed

README.module

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
Python ctypes-based bindings libvlc
2-
===================================
1+
Python ctypes-based bindings for libvlc
2+
=======================================
33

44
The bindings use ctypes to directly call the libvlc dynamic lib, and
55
the code is generated from the include files defining the public
66
API. The same module should be compatible with various versions of
77
libvlc 3.*. However, there may be incompatible changes between major
88
versions.
99

10-
License
11-
-------
12-
13-
The generated module is licensed, like libvlc, under the GNU Lesser
14-
General Public License 2.1 or later.
15-
1610
Installing the module
1711
---------------------
1812

@@ -23,55 +17,71 @@ You can install the module through PyPI:
2317
Using the module
2418
----------------
2519

26-
Documentation building needs epydoc. An online build is available at
27-
<http://olivieraubert.net/vlc/python-ctypes/>
28-
2920
The module offers two ways of accessing the API - a raw access to all
3021
exported methods, and more convenient wrapper classes.
3122

3223
Using wrapper classes
3324
+++++++++++++++++++++
3425

3526
Most major structures of the libvlc API (Instance, Media, MediaPlayer,
36-
etc) are wrapped as classes, with shorter method names and some
37-
adaptations to provide a more pythonic API:
27+
etc) are wrapped as classes, with shorter method names and some
28+
adaptations to provide a more pythonic API:
3829

39-
>>> import vlc
40-
>>> p=vlc.MediaPlayer('file:///tmp/foo.avi')
41-
>>> p.play()
42-
>>> p.get_instance() # returns the corresponding instance
30+
>>> import vlc
31+
>>> player = vlc.MediaPlayer('file:///tmp/foo.avi')
32+
>>> player.play()
33+
>>> player.get_instance() # returns the corresponding instance
4334

4435
In this case, a default ``vlc.Instance`` will be instanciated and
4536
stored in ``vlc._default_instance``. It will be used to instanciate
4637
the various classes (``Media``, ``MediaList``, ``MediaPlayer``, etc).
4738

4839
You also can use wrapper methods closer to the original libvlc API:
4940

50-
>>> import vlc
51-
>>> i=vlc.Instance('--no-audio', '--fullscreen')
52-
>>> p=i.media_player_new()
53-
>>> p.audio_get_volume()
54-
50
55-
>>> m=i.media_new('file:///tmp/foo.avi')
56-
>>> m.get_mrl()
57-
'file:///tmp/foo.avi'
58-
>>> p.set_media(m)
59-
>>> p.play()
41+
>>> import vlc
42+
>>> instance = vlc.Instance('--no-audio', '--fullscreen')
43+
>>> player = instance.media_player_new()
44+
>>> player.audio_get_volume()
45+
50
46+
>>> media = instance.media_new('file:///tmp/foo.avi')
47+
>>> media.get_mrl()
48+
'file:///tmp/foo.avi'
49+
>>> player.set_media(m)
50+
>>> player.play()
6051

6152
Using raw access
6253
++++++++++++++++
6354

6455
Libvlc methods are available as attributes of the vlc module (as
6556
vlc.libvlc_*). Use their docstring (any introspective shell like
6657
ipython is your friend) to explore them, or refer to the online
67-
documentation at http://olivieraubert.net/vlc/python-ctypes/
58+
documentation at https://olivieraubert.net/vlc/python-ctypes/
6859

6960
>>> import vlc
7061
>>> vlc.libvlc_get_version()
7162
'3.0.0-rc2 Vetinari'
72-
>>> e=vlc.VLCException()
73-
>>> i=vlc.libvlc_new(0, [], e)
74-
>>> i
63+
>>> exc = vlc.VLCException()
64+
>>> instance = vlc.libvlc_new(0, [], exc)
65+
>>> instance
7566
<vlc.Instance object at 0x8384a4c>
76-
>>> vlc.libvlc_audio_get_volume(i,e)
67+
>>> vlc.libvlc_audio_get_volume(instance, exc)
7768
50
69+
70+
Example code
71+
++++++++++++
72+
73+
You can find [example
74+
files](https://github.com/oaubert/python-vlc/tree/master/examples) in
75+
the repository.
76+
77+
Note that the ``vlc.py`` module can itself be invoked as an
78+
application using its own features, which also serves as a API usage
79+
example. See the [end of the
80+
module](https://github.com/oaubert/python-vlc/blob/master/generated/3.0/vlc.py#L12525)
81+
after the line ``if __name__ == "__main__":``
82+
83+
License
84+
-------
85+
86+
The generated module is licensed, like libvlc, under the GNU Lesser
87+
General Public License 2.1 or later.

0 commit comments

Comments
 (0)