3#include "AudioTools/CoreAudio/AudioStreams.h"
4#include "IAudioSource.h"
6#include "RTSPPlatform.h"
65 p_audiostream = &stream;
75 p_audiostream =
nullptr;
85 p_audiostream =
nullptr;
98 default_format.begin(info);
112 if (m_magic != MAGIC_NUMBER) {
113 LOGE(
"RTSPAudioSource: invalid magic number 0x%08x, object corrupted",
119 if (dest ==
nullptr || byteCount <= 0) {
120 LOGW(
"RTSPAudioSource: invalid parameters dest=%p byteCount=%d", dest,
125 time_of_last_read =
millis();
128 LOGD(
"readDataTo: %d", byteCount);
129 if (started && p_stream) {
130 result = p_stream->readBytes((uint8_t *)dest, byteCount);
145 if (m_magic != MAGIC_NUMBER) {
146 LOGE(
"RTSPAudioSource: start called on corrupted object, magic=0x%08x",
153 p_audiostream->begin();
168 if (m_magic != MAGIC_NUMBER) {
170 "RTSPAudioSource: stop called on corrupted object, magic=0x%08x, "
178 p_audiostream->end();
195 if (!started)
return false;
197 return millis() - time_of_last_read < timeout;
205 void setFormat(
RTSPFormat &format) { p_format = &format; }
209 void setTimeout(uint16_t to) { timeout = to; }
212 const uint32_t MAGIC_NUMBER =
214 uint32_t m_magic = MAGIC_NUMBER;
215 Stream *p_stream =
nullptr;
216 AudioStream *p_audiostream =
nullptr;
217 uint32_t time_of_last_read = 0;
218 bool started =
false;
219 RTSPFormatPCM default_format;
220 RTSPFormat *p_format = &default_format;
222 uint16_t timeout = 0;