Commit 96b88ffe authored by Michael Olbrich's avatar Michael Olbrich Committed by Tim-Philipp Müller

gdb: add gst_element_pad() function

Another helper to navigate a pipeline. It makes it possible to easily
access the pads of an element:

(gdb) print $gst_element_pad(basesink, "sink")
$1 = 0x7fffe80770f0 [GstPad|sink]
parent 4877afc1
......@@ -1157,8 +1157,35 @@ Find a child element with the given name"""
return child
class GstElementPad(gdb.Function):
"""\
Get the pad with the given name"""
def __init__(self):
super(GstElementPad, self).__init__("gst_element_pad")
def invoke(self, element, arg):
value = gst_object_from_value(element)
if not g_inherits_type(value, "GstElement"):
raise Exception("'%s' is not a GstElement" %
str(value.address))
try:
name = arg.string()
except gdb.error:
raise Exception("Usage: $gst_element_pad(<gst-object>, \"<pad-name>\")")
obj = GdbGstElement(value)
for pad in obj.pads():
if pad.name() == name:
return pad.val
raise Exception("No pad named '%s' found." % name)
GstPipeline()
GstBinGet()
GstElementPad()
def register(obj):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment