Unified RTSP Audio Source - Works with both Stream and AudioStream.
More...
#include <RTSPAudioSource.h>
|
RTSPFormatPCM | default_format |
|
uint32_t | m_magic = MAGIC_NUMBER |
|
const uint32_t | MAGIC_NUMBER |
|
AudioStream * | p_audiostream = nullptr |
|
RTSPFormat * | p_format = &default_format |
|
Stream * | p_stream = nullptr |
|
bool | started = false |
|
uint32_t | time_of_last_read = 0 |
|
uint16_t | timeout = 0 |
|
Unified RTSP Audio Source - Works with both Stream and AudioStream.
This class can adapt any Arduino Stream or AudioTools AudioStream into an IAudioSource for RTSP streaming. It automatically detects AudioStream capabilities when available and falls back to manual configuration for generic Streams.
- Author
- Phil Schatzmann
- Copyright
- GPLv3
◆ RTSPAudioSource() [1/3]
Construct from AudioStream with automatic audio info detection.
- Parameters
-
stream | AudioStream that provides audio configuration automatically |
◆ RTSPAudioSource() [2/3]
Construct from generic Stream with explicit audio info.
- Parameters
-
stream | Any Arduino Stream object |
info | Audio configuration (sample rate, channels, bit depth) |
◆ RTSPAudioSource() [3/3]
Construct with custom format.
- Parameters
-
◆ getFormat()
Get the audio format configuration.
Returns the RTSPFormat object that describes the audio data characteristics including sample rate, bit depth, number of channels, and RTP packaging parameters. If no format has been explicitly set, creates a default 16-bit PCM format at 16kHz mono.
- Returns
- Pointer to RTSPFormat describing the audio characteristics
- Note
- Default format: 16-bit PCM, 16000 Hz, 1 channel
- See also
- setFormat(), RTSPFormatPCM
Implements IAudioSource.
◆ isActive()
Check if source is actively being read (AudioStream only)
- Returns
- true if recent read activity detected, false otherwise
◆ readBytes()
int readBytes |
( |
void * |
dest, |
|
|
int |
byteCount |
|
) |
| |
|
inlineoverridevirtual |
Read audio data for RTSP streaming.
- Parameters
-
dest | Buffer to receive audio data |
byteCount | Number of bytes to read |
- Returns
- Actual number of bytes read
Implements IAudioSource.
◆ setAudioInfo()
Set audio configuration manually.
This is required when using generic Stream objects, but optional for AudioStream objects which can provide their own configuration.
- Parameters
-
info | Audio configuration (sample rate, channels, bit depth) |
◆ setInput() [1/3]
Set input from AudioStream (with auto-detection)
- Parameters
-
stream | AudioStream that can provide its own audio configuration |
◆ setInput() [2/3]
void setInput |
( |
Stream & |
stream | ) |
|
|
inline |
Set input from generic Stream (audio info must be set separately)
- Parameters
-
◆ setInput() [3/3]
Set input from generic Stream with explicit audio info.
- Parameters
-
stream | Generic Arduino Stream |
info | Audio configuration parameters |
◆ start()
Start the audio source.
For AudioStreams, calls begin() to initialize the stream. For generic Streams, just sets the active flag.
Reimplemented from IAudioSource.
◆ stop()
Stop the audio source.
For AudioStreams, calls end() to cleanup the stream. For generic Streams, just clears the active flag.
Reimplemented from IAudioSource.
◆ MAGIC_NUMBER
const uint32_t MAGIC_NUMBER |
|
protected |
The documentation for this class was generated from the following file: