4 #include "AudioConfig.h"
5 #include "URLStreamBuffered.h"
6 #include "AudioTools/CoreAudio/AudioMetaData/MetaDataICY.h"
24 ICYStream(
int readBufferSize = DEFAULT_BUFFER_SIZE) {
26 setReadBufferSize(readBufferSize);
29 ICYStream(
Client& clientPar,
int readBufferSize = DEFAULT_BUFFER_SIZE) {
31 setReadBufferSize(readBufferSize);
36 ICYStream(
const char* network,
const char* password,
37 int readBufferSize = DEFAULT_BUFFER_SIZE) {
39 setReadBufferSize(readBufferSize);
55 virtual bool begin(
const char* urlStr,
const char* acceptMime =
nullptr,
56 MethodID action = GET,
const char* reqMime =
"",
57 const char* reqData =
"")
override {
61 bool result = url.
begin(urlStr, acceptMime, action, reqMime, reqData);
73 LOGW(
"url does not provide metadata");
80 virtual void end()
override {
87 virtual int available()
override {
return url.available(); }
90 virtual size_t readBytes(uint8_t* data,
size_t len)
override {
94 int read = url.readBytes(data, len);
97 for (
int j = 0; j < read; j++) {
100 data[pos++] = data[j];
106 result = url.readBytes(data, len);
108 LOGD(
"%s: %zu -> %zu", LOG_METHOD, len, result);
113 virtual int read()
override {
128 operator bool() {
return url; }
133 void setReadBufferSize(
int readBufferSize) {
134 url.setReadBufferSize(readBufferSize);
153 void (*callback)(
MetaDataType info,
const char* str,
int len) =
nullptr;