8#include "codec-shine.h"
55 if (!
_out)
return false;
58 LOGE(
"Unsupported bits per sample: %d. Only 16 is supported.",
64 LOGE(
"Unsupported number of channels: %d. Only 1 or 2 are supported.",
77 "Input is mono but Shine encoder is configured for stereo. "
78 "Forcing mono mode.");
85 "Failed to initialize Shine encoder with sample rate %d, channels "
91 "Shine encoder initialized with sample rate %d, channels %d, bitrate "
98 LOGE(
"Failed to resize PCM buffer to %d bytes", buffer_size_bytes);
120 for (
int j = 0;
j < len;
j++) {
143 const char*
mime()
override {
return "audio/mpeg"; }
153 if (
_shine ==
nullptr ||
_out ==
nullptr)
return;
161 if (written > 0 && data) {
189 if (
sr <= 12000)
return 32;
190 if (
sr <= 22050)
return 64;
191 if (
sr <= 32000)
return 128;
199 if (req > 320)
return 320;
202 const int table[] = {32, 40, 48, 56, 64, 80, 96,
203 112, 128, 160, 192, 224, 256, 320};
206 for (
int i = 0; i < 14; i++) {
207 if (req <= table[i]) {
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGE(...)
Definition AudioLoggerIDF.h:30