Manages the set of A2DPEncoder instances registered via BluetoothA2DPSource::add_encoder(), delegates encode operations to whichever one matches the codec negotiated with the connected sink and packs the encoded frames into A2DP media packets that are sent with esp_a2d_source_audio_data_send().
More...
#include <A2DPEncoder.h>
|
| bool | add_encoder (A2DPEncoder &encoder) |
| |
| std::vector< A2DPEncoder * > & | all_encoders () |
| |
| bool | apply_mcc (const esp_a2d_mcc_t *mcc) |
| |
|
void | close () |
| | Closes the active encoder (if any) and drops any unsent data.
|
| |
|
audio_tools::AudioInfo | get_audio_info () |
| | Negotiated sample rate/channels of the active encoder.
|
| |
|
bool | has_encoders () |
| | True if at least one encoder has been registered.
|
| |
|
bool | is_active () |
| | True if an encoder has been selected and opened.
|
| |
|
const char * | mime () |
| | MIME type of the currently active encoder ("" if none is active)
|
| |
| size_t | process (const uint8_t *pcm, size_t len) |
| |
|
void | reset () |
| | Restarts the media packet timestamp and drops any unsent data.
|
| |
| int | sample_rate () |
| |
|
void | set_connection_handle (esp_a2d_conn_hdl_t hdl) |
| | Defines the connection handle used for sending.
|
| |
|
void | set_mtu (uint16_t mtu) |
| | Defines the MTU of the audio connection.
|
| |
| void | write_frame (const uint8_t *data, size_t len, uint32_t samples) override |
| |
|
|
A2DPEncoder * | find (esp_a2d_mct_t type) |
| |
|
void | free_pending () |
| |
|
uint16_t | max_payload () |
| | max payload of a media packet
|
| |
|
void | send_pending () |
| | sends the pending media packet
|
| |
|
|
A2DPEncoder * | active = nullptr |
| |
|
esp_a2d_conn_hdl_t | conn_hdl = 0 |
| |
|
std::vector< A2DPEncoder * > | encoders |
| |
|
bool | is_mtu_warning_logged = false |
| |
|
uint16_t | mtu = 0 |
| |
|
esp_a2d_audio_buff_t * | pending = nullptr |
| |
|
uint32_t | timestamp = 0 |
| |
Manages the set of A2DPEncoder instances registered via BluetoothA2DPSource::add_encoder(), delegates encode operations to whichever one matches the codec negotiated with the connected sink and packs the encoded frames into A2DP media packets that are sent with esp_a2d_source_audio_data_send().
- Author
- Phil Schatzmann
- Copyright
- Apache License Version 2
◆ add_encoder()
| bool A2DPAudioEncoder::add_encoder |
( |
A2DPEncoder & |
encoder | ) |
|
Registers an encoder for its codec_type(); returns false if an encoder for that codec type is already registered
◆ all_encoders()
| std::vector< A2DPEncoder * > & A2DPAudioEncoder::all_encoders |
( |
| ) |
|
|
inline |
All registered encoders, in registration order - used to drive SEP registration (one stream endpoint per entry)
◆ apply_mcc()
| bool A2DPAudioEncoder::apply_mcc |
( |
const esp_a2d_mcc_t * |
mcc | ) |
|
Selects and opens the encoder matching mcc->type. Returns false if no matching encoder is registered or it failed to open.
◆ process()
| size_t A2DPAudioEncoder::process |
( |
const uint8_t * |
pcm, |
|
|
size_t |
len |
|
) |
| |
Encodes 16 bit stereo PCM with the active encoder (no-op if none is active) and sends the resulting media packets
◆ sample_rate()
| int A2DPAudioEncoder::sample_rate |
( |
| ) |
|
Sample rate of the PCM expected by the active (or else first registered) encoder
◆ write_frame()
| void A2DPAudioEncoder::write_frame |
( |
const uint8_t * |
data, |
|
|
size_t |
len, |
|
|
uint32_t |
samples |
|
) |
| |
|
overridevirtual |
one complete encoded frame covering the indicated number of samples (per channel)
Implements A2DPFrameSink.
The documentation for this class was generated from the following files: