1 from distutils.core import setup, Extension
5 # Get build variables (buildir, srcdir)
6 top_builddir = os.path.join( '..', '..' )
7 os.environ['top_builddir'] = top_builddir
9 # Determine the extra link args. Normally, vlc-config should take care
10 # of this and return the right path values, from a development tree or
11 # an installed version.
14 d=os.path.join(top_builddir, 'src', '.libs')
16 # We are in a development tree, which was compiled with libtool
20 d=os.path.join(top_builddir, 'src')
21 # We are in a development tree, which was compiled without libtool
25 # For out-of-tree compilations
30 for n in ( 'vlc-config',
31 os.path.join( top_builddir, 'vlc-config' )):
35 status, output = commands.getstatusoutput('pkg-config libvlc --exists')
37 vlcconfig="pkg-config libvlc"
39 print "*** Warning *** Cannot find vlc-config. Will try sane defaults."
40 elif os.sys.platform == 'win32':
41 # Win32 does not know how to invoke the shell itself.
42 vlcconfig="sh %s" % vlcconfig
45 def get_vlc_version():
46 vlcconfig=get_vlcconfig()
50 version=os.popen('%s --modversion' % vlcconfig, 'r').readline().strip()
54 vlcconfig=get_vlcconfig()
58 cflags=os.popen('%s --cflags ' % vlcconfig, 'r').readline().strip()
62 vlcconfig=get_vlcconfig()
67 if os.sys.platform == 'darwin':
68 ldflags = "-read_only_relocs warning".split()
69 ldflags.extend(os.popen('%s --libs ' % vlcconfig,
70 'r').readline().rstrip().split())
71 if os.sys.platform == 'darwin':
72 ldflags.append('-lstdc++')
75 #source_files = [ 'vlc_module.c', 'vlc_mediacontrol.c',
76 # 'vlc_position.c', 'vlc_instance.c', 'vlc_input.c' ]
77 source_files = [ 'vlc_module.c' ]
79 # To compile in a local vlc tree
80 vlclocal = Extension('vlc',
81 sources = [ os.path.join( srcdir, f ) for f in source_files ],
82 include_dirs = [ top_builddir,
85 extra_compile_args = get_cflags(),
86 extra_link_args = linkargs + get_ldflags(),
89 setup (name = 'python-vlc',
91 author='Olivier Aubert',
92 author_email='olivier.aubert@liris.cnrs.fr',
93 url='http://wiki.videolan.org/PythonBinding',
94 #scripts = [ os.path.join( srcdir, 'vlcwidget.py') ],
95 py_modules=['vlcwrapper'],
96 keywords = [ 'vlc', 'video' ],
98 description = "VLC bindings for python.",
99 long_description = """VLC bindings for python.
101 This module provides bindings for the native libvlc API of the VLC
102 video player. Documentation can be found on the VLC wiki :
103 http://wiki.videolan.org/ExternalAPI
105 This module also provides a MediaControl object, which implements an
106 API inspired from the OMG Audio/Video Stream 1.0 specification.
107 Documentation can be found on the VLC wiki :
108 http://wiki.videolan.org/PythonBinding
110 Example session (for the MediaControl API):
113 mc=vlc.MediaControl(['--verbose', '1'])
114 mc.playlist_add_item('movie.mpg')
116 # Start the movie at 2000ms
118 p.origin=vlc.RelativePosition
122 # which could be abbreviated as
124 # for the default conversion from int is to make a RelativePosition in MediaTime
126 # Display some text during 2000ms
127 mc.display_text('Some useless information', 0, 2000)
132 # Get status information
133 mc.get_stream_information()
135 ext_modules = [ vlclocal ])