audio.h File Reference
#include <stdint.h>
#include <strings.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <cutils/bitops.h>
#include <hardware/hardware.h>
#include <system/audio.h>
#include <hardware/audio_effect.h>

Go to the source code of this file.

Data Structures

struct  audio_stream
 
struct  audio_stream_out
 
struct  audio_stream_in
 
struct  audio_module
 
struct  audio_hw_device
 

Macros

#define AUDIO_HARDWARE_MODULE_ID   "audio"
 
#define AUDIO_HARDWARE_INTERFACE   "audio_hw_if"
 
#define AUDIO_MODULE_API_VERSION_0_1   HARDWARE_MODULE_API_VERSION(0, 1)
 
#define AUDIO_MODULE_API_VERSION_CURRENT   AUDIO_MODULE_API_VERSION_0_1
 
#define AUDIO_DEVICE_API_VERSION_0_0   HARDWARE_DEVICE_API_VERSION(0, 0)
 
#define AUDIO_DEVICE_API_VERSION_1_0   HARDWARE_DEVICE_API_VERSION(1, 0)
 
#define AUDIO_DEVICE_API_VERSION_2_0   HARDWARE_DEVICE_API_VERSION(2, 0)
 
#define AUDIO_DEVICE_API_VERSION_3_0   HARDWARE_DEVICE_API_VERSION(3, 0)
 
#define AUDIO_DEVICE_API_VERSION_CURRENT   AUDIO_DEVICE_API_VERSION_3_0
 
#define AUDIO_DEVICE_API_VERSION_MIN   AUDIO_DEVICE_API_VERSION_2_0
 
#define AUDIO_HARDWARE_MODULE_ID_PRIMARY   "primary"
 
#define AUDIO_HARDWARE_MODULE_ID_A2DP   "a2dp"
 
#define AUDIO_HARDWARE_MODULE_ID_USB   "usb"
 
#define AUDIO_HARDWARE_MODULE_ID_REMOTE_SUBMIX   "r_submix"
 
#define AUDIO_HARDWARE_MODULE_ID_CODEC_OFFLOAD   "codec_offload"
 
#define AUDIO_PARAMETER_KEY_BT_NREC   "bt_headset_nrec"
 
#define AUDIO_PARAMETER_VALUE_ON   "on"
 
#define AUDIO_PARAMETER_VALUE_OFF   "off"
 
#define AUDIO_PARAMETER_KEY_TTY_MODE   "tty_mode"
 
#define AUDIO_PARAMETER_VALUE_TTY_OFF   "tty_off"
 
#define AUDIO_PARAMETER_VALUE_TTY_VCO   "tty_vco"
 
#define AUDIO_PARAMETER_VALUE_TTY_HCO   "tty_hco"
 
#define AUDIO_PARAMETER_VALUE_TTY_FULL   "tty_full"
 
#define AUDIO_PARAMETER_KEY_HAC   "HACSetting"
 
#define AUDIO_PARAMETER_VALUE_HAC_ON   "ON"
 
#define AUDIO_PARAMETER_VALUE_HAC_OFF   "OFF"
 
#define AUDIO_PARAMETER_A2DP_SINK_ADDRESS   "a2dp_sink_address"
 
#define AUDIO_PARAMETER_A2DP_SOURCE_ADDRESS   "a2dp_source_address"
 
#define AUDIO_PARAMETER_KEY_SCREEN_STATE   "screen_state"
 
#define AUDIO_PARAMETER_KEY_BT_SCO_WB   "bt_wbs"
 
#define AUDIO_PARAMETER_HW_AV_SYNC   "hw_av_sync"
 
#define AUDIO_PARAMETER_STREAM_ROUTING   "routing" /* audio_devices_t */
 
#define AUDIO_PARAMETER_STREAM_FORMAT   "format" /* audio_format_t */
 
#define AUDIO_PARAMETER_STREAM_CHANNELS   "channels" /* audio_channel_mask_t */
 
