3 # Copyright (C) 2006 Andy Wingo <wingo at pobox.com>
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Library General Public
7 # License as published by the Free Software Foundation; either
8 # version 2 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Library General Public License for more details.
15 # You should have received a copy of the GNU Library General Public
16 # License along with this library; if not, write to the
17 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 # Boston, MA 02110-1301, USA.
27 gobject.threads_init()
31 from gst.extend import discoverer
34 print "error: %r does not appear to be a media file" % path
39 print '%s: %s' % (prop, val)
40 pp('media type', d.mimetype)
42 pp('has video', d.is_video)
44 pp('video caps', d.videocaps)
45 pp('video width (pixels)', d.videowidth)
46 pp('video height (pixels)', d.videoheight)
47 pp('video length (hh:mm:ss)', gst.TIME_ARGS(d.videolength))
48 pp('framerate (fps)', '%s/%s' % (d.videorate.num, d.videorate.denom))
50 pp('has audio', d.is_audio)
52 pp('audio caps', d.audiocaps)
53 pp('audio format', d.audiofloat and 'floating-point' or 'integer')
54 pp('sample rate (Hz)', d.audiorate)
55 pp('sample width (bits)', d.audiowidth)
56 pp('sample depth (bits)', d.audiodepth)
57 pp('audio length (hh:mm:ss)', gst.TIME_ARGS(d.audiolength))
58 pp('audio channels', d.audiochannels)
63 def discovered(d, is_media):
69 d = discoverer.Discoverer(path)
70 d.connect('discovered', discovered)
72 gobject.MainLoop().run()
75 print >>sys.stderr, "usage: gst-discover PATH-TO-MEDIA-FILE"
82 if not os.path.isfile(path):
83 print >>sys.stderr, "error: file %r does not exist" % path
88 if __name__ == '__main__':
89 sys.exit(main(sys.argv))