Bluetooth: A2DP sink interface for Audio Focus change and AVRCP 1.3
- Add interface to report audio focus change from Bluetooth Apk to media task for A2DP Sink scenarios. - Add interface to request audiofocus from system/bt. - Add interfaces for AVRCP 1.3. Change-Id: I687ea7be460b3ee3b082db9264621e2e24d04c0c
This commit is contained in:
parent
6815181c0b
commit
eacdbc8b6d
2 changed files with 104 additions and 8 deletions
|
@ -38,13 +38,13 @@ typedef enum {
|
|||
/** Callback for connection state change.
|
||||
* state will have one of the values from btav_connection_state_t
|
||||
*/
|
||||
typedef void (* btav_connection_state_callback)(btav_connection_state_t state,
|
||||
typedef void (* btav_connection_state_callback)(btav_connection_state_t state,
|
||||
bt_bdaddr_t *bd_addr);
|
||||
|
||||
/** Callback for audiopath state change.
|
||||
* state will have one of the values from btav_audio_state_t
|
||||
*/
|
||||
typedef void (* btav_audio_state_callback)(btav_audio_state_t state,
|
||||
typedef void (* btav_audio_state_callback)(btav_audio_state_t state,
|
||||
bt_bdaddr_t *bd_addr);
|
||||
|
||||
/** Callback for audio configuration change.
|
||||
|
@ -57,6 +57,13 @@ typedef void (* btav_audio_config_callback)(bt_bdaddr_t *bd_addr,
|
|||
uint32_t sample_rate,
|
||||
uint8_t channel_count);
|
||||
|
||||
/*
|
||||
* Callback for audio focus request to be used only in
|
||||
* case of A2DP Sink. This is required because we are using
|
||||
* AudioTrack approach for audio data rendering.
|
||||
*/
|
||||
typedef void (* btav_audio_focus_request_callback)(bt_bdaddr_t *bd_addr);
|
||||
|
||||
/** BT-AV callback structure. */
|
||||
typedef struct {
|
||||
/** set to sizeof(btav_callbacks_t) */
|
||||
|
@ -64,17 +71,18 @@ typedef struct {
|
|||
btav_connection_state_callback connection_state_cb;
|
||||
btav_audio_state_callback audio_state_cb;
|
||||
btav_audio_config_callback audio_config_cb;
|
||||
btav_audio_focus_request_callback audio_focus_request_cb;
|
||||
} btav_callbacks_t;
|
||||
|
||||
/**
|
||||
/**
|
||||
* NOTE:
|
||||
*
|
||||
* 1. AVRCP 1.0 shall be supported initially. AVRCP passthrough commands
|
||||
* shall be handled internally via uinput
|
||||
* shall be handled internally via uinput
|
||||
*
|
||||
* 2. A2DP data path shall be handled via a socket pipe between the AudioFlinger
|
||||
* android_audio_hw library and the Bluetooth stack.
|
||||
*
|
||||
*
|
||||
*/
|
||||
/** Represents the standard BT-AV interface.
|
||||
* Used for both the A2DP source and sink interfaces.
|
||||
|
@ -96,6 +104,9 @@ typedef struct {
|
|||
|
||||
/** Closes the interface. */
|
||||
void (*cleanup)( void );
|
||||
|
||||
/** Sends Audio Focus State. */
|
||||
void (*audio_focus_state)( int focus_state );
|
||||
} btav_interface_t;
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -103,6 +103,36 @@ typedef struct {
|
|||
uint8_t attr_values[BTRC_MAX_APP_SETTINGS];
|
||||
} btrc_player_settings_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t val;
|
||||
uint16_t charset_id;
|
||||
uint16_t str_len;
|
||||
uint8_t *p_str;
|
||||
} btrc_player_app_ext_attr_val_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t attr_id;
|
||||
uint16_t charset_id;
|
||||
uint16_t str_len;
|
||||
uint8_t *p_str;
|
||||
uint8_t num_val;
|
||||
btrc_player_app_ext_attr_val_t ext_attr_val[BTRC_MAX_APP_ATTR_SIZE];
|
||||
} btrc_player_app_ext_attr_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t attr_id;
|
||||
uint8_t num_val;
|
||||
uint8_t attr_val[BTRC_MAX_APP_ATTR_SIZE];
|
||||
} btrc_player_app_attr_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t start_item;
|
||||
uint32_t end_item;
|
||||
uint32_t size;
|
||||
uint32_t attrs[BTRC_MAX_ELEM_ATTR_SIZE];
|
||||
uint8_t attr_count;
|
||||
} btrc_getfolderitem_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
btrc_play_status_t play_status;
|
||||
|
@ -264,14 +294,53 @@ typedef struct {
|
|||
|
||||
typedef void (* btrc_passthrough_rsp_callback) (int id, int key_state);
|
||||
|
||||
typedef void (* btrc_groupnavigation_rsp_callback) (int id, int key_state);
|
||||
|
||||
typedef void (* btrc_connection_state_callback) (bool state, bt_bdaddr_t *bd_addr);
|
||||
|
||||
typedef void (* btrc_ctrl_getrcfeatures_callback) (bt_bdaddr_t *bd_addr, int features);
|
||||
|
||||
typedef void (* btrc_ctrl_setabsvol_cmd_callback) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
|
||||
|
||||
typedef void (* btrc_ctrl_registernotification_abs_vol_callback) (bt_bdaddr_t *bd_addr, uint8_t label);
|
||||
|
||||
typedef void (* btrc_ctrl_setplayerapplicationsetting_rsp_callback) (bt_bdaddr_t *bd_addr,
|
||||
uint8_t accepted);
|
||||
|
||||
typedef void (* btrc_ctrl_playerapplicationsetting_callback)(bt_bdaddr_t *bd_addr,
|
||||
uint8_t num_attr,
|
||||
btrc_player_app_attr_t *app_attrs,
|
||||
uint8_t num_ext_attr,
|
||||
btrc_player_app_ext_attr_t *ext_attrs);
|
||||
|
||||
typedef void (* btrc_ctrl_playerapplicationsetting_changed_callback)(bt_bdaddr_t *bd_addr,
|
||||
btrc_player_settings_t *p_vals);
|
||||
|
||||
typedef void (* btrc_ctrl_track_changed_callback)(bt_bdaddr_t *bd_addr, uint8_t num_attr,
|
||||
btrc_element_attr_val_t *p_attrs);
|
||||
|
||||
typedef void (* btrc_ctrl_play_position_changed_callback)(bt_bdaddr_t *bd_addr,
|
||||
uint32_t song_len, uint32_t song_pos);
|
||||
|
||||
typedef void (* btrc_ctrl_play_status_changed_callback)(bt_bdaddr_t *bd_addr,
|
||||
btrc_play_status_t play_status);
|
||||
|
||||
/** BT-RC Controller callback structure. */
|
||||
typedef struct {
|
||||
/** set to sizeof(BtRcCallbacks) */
|
||||
size_t size;
|
||||
btrc_passthrough_rsp_callback passthrough_rsp_cb;
|
||||
btrc_connection_state_callback connection_state_cb;
|
||||
btrc_passthrough_rsp_callback passthrough_rsp_cb;
|
||||
btrc_groupnavigation_rsp_callback groupnavigation_rsp_cb;
|
||||
btrc_connection_state_callback connection_state_cb;
|
||||
btrc_ctrl_getrcfeatures_callback getrcfeatures_cb;
|
||||
btrc_ctrl_setplayerapplicationsetting_rsp_callback setplayerappsetting_rsp_cb;
|
||||
btrc_ctrl_playerapplicationsetting_callback playerapplicationsetting_cb;
|
||||
btrc_ctrl_playerapplicationsetting_changed_callback playerapplicationsetting_changed_cb;
|
||||
btrc_ctrl_setabsvol_cmd_callback setabsvol_cmd_cb;
|
||||
btrc_ctrl_registernotification_abs_vol_callback registernotification_absvol_cb;
|
||||
btrc_ctrl_track_changed_callback track_changed_cb;
|
||||
btrc_ctrl_play_position_changed_callback play_position_changed_cb;
|
||||
btrc_ctrl_play_status_changed_callback play_status_changed_cb;
|
||||
} btrc_ctrl_callbacks_t;
|
||||
|
||||
/** Represents the standard BT-RC AVRCP Controller interface. */
|
||||
|
@ -285,7 +354,23 @@ typedef struct {
|
|||
bt_status_t (*init)( btrc_ctrl_callbacks_t* callbacks );
|
||||
|
||||
/** send pass through command to target */
|
||||
bt_status_t (*send_pass_through_cmd) ( bt_bdaddr_t *bd_addr, uint8_t key_code, uint8_t key_state );
|
||||
bt_status_t (*send_pass_through_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
|
||||
uint8_t key_state );
|
||||
|
||||
/** send group navigation command to target */
|
||||
bt_status_t (*send_group_navigation_cmd) (bt_bdaddr_t *bd_addr, uint8_t key_code,
|
||||
uint8_t key_state );
|
||||
|
||||
/** send command to set player applicaiton setting attributes to target */
|
||||
bt_status_t (*set_player_app_setting_cmd) (bt_bdaddr_t *bd_addr, uint8_t num_attrib,
|
||||
uint8_t* attrib_ids, uint8_t* attrib_vals);
|
||||
|
||||
/** send rsp to set_abs_vol received from target */
|
||||
bt_status_t (*set_volume_rsp) (bt_bdaddr_t *bd_addr, uint8_t abs_vol, uint8_t label);
|
||||
|
||||
/** send notificaiton rsp for abs vol to target */
|
||||
bt_status_t (*register_abs_vol_rsp) (bt_bdaddr_t *bd_addr, btrc_notification_type_t rsp_type,
|
||||
uint8_t abs_vol, uint8_t label);
|
||||
|
||||
/** Closes the interface. */
|
||||
void (*cleanup)( void );
|
||||
|
|
Loading…
Reference in a new issue