#define AUDIO_PARAMETER_STREAM_FRAME_COUNT   "frame_count" /* size_t */
 
#define AUDIO_PARAMETER_STREAM_INPUT_SOURCE   "input_source" /* audio_source_t */
 
#define AUDIO_PARAMETER_STREAM_SAMPLING_RATE   "sampling_rate" /* uint32_t */
 
#define AUDIO_PARAMETER_DEVICE_CONNECT   "connect" /* audio_devices_t */
 
#define AUDIO_PARAMETER_DEVICE_DISCONNECT   "disconnect" /* audio_devices_t */
 
#define AUDIO_PARAMETER_STREAM_SUP_FORMATS   "sup_formats"
 
#define AUDIO_PARAMETER_STREAM_SUP_CHANNELS   "sup_channels"
 
#define AUDIO_PARAMETER_STREAM_SUP_SAMPLING_RATES   "sup_sampling_rates"
 
#define AUDIO_PARAMETER_STREAM_HW_AV_SYNC   "hw_av_sync"
 
#define AUDIO_OFFLOAD_CODEC_PARAMS   "music_offload_codec_param"
 
#define AUDIO_OFFLOAD_CODEC_BIT_PER_SAMPLE   "music_offload_bit_per_sample"
 
#define AUDIO_OFFLOAD_CODEC_BIT_RATE   "music_offload_bit_rate"
 
#define AUDIO_OFFLOAD_CODEC_AVG_BIT_RATE   "music_offload_avg_bit_rate"
 
#define AUDIO_OFFLOAD_CODEC_ID   "music_offload_codec_id"
 
#define AUDIO_OFFLOAD_CODEC_BLOCK_ALIGN   "music_offload_block_align"
 
#define AUDIO_OFFLOAD_CODEC_SAMPLE_RATE   "music_offload_sample_rate"
 
#define AUDIO_OFFLOAD_CODEC_ENCODE_OPTION   "music_offload_encode_option"
 
#define AUDIO_OFFLOAD_CODEC_NUM_CHANNEL   "music_offload_num_channels"
 
#define AUDIO_OFFLOAD_CODEC_DOWN_SAMPLING   "music_offload_down_sampling"
 
#define AUDIO_OFFLOAD_CODEC_DELAY_SAMPLES   "delay_samples"
 
#define AUDIO_OFFLOAD_CODEC_PADDING_SAMPLES   "padding_samples"
 

Typedefs

typedef struct audio_stream audio_stream_t
 
typedef int(* stream_callback_t )(stream_callback_event_t event, void *param, void *cookie)
 
typedef struct audio_stream_out audio_stream_out_t
 
typedef struct audio_stream_in audio_stream_in_t
 
typedef struct audio_hw_device audio_hw_device_t
 

Enumerations

enum  stream_callback_event_t { STREAM_CBK_EVENT_WRITE_READY, STREAM_CBK_EVENT_DRAIN_READY }
 
enum  audio_drain_type_t { AUDIO_DRAIN_ALL, AUDIO_DRAIN_EARLY_NOTIFY }
 

Functions

 __attribute__ ((__deprecated__)) static inline size_t audio_stream_frame_size(const struct audio_stream *s)
 

Macro Definition Documentation

#define AUDIO_DEVICE_API_VERSION_0_0   HARDWARE_DEVICE_API_VERSION(0, 0)

Definition at line 54 of file audio.h.

#define AUDIO_DEVICE_API_VERSION_1_0   HARDWARE_DEVICE_API_VERSION(1, 0)

Definition at line 55 of file audio.h.

#define AUDIO_DEVICE_API_VERSION_2_0   HARDWARE_DEVICE_API_VERSION(2, 0)

Definition at line 56 of file audio.h.

#define AUDIO_DEVICE_API_VERSION_3_0   HARDWARE_DEVICE_API_VERSION(3, 0)

