This file is indexed.

/usr/share/gst-python/0.10/examples/decodebin.py is in python-gst0.10-dev 0.10.22-3ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env python

# decodebin.py - Audio autopluging example using 'decodebin' element
# Copyright (C) 2006 Jason Gerard DeRose <jderose@jasonderose.org>

# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

import sys

import gobject
gobject.threads_init()

import pygst
pygst.require('0.10')
import gst


class Decodebin:
	def __init__(self, location):
		# The pipeline
		self.pipeline = gst.Pipeline()
		
		# Create bus and connect several handlers
		self.bus = self.pipeline.get_bus()
		self.bus.add_signal_watch()
		self.bus.connect('message::eos', self.on_eos)
		self.bus.connect('message::tag', self.on_tag)
		self.bus.connect('message::error', self.on_error)

		# Create elements
		self.src = gst.element_factory_make('filesrc')
		self.dec = gst.element_factory_make('decodebin')
		self.conv = gst.element_factory_make('audioconvert')
		self.rsmpl = gst.element_factory_make('audioresample')
		self.sink = gst.element_factory_make('alsasink')
		
		# Set 'location' property on filesrc
		self.src.set_property('location', location)
		
		# Connect handler for 'new-decoded-pad' signal 
		self.dec.connect('new-decoded-pad', self.on_new_decoded_pad)
		
		# Add elements to pipeline
		self.pipeline.add(self.src, self.dec, self.conv, self.rsmpl, self.sink)
		
		# Link *some* elements 
		# This is completed in self.on_new_decoded_pad()
		self.src.link(self.dec)
		gst.element_link_many(self.conv, self.rsmpl, self.sink)
		
		# Reference used in self.on_new_decoded_pad()
		self.apad = self.conv.get_pad('sink')

		# The MainLoop
		self.mainloop = gobject.MainLoop()

		# And off we go!
		self.pipeline.set_state(gst.STATE_PLAYING)
		self.mainloop.run()
		
		
	def on_new_decoded_pad(self, element, pad, last):
		caps = pad.get_caps()
		name = caps[0].get_name()
		print 'on_new_decoded_pad:', name
		if name == 'audio/x-raw-float' or name == 'audio/x-raw-int':
			if not self.apad.is_linked(): # Only link once
				pad.link(self.apad)
			
			
	def on_eos(self, bus, msg):
		print 'on_eos'
		self.mainloop.quit()
		
		
	def on_tag(self, bus, msg):
		taglist = msg.parse_tag()
		print 'on_tag:'
		for key in taglist.keys():
			print '\t%s = %s' % (key, taglist[key])
			
			
	def on_error(self, bus, msg):
		error = msg.parse_error()
		print 'on_error:', error[1]
		self.mainloop.quit()





if __name__ == '__main__':
	if len(sys.argv) == 2:
		Decodebin(sys.argv[1])
	else:
		print 'Usage: %s /path/to/media/file' % sys.argv[0]