/usr/share/pyshared/gst-0.10/gst/extend/utils.py is in python-gst0.10 0.10.22-3.
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 | import os
import gobject
import gst
def gst_dump(bin):
dump_element(bin, 0)
def dump_bin(bin, indent):
# Iterate the children
for child in bin.get_list():
dump_element(child, indent + 2)
def dump_element(element, indent):
states = { 1: 'NULL', 2: 'READY',
4: 'PAUSED', 8: 'PLAYING' }
state = 'UNKNOWN'
try:
state = states[element.get_state()]
except KeyError:
state = 'UNKNOWN (%d)' % element.get_state()
c = element.get_clock()
if c is None:
clock_str = "clock - None"
else:
clock_str = "clock - %s" % (c.get_name())
out = "%s (%s): state %s, %s" % (element.get_name(),
gobject.type_name(element.__gtype__), state, clock_str)
print out.rjust(len(out) + indent)
tmp = { True: 'active', False: 'inactive' }
for curpad in element.get_pad_list():
if curpad.get_direction() == gst.PAD_SRC:
if curpad.is_linked():
peer = curpad.get_peer()
out = " - %s:%s (%s) => %s:%s (%s)" % (
curpad.get_parent().get_name(), curpad.get_name(),
tmp[curpad.is_active()],
peer.get_parent().get_name(), peer.get_name(),
tmp[peer.is_active()])
print out.rjust(len(out) + indent)
if isinstance(element, gst.Bin):
dump_bin(element, indent + 2)
elif isinstance(element, gst.Queue):
out = " - time_level: %ld" % (
element.get_property('current-level-time'))
print out.rjust(len(out) + indent)
out = " - bytes_level: %ld" % (
element.get_property('current-level-bytes'))
print out.rjust(len(out) + indent)
def gc_collect(reason=None):
"""
Garbage-collect if GST_GC env var is set.
This helps in debugging object refcounting.
Sprinkle liberally around checkpoints.
"""
env = os.environ.get('GST_GC', None)
if not env:
return
import gc
if env == 'DEBUG_LEAK':
gc.set_debug(gc.DEBUG_LEAK)
gst.debug('collecting garbage')
if reason:
gst.debug('because of %s' % reason)
count = gc.collect()
gst.debug('collected garbage, %d objects collected, %d left' % (
count, len(gc.get_objects())))
|