Blame gst/gsterror.h

Packit f546b1
/* GStreamer
Packit f546b1
 * Copyright (C) 2004 Thomas Vander Stichele <thomas at apestaart dot org>
Packit f546b1
 *
Packit f546b1
 * This library is free software; you can redistribute it and/or
Packit f546b1
 * modify it under the terms of the GNU Library General Public
Packit f546b1
 * License as published by the Free Software Foundation; either
Packit f546b1
 * version 2 of the License, or (at your option) any later version.
Packit f546b1
 *
Packit f546b1
 * This library is distributed in the hope that it will be useful,
Packit f546b1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit f546b1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit f546b1
 * Library General Public License for more details.
Packit f546b1
 *
Packit f546b1
 * You should have received a copy of the GNU Library General Public
Packit f546b1
 * License along with this library; if not, write to the
Packit f546b1
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit f546b1
 * Boston, MA 02110-1301, USA.
Packit f546b1
 */
Packit f546b1
Packit f546b1
#ifndef __GST_ERROR_H__
Packit f546b1
#define __GST_ERROR_H__
Packit f546b1
Packit f546b1
#include <glib.h>
Packit f546b1
#include <glib-object.h>
Packit f546b1
#include <errno.h>
Packit f546b1
Packit f546b1
G_BEGIN_DECLS
Packit f546b1
/*
Packit f546b1
 * we define FIXME error domains:
Packit f546b1
 * GST_CORE_ERROR
Packit f546b1
 * GST_LIBRARY_ERROR
Packit f546b1
 * GST_RESOURCE_ERROR
Packit f546b1
 * GST_STREAM_ERROR
Packit f546b1
 *
Packit f546b1
 * Check GError API docs for rationale for naming.
Packit f546b1
 */
Packit f546b1
/**
Packit f546b1
 * GstCoreError:
Packit f546b1
 * @GST_CORE_ERROR_FAILED: a general error which doesn't fit in any other
Packit f546b1
 * category.  Make sure you add a custom message to the error call.
Packit f546b1
 * @GST_CORE_ERROR_TOO_LAZY: do not use this except as a placeholder for
Packit f546b1
 * deciding where to go while developing code.
Packit f546b1
 * @GST_CORE_ERROR_NOT_IMPLEMENTED: use this when you do not want to implement
Packit f546b1
 * this functionality yet.
Packit f546b1
 * @GST_CORE_ERROR_STATE_CHANGE: used for state change errors.
Packit f546b1
 * @GST_CORE_ERROR_PAD: used for pad-related errors.
Packit f546b1
 * @GST_CORE_ERROR_THREAD: used for thread-related errors.
Packit f546b1
 * @GST_CORE_ERROR_NEGOTIATION: used for negotiation-related errors.
Packit f546b1
 * @GST_CORE_ERROR_EVENT: used for event-related errors.
Packit f546b1
 * @GST_CORE_ERROR_SEEK: used for seek-related errors.
Packit f546b1
 * @GST_CORE_ERROR_CAPS: used for caps-related errors.
Packit f546b1
 * @GST_CORE_ERROR_TAG: used for negotiation-related errors.
Packit f546b1
 * @GST_CORE_ERROR_MISSING_PLUGIN: used if a plugin is missing.
Packit f546b1
 * @GST_CORE_ERROR_CLOCK: used for clock related errors.
Packit f546b1
 * @GST_CORE_ERROR_DISABLED: used if functionality has been disabled at
Packit f546b1
 *                           compile time.
Packit f546b1
 * @GST_CORE_ERROR_NUM_ERRORS: the number of core error types.
Packit f546b1
 *
Packit f546b1
 * Core errors are errors inside the core GStreamer library.
Packit f546b1
 */
Packit f546b1
/* FIXME: should we divide in numerical blocks so we can easily add
Packit f546b1
          for example PAD errors later ? */
