uvgRTP 4.0.0
An open-source library for RTP/SRTP media delivery
Loading...
Searching...
No Matches
Extended C++ API

Only available in static builds, allows use of C++ types like std::string in the public API. More...

Classes

struct  uvgrtp::frame::rtcp_receiver_report
 See RFC 3550 section 6.4.2 More...
 
struct  uvgrtp::frame::rtcp_sender_report
 See RFC 3550 section 6.4.1 More...
 
struct  uvgrtp::frame::rtcp_sdes_chunk
 See RFC 3550 section 6.5 More...
 
struct  uvgrtp::frame::rtcp_sdes_packet
 See RFC 3550 section 6.5 More...
 

Functions

uvgrtp::sessionuvgrtp::context::create_session (std::pair< std::string, std::string > addresses)
 Create a new RTP session between two IP addresses.
 
uvgrtp::sessionuvgrtp::context::create_session (std::string address)
 Create a new RTP session.
 
thread_local rtp_error_t rtp_errno
 Thread-local variable holding the error code for RTP operations that do not return rtp_error.
 
rtp_error_t uvgrtp::media_stream::push_frame (std::unique_ptr< uint8_t[]> data, size_t data_len, int rtp_flags)
 Send data to remote participant with a custom timestamp.
 
rtp_error_t uvgrtp::media_stream::push_frame (std::unique_ptr< uint8_t[]> data, size_t data_len, uint32_t ts, int rtp_flags)
 Send data to remote participant with a custom timestamp.
 
rtp_error_t uvgrtp::media_stream::push_frame (std::unique_ptr< uint8_t[]> data, size_t data_len, uint32_t ts, uint64_t ntp_ts, int rtp_flags)
 Send data to remote participant with custom RTP and NTP timestamps.
 
rtp_error_t uvgrtp::rtcp::send_sdes_packet (const std::vector< uvgrtp::frame::rtcp_sdes_item > &items)
 Send an RTCP SDES packet with full SDES items.
 
rtp_error_t uvgrtp::rtcp::send_bye_packet (const std::vector< uint32_t > &ssrcs)
 Send an RTCP BYE packet.
 
rtp_error_t uvgrtp::rtcp::install_sender_hook (std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sender_report >)> sr_handler)
 Install a C++ callback for incoming RTCP Sender Reports.
 
rtp_error_t uvgrtp::rtcp::install_receiver_hook (std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_receiver_report >)> rr_handler)
 Install a C++ callback for incoming RTCP Receiver Reports.
 
rtp_error_t uvgrtp::rtcp::install_sdes_hook (std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sdes_packet >)> sdes_handler)
 Install a C++ callback for incoming RTCP SDES packets.
 
rtp_error_t uvgrtp::rtcp::install_app_hook (std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_app_packet >)> app_handler)
 Install a C++ callback for incoming RTCP APP packets.
 
rtp_error_t uvgrtp::rtcp::install_roundtrip_time_hook (std::function< void(uint32_t, uint32_t, double)> rtt_handler)
 Install an Round Trip Time hook.
 
rtp_error_t uvgrtp::rtcp::install_send_app_hook (const std::string &app_name, std::function< std::unique_ptr< uint8_t[]>(uint8_t &subtype, uint32_t &payload_len)> app_sending_func)
 Install a C++ hook for sending RTCP APP packets during compound report generation.
 
rtp_error_t uvgrtp::rtcp::remove_send_app_hook (const std::string &app_name)
 
rtp_error_t uvgrtp::rtcp::install_sender_hook (std::function< void(std::shared_ptr< uvgrtp::frame::rtcp_sender_report >)> sr_handler)
 
rtp_error_t uvgrtp::rtcp::install_receiver_hook (std::function< void(std::shared_ptr< uvgrtp::frame::rtcp_receiver_report >)> rr_handler)
 
rtp_error_t uvgrtp::rtcp::install_sdes_hook (std::function< void(std::shared_ptr< uvgrtp::frame::rtcp_sdes_packet >)> sdes_handler)
 
rtp_error_t uvgrtp::rtcp::install_app_hook (std::function< void(std::shared_ptr< uvgrtp::frame::rtcp_app_packet >)> app_handler)
 
rtp_error_t uvgrtp::rtcp::install_sender_hook (void(*hook)(uvgrtp::frame::rtcp_sender_report *))
 
rtp_error_t uvgrtp::rtcp::install_receiver_hook (void(*hook)(uvgrtp::frame::rtcp_receiver_report *))
 
rtp_error_t uvgrtp::rtcp::install_sdes_hook (void(*hook)(uvgrtp::frame::rtcp_sdes_packet *))
 
uvgrtp::frame::rtcp_sender_reportuvgrtp::rtcp::get_sender_packet (uint32_t ssrc)
 
uvgrtp::frame::rtcp_receiver_reportuvgrtp::rtcp::get_receiver_packet (uint32_t ssrc)
 
uvgrtp::frame::rtcp_sdes_packetuvgrtp::rtcp::get_sdes_packet (uint32_t ssrc)
 
std::string uvgrtp::get_version ()
 Get the full version string of uvgRTP.
 
std::string uvgrtp::get_git_hash ()
 Get the Git commit hash of the uvgRTP build.
 

Detailed Description

Only available in static builds, allows use of C++ types like std::string in the public API.

Function Documentation

◆ create_session() [1/2]

uvgrtp::session * uvgrtp::context::create_session ( std::pair< std::string, std::string > addresses)

Create a new RTP session between two IP addresses.

Parameters
addressesLocal and remote IP address for session as a pair
Returns
RTP session object
Return values
uvgrtp::sessionOn success
nullptrIf memory allocation failed

◆ create_session() [2/2]

uvgrtp::session * uvgrtp::context::create_session ( std::string address)

Create a new RTP session.

Parameters
addressIP address of remote or local participant
Returns
RTP session object
Return values
uvgrtp::sessionOn success
nullptrIf "address" is empty or memory allocation failed

◆ get_git_hash()

std::string uvgrtp::get_git_hash ( )

Get the Git commit hash of the uvgRTP build.

Returns
Git commit hash string.

◆ get_version()

std::string uvgrtp::get_version ( )

Get the full version string of uvgRTP.

Returns
Full version string (e.g., "1.2.3").

◆ install_app_hook()

rtp_error_t uvgrtp::rtcp::install_app_hook ( std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_app_packet >)> app_handler)

Install a C++ callback for incoming RTCP APP packets.

Parameters
app_handlerC++ function taking std::unique_ptr to APP packet
Return values
RTP_OKon success
RTP_INVALID_VALUEif handler is nullptr

◆ install_receiver_hook()

rtp_error_t uvgrtp::rtcp::install_receiver_hook ( std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_receiver_report >)> rr_handler)

Install a C++ callback for incoming RTCP Receiver Reports.

Parameters
rr_handlerC++ function taking std::unique_ptr to Receiver Report
Return values
RTP_OKon success
RTP_INVALID_VALUEif handler is nullptr

◆ install_roundtrip_time_hook()

rtp_error_t uvgrtp::rtcp::install_roundtrip_time_hook ( std::function< void(uint32_t, uint32_t, double)> rtt_handler)

Install an Round Trip Time hook.

......

Parameters
rtt_handlerFunction to be called with (ssrc, remote_ssrc, rtt) where rtt is measured in seconds
Return values
RTP_OKon success
RTP_INVALID_VALUEIf hook is nullptr

◆ install_sdes_hook()

rtp_error_t uvgrtp::rtcp::install_sdes_hook ( std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sdes_packet >)> sdes_handler)

Install a C++ callback for incoming RTCP SDES packets.

Parameters
sdes_handlerC++ function taking std::unique_ptr to SDES packet
Return values
RTP_OKon success
RTP_INVALID_VALUEif handler is nullptr

◆ install_send_app_hook()

rtp_error_t uvgrtp::rtcp::install_send_app_hook ( const std::string & app_name,
std::function< std::unique_ptr< uint8_t[]>(uint8_t &subtype, uint32_t &payload_len)> app_sending_func )

Install a C++ hook for sending RTCP APP packets during compound report generation.

Parameters
app_nameFour-character name of the APP item
app_sending_funcFunction returning dynamically allocated payload data and setting subtype/payload_len
Return values
RTP_OKon success
RTP_INVALID_VALUEif inputs are invalid

◆ install_sender_hook()

rtp_error_t uvgrtp::rtcp::install_sender_hook ( std::function< void(std::unique_ptr< uvgrtp::frame::rtcp_sender_report >)> sr_handler)

Install a C++ callback for incoming RTCP Sender Reports.

Parameters
sr_handlerC++ function taking std::unique_ptr to Sender Report
Return values
RTP_OKon success
RTP_INVALID_VALUEif handler is nullptr

◆ push_frame() [1/3]

rtp_error_t uvgrtp::media_stream::push_frame ( std::unique_ptr< uint8_t[]> data,
size_t data_len,
int rtp_flags )

Send data to remote participant with a custom timestamp.

