arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RTSPOutput< Platform > Class Template Reference

RTSPOutput - Audio Output Stream for RTSP Streaming. More...

#include <RTSPOutput.h>

Inheritance diagram for RTSPOutput< Platform >:
AudioOutput Print AudioInfoSupport AudioInfoSource

Public Member Functions

 RTSPOutput ()=default
 Construct RTSPOutput with default PCM format (no encoding)
 
 RTSPOutput (RTSPFormat &format, AudioEncoder &encoder)
 Construct RTSPOutput with specific encoder and format.
 
virtual void addNotifyAudioChange (AudioInfoSupport &bi)
 Adds target to be notified about audio changes.
 
virtual AudioInfo audioInfo () override
 provides the actual input AudioInfo
 
virtual AudioInfo audioInfoOut ()
 
int availableForWrite ()
 Get available space for writing audio data.
 
bool begin ()
 Initialize RTSPOutput with current audio configuration.
 
bool begin (AudioInfo info)
 Initialize RTSPOutput with specific audio configuration.
 
virtual void clearNotifyAudioChange ()
 Deletes all change notify subscriptions.
 
void end ()
 Stop RTSP streaming and cleanup resources.
 
virtual void flush ()
 
virtual bool isDeletable ()
 If true we need to release the related memory in the destructor.
 
bool isNotifyActive ()
 Checks if the automatic AudioInfo update is active.
 
 operator bool ()
 Check if RTSP streaming is active.
 
virtual bool removeNotifyAudioChange (AudioInfoSupport &bi)
 Removes a target in order not to be notified about audio changes.
 
virtual void setAudioInfo (AudioInfo newInfo) override
 Defines the input AudioInfo.
 
void setFormat (RTSPFormat &format)
 
void setNotifyActive (bool flag)
 Deactivate/Reactivate automatic AudioInfo updates: (default is active)
 
RTSPAudioStreamer< Platform > & streamer ()
 Get access to the underlying RTSP streamer.
 
size_t write (const uint8_t *data, size_t len) override
 Write PCM audio data for encoding and streaming.
 
virtual size_t write (uint8_t ch) override
 
virtual void writeSilence (size_t len)
 

Protected Member Functions

void notifyAudioChange (AudioInfo info)
 

Protected Attributes

int _timeout = 10
 
AudioInfo cfg
 
CopyEncoder copy_encoder
 Pass-through encoder for PCM mode.
 
bool is_active = false
 
bool is_notify_active = true
 
DynamicMemoryStream memory_stream {false, 1024, 10}
 Memory stream for internal buffer.
 
Vector< AudioInfoSupport * > notify_vector
 
AudioEncoderp_encoder
 Active encoder (PCM or codec-specific)
 
RTSPFormatp_format = &pcm
 Active format handler.
 
RTSPFormatPCM pcm
 Default PCM format handler (merged class)
 
RTSPAudioSource rtsp_source
 Provides encoded audio to streamer.
 
RTSPAudioStreamer< Platform > rtsp_streamer
 Handles RTP packet transmission.
 
SingleBuffer< uint8_t > tmp {MAX_SINGLE_CHARS}
 
int tmpPos = 0
 

Detailed Description

template<typename Platform>
class audio_tools::RTSPOutput< Platform >

RTSPOutput - Audio Output Stream for RTSP Streaming.

Accepts PCM audio data, encodes it using the specified encoder, and makes it available for RTSP streaming via an integrated RTSPAudioStreamer.

Data flow: PCM input → encoder → internal queue → RTSP source → RTP packets

Template Parameters
PlatformPlatform-specific implementation (RTSPPlatformWiFi, etc.)
Note
Ensure codec compatibility with your audio format
Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ RTSPOutput() [1/2]

template<typename Platform >
RTSPOutput ( RTSPFormat format,
AudioEncoder encoder 
)
inline

Construct RTSPOutput with specific encoder and format.

