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

MPEG-2 Transport Stream (MP2T) format for RTSP streaming of a pre-muxed audio+video container, per RFC 2250. More...

#include <RTSPFormat.h>

Inheritance diagram for RTSPFormatMTS:
RTSPFormat

Public Member Functions

 RTSPFormatMTS (float framerate=25.0f)
 
virtual AudioInfo audioInfo ()
 
virtual void begin (AudioInfo info)
 
virtual void begin (RTSPVideoInfo info)
 
virtual int convert (void *data, int sampleCount)
 
AudioInfo defaultConfig () override
 
virtual RTSPVideoInfo defaultVideoConfig ()
 
const char * format (char *buffer, int len) override
 
virtual int fragmentSize ()
 Fragment (=write) size in bytes.
 
MediaType mediaType () override
 Override media type for video.
 
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 setFramerate (float fps)
 Set the fragment pacing rate (see constructor note)
 
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)
 
int timerPeriodUs () override
 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}
 
float video_framerate = 25.0f
 

Detailed Description

MPEG-2 Transport Stream (MP2T) format for RTSP streaming of a pre-muxed audio+video container, per RFC 2250.

All the other RTSPFormat subclasses carry a single elementary stream, so a server needs one RTSPServer/RTSPMediaStreamer instance per media type (audio, video) - there is no multi-track SDP support (no way to combine separate m=audio/m=video lines into one session). Muxing audio and video into MPEG-TS first (e.g. with MuxerMTS, see ContainerMTS.h) and streaming that as MP2T sidesteps the issue entirely: the interleaved, PTS-synced container travels as a single "m=video ... RTP/AVP 33" track that any RTSP client already knows how to demux into its two streams - no RTSP/SDP changes needed.

Payload type 33 is static (RFC 3551), so no a=rtpmap is required. The source feeding this format needs no per-fragment RTP header beyond the generic one RTSPMediaStreamer already adds - just chunk the muxed byte stream to a whole number of 188-byte TS packets via setFragmentSize() (e.g. 7 * 188 = 1316 bytes, comfortably under a typical 1500-byte MTU).

SDP format: m=video 0 RTP/AVP 33

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ RTSPFormatMTS()

RTSPFormatMTS ( float  framerate = 25.0f)
inline
Parameters
framerateOnly used to pace how often one RTP fragment is sent (timerPeriodUs()) - unrelated to the muxed stream's own frame rate, which MPEG-TS carries internally via PCR/PTS.

Member Function Documentation

◆ audioInfo()

virtual AudioInfo audioInfo ( )
inlinevirtualinherited

◆ begin() [1/2]

virtual void begin ( AudioInfo  info)
inlinevirtualinherited

◆ begin() [2/2]

virtual void begin ( RTSPVideoInfo  info)
inlinevirtualinherited

◆ convert()

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

Reimplemented in RTSPFormatPCM.

◆ 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

Implements RTSPFormat.

◆ fragmentSize()

virtual int fragmentSize ( )
inlinevirtualinherited

Fragment (=write) size in bytes.

Reimplemented in RTSPFormatMP3.

◆ mediaType()

MediaType mediaType ( )
inlineoverridevirtual

Override media type for video.

Reimplemented from RTSPFormat.

◆ 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.

◆ setFragmentSize()

void setFragmentSize ( int  fragmentSize)
inlineinherited

Defines the fragment size in bytes.

◆ setFramerate()

void setFramerate ( float  fps)
inline

Set the fragment pacing rate (see constructor note)

◆ 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()

int timerPeriodUs ( )
inlineoverridevirtual

Timer period in microseconds.

Reimplemented from RTSPFormat.

◆ 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

◆ video_framerate

float video_framerate = 25.0f
protected

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