gst/gsterror.h: Remove comment. GST_TYPE_G_ERROR is here to stay,
[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 #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_NUM_ERRORS: the number of core error types.
54  *
55  * Core errors are errors inside the core GStreamer library.
56  * the core GStreamer library
57  */
58 /* FIXME: should we divide in numerical blocks so we can easily add
59           for example PAD errors later ? */
60 typedef enum
61 {
62   GST_CORE_ERROR_FAILED = 1,
63   GST_CORE_ERROR_TOO_LAZY,
64   GST_CORE_ERROR_NOT_IMPLEMENTED,
65   GST_CORE_ERROR_STATE_CHANGE,
66   GST_CORE_ERROR_PAD,
67   GST_CORE_ERROR_THREAD,
68   GST_CORE_ERROR_NEGOTIATION,
69   GST_CORE_ERROR_EVENT,
70   GST_CORE_ERROR_SEEK,
71   GST_CORE_ERROR_CAPS,
72   GST_CORE_ERROR_TAG,
73   GST_CORE_ERROR_NUM_ERRORS
74 } GstCoreError;
75
76 /**
77  * GstLibraryError:
78  * @GST_LIBRARY_ERROR_FAILED: a general error which doesn't fit in any other
79  * category.  Make sure you add a custom message to the error call.
80  * @GST_LIBRARY_ERROR_TOO_LAZY: do not use this except as a placeholder for
81  * deciding where to go while developing code.
82  * @GST_LIBRARY_ERROR_INIT: used when the library could not be opened.
83  * @GST_LIBRARY_ERROR_SHUTDOWN: used when the library could not be closed.
84  * @GST_LIBRARY_ERROR_SETTINGS: used when the library doesn't accept settings.
85  * @GST_LIBRARY_ERROR_ENCODE: used when the library generated an encoding error.
86  * @GST_LIBRARY_ERROR_NUM_ERRORS: the number of library error types.
87  *
88  * Library errors are for errors from the library being used by elements
89  * (initializing, finalizing, settings, ...)
90  */
91 typedef enum
92 {
93   GST_LIBRARY_ERROR_FAILED = 1,
94   GST_LIBRARY_ERROR_TOO_LAZY,
95   GST_LIBRARY_ERROR_INIT,
96   GST_LIBRARY_ERROR_SHUTDOWN,
97   GST_LIBRARY_ERROR_SETTINGS,
98   GST_LIBRARY_ERROR_ENCODE,
99   GST_LIBRARY_ERROR_NUM_ERRORS
100 } GstLibraryError;
101
102 /**
103  * GstResourceError:
104  * @GST_RESOURCE_ERROR_FAILED: a general error which doesn't fit in any other
105  * category.  Make sure you add a custom message to the error call.
106  * @GST_RESOURCE_ERROR_TOO_LAZY: do not use this except as a placeholder for
107  * deciding where to go while developing code.
108  * @GST_RESOURCE_ERROR_NOT_FOUND: used when the resource could not be found.
109  * @GST_RESOURCE_ERROR_BUSY: used when resource is busy.
110  * @GST_RESOURCE_ERROR_OPEN_READ: used when resource fails to open for reading.
111  * @GST_RESOURCE_ERROR_OPEN_WRITE: used when resource fails to open for writing.
112  * @GST_RESOURCE_ERROR_OPEN_READ_WRITE: used when resource cannot be opened for
113  * both reading and writing, or either (but unspecified which).
114  * @GST_RESOURCE_ERROR_CLOSE: used when the resource can't be closed.
115  * @GST_RESOURCE_ERROR_READ: used when the resource can't be read from.
116  * @GST_RESOURCE_ERROR_WRITE: used when the resource can't be written to.
117  * @GST_RESOURCE_ERROR_SEEK: used when a seek on the resource fails.
118  * @GST_RESOURCE_ERROR_SYNC: used when a synchronize on the resource fails.
119  * @GST_RESOURCE_ERROR_SETTINGS: used when settings can't be manipulated on
120  * @GST_RESOURCE_ERROR_NUM_ERRORS: the number of library error types.
121  *
122  * Resource errors are for any resource used by an element:
123  * memory, files, network connections, process space, ...
124  * They're typically used by source and sink elements.
125  */
126 typedef enum
127 {
128   GST_RESOURCE_ERROR_FAILED = 1,
129   GST_RESOURCE_ERROR_TOO_LAZY,
130   GST_RESOURCE_ERROR_NOT_FOUND,
131   GST_RESOURCE_ERROR_BUSY,
132   GST_RESOURCE_ERROR_OPEN_READ,
133   GST_RESOURCE_ERROR_OPEN_WRITE,
134   GST_RESOURCE_ERROR_OPEN_READ_WRITE,
135   GST_RESOURCE_ERROR_CLOSE,
136   GST_RESOURCE_ERROR_READ,
137   GST_RESOURCE_ERROR_WRITE,
138   GST_RESOURCE_ERROR_SEEK,
139   GST_RESOURCE_ERROR_SYNC,
140   GST_RESOURCE_ERROR_SETTINGS,
141   GST_RESOURCE_ERROR_NUM_ERRORS
142 } GstResourceError;
143
144 /**
145  * GstStreamError:
146  * @GST_STREAM_ERROR_FAILED: a general error which doesn't fit in any other
147  * category.  Make sure you add a custom message to the error call.
148  * @GST_STREAM_ERROR_TOO_LAZY: do not use this except as a placeholder for
149  * deciding where to go while developing code.
150  * @GST_STREAM_ERROR_NOT_IMPLEMENTED: use this when you do not want to implement
151  * this functionality yet.
152  * @GST_STREAM_ERROR_TYPE_NOT_FOUND: used when the element doesn't know the
153  * stream's type.
154  * @GST_STREAM_ERROR_WRONG_TYPE: used when the element doesn't handle this type
155  * of stream.
156  * @GST_STREAM_ERROR_CODEC_NOT_FOUND: used when there's no codec to handle the
157  * stream's type.
158  * @GST_STREAM_ERROR_DECODE: used when decoding fails.
159  * @GST_STREAM_ERROR_ENCODE: used when encoding fails.
160  * @GST_STREAM_ERROR_DEMUX: used when demuxing fails.
161  * @GST_STREAM_ERROR_MUX: used when muxing fails.
162  * @GST_STREAM_ERROR_FORMAT: used when the stream is of the wrong format
163  * (for example, wrong caps).
164  * @GST_STREAM_ERROR_STOPPED: Streaming stopped.
165  * @GST_STREAM_ERROR_NUM_ERRORS: the number of library error types.
166  *
167  * Stream errors are for anything related to the stream being processed:
168  * format errors, media type errors, ...
169  * They're typically used by decoders, demuxers, converters, ...
170  */
171 typedef enum
172 {
173   GST_STREAM_ERROR_FAILED = 1,
174   GST_STREAM_ERROR_TOO_LAZY,
175   GST_STREAM_ERROR_NOT_IMPLEMENTED,
176   GST_STREAM_ERROR_TYPE_NOT_FOUND,
177   GST_STREAM_ERROR_WRONG_TYPE,
178   GST_STREAM_ERROR_CODEC_NOT_FOUND,
179   GST_STREAM_ERROR_DECODE,
180   GST_STREAM_ERROR_ENCODE,
181   GST_STREAM_ERROR_DEMUX,
182   GST_STREAM_ERROR_MUX,
183   GST_STREAM_ERROR_FORMAT,
184   GST_STREAM_ERROR_STOPPED,
185   GST_STREAM_ERROR_NUM_ERRORS
186 } GstStreamError;
187
188 #define GST_TYPE_G_ERROR    (gst_g_error_get_type ())
189
190 #define GST_LIBRARY_ERROR   gst_library_error_quark ()
191 #define GST_RESOURCE_ERROR  gst_resource_error_quark ()
192 #define GST_CORE_ERROR      gst_core_error_quark ()
193 #define GST_STREAM_ERROR    gst_stream_error_quark ()
194
195 /**
196  * GST_ERROR_SYSTEM:
197  *
198  * Generates an human readable error message out of an errno number.
199  */
200 #define GST_ERROR_SYSTEM    ("system error: %s", g_strerror (errno))
201
202 GType gst_g_error_get_type (void);
203 gchar *gst_error_get_message (GQuark domain, gint code);
204 GQuark gst_stream_error_quark (void);
205 GQuark gst_core_error_quark (void);
206 GQuark gst_resource_error_quark (void);
207 GQuark gst_library_error_quark (void);
208
209 G_END_DECLS
210 #endif /* __GST_ERROR_H__ */