mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 22:36:33 +00:00
gst-inspect: print more details for typefind and tracer features
Print full details for typefind features. Print some of the available features for tracers and add some todos for the ones we'd like to see.
This commit is contained in:
parent
ef660a21d6
commit
875903be3f
1 changed files with 147 additions and 29 deletions
|
@ -30,6 +30,7 @@
|
||||||
#define GLIB_DISABLE_DEPRECATION_WARNINGS
|
#define GLIB_DISABLE_DEPRECATION_WARNINGS
|
||||||
|
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
#include <gst/gst_private.h> /* for internal Factories */
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
@ -39,6 +40,9 @@ static char *_name = NULL;
|
||||||
|
|
||||||
static int print_element_info (GstPluginFeature * feature,
|
static int print_element_info (GstPluginFeature * feature,
|
||||||
gboolean print_names);
|
gboolean print_names);
|
||||||
|
static int print_typefind_info (GstPluginFeature * feature,
|
||||||
|
gboolean print_names);
|
||||||
|
static int print_tracer_info (GstPluginFeature * feature, gboolean print_names);
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
G_GNUC_PRINTF (1, 2)
|
G_GNUC_PRINTF (1, 2)
|
||||||
|
@ -937,6 +941,17 @@ print_blacklist (void)
|
||||||
gst_plugin_list_free (plugins);
|
gst_plugin_list_free (plugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_typefind_extensions (const gchar * const *extensions)
|
||||||
|
{
|
||||||
|
guint i = 0;
|
||||||
|
|
||||||
|
while (extensions[i]) {
|
||||||
|
g_print ("%s%s", i > 0 ? ", " : "", extensions[i]);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_element_list (gboolean print_all, gchar * ftypes)
|
print_element_list (gboolean print_all, gchar * ftypes)
|
||||||
{
|
{
|
||||||
|
@ -953,7 +968,6 @@ print_element_list (gboolean print_all, gchar * ftypes)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
orig_plugins = plugins = gst_registry_get_plugin_list (gst_registry_get ());
|
orig_plugins = plugins = gst_registry_get_plugin_list (gst_registry_get ());
|
||||||
while (plugins) {
|
while (plugins) {
|
||||||
GList *features, *orig_features;
|
GList *features, *orig_features;
|
||||||
|
@ -1021,15 +1035,10 @@ print_element_list (gboolean print_all, gchar * ftypes)
|
||||||
|
|
||||||
extensions = gst_type_find_factory_get_extensions (factory);
|
extensions = gst_type_find_factory_get_extensions (factory);
|
||||||
if (extensions != NULL) {
|
if (extensions != NULL) {
|
||||||
guint i = 0;
|
if (!print_all) {
|
||||||
|
print_typefind_extensions (extensions);
|
||||||
while (extensions[i]) {
|
|
||||||
if (!print_all)
|
|
||||||
g_print ("%s%s", i > 0 ? ", " : "", extensions[i]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
if (!print_all)
|
|
||||||
g_print ("\n");
|
g_print ("\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!print_all)
|
if (!print_all)
|
||||||
g_print ("no extensions\n");
|
g_print ("no extensions\n");
|
||||||
|
@ -1273,31 +1282,31 @@ print_feature_info (const gchar * feature_name, gboolean print_all)
|
||||||
{
|
{
|
||||||
GstPluginFeature *feature;
|
GstPluginFeature *feature;
|
||||||
GstRegistry *registry = gst_registry_get ();
|
GstRegistry *registry = gst_registry_get ();
|
||||||
|
int ret;
|
||||||
|
|
||||||
feature = gst_registry_find_feature (registry, feature_name,
|
if ((feature = gst_registry_find_feature (registry, feature_name,
|
||||||
GST_TYPE_ELEMENT_FACTORY);
|
GST_TYPE_ELEMENT_FACTORY))) {
|
||||||
if (feature) {
|
ret = print_element_info (feature, print_all);
|
||||||
int ret = print_element_info (feature, print_all);
|
goto handled;
|
||||||
gst_object_unref (feature);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
/* FIXME implement other pretty print function for these */
|
if ((feature = gst_registry_find_feature (registry, feature_name,
|
||||||
feature = gst_registry_find_feature (registry, feature_name,
|
GST_TYPE_TYPE_FIND_FACTORY))) {
|
||||||
GST_TYPE_TYPE_FIND_FACTORY);
|
ret = print_typefind_info (feature, print_all);
|
||||||
if (feature) {
|
goto handled;
|
||||||
n_print ("%s: a typefind function\n", feature_name);
|
|
||||||
gst_object_unref (feature);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
feature = gst_registry_find_feature (registry, feature_name,
|
if ((feature = gst_registry_find_feature (registry, feature_name,
|
||||||
GST_TYPE_TRACER_FACTORY);
|
GST_TYPE_TRACER_FACTORY))) {
|
||||||
if (feature) {
|
ret = print_tracer_info (feature, print_all);
|
||||||
n_print ("%s: a tracer module\n", feature_name);
|
goto handled;
|
||||||
gst_object_unref (feature);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: handle DEVICE_PROVIDER_FACTORY */
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
handled:
|
||||||
|
gst_object_unref (feature);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1351,10 +1360,119 @@ print_element_info (GstPluginFeature * feature, gboolean print_names)
|
||||||
gst_object_unref (element);
|
gst_object_unref (element);
|
||||||
gst_object_unref (factory);
|
gst_object_unref (factory);
|
||||||
g_free (_name);
|
g_free (_name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
print_typefind_info (GstPluginFeature * feature, gboolean print_names)
|
||||||
|
{
|
||||||
|
GstTypeFindFactory *factory;
|
||||||
|
GstPlugin *plugin;
|
||||||
|
GstCaps *caps;
|
||||||
|
GstRank rank;
|
||||||
|
char s[20];
|
||||||
|
const gchar *const *extensions;
|
||||||
|
|
||||||
|
factory = GST_TYPE_FIND_FACTORY (gst_plugin_feature_load (feature));
|
||||||
|
if (!factory) {
|
||||||
|
g_print ("typefind plugin couldn't be loaded\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (print_names)
|
||||||
|
_name = g_strdup_printf ("%s: ", GST_OBJECT_NAME (factory));
|
||||||
|
else
|
||||||
|
_name = NULL;
|
||||||
|
|
||||||
|
n_print ("Factory Details:\n");
|
||||||
|
rank = gst_plugin_feature_get_rank (feature);
|
||||||
|
n_print (" %-25s%s (%d)\n", "Rank", get_rank_name (s, rank), rank);
|
||||||
|
n_print (" %-25s%s\n", "Name", GST_OBJECT_NAME (factory));
|
||||||
|
caps = gst_type_find_factory_get_caps (factory);
|
||||||
|
if (caps) {
|
||||||
|
gchar *caps_str = gst_caps_to_string (factory->caps);
|
||||||
|
|
||||||
|
n_print (" %-25s%s\n", "Caps", caps_str);
|
||||||
|
g_free (caps_str);
|
||||||
|
}
|
||||||
|
extensions = gst_type_find_factory_get_extensions (factory);
|
||||||
|
if (extensions) {
|
||||||
|
n_print (" %-25s", "Extensions");
|
||||||
|
print_typefind_extensions (extensions);
|
||||||
|
n_print ("\n");
|
||||||
|
}
|
||||||
|
n_print ("\n");
|
||||||
|
|
||||||
|
plugin = gst_plugin_feature_get_plugin (GST_PLUGIN_FEATURE (factory));
|
||||||
|
if (plugin) {
|
||||||
|
print_plugin_info (plugin);
|
||||||
|
gst_object_unref (plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_object_unref (factory);
|
||||||
|
g_free (_name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
print_tracer_info (GstPluginFeature * feature, gboolean print_names)
|
||||||
|
{
|
||||||
|
GstTracerFactory *factory;
|
||||||
|
GstTracer *tracer;
|
||||||
|
GstPlugin *plugin;
|
||||||
|
gint maxlevel = 0;
|
||||||
|
|
||||||
|
factory = GST_TRACER_FACTORY (gst_plugin_feature_load (feature));
|
||||||
|
if (!factory) {
|
||||||
|
g_print ("tracer plugin couldn't be loaded\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tracer = (GstTracer *) g_object_new (factory->type, NULL);
|
||||||
|
if (!tracer) {
|
||||||
|
gst_object_unref (factory);
|
||||||
|
g_print ("couldn't construct tracer for some reason\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (print_names)
|
||||||
|
_name = g_strdup_printf ("%s: ", GST_OBJECT_NAME (factory));
|
||||||
|
else
|
||||||
|
_name = NULL;
|
||||||
|
|
||||||
|
n_print ("Factory Details:\n");
|
||||||
|
n_print (" %-25s%s\n", "Name", GST_OBJECT_NAME (factory));
|
||||||
|
n_print ("\n");
|
||||||
|
|
||||||
|
plugin = gst_plugin_feature_get_plugin (GST_PLUGIN_FEATURE (factory));
|
||||||
|
if (plugin) {
|
||||||
|
print_plugin_info (plugin);
|
||||||
|
gst_object_unref (plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
print_hierarchy (G_OBJECT_TYPE (tracer), 0, &maxlevel);
|
||||||
|
print_interfaces (G_OBJECT_TYPE (tracer));
|
||||||
|
|
||||||
|
/* TODO: list what hooks it registers
|
||||||
|
* - the data is available in gsttracerutils, we need to iterate the
|
||||||
|
* _priv_tracers hashtable for each probe and then check the list of hooks
|
||||||
|
* for each probe whether hook->tracer == tracer :/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* TODO: list what records it emits
|
||||||
|
* - in class_init tracers can create GstTracerRecord instances
|
||||||
|
* - those only get logged right now and there is no association with the
|
||||||
|
* tracer that created them
|
||||||
|
* - we'd need to add them to GstTracerFactory
|
||||||
|
* gst_tracer_class_add_record (klass, record);
|
||||||
|
* - needs work in gstregistrychunks.
|
||||||
|
*/
|
||||||
|
|
||||||
|
gst_object_unref (tracer);
|
||||||
|
gst_object_unref (factory);
|
||||||
|
g_free (_name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_plugin_automatic_install_info_codecs (GstElementFactory * factory)
|
print_plugin_automatic_install_info_codecs (GstElementFactory * factory)
|
||||||
|
|
Loading…
Reference in a new issue