libgpac
Documentation of the core library of GPAC
RTP Streaming

Tools for real-time streaming over IP using RTP/RTCP/RTSP/SDP. More...

+ Collaboration diagram for RTP Streaming:

Data Structures

struct  GF_RTSPRange
 
struct  GF_RTSPTransport
 
struct  GF_RTSPCommand
 
struct  GF_RTPInfo
 
struct  GF_RTSPResponse
 
struct  GF_RTPHeader
 
struct  GF_RTPMap
 
struct  GF_X_Attribute
 
struct  GF_SDPBandwidth
 
struct  GF_SDPTiming
 
struct  GF_SDPConnection
 
struct  GF_SDP_FMTP
 
struct  GF_SDPMedia
 
struct  GF_SDPInfo
 
struct  GP_RTPSLMap
 
struct  GF_RTPStaticMap
 

Macros

#define GF_RTSP_VERSION   "RTSP/1.0"
 
#define GF_RTSP_PROFILE_RTP_AVP   "RTP/AVP"
 
#define GF_RTSP_PROFILE_RTP_AVP_TCP   "RTP/AVP/TCP"
 
#define GF_RTSP_PROFILE_UDP   "udp"
 
#define GF_RTSP_DESCRIBE   "DESCRIBE"
 
#define GF_RTSP_SETUP   "SETUP"
 
#define GF_RTSP_PLAY   "PLAY"
 
#define GF_RTSP_PAUSE   "PAUSE"
 
#define GF_RTSP_RECORD   "RECORD"
 
#define GF_RTSP_TEARDOWN   "TEARDOWN"
 
#define GF_RTSP_GET_PARAMETER   "GET_PARAMETER"
 
#define GF_RTSP_SET_PARAMETER   "SET_PARAMETER"
 
#define GF_RTSP_OPTIONS   "OPTIONS"
 
#define GF_RTSP_ANNOUNCE   "ANNOUNCE"
 
#define GF_RTSP_REDIRECT   "REDIRECT"
 
#define GF_RTSP_TUNNEL_POST   -1000
 
#define GF_SDP_MAX_TIMEOFFSET   10
 

Typedefs

typedef struct _tag_rtsp_session GF_RTSPSession
 
typedef GF_Err(* gf_rtsp_interleave_callback) (GF_RTSPSession *sess, void *cbk_ptr, u8 *buffer, u32 bufferSize, Bool IsRTCP)
 
typedef struct __tag_rtp_channel GF_RTPChannel
 
typedef GF_Err(* gf_rtp_tcp_callback) (void *cbk1, void *cbk2, Bool is_rtcp, u8 *pck, u32 pck_size)
 
typedef struct __tag_rtp_packetizer GP_RTPPacketizer
 
typedef void(* gf_rtp_packet_cbk) (void *udta, u8 *payload, u32 size, GF_SLHeader *hdr, GF_Err e)
 
typedef struct __tag_rtp_depacketizer GF_RTPDepacketizer
 

Enumerations

enum  {
  NC_RTSP_Continue = 100 , NC_RTSP_OK = 200 , NC_RTSP_Created = 201 , NC_RTSP_Low_on_Storage_Space = 250 ,
  NC_RTSP_Multiple_Choice = 300 , NC_RTSP_Moved_Permanently = 301 , NC_RTSP_Moved_Temporarily = 302 , NC_RTSP_See_Other = 303 ,
  NC_RTSP_Use_Proxy = 305 , NC_RTSP_Bad_Request = 400 , NC_RTSP_Unauthorized = 401 , NC_RTSP_Payment_Required = 402 ,
  NC_RTSP_Forbidden = 403 , NC_RTSP_Not_Found = 404 , NC_RTSP_Method_Not_Allowed = 405 , NC_RTSP_Not_Acceptable = 406 ,
  NC_RTSP_Proxy_Authentication_Required = 407 , NC_RTSP_Request_Timeout = 408 , NC_RTSP_Gone = 410 , NC_RTSP_Length_Required = 411 ,
  NC_RTSP_Precondition_Failed = 412 , NC_RTSP_Request_Entity_Too_Large = 413 , NC_RTSP_Request_URI_Too_Long = 414 , NC_RTSP_Unsupported_Media_Type = 415 ,
  NC_RTSP_Invalid_parameter = 451 , NC_RTSP_Illegal_Conference_Identifier = 452 , NC_RTSP_Not_Enough_Bandwidth = 453 , NC_RTSP_Session_Not_Found = 454 ,
  NC_RTSP_Method_Not_Valid_In_This_State = 455 , NC_RTSP_Header_Field_Not_Valid = 456 , NC_RTSP_Invalid_Range = 457 , NC_RTSP_Parameter_Is_ReadOnly = 458 ,
  NC_RTSP_Aggregate_Operation_Not_Allowed = 459 , NC_RTSP_Only_Aggregate_Operation_Allowed = 460 , NC_RTSP_Unsupported_Transport = 461 , NC_RTSP_Destination_Unreachable = 462 ,
  NC_RTSP_Internal_Server_Error = 500 , NC_RTSP_Not_Implemented = 501 , NC_RTSP_Bad_Gateway = 502 , NC_RTSP_Service_Unavailable = 503 ,
  NC_RTSP_Gateway_Timeout = 504 , NC_RTSP_RTSP_Version_Not_Supported = 505 , NC_RTSP_Option_not_support = 551
}
 
enum  { GF_RTSP_STATE_INIT = 0 , GF_RTSP_STATE_WAITING , GF_RTSP_STATE_WAIT_FOR_CONTROL , GF_RTSP_STATE_INVALIDATED }
 
enum  {
  GP_RTP_PCK_FORCE_MPEG4 = (1) , GP_RTP_PCK_USE_MULTI = (1<<1) , GP_RTP_PCK_USE_INTERLEAVING = (1<<2) , GP_RTP_PCK_USE_STATIC_ID = (1<<3) ,
  GP_RTP_PCK_SIGNAL_RAP = (1<<4) , GP_RTP_PCK_SIGNAL_AU_IDX = (1<<5) , GP_RTP_PCK_SIGNAL_SIZE = (1<<6) , GP_RTP_PCK_SIGNAL_TS = (1<<7) ,
  GP_RTP_PCK_SYSTEMS_CAROUSEL = (1<<8) , GP_RTP_PCK_USE_LATM_AAC = (1<<9) , GP_RTP_PCK_SELECTIVE_ENCRYPTION = (1<<10) , GP_RTP_PCK_KEY_IDX_PER_AU = (1<<11) ,
  GP_RTP_DIMS_COMPRESSED = (1<<12)
}
 
enum  {
  GF_RTP_PAYT_PCMU = 0 , GF_RTP_PAYT_GSM , GF_RTP_PAYT_G723 , GF_RTP_PAYT_DVI4_8K ,
  GF_RTP_PAYT_DVI4_16K , GF_RTP_PAYT_LPC , GF_RTP_PAYT_PCMA , GF_RTP_PAYT_G722 ,
  GF_RTP_PAYT_L16_STEREO , GF_RTP_PAYT_L16_MONO , GF_RTP_PAYT_QCELP_BASIC , GF_RTP_PAYT_CN ,
  GF_RTP_PAYT_MPEG12_AUDIO , GF_RTP_PAYT_G728 , GF_RTP_PAYT_DVI4_11K , GF_RTP_PAYT_DVI4_22K ,
  GF_RTP_PAYT_G729 , GF_RTP_PAYT_CelB = 25 , GF_RTP_PAYT_JPEG = 26 , GF_RTP_PAYT_nv = 28 ,
  GF_RTP_PAYT_H261 = 31 , GF_RTP_PAYT_MPEG12_VIDEO = 32 , GF_RTP_PAYT_MP2T = 33 , GF_RTP_PAYT_H263 = 34 ,
  GF_RTP_PAYT_LAST_STATIC_DEFINED = 35 , GF_RTP_PAYT_UNKNOWN = 128 , GF_RTP_PAYT_MPEG4 , GF_RTP_PAYT_AMR ,
  GF_RTP_PAYT_AMR_WB , GF_RTP_PAYT_QCELP , GF_RTP_PAYT_EVRC_SMV , GF_RTP_PAYT_3GPP_TEXT ,
  GF_RTP_PAYT_H264_AVC , GF_RTP_PAYT_LATM , GF_RTP_PAYT_AC3 , GF_RTP_PAYT_EAC3 ,
  GF_RTP_PAYT_H264_SVC , GF_RTP_PAYT_HEVC , GF_RTP_PAYT_LHVC , GF_RTP_PAYT_VVC ,
  GF_RTP_PAYT_OPUS
}
 
