Difference between revisions of "Python bindings"

From VideoLAN Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
= Python bindings =
 
= Python bindings =
  
You can find two versions of python bindings: a up-to-date one, which is ctypes-based and is automatically generated.
+
The bindings feature :
You can also find an old one (see [[Old Python bindings]]), hand-written C-module, and deprecated. It 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.
 
* 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 compilation hassle: the generated module is pure python.
Line 33: Line 28:
  
 
===  Win32 initialization ===  
 
===  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.  Add the location of libvlc.dll to your PATH first.
 
  
 
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.
 
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.

Revision as of 09:05, 4 June 2012

Python bindings

The bindings feature :

  • 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 file also contains a runnable example player application (see code at the end of the file, starting from the line "if __name__ == '__main__').

A set of helper examples examples provide a pyGtk, a pyQt and a pyWx player to ease integration.

There is also a README

Projects using this binding

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

FAQ

Win32 initialization

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.