Improve introspection

Add instrospection of client and source-output.
Add properties to source-output and to CreateSourceOutput/Input
Add helper to fill properties of context.
Add client-name to pinossrc and pinossink
Improve test-subscribe to show all new introspection details.
This commit is contained in:
Wim Taymans 2015-07-28 17:05:03 +02:00
parent 85e09e7a5b
commit 13d846ec38
21 changed files with 684 additions and 72 deletions

View file

@ -34,3 +34,62 @@ pinos_init (int *argc, char **argv[])
{
gst_init (argc, argv);
}
/**
* pinos_client_name:
*
* Make a new pinos client name that can be used to construct a context.
*/
gchar *
pinos_client_name (void)
{
const char *c;
if ((c = g_get_application_name ()))
return g_strdup (c);
else if ((c = g_get_prgname ()))
return g_strdup (c);
else
return g_strdup_printf ("pinos-pid-%lu", (gulong) getpid ());
}
void
pinos_fill_context_properties (PinosProperties *properties)
{
g_return_if_fail (properties != NULL);
if (!pinos_properties_get (properties, "application.name"))
pinos_properties_set (properties, "application.name", g_get_application_name ());
if (!pinos_properties_get (properties, "application.prgname"))
pinos_properties_set (properties, "application.prgname", g_get_prgname ());
if (!pinos_properties_get (properties, "application.language")) {
const gchar *str = g_getenv ("LANG");
if (str)
pinos_properties_set (properties, "application.language", str);
}
if (!pinos_properties_get (properties, "application.process.id")) {
gchar *str = g_strdup_printf ("%lu", (gulong) getpid());
pinos_properties_set (properties, "application.process.id", str);
g_free (str);
}
if (!pinos_properties_get (properties, "application.process.user"))
pinos_properties_set (properties, "application.process.user", g_get_user_name ());
if (!pinos_properties_get (properties, "application.process.host"))
pinos_properties_set (properties, "application.process.host", g_get_host_name ());
if (!pinos_properties_get (properties, "application.process.session_id")) {
const gchar *str = g_getenv ("XDG_SESSION_ID");
if (str)
pinos_properties_set (properties, "application.process.session_id", str);
}
}
void
pinos_fill_stream_properties (PinosProperties *properties)
{
g_return_if_fail (properties != NULL);
}