gdb: add 'gst-pipeline-tree' command

It shows a simple tree of all elements in pipeline.
As with gst-dot, the toplevel bin is found from any element of the
pipeline:

(gdb) gst-pipeline-tree bsink
playbin
  inputselector1
  inputselector0
  uridecodebin0
    queue2-0
    decodebin0
      avdec_aac0
      aacparse0
      vaapidecodebin0
        vaapipostproc0
        capsfilter1
        vaapi-queue
        vaapidecode0
      capsfilter0
      h264parse0
      multiqueue0
      matroskademux0
      typefind
    typefindelement0
    source
  playsink
    abin
      aconv
        resample
        conv
        identity
      aqueue
      pulsesink0
    vbin
      vconv
        scale
        conv
        identity
      vqueue
      vaapisink0
    vdbin
      deinterlace
      vdconv
    audiotee
    streamsynchronizer0
This commit is contained in:
Michael Olbrich 2019-05-11 21:02:37 +02:00 committed by Tim-Philipp Müller
parent ebce5a7ee9
commit 2bd2ed289a

View file

@ -871,6 +871,12 @@ class GdbGstElement(GdbGstObject):
_gdb_write(indent, "}")
@save_memory_access_print("<inaccessible memory>")
def print_tree(self, indent):
_gdb_write(indent, "%s" % self.name())
for child in self.children():
child.print_tree(indent+1)
def _dot(self, indent=0):
spc = " " * indent
@ -1049,8 +1055,31 @@ Usage gst-print <gstreamer-object>"""
obj.print(0)
class GstPipelineTree(gdb.Command):
"""\
Usage: gst-pipeline-tree <gst-object>"""
def __init__(self):
super(GstPipelineTree, self).__init__("gst-pipeline-tree",
gdb.COMPLETE_SYMBOL)
def invoke(self, arg, from_tty):
self.dont_repeat()
args = gdb.string_to_argv(arg)
if len(args) != 1:
raise Exception("Usage: gst-pipeline-tree <gst-object>")
value = gdb.parse_and_eval(args[0])
if not value:
raise Exception("'%s' is not a valid object" % args[0])
value = gst_object_from_value(value)
value = gst_object_pipeline(value)
GdbGstElement(value).print_tree(0)
GstDot()
GstPrint()
GstPipelineTree()
class GstPipeline(gdb.Function):