gst-indent run on core
[platform/upstream/gstreamer.git] / gst / gsterror.h
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 G_BEGIN_DECLS
24 /*
25  * we define FIXME error domains:
26  * GST_CORE_ERROR
27  * GST_LIBRARY_ERROR
28  * GST_RESOURCE_ERROR
29  * GST_STREAM_ERROR
30  *
31  * Check GError API docs for rationale for naming.
32  */
33 /* Core errors are anything that can go wrong in or using
34  * the core GStreamer library */
35 /* FIXME: should we divide in numerical blocks so we can easily add
36           for example PAD errors later ? */
37     typedef enum
38 {
39   GST_CORE_ERROR_FAILED = 1,
40   GST_CORE_ERROR_TOO_LAZY,
41   GST_CORE_ERROR_NOT_IMPLEMENTED,
42   GST_CORE_ERROR_STATE_CHANGE,
43   GST_CORE_ERROR_PAD,
44   GST_CORE_ERROR_THREAD,
45   GST_CORE_ERROR_SCHEDULER,
46   GST_CORE_ERROR_NEGOTIATION,
47   GST_CORE_ERROR_EVENT,
48   GST_CORE_ERROR_SEEK,
49   GST_CORE_ERROR_CAPS,
50   GST_CORE_ERROR_TAG,
51   GST_CORE_ERROR_NUM_ERRORS
52 }
53 GstCoreError;
54
55 /* Library errors are for errors from the library being used by elements
56    initializing, closing, ... */
57 typedef enum
58 {
59   GST_LIBRARY_ERROR_FAILED = 1,
60   GST_LIBRARY_ERROR_TOO_LAZY,
61   GST_LIBRARY_ERROR_INIT,
62   GST_LIBRARY_ERROR_SHUTDOWN,
63   GST_LIBRARY_ERROR_SETTINGS,
64   GST_LIBRARY_ERROR_ENCODE,
65   GST_LIBRARY_ERROR_NUM_ERRORS
66 }
67 GstLibraryError;
68
69 /* Resource errors are for anything external used by an element:
70    memory, files, network connections, process space, ...
71    They're typically used by source and sink elements */
72 typedef enum
73 {
74   GST_RESOURCE_ERROR_FAILED = 1,
75   GST_RESOURCE_ERROR_TOO_LAZY,
76   GST_RESOURCE_ERROR_NOT_FOUND,
77   GST_RESOURCE_ERROR_BUSY,
78   GST_RESOURCE_ERROR_OPEN_READ,
79   GST_RESOURCE_ERROR_OPEN_WRITE,
80   GST_RESOURCE_ERROR_OPEN_READ_WRITE,
81   GST_RESOURCE_ERROR_CLOSE,
82   GST_RESOURCE_ERROR_READ,
83   GST_RESOURCE_ERROR_WRITE,
84   GST_RESOURCE_ERROR_SEEK,
85   GST_RESOURCE_ERROR_SYNC,
86   GST_RESOURCE_ERROR_SETTINGS,
87   GST_RESOURCE_ERROR_NUM_ERRORS
88 }
89 GstResourceError;
90
91 /* Stream errors are for anything related to the stream being processed:
92    format errors, media type errors, ...
93    They're typically used by decoders, demuxers, converters, ... */
94 typedef enum
95 {
96   GST_STREAM_ERROR_FAILED = 1,
97   GST_STREAM_ERROR_TOO_LAZY,
98   GST_STREAM_ERROR_NOT_IMPLEMENTED,
99   GST_STREAM_ERROR_TYPE_NOT_FOUND,
100   GST_STREAM_ERROR_WRONG_TYPE,
101   GST_STREAM_ERROR_CODEC_NOT_FOUND,
102   GST_STREAM_ERROR_DECODE,
103   GST_STREAM_ERROR_ENCODE,
104   GST_STREAM_ERROR_DEMUX,
105   GST_STREAM_ERROR_MUX,
106   GST_STREAM_ERROR_FORMAT,
107   GST_STREAM_ERROR_NUM_ERRORS
108 }
109 GstStreamError;
110
111 /* This should go away once we convinced glib people to register GError */
112 #define GST_TYPE_G_ERROR    (gst_g_error_get_type ())
113
114 #define GST_LIBRARY_ERROR   gst_library_error_quark ()
115 #define GST_RESOURCE_ERROR  gst_resource_error_quark ()
116 #define GST_CORE_ERROR      gst_core_error_quark ()
117 #define GST_STREAM_ERROR    gst_stream_error_quark ()
118
119 #define GST_ERROR_SYSTEM    ("system error: %s", g_strerror (errno))
120
121 GType gst_g_error_get_type (void);
122 gchar *gst_error_get_message (GQuark domain, gint code);
123 GQuark gst_stream_error_quark (void);
124 GQuark gst_core_error_quark (void);
125 GQuark gst_resource_error_quark (void);
126 GQuark gst_library_error_quark (void);
127
128 G_END_DECLS
129 #endif /* __GST_ERROR_H__ */