Packit f546b1
typedef enum
Packit f546b1
{
Packit f546b1
  GST_CORE_ERROR_FAILED = 1,
Packit f546b1
  GST_CORE_ERROR_TOO_LAZY,
Packit f546b1
  GST_CORE_ERROR_NOT_IMPLEMENTED,
Packit f546b1
  GST_CORE_ERROR_STATE_CHANGE,
Packit f546b1
  GST_CORE_ERROR_PAD,
Packit f546b1
  GST_CORE_ERROR_THREAD,
Packit f546b1
  GST_CORE_ERROR_NEGOTIATION,
Packit f546b1
  GST_CORE_ERROR_EVENT,
Packit f546b1
  GST_CORE_ERROR_SEEK,
Packit f546b1
  GST_CORE_ERROR_CAPS,
Packit f546b1
  GST_CORE_ERROR_TAG,
Packit f546b1
  GST_CORE_ERROR_MISSING_PLUGIN,
Packit f546b1
  GST_CORE_ERROR_CLOCK,
Packit f546b1
  GST_CORE_ERROR_DISABLED,
Packit f546b1
  GST_CORE_ERROR_NUM_ERRORS
Packit f546b1
} GstCoreError;
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstLibraryError:
Packit f546b1
 * @GST_LIBRARY_ERROR_FAILED: a general error which doesn't fit in any other
Packit f546b1
 * category.  Make sure you add a custom message to the error call.
Packit f546b1
 * @GST_LIBRARY_ERROR_TOO_LAZY: do not use this except as a placeholder for
Packit f546b1
 * deciding where to go while developing code.
Packit f546b1
 * @GST_LIBRARY_ERROR_INIT: used when the library could not be opened.
Packit f546b1
 * @GST_LIBRARY_ERROR_SHUTDOWN: used when the library could not be closed.
Packit f546b1
 * @GST_LIBRARY_ERROR_SETTINGS: used when the library doesn't accept settings.
Packit f546b1
 * @GST_LIBRARY_ERROR_ENCODE: used when the library generated an encoding error.
Packit f546b1
 * @GST_LIBRARY_ERROR_NUM_ERRORS: the number of library error types.
Packit f546b1
 *
Packit f546b1
 * Library errors are for errors from the library being used by elements
Packit f546b1
 * (initializing, finalizing, settings, ...)
Packit f546b1
 */
Packit f546b1
typedef enum
Packit f546b1
{
Packit f546b1
  GST_LIBRARY_ERROR_FAILED = 1,
Packit f546b1
  GST_LIBRARY_ERROR_TOO_LAZY,
Packit f546b1
  GST_LIBRARY_ERROR_INIT,
Packit f546b1
  GST_LIBRARY_ERROR_SHUTDOWN,
Packit f546b1
  GST_LIBRARY_ERROR_SETTINGS,
Packit f546b1
  GST_LIBRARY_ERROR_ENCODE,
Packit f546b1
  GST_LIBRARY_ERROR_NUM_ERRORS
Packit f546b1
} GstLibraryError;
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstResourceError:
Packit f546b1
 * @GST_RESOURCE_ERROR_FAILED: a general error which doesn't fit in any other
Packit f546b1
 * category.  Make sure you add a custom message to the error call.
Packit f546b1
 * @GST_RESOURCE_ERROR_TOO_LAZY: do not use this except as a placeholder for
Packit f546b1
 * deciding where to go while developing code.
Packit f546b1
 * @GST_RESOURCE_ERROR_NOT_FOUND: used when the resource could not be found.
Packit f546b1
 * @GST_RESOURCE_ERROR_BUSY: used when resource is busy.
Packit f546b1
 * @GST_RESOURCE_ERROR_OPEN_READ: used when resource fails to open for reading.
Packit f546b1
 * @GST_RESOURCE_ERROR_OPEN_WRITE: used when resource fails to open for writing.
Packit f546b1
 * @GST_RESOURCE_ERROR_OPEN_READ_WRITE: used when resource cannot be opened for
Packit f546b1
 * both reading and writing, or either (but unspecified which).
Packit f546b1
 * @GST_RESOURCE_ERROR_CLOSE: used when the resource can't be closed.
Packit f546b1
 * @GST_RESOURCE_ERROR_READ: used when the resource can't be read from.
Packit f546b1
 * @GST_RESOURCE_ERROR_WRITE: used when the resource can't be written to.
Packit f546b1
 * @GST_RESOURCE_ERROR_SEEK: used when a seek on the resource fails.
