2
# THIS FILE IS PART OF THE JOKOSHER PROJECT AND LICENSED UNDER THE GPL. SEE
3
# THE 'COPYING' FILE FOR DETAILS
7
# This class provides a bunch of debugging methods that are mainly intended
8
# for cracking open pipelines and looking at the goo inside. This most likely
9
# won't be shipped with the final release and is mainly useful for hackers
10
# who are involved in the project.
12
# To enable debugging mode, set an environmental variable:
14
# foo@bar~$ export JOKOSHER_DEBUG=1
16
#-------------------------------------------------------------------------------
21
This class provides debugging methods that are mainly intended
22
for cracking open pipelines and looking at the goo inside. This most likely
23
won't be shipped with the final release and is mainly useful for hackers
24
who are involved in the project.
26
To enable debugging mode, set an environmental variable:
28
foo@bar~$ export JOKOSHER_DEBUG=1
31
# remember the trailing space
32
self.DEBUG_PREFIX = "[debug] "
34
def ShowPipelineDetails(self, pipeline):
36
Display the pipeline details, including pads.
39
pipeline -- pipeline object to inspect.
44
pipe = pipeline.sorted()
49
for element in pipeline.sorted():
50
pipelinechildren[:0] = element
53
Globals.debug(self.DEBUG_PREFIX + ">>> Element '" + str(child.get_name()) + "' (" + child.get_factory().get_name() + ")")
54
for pad in child.pads():
55
if pad.is_linked() == True:
56
Globals.debug(self.DEBUG_PREFIX + "\tPAD LINK: pad: '" + str(pad.get_name()) + "' connects to " + str(pad.get_peer()))
58
Globals.debug(self.DEBUG_PREFIX + "\tNO LINK: " + str(pad.get_name()))
60
Globals.debug(self.DEBUG_PREFIX + "<<< END ELEMENT <<<")
62
def ShowPipeline(self, pipeline):
64
Display the construction of the pipeline in a gst-launch type format.
67
pipeline -- pipeline object to inspect.
73
for element in pipeline.sorted():
74
pipelinechildren[:0] = [element.get_factory().get_name()]
76
for elem in pipelinechildren:
77
finalpipe += elem + " ! "
79
Globals.debug(self.DEBUG_PREFIX + finalpipe)
81
def ShowPipelineTree(self, pipeline, recurseDepth = 0, maxDepth = 3):
83
Display a tree of pipeline elements and their children.
86
pipeline -- pipeline object to inspect.
87
recurseDepth -- recursion tree depth.
88
maxDepth -- maximum recursion depth.
90
if recurseDepth > maxDepth:
94
Globals.debug(self.DEBUG_PREFIX + "PIPELINE END")
96
for element in pipeline.sorted():
98
indent = self.DEBUG_PREFIX
99
for i in range(recurseDepth):
101
Globals.debug(indent + element.get_factory().get_name() + ": " + element.get_name())
103
self.ShowPipelineTree(element, recurseDepth+1, maxDepth)
107
if recurseDepth == 0:
108
Globals.debug(self.DEBUG_PREFIX + "PIPELINE START")