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