4#include "AudioConfig.h"
5#include "AudioSource.h"
6#include "AudioTools/CoreAudio/AudioHttp/AbstractURLStream.h"
18 template <
typename T,
size_t N>
20 const char* mime,
int startPos = 0) {
22 this->actual_stream = &urlStream;
24 this->urlArray = urlArray;
27 this->timeout_auto_next_value = 20000;
41 LOGI(
"url array out of limits: %d -> %d", idx, pos);
45 LOGI(
"url array out of limits: %d -> %d", idx, pos);
47 LOGI(
"selectStream: %d/%d -> %s", pos, size() - 1, value(pos));
48 if (started) actual_stream->end();
49 actual_stream->begin(value(pos), mime);
60 LOGI(
"nextStream: %d/%d -> %s", pos, max - 1, value(pos));
70 LOGI(
"previousStream: %d/%d -> %s", pos, size() - 1, value(pos));
76 LOGI(
"selectStream: %s", path);
77 if (started) actual_stream->end();
78 actual_stream->begin(path, mime);
83 int index() {
return pos; }
85 const char* toStr() {
return value(pos); }
94 bool setMetadataCallback(
void (*
fn)(
MetaDataType info,
const char* str,
98 return actual_stream->setMetadataCallback(
fn);
102 AbstractURLStream* actual_stream =
nullptr;
103 const char** urlArray =
nullptr;
106 const char* mime =
nullptr;
107 bool started =
false;
112 virtual const char* value(
int pos) {
113 if (urlArray ==
nullptr)
return nullptr;
114 return urlArray[pos];
117 virtual int size() {
return max; }
130 template <
typename T,
size_t N>
132 const char* mime,
int startPos = 0) {
133 this->actual_stream = &urlStream;
136 this->timeout_auto_next_value = 20000;
137 for (
int j = 0;
j <
N;
j++) {
144 this->actual_stream = &urlStream;
147 this->timeout_auto_next_value = 20000;
151 void addURL(
const char* url) { url_vector.push_back(url); }
153 void clear() { url_vector.clear(); }
156 Vector<Str> url_vector;
158 const char* value(
int pos)
override {
return url_vector[pos].c_str(); }
160 int size()
override {
return url_vector.size(); }