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