If so specified either by the selected media format and/or given RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1492 bytes, or to any other size defined by the application using RCC_MTU_SIZE

The frame is automatically reconstructed by the receiver if all fragments have been received successfully.

Parameters
dataSmart pointer to data the that should be sent
data_lenLength of data
rtp_flagsOptional flags, see RTP_FLAGS for more details
Returns
RTP error code
Return values
RTP_OKOn success
RTP_INVALID_VALUEIf one of the parameters are invalid
RTP_MEMORY_ERRORIf the data chunk is too large to be processed
RTP_SEND_ERRORIf uvgRTP failed to send the data to remote
RTP_GENERIC_ERRORIf an unspecified error occurred

◆ push_frame() [2/3]

rtp_error_t uvgrtp::media_stream::push_frame ( std::unique_ptr< uint8_t[]> data,
size_t data_len,
uint32_t ts,
int rtp_flags )

Send data to remote participant with a custom timestamp.

If so specified either by the selected media format and/or given RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1492 bytes, or to any other size defined by the application using RCC_MTU_SIZE

The frame is automatically reconstructed by the receiver if all fragments have been received successfully.

If application so wishes, it may override uvgRTP's own timestamp calculations and provide timestamping information for the stream itself. This requires that the application provides a sensible value for the ts parameter. If RTCP has been enabled, uvgrtp::rtcp::set_ts_info() should have been called.

Parameters
dataSmart pointer to data the that should be sent
data_lenLength of data
ts32-bit timestamp value for the data
rtp_flagsOptional flags, see RTP_FLAGS for more details
Returns
RTP error code
Return values
RTP_OKOn success
RTP_INVALID_VALUEIf one of the parameters are invalid
RTP_MEMORY_ERRORIf the data chunk is too large to be processed
RTP_SEND_ERRORIf uvgRTP failed to send the data to remote
RTP_GENERIC_ERRORIf an unspecified error occurred

◆ push_frame() [3/3]

rtp_error_t uvgrtp::media_stream::push_frame ( std::unique_ptr< uint8_t[]> data,
size_t data_len,
uint32_t ts,
uint64_t ntp_ts,
int rtp_flags )

Send data to remote participant with custom RTP and NTP timestamps.

If so specified either by the selected media format and/or given RTP_CTX_ENABLE_FLAGS, uvgRTP fragments the input data into RTP packets of 1492 bytes, or to any other size defined by the application using RCC_MTU_SIZE

The frame is automatically reconstructed by the receiver if all fragments have been received successfully.

If application so wishes, it may override uvgRTP's own timestamp calculations and provide timestamping information for the stream itself. This requires that the application provides a sensible value for the ts parameter. If RTCP has been enabled, uvgrtp::rtcp::set_ts_info() should have been called.

Parameters
dataSmart pointer to data the that should be sent
data_lenLength of data
ts32-bit RTP timestamp for the packet
ntp_ts64-bit NTP timestamp value of when the packets data was sampled. NTP timestamp is a 64-bit unsigned fixed-point number with the integer part (seconds) in the first 32 bits and the fractional part (fractional seconds) in the last 32 bits. Used for synchronizing multiple streams.
rtp_flagsOptional flags, see RTP_FLAGS for more details
Returns
RTP error code
Return values
RTP_OKOn success
RTP_INVALID_VALUEIf one of the parameters are invalid
RTP_MEMORY_ERRORIf the data chunk is too large to be processed
RTP_SEND_ERRORIf uvgRTP failed to send the data to remote
RTP_GENERIC_ERRORIf an unspecified error occurred

◆ send_bye_packet()

rtp_error_t uvgrtp::rtcp::send_bye_packet ( const std::vector< uint32_t > & ssrcs)

Send an RTCP BYE packet.

Parameters
ssrcsVector of SSRCs of those participants who are quitting
Return values
RTP_OKOn success
RTP_MEMORY_ERRORIf allocation fails
RTP_GENERIC_ERRORIf sending fails

◆ send_sdes_packet()

rtp_error_t uvgrtp::rtcp::send_sdes_packet ( const std::vector< uvgrtp::frame::rtcp_sdes_item > & items)

Send an RTCP SDES packet with full SDES items.

Parameters
itemsVector of SDES items
Return values
RTP_OKOn success
RTP_MEMORY_ERRORIf allocation fails
RTP_GENERIC_ERRORIf sending fails

Variable Documentation

◆ rtp_errno

thread_local rtp_error_t rtp_errno
extern

Thread-local variable holding the error code for RTP operations that do not return rtp_error.

Stores the most recent RTP error code for the current thread.