Difference between revisions of "Python bindings"

From VideoLAN Wiki
Jump to navigation Jump to search
(add ext. link)
Line 24: Line 24:
 
A helper module [http://git.videolan.org/?p=vlc.git;a=blob;f=bindings/python-ctypes/vlcwidget.py;hb=HEAD vlcwidget.py] provides a pygtk VLCWidget() to ease integration.
 
A helper module [http://git.videolan.org/?p=vlc.git;a=blob;f=bindings/python-ctypes/vlcwidget.py;hb=HEAD vlcwidget.py] provides a pygtk VLCWidget() to ease integration.
  
Note that you'll need to pass it an argument, like "e:\" for it to play.
+
There is a [http://git.videolan.org/?p=vlc/bindings/python.git;a=blob;f=README README]
  
 
== Projects using this binding ==
 
== Projects using this binding ==

Revision as of 21:02, 18 November 2010

Python bindings

You can find two versions of python bindings: an old one (see Old Python bindings), hand-written C-module, and a new one, which is ctypes-based and automatically generated. The old version of the bindings is now deprecated and will be removed in some future version.

Features

The new module features :

  • a complete cover of the libvlc API, since it is automatically generated from the include files.
  • no compilation hassle: the generated module is pure python.
  • no versioning hassle: the same module works with multiple VLC versions.
  • a complete documentation.

Download

You can download the vlc.py module from the Git repository. It only depends on ctypes (standard module in python >= 2.5). Put the module in some place accessible by python (either next to your application, or in a directory from sys.path).

Alternatively, you can generate it by yourself using the generate.py program and accompanying files in the vlc source tree (see [1]).

Usage

The vlc.py module also contains a runnable example player application (see code at the end of the module, starting from the line "if __name__ == '__main__').

A helper module vlcwidget.py provides a pygtk VLCWidget() to ease integration.

There is a README

Projects using this binding

http://code.google.com/p/movie-content-editor/

FAQ

Win32 initialization

If the vlc modules are not installed in their standard location (e.g. c:\\Program Files\\Videolan on Windows, or /usr/lib/vlc on linux), the VLC module cannot find them.

When instanciating vlc.Instance() with no parameter, it tries to guess the location of the modules. However, if you pass any argument to vlc.Instance(), you will need to supply the appropriate "--plugin-path=/path/to/the/modules" yourself.