31 LOGE(
"Not Supported!");
39 virtual int index() {
return -1; }
55 const char* str,
int len),
73 virtual const char*
toStr() {
return nullptr; }
115 LOGI(
"setCallbackSelectStream not provided");
152 Stream* (*nextStreamCallback)(
int offset) =
nullptr;
187 : dataSource(dataSource), prefix(prefix) {}
188 void setPrefix(
const char* prefix) { this->prefix = prefix; }
190 if (
ch ==
'\n' ||
ch ==
'\r') {
192 if (line_buffer.
length() > 0) {
194 if (prefix !=
nullptr) {
198 name.add(line_buffer.
c_str());
199 LOGD(
"adding '%s'", name.c_str());
200 dataSource.
addName(name.c_str());
203 LOGD(
"adding '%s'", line_buffer.
c_str());
206 line_buffer.
clear(
false);
211 line_buffer.
add((
char)
ch);
217 for (
size_t i = 0; i < size; i++) {
225 if (line_buffer.
length() > 0) {
233 Str line_buffer{200};
234 const char* prefix =
nullptr;
255template <
typename FileType>
258 typedef FileType* (*FileToStreamCallback)(
const char* path,
278 if (
files.empty())
return nullptr;
308 LOGE(
"No file to stream callback set!");
315 if (path ==
nullptr)
return nullptr;
322 LOGE(
"File not found: %s", path);
331 if (path ==
nullptr)
return -1;
334 for (
int i = 0; i < (
int)
files.size(); i++) {
371 files.push_back(entry);
393 if (idx >=
files.size()) {
394 LOGW(
"deleteIndex: Invalid index: %d (size: %d)", (
int)idx,
files.size());
398 LOGI(
"deleteIndex: Removing file at index %d", (
int)idx);
413 template <
typename T,
size_t N>
415 for (
size_t i = 0; i < N; i++) {
449 virtual const char*
toStr()
override {
470 if (path ==
nullptr) path =
"";
538template <
typename FileType>
598 LOGE(
"No file to stream callback set or invalid file path!");
605 if (path ==
nullptr)
return nullptr;
612 LOGE(
"File not found: %s", path);
621 if (path ==
nullptr)
return -1;
676 virtual const char*
toStr()
override {
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define TRACED()
Definition AudioLoggerIDF.h:31
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30
File entry to minimize RAM usage by using path index and name.
Definition AudioSource.h:160
int path_index
Definition AudioSource.h:161
Str name
Definition AudioSource.h:162
FileEntry()
Definition AudioSource.h:164
FileEntry(int pathIdx, const char *fileName)
Definition AudioSource.h:166