Base class for a single A2DP codec's decode support: pairs an A2DP codec type and its SEP capability advertisement with an audio_tools::AudioDecoder that performs the actual decoding. Provide one concrete subclass per codec (see A2DPDecoderSBC, A2DPDecoderAAC) and register instances via BluetoothA2DPSink::add_decoder() - stream endpoint registration is driven entirely by what gets registered here.
More...
#include <A2DPDecoder.h>
|
|
| A2DPDecoder (audio_tools::AudioDecoder &decoder) |
| |
| virtual bool | begin (const esp_a2d_mcc_t &mcc) |
| |
| virtual void | build_capability (esp_a2d_mcc_t &mcc)=0 |
| | Fills in the SEP capability advertised for this codec at registration.
|
| |
| virtual esp_a2d_mct_t | codec_type ()=0 |
| | A2DP codec type this decoder handles (e.g. ESP_A2D_MCT_SBC)
|
| |
|
virtual void | end () |
| | Closes the wrapped audio_tools decoder.
|
| |
| audio_tools::AudioInfo | get_audio_info () |
| |
| virtual const char * | mime ()=0 |
| | MIME type of the codec this decoder handles (e.g. "audio/sbc")
|
| |
| virtual size_t | write (const uint8_t *data, size_t len) |
| |
|
|
int | bits_per_sample = 16 |
| |
|
int | channels = 2 |
| |
|
audio_tools::AudioDecoder * | p_decoder |
| |
|
audio_tools::CallbackStream | pcm_stream |
| |
|
int | sample_rate = 44100 |
| |
Base class for a single A2DP codec's decode support: pairs an A2DP codec type and its SEP capability advertisement with an audio_tools::AudioDecoder that performs the actual decoding. Provide one concrete subclass per codec (see A2DPDecoderSBC, A2DPDecoderAAC) and register instances via BluetoothA2DPSink::add_decoder() - stream endpoint registration is driven entirely by what gets registered here.
- Author
- Phil Schatzmann
- Copyright
- Apache License Version 2
◆ begin()
| virtual bool A2DPDecoder::begin |
( |
const esp_a2d_mcc_t & |
mcc | ) |
|
|
inlinevirtual |
Opens the wrapped audio_tools decoder for the negotiated SEP capability: calls parse_audio_info(mcc) (implemented per codec - most decoders self-detect sample rate/channels from the encoded stream and can leave sample_rate/channels at their defaults, but codecs whose wire format doesn't carry that info per-frame, e.g. AAC, need it to synthesize the framing their decoder expects - see A2DPDecoderAAC), then wires up the PCM output and audio-info-change notification and starts the decoder.
◆ build_capability()
| virtual void A2DPDecoder::build_capability |
( |
esp_a2d_mcc_t & |
mcc | ) |
|
|
pure virtual |
◆ codec_type()
| virtual esp_a2d_mct_t A2DPDecoder::codec_type |
( |
| ) |
|
|
pure virtual |
◆ get_audio_info()
| audio_tools::AudioInfo A2DPDecoder::get_audio_info |
( |
| ) |
|
|
inline |
Returns the most recently detected sample rate/channels (default AudioInfo values until the wrapped decoder has actually parsed them from the encoded stream)
◆ mime()
| virtual const char * A2DPDecoder::mime |
( |
| ) |
|
|
pure virtual |
◆ parse_audio_info()
| virtual void A2DPDecoder::parse_audio_info |
( |
const esp_a2d_mcc_t & |
mcc | ) |
|
|
protectedpure virtual |
◆ write()
| virtual size_t A2DPDecoder::write |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlinevirtual |
Feeds raw encoded bytes to the wrapped decoder; decoded PCM is forwarded automatically via pcm_stream
Reimplemented in A2DPDecoderAAC.
The documentation for this class was generated from the following files: