mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
cc23405805
Original commit message from CVS: More generalized tagging
40 lines
848 B
Python
Executable file
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))
|
|
|