libgpac
Documentation of the core library of GPAC
RTP Streamer

RTPStreamer object. More...

+ Collaboration diagram for RTP Streamer:

Data Structures

struct  GF_RTPStreamerConfig
 

Typedefs

typedef struct __rtp_streamer GF_RTPStreamer
 
typedef void(* gf_rtcp_rr_callback) (void *cbk, u32 ssrc, u32 rtt_ms, u64 jitter_rtp_ts, u32 loss_rate)
 

Functions

GF_RTPStreamergf_rtp_streamer_new (u32 streamType, u32 codecid, u32 timeScale, const char *ip_dest, u16 port, u32 MTU, u8 TTL, const char *ifce_addr, u32 flags, const u8 *dsi, u32 dsi_len, u32 PayloadType, u32 sample_rate, u32 nb_ch, Bool is_crypted, u32 IV_length, u32 KI_length, u32 MinSize, u32 MaxSize, u32 avgTS, u32 maxDTSDelta, u32 const_dur, u32 bandwidth, u32 max_ptime, u32 au_sn_len, Bool for_rtsp)
 RTP Streamer constructor with extended parameters. More...
 
GF_RTPStreamergf_rtp_streamer_new_ex (const GF_RTPStreamerConfig *cfg, Bool for_rtsp)
 RTP Streamer constructor with extended parameters. More...
 
void gf_rtp_streamer_del (GF_RTPStreamer *streamer)
 RTP file streamer destructor. More...
 
GF_Err gf_rtp_streamer_append_sdp (GF_RTPStreamer *rtp, u16 ESID, const u8 *dsi, u32 dsi_len, char *KMS_URI, char **out_sdp_buffer)
 gets the SDP file More...
 
GF_Err gf_rtp_streamer_append_sdp_extended (GF_RTPStreamer *rtp, u16 ESID, const u8 *dsi, u32 dsi_len, const u8 *dsi_enh, u32 dsi_enh_len, char *KMS_URI, u32 width, u32 height, u32 tw, u32 th, s32 tx, s32 ty, s16 tl, u32 nb_chan, Bool for_rtsp, char **out_sdp_buffer)
 gets the SDP file More...
 
GF_Err gf_rtp_streamer_send_au (GF_RTPStreamer *rtp, u8 *data, u32 size, u64 cts, u64 dts, Bool is_rap)
 
GF_Err gf_rtp_streamer_send_au_with_sn (GF_RTPStreamer *rtp, u8 *data, u32 size, u64 cts, u64 dts, Bool is_rap, u32 inc_au_sn)
 
GF_Err gf_rtp_streamer_send_data (GF_RTPStreamer *streamer, u8 *data, u32 size, u32 fullsize, u64 cts, u64 dts, Bool is_rap, Bool au_start, Bool au_end, u32 au_sn, u32 duration, u32 sampleDescriptionIndex)
 
char * gf_rtp_streamer_format_sdp_header (char *app_name, char *ip_dest, char *session_name, char *iod64)
 
void gf_rtp_streamer_disable_auto_rtcp (GF_RTPStreamer *streamer)
 
GF_Err gf_rtp_streamer_send_bye (GF_RTPStreamer *streamer)
 
GF_Err gf_rtp_streamer_send_rtcp (GF_RTPStreamer *streamer, Bool force_ts, u32 rtp_ts, u32 force_ntp_type, u32 ntp_sec, u32 ntp_frac)
 
u8 gf_rtp_streamer_get_payload_type (GF_RTPStreamer *streamer)
 
GF_Err gf_rtp_streamer_init_rtsp (GF_RTPStreamer *streamer, u32 path_mtu, GF_RTSPTransport *tr, const char *ifce_addr)
 
u16 gf_rtp_streamer_get_next_rtp_sn (GF_RTPStreamer *streamer)
 
GF_Err gf_rtp_streamer_set_interleave_callbacks (GF_RTPStreamer *streamer, GF_Err(*RTP_TCPCallback)(void *cbk1, void *cbk2, Bool is_rtcp, u8 *pck, u32 pck_size), void *cbk1, void *cbk2)
 
GF_Err gf_rtp_streamer_read_rtcp (GF_RTPStreamer *streamer, gf_rtcp_rr_callback rtcp_cbk, void *udta)
 
u32 gf_rtp_streamer_get_ssrc (GF_RTPStreamer *streamer)
 
u32 gf_rtp_streamer_get_timescale (GF_RTPStreamer *streamer)
 
u32 gf_rtp_streamer_get_codecid (GF_RTPStreamer *streamer)
 

Detailed Description

This section documents the RTP streamer object of the GPAC framework.


Data Structure Documentation

◆ GF_RTPStreamerConfig

struct GF_RTPStreamerConfig

RTP streamer configuration

Data Fields
u32 streamType type of the stream (GF_STREAM_* as defined in <gpac/constants.h>
u32 codecid codec ID for the stream (GF_CODEC_* as defined in <gpac/constants.h>)
u32 timeScale unit to express timestamps of access units
const char * ip_dest IP address of the destination.
u16 port port number of the destination
u32 MTU Maximum Transmission Unit size to use.
u8 TTL Time To Leave.
const char * ifce_addr IP of the local interface to use (may be NULL)
u32 flags set of RTP flags passed to the streamer
const u8 * dsi MPEG-4 Decoder Specific Info for the stream.
u32 dsi_len length of the dsi parameter
u32 PayloadType RTP payload type.
u32 sample_rate audio sample rate
u32 nb_ch number of channels in audio streams
Bool is_crypted indicating if the stream is crypted
u32 IV_length length of the Initialisation Vector used for ISMA encryption
u32 KI_length length of the key index
u32 MinSize minimum AU size, 0 if unknown
u32 MaxSize
u32 avgTS average TS delta in timeScale, 0 if unknown
u32 maxDTSDelta maximum DTS delta in timeScale, 0 if unknown
u32 const_dur constant duration in timeScale, 0 if unknown
u32 bandwidth bandwidth, 0 if unknown
u32 max_ptime maximum packet duration in timeScale, 0 if unknown
u32 au_sn_len length of the MPEG-4 SL descriptor AU sequence number field, 0 if unknown
const char * netcap_id ID of netcap configuration to use, may be null (see gpac -h netcap)

Typedef Documentation

◆ GF_RTPStreamer

typedef struct __rtp_streamer GF_RTPStreamer

RTP streamer object

◆ gf_rtcp_rr_callback

typedef void(* gf_rtcp_rr_callback) (void *cbk, u32 ssrc, u32 rtt_ms, u64 jitter_rtp_ts, u32 loss_rate)

callback function for procesing RTCP receiver reports

Parameters
cbkuser data passed to gf_rtp_streamer_read_rtcp
ssrcssrc for this report, 0 if same as ssrc of channel
rtt_msround-trip time estimate in ms
jitter_rtp_tsinter-arrival jitter in RTP channel timescale
loss_rateloss rate in per-thousands

Function Documentation

◆ gf_rtp_streamer_new()

GF_RTPStreamer* gf_rtp_streamer_new ( u32  streamType,
u32  codecid,
u32  timeScale,
const char *  ip_dest,
u16  port,
u32  MTU,
u8  TTL,
const char *  ifce_addr,
u32  flags,
const u8 dsi,
u32  dsi_len,
u32  PayloadType,
u32  sample_rate,
u32  nb_ch,
Bool  is_crypted,
u32  IV_length,
u32  KI_length,
u32  MinSize,
u32  MaxSize,
u32  avgTS,
u32  maxDTSDelta,
u32  const_dur,
u32  bandwidth,
u32  max_ptime,
u32  au_sn_len,
Bool  for_rtsp 
)

Constructs a new RTP file streamer

Parameters
streamTypetype of the stream (GF_STREAM_* as defined in <gpac/constants.h>)
codecidcodec ID for the stream (GF_CODEC_* as defined in <gpac/constants.h>)
timeScaleunit to express timestamps of access units
ip_destIP address of the destination
portport number of the destination
MTUMaximum Transmission Unit size to use
TTLTime To Leave
ifce_addrIP of the local interface to use (may be NULL)
flagsset of RTP flags passed to the streamer
dsiMPEG-4 Decoder Specific Info for the stream
dsi_lenlength of the dsi parameter
PayloadTypeRTP payload type
sample_rateaudio sample rate
nb_chnumber of channels in audio streams
is_cryptedBoolean indicating if the stream is crypted
IV_lengthlenght of the Initialisation Vector used for encryption
KI_lengthlength of the key index
MinSizeminimum AU size, 0 if unknown
MaxSizemaximum AU size, 0 if unknown
avgTSaverage TS delta in timeScale, 0 if unknown
maxDTSDeltamaximum DTS delta in timeScale, 0 if unknown
const_durconstant duration in timeScale, 0 if unknown
bandwidthbandwidth, 0 if unknown
max_ptimemaximum packet duration in timeScale, 0 if unknown
au_sn_lenlength of the MPEG-4 SL descriptor AU sequence number field, 0 if unknown
for_rtspindicates this is an RTP channel in an RTSP session, RTP channel will not be created, use gf_rtp_streamer_init_rtsp
Returns
a new RTP streamer, or NULL of error or not supported

◆ gf_rtp_streamer_new_ex()

GF_RTPStreamer* gf_rtp_streamer_new_ex ( const GF_RTPStreamerConfig cfg,
Bool  for_rtsp 
)

Constructs a new RTP file streamer

Parameters
cfgconfiguration of the streamer
for_rtspindicates this is an RTP channel in an RTSP session, RTP channel will not be created, use gf_rtp_streamer_init_rtsp
Returns
a new RTP streamer, or NULL of error or not supported

◆ gf_rtp_streamer_del()

void gf_rtp_streamer_del ( GF_RTPStreamer streamer)

Destructs an RTP file streamer

Parameters
streamerthe target RTP streamer

◆ gf_rtp_streamer_append_sdp()

GF_Err gf_rtp_streamer_append_sdp ( GF_RTPStreamer rtp,
u16  ESID,
const u8 dsi,
u32  dsi_len,
char *  KMS_URI,
char **  out_sdp_buffer 
)

Gets the SDP asscoiated with all media in the streaming session (only media parts are returned)

Parameters
rtpthe target RTP streamer
ESIDThe MPEG-4 elementary stream id of the stream to process
dsiThe decoder specific info data
dsi_lenlength of the decoder specific info data
KMS_URIURI of the Key Management System
out_sdp_bufferlocation to the SDP buffer to allocate and fill
Returns
error if any

◆ gf_rtp_streamer_append_sdp_extended()

GF_Err gf_rtp_streamer_append_sdp_extended ( GF_RTPStreamer rtp,
u16  ESID,
const u8 dsi,
u32  dsi_len,
const u8 dsi_enh,
u32  dsi_enh_len,
char *  KMS_URI,
u32  width,
u32  height,
u32  tw,
u32  th,
s32  tx,
s32  ty,
s16  tl,
u32  nb_chan,
Bool  for_rtsp,
char **  out_sdp_buffer 
)

Gets the SDP asscoiated with all media in the streaming session (only media parts are returned)

Parameters
rtpthe target RTP streamer
ESIDThe MPEG-4 elementary stream id of the stream to process
dsidecoder specific info data
dsi_lenlength of the decoder specific info data
dsi_enhenhancement layer decoder specific info data
dsi_enh_lenlength of enhancement layer decoder specific info data
KMS_URIURI of the Key Management System
widthvideo width
heightvideo height
twtext window width
thtext window height
txtext window horizontal offset
tytext window vertical offset
tltext window z-index
nb_channumber of audio channels, 0 if unknown
for_rtspif GF_TRUE, produces the SDP for an RTSP describe (no port info)
out_sdp_bufferlocation to the SDP buffer to allocate and fill
Returns
error if any

◆ gf_rtp_streamer_send_au()

GF_Err gf_rtp_streamer_send_au ( GF_RTPStreamer rtp,
u8 data,
u32  size,
u64  cts,
u64  dts,
Bool  is_rap 
)

sends a full Access Unit over RTP

Parameters
rtpthe target RTP streamer
dataAU payload
sizeAU payload size
ctscomposition timestamp in timeScale unit
dtsdecoding timestamp in timeScale unit
is_rapindicates if the AU is a random access
Returns
error if any

◆ gf_rtp_streamer_send_au_with_sn()

GF_Err gf_rtp_streamer_send_au_with_sn ( GF_RTPStreamer rtp,
u8 data,
u32  size,
u64  cts,
u64  dts,
Bool  is_rap,
u32  inc_au_sn 
)

sends a full Access Unit over RTP

Parameters
rtpthe target RTP streamer
dataAU payload
sizeAU payload size
ctscomposition timestamp in timeScale unit
dtsdecoding timestamp in timeScale unit
is_rapindicates if the AU is a random access
inc_au_snincrements the AU sequence number by the given value before packetizing (used for MPEG-4 systems carousel)
Returns
error if any

◆ gf_rtp_streamer_send_data()

GF_Err gf_rtp_streamer_send_data ( GF_RTPStreamer streamer,
u8 data,
u32  size,
u32  fullsize,
u64  cts,
u64  dts,
Bool  is_rap,
Bool  au_start,
Bool  au_end,
u32  au_sn,
u32  duration,
u32  sampleDescriptionIndex 
)

sends a full or partial Access Unit over RTP

Parameters
streamerthe target RTP streamer
dataAU payload
sizeAU payload size
fullsizethe size of the complete AU
ctscomposition timestamp in timeScale unit
dtsdecoding timestamp in timeScale unit
is_rapindicates if the AU is a random access
au_startindicates if this chunk is the start of the AU
au_endindicates if this chunk is the end of the AU
au_snindicates the AU sequence number
durationindicates the AU duration
sampleDescriptionIndexindicates the ISOBMFF sampleDescriptionIndex for this AU (needed for 3GPP timed text)
Returns
error if any

◆ gf_rtp_streamer_format_sdp_header()

char* gf_rtp_streamer_format_sdp_header ( char *  app_name,
char *  ip_dest,
char *  session_name,
char *  iod64 
)

formats a generic SDP header

Parameters
app_nameapplication name, may be NULL
ip_destdestination IP address, shall NOT be NULL
session_namesession name, may be NULL
iod64base64 encoded MPEG-4 IOD, may be NULL
Returns
the SDP header - shall be destroyed by caller

◆ gf_rtp_streamer_disable_auto_rtcp()

void gf_rtp_streamer_disable_auto_rtcp ( GF_RTPStreamer streamer)

disables RTCP keepalive

Parameters
streamerthe target RTP streamer

◆ gf_rtp_streamer_send_bye()

GF_Err gf_rtp_streamer_send_bye ( GF_RTPStreamer streamer)

sends RTCP bye packet

Parameters
streamerthe target RTP streamer
Returns
error if any

◆ gf_rtp_streamer_send_rtcp()

GF_Err gf_rtp_streamer_send_rtcp ( GF_RTPStreamer streamer,
Bool  force_ts,
u32  rtp_ts,
u32  force_ntp_type,
u32  ntp_sec,
u32  ntp_frac 
)

sends RTCP server report

Parameters
streamerthe target RTP streamer
force_tsif GF_TRUE, forces using the indicatet ts
rtp_tsthe force RTP timestamp to use
force_ntp_typeif 0, computes NTP while sending. If 1 or 2, uses ntp_sec and ntp_frac for report. If 2, forces sending reports right away
ntp_secNTP seconds
ntp_fracNTP fractional part
Returns
error if any

◆ gf_rtp_streamer_get_payload_type()

u8 gf_rtp_streamer_get_payload_type ( GF_RTPStreamer streamer)

gets associated payload type

Parameters
streamerthe target RTP streamer
Returns
the payload type

◆ gf_rtp_streamer_init_rtsp()

GF_Err gf_rtp_streamer_init_rtsp ( GF_RTPStreamer streamer,
u32  path_mtu,
GF_RTSPTransport tr,
const char *  ifce_addr 
)

initializes the RTP channel for RTSP setup

Parameters
streamerthe target RTP streamer
path_mtuMTU path size in bytes
trthe RTSP transport description
ifce_addrIP address of network interface to use
Returns
error if any

◆ gf_rtp_streamer_get_next_rtp_sn()

u16 gf_rtp_streamer_get_next_rtp_sn ( GF_RTPStreamer streamer)

gets the sequence number of the next RTP packet to be sent

Parameters
streamerthe target RTP streamer
Returns
the sequence number

◆ gf_rtp_streamer_set_interleave_callbacks()

GF_Err gf_rtp_streamer_set_interleave_callbacks ( GF_RTPStreamer streamer,
GF_Err(*)(void *cbk1, void *cbk2, Bool is_rtcp, u8 *pck, u32 pck_size)  RTP_TCPCallback,
void *  cbk1,
void *  cbk2 
)

sets callback functions for RTP over RTSP sending

Parameters
streamerthe target RTP streamer
RTP_TCPCallbackthe callback function
cbk1first opaque data passed to callback function
cbk2second opaque data passed to callback function
Returns
error if any

◆ gf_rtp_streamer_read_rtcp()

GF_Err gf_rtp_streamer_read_rtcp ( GF_RTPStreamer streamer,
gf_rtcp_rr_callback  rtcp_cbk,
void *  udta 
)

process rtcp reports if any

Parameters
streamerthe target RTP streamer
rtcp_cbkcallback function for RTCP reports
udtauser data to use for callback function
Returns
error if any, GF_EOS if empty

◆ gf_rtp_streamer_get_ssrc()

u32 gf_rtp_streamer_get_ssrc ( GF_RTPStreamer streamer)

gets ssrc of this streamer

Parameters
streamerthe target RTP streamer
Returns
ssrc ID

◆ gf_rtp_streamer_get_timescale()

u32 gf_rtp_streamer_get_timescale ( GF_RTPStreamer streamer)

gets rtp timescale of this streamer

Parameters
streamerthe target RTP streamer
Returns
timescale

◆ gf_rtp_streamer_get_codecid()

u32 gf_rtp_streamer_get_codecid ( GF_RTPStreamer streamer)

gets codecid of this streamer

Parameters
streamerthe target RTP streamer
Returns
CodecID