A2DP Application Functions
APP_A2DP API Brief
Application |
Brief |
|---|---|
application for setting stream data fill buffer address |
|
stream codec close and the other related variables reset |
|
application for reset ring buffer and related variables |
|
application for stream codec initialize |
|
application for stream data process |
|
application to get samples of per frame |
|
application to get samples rate |
|
application to get samples of per packet |
|
application to get frames of per packet |
|
application to get filled number of nodes in ring buffer |
|
stream codec close and the other related variables reset |
|
application to get filled number of nodes in ring buffer |
|
application to get size of filled data from dac dma buffer |
|
application to fill stream data to ring buffer |
|
application to set packet sequence number and frame sequence number |
|
application to get last filled in p_audio_env->audio_a2dp_frame_nodes ring buffer sequence number |
|
application to get start frame sequence number from app_a2dp_audio_ctrl |
|
application to get resync status |
|
application to get local currently tws link exist or not status |
|
application to get from app_a2dp_audio_ctrl.async_ctrl.tws_resync |
|
application to received a2dp stream data |
APP_A2DP API Reference
Header File
Functions
-
void app_a2dp_dac_fill_music_buffer_start(bool from_start)
application for setting stream data fill buffer address
- 参数:
from_start – [in] true is copy audio_dac_music_rb start address to audio_dac_music_rb false is copy audio_dac_music_rb middle address of audio_dac_music_rb
- 返回:
N/A
-
void app_a2dp_stream_codec_deinit(void)
stream codec close and the other related variables reset
- 返回:
N/A
-
void app_a2dp_reset_playback_buffer(uint32_t codec_type)
application for reset ring buffer and related variables
- 参数:
codec_type – [in] codec type,btif_a2dp_codec_type_t
- 返回:
N/A
-
void app_a2dp_stream_codec_init(uint32_t codec_type, uint32_t sample_rate, uint32_t channels, uint16_t frame_cnt_per_pkt, uint8_t vol)
application for stream codec initialize
include app_audio_init,app_audio_dac_open,ring_buffer_node_init,bt_a2dp_aac_decoder_init
- 参数:
codec_type – [in] codec type,btif_a2dp_codec_type_t
sample_rate – [in] sampling rate(etc 44100,48000,96000) depends on cell phone setting
channels – [in] audio channel(etc 1,2) channels depends on cell phone setting
frame_cnt_per_pkt – [in] frame count per sbc media packet.
vol – [in] music volume
- 返回:
N/A
-
uint32_t app_a2dp_stream_process(audio_trigger_type_t trigger_type)
application for stream data process
- 参数:
trigger_type – [in] BTIF_A2DP_CODEC_SBC,BTIF_A2DP_CODEC_MPEG_2_4_AAC,BTIF_A2DP_CODEC_LDAC
- 返回值:
1 – codec already initialize can process stream data
0 – can not process stream data
- 返回:
result
-
uint32_t app_a2dp_get_samples_per_frame(void)
application to get samples of per frame
- 返回:
samples samples of per frame(etc: AUDIO_A2DP_SBC_SAMPLES_PER_FRAME)
-
uint32_t app_a2dp_get_music_sample_rate(void)
application to get samples rate
get from g_audio_env.audio_dac_music_sample_rate variable
- 返回值:
44100 – 44.1K sampling rate
48000 – 48K sampling rate
96000 – 96K sampling rate
- 返回:
samples rate
-
uint32_t app_a2dp_get_samples_per_packet(void)
application to get samples of per packet
get from (g_audio_env.frames_per_packet * app_a2dp_get_samples_per_frame())
- 返回值:
This – is dynamic value from cell phone,when each call app_a2dp_fill_stream_buffering to fresh
- 返回:
samples_per_packet
-
uint32_t app_a2dp_get_frames_per_packet(void)
application to get frames of per packet
get from (g_audio_env.frames_per_packet)
- 返回值:
This – is dynamic value from cell phone,when each call app_a2dp_fill_stream_buffering to fresh
- 返回:
frames_per_packet
-
uint32_t app_a2dp_get_filled_frame(void)
application to get filled number of nodes in ring buffer
get from filled nodes of g_audio_env.audio_a2dp_frame_nodes ring buffer
- 返回:
number of filled nodes
-
uint32_t app_a2dp_dac_get_free_music_buffer_size(void)
application to get filled number of nodes in ring buffer
get from free nodes of g_audio_env.audio_dac_music_rb ring buffer free_size = rb->capacity - ring_buffer_get_fill_size(rb);
- 返回:
number of free nodes
-
uint32_t app_a2dp_dac_get_fill_music_buffer_size(void)
application to get size of filled data from dac dma buffer
- 返回:
filled data size of DAC DMA buffer
-
void app_a2dp_fill_stream_buffering(uint32_t codec_type, uint8_t *p_data, uint32_t dlen, uint32_t pac_seq, uint32_t frame_seq, uint8_t cp_len)
application to fill stream data to ring buffer
fill stream data to p_audio_env->audio_a2dp_frame_nodes of ring buffer packet format : Media Packet Header(12Bytes) + Content Protection Header(1Byte) + mdia Payload
- 参数:
codec_type – [in] codec type btif_a2dp_codec_type_t
*p_data – [in] store a2dp rx stream packet data address
dlen – [in] a2dp rx stream data length include stream data packet header length
pac_seq – [in] packet sequence number
frame_seq – [in] frame sequence number
cp_len – [in] Content Protection Header length
- 返回:
N/A
-
void app_a2dp_init_decode_seq(uint32_t pac_seq, uint32_t frame_seq)
application to set packet sequence number and frame sequence number
set packet sequence and frame sequence number to g_audio_env environment variable
- 参数:
pac_seq – [in] packet sequence number
frame_seq – [in] frame sequence number
- 返回:
N/A
-
uint32_t app_a2dp_get_last_seq(void)
application to get last filled in p_audio_env->audio_a2dp_frame_nodes ring buffer sequence number
- 返回:
last sequence number
-
uint16_t app_a2dp_async_get_frame_seq(void)
application to get start frame sequence number from app_a2dp_audio_ctrl
usually used in TWS_SLAVE and TWS_MASTER sync music stream
- 返回:
start frame sequence number of app_a2dp_audio_ctrl
-
bool app_a2dp_resync_is_ongoing(void)
application to get resync status
- 返回值:
true – currently re-sync
false – currently not re-sync
- 返回:
resync status
-
bool app_a2dp_resync_get_tws_resync(void)
application to get local currently tws link exist or not status
- 返回值:
true – tws link exist only or tws link exist and mobile profile sync done
false – tws link not exist or tws link exist but mobile profile sync not done
- 返回:
tws link exist status
-
bool app_a2dp_resync_is_tws_resync(void)
application to get from app_a2dp_audio_ctrl.async_ctrl.tws_resync
Usage Scenarios : Identify tws link is from disconnected to connected(tws sync profile done)
- 返回值:
true – app_a2dp_audio_ctrl.async_ctrl.tws_resync is true
false – app_a2dp_audio_ctrl.async_ctrl.tws_resync is false
- 返回:
tws_resync
-
void app_a2dp_rx_stream_data(const uint8_t *p_data, uint16_t len, uint32_t pac_seq, uint32_t frame_seq, uint8_t cp_len)
application to received a2dp stream data
upper caller is bt_audio_dsp_rx_a2dp_stream_data Media Packet Header(12Bytes) + Content Protection Header(1Byte) + mdia Payload
- 参数:
*p_data – [in] store a2dp rx stream packet data address
len – [in] rx stream data length include header length
pac_seq – [in] packet sequence number
frame_seq – [in] frame sequence number
cp_len – [in] Content Protection Header length
- 返回:
N/A
Structures
-
struct app_a2dp_sync_ctrl_t
Macros
-
DAC_SBC_RING_BUFF_SIZE
-
DAC_AAC_RING_BUFF_SIZE
-
DAC_LDAC_RING_BUFF_SIZE