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

H.264 (AVC) format for RTSP video streaming, per RFC 6184. More...

#include <RTSPFormat.h>

Inheritance diagram for RTSPFormatH264:
RTSPFormat

Public Member Functions

 RTSPFormatH264 (int width=1280, int height=720, float framerate=15.0f)
 
virtual AudioInfo audioInfo ()
 
virtual void begin (AudioInfo info)
 
virtual void begin (RTSPVideoInfo info)
 
virtual int convert (void *data, int sampleCount)
 
AudioInfo defaultConfig () override
 
RTSPVideoInfo defaultVideoConfig () override
 
const char * format (char *buffer, int len) override
 
virtual int fragmentSize ()
 Fragment (=write) size in bytes.
 
float getFramerate () const
 Get framerate.
 
int getHeight () const
 Get video height.
 
int getWidth () const
 Get video width.
 
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 video framerate.
 
void setName (const char *name)
 Defines the name of the stream.
 
void setProfileLevelId (const char *hex6) override
 
void setSpropParameterSets (const char *base64Sps, const char *base64Pps) override
 
void setTimerPeriodUs (int period)
 Defines the timer period in microseconds.
 
virtual void setUseRfc2250Header (bool)
 Optional: Configure RFC2250 header usage (default: no-op)
 
void setVideoDimensions (int width, int height)
 Set video dimensions.
 
virtual int timerPeriodUs ()
 Timer period in microseconds.
 
int timestampIncrement () override
 Override timestamp increment for video (90kHz clock)
 
virtual bool useRfc2250Header () const
 
virtual RTSPVideoInfo videoInfo ()
 

Protected Attributes

AudioInfo cfg {16000, 1, 16}
 
int fragment_size = 640
 
const char * name_str = "RTSPAudioTools"
 
String profile_level_id = "42E01E"
 
String sprop_parameter_sets
 
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 = 15.0f
 
int video_height = 720
 
int video_width = 1280
 

Detailed Description

H.264 (AVC) format for RTSP video streaming, per RFC 6184.

Unlike JPEG's static payload type 26, H.264 has no static RTP payload type, so this uses a dynamic one (96) with packetization-mode=1 (non-interleaved: single-NAL-unit packets plus FU-A fragmentation for large NALs, no STAP-A aggregation).

The sprop-parameter-sets/profile-level-id SDP attributes need the stream's actual SPS/PPS, but most H.264 encoders (including codec-h264-ESP32S3) only emit SPS/PPS embedded in the first encoded IDR frame - there is no way to query them ahead of time. H264RtpEncoder pushes them into this format via setSpropParameterSets()/setProfileLevelId() as soon as they become available; until then, format() simply omits those attributes. Conformant clients still work either way because H264RtpEncoder also (re-)sends SPS/PPS in-band before every IDR frame.

SDP format: m=video 0 RTP/AVP 96 a=rtpmap:96 H264/90000 a=fmtp:96 packetization-mode=1[;profile-level-id=...;sprop-parameter-sets=...]

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ RTSPFormatH264()

RTSPFormatH264 ( int  width = 1280,
int  height = 720,
float  framerate = 15.0f 
)
inline

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

RTSPVideoInfo defaultVideoConfig ( )
inlineoverridevirtual

Reimplemented from RTSPFormat.

◆ format()

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

Implements RTSPFormat.

◆ fragmentSize()

virtual int fragmentSize ( )
inlinevirtualinherited

Fragment (=write) size in bytes.

Reimplemented in RTSPFormatMP3.

◆ getFramerate()

float getFramerate ( ) const
inline

Get framerate.

◆ getHeight()

int getHeight ( ) const
inline

Get video height.

◆ getWidth()

int getWidth ( ) const
inline

Get video width.

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

◆ setName()

void setName ( const char *  name)
inlineinherited

Defines the name of the stream.

◆ setProfileLevelId()

void setProfileLevelId ( const char *  hex6)
inlineoverridevirtual

Called by H264RtpEncoder with the 3-byte profile-level-id (as 6 hex digits) parsed from the SPS.

Reimplemented from RTSPFormat.

◆ setSpropParameterSets()

void setSpropParameterSets ( const char *  base64Sps,
const char *  base64Pps 
)
inlineoverridevirtual

Called by H264RtpEncoder once it has extracted SPS/PPS from the stream, so DESCRIBE responses can advertise sprop-parameter-sets.

Reimplemented from RTSPFormat.

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

◆ setVideoDimensions()

void setVideoDimensions ( int  width,
int  height 
)
inline

Set video dimensions.

◆ timerPeriodUs()

virtual int timerPeriodUs ( )
inlinevirtualinherited

Timer period in microseconds.

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

◆ timestampIncrement()

int timestampIncrement ( )
inlineoverridevirtual

Override timestamp increment for video (90kHz clock)

Reimplemented from RTSPFormat.

◆ 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

◆ profile_level_id

String profile_level_id = "42E01E"
protected

◆ sprop_parameter_sets

String sprop_parameter_sets
protected

◆ 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 = 15.0f
protected

◆ video_height

int video_height = 720
protected

◆ video_width

int video_width = 1280
protected

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