No error checking on the gst-pipeline construction
mithro opened this issue · 8 comments
For example, the UI uses monoscope for audio display, but if the monoscope plugin isn't installed it doesn't output anything and just fails to work.
Take a look at
static GString *
gst_audio_visual_get_pipeline_string (GstAudioVisual *visual)
{
I think some api like gst_element_factory_make could be used to check if monoscope exists or not.
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstGError.html
Errors can be received by listening to the GstBus of the element/pipeline for GstMessage objects with the type GST_MESSAGE_ERROR or GST_MESSAGE_WARNING. The thrown errors should be inspected, and filtered if appropriate.
GST_CORE_ERROR_FAILED
a general error which doesn't fit in any other category. Make sure you add a custom message to the error call.
GST_CORE_ERROR_TOO_LAZY
do not use this except as a placeholder for deciding where to go while developing code.
GST_CORE_ERROR_NOT_IMPLEMENTED
use this when you do not want to implement this functionality yet.
GST_CORE_ERROR_STATE_CHANGE
used for state change errors.
GST_CORE_ERROR_PAD
used for pad-related errors.
GST_CORE_ERROR_THREAD
used for thread-related errors.
GST_CORE_ERROR_NEGOTIATION
used for negotiation-related errors.
GST_CORE_ERROR_EVENT
used for event-related errors.
GST_CORE_ERROR_SEEK
used for seek-related errors.
GST_CORE_ERROR_CAPS
used for caps-related errors.
GST_CORE_ERROR_TAG
used for negotiation-related errors.
GST_CORE_ERROR_MISSING_PLUGIN
used if a plugin is missing.
GST_CORE_ERROR_CLOCK
used for clock related errors.
GST_CORE_ERROR_DISABLED
used if functionality has been disabled at compile time.
GST_CORE_ERROR_NUM_ERRORS
the number of core error types.
We will need to figure out a way to deal with errors. Possibly recover from the error, or going another way if error raised.
*) https://github.com/duzy/gst-switch/blob/switch/tools/gstworker.c#L337
static void
gst_worker_handle_error (GstWorker *worker, GError * error,
const char *debug)
{
https://github.com/duzy/gst-switch/blob/switch/tools/gstcomposite.c#L604
static void
gst_composite_error (GstComposite *composite)
{
/* 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
|| gst_message_get_structure (msg) == NULL)
return FALSE;return gst_structure_has_name (gst_message_get_structure (msg),
"missing-plugin");
}
Linking to this library
libgstpbutils is a general utility library for plugins and applications. It currently provides the following:
- human-readable description strings of codecs, elements, sources, decoders, encoders, or sinks from decoder/encoder caps, element names, or protocol names.
- support for applications to initiate installation of missing plugins (if this is supported by the distribution or operating system used)
- API for GStreamer elements to create missing-plugin messages in order to communicate to the application that a certain type of plugin is missing (decoder, encoder, URI protocol source, URI protocol sink, named element)
- API for applications to recognise and handle missing-plugin messages
You should obtain the required CFLAGS and LIBS using pkg-config on the gstreamer-plugins-base-0.10 module. You will then also need to add '-lgstpbutils-0.10' manually to your LIBS line.
Before using any of its functions, applications and plugins must call gst_pb_utils_init() to initialise the library.
It looks like the missing-plugin errors are only reported by gst_parse_launch instead of GST_MESSAGE_ERROR, I'm now trying to recognize the GST_CORE_ERROR_MISSING_PLUGIN from the GError it returned.