diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/usbaudio/Android.mk | 4 | ||||
-rw-r--r-- | modules/usbaudio/alsa_device_profile.c | 4 | ||||
-rw-r--r-- | modules/usbaudio/alsa_device_proxy.c | 2 | ||||
-rw-r--r-- | modules/usbaudio/audio_format.c (renamed from modules/usbaudio/format.c) | 88 | ||||
-rw-r--r-- | modules/usbaudio/audio_format.h (renamed from modules/usbaudio/format.h) | 7 | ||||
-rw-r--r-- | modules/usbaudio/audio_hw.c | 2 | ||||
-rw-r--r-- | modules/usbaudio/audio_logging.c (renamed from modules/usbaudio/logging.c) | 4 | ||||
-rw-r--r-- | modules/usbaudio/audio_logging.h (renamed from modules/usbaudio/logging.h) | 6 |
8 files changed, 16 insertions, 101 deletions
diff --git a/modules/usbaudio/Android.mk b/modules/usbaudio/Android.mk index ec8a8c0..446281d 100644 --- a/modules/usbaudio/Android.mk +++ b/modules/usbaudio/Android.mk @@ -22,8 +22,8 @@ LOCAL_SRC_FILES := \ audio_hw.c \ alsa_device_profile.c \ alsa_device_proxy.c \ - logging.c \ - format.c + audio_logging.c \ + audio_format.c LOCAL_C_INCLUDES += \ external/tinyalsa/include \ $(call include-path-for, audio-utils) diff --git a/modules/usbaudio/alsa_device_profile.c b/modules/usbaudio/alsa_device_profile.c index 8e84471..6397b28 100644 --- a/modules/usbaudio/alsa_device_profile.c +++ b/modules/usbaudio/alsa_device_profile.c @@ -26,8 +26,8 @@ #include <log/log.h> #include "alsa_device_profile.h" -#include "format.h" -#include "logging.h" +#include "audio_format.h" +#include "audio_logging.h" #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) diff --git a/modules/usbaudio/alsa_device_proxy.c b/modules/usbaudio/alsa_device_proxy.c index 081c05b..902a6d2 100644 --- a/modules/usbaudio/alsa_device_proxy.c +++ b/modules/usbaudio/alsa_device_proxy.c @@ -22,7 +22,7 @@ #include "alsa_device_proxy.h" -#include "logging.h" +#include "audio_logging.h" #define DEFAULT_PERIOD_SIZE 1024 #define DEFAULT_PERIOD_COUNT 2 diff --git a/modules/usbaudio/format.c b/modules/usbaudio/audio_format.c index 6aac1d3..63b1ba8 100644 --- a/modules/usbaudio/format.c +++ b/modules/usbaudio/audio_format.c @@ -14,100 +14,16 @@ * limitations under the License. */ -#define LOG_TAG "usb_profile" +#define LOG_TAG "audio_format" /*#define LOG_NDEBUG 0*/ -#include "format.h" +#include "audio_format.h" #include <tinyalsa/asoundlib.h> #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) /* - * Maps from bit position in pcm_mask to AUDIO_ format constants. - */ -static audio_format_t const format_value_map[] = { - AUDIO_FORMAT_PCM_8_BIT, /* 00 - SNDRV_PCM_FORMAT_S8 */ - AUDIO_FORMAT_PCM_8_BIT, /* 01 - SNDRV_PCM_FORMAT_U8 */ - AUDIO_FORMAT_PCM_16_BIT, /* 02 - SNDRV_PCM_FORMAT_S16_LE */ - AUDIO_FORMAT_INVALID, /* 03 - SNDRV_PCM_FORMAT_S16_BE */ - AUDIO_FORMAT_INVALID, /* 04 - SNDRV_PCM_FORMAT_U16_LE */ - AUDIO_FORMAT_INVALID, /* 05 - SNDRV_PCM_FORMAT_U16_BE */ - AUDIO_FORMAT_INVALID, /* 06 - SNDRV_PCM_FORMAT_S24_LE */ - AUDIO_FORMAT_INVALID, /* 07 - SNDRV_PCM_FORMAT_S24_BE */ - AUDIO_FORMAT_INVALID, /* 08 - SNDRV_PCM_FORMAT_U24_LE */ - AUDIO_FORMAT_INVALID, /* 09 - SNDRV_PCM_FORMAT_U24_BE */ - AUDIO_FORMAT_PCM_32_BIT, /* 10 - SNDRV_PCM_FORMAT_S32_LE */ - AUDIO_FORMAT_INVALID, /* 11 - SNDRV_PCM_FORMAT_S32_BE */ - AUDIO_FORMAT_INVALID, /* 12 - SNDRV_PCM_FORMAT_U32_LE */ - AUDIO_FORMAT_INVALID, /* 13 - SNDRV_PCM_FORMAT_U32_BE */ - AUDIO_FORMAT_PCM_FLOAT, /* 14 - SNDRV_PCM_FORMAT_FLOAT_LE */ - AUDIO_FORMAT_INVALID, /* 15 - SNDRV_PCM_FORMAT_FLOAT_BE */ - AUDIO_FORMAT_INVALID, /* 16 - SNDRV_PCM_FORMAT_FLOAT64_LE */ - AUDIO_FORMAT_INVALID, /* 17 - SNDRV_PCM_FORMAT_FLOAT64_BE */ - AUDIO_FORMAT_INVALID, /* 18 - SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE */ - AUDIO_FORMAT_INVALID, /* 19 - SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE */ - AUDIO_FORMAT_INVALID, /* 20 - SNDRV_PCM_FORMAT_MU_LAW */ - AUDIO_FORMAT_INVALID, /* 21 - SNDRV_PCM_FORMAT_A_LAW */ - AUDIO_FORMAT_INVALID, /* 22 - SNDRV_PCM_FORMAT_IMA_ADPCM */ - AUDIO_FORMAT_INVALID, /* 23 - SNDRV_PCM_FORMAT_MPEG */ - AUDIO_FORMAT_INVALID, /* 24 - SNDRV_PCM_FORMAT_GSM */ - AUDIO_FORMAT_INVALID, /* 25 -> 30 (not assigned) */ - AUDIO_FORMAT_INVALID, - AUDIO_FORMAT_INVALID, - AUDIO_FORMAT_INVALID, - AUDIO_FORMAT_INVALID, - AUDIO_FORMAT_INVALID, - AUDIO_FORMAT_INVALID, /* 31 - SNDRV_PCM_FORMAT_SPECIAL */ - AUDIO_FORMAT_PCM_24_BIT_PACKED, /* 32 - SNDRV_PCM_FORMAT_S24_3LE */ - AUDIO_FORMAT_INVALID, /* 33 - SNDRV_PCM_FORMAT_S24_3BE */ - AUDIO_FORMAT_INVALID, /* 34 - SNDRV_PCM_FORMAT_U24_3LE */ - AUDIO_FORMAT_INVALID, /* 35 - SNDRV_PCM_FORMAT_U24_3BE */ - AUDIO_FORMAT_INVALID, /* 36 - SNDRV_PCM_FORMAT_S20_3LE */ - AUDIO_FORMAT_INVALID, /* 37 - SNDRV_PCM_FORMAT_S20_3BE */ - AUDIO_FORMAT_INVALID, /* 38 - SNDRV_PCM_FORMAT_U20_3LE */ - AUDIO_FORMAT_INVALID, /* 39 - SNDRV_PCM_FORMAT_U20_3BE */ - AUDIO_FORMAT_INVALID, /* 40 - SNDRV_PCM_FORMAT_S18_3LE */ - AUDIO_FORMAT_INVALID, /* 41 - SNDRV_PCM_FORMAT_S18_3BE */ - AUDIO_FORMAT_INVALID, /* 42 - SNDRV_PCM_FORMAT_U18_3LE */ - AUDIO_FORMAT_INVALID, /* 43 - SNDRV_PCM_FORMAT_U18_3BE */ - AUDIO_FORMAT_INVALID, /* 44 - SNDRV_PCM_FORMAT_G723_24 */ - AUDIO_FORMAT_INVALID, /* 45 - SNDRV_PCM_FORMAT_G723_24_1B */ - AUDIO_FORMAT_INVALID, /* 46 - SNDRV_PCM_FORMAT_G723_40 */ - AUDIO_FORMAT_INVALID, /* 47 - SNDRV_PCM_FORMAT_G723_40_1B */ - AUDIO_FORMAT_INVALID, /* 48 - SNDRV_PCM_FORMAT_DSD_U8 */ - AUDIO_FORMAT_INVALID /* 49 - SNDRV_PCM_FORMAT_DSD_U16_LE */ -}; - -audio_format_t get_format_for_mask(struct pcm_mask* mask) -{ - int num_slots = sizeof(mask->bits) / sizeof(mask->bits[0]); - int bits_per_slot = sizeof(mask->bits[0]) * 8; - - int table_size = sizeof(format_value_map) / sizeof(format_value_map[0]); - - int slot_index, bit_index, table_index; - table_index = 0; - int num_written = 0; - for (slot_index = 0; slot_index < num_slots; slot_index++) { - unsigned bit_mask = 1; - for (bit_index = 0; bit_index < bits_per_slot; bit_index++) { - /* don't return b-bit formats even if they are supported */ - if (table_index >= 2 && (mask->bits[slot_index] & bit_mask) != 0) { - /* just return the first one */ - return table_index < table_size - ? format_value_map[table_index] - : AUDIO_FORMAT_INVALID; - } - bit_mask <<= 1; - table_index++; - } - } - - return AUDIO_FORMAT_INVALID; -} - -/* * Maps from bit position in pcm_mask to PCM_ format constants. */ int8_t const pcm_format_value_map[50] = { diff --git a/modules/usbaudio/format.h b/modules/usbaudio/audio_format.h index e23935e..712ef67 100644 --- a/modules/usbaudio/format.h +++ b/modules/usbaudio/audio_format.h @@ -14,14 +14,13 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_FORMAT_H -#define ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_FORMAT_H +#ifndef ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_AUDIO_FORMAT_H +#define ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_AUDIO_FORMAT_H #include <system/audio.h> #include <tinyalsa/asoundlib.h> -audio_format_t get_format_for_mask(struct pcm_mask* mask); enum pcm_format get_pcm_format_for_mask(struct pcm_mask* mask); -#endif /* ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_FORMAT_H */ +#endif /* ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_AUDIO_FORMAT_H */ diff --git a/modules/usbaudio/audio_hw.c b/modules/usbaudio/audio_hw.c index 0ee44c5..dec87e7 100644 --- a/modules/usbaudio/audio_hw.c +++ b/modules/usbaudio/audio_hw.c @@ -51,7 +51,7 @@ static const unsigned k_force_channels = 0; #include "alsa_device_profile.h" #include "alsa_device_proxy.h" -#include "logging.h" +#include "audio_logging.h" #define DEFAULT_INPUT_BUFFER_SIZE_MS 20 diff --git a/modules/usbaudio/logging.c b/modules/usbaudio/audio_logging.c index 0a05511..77fbd51 100644 --- a/modules/usbaudio/logging.c +++ b/modules/usbaudio/audio_logging.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#define LOG_TAG "usb_logging" +#define LOG_TAG "audio_logging" /*#define LOG_NDEBUG 0*/ #include <string.h> #include <log/log.h> -#include "logging.h" +#include "audio_logging.h" #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) diff --git a/modules/usbaudio/logging.h b/modules/usbaudio/audio_logging.h index b5640ed..082e8b2 100644 --- a/modules/usbaudio/logging.h +++ b/modules/usbaudio/audio_logging.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_LOGGING_H -#define ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_LOGGING_H +#ifndef ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_AUDIO_LOGGING_H +#define ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_AUDIO_LOGGING_H #include <tinyalsa/asoundlib.h> @@ -23,4 +23,4 @@ void log_pcm_mask(const char* mask_name, struct pcm_mask* mask); void log_pcm_params(struct pcm_params * alsa_hw_params); void log_pcm_config(struct pcm_config * config, const char* label); -#endif /* ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_LOGGING_H */ +#endif /* ANDROID_HARDWARE_LIBHARDWARE_MODULES_USBAUDIO_AUDIO_LOGGING_H */ |