3#include "AudioTools/AudioCodecs/AudioCodecsBase.h"
7#include "AACDecoderHelix.h"
24 aac =
new libhelix::AACDecoderHelix();
26 aac->setReference(
this);
28 LOGE(
"Not enough memory for libhelix");
38 aac =
new libhelix::AACDecoderHelix(out_stream);
40 aac->setReference(
this);
42 LOGE(
"Not enough memory for libhelix");
55 aac =
new libhelix::AACDecoderHelix(out_stream);
57 aac->setReference(
this);
59 LOGE(
"Not enough memory for libhelix");
70 if (aac !=
nullptr)
delete aac;
81 if (aac !=
nullptr) aac->setOutput(out_stream);
96 virtual void end()
override {
98 if (aac !=
nullptr) aac->end();
101 virtual _AACFrameInfo audioInfoEx() {
return aac->audioInfo(); }
105 auto i = audioInfoEx();
106 if (i.nChans != 0 && i.bitsPerSample != 0 && i.sampRateOut != 0) {
116 if (info_notifications_active) {
117 notifyAudioChange(info);
122 size_t write(
const uint8_t *data,
size_t len)
override {
123 LOGD(
"AACDecoderHelix::write: %d", (
int)len);
124 if (aac ==
nullptr)
return 0;
127 uint8_t *data8 = (uint8_t *)data;
130 aac->write(data8 + processed, min(open, DEFAULT_BUFFER_SIZE));
132 processed += act_write;
138 virtual operator bool()
override {
return aac !=
nullptr && (bool)*aac; }
147 if (p_helix !=
nullptr) {
154 LOGW(
"sample_rate: %d", i.sampRateOut);
166 void setAudioInfoNotifications(
bool active) {
167 info_notifications_active = active;
178 libhelix::AACDecoderHelix *aac =
nullptr;
179 bool info_notifications_active =
true;