gstreamer_core/gst/gsterror.h
changeset 0 0e761a78d257
child 7 567bb019e3e3
equal deleted inserted replaced
-1:000000000000 0:0e761a78d257
       
     1 /* GStreamer
       
     2  * Copyright (C) 2004 Thomas Vander Stichele <thomas at apestaart dot org>
       
     3  *
       
     4  * This library is free software; you can redistribute it and/or
       
     5  * modify it under the terms of the GNU Library General Public
       
     6  * License as published by the Free Software Foundation; either
       
     7  * version 2 of the License, or (at your option) any later version.
       
     8  *
       
     9  * This library is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    12  * Library General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU Library General Public
       
    15  * License along with this library; if not, write to the
       
    16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    17  * Boston, MA 02111-1307, USA.
       
    18  */
       
    19 
       
    20 #ifndef __GST_ERROR_H__
       
    21 #define __GST_ERROR_H__
       
    22 
       
    23 #include <glib.h>
       
    24 #include <glib-object.h>
       
    25 #include <errno.h>
       
    26 
       
    27 G_BEGIN_DECLS
       
    28 /*
       
    29  * we define FIXME error domains:
       
    30  * GST_CORE_ERROR
       
    31  * GST_LIBRARY_ERROR
       
    32  * GST_RESOURCE_ERROR
       
    33  * GST_STREAM_ERROR
       
    34  *
       
    35  * Check GError API docs for rationale for naming.
       
    36  */
       
    37 /**
       
    38  * GstCoreError:
       
    39  * @GST_CORE_ERROR_FAILED: a general error which doesn't fit in any other
       
    40  * category.  Make sure you add a custom message to the error call.
       
    41  * @GST_CORE_ERROR_TOO_LAZY: do not use this except as a placeholder for
       
    42  * deciding where to go while developing code.
       
    43  * @GST_CORE_ERROR_NOT_IMPLEMENTED: use this when you do not want to implement
       
    44  * this functionality yet.
       
    45  * @GST_CORE_ERROR_STATE_CHANGE: used for state change errors.
       
    46  * @GST_CORE_ERROR_PAD: used for pad-related errors.
       
    47  * @GST_CORE_ERROR_THREAD: used for thread-related errors.
       
    48  * @GST_CORE_ERROR_NEGOTIATION: used for negotiation-related errors.
       
    49  * @GST_CORE_ERROR_EVENT: used for event-related errors.
       
    50  * @GST_CORE_ERROR_SEEK: used for seek-related errors.
       
    51  * @GST_CORE_ERROR_CAPS: used for caps-related errors.
       
    52  * @GST_CORE_ERROR_TAG: used for negotiation-related errors.
       
    53  * @GST_CORE_ERROR_MISSING_PLUGIN: used if a plugin is missing.
       
    54  * @GST_CORE_ERROR_CLOCK: used for clock related errors.
       
    55  * @GST_CORE_ERROR_DISABLED: used if functionality has been disabled at
       
    56  *                           compile time (Since: 0.10.13).
       
    57  * @GST_CORE_ERROR_NUM_ERRORS: the number of core error types.
       
    58  *
       
    59  * Core errors are errors inside the core GStreamer library.
       
    60  */
       
    61 /* FIXME: should we divide in numerical blocks so we can easily add
       
    62           for example PAD errors later ? */
       
    63 typedef enum
       
    64 {
       
    65   GST_CORE_ERROR_FAILED = 1,
       
    66   GST_CORE_ERROR_TOO_LAZY,
       
    67   GST_CORE_ERROR_NOT_IMPLEMENTED,
       
    68   GST_CORE_ERROR_STATE_CHANGE,
       
    69   GST_CORE_ERROR_PAD,
       
    70   GST_CORE_ERROR_THREAD,
       
    71   GST_CORE_ERROR_NEGOTIATION,
       
    72   GST_CORE_ERROR_EVENT,
       
    73   GST_CORE_ERROR_SEEK,
       
    74   GST_CORE_ERROR_CAPS,
       
    75   GST_CORE_ERROR_TAG,
       
    76   GST_CORE_ERROR_MISSING_PLUGIN,
       
    77   GST_CORE_ERROR_CLOCK,
       
    78   GST_CORE_ERROR_DISABLED,
       
    79   GST_CORE_ERROR_NUM_ERRORS
       
    80 } GstCoreError;
       
    81 
       
    82 /**
       
    83  * GstLibraryError:
       
    84  * @GST_LIBRARY_ERROR_FAILED: a general error which doesn't fit in any other
       
    85  * category.  Make sure you add a custom message to the error call.
       
    86  * @GST_LIBRARY_ERROR_TOO_LAZY: do not use this except as a placeholder for
       
    87  * deciding where to go while developing code.
       
    88  * @GST_LIBRARY_ERROR_INIT: used when the library could not be opened.
       
    89  * @GST_LIBRARY_ERROR_SHUTDOWN: used when the library could not be closed.
       
    90  * @GST_LIBRARY_ERROR_SETTINGS: used when the library doesn't accept settings.
       
    91  * @GST_LIBRARY_ERROR_ENCODE: used when the library generated an encoding error.
       
    92  * @GST_LIBRARY_ERROR_NUM_ERRORS: the number of library error types.
       
    93  *
       
    94  * Library errors are for errors from the library being used by elements
       
    95  * (initializing, finalizing, settings, ...)
       
    96  */
       
    97 typedef enum
       
    98 {
       
    99   GST_LIBRARY_ERROR_FAILED = 1,
       
   100   GST_LIBRARY_ERROR_TOO_LAZY,
       
   101   GST_LIBRARY_ERROR_INIT,
       
   102   GST_LIBRARY_ERROR_SHUTDOWN,
       
   103   GST_LIBRARY_ERROR_SETTINGS,
       
   104   GST_LIBRARY_ERROR_ENCODE,
       
   105   GST_LIBRARY_ERROR_NUM_ERRORS
       
   106 } GstLibraryError;
       
   107 
       
   108 /**
       
   109  * GstResourceError:
       
   110  * @GST_RESOURCE_ERROR_FAILED: a general error which doesn't fit in any other
       
   111  * category.  Make sure you add a custom message to the error call.
       
   112  * @GST_RESOURCE_ERROR_TOO_LAZY: do not use this except as a placeholder for
       
   113  * deciding where to go while developing code.
       
   114  * @GST_RESOURCE_ERROR_NOT_FOUND: used when the resource could not be found.
       
   115  * @GST_RESOURCE_ERROR_BUSY: used when resource is busy.
       
   116  * @GST_RESOURCE_ERROR_OPEN_READ: used when resource fails to open for reading.
       
   117  * @GST_RESOURCE_ERROR_OPEN_WRITE: used when resource fails to open for writing.
       
   118  * @GST_RESOURCE_ERROR_OPEN_READ_WRITE: used when resource cannot be opened for
       
   119  * both reading and writing, or either (but unspecified which).
       
   120  * @GST_RESOURCE_ERROR_CLOSE: used when the resource can't be closed.
       
   121  * @GST_RESOURCE_ERROR_READ: used when the resource can't be read from.
       
   122  * @GST_RESOURCE_ERROR_WRITE: used when the resource can't be written to.
       
   123  * @GST_RESOURCE_ERROR_SEEK: used when a seek on the resource fails.
       
   124  * @GST_RESOURCE_ERROR_SYNC: used when a synchronize on the resource fails.
       
   125  * @GST_RESOURCE_ERROR_SETTINGS: used when settings can't be manipulated on.
       
   126  * @GST_RESOURCE_ERROR_NO_SPACE_LEFT: used when the resource has no space left.
       
   127  * @GST_RESOURCE_ERROR_NUM_ERRORS: the number of resource error types.
       
   128  *
       
   129  * Resource errors are for any resource used by an element:
       
   130  * memory, files, network connections, process space, ...
       
   131  * They're typically used by source and sink elements.
       
   132  */
       
   133 typedef enum
       
   134 {
       
   135   GST_RESOURCE_ERROR_FAILED = 1,
       
   136   GST_RESOURCE_ERROR_TOO_LAZY,
       
   137   GST_RESOURCE_ERROR_NOT_FOUND,
       
   138   GST_RESOURCE_ERROR_BUSY,
       
   139   GST_RESOURCE_ERROR_OPEN_READ,
       
   140   GST_RESOURCE_ERROR_OPEN_WRITE,
       
   141   GST_RESOURCE_ERROR_OPEN_READ_WRITE,
       
   142   GST_RESOURCE_ERROR_CLOSE,
       
   143   GST_RESOURCE_ERROR_READ,
       
   144   GST_RESOURCE_ERROR_WRITE,
       
   145   GST_RESOURCE_ERROR_SEEK,
       
   146   GST_RESOURCE_ERROR_SYNC,
       
   147   GST_RESOURCE_ERROR_SETTINGS,
       
   148   GST_RESOURCE_ERROR_NO_SPACE_LEFT,
       
   149   GST_RESOURCE_ERROR_NUM_ERRORS
       
   150 } GstResourceError;
       
   151 
       
   152 /**
       
   153  * GstStreamError:
       
   154  * @GST_STREAM_ERROR_FAILED: a general error which doesn't fit in any other
       
   155  * category.  Make sure you add a custom message to the error call.
       
   156  * @GST_STREAM_ERROR_TOO_LAZY: do not use this except as a placeholder for
       
   157  * deciding where to go while developing code.
       
   158  * @GST_STREAM_ERROR_NOT_IMPLEMENTED: use this when you do not want to implement
       
   159  * this functionality yet.
       
   160  * @GST_STREAM_ERROR_TYPE_NOT_FOUND: used when the element doesn't know the
       
   161  * stream's type.
       
   162  * @GST_STREAM_ERROR_WRONG_TYPE: used when the element doesn't handle this type
       
   163  * of stream.
       
   164  * @GST_STREAM_ERROR_CODEC_NOT_FOUND: used when there's no codec to handle the
       
   165  * stream's type.
       
   166  * @GST_STREAM_ERROR_DECODE: used when decoding fails.
       
   167  * @GST_STREAM_ERROR_ENCODE: used when encoding fails.
       
   168  * @GST_STREAM_ERROR_DEMUX: used when demuxing fails.
       
   169  * @GST_STREAM_ERROR_MUX: used when muxing fails.
       
   170  * @GST_STREAM_ERROR_FORMAT: used when the stream is of the wrong format
       
   171  * (for example, wrong caps).
       
   172  * @GST_STREAM_ERROR_NUM_ERRORS: the number of stream error types.
       
   173  *
       
   174  * Stream errors are for anything related to the stream being processed:
       
   175  * format errors, media type errors, ...
       
   176  * They're typically used by decoders, demuxers, converters, ...
       
   177  */
       
   178 typedef enum
       
   179 {
       
   180   GST_STREAM_ERROR_FAILED = 1,
       
   181   GST_STREAM_ERROR_TOO_LAZY,
       
   182   GST_STREAM_ERROR_NOT_IMPLEMENTED,
       
   183   GST_STREAM_ERROR_TYPE_NOT_FOUND,
       
   184   GST_STREAM_ERROR_WRONG_TYPE,
       
   185   GST_STREAM_ERROR_CODEC_NOT_FOUND,
       
   186   GST_STREAM_ERROR_DECODE,
       
   187   GST_STREAM_ERROR_ENCODE,
       
   188   GST_STREAM_ERROR_DEMUX,
       
   189   GST_STREAM_ERROR_MUX,
       
   190   GST_STREAM_ERROR_FORMAT,
       
   191   GST_STREAM_ERROR_NUM_ERRORS
       
   192 } GstStreamError;
       
   193 
       
   194 #define GST_TYPE_G_ERROR    (gst_g_error_get_type ())
       
   195 
       
   196 /**
       
   197  * GST_LIBRARY_ERROR:
       
   198  *
       
   199  * Error domain for library loading. Errors in this domain will
       
   200  * be from the #GstLibraryError enumeration.
       
   201  * See #GError for information on error domains.
       
   202  */
       
   203 #define GST_LIBRARY_ERROR   gst_library_error_quark ()
       
   204 /**
       
   205  * GST_RESOURCE_ERROR:
       
   206  *
       
   207  * Error domain for resource handling. Errors in this domain will
       
   208  * be from the #GstResourceError enumeration.
       
   209  * See #GError for information on error domains.
       
   210  */
       
   211 #define GST_RESOURCE_ERROR  gst_resource_error_quark ()
       
   212 /**
       
   213  * GST_CORE_ERROR:
       
   214  *
       
   215  * Error domain for core system. Errors in this domain will
       
   216  * be from the #GstCoreError enumeration.
       
   217  * See #GError for information on error domains.
       
   218  */
       
   219 #define GST_CORE_ERROR      gst_core_error_quark ()
       
   220 /**
       
   221  * GST_STREAM_ERROR:
       
   222  *
       
   223  * Error domain for media stream processing. Errors in this domain will
       
   224  * be from the #GstStreamError enumeration.
       
   225  * See #GError for information on error domains.
       
   226  */
       
   227 #define GST_STREAM_ERROR    gst_stream_error_quark ()
       
   228 
       
   229 /**
       
   230  * GST_ERROR_SYSTEM:
       
   231  *
       
   232  * Builds a string using errno describing the previously failed system
       
   233  * call.  To be used as the debug argument in #GST_ELEMENT_ERROR.
       
   234  */
       
   235 #define GST_ERROR_SYSTEM    ("system error: %s", g_strerror (errno))
       
   236 
       
   237 GType gst_g_error_get_type (void);
       
   238 #ifdef __SYMBIAN32__
       
   239 IMPORT_C
       
   240 #endif
       
   241 
       
   242 gchar *gst_error_get_message (GQuark domain, gint code);
       
   243 #ifdef __SYMBIAN32__
       
   244 IMPORT_C
       
   245 #endif
       
   246 
       
   247 GQuark gst_stream_error_quark (void);
       
   248 #ifdef __SYMBIAN32__
       
   249 IMPORT_C
       
   250 #endif
       
   251 
       
   252 GQuark gst_core_error_quark (void);
       
   253 #ifdef __SYMBIAN32__
       
   254 IMPORT_C
       
   255 #endif
       
   256 
       
   257 GQuark gst_resource_error_quark (void);
       
   258 #ifdef __SYMBIAN32__
       
   259 IMPORT_C
       
   260 #endif
       
   261 
       
   262 GQuark gst_library_error_quark (void);
       
   263 
       
   264 G_END_DECLS
       
   265 #endif /* __GST_ERROR_H__ */