Packit f546b1
 * @GST_RESOURCE_ERROR_SYNC: used when a synchronize on the resource fails.
Packit f546b1
 * @GST_RESOURCE_ERROR_SETTINGS: used when settings can't be manipulated on.
Packit f546b1
 * @GST_RESOURCE_ERROR_NO_SPACE_LEFT: used when the resource has no space left.
Packit f546b1
 * @GST_RESOURCE_ERROR_NOT_AUTHORIZED: used when the resource can't be opened
Packit f546b1
 *                                     due to missing authorization.
Packit f546b1
 *                                     (Since 1.2.4)
Packit f546b1
 * @GST_RESOURCE_ERROR_NUM_ERRORS: the number of resource error types.
Packit f546b1
 *
Packit f546b1
 * Resource errors are for any resource used by an element:
Packit f546b1
 * memory, files, network connections, process space, ...
Packit f546b1
 * They're typically used by source and sink elements.
Packit f546b1
 */
Packit f546b1
typedef enum
Packit f546b1
{
Packit f546b1
  GST_RESOURCE_ERROR_FAILED = 1,
Packit f546b1
  GST_RESOURCE_ERROR_TOO_LAZY,
Packit f546b1
  GST_RESOURCE_ERROR_NOT_FOUND,
Packit f546b1
  GST_RESOURCE_ERROR_BUSY,
Packit f546b1
  GST_RESOURCE_ERROR_OPEN_READ,
Packit f546b1
  GST_RESOURCE_ERROR_OPEN_WRITE,
Packit f546b1
  GST_RESOURCE_ERROR_OPEN_READ_WRITE,
Packit f546b1
  GST_RESOURCE_ERROR_CLOSE,
Packit f546b1
  GST_RESOURCE_ERROR_READ,
Packit f546b1
  GST_RESOURCE_ERROR_WRITE,
Packit f546b1
  GST_RESOURCE_ERROR_SEEK,
Packit f546b1
  GST_RESOURCE_ERROR_SYNC,
Packit f546b1
  GST_RESOURCE_ERROR_SETTINGS,
Packit f546b1
  GST_RESOURCE_ERROR_NO_SPACE_LEFT,
Packit f546b1
  GST_RESOURCE_ERROR_NOT_AUTHORIZED,
Packit f546b1
  GST_RESOURCE_ERROR_NUM_ERRORS
Packit f546b1
} GstResourceError;
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstStreamError:
Packit f546b1
 * @GST_STREAM_ERROR_FAILED: a general error which doesn't fit in any other
Packit f546b1
 * category.  Make sure you add a custom message to the error call.
Packit f546b1
 * @GST_STREAM_ERROR_TOO_LAZY: do not use this except as a placeholder for
Packit f546b1
 * deciding where to go while developing code.
Packit f546b1
 * @GST_STREAM_ERROR_NOT_IMPLEMENTED: use this when you do not want to implement
Packit f546b1
 * this functionality yet.
Packit f546b1
 * @GST_STREAM_ERROR_TYPE_NOT_FOUND: used when the element doesn't know the
Packit f546b1
 * stream's type.
Packit f546b1
 * @GST_STREAM_ERROR_WRONG_TYPE: used when the element doesn't handle this type
Packit f546b1
 * of stream.
Packit f546b1
 * @GST_STREAM_ERROR_CODEC_NOT_FOUND: used when there's no codec to handle the
Packit f546b1
 * stream's type.
Packit f546b1
 * @GST_STREAM_ERROR_DECODE: used when decoding fails.
Packit f546b1
 * @GST_STREAM_ERROR_ENCODE: used when encoding fails.
Packit f546b1
 * @GST_STREAM_ERROR_DEMUX: used when demuxing fails.
Packit f546b1
 * @GST_STREAM_ERROR_MUX: used when muxing fails.
Packit f546b1
 * @GST_STREAM_ERROR_FORMAT: used when the stream is of the wrong format
Packit f546b1
 * (for example, wrong caps).
Packit f546b1
 * @GST_STREAM_ERROR_DECRYPT: used when the stream is encrypted and can't be
Packit f546b1
 * decrypted because this is not supported by the element.