enum  {
  GF_RTP_NEW_AU = (1) , GF_RTP_AMR_ALIGN = (1<<1) , GF_RTP_M4V_CHECK_RAP = (1<<2) , GF_RTP_AVC_WAIT_RAP = (1<<4) ,
  GF_RTP_HAS_ISMACRYP = (1<<5) , GF_RTP_ISMA_SEL_ENC = (1<<6) , GF_RTP_ISMA_HAS_KEY_IDX = (1<<7) , GF_RTP_AVC_USE_ANNEX_B = (1<<8)
}
 

Functions

const char * gf_rtsp_nc_to_string (u32 ErrCode)
 
GF_RTSPRangegf_rtsp_range_parse (char *range_buf)
 
GF_RTSPRangegf_rtsp_range_new ()
 
void gf_rtsp_range_del (GF_RTSPRange *range)
 
GF_RTSPTransportgf_rtsp_transport_clone (GF_RTSPTransport *transp)
 
void gf_rtsp_transport_del (GF_RTSPTransport *transp)
 
GF_RTSPCommandgf_rtsp_command_new ()
 
void gf_rtsp_command_del (GF_RTSPCommand *com)
 
void gf_rtsp_command_reset (GF_RTSPCommand *com)
 
GF_RTSPResponsegf_rtsp_response_new ()
 
void gf_rtsp_response_del (GF_RTSPResponse *rsp)
 
void gf_rtsp_response_reset (GF_RTSPResponse *rsp)
 
GF_RTSPSessiongf_rtsp_session_new (char *sURL, u16 DefaultPort)
 
void gf_rtsp_session_del (GF_RTSPSession *sess)
 
GF_Err gf_rtsp_set_buffer_size (GF_RTSPSession *sess, u32 BufferSize)
 
u32 gf_rtsp_session_reset (GF_RTSPSession *sess, Bool ResetConnection)
 
Bool gf_rtsp_is_my_session (GF_RTSPSession *sess, char *url)
 
const char * gf_rtsp_get_server_name (GF_RTSPSession *sess)
 
const char * gf_rtsp_get_user (GF_RTSPSession *sess)
 
const char * gf_rtsp_get_password (GF_RTSPSession *sess)
 
u16 gf_rtsp_get_session_port (GF_RTSPSession *sess)
 
Bool gf_rtsp_use_tls (GF_RTSPSession *sess)
 
GF_Err gf_rtsp_get_response (GF_RTSPSession *sess, GF_RTSPResponse *rsp)
 
u32 gf_rtsp_get_session_state (GF_RTSPSession *sess)
 
void gf_rtsp_reset_aggregation (GF_RTSPSession *sess)
 
GF_Err gf_rtsp_send_command (GF_RTSPSession *sess, GF_RTSPCommand *com)
 
GF_Err gf_rtsp_check_connection (GF_RTSPSession *sess)
 
GF_Err gf_rtsp_set_interleave_callback (GF_RTSPSession *sess, gf_rtsp_interleave_callback SignalData)
 
GF_Err gf_rtsp_session_read (GF_RTSPSession *sess)
 
GF_Err gf_rtsp_register_interleave (GF_RTSPSession *sess, void *the_ch, u8 LowInterID, u8 HighInterID)
 
u32 gf_rtsp_unregister_interleave (GF_RTSPSession *sess, u8 LowInterID)
 
GF_RTSPSessiongf_rtsp_session_new_server (GF_Socket *rtsp_listener, Bool allow_http_tunnel, void *ssl_ctx)
 
GF_Err gf_rtsp_get_command (GF_RTSPSession *sess, GF_RTSPCommand *com)
 
char * gf_rtsp_generate_session_id (GF_RTSPSession *sess)
 
GF_Err gf_rtsp_send_response (GF_RTSPSession *sess, GF_RTSPResponse *rsp)
 
GF_Err gf_rtsp_get_session_ip (GF_RTSPSession *sess, char buffer[GF_MAX_IP_NAME_LEN])
 
GF_Err gf_rtsp_get_remote_address (GF_RTSPSession *sess, char *buffer)
 
GF_Err gf_rtsp_session_write_interleaved (GF_RTSPSession *sess, u32 idx, u8 *pck, u32 pck_size)
 
const char * gf_rtsp_get_session_cookie (GF_RTSPSession *sess)
 
GF_Err gf_rtsp_merge_tunnel (GF_RTSPSession *sess, GF_RTSPSession *post_sess)
 
void gf_rtsp_session_set_netcap_id (GF_RTSPSession *sess, const char *netcap_id)
 
GF_RTPChannelgf_rtp_new ()
 
GF_RTPChannelgf_rtp_new_ex (const char *netcap_id)
 
void gf_rtp_del (GF_RTPChannel *ch)
 
GF_Err gf_rtp_setup_transport (GF_RTPChannel *ch, GF_RTSPTransport *trans_info, const char *remote_address)
 
GF_Err gf_rtp_set_ports (GF_RTPChannel *ch, u16 first_port)
 
GF_Err gf_rtp_setup_payload (GF_RTPChannel *ch, u32 PayloadType, u32 ClockRate)
 
void gf_rtp_enable_nat_keepalive (GF_RTPChannel *ch, u32 nat_timeout)
 
GF_Err gf_rtp_initialize (GF_RTPChannel *ch, u32 UDPBufferSize, Bool IsSource, u32 PathMTU, u32 ReorederingSize, u32 MaxReorderDelay, char *local_interface_ip)
 
GF_Err gf_rtp_stop (GF_RTPChannel *ch)
 
GF_Err gf_rtp_set_ssm (GF_RTPChannel *ch, const char **src_ip_inc, u32 nb_src_ip_inc, const char **src_ip_exc, u32 nb_src_ip_exc)
 
GF_Err gf_rtp_set_info_rtp (GF_RTPChannel *ch, u32 seq_num, u32 rtp_time, u32 ssrc)
 
Double gf_rtp_get_current_time (GF_RTPChannel *ch)
 
void gf_rtp_reset_buffers (GF_RTPChannel *ch)
 
void gf_rtp_reset_ssrc (GF_RTPChannel *ch)
 
u32 gf_rtp_read_rtp (GF_RTPChannel *ch, u8 *buffer, u32 buffer_size)
 
u32 gf_rtp_flush_rtp (GF_RTPChannel *ch, u8 *buffer, u32 buffer_size)
 
u32 gf_rtp_read_rtcp (GF_RTPChannel *ch, u8 *buffer, u32 buffer_size)
 
u32 gf_rtp_read_flush (GF_RTPChannel *ch, u8 *buffer, u32 buffer_size)
 
GF_Err gf_rtp_decode_rtp (GF_RTPChannel *ch, u8 *pck, u32 pck_size, GF_RTPHeader *rtp_hdr, u32 *PayloadStart)
 
GF_Err gf_rtp_decode_rtcp (GF_RTPChannel *ch, u8 *pck, u32 pck_size, Bool *has_sr)
 
GF_Err gf_rtp_send_rtcp_report (GF_RTPChannel *ch)
 
void gf_rtp_set_loss_rate (GF_RTPChannel *ch, u32 loss_rate)
 
GF_Err gf_rtp_send_bye (GF_RTPChannel *ch)
 
GF_Err gf_rtp_send_packet (GF_RTPChannel *ch, GF_RTPHeader *rtp_hdr, u8 *pck, u32 pck_size, Bool fast_send)
 
GF_Err gf_rtp_set_interleave_callbacks (GF_RTPChannel *ch, gf_rtp_tcp_callback tcp_callback, void *cbk1, void *cbk2)
 
u32 gf_rtp_is_unicast (GF_RTPChannel *ch)
 
u32 gf_rtp_is_interleaved (GF_RTPChannel *ch)
 
u32 gf_rtp_get_clockrate (GF_RTPChannel *ch)
 
u8 gf_rtp_get_low_interleave_id (GF_RTPChannel *ch)
 
u8 gf_rtp_get_hight_interleave_id (GF_RTPChannel *ch)
 
const GF_RTSPTransportgf_rtp_get_transport (GF_RTPChannel *ch)
 
