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 top_srcdir=os.environ['top_srcdir']
22 top_srcdir = os.path.join( '..', '..' )
23 os.environ['top_srcdir'] = top_srcdir
25 vlclib= "-L" + os.path.join( top_builddir, 'src') + " -lvlc"
27 srcdir=os.path.join( top_srcdir, 'bindings', 'mediacontrol-python' )
31 for n in ( 'vlc-config',
32 os.path.join( top_builddir, 'vlc-config' )):
37 print "*** Warning *** Cannot find vlc-config"
38 elif os.sys.platform == 'win32':
39 # Win32 does not know how to invoke the shell itself.
40 vlcconfig="sh %s" % vlcconfig
43 def get_vlc_version():
44 vlcconfig=get_vlcconfig()
48 version=os.popen('%s --version' % vlcconfig, 'r').readline().strip()
52 vlcconfig=get_vlcconfig()
56 cflags=os.popen('%s --cflags' % vlcconfig, 'r').readline().rstrip().split()
60 vlcconfig=get_vlcconfig()
65 if os.sys.platform == 'darwin':
66 ldflags = "-read_only_relocs warning".split()
67 ldflags.extend(os.popen('%s --libs vlc %s' % (vlcconfig,
69 'r').readline().rstrip().split())
70 if os.sys.platform == 'darwin':
71 ldflags.append('-lstdc++')
74 #source_files = [ 'vlc_module.c', 'vlc_object.c', 'vlc_mediacontrol.c',
75 # 'vlc_position.c', 'vlc_instance.c', 'vlc_input.c' ]
76 source_files = [ 'vlc_module.c' ]
78 # To compile in a local vlc tree
79 vlclocal = Extension('vlc',
80 sources = [ os.path.join( srcdir, f ) for f in source_files ],
81 include_dirs = [ top_builddir,
82 os.path.join( top_srcdir, 'include' ),
84 '/usr/win32/include' ],
85 extra_objects = [ vlclib ],
86 extra_compile_args = get_cflags(),
87 extra_link_args = [ '-L' + top_builddir ] + get_ldflags(),
90 setup (name = 'VLC Bindings',
91 version = get_vlc_version(),
92 #scripts = [ os.path.join( srcdir, 'vlcwrapper.py') ],
93 keywords = [ 'vlc', 'video' ],
95 description = """VLC bindings for python.
97 This module provides bindings for the native libvlc API of the VLC
98 video player. Documentation can be found on the VLC wiki :
99 http://wiki.videolan.org/index.php/ExternalAPI
101 The module also provides a Object type, which gives a low-level access
102 to the vlc objects and their variables.
104 This module also provides a MediaControl object, which implements an
105 API inspired from the OMG Audio/Video Stream 1.0 specification.
106 Documentation can be found on the VLC wiki :
107 http://wiki.videolan.org/index.php/PythonBinding
112 mc=vlc.MediaControl(['--verbose', '1'])
113 mc.playlist_add_item('movie.mpg')
115 # Start the movie at 2000ms
117 p.origin=vlc.RelativePosition
121 # which could be abbreviated as
123 # for the default conversion from int is to make a RelativePosition in MediaTime
125 # Display some text during 2000ms
126 mc.display_text('Some useless information', 0, 2000)
131 # Get status information
132 mc.get_stream_information()
134 # Access lowlevel objets
137 i=o.find_object('input')
142 ext_modules = [ vlclocal ])