mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 05:26:23 +00:00
gdb: add gst_pipeline() and gst_bin_get() functions
This simplifies navigating in a GStreamer pipeline, e.g. (gdb) print $gst_bin_get($gst_pipeline(pad), "matroskademux0") $1 = 0x7fffe81b4050 [GstMatroskaDemux|matroskademux0]
This commit is contained in:
parent
8ccb9f2595
commit
ebce5a7ee9
1 changed files with 52 additions and 0 deletions
|
@ -1053,6 +1053,58 @@ GstDot()
|
|||
GstPrint()
|
||||
|
||||
|
||||
class GstPipeline(gdb.Function):
|
||||
"""\
|
||||
Find the top-level pipeline for the given element"""
|
||||
|
||||
def __init__(self):
|
||||
super(GstPipeline, self).__init__("gst_pipeline")
|
||||
|
||||
def invoke(self, arg):
|
||||
value = gst_object_from_value(arg)
|
||||
return gst_object_pipeline(value)
|
||||
|
||||
|
||||
class GstBinGet(gdb.Function):
|
||||
"""\
|
||||
Find a child element with the given name"""
|
||||
|
||||
def __init__(self):
|
||||
super(GstBinGet, self).__init__("gst_bin_get")
|
||||
|
||||
def find(self, obj, name, recurse):
|
||||
for child in obj.children():
|
||||
if child.name() == name:
|
||||
return child.val
|
||||
if recurse:
|
||||
result = self.find(child, name, recurse)
|
||||
if result is not None:
|
||||
return result
|
||||
|
||||
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_bin_get(<gst-object>, \"<name>\")")
|
||||
|
||||
obj = GdbGstElement(value)
|
||||
child = self.find(obj, name, False)
|
||||
if child is None:
|
||||
child = self.find(obj, name, True)
|
||||
if child is None:
|
||||
raise Exception("No child named '%s' found." % name)
|
||||
return child
|
||||
|
||||
|
||||
GstPipeline()
|
||||
GstBinGet()
|
||||
|
||||
|
||||
def register(obj):
|
||||
if obj is None:
|
||||
obj = gdb
|
||||
|
|
Loading…
Reference in a new issue