Benny Prijono | 8eeab0b | 2009-03-04 19:00:28 +0000 | [diff] [blame^] | 1 | /* $Id$ */ |
| 2 | /* |
| 3 | * Copyright (C) 2008-2009 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 | * Audio Device API error codes |
| 95 | ***********************************************************/ |
| 96 | /** |
| 97 | * @hideinitializer |
| 98 | * General/unknown error. |
| 99 | */ |
| 100 | #define PJMEDIA_AUDIODEV_ERROR (PJMEDIA_AUDIODEV_ERRNO_START+1) /* 420001 */ |
| 101 | |
| 102 | /** |
| 103 | * @hideinitializer |
| 104 | * Unknown error from audio driver |
| 105 | */ |
| 106 | #define PJMEDIA_EAUD_SYSERR (PJMEDIA_AUDIODEV_ERRNO_START+2) /* 420002 */ |
| 107 | |
| 108 | /** |
| 109 | * @hideinitializer |
| 110 | * Audio subsystem not initialized |
| 111 | */ |
| 112 | #define PJMEDIA_EAUD_INIT (PJMEDIA_AUDIODEV_ERRNO_START+3) /* 420003 */ |
| 113 | |
| 114 | /** |
| 115 | * @hideinitializer |
| 116 | * Invalid audio device |
| 117 | */ |
| 118 | #define PJMEDIA_EAUD_INVDEV (PJMEDIA_AUDIODEV_ERRNO_START+4) /* 420004 */ |
| 119 | |
| 120 | /** |
| 121 | * @hideinitializer |
| 122 | * Found no devices |
| 123 | */ |
| 124 | #define PJMEDIA_EAUD_NODEV (PJMEDIA_AUDIODEV_ERRNO_START+5) /* 420005 */ |
| 125 | |
| 126 | /** |
| 127 | * @hideinitializer |
| 128 | * Unable to find default device |
| 129 | */ |
| 130 | #define PJMEDIA_EAUD_NODEFDEV (PJMEDIA_AUDIODEV_ERRNO_START+6) /* 420006 */ |
| 131 | |
| 132 | /** |
| 133 | * @hideinitializer |
| 134 | * Device not ready |
| 135 | */ |
| 136 | #define PJMEDIA_EAUD_NOTREADY (PJMEDIA_AUDIODEV_ERRNO_START+7) /* 420007 */ |
| 137 | |
| 138 | /** |
| 139 | * @hideinitializer |
| 140 | * The audio capability is invalid or not supported |
| 141 | */ |
| 142 | #define PJMEDIA_EAUD_INVCAP (PJMEDIA_AUDIODEV_ERRNO_START+8) /* 420008 */ |
| 143 | |
| 144 | /** |
| 145 | * @hideinitializer |
| 146 | * The operation is invalid or not supported |
| 147 | */ |
| 148 | #define PJMEDIA_EAUD_INVOP (PJMEDIA_AUDIODEV_ERRNO_START+9) /* 420009 */ |
| 149 | |
| 150 | /** |
| 151 | * @hideinitializer |
| 152 | * Bad or invalid audio device format |
| 153 | */ |
| 154 | #define PJMEDIA_EAUD_BADFORMAT (PJMEDIA_AUDIODEV_ERRNO_START+10) /* 4200010 */ |
| 155 | |
| 156 | /** |
| 157 | * @hideinitializer |
| 158 | * Invalid audio device sample format |
| 159 | */ |
| 160 | #define PJMEDIA_EAUD_SAMPFORMAT (PJMEDIA_AUDIODEV_ERRNO_START+11) /* 4200011 */ |
| 161 | |
| 162 | /** |
| 163 | * Get error message for the specified error code. Note that this |
| 164 | * function is only able to decode PJMEDIA Audiodev specific error code. |
| 165 | * Application should use pj_strerror(), which should be able to |
| 166 | * decode all error codes belonging to all subsystems (e.g. pjlib, |
| 167 | * pjmedia, pjsip, etc). |
| 168 | * |
| 169 | * @param status The error code. |
| 170 | * @param buffer The buffer where to put the error message. |
| 171 | * @param bufsize Size of the buffer. |
| 172 | * |
| 173 | * @return The error message as NULL terminated string, |
| 174 | * wrapped with pj_str_t. |
| 175 | */ |
| 176 | PJ_DECL(pj_str_t) pjmedia_audiodev_strerror(pj_status_t status, char *buffer, |
| 177 | pj_size_t bufsize); |
| 178 | |
| 179 | |
| 180 | PJ_END_DECL |
| 181 | |
| 182 | /** |
| 183 | * @} |
| 184 | */ |
| 185 | |
| 186 | |
| 187 | #endif /* __PJMEDIA_AUDIODEV_AUDIODEV_ERRNO_H__ */ |
| 188 | |