Definition at line 57 of file audio.h.

#define AUDIO_DEVICE_API_VERSION_CURRENT   AUDIO_DEVICE_API_VERSION_3_0

Definition at line 58 of file audio.h.

#define AUDIO_DEVICE_API_VERSION_MIN   AUDIO_DEVICE_API_VERSION_2_0

Definition at line 60 of file audio.h.

#define AUDIO_HARDWARE_INTERFACE   "audio_hw_if"

Name of the audio devices to open

Definition at line 42 of file audio.h.

#define AUDIO_HARDWARE_MODULE_ID   "audio"

The id of this module

Definition at line 37 of file audio.h.

#define AUDIO_HARDWARE_MODULE_ID_A2DP   "a2dp"

Definition at line 70 of file audio.h.

#define AUDIO_HARDWARE_MODULE_ID_CODEC_OFFLOAD   "codec_offload"

Definition at line 73 of file audio.h.

#define AUDIO_HARDWARE_MODULE_ID_PRIMARY   "primary"

List of known audio HAL modules. This is the base name of the audio HAL library composed of the "audio." prefix, one of the base names below and a suffix specific to the device. e.g: audio.primary.goldfish.so or audio.a2dp.default.so

Definition at line 69 of file audio.h.

#define AUDIO_HARDWARE_MODULE_ID_REMOTE_SUBMIX   "r_submix"

Definition at line 72 of file audio.h.

#define AUDIO_HARDWARE_MODULE_ID_USB   "usb"

Definition at line 71 of file audio.h.

#define AUDIO_MODULE_API_VERSION_0_1   HARDWARE_MODULE_API_VERSION(0, 1)

Definition at line 48 of file audio.h.

#define AUDIO_MODULE_API_VERSION_CURRENT   AUDIO_MODULE_API_VERSION_0_1

Definition at line 49 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_AVG_BIT_RATE   "music_offload_avg_bit_rate"

Definition at line 154 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_BIT_PER_SAMPLE   "music_offload_bit_per_sample"

Definition at line 152 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_BIT_RATE   "music_offload_bit_rate"

Definition at line 153 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_BLOCK_ALIGN   "music_offload_block_align"

Definition at line 156 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_DELAY_SAMPLES   "delay_samples"

Definition at line 161 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_DOWN_SAMPLING   "music_offload_down_sampling"

Definition at line 160 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_ENCODE_OPTION   "music_offload_encode_option"

Definition at line 158 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_ID   "music_offload_codec_id"

Definition at line 155 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_NUM_CHANNEL   "music_offload_num_channels"

Definition at line 159 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_PADDING_SAMPLES   "padding_samples"

Definition at line 162 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_PARAMS   "music_offload_codec_param"

audio codec parameters

Definition at line 151 of file audio.h.

#define AUDIO_OFFLOAD_CODEC_SAMPLE_RATE   "music_offload_sample_rate"

Definition at line 157 of file audio.h.

#define AUDIO_PARAMETER_A2DP_SINK_ADDRESS   "a2dp_sink_address"

Definition at line 104 of file audio.h.

#define AUDIO_PARAMETER_A2DP_SOURCE_ADDRESS   "a2dp_source_address"

Definition at line 107 of file audio.h.

#define AUDIO_PARAMETER_DEVICE_CONNECT   "connect" /* audio_devices_t */

Definition at line 131 of file audio.h.

#define AUDIO_PARAMETER_DEVICE_DISCONNECT   "disconnect" /* audio_devices_t */

Definition at line 132 of file audio.h.

#define AUDIO_PARAMETER_HW_AV_SYNC   "hw_av_sync"

Definition at line 118 of file audio.h.

#define AUDIO_PARAMETER_KEY_BT_NREC   "bt_headset_nrec"

standard audio parameters that the HAL may need to handle audio device parameters

Definition at line 86 of file audio.h.

#define AUDIO_PARAMETER_KEY_BT_SCO_WB   "bt_wbs"

