added params for deprecation guards documented some more enums
[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: GStreamer encountered a general core library error.
40  * @GST_CORE_ERROR_TOO_LAZY: GStreamer developers were too lazy to assign an error code to this error.  Please file a bug.
41  * @GST_CORE_ERROR_NOT_IMPLEMENTED: Internal GStreamer error: code not implemented.  File a bug.
42  * @GST_CORE_ERROR_STATE_CHANGE: Internal GStreamer error: state change failed.  File a bug.
43  * @GST_CORE_ERROR_PAD: Internal GStreamer error: pad problem.  File a bug.
44  * @GST_CORE_ERROR_THREAD: Internal GStreamer error: thread problem.  File a bug.
45  * @GST_CORE_ERROR_SCHEDULER: Internal GStreamer error: scheduler problem.  File a bug.
46  * @GST_CORE_ERROR_NEGOTIATION: Internal GStreamer error: negotiation problem.  File a bug.
47  * @GST_CORE_ERROR_EVENT: Internal GStreamer error: event problem.  File a bug.
48  * @GST_CORE_ERROR_SEEK: Internal GStreamer error: seek problem.  File a bug.
49  * @GST_CORE_ERROR_CAPS: Internal GStreamer error: caps problem.  File a bug.
50  * @GST_CORE_ERROR_TAG: Internal GStreamer error: tag problem.  File a bug.
51  * @GST_CORE_ERROR_NUM_ERRORS: the error count
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: GStreamer encountered a general supporting library error.
78  * @GST_LIBRARY_ERROR_TOO_LAZY: GStreamer developers were too lazy to assign an error code to this error.  Please file a bug.
79  * @GST_LIBRARY_ERROR_INIT: Could not initialize supporting library.
80  * @GST_LIBRARY_ERROR_SHUTDOWN: Could not close supporting library.
81  * @GST_LIBRARY_ERROR_SETTINGS: Could not close supporting library.
82  * @GST_LIBRARY_ERROR_ENCODE:
83  * @GST_LIBRARY_ERROR_NUM_ERRORS: the error count
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: GStreamer encountered a general resource error
102  * @GST_RESOURCE_ERROR_TOO_LAZY: GStreamer developers were too lazy to assign an error code to this error.  Please file a bug.
103  * @GST_RESOURCE_ERROR_NOT_FOUND: Resource not found
104  * @GST_RESOURCE_ERROR_BUSY: Resource busy or not available
105  * @GST_RESOURCE_ERROR_OPEN_READ: Could not open resource for reading
106  * @GST_RESOURCE_ERROR_OPEN_WRITE: Could not open resource for writing
107  * @GST_RESOURCE_ERROR_OPEN_READ_WRITE: Could not open resource for reading and writing
108  * @GST_RESOURCE_ERROR_CLOSE: Could not close resource
109  * @GST_RESOURCE_ERROR_READ: Could not read from resource
110  * @GST_RESOURCE_ERROR_WRITE: Could not write to resource
111  * @GST_RESOURCE_ERROR_SEEK: Could not perform seek on resource
112  * @GST_RESOURCE_ERROR_SYNC: Could not synchronize on resource
113  * @GST_RESOURCE_ERROR_SETTINGS: Could not get/set settings from/on resource
114  * @GST_RESOURCE_ERROR_NUM_ERRORS: the error count
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: GStreamer encountered a general stream error
141  * @GST_STREAM_ERROR_TOO_LAZY: GStreamer developers were too lazy to assign an error code to this error.  Please file a bug
142  * @GST_STREAM_ERROR_NOT_IMPLEMENTED: Element doesn't implement handling of this stream. Please file a bug.
143  * @GST_STREAM_ERROR_TYPE_NOT_FOUND: Could not determine type of stream
144  * @GST_STREAM_ERROR_WRONG_TYPE: The stream is of a different type than handled by this element
145  * @GST_STREAM_ERROR_CODEC_NOT_FOUND: There is no codec present that can handle the stream's type
146  * @GST_STREAM_ERROR_DECODE: Could not decode stream
147  * @GST_STREAM_ERROR_ENCODE: Could not encode stream
148  * @GST_STREAM_ERROR_DEMUX: Could not demultiplex stream
149  * @GST_STREAM_ERROR_MUX: Could not multiplex stream
150  * @GST_STREAM_ERROR_FORMAT: Stream is of the wrong format
151  * @GST_STREAM_ERROR_NUM_ERRORS: the error count
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__ */