Top |
enum | GstCoreError |
enum | GstLibraryError |
enum | GstResourceError |
enum | GstStreamError |
#define | GST_CORE_ERROR |
#define | GST_LIBRARY_ERROR |
#define | GST_RESOURCE_ERROR |
#define | GST_STREAM_ERROR |
#define | GST_ERROR_SYSTEM |
GStreamer elements can throw non-fatal warnings and fatal errors. Higher-level elements and applications can programmatically filter the ones they are interested in or can recover from, and have a default handler handle the rest of them.
The rest of this section will use the term “error” to mean both (non-fatal) warnings and (fatal) errors; they are treated similarly.
Errors from elements are the combination of a GError and a debug string. The GError contains:
a domain type: CORE, LIBRARY, RESOURCE or STREAM
a code: an enum value specific to the domain
a translated, human-readable message
a non-translated additional debug string, which also contains
file and line information
Elements do not have the context required to decide what to do with errors. As such, they should only inform about errors, and stop their processing. In short, an element doesn't know what it is being used for.
It is the application or compound element using the given element that
has more context about the use of the element. 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.
An application is expected to, by default, present the user with a dialog box (or an equivalent) showing the error message. The dialog should also allow a way to get at the additional debug information, so the user can provide bug reporting information.
A compound element is expected to forward errors by default higher up the hierarchy; this is done by default in the same way as for other types of GstMessage.
When applications or compound elements trigger errors that they can recover from, they can filter out these errors and take appropriate action. For example, an application that gets an error from xvimagesink that indicates all XVideo ports are taken, the application can attempt to use another sink instead.
Elements throw errors using the GST_ELEMENT_ERROR convenience macro:
Example 5. Throwing an error
1 2 |
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (_("No file name specified for reading.")), (NULL)); |
Things to keep in mind:
Don't go off inventing new error codes. The ones currently provided should be enough. If you find your type of error does not fit the current codes, you should use FAILED.
Don't provide a message if the default one suffices.
this keeps messages more uniform. Use (NULL
) - not forgetting the
parentheses.
If you do supply a custom message, it should be marked for translation. The message should start with a capital and end with a period. The message should describe the error in short, in a human-readable form, and without any complex technical terms. A user interface will present this message as the first thing a user sees. Details, technical info, ... should go in the debug string.
The debug string can be as you like. Again, use (NULL
)
if there's nothing to add - file and line number will still be
passed. GST_ERROR_SYSTEM can be used as a shortcut to give
debug information on a system call error.
Core errors are errors inside the core GStreamer library.
a general error which doesn't fit in any other category. Make sure you add a custom message to the error call. |
||
do not use this except as a placeholder for deciding where to go while developing code. |
||
use this when you do not want to implement this functionality yet. |
||
used for state change errors. |
||
used for pad-related errors. |
||
used for thread-related errors. |
||
used for negotiation-related errors. |
||
used for event-related errors. |
||
used for seek-related errors. |
||
used for caps-related errors. |
||
used for negotiation-related errors. |
||
used if a plugin is missing. |
||
used for clock related errors. |
||
used if functionality has been disabled at compile time. |
||
the number of core error types. |
Library errors are for errors from the library being used by elements (initializing, finalizing, settings, ...)
a general error which doesn't fit in any other category. Make sure you add a custom message to the error call. |
||
do not use this except as a placeholder for deciding where to go while developing code. |
||
used when the library could not be opened. |
||
used when the library could not be closed. |
||
used when the library doesn't accept settings. |
||
used when the library generated an encoding error. |
||
the number of library error types. |
Resource errors are for any resource used by an element: memory, files, network connections, process space, ... They're typically used by source and sink elements.
a general error which doesn't fit in any other category. Make sure you add a custom message to the error call. |
||
do not use this except as a placeholder for deciding where to go while developing code. |
||
used when the resource could not be found. |
||
used when resource is busy. |
||
used when resource fails to open for reading. |
||
used when resource fails to open for writing. |
||
used when resource cannot be opened for both reading and writing, or either (but unspecified which). |
||
used when the resource can't be closed. |
||
used when the resource can't be read from. |
||
used when the resource can't be written to. |
||
used when a seek on the resource fails. |
||
used when a synchronize on the resource fails. |
||
used when settings can't be manipulated on. |
||
used when the resource has no space left. |
||
used when the resource can't be opened due to missing authorization. (Since 1.2.4) |
||
the number of resource error types. |
Stream errors are for anything related to the stream being processed: format errors, media type errors, ... They're typically used by decoders, demuxers, converters, ...
a general error which doesn't fit in any other category. Make sure you add a custom message to the error call. |
||
do not use this except as a placeholder for deciding where to go while developing code. |
||
use this when you do not want to implement this functionality yet. |
||
used when the element doesn't know the stream's type. |
||
used when the element doesn't handle this type of stream. |
||
used when there's no codec to handle the stream's type. |
||
used when decoding fails. |
||
used when encoding fails. |
||
used when demuxing fails. |
||
used when muxing fails. |
||
used when the stream is of the wrong format (for example, wrong caps). |
||
used when the stream is encrypted and can't be decrypted because this is not supported by the element. |
||
used when the stream is encrypted and can't be decrypted because no suitable key is available. |
||
the number of stream error types. |
#define GST_CORE_ERROR gst_core_error_quark ()
Error domain for core system. Errors in this domain will be from the GstCoreError enumeration. See GError for information on error domains.
#define GST_LIBRARY_ERROR gst_library_error_quark ()
Error domain for library loading. Errors in this domain will be from the GstLibraryError enumeration. See GError for information on error domains.
#define GST_RESOURCE_ERROR gst_resource_error_quark ()
Error domain for resource handling. Errors in this domain will be from the GstResourceError enumeration. See GError for information on error domains.
#define GST_STREAM_ERROR gst_stream_error_quark ()
Error domain for media stream processing. Errors in this domain will be from the GstStreamError enumeration. See GError for information on error domains.
#define GST_ERROR_SYSTEM ("system error: %s", g_strerror (errno))
Builds a string using errno describing the previously failed system call. To be used as the debug argument in GST_ELEMENT_ERROR.