forked from thoemy/android-audio-wrapper
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaudio_hw.cpp
616 lines (524 loc) · 19.8 KB
/
audio_hw.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
/*
* Copyright (C) 2011 The Android Open Source Project
* Copyright (C) 2013 Thomas Wendt <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "AudioWrapper"
//#define LOG_NDEBUG 0
#include <errno.h>
#include <pthread.h>
#include <stdint.h>
#include <sys/time.h>
#include <cutils/log.h>
#include "common.h"
#include "include/4.0/hardware/audio.h"
struct wrapper_audio_device {
struct audio_hw_device device;
struct wrapper::audio_hw_device *wrapped_device;
};
struct wrapper_stream_out {
struct audio_stream_out stream;
struct wrapper::audio_stream_out *wrapped_stream;
};
struct wrapper_stream_in {
struct audio_stream_in stream;
struct wrapper::audio_stream_in *wrapped_stream;
};
/**
* device macros.
*/
#define WRAPPED_DEVICE(d) (((struct wrapper_audio_device*) d)->wrapped_device)
#define WRAPPED_DEVICE_CALL(d, func, ...) ({\
WRAPPED_DEVICE(d)->func(WRAPPED_DEVICE(d), ##__VA_ARGS__); \
})
#define RETURN_WRAPPED_DEVICE_CALL(d, func, ...) ({\
ALOGV("%s", __FUNCTION__); \
return WRAPPED_DEVICE(d)->func(WRAPPED_DEVICE(d), ##__VA_ARGS__); \
})
/**
* Stream in macros.
*/
#define WRAPPED_STREAM_IN(p) (((struct wrapper_stream_in*) p)->wrapped_stream)
#define WRAPPED_STREAM_IN_COMMON(s) (WRAPPED_STREAM_IN(s)->common)
#define WRAPPED_STREAM_IN_COMMON_CALL(s, func, ...) ({\
WRAPPED_STREAM_IN_COMMON(s).func(&WRAPPED_STREAM_IN_COMMON(s), ##__VA_ARGS__); \
})
#define RETURN_WRAPPED_STREAM_IN_CALL(s, func, ...) ({\
ALOGV("%s", __FUNCTION__); \
return WRAPPED_STREAM_IN(s)->func(WRAPPED_STREAM_IN(s), ##__VA_ARGS__); \
})
#define RETURN_WRAPPED_STREAM_IN_COMMON_CALL(s, func, ...) ({\
ALOGV("%s", __FUNCTION__); \
return WRAPPED_STREAM_IN_COMMON(s).func(&WRAPPED_STREAM_IN_COMMON(s), ##__VA_ARGS__); \
})
/**
* Stream out macros.
*/
#define WRAPPED_STREAM_OUT(p) (((struct wrapper_stream_out*) p)->wrapped_stream)
#define WRAPPED_STREAM_OUT_COMMON(s) (WRAPPED_STREAM_OUT(s)->common)
#define WRAPPED_STREAM_OUT_COMMON_CALL(s, func, ...) ({\
WRAPPED_STREAM_OUT_COMMON(s).func(&WRAPPED_STREAM_OUT_COMMON(s), ##__VA_ARGS__); \
})
#define RETURN_WRAPPED_STREAM_OUT_CALL(s, func, ...) ({\
ALOGV("%s", __FUNCTION__); \
return WRAPPED_STREAM_OUT(s)->func(WRAPPED_STREAM_OUT(s), ##__VA_ARGS__); \
})
#define RETURN_WRAPPED_STREAM_OUT_COMMON_CALL(s, func, ...) ({\
ALOGV("%s", __FUNCTION__); \
return WRAPPED_STREAM_OUT_COMMON(s).func(&WRAPPED_STREAM_OUT_COMMON(s), ##__VA_ARGS__); \
})
static uint32_t out_get_sample_rate(const struct audio_stream *stream)
{
RETURN_WRAPPED_STREAM_OUT_COMMON_CALL(stream, get_sample_rate);
}
static int out_set_sample_rate(struct audio_stream *stream, uint32_t rate)
{
RETURN_WRAPPED_STREAM_OUT_COMMON_CALL(stream, set_sample_rate, rate);
}
static size_t out_get_buffer_size(const struct audio_stream *stream)
{
RETURN_WRAPPED_STREAM_OUT_COMMON_CALL(stream, get_buffer_size);
}
static audio_channel_mask_t out_get_channels(const struct audio_stream *stream)
{
RETURN_WRAPPED_STREAM_OUT_COMMON_CALL(stream, get_channels);
}
static audio_format_t out_get_format(const struct audio_stream *stream)
{
RETURN_WRAPPED_STREAM_OUT_COMMON_CALL(stream, get_format);
}
static int out_set_format(struct audio_stream *stream, audio_format_t format)
{
RETURN_WRAPPED_STREAM_OUT_COMMON_CALL(stream, set_format, format);
}
static int out_standby(struct audio_stream *stream)
{
RETURN_WRAPPED_STREAM_OUT_COMMON_CALL(stream, standby);
}
static int out_dump(const struct audio_stream *stream, int fd)
{
RETURN_WRAPPED_STREAM_OUT_COMMON_CALL(stream, dump, fd);
}
static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
{
ALOGI("%s: kvpairs: %s", __FUNCTION__, kvpairs);
int ret;
char * fixed_kvpairs = fixup_audio_parameters(kvpairs, JB_TO_ICS);
ret = WRAPPED_STREAM_OUT_COMMON_CALL(stream, set_parameters, fixed_kvpairs);
free(fixed_kvpairs);
return ret;
}
static char * out_get_parameters(const struct audio_stream *stream, const char *keys)
{
ALOGI("%s: keys: %s", __FUNCTION__, keys);
char * kvpairs = WRAPPED_STREAM_OUT_COMMON_CALL(stream, get_parameters, keys);
char * fixed_kvpairs = fixup_audio_parameters(kvpairs, ICS_TO_JB);
free(kvpairs);
return fixed_kvpairs;
}
static uint32_t out_get_latency(const struct audio_stream_out *stream)
{
RETURN_WRAPPED_STREAM_OUT_CALL(stream, get_latency);
}
static int out_set_volume(struct audio_stream_out *stream, float left,
float right)
{
RETURN_WRAPPED_STREAM_OUT_CALL(stream, set_volume, left, right);
}
static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
size_t bytes)
{
RETURN_WRAPPED_STREAM_OUT_CALL(stream, write, buffer, bytes);
}
static int out_get_render_position(const struct audio_stream_out *stream,
uint32_t *dsp_frames)
{
RETURN_WRAPPED_STREAM_OUT_CALL(stream, get_render_position, dsp_frames);
}
static int out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
RETURN_WRAPPED_STREAM_OUT_COMMON_CALL(stream, add_audio_effect, effect);
}
static int out_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
RETURN_WRAPPED_STREAM_OUT_COMMON_CALL(stream, remove_audio_effect, effect);
}
#if 0
#ifndef ICS_AUDIO_BLOB
static int out_get_next_write_timestamp(const struct audio_stream_out *stream,
int64_t *timestamp)
{
ALOGD("%s", __FUNCTION__);
return android::INVALID_OPERATION;
//RETURN_WRAPPED_STREAM_OUT_CALL(stream, get_next_write_timestamp, timestamp);
}
#endif
#endif
/** audio_stream_in implementation **/
static uint32_t in_get_sample_rate(const struct audio_stream *stream)
{
RETURN_WRAPPED_STREAM_IN_COMMON_CALL(stream, get_sample_rate);
}
static int in_set_sample_rate(struct audio_stream *stream, uint32_t rate)
{
RETURN_WRAPPED_STREAM_IN_COMMON_CALL(stream, set_sample_rate, rate);
}
static size_t in_get_buffer_size(const struct audio_stream *stream)
{
RETURN_WRAPPED_STREAM_IN_COMMON_CALL(stream, get_buffer_size);
}
static audio_channel_mask_t in_get_channels(const struct audio_stream *stream)
{
RETURN_WRAPPED_STREAM_IN_COMMON_CALL(stream, get_channels);
}
static audio_format_t in_get_format(const struct audio_stream *stream)
{
RETURN_WRAPPED_STREAM_IN_COMMON_CALL(stream, get_format);
}
static int in_set_format(struct audio_stream *stream, audio_format_t format)
{
RETURN_WRAPPED_STREAM_IN_COMMON_CALL(stream, set_format, format);
}
static int in_standby(struct audio_stream *stream)
{
RETURN_WRAPPED_STREAM_IN_COMMON_CALL(stream, standby);
}
static int in_dump(const struct audio_stream *stream, int fd)
{
RETURN_WRAPPED_STREAM_IN_COMMON_CALL(stream, dump, fd);
}
static int in_set_parameters(struct audio_stream *stream, const char *kvpairs)
{
ALOGI("%s: kvpairs: %s", __FUNCTION__, kvpairs);
int ret;
char * fixed_kvpairs = fixup_audio_parameters(kvpairs, JB_TO_ICS);
ret = WRAPPED_STREAM_IN_COMMON_CALL(stream, set_parameters, fixed_kvpairs);
free(fixed_kvpairs);
return ret;
}
static char * in_get_parameters(const struct audio_stream *stream,
const char *keys)
{
ALOGI("%s: keys: %s", __FUNCTION__, keys);
char * kvpairs = WRAPPED_STREAM_IN_COMMON_CALL(stream, get_parameters, keys);
char * fixed_kvpairs = fixup_audio_parameters(kvpairs, ICS_TO_JB);
free(kvpairs);
return fixed_kvpairs;
}
static int in_set_gain(struct audio_stream_in *stream, float gain)
{
RETURN_WRAPPED_STREAM_IN_CALL(stream, set_gain, gain);
}
static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
size_t bytes)
{
RETURN_WRAPPED_STREAM_IN_CALL(stream, read, buffer, bytes);
}
static uint32_t in_get_input_frames_lost(struct audio_stream_in *stream)
{
RETURN_WRAPPED_STREAM_IN_CALL(stream, get_input_frames_lost);
}
static int in_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
RETURN_WRAPPED_STREAM_IN_COMMON_CALL(stream, add_audio_effect, effect);
}
static int in_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
RETURN_WRAPPED_STREAM_IN_COMMON_CALL(stream, remove_audio_effect, effect);
}
static int adev_open_output_stream(struct audio_hw_device *dev,
#ifndef ICS_AUDIO_BLOB
audio_io_handle_t handle,
audio_devices_t devices,
audio_output_flags_t flags,
struct audio_config *config,
struct audio_stream_out **stream_out,
const char *address)
#else
uint32_t devices,
int *format, uint32_t *channels,
uint32_t *sample_rate,
struct audio_stream_out **stream_out)
#endif
{
struct wrapper_stream_out *out;
int ret;
ALOGI("%s: devices 0x%x", __FUNCTION__, devices);
out = (struct wrapper_stream_out *)calloc(1, sizeof(struct wrapper_stream_out));
if (!out)
return -ENOMEM;
devices = convert_audio_devices(devices, JB_TO_ICS);
#ifdef ICS_AUDIO_BLOB
ret = WRAPPED_DEVICE_CALL(dev, open_output_stream, devices, format, channels, sample_rate,
&WRAPPED_STREAM_OUT(out));
#else
ret = WRAPPED_DEVICE_CALL(dev, open_output_stream, devices, (int *)&config->format,
&config->channel_mask, &config->sample_rate,
&WRAPPED_STREAM_OUT(out));
#endif
if(ret < 0)
goto err_open;
out->stream.common.get_sample_rate = out_get_sample_rate;
out->stream.common.set_sample_rate = out_set_sample_rate;
out->stream.common.get_buffer_size = out_get_buffer_size;
out->stream.common.get_channels = out_get_channels;
out->stream.common.get_format = out_get_format;
out->stream.common.set_format = out_set_format;
out->stream.common.standby = out_standby;
out->stream.common.dump = out_dump;
out->stream.common.set_parameters = out_set_parameters;
out->stream.common.get_parameters = out_get_parameters;
out->stream.common.add_audio_effect = out_add_audio_effect;
out->stream.common.remove_audio_effect = out_remove_audio_effect;
out->stream.get_latency = out_get_latency;
out->stream.set_volume = out_set_volume;
out->stream.write = out_write;
out->stream.get_render_position = out_get_render_position;
#ifndef ICS_AUDIO_BLOB
out->stream.get_next_write_timestamp = NULL; //out_get_next_write_timestamp;
#endif
*stream_out = &out->stream;
return 0;
err_open:
free(out);
*stream_out = NULL;
return ret;
}
static void adev_close_output_stream(struct audio_hw_device *dev,
struct audio_stream_out *stream)
{
WRAPPED_DEVICE_CALL(dev, close_output_stream, WRAPPED_STREAM_OUT(stream));
free(stream);
}
static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
{
ALOGI("%s: kvpairs: %s", __FUNCTION__, kvpairs);
char *fixed_kvpairs = fixup_audio_parameters(kvpairs, JB_TO_ICS);
int ret = WRAPPED_DEVICE_CALL(dev, set_parameters, fixed_kvpairs);
free(fixed_kvpairs);
return ret;
}
static char * adev_get_parameters(const struct audio_hw_device *dev,
const char *keys)
{
ALOGI("%s: keys: %s", __FUNCTION__, keys);
char *kvpairs = WRAPPED_DEVICE_CALL(dev, get_parameters, keys);
char *fixed_kvpairs = fixup_audio_parameters(kvpairs, ICS_TO_JB);
free(kvpairs);
return fixed_kvpairs;
}
static uint32_t adev_get_supported_devices(const struct audio_hw_device *dev)
{
uint32_t devices = WRAPPED_DEVICE_CALL(dev, get_supported_devices);
return convert_audio_devices(devices, ICS_TO_JB);
}
static int adev_init_check(const struct audio_hw_device *dev)
{
RETURN_WRAPPED_DEVICE_CALL(dev, init_check);
}
static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
{
RETURN_WRAPPED_DEVICE_CALL(dev, set_voice_volume, volume);
}
static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
{
RETURN_WRAPPED_DEVICE_CALL(dev, set_master_volume, volume);
}
#if 0
#ifndef ICS_AUDIO_BLOB
static int adev_get_master_volume(struct audio_hw_device *dev, float *volume)
{
ALOGI("%s", __FUNCTION__);
return 0;
//RETURN_WRAPPED_DEVICE_CALL(dev, get_master_volume, volume);
}
static int adev_set_master_mute(struct audio_hw_device *dev, bool muted)
{
ALOGI("%s", __FUNCTION__);
return 0;
//RETURN_WRAPPED_DEVICE_CALL(dev, set_master_mute, muted);
}
static int adev_get_master_mute(struct audio_hw_device *dev, bool *muted)
{
ALOGI("%s", __FUNCTION__);
return 0;
//RETURN_WRAPPED_DEVICE_CALL(dev, get_master_mute, muted);
}
#endif
#endif
static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
{
RETURN_WRAPPED_DEVICE_CALL(dev, set_mode, mode);
}
static int adev_set_mic_mute(struct audio_hw_device *dev, bool state)
{
RETURN_WRAPPED_DEVICE_CALL(dev, set_mic_mute, state);
}
static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state)
{
RETURN_WRAPPED_DEVICE_CALL(dev, get_mic_mute, state);
}
#ifndef ICS_AUDIO_BLOB
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
const struct audio_config *config)
{
RETURN_WRAPPED_DEVICE_CALL(dev, get_input_buffer_size, config->sample_rate,
config->format, popcount(config->channel_mask));
}
#else
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
uint32_t sample_rate, int format,
int channel_count)
{
RETURN_WRAPPED_DEVICE_CALL(dev, get_input_buffer_size, sample_rate, format,
channel_count);
}
#endif
#ifndef ICS_AUDIO_BLOB
static int adev_open_input_stream(struct audio_hw_device *dev,
audio_io_handle_t handle,
audio_devices_t devices,
struct audio_config *config,
struct audio_stream_in **stream_in,
audio_input_flags_t flags,
const char *address,
audio_source_t source)
#else
static int adev_open_input_stream(struct audio_hw_device *dev, uint32_t devices,
int *format, uint32_t *channels,
uint32_t *sample_rate,
audio_in_acoustics_t acoustics,
struct audio_stream_in **stream_in)
#endif
{
struct wrapper_stream_in *in;
int ret;
ALOGI("%s: devices 0x%x", __FUNCTION__, devices);
in = (struct wrapper_stream_in *)calloc(1, sizeof(struct wrapper_stream_in));
if (!in)
return -ENOMEM;
devices = convert_audio_devices(devices, JB_TO_ICS);
#ifndef ICS_AUDIO_BLOB
ret = WRAPPED_DEVICE_CALL(dev, open_input_stream, devices, (int *)&config->format,
&config->channel_mask, &config->sample_rate,
(audio_in_acoustics_t)0, &WRAPPED_STREAM_IN(in));
#else
ret = WRAPPED_DEVICE_CALL(dev, open_input_stream, devices, format, channels,
sample_rate, acoustics, &WRAPPED_STREAM_IN(in));
#endif
if(ret < 0)
goto err_open;
in->stream.common.get_sample_rate = in_get_sample_rate;
in->stream.common.set_sample_rate = in_set_sample_rate;
in->stream.common.get_buffer_size = in_get_buffer_size;
in->stream.common.get_channels = in_get_channels;
in->stream.common.get_format = in_get_format;
in->stream.common.set_format = in_set_format;
in->stream.common.standby = in_standby;
in->stream.common.dump = in_dump;
in->stream.common.set_parameters = in_set_parameters;
in->stream.common.get_parameters = in_get_parameters;
in->stream.common.add_audio_effect = in_add_audio_effect;
in->stream.common.remove_audio_effect = in_remove_audio_effect;
in->stream.set_gain = in_set_gain;
in->stream.read = in_read;
in->stream.get_input_frames_lost = in_get_input_frames_lost;
*stream_in = &in->stream;
return 0;
err_open:
free(in);
*stream_in = NULL;
return ret;
}
static void adev_close_input_stream(struct audio_hw_device *dev,
struct audio_stream_in *in)
{
WRAPPED_DEVICE_CALL(dev, close_input_stream, WRAPPED_STREAM_IN(in));
free(in);
}
static int adev_dump(const audio_hw_device_t *dev, int fd)
{
RETURN_WRAPPED_DEVICE_CALL(dev, dump, fd);
}
static int adev_close(hw_device_t *dev)
{
ALOGI("%s", __FUNCTION__);
WRAPPED_DEVICE(dev)->common.close((hw_device_t*)&(WRAPPED_DEVICE(dev)));
free(dev);
return 0;
}
static int adev_open(const hw_module_t* module, const char* name,
hw_device_t** device)
{
struct wrapper_audio_device *adev;
int ret;
ALOGI("Wrapping vendor audio primary");
if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
return -EINVAL;
adev = (struct wrapper_audio_device *) calloc(1, sizeof(struct wrapper_audio_device));
if (!adev)
return -ENOMEM;
ret = load_vendor_module(module, name, (hw_device_t**) &adev->wrapped_device,
AUDIO_HARDWARE_MODULE_ID_PRIMARY);
if(ret) {
free(adev);
return ret;
}
adev->device.common.tag = HARDWARE_DEVICE_TAG;
#ifndef ICS_AUDIO_BLOB
adev->device.common.version = AUDIO_DEVICE_API_VERSION_2_0;
#else
adev->device.common.version = AUDIO_DEVICE_API_VERSION_1_0;
#endif
adev->device.common.module = (struct hw_module_t *) module;
adev->device.common.close = adev_close;
adev->device.get_supported_devices = adev_get_supported_devices;
adev->device.init_check = adev_init_check;
adev->device.set_voice_volume = adev_set_voice_volume;
adev->device.set_master_volume = adev_set_master_volume;
#ifndef ICS_AUDIO_BLOB
adev->device.get_master_volume = NULL; //adev_get_master_volume;
adev->device.set_master_mute = NULL; //adev_set_master_mute;
adev->device.get_master_mute = NULL; //adev_get_master_mute;
#endif
adev->device.set_mode = adev_set_mode;
adev->device.set_mic_mute = adev_set_mic_mute;
adev->device.get_mic_mute = adev_get_mic_mute;
adev->device.set_parameters = adev_set_parameters;
adev->device.get_parameters = adev_get_parameters;
adev->device.get_input_buffer_size = adev_get_input_buffer_size;
adev->device.open_output_stream = adev_open_output_stream;
adev->device.open_input_stream = adev_open_input_stream;
adev->device.close_output_stream = adev_close_output_stream;
adev->device.close_input_stream = adev_close_input_stream;
adev->device.dump = adev_dump;
*device = &adev->device.common;
return 0;
}
static struct hw_module_methods_t hal_module_methods = {
.open = adev_open,
};
struct audio_module HAL_MODULE_INFO_SYM = {
.common = {
.tag = HARDWARE_MODULE_TAG,
.module_api_version = AUDIO_MODULE_API_VERSION_0_1,
.hal_api_version = HARDWARE_HAL_API_VERSION,
.id = AUDIO_HARDWARE_MODULE_ID,
.name = "LEGACY Audio HW Wrapper HAL",
.author = "The Android Open Source Project",
.methods = &hal_module_methods,
.dso = NULL,
.reserved = {0},
},
};