Float gf_rtp_get_loss (GF_RTPChannel *ch)
 
u32 gf_rtp_get_tcp_bytes_sent (GF_RTPChannel *ch)
 
void gf_rtp_get_ports (GF_RTPChannel *ch, u16 *rtp_port, u16 *rtcp_port)
 
GF_SDPInfogf_sdp_info_new ()
 
void gf_sdp_info_del (GF_SDPInfo *sdp)
 
void gf_sdp_info_reset (GF_SDPInfo *sdp)
 
GF_Err gf_sdp_info_parse (GF_SDPInfo *sdp, char *sdp_text, u32 text_size)
 
GF_SDPMediagf_sdp_media_new ()
 
void gf_sdp_media_del (GF_SDPMedia *media)
 
GF_SDPConnectiongf_sdp_conn_new ()
 
void gf_sdp_conn_del (GF_SDPConnection *conn)
 
GF_SDP_FMTPgf_sdp_fmtp_new ()
 
void gf_sdp_fmtp_del (GF_SDP_FMTP *fmtp)
 
GP_RTPPacketizergf_rtp_builder_new (u32 rtp_payt, GF_SLConfig *slc, u32 flags, void *cbk_obj, void(*OnNewPacket)(void *cbk, GF_RTPHeader *header), void(*OnPacketDone)(void *cbk, GF_RTPHeader *header), void(*OnDataReference)(void *cbk, u32 payload_size, u32 offset_from_orig), void(*OnData)(void *cbk, u8 *data, u32 data_size, Bool is_head))
 
void gf_rtp_builder_del (GP_RTPPacketizer *builder)
 
void gf_rtp_builder_init (GP_RTPPacketizer *builder, u8 PayloadType, u32 MaxPayloadSize, u32 max_ptime, u32 StreamType, u32 codecid, u32 PL_ID, u32 avgSize, u32 maxSize, u32 avgTS, u32 maxDTS, u32 IV_length, u32 KI_length, char *pref_mode)
 
void gf_rtp_builder_set_cryp_info (GP_RTPPacketizer *builder, u64 IV, char *key_indicator, Bool is_encrypted)
 
GF_Err gf_rtp_builder_process (GP_RTPPacketizer *builder, u8 *data, u32 data_size, u8 IsAUEnd, u32 FullAUSize, u32 duration, u8 descIndex)
 
GF_Err gf_rtp_builder_format_sdp (GP_RTPPacketizer *builder, char *payload_name, char *sdp_line, char *dsi, u32 dsi_size)
 
Bool gf_rtp_builder_get_payload_name (GP_RTPPacketizer *builder, char payload_name[20], char media_name[20])
 
GF_RTPDepacketizergf_rtp_depacketizer_new (GF_SDPMedia *media, u32 hdr_payt, gf_rtp_packet_cbk sl_packet_cbk, void *udta)
 
void gf_rtp_depacketizer_del (GF_RTPDepacketizer *rtpd)
 
void gf_rtp_depacketizer_reset (GF_RTPDepacketizer *rtpd, Bool full_reset)
 
void gf_rtp_depacketizer_process (GF_RTPDepacketizer *rtpd, GF_RTPHeader *hdr, u8 *payload, u32 size)
 

Detailed Description

This section documents the tools used for real-time streaming over IP using RTP/RTCP/RTSP/SDP.


Data Structure Documentation

◆ GF_RTSPRange

struct GF_RTSPRange

RTSP Range information RTSP Session level only, although this is almost the same format as an SDP range, this is not used in the SDP lib as "a=range" is not part of SDP but part of RTSP

Data Fields
Double start
Double end
u32 UseSMPTE
Double FPS

◆ GF_RTSPTransport

struct GF_RTSPTransport

RTSP transport structure

Data Fields
Bool IsUnicast
char * destination
char * source
Bool IsRecord
Bool Append
Bool IsInterleaved
u32 rtpID
u32 rtcpID
u32 MulticastLayers
u8 TTL
u16 port_first
u16 port_last
u16 client_port_first
u16 client_port_last
u32 SSRC
char * Profile
Bool is_sender

◆ GF_RTSPCommand

struct GF_RTSPCommand

RTSP command structure

+ Collaboration diagram for GF_RTSPCommand:
Data Fields
char * Accept
char * Accept_Encoding
char * Accept_Language
char * Authorization
u32 Bandwidth
u32 Blocksize
char * Cache_Control
char * Conference
char * Connection
u32 Content_Length
u32 CSeq
char * From
char * Proxy_Authorization
char * Proxy_Require
GF_RTSPRange * Range
char * Referer
Double Scale
char * Session
Double Speed
GF_List * Transports
char * User_Agent
char * method
GF_List * Xtensions
char * body
char * ControlString
void * user_data
u32 user_flags
char * service_name
u32 StatusCode
Bool is_resend

◆ GF_RTPInfo

struct GF_RTPInfo

RTP-Info for RTP channels.

There may be several RTP-Infos in one response
based on the server implementation (DSS/QTSS begaves this way)
Data Fields
char * url
u32 seq
u32 rtp_time
u32 ssrc

◆ GF_RTSPResponse

struct GF_RTSPResponse

RTSP Response

+ Collaboration diagram for GF_RTSPResponse:
Data Fields
u32 ResponseCode
char * ResponseInfo
char * Accept
char * Accept_Encoding
char * Accept_Language
char * Allow
char * Authorization
u32 Bandwidth
u32 Blocksize
char * Cache_Control
char * Conference
char * Connection
char * Content_Base
char * Content_Encoding
char * Content_Language
u32 Content_Length
char * Content_Location
char * Content_Type
u32 CSeq
char * Date
char * Expires
char * From
char * Host
char * If_Match
char * If_Modified_Since
char * Last_Modified
char * Location
char * Proxy_Authenticate
char * Proxy_Require
char * Public
GF_RTSPRange * Range
char * Referer
char * Require
char * Retry_After
GF_List * RTP_Infos
Double Scale
char * Server
char * Session
u32 SessionTimeOut
Double Speed
u32 StreamID
char * Timestamp
GF_List * Transports
char * Unsupported
char * User_Agent
char * Vary
char * Via
char * WWW_Authenticate
GF_List * Xtensions
char * body

◆ GF_RTPHeader

struct GF_RTPHeader

RTP header

Data Fields
u8 Version
u8 Padding
u8 Extension
u8 CSRCCount
u8 Marker
u8 PayloadType
u16 SequenceNumber
u32 TimeStamp
u32 SSRC
u32 CSRC[16]
u64 recomputed_ntp_ts

◆ GF_RTPMap

struct GF_RTPMap

RTPMap information

Data Fields
u32 PayloadType
char * payload_name
u32 ClockRate
u32 AudioChannels

◆ GF_X_Attribute

struct GF_X_Attribute

Extension Attribute

All attributes x-ZZZZ are considered as extensions attributes. If no "x-" is found
the attributes in the RTSP response is SKIPPED. The "x-" radical is removed in the structure
when parsing commands / responses
Data Fields
char * Name
char * Value

◆ GF_SDPBandwidth

struct GF_SDPBandwidth

SDP bandwidth info

Data Fields
char * name
u32 value

◆ GF_SDPTiming

struct GF_SDPTiming

SDP Timing information

Data Fields
u32 StartTime
u32 StopTime
u32 RepeatInterval
u32 ActiveDuration
u32 OffsetFromStart[GF_SDP_MAX_TIMEOFFSET]
u32 NbRepeatOffsets
u32 AdjustmentTime[GF_SDP_MAX_TIMEOFFSET]
s32 AdjustmentOffset[GF_SDP_MAX_TIMEOFFSET]
u32 NbZoneOffsets

◆ GF_SDPConnection

struct GF_SDPConnection

SDP Connection information

Data Fields
char * net_type
char * add_type
char * host
s32 TTL
u32 add_count

◆ GF_SDP_FMTP

struct GF_SDP_FMTP

SDP FormatTypePayload

description of dynamic payload types. This is opaque at the SDP level.
Each attributes is assumed to be formatted as <param_name=param_val; ...>
If not the case the attribute will have an empty value string and only the
parameter name.
Data Fields
u32 PayloadType
GF_List * Attributes

◆ GF_SDPMedia

struct GF_SDPMedia

SDP Media information

Data Fields
u32 Type
u32 PortNumber
u32 NumPorts
char * Profile
GF_List * Connections
GF_List * RTPMaps
GF_List * FMTP
char * fmt_list
GF_List * Attributes
char * k_method
char * k_key
GF_List * Bandwidths
u32 PacketTime
u32 SendReceive
char * orientation
char * sdplang
char * lang
Double FrameRate
s32 Quality

◆ GF_SDPInfo

struct GF_SDPInfo

SDP information

+ Collaboration diagram for GF_SDPInfo:
Data Fields
u32 Version
char * o_username
char * o_session_id
char * o_version
char * o_address
char * o_net_type
char * o_add_type
char * s_session_name
char * i_description
char * u_uri
char * e_email
char * p_phone
GF_SDPConnection * c_connection
GF_List * b_bandwidth
GF_List * Timing
char * k_method
char * k_key
char * a_cat
char * a_keywds
char * a_tool
u32 a_SendReceive
char * a_type
char * a_charset
char * a_sdplang
char * a_lang
GF_List * Attributes
GF_List * media_desc

◆ GP_RTPSLMap

struct GP_RTPSLMap

Mapping between RTP and GPAC / MPEG-4 Systems SyncLayer

Data Fields
char mode[30]
u8 * config
u32 configSize
u8 config_updated
u8 StreamType
u32 PL_ID
u16 rvc_predef
u8 * rvc_config
u32 rvc_config_size
u32 ConstantSize
u32 ConstantDuration
u32 CodecID
u32 maxDisplacement
u32 deinterleaveBufferSize
u32 SizeLength
u32 IndexLength
u32 IndexDeltaLength
u32 DTSDeltaLength
u32 CTSDeltaLength
Bool RandomAccessIndication
u32 StreamStateIndication
u32 AuxiliaryDataSizeLength
u8 IV_length
u8 IV_delta_length
u8 KI_length
u32 auh_first_min_len
u32 auh_min_len

◆ GF_RTPStaticMap

struct GF_RTPStaticMap

Static RTP map definition, for static payload types

Data Fields
u32 fmt
u32 clock_rate
u32 stream_type
u32 codec_id
const char * mime

Macro Definition Documentation

◆ GF_RTSP_VERSION

#define GF_RTSP_VERSION   "RTSP/1.0"

RTSP version supported by GPAC

◆ GF_RTSP_PROFILE_RTP_AVP

#define GF_RTSP_PROFILE_RTP_AVP   "RTP/AVP"

RTSP AVP Transport Profile

◆ GF_RTSP_PROFILE_RTP_AVP_TCP

#define GF_RTSP_PROFILE_RTP_AVP_TCP   "RTP/AVP/TCP"

RTSP AVP + TCP Transport Profile

◆ GF_RTSP_PROFILE_UDP

#define GF_RTSP_PROFILE_UDP   "udp"

RTSP UDP Transport Profile

◆ GF_RTSP_DESCRIBE

#define GF_RTSP_DESCRIBE   "DESCRIBE"

RTSP DESCRIBE method

◆ GF_RTSP_SETUP

#define GF_RTSP_SETUP   "SETUP"

RTSP SETUP method

◆ GF_RTSP_PLAY

#define GF_RTSP_PLAY   "PLAY"

RTSP PLAY method

◆ GF_RTSP_PAUSE

#define GF_RTSP_PAUSE   "PAUSE"

RTSP PAUSE method

◆ GF_RTSP_RECORD

#define GF_RTSP_RECORD   "RECORD"

RTSP RECORD method

◆ GF_RTSP_TEARDOWN

#define GF_RTSP_TEARDOWN   "TEARDOWN"

RTSP TEARDOWN method

◆ GF_RTSP_GET_PARAMETER

#define GF_RTSP_GET_PARAMETER   "GET_PARAMETER"

RTSP GET_PARAMETER method

◆ GF_RTSP_SET_PARAMETER

#define GF_RTSP_SET_PARAMETER   "SET_PARAMETER"

RTSP SET_PARAMETER method

◆ GF_RTSP_OPTIONS

#define GF_RTSP_OPTIONS   "OPTIONS"

RTSP OPTIONS method

◆ GF_RTSP_ANNOUNCE

#define GF_RTSP_ANNOUNCE   "ANNOUNCE"

RTSP ANNOUCE method

◆ GF_RTSP_REDIRECT

#define GF_RTSP_REDIRECT   "REDIRECT"

RTSP REDIRECT method

◆ GF_RTSP_TUNNEL_POST

#define GF_RTSP_TUNNEL_POST   -1000

special error code for gf_rtsp_get_command

◆ GF_SDP_MAX_TIMEOFFSET

#define GF_SDP_MAX_TIMEOFFSET   10

SDP maximum time offset We do not support more than this offset / zone adjustment if more are needed, RFC recommends to use several entries rather than a big offset

Typedef Documentation

◆ GF_RTSPSession

typedef struct _tag_rtsp_session GF_RTSPSession

RTSP session

◆ gf_rtsp_interleave_callback

typedef GF_Err(* gf_rtsp_interleave_callback) (GF_RTSPSession *sess, void *cbk_ptr, u8 *buffer, u32 bufferSize, Bool IsRTCP)

callback function for interleaved RTSP/TCP transport

Parameters
sessthe target RTSP session
cbk_ptropaque data
bufferRTP or RTCP packet
bufferSizepacket size in bytes
IsRTCPset to GF_TRUE if the packet is an RTCP packet, GF_FALSE otherwise
Returns
error if any

◆ GF_RTPChannel

typedef struct __tag_rtp_channel GF_RTPChannel

RTP channel

◆ gf_rtp_tcp_callback

typedef GF_Err(* gf_rtp_tcp_callback) (void *cbk1, void *cbk2, Bool is_rtcp, u8 *pck, u32 pck_size)

callback used for writing rtp over TCP

Parameters
cbk1opaque user data
cbk2opaque user data
is_rtcpindicates the data is an RTCP packet
pckthe RTP/RTCP buffer
pck_sizethe RTP/RTCP size
Returns
error if any

◆ GP_RTPPacketizer

typedef struct __tag_rtp_packetizer GP_RTPPacketizer

RTP builder (packetizer)

◆ gf_rtp_packet_cbk

typedef void(* gf_rtp_packet_cbk) (void *udta, u8 *payload, u32 size, GF_SLHeader *hdr, GF_Err e)

RTP depacketizer callback

Parameters
udtaopaque user data
payloaddepacketized payload data
sizepayload size
hdrMPEG-4 Sync Layer structure for the payload (with AU start/end flag, timestamps, etc)
eerror if any

◆ GF_RTPDepacketizer

typedef struct __tag_rtp_depacketizer GF_RTPDepacketizer

RTP parser (depacketizer)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

RTSP NOTIF CODES

◆ anonymous enum

anonymous enum

RTSP States. The only non blocking mode is GF_RTSP_STATE_WAIT_FOR_CONTROL

Enumerator
GF_RTSP_STATE_INIT 

Initialized (connection might be off, but all structures are in place) This is the default state between # requests (aka, DESCRIBE and SETUP or SETUP and PLAY ...)

GF_RTSP_STATE_WAITING 

Waiting

GF_RTSP_STATE_WAIT_FOR_CONTROL 

PLAY, PAUSE, RECORD. Aggregation is allowed for the same type, you can send several command in a row. However the session will return GF_SERVICE_ERROR if you do not have a valid SessionID in the command You cannot issue a SETUP / DESCRIBE while in this state

GF_RTSP_STATE_INVALIDATED 

FATAL ERROR: session is invalidated by server. Call reset and restart from SETUP if needed

◆ anonymous enum

anonymous enum

packetizer config flags - some flags are dynamically re-assigned when detecting multiSL / B-Frames / ...

◆ anonymous enum

anonymous enum

Supported payload types

◆ anonymous enum

anonymous enum

rtp payload flags

Function Documentation

◆ gf_rtsp_nc_to_string()

const char* gf_rtsp_nc_to_string ( u32  ErrCode)

Gives string description of error code

Parameters
ErrCodethe RTSP error code
Returns
the description of the RTSP error code

◆ gf_rtsp_range_parse()

GF_RTSPRange* gf_rtsp_range_parse ( char *  range_buf)

parses a Range line and returns range header structure. This can be used for RTSP extension of SDP

Note
Only support for npt for now
Parameters
range_bufthe range string
Returns
a newly allocated RTSP range

◆ gf_rtsp_range_new()

GF_RTSPRange* gf_rtsp_range_new ( )

creates a new RTSP range

Returns
a newly allocated RTSP range

◆ gf_rtsp_range_del()

void gf_rtsp_range_del ( GF_RTSPRange range)

destroys a RTSP range

Parameters
rangethe target RTSP range

◆ gf_rtsp_transport_clone()

GF_RTSPTransport* gf_rtsp_transport_clone ( GF_RTSPTransport transp)

clones a RTSP transport

Parameters
transpthe target RTSP transport
Returns
an allocated copy RTSP transport

◆ gf_rtsp_transport_del()

void gf_rtsp_transport_del ( GF_RTSPTransport transp)

destroys a RTSP transport

Parameters
transpthe target RTSP transport

◆ gf_rtsp_command_new()

GF_RTSPCommand* gf_rtsp_command_new ( )

creates an RTSP command

Returns
the newly allocated RTSP command

◆ gf_rtsp_command_del()

void gf_rtsp_command_del ( GF_RTSPCommand com)

destroys an RTSP command

Parameters
comthe target RTSP command

◆ gf_rtsp_command_reset()

void gf_rtsp_command_reset ( GF_RTSPCommand com)

resets an RTSP command

Parameters
comthe target RTSP command

◆ gf_rtsp_response_new()

GF_RTSPResponse* gf_rtsp_response_new ( )

creates an RTSP response

Returns
the newly allocated RTSP response

◆ gf_rtsp_response_del()

void gf_rtsp_response_del ( GF_RTSPResponse rsp)

deletes an RTSP response

Parameters
rspthe target RTSP response

◆ gf_rtsp_response_reset()

void gf_rtsp_response_reset ( GF_RTSPResponse rsp)

resets an RTSP response

Parameters
rspthe target RTSP response

◆ gf_rtsp_session_new()

GF_RTSPSession* gf_rtsp_session_new ( char *  sURL,
u16  DefaultPort 
)

creates a new RTSP session

Parameters
sURLthe target RTSP session URL
DefaultPortthe target RTSP session port
Returns
a newly allocated RTSP session

◆ gf_rtsp_session_del()

void gf_rtsp_session_del ( GF_RTSPSession sess)

destroys an RTSP session

Parameters
sessthe target RTSP session

◆ gf_rtsp_set_buffer_size()

GF_Err gf_rtsp_set_buffer_size ( GF_RTSPSession sess,
u32  BufferSize 
)

sets TCP buffer size of an RTSP session

Parameters
sessthe target RTSP session
BufferSizedesired buffer size in bytes
Returns
error if any

◆ gf_rtsp_session_reset()

u32 gf_rtsp_session_reset ( GF_RTSPSession sess,
Bool  ResetConnection 
)

resets state machine, invalidate SessionID

Note
RFC2326 requires that the session is reseted when all RTP streams are closed. As this lib doesn't maintain the number of valid streams you MUST call reset when all your streams are shutdown (either requested through TEARDOWN or signaled through RTCP BYE packets for RTP, or any other signaling means for other protocols)
Parameters
sessthe target RTSP session
ResetConnectionif set, this will destroy the associated TCP socket. This is useful in case of timeouts, because some servers do not restart with the right CSeq.
Returns
number of retries for reset happening before first server reply, 0 otherwise

◆ gf_rtsp_is_my_session()

Bool gf_rtsp_is_my_session ( GF_RTSPSession sess,
char *  url 
)

checks if an RTSP session matches an RTSP URL

Parameters
sessthe target RTSP session
urlthe URL to test
Returns
GF_TRUE if the session matches the URL, GF_FALSE otherwise

◆ gf_rtsp_get_server_name()

const char* gf_rtsp_get_server_name ( GF_RTSPSession sess)

gets server name of an RTSP session

Parameters
sessthe target RTSP session
Returns
the server name

◆ gf_rtsp_get_user()

const char* gf_rtsp_get_user ( GF_RTSPSession sess)

gets user name of an RTSP session

Parameters
sessthe target RTSP session
Returns
the user name or NULL if none

◆ gf_rtsp_get_password()

const char* gf_rtsp_get_password ( GF_RTSPSession sess)

gets password of an RTSP session

Parameters
sessthe target RTSP session
Returns
the password or NULL if none

◆ gf_rtsp_get_session_port()

u16 gf_rtsp_get_session_port ( GF_RTSPSession sess)

gets server port of an RTSP session

Parameters
sessthe target RTSP session
Returns
the server port

◆ gf_rtsp_use_tls()

Bool gf_rtsp_use_tls ( GF_RTSPSession sess)

checks if RTSP connection is over TLS

Parameters
sessthe target RTSP session
Returns
GF_TRUE if connection is secured

◆ gf_rtsp_get_response()

GF_Err gf_rtsp_get_response ( GF_RTSPSession sess,
GF_RTSPResponse rsp 
)

fetches an RTSP response from the server. the GF_RTSPResponse will be reseted before fetch

Parameters
sessthe target RTSP session
rspthe response object to fill with the response. This will be reseted before TCP fetch
Returns
error if any

◆ gf_rtsp_get_session_state()

u32 gf_rtsp_get_session_state ( GF_RTSPSession sess)

gets the RTSP session state

Parameters
sessthe target RTSP session
Returns
the session state

◆ gf_rtsp_reset_aggregation()

void gf_rtsp_reset_aggregation ( GF_RTSPSession sess)

forces a reset of the state to GF_RTSP_STATE_INIT

Parameters
sessthe target RTSP session

◆ gf_rtsp_send_command()

GF_Err gf_rtsp_send_command ( GF_RTSPSession sess,
GF_RTSPCommand com 
)

sends an RTSP request to the server.

Parameters
sessthe target RTSP session
comthe RTSP command to send
Returns
error if any

◆ gf_rtsp_check_connection()

GF_Err gf_rtsp_check_connection ( GF_RTSPSession sess)

checks connection status - should be called before processing any RTSP for non-blocking IO

Parameters
sessthe target RTSP session
Returns
GF_IP_NETWORK_EMPTY if connection is still pending or data cannot be flushed, GF_OK if connected and no more data to send or error if any

◆ gf_rtsp_set_interleave_callback()

GF_Err gf_rtsp_set_interleave_callback ( GF_RTSPSession sess,
gf_rtsp_interleave_callback  SignalData 
)

assigns the callback function for interleaved RTSP/TCP transport

Parameters
sessthe target RTSP session
SignalDatathe callback function on each interleaved packet
Returns
error if any

◆ gf_rtsp_session_read()

GF_Err gf_rtsp_session_read ( GF_RTSPSession sess)

reads RTSP session (response fetch and interleaved RTSP/TCP transport)

Parameters
sessthe target RTSP session
Returns
error if any

◆ gf_rtsp_register_interleave()

GF_Err gf_rtsp_register_interleave ( GF_RTSPSession sess,
void *  the_ch,
u8  LowInterID,
u8  HighInterID 
)

registers a new interleaved RTP channel over an RTSP connection

Parameters
sessthe target RTSP session
the_chopaque data passed to gf_rtsp_interleave_callback
LowInterIDID of the RTP interleave channel
HighInterIDID of the RCTP interleave channel
Returns
error if any

◆ gf_rtsp_unregister_interleave()

u32 gf_rtsp_unregister_interleave ( GF_RTSPSession sess,
u8  LowInterID 
)

unregisters a new interleaved RTP channel over an RTSP connection

Parameters
sessthe target RTSP session
LowInterIDID of the RTP interleave channel
Returns
the numbers of registered interleaved channels remaining

◆ gf_rtsp_session_new_server()

GF_RTSPSession* gf_rtsp_session_new_server ( GF_Socket rtsp_listener,
Bool  allow_http_tunnel,
void *  ssl_ctx 
)

creates a new RTSP session from an existing socket in listen state. If no pending connection is detected, return NULL

Parameters
rtsp_listenerthe listening server socket
allow_http_tunnelindicate if HTTP tunnel should be enabled
ssl_ctxOpenSSL context
Returns
the newly allocated RTSP session if any, NULL otherwise

◆ gf_rtsp_get_command()

GF_Err gf_rtsp_get_command ( GF_RTSPSession sess,
GF_RTSPCommand com 
)

fetches an RTSP request

Parameters
sessthe target RTSP session
comthe RTSP command to fill with the command. This will be reseted before fetch
Returns
error if any or GF_RTSP_TUNNEL_POST if this is a POST on a HTPP tunnel

◆ gf_rtsp_generate_session_id()

char* gf_rtsp_generate_session_id ( GF_RTSPSession sess)

generates a session ID for the given session

Parameters
sessthe target RTSP session
Returns
an allocated string containing a session ID

◆ gf_rtsp_send_response()

GF_Err gf_rtsp_send_response ( GF_RTSPSession sess,
GF_RTSPResponse rsp 
)

sends an RTSP response

Parameters
sessthe target RTSP session
rspthe response to send
Returns
error if any

◆ gf_rtsp_get_session_ip()

GF_Err gf_rtsp_get_session_ip ( GF_RTSPSession sess,
char  buffer[GF_MAX_IP_NAME_LEN] 
)

gets the IP address of the local host running the session

Parameters
sessthe target RTSP session
bufferbuffer to store the local host name
Returns
error if any

◆ gf_rtsp_get_remote_address()

GF_Err gf_rtsp_get_remote_address ( GF_RTSPSession sess,
char *  buffer 
)

gets the IP address of the connected peer

Parameters
sessthe target RTSP session
bufferbuffer to store the connected peer name
Returns
error if any

◆ gf_rtsp_session_write_interleaved()

GF_Err gf_rtsp_session_write_interleaved ( GF_RTSPSession sess,
u32  idx,
u8 pck,
u32  pck_size 
)

writes a packet on an interleaved channel over RTSP

Parameters
sessthe target RTSP session
idxID (RTP or RTCP) of the interleaved channel
pckpacket data (RTP or RTCP packet) to write
pck_sizepacket size in bytes
Returns
error if any

◆ gf_rtsp_get_session_cookie()

const char* gf_rtsp_get_session_cookie ( GF_RTSPSession sess)

gets sessioncookie for HTTP tunnel

Parameters
sessthe target RTSP session
Returns
cookie or NULL if none

◆ gf_rtsp_merge_tunnel()

GF_Err gf_rtsp_merge_tunnel ( GF_RTSPSession sess,
GF_RTSPSession post_sess 
)

move TCP connection of a POST HTTP tunnel link to main session

Parameters
sessthe target RTSP session
post_sessthe target RTSP POST http tunnel session - the session is not destroyed, only its connection is detached
Returns
error if any

◆ gf_rtsp_session_set_netcap_id()

void gf_rtsp_session_set_netcap_id ( GF_RTSPSession sess,
const char *  netcap_id 
)

sets associated netcap rules

Parameters
sessthe target RTSP session
netcap_idID of netcap configuration to use, may be null (see gpac -h netcap)

◆ gf_rtp_new()

GF_RTPChannel* gf_rtp_new ( )

creates a new RTP channel

Returns
a newly allocated RTP channel

◆ gf_rtp_new_ex()

GF_RTPChannel* gf_rtp_new_ex ( const char *  netcap_id)

creates a new RTP channel

Parameters
netcap_idID of netcap configuration to use, may be null (see gpac -h netcap)
Returns
a newly allocated RTP channel

◆ gf_rtp_del()

void gf_rtp_del ( GF_RTPChannel ch)

destroys an RTP channel

Parameters
chthe target RTP channel

◆ gf_rtp_setup_transport()

GF_Err gf_rtp_setup_transport ( GF_RTPChannel ch,
GF_RTSPTransport trans_info,
const char *  remote_address 
)

setup transport for an RTP channel A server channelis configured through the transport structure, with the same info as a client channel, the client_port_* info designing the REMOTE client and port_* designing the server channel

Parameters
chthe target RTP channel
trans_infothe transport info for this channel
remote_addressthe remote / destination address of the channel
Returns
error if any

◆ gf_rtp_set_ports()

GF_Err gf_rtp_set_ports ( GF_RTPChannel ch,
u16  first_port 
)

setup of rtp/rtcp transport ports This only applies in unicast, non interleaved cases. For multicast port setup MUST be done through the above gf_rtp_setup_transport function This will take care of port reuse

Parameters
chthe target RTP channel
first_portRTP port number of the RTP channel
Returns
error if any

◆ gf_rtp_setup_payload()

GF_Err gf_rtp_setup_payload ( GF_RTPChannel ch,
u32  PayloadType,
u32  ClockRate 
)

init of RTP payload information. Only ONE payload per sync source is supported in this version of the library (a sender cannot switch payload types on a single media)

Parameters
chthe target RTP channel
PayloadTypeidentifier of RTP payload
ClockRateclock rate in (1/Hz) of RTP channel
Returns
error if any

◆ gf_rtp_enable_nat_keepalive()

void gf_rtp_enable_nat_keepalive ( GF_RTPChannel ch,
u32  nat_timeout 
)

enables sending of NAT keep-alive packets for NAT traversal

Parameters
chthe target RTP channel
nat_timeoutspecifies the inactivity period in ms after which NAT keepalive packets are sent. If 0, disables NAT keep-alive packets

◆ gf_rtp_initialize()

GF_Err gf_rtp_initialize ( GF_RTPChannel ch,
u32  UDPBufferSize,
Bool  IsSource,
u32  PathMTU,
u32  ReorederingSize,
u32  MaxReorderDelay,
char *  local_interface_ip 
)

initializes the RTP channel.

Parameters
chthe target RTP channel
UDPBufferSizeUDP stack buffer size if configurable by OS/ISP - ignored otherwise
Note
On WinCE devices, this is not configurable on an app bases but for the whole OS you must update the device registry with:
[HKEY_LOCAL_MACHINE\Comm\Afd]
DgramBuffer=dword:N
    where N is the number of UDP datagrams a socket should be able to buffer. For multimedia
app you should set N as large as possible. The device MUST be reseted for the param to take effect
Parameters
IsSourceif true, the channel is a sender (media data, sender report, Receiver report processing) if source, you must specify the Path MTU size. The RTP lib won't send any packet bigger than this size your application shall perform payload size splitting if needed
PathMTUdesired path MTU (max packet size) in bytes
ReorederingSizemax number of packets to queue for reordering. 0 means no reordering
MaxReorderDelaymax time to wait in ms before releasing first packet in reoderer when only one packet is present. If 0 and reordering size is specified, defaults to 200 ms (usually enough).
local_interface_iplocal interface address to use for multicast. If NULL, default address is used
Returns
error if any

◆ gf_rtp_stop()

GF_Err gf_rtp_stop ( GF_RTPChannel ch)

stops the RTP channel. This destrpys RTP and RTCP sockets as well as packet reorderer

Parameters
chthe target RTP channel
Returns
error if any

◆ gf_rtp_set_ssm()

GF_Err gf_rtp_set_ssm ( GF_RTPChannel ch,
const char **  src_ip_inc,
u32  nb_src_ip_inc,
const char **  src_ip_exc,
u32  nb_src_ip_exc 
)

sets source-specific IPs - this MUST be called before calling gf_rtp_initialize

Parameters
chthe target RTP channel
src_ip_incIP of sources to receive from
nb_src_ip_incnumber of sources to receive from
src_ip_excIP of sources to exclude
nb_src_ip_excnumber of sources to exclude
Returns
error if any

◆ gf_rtp_set_info_rtp()

GF_Err gf_rtp_set_info_rtp ( GF_RTPChannel ch,
u32  seq_num,
u32  rtp_time,
u32  ssrc 
)

inits the RTP info after a PLAY or PAUSE, rtp_time is the rtp TimeStamp of the RTP packet with seq_num sequence number. This info is needed to compute the CurrentTime of the RTP channel ssrc may not be known if sender hasn't indicated it (use 0 then)

Parameters
chthe target RTP channel
seq_numthe seq num of the next packet to be received
rtp_timethe time in RTP timescale of the next packet to be received
ssrcthe SSRC identifier of the next packet to be received
Returns
error if any

◆ gf_rtp_get_current_time()

Double gf_rtp_get_current_time ( GF_RTPChannel ch)

retrieves current RTP time in sec. If rtp_time was unknown (not on demand media) the time is absolute. Otherwise this is the time in ms elapsed since the last PLAY range start value Not supported yet if played without RTSP (aka RTCP time not supported)

Parameters
chthe target RTP channel
Returns
NTP clock in seconds

◆ gf_rtp_reset_buffers()

void gf_rtp_reset_buffers ( GF_RTPChannel ch)

resets both sockets and packet reorderer

Parameters
chthe target RTP channel

◆ gf_rtp_reset_ssrc()

void gf_rtp_reset_ssrc ( GF_RTPChannel ch)

resets sender SSRC

Parameters
chthe target RTP channel

◆ gf_rtp_read_rtp()

u32 gf_rtp_read_rtp ( GF_RTPChannel ch,
u8 buffer,
u32  buffer_size 
)

reads any RTP data on UDP only (not valid for TCP). Performs re-ordering if configured for it

Parameters
chthe target RTP channel
bufferthe buffer where to store the RTP packet
buffer_sizethe size of the buffer
Returns
amount of data read in bytes

◆ gf_rtp_flush_rtp()

u32 gf_rtp_flush_rtp ( GF_RTPChannel ch,
u8 buffer,
u32  buffer_size 
)

flushes any pending data in packet reorderer, but does not flush packet reorderer if reorderer timeout is not exceeded

Parameters
chthe target RTP channel
bufferthe buffer where to store the data
buffer_sizethe size of the buffer
Returns
amount of data read in bytes

◆ gf_rtp_read_rtcp()

u32 gf_rtp_read_rtcp ( GF_RTPChannel ch,
u8 buffer,
u32  buffer_size 
)

reads any RTCP data on UDP only (not valid for TCP). Performs re-ordering if configured for it

Parameters
chthe target RTP channel
bufferthe buffer where to store the RTCP packet
buffer_sizethe size of the buffer
Returns
amount of data read in bytes

◆ gf_rtp_read_flush()

u32 gf_rtp_read_flush ( GF_RTPChannel ch,
u8 buffer,
u32  buffer_size 
)

flushes any pending data in packet reorderer, and flushes packet reorderer if reorderer timeout is not exceeded. Typically called several times until returning 0.

Parameters
chthe target RTP channel
bufferthe buffer where to store the data
buffer_sizethe size of the buffer
Returns
amount of data read in bytes

◆ gf_rtp_decode_rtp()

GF_Err gf_rtp_decode_rtp ( GF_RTPChannel ch,
u8 pck,
u32  pck_size,
GF_RTPHeader rtp_hdr,
u32 PayloadStart 
)

decodes an RTP packet and gets the beginning of the RTP payload

Parameters
chthe target RTP channel
pckthe RTP packet buffer
pck_sizethe size of the RTP packet
rtp_hdrfilled with decoded RTP header information
PayloadStartset to the offset in bytes of the start of the payload in the RTP packet
Returns
error if any

◆ gf_rtp_decode_rtcp()

GF_Err gf_rtp_decode_rtcp ( GF_RTPChannel ch,
u8 pck,
u32  pck_size,
Bool has_sr 
)

decodes an RTCP packet and update timing info, send ReceiverReport too

Parameters
chthe target RTP channel
pckthe RTP packet buffer
pck_sizethe size of the RTP packet
has_srset to GF_TRUE if the RTCP packet contained an SenderReport
Returns
error if any

◆ gf_rtp_send_rtcp_report()

GF_Err gf_rtp_send_rtcp_report ( GF_RTPChannel ch)

computes and send Receiver report. If the channel is a TCP channel, you must specify the callback function.

Note
Many RTP implementation do NOT process RTCP info received on TCP... the lib will decide whether the report shall be sent or not, therefore you should call this function at regular times
Parameters
chthe target RTP channel
Returns
error if any

◆ gf_rtp_set_loss_rate()

void gf_rtp_set_loss_rate ( GF_RTPChannel ch,
u32  loss_rate 
)

forces loss rate for next Receiver report

Parameters
chthe target RTP channel
loss_rateloss rate in per-thousand

◆ gf_rtp_send_bye()

GF_Err gf_rtp_send_bye ( GF_RTPChannel ch)

sends a BYE info (leaving the session)

Parameters
chthe target RTP channel
Returns
error if any

◆ gf_rtp_send_packet()

GF_Err gf_rtp_send_packet ( GF_RTPChannel ch,
GF_RTPHeader rtp_hdr,
u8 pck,
u32  pck_size,
Bool  fast_send 
)

sends an RTP packet. In fast_send mode,

Parameters
chthe target RTP channel
rtp_hdrthe RTP header of the packet
pckthe RTP payload buffer
pck_sizethe RTP payload size
fast_sendif set, the payload buffer contains 12 bytes available BEFORE its indicated start where the RTP header is written in place
Returns
error if any

◆ gf_rtp_set_interleave_callbacks()

GF_Err gf_rtp_set_interleave_callbacks ( GF_RTPChannel ch,
gf_rtp_tcp_callback  tcp_callback,
void *  cbk1,
void *  cbk2 
)

sets RTP interleaved callback on the RTP channel

Parameters
chthe target RTP channel
tcp_callbackthe callback function
cbk1user data for the callback function
cbk2user data for the callback function
Returns
error if any

◆ gf_rtp_is_unicast()

u32 gf_rtp_is_unicast ( GF_RTPChannel ch)

checks if an RTP channel is unicast

Parameters
chthe target RTP channel
Returns
GF_TRUE if unicast, GF_FALSE otherwise

◆ gf_rtp_is_interleaved()

u32 gf_rtp_is_interleaved ( GF_RTPChannel ch)

checks if an RTP channel is interleaved

Parameters
chthe target RTP channel
Returns
GF_TRUE if interleaved, GF_FALSE otherwise

◆ gf_rtp_get_clockrate()

u32 gf_rtp_get_clockrate ( GF_RTPChannel ch)

gets clockrate/timescale of an RTP channel

Parameters
chthe target RTP channel
Returns
the RTP clock rate

◆ gf_rtp_get_low_interleave_id()

u8 gf_rtp_get_low_interleave_id ( GF_RTPChannel ch)

gets the low interleave ID of an RTP channel

Parameters
chthe target RTP channel
Returns
the low (RTP) interleave ID of the channel, or 0 if not interleaved

◆ gf_rtp_get_hight_interleave_id()

u8 gf_rtp_get_hight_interleave_id ( GF_RTPChannel ch)

gets the high interleave ID of an RTP channel

Parameters
chthe target RTP channel
Returns
the high (RTCP) interleave ID of the channel, or 0 if not interleaved

◆ gf_rtp_get_transport()

const GF_RTSPTransport* gf_rtp_get_transport ( GF_RTPChannel ch)

gets the transport associated with an RTP channel

Parameters
chthe target RTP channel
Returns
the RTSP transport information

◆ gf_rtp_get_loss()

Float gf_rtp_get_loss ( GF_RTPChannel ch)

gets loss rate of the RTP channel

Parameters
chthe target RTP channel
Returns
the loss rate of the channel, between 0 and 100 %

◆ gf_rtp_get_tcp_bytes_sent()

u32 gf_rtp_get_tcp_bytes_sent ( GF_RTPChannel ch)

gets number of TCP bytes send for an interleaved channel

Parameters
chthe target RTP channel
Returns
the number of bytes sent

◆ gf_rtp_get_ports()

void gf_rtp_get_ports ( GF_RTPChannel ch,
u16 rtp_port,
u16 rtcp_port 
)

gets ports of an non-interleaved RTP channel

Parameters
chthe target RTP channel
rtp_portthe RTP port number
rtcp_portthe RCTP port number

◆ gf_sdp_info_new()

GF_SDPInfo* gf_sdp_info_new ( )

creates a new SDP info

Returns
the newly allocated SDP

◆ gf_sdp_info_del()

void gf_sdp_info_del ( GF_SDPInfo sdp)

destrucs an SDP info Memory Consideration: the destructors free all non-NULL string. You should therefore be careful while (de-)assigning the strings. The function gf_sdp_info_parse() performs a complete reset of the GF_SDPInfo

Parameters
sdpthe target SDP to destroy

◆ gf_sdp_info_reset()

void gf_sdp_info_reset ( GF_SDPInfo sdp)

resets all structures and destroys substructures too

Parameters
sdpthe target SDP to destroy

◆ gf_sdp_info_parse()

GF_Err gf_sdp_info_parse ( GF_SDPInfo sdp,
char *  sdp_text,
u32  text_size 
)

parses a memory SDP buffer

