1 from distutils.core import setup, Extension
4 # Get build variables (buildir, srcdir)
6 top_builddir=os.environ['top_builddir']
8 # Note: do not initialize here, so that we get
9 # a correct default value if the env. var is
13 top_builddir = os.path.join( '..', '..' )
14 os.environ['top_builddir'] = top_builddir
17 srcdir=os.environ['srcdir']
29 for n in ( 'vlc-config',
30 os.path.join( top_builddir, 'vlc-config' )):
35 print "*** Warning *** Cannot find vlc-config"
36 elif os.sys.platform == 'win32':
37 # Win32 does not know how to invoke the shell itself.
38 vlcconfig="sh %s" % vlcconfig
41 def get_vlc_version():
42 vlcconfig=get_vlcconfig()
46 version=os.popen('%s --version' % vlcconfig, 'r').readline().strip()
50 vlcconfig=get_vlcconfig()
54 cflags=os.popen('%s --cflags' % vlcconfig, 'r').readline().rstrip().split()
58 vlcconfig=get_vlcconfig()
63 if os.sys.platform == 'darwin':
64 ldflags = "-read_only_relocs warning".split()
65 ldflags.extend(os.popen('%s --libs vlc %s' % (vlcconfig,
67 'r').readline().rstrip().split())
68 if os.sys.platform == 'darwin':
69 ldflags.append('-lstdc++')
72 #source_files = [ 'vlc_module.c', 'vlc_object.c', 'vlc_mediacontrol.c',
73 # 'vlc_position.c', 'vlc_instance.c', 'vlc_input.c' ]
74 source_files = [ 'vlc_module.c' ]
76 # To compile in a local vlc tree
77 vlclocal = Extension('vlc',
78 sources = [ os.path.join( srcdir, f ) for f in source_files ],
79 include_dirs = [ top_builddir,
80 os.path.join( srcdir, '..', '..', 'include' ),
82 '/usr/win32/include' ],
83 extra_objects = [ vlclib ],
84 extra_compile_args = get_cflags(),
85 extra_link_args = [ '-L' + os.path.join(top_builddir, 'src') ] + get_ldflags(),
88 setup (name = 'VLC Bindings',
89 version = get_vlc_version(),
90 #scripts = [ os.path.join( srcdir, 'vlcwrapper.py') ],
91 keywords = [ 'vlc', 'video' ],
93 description = """VLC bindings for python.
95 This module provides bindings for the native libvlc API of the VLC
96 video player. Documentation can be found on the VLC wiki :
97 http://wiki.videolan.org/index.php/ExternalAPI
99 The module also provides a Object type, which gives a low-level access
100 to the vlc objects and their variables.
102 This module also provides a MediaControl object, which implements an
103 API inspired from the OMG Audio/Video Stream 1.0 specification.
104 Documentation can be found on the VLC wiki :
105 http://wiki.videolan.org/index.php/PythonBinding
110 mc=vlc.MediaControl(['--verbose', '1'])
111 mc.playlist_add_item('movie.mpg')
113 # Start the movie at 2000ms
115 p.origin=vlc.RelativePosition
119 # which could be abbreviated as
121 # for the default conversion from int is to make a RelativePosition in MediaTime
123 # Display some text during 2000ms
124 mc.display_text('Some useless information', 0, 2000)
129 # Get status information
130 mc.get_stream_information()
132 # Access lowlevel objets
135 i=o.find_object('input')
140 ext_modules = [ vlclocal ])