mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-03 23:16:38 +00:00
a37dede09c
Original commit message from CVS: * examples/gstreamer/filesrc.py,player.py: New examples * gstreamer/gstreamer.override: Add a dict like interface to GstTagList * gstreamer/gstpad-handlers.override: New file, split out from gstreamer.override * gstreamer/gst-types.defs: Don't use gst_buffer_free/gst_data_free, use gst_data_unref instead. * gstreamer/gst-types.c (PyGstData_to_value): Don't send address here. * gstreamer/arg-types.py (GstDataPtrArg.write_param): Send the address to stuff, since we really want to avoid segfaults :) * gstreamer/0.6.[c,defs,h,override]: Remove, we're focusing on 0.7 * gstreamer/0.7.[c,defs,h,override]: Remove, merge with gstreamer.* * gstreamer/Makefile.am: Clean up, remove versioning support.
41 lines
903 B
Python
Executable file
41 lines
903 B
Python
Executable file
import os
|
|
import sys
|
|
|
|
import gst
|
|
|
|
def found_tags(element, source, tags):
|
|
print 'Artist:', tags.get('artist')
|
|
print 'Title: ', tags.get('title')
|
|
print 'Album: ', tags.get('album')
|
|
|
|
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))
|
|
|