Packit f546b1
 * @GST_STREAM_ERROR_DECRYPT_NOKEY: used when the stream is encrypted and
Packit f546b1
 * can't be decrypted because no suitable key is available.
Packit f546b1
 * @GST_STREAM_ERROR_NUM_ERRORS: the number of stream error types.
Packit f546b1
 *
Packit f546b1
 * Stream errors are for anything related to the stream being processed:
Packit f546b1
 * format errors, media type errors, ...
Packit f546b1
 * They're typically used by decoders, demuxers, converters, ...
Packit f546b1
 */
Packit f546b1
typedef enum
Packit f546b1
{
Packit f546b1
  GST_STREAM_ERROR_FAILED = 1,
Packit f546b1
  GST_STREAM_ERROR_TOO_LAZY,
Packit f546b1
  GST_STREAM_ERROR_NOT_IMPLEMENTED,
Packit f546b1
  GST_STREAM_ERROR_TYPE_NOT_FOUND,
Packit f546b1
  GST_STREAM_ERROR_WRONG_TYPE,
Packit f546b1
  GST_STREAM_ERROR_CODEC_NOT_FOUND,
Packit f546b1
  GST_STREAM_ERROR_DECODE,
Packit f546b1
  GST_STREAM_ERROR_ENCODE,
Packit f546b1
  GST_STREAM_ERROR_DEMUX,
Packit f546b1
  GST_STREAM_ERROR_MUX,
Packit f546b1
  GST_STREAM_ERROR_FORMAT,
Packit f546b1
  GST_STREAM_ERROR_DECRYPT,
Packit f546b1
  GST_STREAM_ERROR_DECRYPT_NOKEY,
Packit f546b1
  GST_STREAM_ERROR_NUM_ERRORS
Packit f546b1
} GstStreamError;
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GST_LIBRARY_ERROR:
Packit f546b1
 *
Packit f546b1
 * Error domain for library loading. Errors in this domain will
Packit f546b1
 * be from the #GstLibraryError enumeration.
Packit f546b1
 * See #GError for information on error domains.
Packit f546b1
 */
Packit f546b1
#define GST_LIBRARY_ERROR   gst_library_error_quark ()
Packit f546b1
/**
Packit f546b1
 * GST_RESOURCE_ERROR:
Packit f546b1
 *
Packit f546b1
 * Error domain for resource handling. Errors in this domain will
Packit f546b1
 * be from the #GstResourceError enumeration.
Packit f546b1
 * See #GError for information on error domains.
Packit f546b1
 */
Packit f546b1
#define GST_RESOURCE_ERROR  gst_resource_error_quark ()
Packit f546b1
/**
Packit f546b1
 * GST_CORE_ERROR:
Packit f546b1
 *
Packit f546b1
 * Error domain for core system. Errors in this domain will
Packit f546b1
 * be from the #GstCoreError enumeration.
Packit f546b1
 * See #GError for information on error domains.
Packit f546b1
 */
Packit f546b1
#define GST_CORE_ERROR      gst_core_error_quark ()
Packit f546b1
/**
Packit f546b1
 * GST_STREAM_ERROR:
Packit f546b1
 *
Packit f546b1
 * Error domain for media stream processing. Errors in this domain will
Packit f546b1
 * be from the #GstStreamError enumeration.
Packit f546b1
 * See #GError for information on error domains.
Packit f546b1
 */
Packit f546b1
#define GST_STREAM_ERROR    gst_stream_error_quark ()
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GST_ERROR_SYSTEM:
Packit f546b1
 *
Packit f546b1
 * Builds a string using errno describing the previously failed system
Packit f546b1
 * call.  To be used as the debug argument in #GST_ELEMENT_ERROR.
Packit f546b1
 */
Packit f546b1
#define GST_ERROR_SYSTEM    ("system error: %s", g_strerror (errno))
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
gchar *gst_error_get_message (GQuark domain, gint code);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GQuark gst_stream_error_quark (void);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GQuark gst_core_error_quark (void);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GQuark gst_resource_error_quark (void);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GQuark gst_library_error_quark (void);
Packit f546b1
Packit f546b1
G_END_DECLS
Packit f546b1
#endif /* __GST_ERROR_H__ */