SBC decode support for the managed A2DP decoder framework: wraps any audio_tools::AudioDecoder that decodes SBC - e.g. audio_tools::SBCDecoder (arduino-libsbc) - and advertises the SBC SEP capability. Construct your decoder of choice, include its codec header yourself (e.g. "AudioTools/AudioCodecs/CodecSBC.h"), and register an A2DPDecoderSBC wrapping it via BluetoothA2DPSink::add_decoder().
More...
#include <A2DPDecoderSBC.h>
|
|
| A2DPDecoderSBC (audio_tools::AudioDecoder &decoder) |
| |
| virtual bool | begin (const esp_a2d_mcc_t &mcc) |
| |
| void | build_capability (esp_a2d_mcc_t &mcc) override |
| | Fills in the SEP capability advertised for this codec at registration.
|
| |
| esp_a2d_mct_t | codec_type () override |
| | 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 () |
| |
| const char * | mime () override |
| | 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 |
| |
SBC decode support for the managed A2DP decoder framework: wraps any audio_tools::AudioDecoder that decodes SBC - e.g. audio_tools::SBCDecoder (arduino-libsbc) - and advertises the SBC SEP capability. Construct your decoder of choice, include its codec header yourself (e.g. "AudioTools/AudioCodecs/CodecSBC.h"), and register an A2DPDecoderSBC wrapping it via BluetoothA2DPSink::add_decoder().
- Author
- Phil Schatzmann
- Copyright
- Apache License Version 2
◆ begin()
| virtual bool A2DPDecoder::begin |
( |
const esp_a2d_mcc_t & |
mcc | ) |
|
|
inlinevirtualinherited |
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()
| void A2DPDecoderSBC::build_capability |
( |
esp_a2d_mcc_t & |
mcc | ) |
|
|
inlineoverridevirtual |
Fills in the SEP capability advertised for this codec at registration.
Implements A2DPDecoder.
◆ codec_type()
| esp_a2d_mct_t A2DPDecoderSBC::codec_type |
( |
| ) |
|
|
inlineoverridevirtual |
A2DP codec type this decoder handles (e.g. ESP_A2D_MCT_SBC)
Implements A2DPDecoder.
◆ get_audio_info()
| audio_tools::AudioInfo A2DPDecoder::get_audio_info |
( |
| ) |
|
|
inlineinherited |
Returns the most recently detected sample rate/channels (default AudioInfo values until the wrapped decoder has actually parsed them from the encoded stream)
◆ mime()
| const char * A2DPDecoderSBC::mime |
( |
| ) |
|
|
inlineoverridevirtual |
MIME type of the codec this decoder handles (e.g. "audio/sbc")
Implements A2DPDecoder.
◆ parse_audio_info()
| void A2DPDecoderSBC::parse_audio_info |
( |
const esp_a2d_mcc_t & |
mcc | ) |
|
|
inlineoverrideprotectedvirtual |
determines sample_rate/channels from the negotiated SBC capability (a single bit is set per field once negotiation completes); the wrapped decoder also self-detects the same values from the SBC frame header itself once frames start flowing (see A2DPDecoder::get_audio_info())
Implements A2DPDecoder.
◆ write()
| virtual size_t A2DPDecoder::write |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlinevirtualinherited |
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 file: