blob: 4f92f5148d2958ab0e5e707bc892a636082c26bf [file] [log] [blame]
Benny Prijono8eeab0b2009-03-04 19:00:28 +00001/* $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
38PJ_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
Sauw Ming55a73cd2010-05-17 12:51:06 +000093/**
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
Benny Prijono8eeab0b2009-03-04 19:00:28 +0000107/************************************************************
108 * Audio Device API error codes
109 ***********************************************************/
110/**
111 * @hideinitializer
112 * General/unknown error.
113 */
Benny Prijono64f91382009-03-05 18:02:28 +0000114#define PJMEDIA_EAUD_ERR (PJMEDIA_AUDIODEV_ERRNO_START+1) /* 420001 */
Benny Prijono8eeab0b2009-03-04 19:00:28 +0000115
116/**
117 * @hideinitializer
118 * Unknown error from audio driver
119 */
120#define PJMEDIA_EAUD_SYSERR (PJMEDIA_AUDIODEV_ERRNO_START+2) /* 420002 */
121
122/**
123 * @hideinitializer
124 * Audio subsystem not initialized
125 */
126#define PJMEDIA_EAUD_INIT (PJMEDIA_AUDIODEV_ERRNO_START+3) /* 420003 */
127
128/**
129 * @hideinitializer
130 * Invalid audio device
131 */
132#define PJMEDIA_EAUD_INVDEV (PJMEDIA_AUDIODEV_ERRNO_START+4) /* 420004 */
133
134/**
135 * @hideinitializer
136 * Found no devices
137 */
138#define PJMEDIA_EAUD_NODEV (PJMEDIA_AUDIODEV_ERRNO_START+5) /* 420005 */
139
140/**
141 * @hideinitializer
142 * Unable to find default device
143 */
144#define PJMEDIA_EAUD_NODEFDEV (PJMEDIA_AUDIODEV_ERRNO_START+6) /* 420006 */
145
146/**
147 * @hideinitializer
148 * Device not ready
149 */
150#define PJMEDIA_EAUD_NOTREADY (PJMEDIA_AUDIODEV_ERRNO_START+7) /* 420007 */
151
152/**
153 * @hideinitializer
154 * The audio capability is invalid or not supported
155 */
156#define PJMEDIA_EAUD_INVCAP (PJMEDIA_AUDIODEV_ERRNO_START+8) /* 420008 */
157
158/**
159 * @hideinitializer
160 * The operation is invalid or not supported
161 */
162#define PJMEDIA_EAUD_INVOP (PJMEDIA_AUDIODEV_ERRNO_START+9) /* 420009 */
163
164/**
165 * @hideinitializer
166 * Bad or invalid audio device format
167 */
168#define PJMEDIA_EAUD_BADFORMAT (PJMEDIA_AUDIODEV_ERRNO_START+10) /* 4200010 */
169
170/**
171 * @hideinitializer
172 * Invalid audio device sample format
173 */
174#define PJMEDIA_EAUD_SAMPFORMAT (PJMEDIA_AUDIODEV_ERRNO_START+11) /* 4200011 */
175
176/**
Benny Prijono64f91382009-03-05 18:02:28 +0000177 * @hideinitializer
178 * Bad latency setting
179 */
180#define PJMEDIA_EAUD_BADLATENCY (PJMEDIA_AUDIODEV_ERRNO_START+12) /* 4200012 */
181
182
183
184
185
186/**
Benny Prijono8eeab0b2009-03-04 19:00:28 +0000187 * Get error message for the specified error code. Note that this
188 * function is only able to decode PJMEDIA Audiodev specific error code.
189 * Application should use pj_strerror(), which should be able to
190 * decode all error codes belonging to all subsystems (e.g. pjlib,
191 * pjmedia, pjsip, etc).
192 *
193 * @param status The error code.
194 * @param buffer The buffer where to put the error message.
195 * @param bufsize Size of the buffer.
196 *
197 * @return The error message as NULL terminated string,
198 * wrapped with pj_str_t.
199 */
200PJ_DECL(pj_str_t) pjmedia_audiodev_strerror(pj_status_t status, char *buffer,
201 pj_size_t bufsize);
202
203
204PJ_END_DECL
205
206/**
207 * @}
208 */
209
210
211#endif /* __PJMEDIA_AUDIODEV_AUDIODEV_ERRNO_H__ */
212