]> git.sesse.net Git - vlc/blob - bindings/python-ctypes/README
phonon: Allow building against kdesupport libphonon.
[vlc] / bindings / python-ctypes / README
1 * Python ctypes-based bindings
2
3 The bindings use ctypes to directly call the libvlc dynamic lib, and
4 the code is generated from the include files defining the public API.
5
6 ** Building
7
8 To generate the vlc.py module and its documentation, use
9 make
10
11 Documentation building needs epydoc.
12
13 ** Layout
14
15 The module offers two ways of accessing the API - a raw access to all
16 exported methods, and more convenient wrapper classes :
17
18 - Raw access: methods are available as attributes of the vlc
19   module. Use their docstring (introspective shells like ipython are
20   your friends) to explore them.
21
22 - Wrapper classes: most major structures of the libvlc API (Instance,
23   Media, MediaPlayer, etc) are wrapped as classes, with shorter method
24   names.
25
26 ** Using the module
27
28 On win32, the simplest way is to put the vlc.py file in the same
29 directory as the libvlc.dll file (standard location:
30 c:\Program Files\VideoLAN\VLC ).
31
32
33 - Using raw access:
34
35 >>> import vlc
36 >>> vlc.libvlc_get_version()
37 '1.0.0 Goldeneye'
38 >>> e=vlc.VLCException()
39 >>> i=vlc.libvlc_new(0, [], e)
40 >>> i
41 <vlc.Instance object at 0x8384a4c>
42 >>> vlc.libvlc_audio_get_volume(i,e)
43 50
44
45 - Using wrapper classes:
46
47 >>> import vlc
48 >>> i=vlc.Instance('--no-audio', '--fullscreen')
49 >>> i.audio_get_volume()
50 50
51 >>> m=i.media_new('/tmp/foo.avi')
52 >>> m.get_mrl()
53 '/tmp/foo.avi'
54 >>> p=i.media_player_new(m)
55 >>> p.play()
56
57 or shorter:
58 >>> import vlc
59 >>> p=vlc.MediaPlayer('/tmp/foo.avi')
60 >>> p.play()