1
mirror of https://code.videolan.org/videolan/vlc synced 2024-10-11 06:21:30 +02:00
vlc/bindings/python-ctypes
Olivier Aubert 0fbc808722 python-ctypes: first shot at generating java JNA glue code
Not perfect yet (esp. enum classes are not correctly translated for discontinuous enums).
2009-09-23 16:19:03 +02:00
..
boilerplate.java python-ctypes: first shot at generating java JNA glue code 2009-09-23 16:19:03 +02:00
footer.py python-ctypes: fix pylint/pyflakes warnings 2009-09-11 09:56:44 +02:00
generate.py python-ctypes: first shot at generating java JNA glue code 2009-09-23 16:19:03 +02:00
header.py python-ctypes: fix pylint/pyflakes warnings 2009-09-11 09:56:44 +02:00
LibVlc-footer.java python-ctypes: first shot at generating java JNA glue code 2009-09-23 16:19:03 +02:00
LibVlc-header.java python-ctypes: first shot at generating java JNA glue code 2009-09-23 16:19:03 +02:00
Makefile python-ctypes: fix pylint/pyflakes warnings 2009-09-11 09:56:44 +02:00
override.py python-ctypes: fix pylint/pyflakes warnings 2009-09-11 09:56:44 +02:00
README python-ctypes: update README 2009-07-31 17:11:38 +02:00
setup.py python-ctypes: define setup.py (based on a contribution by Martin Muellenhaupt <mmuellen@gmx.de>) 2009-08-10 00:33:34 +02:00
test.py python-ctypes: improve enum conversion 2009-09-04 15:40:09 +02:00
TODO python-ctypes: implement comparison operators for enum classes 2009-09-03 10:53:08 +02:00
vlcwidget.py python-ctypes: provide a helper pygtk VLCWidget which also serves as example player app. 2009-09-04 16:31:50 +02:00

* Python ctypes-based bindings

The bindings use ctypes to directly call the libvlc dynamic lib, and
the code is generated from the include files defining the public API.

** Building

To generate the vlc.py module and its documentation, use
make

Documentation building needs epydoc.

** Layout

The module offers two ways of accessing the API - a raw access to all
exported methods, and more convenient wrapper classes :

- Raw access: methods are available as attributes of the vlc
  module. Use their docstring (introspective shells like ipython are
  your friends) to explore them.

- Wrapper classes: most major structures of the libvlc API (Instance,
  Media, MediaPlayer, etc) are wrapped as classes, with shorter method
  names.

** Using the module

On win32, the simplest way is to put the vlc.py file in the same
directory as the libvlc.dll file (standard location:
c:\Program Files\VideoLAN\VLC ).


- Using raw access:

>>> import vlc
>>> vlc.libvlc_get_version()
'1.0.0 Goldeneye'
>>> e=vlc.VLCException()
>>> i=vlc.libvlc_new(0, [], e)
>>> i
<vlc.Instance object at 0x8384a4c>
>>> vlc.libvlc_audio_get_volume(i,e)
50

- Using wrapper classes:

>>> import vlc
>>> i=vlc.Instance('--no-audio', '--fullscreen')
>>> i.audio_get_volume()
50
>>> m=i.media_new('/tmp/foo.avi')
>>> m.get_mrl()
'/tmp/foo.avi'
>>> p=i.media_player_new(m)
>>> p.play()

or shorter:
>>> import vlc
>>> p=vlc.MediaPlayer('/tmp/foo.avi')
>>> p.play()