30 LOGE(
"Not Supported!");
38 virtual int index() {
return -1; }
54 const char* str,
int len),
72 virtual const char*
toStr() {
return nullptr; }
114 LOGI(
"setCallbackSelectStream not provided");
151 Stream* (*nextStreamCallback)(
int offset) =
nullptr;
186 : dataSource(dataSource), prefix(prefix) {}
187 void setPrefix(
const char* prefix) { this->prefix = prefix; }
189 if (
ch ==
'\n' ||
ch ==
'\r') {
191 if (line_buffer.
length() > 0) {
193 if (prefix !=
nullptr) {
197 name.add(line_buffer.
c_str());
198 LOGD(
"adding '%s'", name.c_str());
199 dataSource.
addName(name.c_str());
202 LOGD(
"adding '%s'", line_buffer.
c_str());
205 line_buffer.
clear(
false);
210 line_buffer.
add((
char)
ch);
216 for (
size_t i = 0; i < size; i++) {
224 if (line_buffer.
length() > 0) {
232 Str line_buffer{200};
233 const char* prefix =
nullptr;
254template <
typename FileType>
257 typedef FileType* (*FileToStreamCallback)(
const char* path,
277 if (
files.empty())
return nullptr;
307 LOGE(
"No file to stream callback set!");
314 if (path ==
nullptr)
return nullptr;
321 LOGE(
"File not found: %s", path);
330 if (path ==
nullptr)
return -1;
333 for (
int i = 0; i < (
int)
files.size(); i++) {
370 files.push_back(entry);
392 if (idx >=
files.size()) {
393 LOGW(
"deleteIndex: Invalid index: %d (size: %d)", (
int)idx,
files.size());
397 LOGI(
"deleteIndex: Removing file at index %d", (
int)idx);
412 template <
typename T,
size_t N>
414 for (
size_t i = 0; i < N; i++) {
448 virtual const char*
toStr()
override {
469 if (path ==
nullptr) path =
"";
537template <
typename FileType>
597 LOGE(
"No file to stream callback set or invalid file path!");
604 if (path ==
nullptr)
return nullptr;
611 LOGE(
"File not found: %s", path);
620 if (path ==
nullptr)
return -1;
675 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:159
int path_index
Definition AudioSource.h:160
Str name
Definition AudioSource.h:161
FileEntry()
Definition AudioSource.h:163
FileEntry(int pathIdx, const char *fileName)
Definition AudioSource.h:165