errno.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. /*
  2. * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program 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
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #ifndef __PJMEDIA_AUDIODEV_AUDIODEV_ERRNO_H__
  19. #define __PJMEDIA_AUDIODEV_AUDIODEV_ERRNO_H__
  20. /**
  21. * @file errno.h Error Codes
  22. * @brief Audiodev specific error codes.
  23. */
  24. #include <pjmedia-audiodev/config.h>
  25. #include <pj/errno.h>
  26. /**
  27. * @defgroup error_codes Error Codes
  28. * @ingroup audio_device_api
  29. * @brief Audio devive library specific error codes.
  30. * @{
  31. */
  32. PJ_BEGIN_DECL
  33. /**
  34. * Start of error code relative to PJ_ERRNO_START_USER.
  35. * This value is 420000.
  36. */
  37. #define PJMEDIA_AUDIODEV_ERRNO_START \
  38. (PJ_ERRNO_START_USER + PJ_ERRNO_SPACE_SIZE*5)
  39. #define PJMEDIA_AUDIODEV_ERRNO_END \
  40. (PJMEDIA_AUDIODEV_ERRNO_START + PJ_ERRNO_SPACE_SIZE - 1)
  41. /**
  42. * Mapping from PortAudio error codes to pjmedia error space.
  43. */
  44. #define PJMEDIA_AUDIODEV_PORTAUDIO_ERRNO_START \
  45. (PJMEDIA_AUDIODEV_ERRNO_END-10000)
  46. #define PJMEDIA_AUDIODEV_PORTAUDIO_ERRNO_END \
  47. (PJMEDIA_AUDIODEV_PORTAUDIO_ERRNO_START + 10000 -1)
  48. /**
  49. * Convert PortAudio error code to PJLIB error code.
  50. * PortAudio error code range: 0 >= err >= -10000
  51. */
  52. #define PJMEDIA_AUDIODEV_ERRNO_FROM_PORTAUDIO(err) \
  53. ((int)PJMEDIA_AUDIODEV_PORTAUDIO_ERRNO_START-err)
  54. /**
  55. * Mapping from Windows multimedia WaveIn error codes.
  56. */
  57. #define PJMEDIA_AUDIODEV_WMME_IN_ERROR_START \
  58. (PJMEDIA_AUDIODEV_ERRNO_START + 30000)
  59. #define PJMEDIA_AUDIODEV_WMME_IN_ERROR_END \
  60. (PJMEDIA_AUDIODEV_WMME_IN_ERROR_START + 1000 - 1)
  61. /**
  62. * Convert WaveIn operation error codes to PJLIB error space.
  63. */
  64. #define PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_IN(err) \
  65. ((int)PJMEDIA_AUDIODEV_WMME_IN_ERROR_START+err)
  66. /**
  67. * Mapping from Windows multimedia WaveOut error codes.
  68. */
  69. #define PJMEDIA_AUDIODEV_WMME_OUT_ERROR_START \
  70. (PJMEDIA_AUDIODEV_WMME_IN_ERROR_END + 1000)
  71. #define PJMEDIA_AUDIODEV_WMME_OUT_ERROR_END \
  72. (PJMEDIA_AUDIODEV_WMME_OUT_ERROR_START + 1000)
  73. /**
  74. * Convert WaveOut operation error codes to PJLIB error space.
  75. */
  76. #define PJMEDIA_AUDIODEV_ERRNO_FROM_WMME_OUT(err) \
  77. ((int)PJMEDIA_AUDIODEV_WMME_OUT_ERROR_START+err)
  78. /**
  79. * Mapping from CoreAudio error codes to pjmedia error space.
  80. */
  81. #define PJMEDIA_AUDIODEV_COREAUDIO_ERRNO_START \
  82. (PJMEDIA_AUDIODEV_ERRNO_START+20000)
  83. #define PJMEDIA_AUDIODEV_COREAUDIO_ERRNO_END \
  84. (PJMEDIA_AUDIODEV_COREAUDIO_ERRNO_START + 20000 -1)
  85. /**
  86. * Convert CoreAudio error code to PJLIB error code.
  87. * CoreAudio error code range: 0 >= err >= -10000
  88. */
  89. #define PJMEDIA_AUDIODEV_ERRNO_FROM_COREAUDIO(err) \
  90. ((int)PJMEDIA_AUDIODEV_COREAUDIO_ERRNO_START-err)
  91. /**
  92. * Mapping from BDIMAD error codes to pjmedia error space.
  93. */
  94. #define PJMEDIA_AUDIODEV_BDIMAD_ERROR_START \
  95. (PJMEDIA_AUDIODEV_ERRNO_START + 40000)
  96. #define PJMEDIA_AUDIODEV_BDIMAD_ERROR_END \
  97. (PJMEDIA_AUDIODEV_BDIMAD_ERROR_START + 2000 - 1)
  98. /**
  99. * Convert BDIMAD error codes to PJLIB error space.
  100. */
  101. #define PJMEDIA_AUDIODEV_ERRNO_FROM_BDIMAD(err) \
  102. ((int)PJMEDIA_AUDIODEV_BDIMAD_ERROR_START+err)
  103. /************************************************************
  104. * Audio Device API error codes
  105. ***********************************************************/
  106. /**
  107. * @hideinitializer
  108. * General/unknown error.
  109. */
  110. #define PJMEDIA_EAUD_ERR (PJMEDIA_AUDIODEV_ERRNO_START+1) /* 420001 */
  111. /**
  112. * @hideinitializer
  113. * Unknown error from audio driver
  114. */
  115. #define PJMEDIA_EAUD_SYSERR (PJMEDIA_AUDIODEV_ERRNO_START+2) /* 420002 */
  116. /**
  117. * @hideinitializer
  118. * Audio subsystem not initialized
  119. */
  120. #define PJMEDIA_EAUD_INIT (PJMEDIA_AUDIODEV_ERRNO_START+3) /* 420003 */
  121. /**
  122. * @hideinitializer
  123. * Invalid audio device
  124. */
  125. #define PJMEDIA_EAUD_INVDEV (PJMEDIA_AUDIODEV_ERRNO_START+4) /* 420004 */
  126. /**
  127. * @hideinitializer
  128. * Found no devices
  129. */
  130. #define PJMEDIA_EAUD_NODEV (PJMEDIA_AUDIODEV_ERRNO_START+5) /* 420005 */
  131. /**
  132. * @hideinitializer
  133. * Unable to find default device
  134. */
  135. #define PJMEDIA_EAUD_NODEFDEV (PJMEDIA_AUDIODEV_ERRNO_START+6) /* 420006 */
  136. /**
  137. * @hideinitializer
  138. * Device not ready
  139. */
  140. #define PJMEDIA_EAUD_NOTREADY (PJMEDIA_AUDIODEV_ERRNO_START+7) /* 420007 */
  141. /**
  142. * @hideinitializer
  143. * The audio capability is invalid or not supported
  144. */
  145. #define PJMEDIA_EAUD_INVCAP (PJMEDIA_AUDIODEV_ERRNO_START+8) /* 420008 */
  146. /**
  147. * @hideinitializer
  148. * The operation is invalid or not supported
  149. */
  150. #define PJMEDIA_EAUD_INVOP (PJMEDIA_AUDIODEV_ERRNO_START+9) /* 420009 */
  151. /**
  152. * @hideinitializer
  153. * Bad or invalid audio device format
  154. */
  155. #define PJMEDIA_EAUD_BADFORMAT (PJMEDIA_AUDIODEV_ERRNO_START+10) /* 4200010 */
  156. /**
  157. * @hideinitializer
  158. * Invalid audio device sample format
  159. */
  160. #define PJMEDIA_EAUD_SAMPFORMAT (PJMEDIA_AUDIODEV_ERRNO_START+11) /* 4200011 */
  161. /**
  162. * @hideinitializer
  163. * Bad latency setting
  164. */
  165. #define PJMEDIA_EAUD_BADLATENCY (PJMEDIA_AUDIODEV_ERRNO_START+12) /* 4200012 */
  166. /**
  167. * @hideinitializer
  168. * General WASAPI error
  169. */
  170. #define PJMEDIA_EAUD_WASAPI_ERROR \
  171. (PJMEDIA_AUDIODEV_ERRNO_START+13) /* 4200013 */
  172. /**
  173. * Get error message for the specified error code. Note that this
  174. * function is only able to decode PJMEDIA Audiodev specific error code.
  175. * Application should use pj_strerror(), which should be able to
  176. * decode all error codes belonging to all subsystems (e.g. pjlib,
  177. * pjmedia, pjsip, etc).
  178. *
  179. * @param status The error code.
  180. * @param buffer The buffer where to put the error message.
  181. * @param bufsize Size of the buffer.
  182. *
  183. * @return The error message as NULL terminated string,
  184. * wrapped with pj_str_t.
  185. */
  186. PJ_DECL(pj_str_t) pjmedia_audiodev_strerror(pj_status_t status, char *buffer,
  187. pj_size_t bufsize);
  188. PJ_END_DECL
  189. /**
  190. * @}
  191. */
  192. #endif /* __PJMEDIA_AUDIODEV_AUDIODEV_ERRNO_H__ */