11#include "AudioTools/CoreAudio/AudioStreams.h"
12#include "IAudioSource.h"
13#include "RTSPFormat.h"
14#include "RTSPPlatform.h"
73 p_audiostream = &stream;
83 p_audiostream =
nullptr;
93 p_audiostream =
nullptr;
106 default_format.begin(info);
120 if (m_magic != MAGIC_NUMBER) {
121 LOGE(
"RTSPAudioSource: invalid magic number 0x%08x, object corrupted",
127 if (dest ==
nullptr || byteCount <= 0) {
128 LOGW(
"RTSPAudioSource: invalid parameters dest=%p byteCount=%d", dest,
133 time_of_last_read =
millis();
136 LOGD(
"readDataTo: %d", byteCount);
137 if (started && p_stream) {
138 result = p_stream->readBytes((uint8_t *)dest, byteCount);
153 if (m_magic != MAGIC_NUMBER) {
154 LOGE(
"RTSPAudioSource: start called on corrupted object, magic=0x%08x",
161 p_audiostream->begin();
176 if (m_magic != MAGIC_NUMBER) {
178 "RTSPAudioSource: stop called on corrupted object, magic=0x%08x, "
186 p_audiostream->end();
203 if (!started)
return false;
205 return millis() - time_of_last_read < timeout;
213 void setFormat(
RTSPFormat &format) { p_format = &format; }
217 void setTimeout(uint16_t to) { timeout = to; }
220 const uint32_t MAGIC_NUMBER =
222 uint32_t m_magic = MAGIC_NUMBER;
223 Stream *p_stream =
nullptr;
224 AudioStream *p_audiostream =
nullptr;
225 uint32_t time_of_last_read = 0;
226 bool started =
false;
227 RTSPFormatPCM default_format;
228 RTSPFormat *p_format = &default_format;
230 uint16_t timeout = 0;