gsterror.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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., 51 Franklin St, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19. #ifndef __GST_ERROR_H__
  20. #define __GST_ERROR_H__
  21. #include <glib.h>
  22. #include <glib-object.h>
  23. #include <errno.h>
  24. G_BEGIN_DECLS
  25. /*
  26. * we define FIXME error domains:
  27. * GST_CORE_ERROR
  28. * GST_LIBRARY_ERROR
  29. * GST_RESOURCE_ERROR
  30. * GST_STREAM_ERROR
  31. *
  32. * Check GError API docs for rationale for naming.
  33. */
  34. /**
  35. * GstCoreError:
  36. * @GST_CORE_ERROR_FAILED: a general error which doesn't fit in any other
  37. * category. Make sure you add a custom message to the error call.
  38. * @GST_CORE_ERROR_TOO_LAZY: do not use this except as a placeholder for
  39. * deciding where to go while developing code.
  40. * @GST_CORE_ERROR_NOT_IMPLEMENTED: use this when you do not want to implement
  41. * this functionality yet.
  42. * @GST_CORE_ERROR_STATE_CHANGE: used for state change errors.
  43. * @GST_CORE_ERROR_PAD: used for pad-related errors.
  44. * @GST_CORE_ERROR_THREAD: used for thread-related errors.
  45. * @GST_CORE_ERROR_NEGOTIATION: used for negotiation-related errors.
  46. * @GST_CORE_ERROR_EVENT: used for event-related errors.
  47. * @GST_CORE_ERROR_SEEK: used for seek-related errors.
  48. * @GST_CORE_ERROR_CAPS: used for caps-related errors.
  49. * @GST_CORE_ERROR_TAG: used for negotiation-related errors.
  50. * @GST_CORE_ERROR_MISSING_PLUGIN: used if a plugin is missing.
  51. * @GST_CORE_ERROR_CLOCK: used for clock related errors.
  52. * @GST_CORE_ERROR_DISABLED: used if functionality has been disabled at
  53. * compile time.
  54. * @GST_CORE_ERROR_NUM_ERRORS: the number of core error types.
  55. *
  56. * Core errors are errors inside 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_MISSING_PLUGIN,
  74. GST_CORE_ERROR_CLOCK,
  75. GST_CORE_ERROR_DISABLED,
  76. GST_CORE_ERROR_NUM_ERRORS
  77. } GstCoreError;
  78. /**
  79. * GstLibraryError:
  80. * @GST_LIBRARY_ERROR_FAILED: a general error which doesn't fit in any other
  81. * category. Make sure you add a custom message to the error call.
  82. * @GST_LIBRARY_ERROR_TOO_LAZY: do not use this except as a placeholder for
  83. * deciding where to go while developing code.
  84. * @GST_LIBRARY_ERROR_INIT: used when the library could not be opened.
  85. * @GST_LIBRARY_ERROR_SHUTDOWN: used when the library could not be closed.
  86. * @GST_LIBRARY_ERROR_SETTINGS: used when the library doesn't accept settings.
  87. * @GST_LIBRARY_ERROR_ENCODE: used when the library generated an encoding error.
  88. * @GST_LIBRARY_ERROR_NUM_ERRORS: the number of library error types.
  89. *
  90. * Library errors are for errors from the library being used by elements
  91. * (initializing, finalizing, settings, ...)
  92. */
  93. typedef enum
  94. {
  95. GST_LIBRARY_ERROR_FAILED = 1,
  96. GST_LIBRARY_ERROR_TOO_LAZY,
  97. GST_LIBRARY_ERROR_INIT,
  98. GST_LIBRARY_ERROR_SHUTDOWN,
  99. GST_LIBRARY_ERROR_SETTINGS,
  100. GST_LIBRARY_ERROR_ENCODE,
  101. GST_LIBRARY_ERROR_NUM_ERRORS
  102. } GstLibraryError;
  103. /**
  104. * GstResourceError:
  105. * @GST_RESOURCE_ERROR_FAILED: a general error which doesn't fit in any other
  106. * category. Make sure you add a custom message to the error call.
  107. * @GST_RESOURCE_ERROR_TOO_LAZY: do not use this except as a placeholder for
  108. * deciding where to go while developing code.
  109. * @GST_RESOURCE_ERROR_NOT_FOUND: used when the resource could not be found.
  110. * @GST_RESOURCE_ERROR_BUSY: used when resource is busy.
  111. * @GST_RESOURCE_ERROR_OPEN_READ: used when resource fails to open for reading.
  112. * @GST_RESOURCE_ERROR_OPEN_WRITE: used when resource fails to open for writing.
  113. * @GST_RESOURCE_ERROR_OPEN_READ_WRITE: used when resource cannot be opened for
  114. * both reading and writing, or either (but unspecified which).
  115. * @GST_RESOURCE_ERROR_CLOSE: used when the resource can't be closed.
  116. * @GST_RESOURCE_ERROR_READ: used when the resource can't be read from.
  117. * @GST_RESOURCE_ERROR_WRITE: used when the resource can't be written to.
  118. * @GST_RESOURCE_ERROR_SEEK: used when a seek on the resource fails.
  119. * @GST_RESOURCE_ERROR_SYNC: used when a synchronize on the resource fails.
  120. * @GST_RESOURCE_ERROR_SETTINGS: used when settings can't be manipulated on.
  121. * @GST_RESOURCE_ERROR_NO_SPACE_LEFT: used when the resource has no space left.
  122. * @GST_RESOURCE_ERROR_NOT_AUTHORIZED: used when the resource can't be opened
  123. * due to missing authorization.
  124. * (Since 1.2.4)
  125. * @GST_RESOURCE_ERROR_NUM_ERRORS: the number of resource error types.
  126. *
  127. * Resource errors are for any resource used by an element:
  128. * memory, files, network connections, process space, ...
  129. * They're typically used by source and sink elements.
  130. */
  131. typedef enum
  132. {
  133. GST_RESOURCE_ERROR_FAILED = 1,
  134. GST_RESOURCE_ERROR_TOO_LAZY,
  135. GST_RESOURCE_ERROR_NOT_FOUND,
  136. GST_RESOURCE_ERROR_BUSY,
  137. GST_RESOURCE_ERROR_OPEN_READ,
  138. GST_RESOURCE_ERROR_OPEN_WRITE,
  139. GST_RESOURCE_ERROR_OPEN_READ_WRITE,
  140. GST_RESOURCE_ERROR_CLOSE,
  141. GST_RESOURCE_ERROR_READ,
  142. GST_RESOURCE_ERROR_WRITE,
  143. GST_RESOURCE_ERROR_SEEK,
  144. GST_RESOURCE_ERROR_SYNC,
  145. GST_RESOURCE_ERROR_SETTINGS,
  146. GST_RESOURCE_ERROR_NO_SPACE_LEFT,
  147. GST_RESOURCE_ERROR_NOT_AUTHORIZED,
  148. GST_RESOURCE_ERROR_NUM_ERRORS
  149. } GstResourceError;
  150. /**
  151. * GstStreamError:
  152. * @GST_STREAM_ERROR_FAILED: a general error which doesn't fit in any other
  153. * category. Make sure you add a custom message to the error call.
  154. * @GST_STREAM_ERROR_TOO_LAZY: do not use this except as a placeholder for
  155. * deciding where to go while developing code.
  156. * @GST_STREAM_ERROR_NOT_IMPLEMENTED: use this when you do not want to implement
  157. * this functionality yet.
  158. * @GST_STREAM_ERROR_TYPE_NOT_FOUND: used when the element doesn't know the
  159. * stream's type.
  160. * @GST_STREAM_ERROR_WRONG_TYPE: used when the element doesn't handle this type
  161. * of stream.
  162. * @GST_STREAM_ERROR_CODEC_NOT_FOUND: used when there's no codec to handle the
  163. * stream's type.
  164. * @GST_STREAM_ERROR_DECODE: used when decoding fails.
  165. * @GST_STREAM_ERROR_ENCODE: used when encoding fails.
  166. * @GST_STREAM_ERROR_DEMUX: used when demuxing fails.
  167. * @GST_STREAM_ERROR_MUX: used when muxing fails.
  168. * @GST_STREAM_ERROR_FORMAT: used when the stream is of the wrong format
  169. * (for example, wrong caps).
  170. * @GST_STREAM_ERROR_DECRYPT: used when the stream is encrypted and can't be
  171. * decrypted because this is not supported by the element.
  172. * @GST_STREAM_ERROR_DECRYPT_NOKEY: used when the stream is encrypted and
  173. * can't be decrypted because no suitable key is available.
  174. * @GST_STREAM_ERROR_NUM_ERRORS: the number of stream error types.
  175. *
  176. * Stream errors are for anything related to the stream being processed:
  177. * format errors, media type errors, ...
  178. * They're typically used by decoders, demuxers, converters, ...
  179. */
  180. typedef enum
  181. {
  182. GST_STREAM_ERROR_FAILED = 1,
  183. GST_STREAM_ERROR_TOO_LAZY,
  184. GST_STREAM_ERROR_NOT_IMPLEMENTED,
  185. GST_STREAM_ERROR_TYPE_NOT_FOUND,
  186. GST_STREAM_ERROR_WRONG_TYPE,
  187. GST_STREAM_ERROR_CODEC_NOT_FOUND,
  188. GST_STREAM_ERROR_DECODE,
  189. GST_STREAM_ERROR_ENCODE,
  190. GST_STREAM_ERROR_DEMUX,
  191. GST_STREAM_ERROR_MUX,
  192. GST_STREAM_ERROR_FORMAT,
  193. GST_STREAM_ERROR_DECRYPT,
  194. GST_STREAM_ERROR_DECRYPT_NOKEY,
  195. GST_STREAM_ERROR_NUM_ERRORS
  196. } GstStreamError;
  197. /**
  198. * GST_LIBRARY_ERROR:
  199. *
  200. * Error domain for library loading. Errors in this domain will
  201. * be from the #GstLibraryError enumeration.
  202. * See #GError for information on error domains.
  203. */
  204. #define GST_LIBRARY_ERROR gst_library_error_quark ()
  205. /**
  206. * GST_RESOURCE_ERROR:
  207. *
  208. * Error domain for resource handling. Errors in this domain will
  209. * be from the #GstResourceError enumeration.
  210. * See #GError for information on error domains.
  211. */
  212. #define GST_RESOURCE_ERROR gst_resource_error_quark ()
  213. /**
  214. * GST_CORE_ERROR:
  215. *
  216. * Error domain for core system. Errors in this domain will
  217. * be from the #GstCoreError enumeration.
  218. * See #GError for information on error domains.
  219. */
  220. #define GST_CORE_ERROR gst_core_error_quark ()
  221. /**
  222. * GST_STREAM_ERROR:
  223. *
  224. * Error domain for media stream processing. Errors in this domain will
  225. * be from the #GstStreamError enumeration.
  226. * See #GError for information on error domains.
  227. */
  228. #define GST_STREAM_ERROR gst_stream_error_quark ()
  229. /**
  230. * GST_ERROR_SYSTEM:
  231. *
  232. * Builds a string using errno describing the previously failed system
  233. * call. To be used as the debug argument in #GST_ELEMENT_ERROR.
  234. */
  235. #define GST_ERROR_SYSTEM ("system error: %s", g_strerror (errno))
  236. gchar *gst_error_get_message (GQuark domain, gint code);
  237. GQuark gst_stream_error_quark (void);
  238. GQuark gst_core_error_quark (void);
  239. GQuark gst_resource_error_quark (void);
  240. GQuark gst_library_error_quark (void);
  241. G_END_DECLS
  242. #endif /* __GST_ERROR_H__ */