|
arduino-audio-tools
|
Efficient RTSP client for UDP/RTP audio with decoder pipeline. More...
#include <RTSPClient.h>
Public Member Functions | |
| RTSPClient () | |
| RTSPClient (AudioOutput &out) | |
| Construct with an AudioOutput as decoding sink. | |
| RTSPClient (AudioStream &out) | |
| Construct with an AudioStream as decoding sink. | |
| RTSPClient (Print &out) | |
| Construct with a generic Print sink. | |
| void | addDecoder (const char *mimeType, AudioDecoder &decoder) |
| Register a decoder to be auto-selected for the given MIME. | |
| void | addNotifyAudioChange (AudioInfoSupport &bi) override |
| Adds target to be notified about audio changes. | |
| AudioInfo | audioInfo () override |
| Audio info parsed from SDP for raw PCM encodings. | |
| virtual AudioInfo | audioInfoOut () |
| int | available () |
| Returns buffered RTP payload bytes available for copy(). | |
| bool | begin (IPAddress addr, uint16_t port, const char *path=nullptr) |
| Start RTSP session and UDP RTP reception. | |
| void | clearNotifyAudioChange () override |
| Deletes all change notify subscriptions. | |
| size_t | copy () |
| Copy the next buffered RTP payload into the decoder pipeline. Performs initial decoder selection based on SDP MIME. | |
| void | end () |
| Stop streaming and close RTSP/UDP sockets. | |
| bool | isNotifyActive () |
| const char * | mime () const |
| Best-effort MIME derived from SDP (e.g. audio/L16, audio/aac). | |
| operator bool () | |
| uint8_t | payloadType () const |
| RTP payload type from SDP (0xFF if unknown). | |
| bool | removeNotifyAudioChange (AudioInfoSupport &bi) override |
| Removes a target in order not to be notified about audio changes. | |
| bool | setActive (bool active) |
| Pause or resume playback via RTSP PAUSE/PLAY. | |
| void | setAudioInfo (AudioInfo info) override |
| Defines the input AudioInfo. | |
| void | setConnectRetries (uint8_t retries) |
| Set number of TCP connect retries (default 2). | |
| void | setConnectRetryDelayMs (uint32_t ms) |
| Set delay between connect retries in ms (default 500ms). | |
| void | setHeaderTimeoutMs (uint32_t ms) |
| Set timeout (ms) for reading RTSP response headers. Increase if your server responds slowly. Default 3000ms. | |
| void | setIdleDelay (uint32_t ms) |
| Set idle backoff delay (ms) for zero-return cases. Used in available() and copy() to avoid busy loops. | |
| void | setNotifyActive (bool flag) |
| void | setOutput (AudioOutput &out) |
| Define decoding sink as AudioOutput. | |
| void | setOutput (AudioStream &out) |
| Define decoding sink as AudioStream. | |
| void | setOutput (Print &out) |
| Define decoding sink as Print. | |
| void | setPayloadOffset (uint8_t bytes) |
| Set additional RTP payload offset in bytes. Some payloads embed a small header before the actual audio data (e.g., RFC2250 4-byte header for MP3). This offset is added after the RTP header and any CSRC entries. | |
| void | setResampleFactor (float factor) |
| Set resampling factor to stabilize buffers and playback. 1.0 means no resampling. factor > 1.0 speeds up (upsamples), factor < 1.0 slows down (downsamples). Useful to compensate clock drift between sender and receiver to prevent buffer overflows/underflows. Internally mapped to step size as step = 1.0 / factor. | |
Static Protected Member Functions | |
| static int | parseContentLength (const char *headers) |
Efficient RTSP client for UDP/RTP audio with decoder pipeline.
Establishes an RTSP session (OPTIONS, DESCRIBE, SETUP/UDP, PLAY), binds a local UDP RTP port and receives RTP audio packets. The payload of each RTP packet is forwarded to an internal MultiDecoder. For raw PCM over RTP (e.g. L16) a DecoderNetworkFormat is used to convert network byte order into host format before writing to the configured output. For compressed formats, register decoders with addDecoder().
Usage:
Template parameters:
|
inline |
|
inline |
Construct with an AudioOutput as decoding sink.
|
inline |
Construct with an AudioStream as decoding sink.
Construct with a generic Print sink.
|
inline |
Register a decoder to be auto-selected for the given MIME.
| mimeType | MIME to match |
| decoder | AudioDecoder instance handling that MIME |
|
inlineoverridevirtual |
Adds target to be notified about audio changes.
Reimplemented from AudioInfoSource.
Audio info parsed from SDP for raw PCM encodings.
Implements AudioInfoSupport.
provides the actual output AudioInfo: this is usually the same as audioInfo() unless we use a transforming stream
Reimplemented in PureDataStream, PWMAudioOutput, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, FormatConverterStream, Pipeline, ResampleStream, and ResampleStreamT< TInterpolator >.
Returns buffered RTP payload bytes available for copy().
Start RTSP session and UDP RTP reception.
| addr | RTSP server IP address |
| port | RTSP server port (typically 554) |
| path | Optional path appended to the RTSP URL (e.g. "stream1"). If provided, the base URL becomes rtsp://<ip>:<port>/<path>/ |
|
inlineprotected |
|
inlineoverridevirtual |
Deletes all change notify subscriptions.
Reimplemented from AudioInfoSource.
Copy the next buffered RTP payload into the decoder pipeline. Performs initial decoder selection based on SDP MIME.
Stop streaming and close RTSP/UDP sockets.
Best-effort MIME derived from SDP (e.g. audio/L16, audio/aac).
returns true when streaming is active and a decoder is configured and we have data
RTP payload type from SDP (0xFF if unknown).
|
inlineprotected |
|
inlineoverridevirtual |
Removes a target in order not to be notified about audio changes.
Reimplemented from AudioInfoSource.
|
inlineprotected |
Pause or resume playback via RTSP PAUSE/PLAY.
| active | true to PLAY, false to PAUSE |
Defines the input AudioInfo.
Implements AudioInfoSupport.
Set number of TCP connect retries (default 2).
Set delay between connect retries in ms (default 500ms).
Set timeout (ms) for reading RTSP response headers. Increase if your server responds slowly. Default 3000ms.
Set idle backoff delay (ms) for zero-return cases. Used in available() and copy() to avoid busy loops.
Define decoding sink as AudioOutput.
Define decoding sink as AudioStream.
Define decoding sink as Print.
Set additional RTP payload offset in bytes. Some payloads embed a small header before the actual audio data (e.g., RFC2250 4-byte header for MP3). This offset is added after the RTP header and any CSRC entries.
Set resampling factor to stabilize buffers and playback. 1.0 means no resampling. factor > 1.0 speeds up (upsamples), factor < 1.0 slows down (downsamples). Useful to compensate clock drift between sender and receiver to prevent buffer overflows/underflows. Internally mapped to step size as step = 1.0 / factor.
|
protected |
|
protected |
|
protected |
|
protectedinherited |