3#include "AudioTools/CoreAudio/AudioStreams.h"
4#include "IAudioSource.h"
6#include "RTSPPlatform.h"
72 p_audiostream = &stream;
82 p_audiostream =
nullptr;
92 p_audiostream =
nullptr;
105 default_format.begin(info);
119 if (m_magic != MAGIC_NUMBER) {
120 LOGE(
"RTSPAudioSource: invalid magic number 0x%08x, object corrupted",
126 if (dest ==
nullptr || byteCount <= 0) {
127 LOGW(
"RTSPAudioSource: invalid parameters dest=%p byteCount=%d", dest,
132 time_of_last_read =
millis();
135 LOGD(
"readDataTo: %d", byteCount);
136 if (started && p_stream) {
137 result = p_stream->readBytes((uint8_t *)dest, byteCount);
152 if (m_magic != MAGIC_NUMBER) {
153 LOGE(
"RTSPAudioSource: start called on corrupted object, magic=0x%08x",
160 p_audiostream->begin();
175 if (m_magic != MAGIC_NUMBER) {
177 "RTSPAudioSource: stop called on corrupted object, magic=0x%08x, "
185 p_audiostream->end();
202 if (!started)
return false;
204 return millis() - time_of_last_read < timeout;
212 void setFormat(
RTSPFormat &format) { p_format = &format; }
216 void setTimeout(uint16_t to) { timeout = to; }
219 const uint32_t MAGIC_NUMBER =
221 uint32_t m_magic = MAGIC_NUMBER;
222 Stream *p_stream =
nullptr;
223 AudioStream *p_audiostream =
nullptr;
224 uint32_t time_of_last_read = 0;
225 bool started =
false;
226 RTSPFormatPCM default_format;
227 RTSPFormat *p_format = &default_format;
229 uint16_t timeout = 0;