gstreamer/examples/gst/player.py
Johan Dahlin cc23405805 More generalized tagging
Original commit message from CVS:
More generalized tagging
2004-03-08 14:32:14 +00:00

40 lines
848 B
Python
Executable file

import os
import sys
import gst
def found_tags(element, source, tags):
for tag in tags.keys():
print gst.tag_get_nick(tag), tags[tag]
def playfile(filename):
bin = gst.Pipeline('player')
source = gst.Element('filesrc', 'src')
source.set_property('location', filename)
spider = gst.Element('spider', 'spider')
spider.connect('found-tag', found_tags)
sink = gst.Element('osssink', 'sink')
bin.add_many(source, spider, sink)
gst.element_link_many(source, spider, sink)
print 'Playing:', os.path.basename(filename)
bin.set_state(gst.STATE_PLAYING)
try:
while bin.iterate():
pass
except KeyboardInterrupt:
pass
bin.set_state(gst.STATE_NULL)
def main(args):
map(playfile, args[1:])
if __name__ == '__main__':
sys.exit(main(sys.argv))