Page 1 of 1
VLC/Python bindings simple player example
Posted: 19 Mar 2008 13:59
by videolanuser731
As I had to go through a lot of troubles to find a working example of simple Python/VLC integration, I thought I'd post a simple example to get anybody looking into that area started :
Code: Select all
#!/usr/bin/env python
import gtk
import sys
import vlc
class VideoPlayer:
def __init__(self):
self.mc=vlc.MediaControl( [ ] )
if sys.argv[1:]:
self.mc.playlist_add_item(sys.argv[1])
self.libvlc=vlc.Object(0)
self.widget=self.build_widget()
def main(self):
self.popup()
gtk.main()
def action(self, button, action):
action(0)
return True
def print_pos(self, toto):
streaminfo = self.mc.get_stream_information()
if streaminfo["status"] == 0:
print streaminfo["position"], " / ", streaminfo["length"]
def build_widget(self):
vbox=gtk.VBox()
self.drawable=gtk.DrawingArea()
self.drawable.set_size_request(320,200)
vbox.add(self.drawable)
hbox=gtk.HButtonBox()
for name, action in ( ("Play", self.mc.start),
("Pos", self.print_pos),
("Pause", self.mc.pause),
("Stop", self.mc.stop),
("Quit", gtk.main_quit)):
b=gtk.Button(name)
b.connect("clicked", self.action, action)
hbox.add(b)
vbox.pack_start(hbox, expand=False)
vbox.show_all()
return vbox
def popup(self):
w=gtk.Window()
w.add(self.widget)
w.show_all()
# Now that self.drawable is realized, its xid is available
if sys.platform == 'win32':
xidattr='handle'
else:
xidattr='xid'
self.libvlc.set("drawable", getattr(self.drawable.window, xidattr))
w.connect("destroy", gtk.main_quit)
return w
if __name__ == '__main__':
p=VideoPlayer()
p.main()
Re: VLC/Python bindings simple player example
Posted: 19 Mar 2008 17:44
by OlivierAubert
Note that this code is a bit outdated, and will work only with vlc <= 0.8.6, for which compiling the bindings is a bit of a pain, esp. crossplatform. You are using features that have been removed from the development tree. Sample player code is provided in the bindings/python directory :
https://trac.videolan.org/vlc/browser/b ... cwidget.py
[I think you know that, since you obviously based your code on it, but it can be useful information for people looking for it].
Re: VLC/Python bindings simple player example
Posted: 20 Mar 2008 08:50
by videolanuser731
Yes, maybe I should have specified that this code was tested with version 0.8.6e on Ubuntu 6.06.2
I'm still struggling to get the SVN version running, I'll try to post an updated example.
Re: VLC/Python bindings simple player example
Posted: 20 Mar 2008 09:41
by OlivierAubert
Well, the situation being much saner with vlc 0.9.0, there should be no struggle to build the bindings, even without building the whole VLC:
On Debian/Ubuntu, it is simple, since the needed development files are packaged: you need to install the dev package libvlc1-dev.
Get the python bindings sources from the git tree. If the svn mirror functions correctly, you can get only the bindings with
svn co svn://svn.videolan.org/vlc/trunk/bindings/python
Then, in the python directory, launch
python setup.py build
The module will be built in
build/lib.linux-i686-2.5
and can be installed through
python setup.py install (as root).
And you are done. For the sample code, as I said before, it is present in the bindings directory and I gave the link to it. If you think there are some things to modify to make it clearer, please tell me so that I can update the file.
Re: VLC/Python bindings simple player example
Posted: 20 Mar 2008 10:22
by videolanuser731
Right, I looked at the nightlies but there are some incompatible dependencies with Ubuntu 6.06 so I had to got back to the stable branch for now. I will try to sort it out by maybe putting the required libraries in a chroot or something.
Also, I'm sorry, I didn't mean to imply your example in the repository was bad.
Re: VLC/Python bindings simple player example
Posted: 14 Apr 2008 12:37
by nico_open
hello,
I followed this post to be able to have the vlc python bindings but when I try to do the python setup.py build I get the following :
Code: Select all
*** Warning *** Cannot find vlc-config
*** Warning *** Cannot find vlc-config
*** Warning *** Cannot find vlc-config
running install
running build
running build_ext
building 'vlc' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -fPIC -I../.. -I./../../include -I. -I/usr/win32/include -I/usr/include/python2.5 -c ./vlc_module.c -o build/temp.linux-i686-2.5/./vlc_module.o
In file included from ./vlc_module.c:24:
./vlcglue.h:27:20: error: Python.h: No such file or directory
./vlcglue.h:28:26: error: structmember.h: No such file or directory
./vlcglue.h:30:19: error: stdio.h: No such file or directory
In file included from ./../../include/vlc/vlc.h:38,
from ./vlcglue.h:31,
from ./vlc_module.c:24:
./../../include/vlc/libvlc.h:155: warning: function declaration isn’t a prototype
./../../include/vlc/libvlc.h:164: warning: function declaration isn’t a prototype
./../../include/vlc/libvlc.h:173: warning: function declaration isn’t a prototype
In file included from ./vlcglue.h:33,
from ./vlc_module.c:24:
./../../include/vlc/mediacontrol_structures.h:37:20: error: stdint.h: No such file or directory
In file included from ./vlcglue.h:33,
from ./vlc_module.c:24:
./../../include/vlc/mediacontrol_structures.h:89: error: expected specifier-qualifier-list before ‘uint32_t’
In file included from ./vlc_module.c:24:
./vlcglue.h:76: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlcglue.h:77: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlcglue.h:78: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlcglue.h:79: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlcglue.h:80: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlcglue.h:81: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlcglue.h:88: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
./vlcglue.h:99: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
./vlcglue.h:109: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
./vlcglue.h:120: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
./vlcglue.h:129: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
./vlcglue.h:134: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
./vlcglue.h:135: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
./vlcglue.h:136: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
./vlcglue.h:137: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
./vlcglue.h:138: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
./vlcglue.h:152: error: expected ‘)’ before ‘*’ token
./vlcglue.h:153: error: expected ‘)’ before ‘*’ token
./vlcglue.h:154: error: expected ‘)’ before ‘*’ token
./vlc_module.c:34: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘vlc_methods’
./vlc_module.c:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_module.c:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_module.c:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_module.c:42: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_module.c:43: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_module.c: In function ‘initvlc’:
./vlc_module.c:48: error: ‘PyObject’ undeclared (first use in this function)
./vlc_module.c:48: error: (Each undeclared identifier is reported only once
./vlc_module.c:48: error: for each function it appears in.)
./vlc_module.c:48: error: ‘p_module’ undeclared (first use in this function)
./vlc_module.c:50: error: ‘vlcMediaInstance_Type’ undeclared (first use in this function)
./vlc_module.c:50: error: ‘PyType_GenericNew’ undeclared (first use in this function)
./vlc_module.c:51: error: ‘PyType_GenericAlloc’ undeclared (first use in this function)
./vlc_module.c:52: error: ‘vlcMediaDescriptor_Type’ undeclared (first use in this function)
./vlc_module.c:55: warning: implicit declaration of function ‘Py_InitModule3’
./vlc_module.c:55: error: ‘vlc_methods’ undeclared (first use in this function)
./vlc_module.c:61: warning: implicit declaration of function ‘PyType_Ready’
./vlc_module.c:61: error: ‘PyPosition_Type’ undeclared (first use in this function)
./vlc_module.c:63: error: ‘MediaControl_Type’ undeclared (first use in this function)
./vlc_module.c:65: error: ‘vlcInstance_Type’ undeclared (first use in this function)
./vlc_module.c:73: error: ‘MediaControl_InternalException’ undeclared (first use in this function)
./vlc_module.c:74: warning: implicit declaration of function ‘PyErr_NewException’
./vlc_module.c:74: error: ‘NULL’ undeclared (first use in this function)
./vlc_module.c:75: warning: implicit declaration of function ‘Py_INCREF’
./vlc_module.c:76: warning: implicit declaration of function ‘PyModule_AddObject’
./vlc_module.c:79: error: ‘MediaControl_PositionKeyNotSupported’ undeclared (first use in this function)
./vlc_module.c:85: error: ‘MediaControl_PositionOriginNotSupported’ undeclared (first use in this function)
./vlc_module.c:91: error: ‘MediaControl_InvalidPosition’ undeclared (first use in this function)
./vlc_module.c:97: error: ‘MediaControl_PlaylistException’ undeclared (first use in this function)
./vlc_module.c:104: error: ‘vlcInstance_Exception’ undeclared (first use in this function)
./vlc_module.c:113: error: expected expression before ‘)’ token
./vlc_module.c:117: error: expected expression before ‘)’ token
./vlc_module.c:121: error: expected expression before ‘)’ token
./vlc_module.c:124: error: expected expression before ‘)’ token
./vlc_module.c:127: error: expected expression before ‘)’ token
./vlc_module.c:130: warning: implicit declaration of function ‘PyModule_AddIntConstant’
./vlc_module.c: At top level:
./vlc_module.c:163: error: expected declaration specifiers or ‘...’ before ‘size_t’
./vlc_module.c: In function ‘fast_memcpy’:
./vlc_module.c:165: warning: implicit declaration of function ‘memcpy’
./vlc_module.c:165: warning: incompatible implicit declaration of built-in function ‘memcpy’
./vlc_module.c:165: error: ‘len’ undeclared (first use in this function)
In file included from ./vlc_module.c:175:
./vlc_mediacontrol.c: At top level:
./vlc_mediacontrol.c:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:109: error: expected ‘)’ before ‘*’ token
./vlc_mediacontrol.c:115: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:130: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:159: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:187: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:215: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:243: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:271: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:299: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:307: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:326: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:341: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:371: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:417: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:445: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:476: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:495: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:512: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:531: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:548: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:567: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:584: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediacontrol.c:603: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘MediaControl_methods’
./vlc_mediacontrol.c:651: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘MediaControl_Type’
In file included from ./vlc_module.c:176:
./vlc_position.c:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_position.c:70: error: expected ‘)’ before ‘*’ token
./vlc_position.c:91: error: expected ‘)’ before ‘*’ token
./vlc_position.c:115: error: expected ‘)’ before ‘*’ token
./vlc_position.c: In function ‘position_c_to_py’:
./vlc_position.c:157: warning: implicit declaration of function ‘PyObject_New’
./vlc_position.c:157: error: expected expression before ‘PyPosition’
./vlc_position.c:157: warning: assignment makes pointer from integer without a cast
./vlc_position.c:158: error: ‘PyPosition’ has no member named ‘origin’
./vlc_position.c:159: error: ‘PyPosition’ has no member named ‘key’
./vlc_position.c:160: error: ‘PyPosition’ has no member named ‘value’
./vlc_position.c: At top level:
./vlc_position.c:165: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyPosition_methods’
./vlc_position.c:170: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyPosition_members’
./vlc_position.c:178: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyPosition_Type’
In file included from ./vlc_module.c:177:
./vlc_instance.c:27: error: expected ‘)’ before ‘*’ token
./vlc_instance.c: In function ‘free_args’:
./vlc_instance.c:66: warning: implicit declaration of function ‘free’
./vlc_instance.c: At top level:
./vlc_instance.c:74: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:110: error: expected ‘)’ before ‘*’ token
./vlc_instance.c:116: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:123: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:142: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:168: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:179: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:191: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:203: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:214: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:225: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:236: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:249: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:297: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:314: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:331: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:348: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:361: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:379: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:390: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:402: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:418: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:430: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:446: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:458: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:476: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:512: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:528: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:545: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:562: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:579: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:596: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:613: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:649: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:665: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:681: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:697: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:714: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:732: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_instance.c:754: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘vlcInstance_methods’
./vlc_instance.c:836: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘vlcInstance_Type’
In file included from ./vlc_module.c:178:
./vlc_input.c:29: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:40: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:51: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:67: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:78: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:94: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:105: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:116: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:132: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:143: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:154: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:165: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:177: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:193: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:205: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:217: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:234: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:246: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:262: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:274: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:286: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:298: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:313: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:330: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:346: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:363: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:379: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:390: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:401: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:413: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:425: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:437: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:454: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:477: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:502: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:513: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_input.c:530: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘vlcMediaInstance_methods’
./vlc_input.c:612: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘vlcMediaInstance_Type’
In file included from ./vlc_module.c:179:
./vlc_mediadescriptor.c:30: error: expected ‘)’ before ‘*’ token
./vlc_mediadescriptor.c:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediadescriptor.c:52: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediadescriptor.c:68: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediadescriptor.c:81: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediadescriptor.c:98: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediadescriptor.c:115: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediadescriptor.c:131: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediadescriptor.c:142: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediadescriptor.c:159: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediadescriptor.c:170: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
./vlc_mediadescriptor.c:208: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘vlcMediaDescriptor_methods’
./vlc_mediadescriptor.c:234: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘vlcMediaDescriptor_Type’
error: command 'gcc' failed with exit status 1
For info I am running under Ubuntu 7.10 and I have VLC O.9.0-git Grishenko installed.
I got the git vlc-snapshot-20080412.tar.bz2 from which I am trying to run the python setup.py build.
Does anybody has an idea of what is going on?
Thanks in advance for your answers...
Nico
Re: VLC/Python bindings simple player example
Posted: 14 Apr 2008 13:38
by OlivierAubert
You need to install the python development packages, which bundle the necessary include files (and other files). On Debian and derivatives (including ubuntu), the package is named python-dev
Re: VLC/Python bindings simple player example
Posted: 14 Apr 2008 14:58
by nico_open
Thanks for your quick answer. I now have the python-dev pakage and its dependencies. Unfortunately, I still get errors doing the python setup.y build :
Code: Select all
*** Warning *** Cannot find vlc-config
*** Warning *** Cannot find vlc-config
*** Warning *** Cannot find vlc-config
running build
running build_ext
building 'vlc' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I../.. -I./../../include -I. -I/usr/win32/include -I/usr/include/python2.5 -c ./vlc_module.c -o build/temp.linux-i686-2.5/./vlc_module.o
In file included from ./../../include/vlc/vlc.h:38,
from ./vlcglue.h:31,
from ./vlc_module.c:24:
./../../include/vlc/libvlc.h:155: warning: function declaration isn’t a prototype
./../../include/vlc/libvlc.h:164: warning: function declaration isn’t a prototype
./../../include/vlc/libvlc.h:173: warning: function declaration isn’t a prototype
In file included from ./vlc_module.c:177:
./vlc_instance.c: In function ‘vlcInstance_new’:
./vlc_instance.c:100: warning: passing argument 2 of ‘libvlc_new’ from incompatible pointer type
./vlc_instance.c: In function ‘vlcInstance_playlist_loop’:
./vlc_instance.c:133: warning: ‘libvlc_playlist_loop’ is deprecated (declared at ./../../include/vlc/deprecated.h:52)
./vlc_instance.c: In function ‘vlcInstance_playlist_play’:
./vlc_instance.c:160: warning: ‘libvlc_playlist_play’ is deprecated (declared at ./../../include/vlc/deprecated.h:69)
./vlc_instance.c: In function ‘vlcInstance_playlist_pause’:
./vlc_instance.c:173: warning: ‘libvlc_playlist_pause’ is deprecated (declared at ./../../include/vlc/deprecated.h:80)
./vlc_instance.c: In function ‘vlcInstance_playlist_isplaying’:
./vlc_instance.c:186: warning: ‘libvlc_playlist_isplaying’ is deprecated (declared at ./../../include/vlc/deprecated.h:90)
./vlc_instance.c: In function ‘vlcInstance_playlist_items_count’:
./vlc_instance.c:198: warning: ‘libvlc_playlist_items_count’ is deprecated (declared at ./../../include/vlc/deprecated.h:100)
./vlc_instance.c: In function ‘vlcInstance_playlist_stop’:
./vlc_instance.c:208: warning: ‘libvlc_playlist_stop’ is deprecated (declared at ./../../include/vlc/deprecated.h:123)
./vlc_instance.c: In function ‘vlcInstance_playlist_next’:
./vlc_instance.c:219: warning: ‘libvlc_playlist_next’ is deprecated (declared at ./../../include/vlc/deprecated.h:133)
./vlc_instance.c: In function ‘vlcInstance_playlist_prev’:
./vlc_instance.c:230: warning: ‘libvlc_playlist_prev’ is deprecated (declared at ./../../include/vlc/deprecated.h:143)
./vlc_instance.c: In function ‘vlcInstance_playlist_clear’:
./vlc_instance.c:241: warning: ‘libvlc_playlist_clear’ is deprecated (declared at ./../../include/vlc/deprecated.h:152)
./vlc_instance.c: In function ‘vlcInstance_playlist_add’:
./vlc_instance.c:277: warning: ‘libvlc_playlist_add_extended’ is deprecated (declared at ./../../include/vlc/deprecated.h:181)
./vlc_instance.c:282: warning: passing argument 5 of ‘libvlc_playlist_add_extended’ from incompatible pointer type
./vlc_instance.c:287: warning: ‘libvlc_playlist_add’ is deprecated (declared at ./../../include/vlc/deprecated.h:165)
./vlc_instance.c: In function ‘vlcInstance_playlist_delete_item’:
./vlc_instance.c:308: warning: ‘libvlc_playlist_delete_item’ is deprecated (declared at ./../../include/vlc/deprecated.h:192)
./vlc_instance.c: In function ‘vlcInstance_playlist_get_media_player’:
./vlc_instance.c:322: warning: ‘libvlc_playlist_get_media_player’ is deprecated (declared at ./../../include/vlc/deprecated.h:201)
./vlc_instance.c: At top level:
./vlc_instance.c:806: warning: initialization from incompatible pointer type
./vlc_instance.c:820: warning: initialization from incompatible pointer type
In file included from ./vlc_module.c:179:
./vlc_mediadescriptor.c: In function ‘vlcMediaDescriptor_add_tag’:
./vlc_mediadescriptor.c:92: warning: implicit declaration of function ‘libvlc_media_add_tag’
./vlc_mediadescriptor.c:92: error: ‘libvlc_tag_t’ undeclared (first use in this function)
./vlc_mediadescriptor.c:92: error: (Each undeclared identifier is reported only once
./vlc_mediadescriptor.c:92: error: for each function it appears in.)
./vlc_mediadescriptor.c:92: error: expected ‘)’ before ‘psz_tag’
./vlc_mediadescriptor.c: In function ‘vlcMediaDescriptor_remove_tag’:
./vlc_mediadescriptor.c:109: warning: implicit declaration of function ‘libvlc_media_remove_tag’
./vlc_mediadescriptor.c:109: error: ‘libvlc_tag_t’ undeclared (first use in this function)
./vlc_mediadescriptor.c:109: error: expected ‘)’ before ‘psz_tag’
./vlc_mediadescriptor.c: In function ‘vlcMediaDescriptor_tags_count_for_key’:
./vlc_mediadescriptor.c:126: warning: implicit declaration of function ‘libvlc_media_tags_count_for_key’
error: command 'gcc' failed with exit status 1
Any ideas??
Re: VLC/Python bindings simple player example
Posted: 14 Apr 2008 15:01
by OlivierAubert
There have been a substantial number of changes in the libvlc API, and not all of them were reflected in the bindings (blame the modifier for this...). I am in the process of reviewing the bindings, but they are not buildable for the moment.
Re: VLC/Python bindings simple player example
Posted: 14 Apr 2008 15:19
by nico_open
Thank for this answer.
No worries I will compile the 0.8.6f version of VLC and wait for the 0.9 version.
Thanks again for your time...
Re: VLC/Python bindings simple player example
Posted: 15 Apr 2008 11:55
by nico_open
I am just adding a post because a bumped into a "problem" when I tried to compile vlc 0.8.6f with the --enable-mediacontrol-python-bindings.
The ./configure works fine. Here it is :
Code: Select all
./configure --prefix=/usr \
--enable-snapshot --enable-debug \
--enable-dbus-control --enable-musicbrainz \
--enable-mozilla \
--enable-lirc --enable-libtool \
--enable-shout --enable-taglib \
--enable-v4l \
--enable-dvb \
--enable-realrtsp --disable-xvmc \
--enable-svg --enable-dvdread \
--enable-dc1394 --enable-dv \
--enable-theora --enable-faad \
--enable-twolame --enable-real \
--enable-flac --enable-tremor \
--enable-skins2 --enable-qt4 \
--enable-ncurses \
--enable-aa --enable-caca \
--enable-esd --disable-portaudio \
--enable-jack --enable-xosd \
--enable-galaktos --enable-goom \
--enable-ggi \
--disable-cddax --disable-vcdx \
--disable-quicktime --enable-lua \
--enable-mediacontrol-python-bindings
But when I do the make, it returns me the following error:
Code: Select all
building 'vlc' extension
gcc -pthread -shared -Wl,-O1 ../../bindings/mediacontrol-python/./vlcglue.o ../../bindings/mediacontrol-python/./../../src/control/mediacontrol_init.o ../../src/libvlc.a -o ../../bindings/mediacontrol-python/lib.linux-i686-2.5/vlc.so -L../.. ../../modules/misc/memcpy/libmemcpymmx.a ../../modules/video_chroma/libi420_rgb_mmx.a ../../modules/video_chroma/libi422_yuy2_mmx.a ../../modules/video_chroma/libi420_ymga_mmx.a ../../modules/video_chroma/libi420_yuy2_mmx.a ../../modules/misc/memcpy/libmemcpymmxext.a ../../modules/misc/memcpy/libmemcpy3dn.a ../../modules/mux/mpeg/libmux_ts.a ../../modules/codec/libtheora.a -L/usr/lib -g -lhal -ldbus-1 -lrt -lpthread -ldl -lm -ldvbpsi -ltheora -logg
gcc: ../../src/libvlc.a : Aucun fichier ou répertoire de ce type
gcc: ../../modules/misc/memcpy/libmemcpymmx.a : Aucun fichier ou répertoire de ce type
gcc: ../../modules/video_chroma/libi420_rgb_mmx.a : Aucun fichier ou répertoire de ce type
gcc: ../../modules/video_chroma/libi422_yuy2_mmx.a : Aucun fichier ou répertoire de ce type
gcc: ../../modules/video_chroma/libi420_ymga_mmx.a : Aucun fichier ou répertoire de ce type
gcc: ../../modules/video_chroma/libi420_yuy2_mmx.a : Aucun fichier ou répertoire de ce type
gcc: ../../modules/misc/memcpy/libmemcpymmxext.a : Aucun fichier ou répertoire de ce type
gcc: ../../modules/misc/memcpy/libmemcpy3dn.a : Aucun fichier ou répertoire de ce type
gcc: ../../modules/mux/mpeg/libmux_ts.a : Aucun fichier ou répertoire de ce type
gcc: ../../modules/codec/libtheora.a : Aucun fichier ou répertoire de ce type
error: command 'gcc' failed with exit status 1
make[3]: *** [all] Erreur 1
make[3]: quittant le répertoire « /home/ndel/download/vlc-0.8.6f/bindings/mediacontrol-python »
make[2]: *** [all-recursive] Erreur 1
make[2]: quittant le répertoire « /home/ndel/download/vlc-0.8.6f/bindings »
make[1]: *** [all-recursive] Erreur 1
make[1]: quittant le répertoire « /home/ndel/download/vlc-0.8.6f »
make: *** [all] Erreur 2
I had a look and it seems that theses files are not present where the make is searching them and don't have the exact same names:
Code: Select all
find . -name *.a
./mozilla/libnpvlc.a
./modules/video_chroma/.libs/libi420_ymga_mmx_builtin.a
./modules/video_chroma/.libs/libi422_yuy2_mmx_builtin.a
./modules/video_chroma/.libs/libi420_rgb_mmx_builtin.a
./modules/video_chroma/.libs/libi420_yuy2_mmx_builtin.a
./modules/codec/.libs/libtheora_builtin.a
./modules/misc/memcpy/.libs/libmemcpy3dn_builtin.a
./modules/misc/memcpy/.libs/libmemcpymmx_builtin.a
./modules/misc/memcpy/.libs/libmemcpymmxext_builtin.a
./modules/mux/mpeg/.libs/libmux_ts_builtin.a
I tried with the 0.8.6e version and it is the same punishement. After searching in the wiki, I saw that for the 0.8.6a version it is not possible to --enable-mediacontrol-python-bindings and --enable-libtool at the same time. So I delete the --enable-libtool from my ./configure.
And now the make and the make install works fine.
So maybe it good be good to modify the wiki by saying that --enable-mediacontrol-python-bindings and --enable-libtool cannot be implemented at the same time in the ./configure for all 0.8.6x versions.
Thanks again for the help and cannot wait for a stable 0.9.0O version.
Re: VLC/Python bindings simple player example
Posted: 08 May 2009 12:15
by wlourf
You need to install the python development packages, which bundle the necessary include files (and other files). On Debian and derivatives (including ubuntu), the package is named python-dev
I think the information
install the python-dev package is missing in the
wiki page -but I can't edit the page (need a different login from the forum ?)
(for ubuntu 9.04 at least)
Thanks