arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
RTSPFormatPCM Class Reference

Linear PCM Format for RTSP Streaming. More...

#include <RTSPFormat.h>

Inheritance diagram for RTSPFormatPCM:
RTSPFormat

Public Member Functions

 RTSPFormatPCM ()
 
 RTSPFormatPCM (AudioInfo info, int fragmentSize=640)
 
virtual AudioInfo audioInfo ()
 
void begin (AudioInfo info)
 
virtual void begin (RTSPVideoInfo info)
 
int convert (void *data, int samples)
 Convert to network format.
 
AudioInfo defaultConfig () override
 
virtual RTSPVideoInfo defaultVideoConfig ()
 
const char * format (char *buffer, int len) override
 Provide format 10 or 11.
 
virtual int fragmentSize ()
 Fragment (=write) size in bytes.
 
AudioInfo info ()
 
virtual MediaType mediaType ()
 
virtual const char * name ()
 
virtual int readHeader (uint8_t *data)
 Optional header: e.g. rfc2250.
 
int rtpPayloadType () override
 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 Member Functions

int bytesPerSample ()
 
int channels ()
 
int getTimerPeriod (int fragmentSize)
 Get the timer period for streaming.
 
int sampleRate ()
 

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

Linear PCM Format for RTSP Streaming.

RTSPFormatPCM implements the RTSPFormat interface for linear PCM audio, the most common uncompressed audio format. This class:

See also
https://en.wikipedia.org/wiki/RTP_payload_formats
Note
Automatically handles endian conversion for network transmission

Constructor & Destructor Documentation

◆ RTSPFormatPCM() [1/2]

RTSPFormatPCM ( AudioInfo  info,
int  fragmentSize = 640 
)
inline

◆ RTSPFormatPCM() [2/2]

RTSPFormatPCM ( )
inline

Member Function Documentation

◆ audioInfo()

virtual AudioInfo audioInfo ( )
inlinevirtualinherited

◆ begin() [1/2]

void begin ( AudioInfo  info)
inlinevirtual

Reimplemented from RTSPFormat.

◆ begin() [2/2]

virtual void begin ( RTSPVideoInfo  info)
inlinevirtualinherited

◆ bytesPerSample()

int bytesPerSample ( )
inlineprotected

◆ channels()

int channels ( )
inlineprotected

◆ convert()

int convert ( void *  data,
int  samples 
)
inlinevirtual

Convert to network format.

Parameters
data
byteSize

Reimplemented from RTSPFormat.

◆ defaultConfig()

AudioInfo defaultConfig ( )
inlineoverridevirtual

Implements RTSPFormat.

◆ defaultVideoConfig()

virtual RTSPVideoInfo defaultVideoConfig ( )
inlinevirtualinherited

Reimplemented in RTSPFormatMJPEG, and RTSPFormatH264.

◆ format()

const char * format ( char *  buffer,
int  len 
)
inlineoverridevirtual

Provide format 10 or 11.

Parameters
buffer
len
Returns
const char*

Implements RTSPFormat.

◆ fragmentSize()

virtual int fragmentSize ( )
inlinevirtualinherited

Fragment (=write) size in bytes.

Reimplemented in RTSPFormatMP3.

◆ getTimerPeriod()

int getTimerPeriod ( int  fragmentSize)
inlineprotected

Get the timer period for streaming.

Returns
Timer period in microseconds between audio packets

◆ info()

AudioInfo info ( )
inline

◆ mediaType()

virtual MediaType mediaType ( )
inlinevirtualinherited

Reimplemented in RTSPFormatMJPEG, RTSPFormatH264, and RTSPFormatMTS.

◆ name()

virtual const char * name ( )
inlinevirtualinherited

◆ readHeader()

virtual int readHeader ( uint8_t *  data)
inlinevirtualinherited

Optional header: e.g. rfc2250.

◆ rtpPayloadType()

int rtpPayloadType ( )
inlineoverridevirtual

default dynamic

Reimplemented from RTSPFormat.

◆ sampleRate()

int sampleRate ( )
inlineprotected

◆ setFragmentSize()

void setFragmentSize ( int  fragmentSize)
inlineinherited

Defines the fragment size in bytes.

◆ setName()

void setName ( const char *  name)
inlineinherited

Defines the name of the stream.

◆ setProfileLevelId()

virtual void setProfileLevelId ( const char *  )
inlinevirtualinherited

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.

◆ setSpropParameterSets()

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

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.

◆ setTimerPeriodUs()

void setTimerPeriodUs ( int  period)
inlineinherited

Defines the timer period in microseconds.

◆ setUseRfc2250Header()

virtual void setUseRfc2250Header ( bool  )
inlinevirtualinherited

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

Reimplemented in RTSPFormatMP3.

◆ timerPeriodUs()

virtual int timerPeriodUs ( )
inlinevirtualinherited

Timer period in microseconds.

Reimplemented in RTSPFormatADPCM< AudioEncoder >, RTSPFormatMP3, and RTSPFormatMTS.

◆ timestampIncrement()

virtual int timestampIncrement ( )
inlinevirtualinherited

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

Reimplemented in RTSPFormatMP3, RTSPFormatMJPEG, and RTSPFormatH264.

◆ useRfc2250Header()

virtual bool useRfc2250Header ( ) const
inlinevirtualinherited

Reimplemented in RTSPFormatMP3.

◆ videoInfo()

virtual RTSPVideoInfo videoInfo ( )
inlinevirtualinherited

Member Data Documentation

◆ cfg

AudioInfo cfg {16000, 1, 16}
protectedinherited

◆ fragment_size

int fragment_size = 640
protectedinherited

◆ name_str

const char* name_str = "RTSPAudioTools"
protectedinherited

◆ STD_URL_PRE_SUFFIX

const char* STD_URL_PRE_SUFFIX = "trackID"
protectedinherited

◆ timer_period_us

int timer_period_us = 10000
protectedinherited

◆ video_cfg

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

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