Parameters
formatFormat handler providing SDP configuration and timing
encoderAudio encoder for PCM compression
bufferSizeInternal buffer size in bytes (default: 2KB)
Note
Encoder and format must remain valid for RTSPOutput lifetime

◆ RTSPOutput() [2/2]

template<typename Platform >
RTSPOutput ( )
default

Construct RTSPOutput with default PCM format (no encoding)

Note
Uses CopyEncoder (pass-through) for uncompressed streaming

Member Function Documentation

◆ addNotifyAudioChange()

virtual void addNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

◆ audioInfo()

virtual AudioInfo audioInfo ( )
inlineoverridevirtualinherited

provides the actual input AudioInfo

Implements AudioInfoSupport.

Reimplemented in AdapterPrintToAudioOutput, EncodedAudioOutput, and AdapterAudioStreamToAudioOutput.

◆ audioInfoOut()

virtual AudioInfo audioInfoOut ( )
inlinevirtualinherited

◆ availableForWrite()

template<typename Platform >
int availableForWrite ( )
inlinevirtual

Get available space for writing audio data.

Returns
Number of bytes available for writing, 0 if not started

Reimplemented from AudioOutput.

◆ begin() [1/2]

template<typename Platform >
bool begin ( )
inlinevirtual

Initialize RTSPOutput with current audio configuration.

Returns
true if initialization successful, false otherwise

Reimplemented from AudioOutput.

◆ begin() [2/2]

template<typename Platform >
bool begin ( AudioInfo  info)
inlinevirtual

Initialize RTSPOutput with specific audio configuration.

Parameters
infoAudio configuration (sample rate, channels, bits per sample)
Returns
true if initialization successful, false otherwise

Reimplemented from AudioOutput.

◆ clearNotifyAudioChange()

virtual void clearNotifyAudioChange ( )
inlinevirtualinherited

Deletes all change notify subscriptions.

Reimplemented in RTSPClient< TcpClient, UdpSocket >.

◆ end()

template<typename Platform >
void end ( )
inlinevirtual

Stop RTSP streaming and cleanup resources.

Reimplemented from AudioOutput.

◆ flush()

virtual void flush ( )
inlinevirtualinherited

Reimplemented from Print.

◆ isDeletable()

virtual bool isDeletable ( )
inlinevirtualinherited

If true we need to release the related memory in the destructor.

Reimplemented in AdapterPrintToAudioOutput, and AdapterAudioStreamToAudioOutput.

◆ operator bool()

template<typename Platform >
operator bool ( )
inlinevirtual

Check if RTSP streaming is active.

Returns
true if the RTSP source is active and ready for streaming

Reimplemented from AudioOutput.

◆ removeNotifyAudioChange()

virtual bool removeNotifyAudioChange ( AudioInfoSupport bi)
inlinevirtualinherited

Removes a target in order not to be notified about audio changes.

Reimplemented in RTSPClient< TcpClient, UdpSocket >.

◆ setAudioInfo()

virtual void setAudioInfo ( AudioInfo  info)
inlineoverridevirtualinherited

◆ streamer()

template<typename Platform >
RTSPAudioStreamer< Platform > & streamer ( )
inline

Get access to the underlying RTSP streamer.

Returns
Pointer to the RTSPAudioStreamer instance

◆ write()

template<typename Platform >
size_t write ( const uint8_t *  data,
size_t  len 
)
inlineoverridevirtual

Write PCM audio data for encoding and streaming.

Parameters
dataPointer to PCM audio data buffer
lenNumber of bytes to write
Returns
Number of bytes actually written and processed

Implements AudioOutput.

◆ writeSilence()

virtual void writeSilence ( size_t  len)
inlinevirtualinherited

Writes n 0 values (= silence)

Parameters
len

Member Data Documentation

◆ p_encoder

template<typename Platform >
AudioEncoder* p_encoder
protected
Initial value:
=
CopyEncoder copy_encoder
Pass-through encoder for PCM mode.
Definition RTSPOutput.h:149

Active encoder (PCM or codec-specific)


The documentation for this class was generated from the following file: