blob: 54de850d1c9621db7075c35dbda9c1f6ae50c902 [file] [log] [blame]
Alexandre Lision8af73cb2013-12-10 14:11:20 -05001/* $Id$ */
2/*
3 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#ifndef __AUDIODEV_IMP_H__
21#define __AUDIODEV_IMP_H__
22
23#include <pjmedia-audiodev/audiodev.h>
24
25/**
26 * @defgroup s8_audio_device_implementors_api Audio Device Implementors API
27 * @ingroup audio_device_api
28 * @brief API for audio device implementors
29 * @{
30 */
31
32/**
33 * Sound device factory operations.
34 */
35typedef struct pjmedia_aud_dev_factory_op
36{
37 /**
38 * Initialize the audio device factory.
39 *
40 * @param f The audio device factory.
41 */
42 pj_status_t (*init)(pjmedia_aud_dev_factory *f);
43
44 /**
45 * Close this audio device factory and release all resources back to the
46 * operating system.
47 *
48 * @param f The audio device factory.
49 */
50 pj_status_t (*destroy)(pjmedia_aud_dev_factory *f);
51
52 /**
53 * Get the number of audio devices installed in the system.
54 *
55 * @param f The audio device factory.
56 */
57 unsigned (*get_dev_count)(pjmedia_aud_dev_factory *f);
58
59 /**
60 * Get the audio device information and capabilities.
61 *
62 * @param f The audio device factory.
63 * @param index Device index.
64 * @param info The audio device information structure which will be
65 * initialized by this function once it returns
66 * successfully.
67 */
68 pj_status_t (*get_dev_info)(pjmedia_aud_dev_factory *f,
69 unsigned index,
70 pjmedia_aud_dev_info *info);
71
72 /**
73 * Initialize the specified audio device parameter with the default
74 * values for the specified device.
75 *
76 * @param f The audio device factory.
77 * @param index Device index.
78 * @param param The audio device parameter.
79 */
80 pj_status_t (*default_param)(pjmedia_aud_dev_factory *f,
81 unsigned index,
82 pjmedia_aud_param *param);
83
84 /**
85 * Open the audio device and create audio stream. See
86 * #pjmedia_aud_stream_create()
87 */
88 pj_status_t (*create_stream)(pjmedia_aud_dev_factory *f,
89 const pjmedia_aud_param *param,
90 pjmedia_aud_rec_cb rec_cb,
91 pjmedia_aud_play_cb play_cb,
92 void *user_data,
93 pjmedia_aud_stream **p_aud_strm);
94
95 /**
96 * Refresh the list of audio devices installed in the system.
97 *
98 * @param f The audio device factory.
99 */
100 pj_status_t (*refresh)(pjmedia_aud_dev_factory *f);
101
102} pjmedia_aud_dev_factory_op;
103
104
105/**
106 * This structure describes an audio device factory.
107 */
108struct pjmedia_aud_dev_factory
109{
110 /** Internal data to be initialized by audio subsystem. */
111 struct {
112 /** Driver index */
113 unsigned drv_idx;
114 } sys;
115
116 /** Operations */
117 pjmedia_aud_dev_factory_op *op;
118};
119
120
121/**
122 * Sound stream operations.
123 */
124typedef struct pjmedia_aud_stream_op
125{
126 /**
127 * See #pjmedia_aud_stream_get_param()
128 */
129 pj_status_t (*get_param)(pjmedia_aud_stream *strm,
130 pjmedia_aud_param *param);
131
132 /**
133 * See #pjmedia_aud_stream_get_cap()
134 */
135 pj_status_t (*get_cap)(pjmedia_aud_stream *strm,
136 pjmedia_aud_dev_cap cap,
137 void *value);
138
139 /**
140 * See #pjmedia_aud_stream_set_cap()
141 */
142 pj_status_t (*set_cap)(pjmedia_aud_stream *strm,
143 pjmedia_aud_dev_cap cap,
144 const void *value);
145
146 /**
147 * See #pjmedia_aud_stream_start()
148 */
149 pj_status_t (*start)(pjmedia_aud_stream *strm);
150
151 /**
152 * See #pjmedia_aud_stream_stop().
153 */
154 pj_status_t (*stop)(pjmedia_aud_stream *strm);
155
156 /**
157 * See #pjmedia_aud_stream_destroy().
158 */
159 pj_status_t (*destroy)(pjmedia_aud_stream *strm);
160
161} pjmedia_aud_stream_op;
162
163
164/**
165 * This structure describes the audio device stream.
166 */
167struct pjmedia_aud_stream
168{
169 /** Internal data to be initialized by audio subsystem */
170 struct {
171 /** Driver index */
172 unsigned drv_idx;
173 } sys;
174
175 /** Operations */
176 pjmedia_aud_stream_op *op;
177};
178
179
180
181
182/**
183 * @}
184 */
185
186
187
188#endif /* __AUDIODEV_IMP_H__ */