1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_ALSA_DEVICE_PROXY_H 18 #define ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_ALSA_DEVICE_PROXY_H 19 20 #include <tinyalsa/asoundlib.h> 21 22 #include "alsa_device_profile.h" 23 24 typedef struct { 25 alsa_device_profile* profile; 26 27 struct pcm_config alsa_config; 28 29 struct pcm * pcm; 30 } alsa_device_proxy; 31 32 void proxy_prepare(alsa_device_proxy * proxy, alsa_device_profile * profile, 33 struct pcm_config * config); 34 35 unsigned proxy_get_sample_rate(const alsa_device_proxy * proxy); 36 enum pcm_format proxy_get_format(const alsa_device_proxy * proxy); 37 unsigned proxy_get_channel_count(const alsa_device_proxy * proxy); 38 39 unsigned int proxy_get_period_size(const alsa_device_proxy * proxy); 40 41 unsigned proxy_get_latency(const alsa_device_proxy * proxy); 42 43 int proxy_open(alsa_device_proxy * proxy); 44 void proxy_close(alsa_device_proxy * proxy); 45 46 int proxy_write(const alsa_device_proxy * proxy, const void *data, unsigned int count); 47 int proxy_read(const alsa_device_proxy * proxy, void *data, unsigned int count); 48 49 #endif /* ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_ALSA_DEVICE_PROXY_H */ 50