mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-02 02:03:54 +00:00
tools: catch and print missing-plugin messages in gst-launch
So that users get some feedback if they're using a pipeline like src ! decodebin2 ! sink and are missing an element.
This commit is contained in:
parent
57df188757
commit
329b786569
1 changed files with 28 additions and 0 deletions
|
@ -403,6 +403,24 @@ print_index_stats (GPtrArray * index_stats)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Kids, use the functions from libgstpbutils in gst-plugins-base in your
|
||||||
|
* own code (we can't do that here because it would introduce a circular
|
||||||
|
* dependency) */
|
||||||
|
static gboolean
|
||||||
|
gst_is_missing_plugin_message (GstMessage * msg)
|
||||||
|
{
|
||||||
|
if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ELEMENT || msg->structure == NULL)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return gst_structure_has_name (msg->structure, "missing-plugin");
|
||||||
|
}
|
||||||
|
|
||||||
|
static const gchar *
|
||||||
|
gst_missing_plugin_message_get_description (GstMessage * msg)
|
||||||
|
{
|
||||||
|
return gst_structure_get_string (msg->structure, "name");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_error_message (GstMessage * msg)
|
print_error_message (GstMessage * msg)
|
||||||
{
|
{
|
||||||
|
@ -821,6 +839,16 @@ event_loop (GstElement * pipeline, gboolean blocking, GstState target_state)
|
||||||
res = ELR_INTERRUPT;
|
res = ELR_INTERRUPT;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GST_MESSAGE_ELEMENT:{
|
||||||
|
if (gst_is_missing_plugin_message (message)) {
|
||||||
|
const gchar *desc;
|
||||||
|
|
||||||
|
desc = gst_missing_plugin_message_get_description (message);
|
||||||
|
PRINT (_("Missing element: %s\n"), desc ? desc : "(no description)");
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
/* just be quiet by default */
|
/* just be quiet by default */
|
||||||
|
|
Loading…
Reference in a new issue