libgpac
Documentation of the core library of GPAC
|
Tools for real-time streaming over IP using RTP/RTCP/RTSP/SDP. More...
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 GF_Err(* | gf_rtsp_interleave_callback) (GF_RTSPSession *sess, void *cbk_ptr, u8 *buffer, u32 bufferSize, Bool IsRTCP) |
typedef GF_Err(* | gf_rtp_tcp_callback) (void *cbk1, void *cbk2, Bool is_rtcp, u8 *pck, u32 pck_size) |
typedef void(* | gf_rtp_packet_cbk) (void *udta, u8 *payload, u32 size, GF_SLHeader *hdr, GF_Err e) |
Functions | |
const char * | gf_rtsp_nc_to_string (u32 ErrCode) |
GF_RTSPRange * | gf_rtsp_range_parse (char *range_buf) |
GF_RTSPRange * | gf_rtsp_range_new () |
void | gf_rtsp_range_del (GF_RTSPRange *range) |
GF_RTSPTransport * | gf_rtsp_transport_clone (GF_RTSPTransport *transp) |
void | gf_rtsp_transport_del (GF_RTSPTransport *transp) |
GF_RTSPCommand * | gf_rtsp_command_new () |
void | gf_rtsp_command_del (GF_RTSPCommand *com) |
void | gf_rtsp_command_reset (GF_RTSPCommand *com) |
GF_RTSPResponse * | gf_rtsp_response_new () |
void | gf_rtsp_response_del (GF_RTSPResponse *rsp) |
void | gf_rtsp_response_reset (GF_RTSPResponse *rsp) |
GF_RTSPSession * | gf_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_RTSPSession * | gf_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_RTPChannel * | gf_rtp_new () |
GF_RTPChannel * | gf_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_RTSPTransport * | gf_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_SDPInfo * | gf_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_SDPMedia * | gf_sdp_media_new () |
void | gf_sdp_media_del (GF_SDPMedia *media) |
GF_SDPConnection * | gf_sdp_conn_new () |
void | gf_sdp_conn_del (GF_SDPConnection *conn) |
GF_SDP_FMTP * | gf_sdp_fmtp_new () |
void | gf_sdp_fmtp_del (GF_SDP_FMTP *fmtp) |
GP_RTPPacketizer * | gf_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 **out_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_RTPDepacketizer * | gf_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) |
This section documents the tools used for real-time streaming over IP using RTP/RTCP/RTSP/SDP.
struct GF_RTSPRange |
struct GF_RTSPTransport |
struct GF_RTSPCommand |
RTSP command structure
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 |
struct GF_RTPInfo |
struct GF_RTSPResponse |
RTSP Response
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 |
struct GF_RTPHeader |
struct GF_RTPMap |
struct GF_X_Attribute |
struct GF_SDPBandwidth |
SDP bandwidth info
Data Fields | ||
---|---|---|
char * | name | |
u32 | value |
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 |
struct GF_SDPConnection |
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 |
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 |
struct GF_SDPInfo |
SDP information
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 |
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 |
struct GF_RTPStaticMap |
#define GF_RTSP_VERSION "RTSP/1.0" |
RTSP version supported by GPAC
#define GF_RTSP_PROFILE_RTP_AVP "RTP/AVP" |
RTSP AVP Transport Profile
#define GF_RTSP_PROFILE_RTP_AVP_TCP "RTP/AVP/TCP" |
RTSP AVP + TCP Transport Profile
#define GF_RTSP_PROFILE_UDP "udp" |
RTSP UDP Transport Profile
#define GF_RTSP_DESCRIBE "DESCRIBE" |
RTSP DESCRIBE method
#define GF_RTSP_SETUP "SETUP" |
RTSP SETUP method
#define GF_RTSP_PLAY "PLAY" |
RTSP PLAY method
#define GF_RTSP_PAUSE "PAUSE" |
RTSP PAUSE method
#define GF_RTSP_RECORD "RECORD" |
RTSP RECORD method
#define GF_RTSP_TEARDOWN "TEARDOWN" |
RTSP TEARDOWN method
#define GF_RTSP_GET_PARAMETER "GET_PARAMETER" |
RTSP GET_PARAMETER method
#define GF_RTSP_SET_PARAMETER "SET_PARAMETER" |
RTSP SET_PARAMETER method
#define GF_RTSP_OPTIONS "OPTIONS" |
RTSP OPTIONS method
#define GF_RTSP_ANNOUNCE "ANNOUNCE" |
RTSP ANNOUCE method
#define GF_RTSP_REDIRECT "REDIRECT" |
RTSP REDIRECT method
#define GF_RTSP_TUNNEL_POST -1000 |
special error code for gf_rtsp_get_command
#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 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
sess | the target RTSP session |
cbk_ptr | opaque data |
buffer | RTP or RTCP packet |
bufferSize | packet size in bytes |
IsRTCP | set to GF_TRUE if the packet is an RTCP packet, GF_FALSE otherwise |
callback used for writing rtp over TCP
cbk1 | opaque user data |
cbk2 | opaque user data |
is_rtcp | indicates the data is an RTCP packet |
pck | the RTP/RTCP buffer |
pck_size | the RTP/RTCP size |
typedef void(* gf_rtp_packet_cbk) (void *udta, u8 *payload, u32 size, GF_SLHeader *hdr, GF_Err e) |
RTP depacketizer callback
udta | opaque user data |
payload | depacketized payload data |
size | payload size |
hdr | MPEG-4 Sync Layer structure for the payload (with AU start/end flag, timestamps, etc) |
e | error if any |
anonymous enum |
RTSP NOTIF CODES
anonymous enum |
RTSP States. The only non blocking mode is GF_RTSP_STATE_WAIT_FOR_CONTROL
anonymous enum |
packetizer config flags - some flags are dynamically re-assigned when detecting multiSL / B-Frames / ...
anonymous enum |
Supported payload types
anonymous enum |
const char* gf_rtsp_nc_to_string | ( | u32 | ErrCode | ) |
Gives string description of error code
ErrCode | the RTSP error code |
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
range_buf | the range string |
GF_RTSPRange* gf_rtsp_range_new | ( | ) |
creates a new RTSP range
void gf_rtsp_range_del | ( | GF_RTSPRange * | range | ) |
destroys a RTSP range
range | the target RTSP range |
GF_RTSPTransport* gf_rtsp_transport_clone | ( | GF_RTSPTransport * | transp | ) |
clones a RTSP transport
transp | the target RTSP transport |
void gf_rtsp_transport_del | ( | GF_RTSPTransport * | transp | ) |
destroys a RTSP transport
transp | the target RTSP transport |
GF_RTSPCommand* gf_rtsp_command_new | ( | ) |
creates an RTSP command
void gf_rtsp_command_del | ( | GF_RTSPCommand * | com | ) |
destroys an RTSP command
com | the target RTSP command |
void gf_rtsp_command_reset | ( | GF_RTSPCommand * | com | ) |
resets an RTSP command
com | the target RTSP command |
GF_RTSPResponse* gf_rtsp_response_new | ( | ) |
creates an RTSP response
void gf_rtsp_response_del | ( | GF_RTSPResponse * | rsp | ) |
deletes an RTSP response
rsp | the target RTSP response |
void gf_rtsp_response_reset | ( | GF_RTSPResponse * | rsp | ) |
resets an RTSP response
rsp | the target RTSP response |
GF_RTSPSession* gf_rtsp_session_new | ( | char * | sURL, |
u16 | DefaultPort | ||
) |
creates a new RTSP session
sURL | the target RTSP session URL |
DefaultPort | the target RTSP session port |
void gf_rtsp_session_del | ( | GF_RTSPSession * | sess | ) |
destroys an RTSP session
sess | the target RTSP session |
sets TCP buffer size of an RTSP session
sess | the target RTSP session |
BufferSize | desired buffer size in bytes |
resets state machine, invalidate SessionID
sess | the target RTSP session |
ResetConnection | if 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. |
Bool gf_rtsp_is_my_session | ( | GF_RTSPSession * | sess, |
char * | url | ||
) |
checks if an RTSP session matches an RTSP URL
sess | the target RTSP session |
url | the URL to test |
const char* gf_rtsp_get_server_name | ( | GF_RTSPSession * | sess | ) |
gets server name of an RTSP session
sess | the target RTSP session |
const char* gf_rtsp_get_user | ( | GF_RTSPSession * | sess | ) |
gets user name of an RTSP session
sess | the target RTSP session |
const char* gf_rtsp_get_password | ( | GF_RTSPSession * | sess | ) |
gets password of an RTSP session
sess | the target RTSP session |
u16 gf_rtsp_get_session_port | ( | GF_RTSPSession * | sess | ) |
gets server port of an RTSP session
sess | the target RTSP session |
Bool gf_rtsp_use_tls | ( | GF_RTSPSession * | sess | ) |
checks if RTSP connection is over TLS
sess | the target RTSP session |
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
sess | the target RTSP session |
rsp | the response object to fill with the response. This will be reseted before TCP fetch |
u32 gf_rtsp_get_session_state | ( | GF_RTSPSession * | sess | ) |
gets the RTSP session state
sess | the target RTSP session |
void gf_rtsp_reset_aggregation | ( | GF_RTSPSession * | sess | ) |
forces a reset of the state to GF_RTSP_STATE_INIT
sess | the target RTSP session |
GF_Err gf_rtsp_send_command | ( | GF_RTSPSession * | sess, |
GF_RTSPCommand * | com | ||
) |
sends an RTSP request to the server.
sess | the target RTSP session |
com | the RTSP command to send |
GF_Err gf_rtsp_check_connection | ( | GF_RTSPSession * | sess | ) |
checks connection status - should be called before processing any RTSP for non-blocking IO
sess | the target RTSP session |
GF_Err gf_rtsp_set_interleave_callback | ( | GF_RTSPSession * | sess, |
gf_rtsp_interleave_callback | SignalData | ||
) |
assigns the callback function for interleaved RTSP/TCP transport
sess | the target RTSP session |
SignalData | the callback function on each interleaved packet |
GF_Err gf_rtsp_session_read | ( | GF_RTSPSession * | sess | ) |
reads RTSP session (response fetch and interleaved RTSP/TCP transport)
sess | the target RTSP session |
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
sess | the target RTSP session |
the_ch | opaque data passed to gf_rtsp_interleave_callback |
LowInterID | ID of the RTP interleave channel |
HighInterID | ID of the RCTP interleave channel |
unregisters a new interleaved RTP channel over an RTSP connection
sess | the target RTSP session |
LowInterID | ID of the RTP interleave channel |
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
rtsp_listener | the listening server socket |
allow_http_tunnel | indicate if HTTP tunnel should be enabled |
ssl_ctx | OpenSSL context |
GF_Err gf_rtsp_get_command | ( | GF_RTSPSession * | sess, |
GF_RTSPCommand * | com | ||
) |
fetches an RTSP request
sess | the target RTSP session |
com | the RTSP command to fill with the command. This will be reseted before fetch |
char* gf_rtsp_generate_session_id | ( | GF_RTSPSession * | sess | ) |
generates a session ID for the given session
sess | the target RTSP session |
GF_Err gf_rtsp_send_response | ( | GF_RTSPSession * | sess, |
GF_RTSPResponse * | rsp | ||
) |
sends an RTSP response
sess | the target RTSP session |
rsp | the response to send |
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
sess | the target RTSP session |
buffer | buffer to store the local host name |
GF_Err gf_rtsp_get_remote_address | ( | GF_RTSPSession * | sess, |
char * | buffer | ||
) |
gets the IP address of the connected peer
sess | the target RTSP session |
buffer | buffer to store the connected peer name |
writes a packet on an interleaved channel over RTSP
sess | the target RTSP session |
idx | ID (RTP or RTCP) of the interleaved channel |
pck | packet data (RTP or RTCP packet) to write |
pck_size | packet size in bytes |
const char* gf_rtsp_get_session_cookie | ( | GF_RTSPSession * | sess | ) |
gets sessioncookie for HTTP tunnel
sess | the target RTSP session |
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
sess | the target RTSP session |
post_sess | the target RTSP POST http tunnel session - the session is not destroyed, only its connection is detached |
void gf_rtsp_session_set_netcap_id | ( | GF_RTSPSession * | sess, |
const char * | netcap_id | ||
) |
sets associated netcap rules
sess | the target RTSP session |
netcap_id | ID of netcap configuration to use, may be null (see gpac -h netcap) |
GF_RTPChannel* gf_rtp_new | ( | ) |
creates a new RTP channel
GF_RTPChannel* gf_rtp_new_ex | ( | const char * | netcap_id | ) |
creates a new RTP channel
netcap_id | ID of netcap configuration to use, may be null (see gpac -h netcap) |
void gf_rtp_del | ( | GF_RTPChannel * | ch | ) |
destroys an RTP channel
ch | the target RTP channel |
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
ch | the target RTP channel |
trans_info | the transport info for this channel |
remote_address | the remote / destination address of the channel |
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
ch | the target RTP channel |
first_port | RTP port number of the RTP channel |
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)
ch | the target RTP channel |
PayloadType | identifier of RTP payload |
ClockRate | clock rate in (1/Hz) of RTP channel |
void gf_rtp_enable_nat_keepalive | ( | GF_RTPChannel * | ch, |
u32 | nat_timeout | ||
) |
enables sending of NAT keep-alive packets for NAT traversal
ch | the target RTP channel |
nat_timeout | specifies the inactivity period in ms after which NAT keepalive packets are sent. If 0, disables NAT keep-alive packets |
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.
ch | the target RTP channel |
UDPBufferSize | UDP stack buffer size if configurable by OS/ISP - ignored otherwise |
where N is the number of UDP datagrams a socket should be able to buffer. For multimediaapp you should set N as large as possible. The device MUST be reseted for the param to take effect
IsSource | if 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 |
PathMTU | desired path MTU (max packet size) in bytes |
ReorederingSize | max number of packets to queue for reordering. 0 means no reordering |
MaxReorderDelay | max 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_ip | local interface address to use for multicast. If NULL, default address is used |
GF_Err gf_rtp_stop | ( | GF_RTPChannel * | ch | ) |
stops the RTP channel. This destrpys RTP and RTCP sockets as well as packet reorderer
ch | the target RTP channel |
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
ch | the target RTP channel |
src_ip_inc | IP of sources to receive from |
nb_src_ip_inc | number of sources to receive from |
src_ip_exc | IP of sources to exclude |
nb_src_ip_exc | number of sources to exclude |
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)
ch | the target RTP channel |
seq_num | the seq num of the next packet to be received |
rtp_time | the time in RTP timescale of the next packet to be received |
ssrc | the SSRC identifier of the next packet to be received |
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)
ch | the target RTP channel |
void gf_rtp_reset_buffers | ( | GF_RTPChannel * | ch | ) |
resets both sockets and packet reorderer
ch | the target RTP channel |
void gf_rtp_reset_ssrc | ( | GF_RTPChannel * | ch | ) |
resets sender SSRC
ch | the target RTP channel |
reads any RTP data on UDP only (not valid for TCP). Performs re-ordering if configured for it
ch | the target RTP channel |
buffer | the buffer where to store the RTP packet |
buffer_size | the size of the buffer |
flushes any pending data in packet reorderer, but does not flush packet reorderer if reorderer timeout is not exceeded
ch | the target RTP channel |
buffer | the buffer where to store the data |
buffer_size | the size of the buffer |
reads any RTCP data on UDP only (not valid for TCP). Performs re-ordering if configured for it
ch | the target RTP channel |
buffer | the buffer where to store the RTCP packet |
buffer_size | the size of the buffer |
flushes any pending data in packet reorderer, and flushes packet reorderer if reorderer timeout is not exceeded. Typically called several times until returning 0.
ch | the target RTP channel |
buffer | the buffer where to store the data |
buffer_size | the size of the buffer |
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
ch | the target RTP channel |
pck | the RTP packet buffer |
pck_size | the size of the RTP packet |
rtp_hdr | filled with decoded RTP header information |
PayloadStart | set to the offset in bytes of the start of the payload in the RTP packet |
decodes an RTCP packet and update timing info, send ReceiverReport too
ch | the target RTP channel |
pck | the RTP packet buffer |
pck_size | the size of the RTP packet |
has_sr | set to GF_TRUE if the RTCP packet contained an SenderReport |
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.
ch | the target RTP channel |
void gf_rtp_set_loss_rate | ( | GF_RTPChannel * | ch, |
u32 | loss_rate | ||
) |
forces loss rate for next Receiver report
ch | the target RTP channel |
loss_rate | loss rate in per-thousand |
GF_Err gf_rtp_send_bye | ( | GF_RTPChannel * | ch | ) |
sends a BYE info (leaving the session)
ch | the target RTP channel |
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,
ch | the target RTP channel |
rtp_hdr | the RTP header of the packet |
pck | the RTP payload buffer |
pck_size | the RTP payload size |
fast_send | if set, the payload buffer contains 12 bytes available BEFORE its indicated start where the RTP header is written in place |
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
ch | the target RTP channel |
tcp_callback | the callback function |
cbk1 | user data for the callback function |
cbk2 | user data for the callback function |
u32 gf_rtp_is_unicast | ( | GF_RTPChannel * | ch | ) |
checks if an RTP channel is unicast
ch | the target RTP channel |
u32 gf_rtp_is_interleaved | ( | GF_RTPChannel * | ch | ) |
checks if an RTP channel is interleaved
ch | the target RTP channel |
u32 gf_rtp_get_clockrate | ( | GF_RTPChannel * | ch | ) |
gets clockrate/timescale of an RTP channel
ch | the target RTP channel |
u8 gf_rtp_get_low_interleave_id | ( | GF_RTPChannel * | ch | ) |
gets the low interleave ID of an RTP channel
ch | the target RTP channel |
u8 gf_rtp_get_hight_interleave_id | ( | GF_RTPChannel * | ch | ) |
gets the high interleave ID of an RTP channel
ch | the target RTP channel |
const GF_RTSPTransport* gf_rtp_get_transport | ( | GF_RTPChannel * | ch | ) |
gets the transport associated with an RTP channel
ch | the target RTP channel |
Float gf_rtp_get_loss | ( | GF_RTPChannel * | ch | ) |
gets loss rate of the RTP channel
ch | the target RTP channel |
u32 gf_rtp_get_tcp_bytes_sent | ( | GF_RTPChannel * | ch | ) |
gets number of TCP bytes send for an interleaved channel
ch | the target RTP channel |
gets ports of an non-interleaved RTP channel
ch | the target RTP channel |
rtp_port | the RTP port number |
rtcp_port | the RCTP port number |
GF_SDPInfo* gf_sdp_info_new | ( | ) |
creates a new SDP info
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
sdp | the target SDP to destroy |
void gf_sdp_info_reset | ( | GF_SDPInfo * | sdp | ) |
resets all structures and destroys substructures too
sdp | the target SDP to destroy |
GF_Err gf_sdp_info_parse | ( | GF_SDPInfo * | sdp, |
char * | sdp_text, | ||
u32 | text_size | ||
) |
parses a memory SDP buffer
sdp | the target SDP to destroy |
sdp_text | the encoded SDP buffer |
text_size | sizeo if the encoded SDP buffer |
GF_SDPMedia* gf_sdp_media_new | ( | ) |
creates a new SDP media
void gf_sdp_media_del | ( | GF_SDPMedia * | media | ) |
destroys an SDP media
media | the target SDP media |
GF_SDPConnection* gf_sdp_conn_new | ( | ) |
creates a new SDP connection
void gf_sdp_conn_del | ( | GF_SDPConnection * | conn | ) |
destroys an SDP connection
conn | the target SDP connection |
GF_SDP_FMTP* gf_sdp_fmtp_new | ( | ) |
creates a new SDP payload
void gf_sdp_fmtp_del | ( | GF_SDP_FMTP * | fmtp | ) |
destroys an SDP payload
fmtp | the target SDP payload |
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
rtp_payt | rtp payload format, one of the above GF_RTP_PAYT_* |
slc | user-given SL config to use. If none specified, default RFC config is used |
flags | packetizer flags, one of the above GP_RTP_PCK_* |
cbk_obj | callback object passed back in functions |
OnNewPacket | callback function starting new RTP packet header: rtp header for new packet - note that RTP header flags are not used until PacketDone is called |
OnPacketDone | callback function closing current RTP packet header: final rtp header for packet |
OnDataReference | optional, 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 |
OnData | to 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 |
void gf_rtp_builder_del | ( | GP_RTPPacketizer * | builder | ) |
destroys an RTP packetizer
builder | the target RTP packetizer |
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
builder | the target RTP packetizer |
PayloadType | the payload type to use |
MaxPayloadSize | maximum payload size of RTP packets (eg MTU minus IP/UDP/RTP headers) |
max_ptime | maximum packet duration IN RTP TIMESCALE |
StreamType | MPEG-4 system stream type - MUST always be provided for payloads format specifying audio or video streams |
codecid | ID of the media codec |
PL_ID | profile and level identifier for the stream all other params are for RFC 3640 *** |
avgSize | average 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 |
maxSize | max size of an AU. If unknown (real-time) set to 0 |
avgTS | average CTS progression (1000/FPS for video) |
maxDTS | maximum DTS offset in case of bidirectional coding. |
IV_length | size (in bytes) of IV when ISMACrypted |
KI_length | size (in bytes) of key indicator when ISMACrypted |
pref_mode | MPEG-4 generic only, specifies the payload mode - can be NULL (mode generic) |
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
builder | the target RTP packetizer |
IV | initialization vector |
key_indicator | key indicator |
is_encrypted | encrypted flag |
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
builder | the target RTP packetizer |
data | input buffer |
data_size | input buffer size |
IsAUEnd | set to one if this buffer is the last of the AU |
FullAUSize | complete access unit size if known, 0 otherwise |
duration | sample duration in rtp timescale (mostly needed for 3GPP text streams) |
descIndex | sample description index (mostly needed for 3GPP text streams) |
GF_Err gf_rtp_builder_format_sdp | ( | GP_RTPPacketizer * | builder, |
char * | payload_name, | ||
char ** | out_sdp_line, | ||
char * | dsi, | ||
u32 | dsi_size | ||
) |
formats the "fmtp: " attribute for the MPEG-4 generic packetizer. sdpline shall be at least 2000 char
builder | the target RTP packetizer |
payload_name | name of the payload to use (profile of RFC 3640) |
out_sdp_line | SDP line buffer produced - must be freed by caller |
dsi | decoder config of stream if any, or NULL |
dsi_size | size of the decoder config |
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
builder | the target RTP packetizer |
payload_name | the buffer to fill with the payload name |
media_name | the buffer to fill with the payload name |
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
media | the SDP media structure describing the RTP stream - can be NULL for static payload types |
hdr_payt | the static RTP payload type when no SDP is used |
sl_packet_cbk | callback function of the depacketizer to retrieves payload |
udta | opaque data for the callback function |
void gf_rtp_depacketizer_del | ( | GF_RTPDepacketizer * | rtpd | ) |
destroys an RTP depacketizer
rtpd | the target RTP depacketizer |
void gf_rtp_depacketizer_reset | ( | GF_RTPDepacketizer * | rtpd, |
Bool | full_reset | ||
) |
resets an RTP depacketizer, assuming next packet should be an AU start
rtpd | the target RTP depacketizer |
full_reset | if set, completely reset the SL header |
void gf_rtp_depacketizer_process | ( | GF_RTPDepacketizer * | rtpd, |
GF_RTPHeader * | hdr, | ||
u8 * | payload, | ||
u32 | size | ||
) |
process an RTP depacketizer
rtpd | the target RTP depacketizer |
hdr | the RTP packet header |
payload | the RTP packet payload |
size | the RTP packet payload size |