Parameters
sdpthe target SDP to destroy
sdp_textthe encoded SDP buffer
text_sizesizeo if the encoded SDP buffer
Returns
error if any

◆ gf_sdp_media_new()

GF_SDPMedia* gf_sdp_media_new ( )

creates a new SDP media

Returns
the newly allocated SDP media

◆ gf_sdp_media_del()

void gf_sdp_media_del ( GF_SDPMedia media)

destroys an SDP media

Parameters
mediathe target SDP media

◆ gf_sdp_conn_new()

GF_SDPConnection* gf_sdp_conn_new ( )

creates a new SDP connection

Returns
the newly allocated SDP connection

◆ gf_sdp_conn_del()

void gf_sdp_conn_del ( GF_SDPConnection conn)

destroys an SDP connection

Parameters
connthe target SDP connection

◆ gf_sdp_fmtp_new()

GF_SDP_FMTP* gf_sdp_fmtp_new ( )

creates a new SDP payload

Returns
the newly allocated SDP payload

◆ gf_sdp_fmtp_del()

void gf_sdp_fmtp_del ( GF_SDP_FMTP fmtp)

destroys an SDP payload

Parameters
fmtpthe target SDP payload

◆ gf_rtp_builder_new()

GP_RTPPacketizer* gf_rtp_builder_new ( u32  rtp_payt,
GF_SLConfig slc,
u32  flags,
void *  cbk_obj,
void(*)(void *cbk, GF_RTPHeader *header)  OnNewPacket,
void(*)(void *cbk, GF_RTPHeader *header)  OnPacketDone,
void(*)(void *cbk, u32 payload_size, u32 offset_from_orig)  OnDataReference,
void(*)(void *cbk, u8 *data, u32 data_size, Bool is_head)  OnData 
)

creates a new builder

Parameters
rtp_paytrtp payload format, one of the above GF_RTP_PAYT_*
slcuser-given SL config to use. If none specified, default RFC config is used
flagspacketizer flags, one of the above GP_RTP_PCK_*
cbk_objcallback object passed back in functions
OnNewPacketcallback function starting new RTP packet header: rtp header for new packet - note that RTP header flags are not used until PacketDone is called
OnPacketDonecallback function closing current RTP packet header: final rtp header for packet
OnDataReferenceoptional, to call each time data from input buffer is added to current RTP packet. If not set, data must be added through OnData payload_size: size of reference data offset_from_orig: start offset in input buffer
OnDatato call each time data is added to current RTP packet (either extra data from payload or data from input when not using referencing) is_head: signal the data added MUST be inserted at the beginning of the payload. Otherwise data is concatenated as received
Returns
a new RTP packetizer object

◆ gf_rtp_builder_del()

void gf_rtp_builder_del ( GP_RTPPacketizer builder)

destroys an RTP packetizer

Parameters
builderthe target RTP packetizer

◆ gf_rtp_builder_init()

void gf_rtp_builder_init ( GP_RTPPacketizer builder,
u8  PayloadType,
u32  MaxPayloadSize,
u32  max_ptime,
u32  StreamType,
u32  codecid,
u32  PL_ID,
u32  avgSize,
u32  maxSize,
u32  avgTS,
u32  maxDTS,
u32  IV_length,
u32  KI_length,
char *  pref_mode 
)

inits the RTP packetizer

Parameters
builderthe target RTP packetizer
PayloadTypethe payload type to use
MaxPayloadSizemaximum payload size of RTP packets (eg MTU minus IP/UDP/RTP headers)
max_ptimemaximum packet duration IN RTP TIMESCALE
StreamTypeMPEG-4 system stream type - MUST always be provided for payloads format specifying audio or video streams
codecidID of the media codec
PL_IDprofile and level identifier for the stream
                        all other params are for RFC 3640 ***
avgSizeaverage size of an AU. This is not always known (real-time encoding). In this case you should specify a rough compute indicating how many packets could be stored per RTP packet. for ex AAC stereo at 44100 k / 64kbps , one AU ~= 380 bytes so 3 AUs for 1500 MTU is ok - BE CAREFUL: MultiSL adds some SL info on top of the 12 byte RTP header so you should specify a smaller size The packetizer will ALWAYS make sure there's no pb storing the packets so specifying more will result in a slight overhead in the SL mapping but the gain to singleSL will still be worth it. -Nota: at init, the packetizer can decide to switch to SingleSL if the average size specified is too close to the PathMTU
maxSizemax size of an AU. If unknown (real-time) set to 0
avgTSaverage CTS progression (1000/FPS for video)
maxDTSmaximum DTS offset in case of bidirectional coding.
IV_lengthsize (in bytes) of IV when ISMACrypted
KI_lengthsize (in bytes) of key indicator when ISMACrypted
pref_modeMPEG-4 generic only, specifies the payload mode - can be NULL (mode generic)

◆ gf_rtp_builder_set_cryp_info()

void gf_rtp_builder_set_cryp_info ( GP_RTPPacketizer builder,
u64  IV,
char *  key_indicator,
Bool  is_encrypted 
)

sets frame crypto info (ISMA E&A) for frame starting in next RTP packet

Parameters
builderthe target RTP packetizer
IVinitialization vector
key_indicatorkey indicator
is_encryptedencrypted flag

◆ gf_rtp_builder_process()

GF_Err gf_rtp_builder_process ( GP_RTPPacketizer builder,
u8 data,
u32  data_size,
u8  IsAUEnd,
u32  FullAUSize,
u32  duration,
u8  descIndex 
)

packetizes input buffer

Parameters
builderthe target RTP packetizer
datainput buffer
data_sizeinput buffer size
IsAUEndset to one if this buffer is the last of the AU
FullAUSizecomplete access unit size if known, 0 otherwise
durationsample duration in rtp timescale (mostly needed for 3GPP text streams)
descIndexsample description index (mostly needed for 3GPP text streams)
Returns
error if any

◆ gf_rtp_builder_format_sdp()

GF_Err gf_rtp_builder_format_sdp ( GP_RTPPacketizer builder,
char *  payload_name,
char *  sdp_line,
char *  dsi,
u32  dsi_size 
)

formats the "fmtp: " attribute for the MPEG-4 generic packetizer. sdpline shall be at least 2000 char

Parameters
builderthe target RTP packetizer
payload_namename of the payload to use (profile of RFC 3640)
sdp_lineSDP line buffer to fill
dsidecoder config of stream if any, or NULL
dsi_sizesize of the decoder config
Returns
error if any

◆ gf_rtp_builder_get_payload_name()

Bool gf_rtp_builder_get_payload_name ( GP_RTPPacketizer builder,
char  payload_name[20],
char  media_name[20] 
)

formats SDP payload name and media name

Parameters
builderthe target RTP packetizer
payload_namethe buffer to fill with the payload name
media_namethe buffer to fill with the payload name
Returns
GF_TRUE if success, GF_FALSE otherwise

◆ gf_rtp_depacketizer_new()

GF_RTPDepacketizer* gf_rtp_depacketizer_new ( GF_SDPMedia media,
u32  hdr_payt,
gf_rtp_packet_cbk  sl_packet_cbk,
void *  udta 
)

creates a new depacketizer

Parameters
mediathe SDP media structure describing the RTP stream - can be NULL for static payload types
hdr_paytthe static RTP payload type when no SDP is used
sl_packet_cbkcallback function of the depacketizer to retrieves payload
udtaopaque data for the callback function
Returns
a newly allocated RTP depacketizer, or NULL if not supported

◆ gf_rtp_depacketizer_del()

void gf_rtp_depacketizer_del ( GF_RTPDepacketizer rtpd)

destroys an RTP depacketizer

Parameters
rtpdthe target RTP depacketizer

◆ gf_rtp_depacketizer_reset()

void gf_rtp_depacketizer_reset ( GF_RTPDepacketizer rtpd,
Bool  full_reset 
)

resets an RTP depacketizer, assuming next packet should be an AU start

Parameters
rtpdthe target RTP depacketizer
full_resetif set, completely reset the SL header

◆ gf_rtp_depacketizer_process()

void gf_rtp_depacketizer_process ( GF_RTPDepacketizer rtpd,
GF_RTPHeader hdr,
u8 payload,
u32  size 
)

process an RTP depacketizer

Parameters
rtpdthe target RTP depacketizer
hdrthe RTP packet header
payloadthe RTP packet payload
sizethe RTP packet payload size