Commit 91f06acc authored by Olivier Aubert's avatar Olivier Aubert

python-ctypes: give running example

Invoking
python vlc.py filename.avi
will play the given movie.
parent cdb7b4af
......@@ -40,14 +40,26 @@ callbackmethod=ctypes.CFUNCTYPE(None, Event, ctypes.c_void_p)
@callbackmethod
def debug_callback(event, data):
print "Debug callback method"
print "Event:", event
print "Event:", event.type
print "Data", data
if __name__ == '__main__':
import sys
import gobject
@callbackmethod
def end_callback(event, data):
print "End of stream"
sys.exit(0)
if sys.argv[1:]:
i=vlc.Instance()
i=Instance()
m=i.media_new(sys.argv[1])
p=MediaPlayer()
p=i.media_player_new()
p.set_media(m)
p.play()
# Loop
e=p.event_manager()
e.event_attach(EventType.MediaPlayerPaused, end_callback, None)
gobject.MainLoop().run()
......@@ -154,3 +154,5 @@ def check_vlc_exception(result, func, args):
if c:
raise Exception(args[-1].message)
return result
### End of header.py ###
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment