arduino-audio-tools
Loading...
Searching...
No Matches
RTSPFormat Class Referenceabstract

Audio Format Definition - Base class for RTSP audio formats. More...

#include <CodecOpusOgg.h>

Inheritance diagram for RTSPFormat:
RTSPFormatAAC RTSPFormatADPCM< AudioEncoder > RTSPFormatAbtX RTSPFormatG711 RTSPFormatGSM RTSPFormatH264 RTSPFormatMJPEG RTSPFormatMP3 RTSPFormatMTS RTSPFormatOpus RTSPFormatPCM RTSPFormatPCM8 RTSPFormatAAC RTSPFormatADPCM< AudioEncoder > RTSPFormatAbtX RTSPFormatG711 RTSPFormatGSM RTSPFormatH264 RTSPFormatMJPEG RTSPFormatMP3 RTSPFormatMTS RTSPFormatOpus RTSPFormatPCM RTSPFormatPCM8

Public Member Functions

virtual AudioInfo audioInfo ()
virtual void begin (AudioInfo info)
virtual void begin (RTSPVideoInfo info)
virtual int convert (void *data, int sampleCount)
virtual AudioInfo defaultConfig ()=0
virtual RTSPVideoInfo defaultVideoConfig ()
virtual const char * format (char *buffer, int len)=0
virtual int fragmentSize ()
 Fragment (=write) size in bytes.
virtual MediaType mediaType ()
virtual const char * name ()
virtual int readHeader (uint8_t *data)
 Optional header: e.g. rfc2250.
virtual int rtpPayloadType ()
 default dynamic
void setFragmentSize (int fragmentSize)
 Defines the fragment size in bytes.
void setName (const char *name)
 Defines the name of the stream.
virtual void setProfileLevelId (const char *)
virtual void setSpropParameterSets (const char *, const char *)
void setTimerPeriodUs (int period)
 Defines the timer period in microseconds.
virtual void setUseRfc2250Header (bool)
 Optional: Configure RFC2250 header usage (default: no-op).
virtual int timerPeriodUs ()
 Timer period in microseconds.
virtual int timestampIncrement ()
 Fragment size in samples (for audio) or timestamp increment (for video).
virtual bool useRfc2250Header () const
virtual RTSPVideoInfo videoInfo ()

Protected Attributes

AudioInfo cfg {16000, 1, 16}
int fragment_size = 640
const char * name_str = "RTSPAudioTools"
const char * STD_URL_PRE_SUFFIX = "trackID"
int timer_period_us = 10000
RTSPVideoInfo video_cfg {640, 480, 30.0f, RTSPVideoFormat::MJPEG, 24}

Detailed Description

Audio Format Definition - Base class for RTSP audio formats.

The RTSPFormat class hierarchy defines audio format characteristics for RTSP streaming, including SDP generation and RTP packaging parameters. This base class provides the interface for:

  • SDP (Session Description Protocol) generation for RTSP DESCRIBE responses
  • Audio data conversion (endianness, format transformations)
  • RTP packaging parameters (fragment size, timing)
  • Sample rate and channel configuration

Supported Formats

  • RTSPFormatPCM: Linear PCM audio (most common)
  • Custom formats can be implemented by extending this class

SDP Format String

The format() method generates SDP media descriptions like:

m=audio 0 RTP/AVP 11
a=rtpmap:11 L16/16000/1
Note
Implementations must provide format() method for SDP generation
Author
Phil Schatzmann

Member Function Documentation

◆ audioInfo()

virtual AudioInfo audioInfo ( )
inlinevirtual

◆ begin() [1/2]

◆ begin() [2/2]

virtual void begin ( RTSPVideoInfo info)
inlinevirtual

◆ convert()

virtual int convert ( void * data,
int sampleCount )
inlinevirtual

Reimplemented in RTSPFormatPCM, and RTSPFormatPCM.

◆ defaultConfig()

◆ defaultVideoConfig()

virtual RTSPVideoInfo defaultVideoConfig ( )
inlinevirtual

◆ format()

◆ fragmentSize()

virtual int fragmentSize ( )
inlinevirtual

Fragment (=write) size in bytes.

Reimplemented in RTSPFormatMP3, and RTSPFormatMP3.

◆ mediaType()

virtual MediaType mediaType ( )
inlinevirtual

◆ name()

virtual const char * name ( )
inlinevirtual

◆ readHeader()

virtual int readHeader ( uint8_t * data)
inlinevirtual

Optional header: e.g. rfc2250.

◆ rtpPayloadType()

virtual int rtpPayloadType ( )
inlinevirtual

◆ setFragmentSize()

void setFragmentSize ( int fragmentSize)
inline

Defines the fragment size in bytes.

◆ setName()

void setName ( const char * name)
inline

Defines the name of the stream.

◆ setProfileLevelId()

virtual void setProfileLevelId ( const char * )
inlinevirtual

Optional: receives the 3-byte profile-level-id (as 6 hex digits) once an encoder has parsed it from the SPS. Default no-op; only RTSPFormatH264 acts on it.

Reimplemented in RTSPFormatH264, and RTSPFormatH264.

◆ setSpropParameterSets()

virtual void setSpropParameterSets ( const char * ,
const char *  )
inlinevirtual

Optional: receives base64-encoded SPS/PPS once an encoder has learned them (H.264 sprop-parameter-sets). Default no-op; only RTSPFormatH264 acts on it. Declared here (rather than only on RTSPFormatH264) so video encoders (see RTSPVideoEncoder) can push this through a generic RTSPFormat* without needing to know the concrete format type.

Reimplemented in RTSPFormatH264, and RTSPFormatH264.

◆ setTimerPeriodUs()

void setTimerPeriodUs ( int period)
inline

Defines the timer period in microseconds.

◆ setUseRfc2250Header()

virtual void setUseRfc2250Header ( bool )
inlinevirtual

Optional: Configure RFC2250 header usage (default: no-op).

Reimplemented in RTSPFormatMP3, and RTSPFormatMP3.

◆ timerPeriodUs()

virtual int timerPeriodUs ( )
inlinevirtual

◆ timestampIncrement()

virtual int timestampIncrement ( )
inlinevirtual

Fragment size in samples (for audio) or timestamp increment (for video).

Reimplemented in RTSPFormatH264, RTSPFormatMJPEG, RTSPFormatMP3, RTSPFormatH264, RTSPFormatMJPEG, and RTSPFormatMP3.

◆ useRfc2250Header()

virtual bool useRfc2250Header ( ) const
inlinevirtual

Reimplemented in RTSPFormatMP3, and RTSPFormatMP3.

◆ videoInfo()

virtual RTSPVideoInfo videoInfo ( )
inlinevirtual

Member Data Documentation

◆ cfg

AudioInfo cfg {16000, 1, 16}
protected

◆ fragment_size

int fragment_size = 640
protected

◆ name_str

const char* name_str = "RTSPAudioTools"
protected

◆ STD_URL_PRE_SUFFIX

const char* STD_URL_PRE_SUFFIX = "trackID"
protected

◆ timer_period_us

int timer_period_us = 10000
protected

◆ video_cfg

RTSPVideoInfo video_cfg {640, 480, 30.0f, RTSPVideoFormat::MJPEG, 24}
protected

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