3 #include "AudioTools/AudioCodecs/AudioCodecsBase.h"
4 #include "MP3EncoderLAME.h"
41 p_print = &out_stream;
52 p_print = &out_stream;
54 enc->setOutput(out_stream);
81 if (enc==
nullptr)
return false;
87 AudioInfoLAME &audioInfoExt(){
91 AudioInfoLAME defaultConfig(){
97 size_t write(
const uint8_t *data,
size_t len){
98 if (enc==
nullptr)
return 0;
99 LOGD(
"write %d bytes", (
int) len);
100 return enc->write((uint8_t*)data, len);
113 liblame::MP3EncoderLAME *driver() {
121 virtual operator bool() {
122 return enc!=
nullptr && (bool)(*enc);
126 liblame::MP3EncoderLAME *enc=
nullptr;
127 AudioInfoLAME lame_info;
128 Print *p_print=
nullptr;
134 enc =
new liblame::MP3EncoderLAME();
135 if (p_print!=
nullptr){
138 LOGE(
"Output undefined");
140 LOGI(
"LibLAME channels: %d", lame_info.channels);
141 LOGI(
"LibLAME sample_rate: %d", lame_info.sample_rate);
142 LOGI(
"LibLAME bits_per_sample: %d", lame_info.bits_per_sample);
143 LOGI(
"LibLAME quality: %d", lame_info.quality);
144 enc->setAudioInfo(lame_info);