quick shell oneliner to find undocumented members in docs/README more enumtypes clean...
[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:
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  * Core errors are anything that can go wrong in or using
54  * the core GStreamer library
55  */
56 /* FIXME: should we divide in numerical blocks so we can easily add
57           for example PAD errors later ? */
58 typedef enum
59 {
60   GST_CORE_ERROR_FAILED = 1,
61   GST_CORE_ERROR_TOO_LAZY,
62   GST_CORE_ERROR_NOT_IMPLEMENTED,
63   GST_CORE_ERROR_STATE_CHANGE,
64   GST_CORE_ERROR_PAD,
65   GST_CORE_ERROR_THREAD,
66   GST_CORE_ERROR_SCHEDULER,
67   GST_CORE_ERROR_NEGOTIATION,
68   GST_CORE_ERROR_EVENT,
69   GST_CORE_ERROR_SEEK,
70   GST_CORE_ERROR_CAPS,
71   GST_CORE_ERROR_TAG,
72   GST_CORE_ERROR_NUM_ERRORS
73 } GstCoreError;
74
75 /**
76  * GstLibraryError:
77  * @GST_LIBRARY_ERROR_FAILED:
78  * @GST_LIBRARY_ERROR_TOO_LAZY:
79  * @GST_LIBRARY_ERROR_INIT:
80  * @GST_LIBRARY_ERROR_SHUTDOWN:
81  * @GST_LIBRARY_ERROR_SETTINGS:
82  * @GST_LIBRARY_ERROR_ENCODE:
83  * @GST_LIBRARY_ERROR_NUM_ERRORS:
84  *
85  * Library errors are for errors from the library being used by elements
86  * initializing, closing, ...
87  */
88 typedef enum
89 {
90   GST_LIBRARY_ERROR_FAILED = 1,
91   GST_LIBRARY_ERROR_TOO_LAZY,
92   GST_LIBRARY_ERROR_INIT,
93   GST_LIBRARY_ERROR_SHUTDOWN,
94   GST_LIBRARY_ERROR_SETTINGS,
95   GST_LIBRARY_ERROR_ENCODE,
96   GST_LIBRARY_ERROR_NUM_ERRORS
97 } GstLibraryError;
98
99 /**
100  * GstResourceError:
101  * @GST_RESOURCE_ERROR_FAILED:
102  * @GST_RESOURCE_ERROR_TOO_LAZY:
103  * @GST_RESOURCE_ERROR_NOT_FOUND:
104  * @GST_RESOURCE_ERROR_BUSY:
105  * @GST_RESOURCE_ERROR_OPEN_READ:
106  * @GST_RESOURCE_ERROR_OPEN_WRITE:
107  * @GST_RESOURCE_ERROR_OPEN_READ_WRITE:
108  * @GST_RESOURCE_ERROR_CLOSE:
109  * @GST_RESOURCE_ERROR_READ:
110  * @GST_RESOURCE_ERROR_WRITE:
111  * @GST_RESOURCE_ERROR_SEEK:
112  * @GST_RESOURCE_ERROR_SYNC:
113  * @GST_RESOURCE_ERROR_SETTINGS:
114  * @GST_RESOURCE_ERROR_NUM_ERRORS:
115  *
116  * Resource errors are for anything external used by an element:
117  * memory, files, network connections, process space, ...
118  * They're typically used by source and sink elements
119  */
120 typedef enum
121 {
122   GST_RESOURCE_ERROR_FAILED = 1,
123   GST_RESOURCE_ERROR_TOO_LAZY,
124   GST_RESOURCE_ERROR_NOT_FOUND,
125   GST_RESOURCE_ERROR_BUSY,
126   GST_RESOURCE_ERROR_OPEN_READ,
127   GST_RESOURCE_ERROR_OPEN_WRITE,
128   GST_RESOURCE_ERROR_OPEN_READ_WRITE,
129   GST_RESOURCE_ERROR_CLOSE,
130   GST_RESOURCE_ERROR_READ,
131   GST_RESOURCE_ERROR_WRITE,
132   GST_RESOURCE_ERROR_SEEK,
133   GST_RESOURCE_ERROR_SYNC,
134   GST_RESOURCE_ERROR_SETTINGS,
135   GST_RESOURCE_ERROR_NUM_ERRORS
136 } GstResourceError;
137
138 /**
139  * GstStreamError:
140  * @GST_STREAM_ERROR_FAILED:
141  * @GST_STREAM_ERROR_TOO_LAZY:
142  * @GST_STREAM_ERROR_NOT_IMPLEMENTED:
143  * @GST_STREAM_ERROR_TYPE_NOT_FOUND:
144  * @GST_STREAM_ERROR_WRONG_TYPE:
145  * @GST_STREAM_ERROR_CODEC_NOT_FOUND:
146  * @GST_STREAM_ERROR_DECODE:
147  * @GST_STREAM_ERROR_ENCODE:
148  * @GST_STREAM_ERROR_DEMUX:
149  * @GST_STREAM_ERROR_MUX:
150  * @GST_STREAM_ERROR_FORMAT:
151  * @GST_STREAM_ERROR_NUM_ERRORS:
152  *
153  * Stream errors are for anything related to the stream being processed:
154  * format errors, media type errors, ...
155  * They're typically used by decoders, demuxers, converters, ...
156  */
157 typedef enum
158 {
159   GST_STREAM_ERROR_FAILED = 1,
160   GST_STREAM_ERROR_TOO_LAZY,
161   GST_STREAM_ERROR_NOT_IMPLEMENTED,
162   GST_STREAM_ERROR_TYPE_NOT_FOUND,
163   GST_STREAM_ERROR_WRONG_TYPE,
164   GST_STREAM_ERROR_CODEC_NOT_FOUND,
165   GST_STREAM_ERROR_DECODE,
166   GST_STREAM_ERROR_ENCODE,
167   GST_STREAM_ERROR_DEMUX,
168   GST_STREAM_ERROR_MUX,
169   GST_STREAM_ERROR_FORMAT,
170   GST_STREAM_ERROR_NUM_ERRORS
171 } GstStreamError;
172
173 /* This should go away once we convinced glib people to register GError */
174 #define GST_TYPE_G_ERROR    (gst_g_error_get_type ())
175
176 #define GST_LIBRARY_ERROR   gst_library_error_quark ()
177 #define GST_RESOURCE_ERROR  gst_resource_error_quark ()
178 #define GST_CORE_ERROR      gst_core_error_quark ()
179 #define GST_STREAM_ERROR    gst_stream_error_quark ()
180
181 #define GST_ERROR_SYSTEM    ("system error: %s", g_strerror (errno))
182
183 GType gst_g_error_get_type (void);
184 gchar *gst_error_get_message (GQuark domain, gint code);
185 GQuark gst_stream_error_quark (void);
186 GQuark gst_core_error_quark (void);
187 GQuark gst_resource_error_quark (void);
188 GQuark gst_library_error_quark (void);
189
190 G_END_DECLS
191 #endif /* __GST_ERROR_H__ */