From c81ee91edca11649e8cb720a418b3caa64c3fce5 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 10 Oct 2024 08:53:19 -0400 Subject: [PATCH] inspect: display element flags I wanted to check if an element had the SINK flag and realized it was not displayed in gst-inspect. The clock flags were already reported as part of the "clocking capabilities" info but best to have them explicitly listed here as well. Part-of: --- subprojects/gstreamer/tools/gst-inspect.c | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/subprojects/gstreamer/tools/gst-inspect.c b/subprojects/gstreamer/tools/gst-inspect.c index 7195c9c34e..41e8a02c7f 100644 --- a/subprojects/gstreamer/tools/gst-inspect.c +++ b/subprojects/gstreamer/tools/gst-inspect.c @@ -372,6 +372,29 @@ print_interfaces (GType type) } } +static void +print_element_flags (GstElement * element) +{ + n_print (_("%sElement Flags%s:\n"), HEADING_COLOR, RESET_COLOR); + + push_indent (); + if (GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_FLAG_LOCKED_STATE)) + n_print ("- %s%s%s\n", DATATYPE_COLOR, "LOCKED_STATE", RESET_COLOR); + if (GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_FLAG_SINK)) + n_print ("- %s%s%s\n", DATATYPE_COLOR, "SINK", RESET_COLOR); + if (GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_FLAG_SOURCE)) + n_print ("- %s%s%s\n", DATATYPE_COLOR, "SOURCE", RESET_COLOR); + if (GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_FLAG_PROVIDE_CLOCK)) + n_print ("- %s%s%s\n", DATATYPE_COLOR, "PROVIDE_CLOCK", RESET_COLOR); + if (GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_FLAG_REQUIRE_CLOCK)) + n_print ("- %s%s%s\n", DATATYPE_COLOR, "REQUIRE_CLOCK", RESET_COLOR); + if (GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_FLAG_INDEXABLE)) + n_print ("- %s%s%s\n", DATATYPE_COLOR, "REQUIRE_INDEXABLE", RESET_COLOR); + pop_indent (); + + n_print ("\n"); +} + static gchar * flags_to_string (GFlagsValue * vals, guint flags) { @@ -1799,6 +1822,7 @@ print_element_info (GstPluginFeature * feature, gboolean print_names) print_hierarchy (G_OBJECT_TYPE (element), 0, &maxlevel); print_interfaces (G_OBJECT_TYPE (element)); + print_element_flags (element); print_pad_templates_info (element, factory); print_clocking_info (element);