duzy / gst-switch

A DVswitch replacement basing on GStreamer -- record video from multiple sources in the network, and switch for showing in PiP mode
Other
11 stars 19 forks source link

No error checking on the gst-pipeline construction #4

Closed mithro closed 11 years ago

mithro commented 11 years ago

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.

mithro commented 11 years ago

Take a look at

static GString *
gst_audio_visual_get_pipeline_string (GstAudioVisual *visual)
{
duzy commented 11 years ago

I think some api like gst_element_factory_make could be used to check if monoscope exists or not.

mithro commented 11 years ago

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.

duzy commented 11 years ago

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) {

duzy commented 11 years ago

https://github.com/duzy/gst-switch/blob/switch/tools/gstcomposite.c#L604

static void gst_composite_error (GstComposite *composite) {

mithro commented 11 years ago

/* Kids, use the functions from libgstpbutils in gst-plugins-base in your

mithro commented 11 years ago

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstpbutils.html

Linking to this library

libgstpbutils is a general utility library for plugins and applications. It currently provides the following:

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.

duzy commented 11 years ago

It looks like the missing-plugin errors are only reported by _gst_parselaunch instead of GST_MESSAGE_ERROR, I'm now trying to recognize the GST_CORE_ERROR_MISSING_PLUGIN from the GError it returned.