Definition at line 113 of file audio.h.

#define AUDIO_PARAMETER_KEY_HAC   "HACSetting"

Definition at line 99 of file audio.h.

#define AUDIO_PARAMETER_KEY_SCREEN_STATE   "screen_state"

Definition at line 110 of file audio.h.

#define AUDIO_PARAMETER_KEY_TTY_MODE   "tty_mode"

Definition at line 91 of file audio.h.

#define AUDIO_PARAMETER_STREAM_CHANNELS   "channels" /* audio_channel_mask_t */

Definition at line 126 of file audio.h.

#define AUDIO_PARAMETER_STREAM_FORMAT   "format" /* audio_format_t */

Definition at line 125 of file audio.h.

#define AUDIO_PARAMETER_STREAM_FRAME_COUNT   "frame_count" /* size_t */

Definition at line 127 of file audio.h.

#define AUDIO_PARAMETER_STREAM_HW_AV_SYNC   "hw_av_sync"

Definition at line 145 of file audio.h.

#define AUDIO_PARAMETER_STREAM_INPUT_SOURCE   "input_source" /* audio_source_t */

Definition at line 128 of file audio.h.

#define AUDIO_PARAMETER_STREAM_ROUTING   "routing" /* audio_devices_t */

audio stream parameters

Definition at line 124 of file audio.h.

#define AUDIO_PARAMETER_STREAM_SAMPLING_RATE   "sampling_rate" /* uint32_t */

Definition at line 129 of file audio.h.

#define AUDIO_PARAMETER_STREAM_SUP_CHANNELS   "sup_channels"

Definition at line 139 of file audio.h.

#define AUDIO_PARAMETER_STREAM_SUP_FORMATS   "sup_formats"

Definition at line 136 of file audio.h.

#define AUDIO_PARAMETER_STREAM_SUP_SAMPLING_RATES   "sup_sampling_rates"

Definition at line 142 of file audio.h.

#define AUDIO_PARAMETER_VALUE_HAC_OFF   "OFF"

Definition at line 101 of file audio.h.

#define AUDIO_PARAMETER_VALUE_HAC_ON   "ON"

Definition at line 100 of file audio.h.

#define AUDIO_PARAMETER_VALUE_OFF   "off"

Definition at line 88 of file audio.h.

#define AUDIO_PARAMETER_VALUE_ON   "on"

Definition at line 87 of file audio.h.

#define AUDIO_PARAMETER_VALUE_TTY_FULL   "tty_full"

Definition at line 95 of file audio.h.

#define AUDIO_PARAMETER_VALUE_TTY_HCO   "tty_hco"

Definition at line 94 of file audio.h.

#define AUDIO_PARAMETER_VALUE_TTY_OFF   "tty_off"

Definition at line 92 of file audio.h.

#define AUDIO_PARAMETER_VALUE_TTY_VCO   "tty_vco"

Definition at line 93 of file audio.h.

Typedef Documentation

Definition at line 653 of file audio.h.

Definition at line 432 of file audio.h.

Definition at line 399 of file audio.h.

typedef struct audio_stream audio_stream_t

Definition at line 248 of file audio.h.

typedef int(* stream_callback_t)(stream_callback_event_t event, void *param, void *cookie)

Definition at line 256 of file audio.h.

Enumeration Type Documentation

Enumerator
AUDIO_DRAIN_ALL 
AUDIO_DRAIN_EARLY_NOTIFY 

Definition at line 259 of file audio.h.

Enumerator
STREAM_CBK_EVENT_WRITE_READY 
STREAM_CBK_EVENT_DRAIN_READY 

Definition at line 251 of file audio.h.

Function Documentation

__attribute__ ( (__deprecated__)  ) const

return the frame size (number of bytes per sample).

Deprecated: use audio_stream_out_frame_size() or audio_stream_in_frame_size() instead.

Definition at line 439 of file audio.h.