3 #define MINIMP3_IMPLEMENTATION
4 #define MINIMP3_NO_STDIO
5 #define LOGGING_ACTIVE true
8 #include "AudioTools/AudioCodecs/AudioCodecsBase.h"
9 #include "MP3DecoderMAD.h"
15 static AudioInfoSupport *audioChangeMAD=
nullptr;
29 mad =
new libmad::MP3DecoderMAD();
32 MP3DecoderMAD(libmad::MP3DataCallback dataCallback, libmad::MP3InfoCallback infoCB=
nullptr){
34 mad =
new libmad::MP3DecoderMAD(dataCallback, infoCB);
39 mad =
new libmad::MP3DecoderMAD(mad_output_streamput, infoCB);
55 mad->setDataCallback(cb);
61 mad->setInfoCallback(cb);
80 return mad->audioInfo();
94 size_t write(
const uint8_t *data,
size_t len){
96 return mad->write(data,len);
100 size_t write(
void *data,
size_t len){
102 return mad->write(data,len);
110 libmad::MP3DecoderMAD *driver() {
114 static void audioChangeCallback(libmad::MadAudioInfo &info){
115 if (audioChangeMAD!=
nullptr){
118 base.channels = info.channels;
119 base.sample_rate = info.sample_rate;
120 base.bits_per_sample = info.bits_per_sample;
128 audioChangeMAD = &bi;
130 mad->setInfoCallback(audioChangeCallback);
134 libmad::MP3DecoderMAD *mad;