Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
rtp.h File Reference

RTP (Real-time Transport Protocol) API. More...

Go to the source code of this file.

Data Structures

struct  rtp_header_extension
 RTP header extension as defined in RFC 3550 section 5.3.1. More...
struct  rtp_header
 RTP fixed header as defined in RFC 3550 section 5.1. More...
struct  rtp_packet
 Decoded RTP packet with header and payload separated. More...
struct  rtp_session_context
 RTP session configuration context. More...
struct  rtp_transport
 Internal transport state embedded in rtp_session. More...
struct  rtp_session
 RTP session state. More...

Macros

#define RTP_VERSION   2
 RTP protocol version 2 as defined in RFC 3550.
#define RTP_MIN_HEADER_LEN   12
 Minimum RTP header length in bytes, excluding any CSRC list or extension.
#define RTP_PAYLOAD_TYPE_MAX   127
 Maximum value for the payload type in an RTP packet.
#define RTP_MARKER   1
 Convenience value for the marker argument of rtp_session_send that sets the RTP marker bit.
#define RTP_HDR_V_MASK   GENMASK(7, 6)
 Mask for the version (V) field within rtp_header::vpxcc.
#define RTP_HDR_P_MASK   BIT(5)
 Mask for the padding (P) flag within rtp_header::vpxcc.
#define RTP_HDR_X_MASK   BIT(4)
 Mask for the extension (X) flag within rtp_header::vpxcc.
#define RTP_HDR_CC_MASK   GENMASK(3, 0)
 Mask for the CSRC count (CC) field within rtp_header::vpxcc.
#define RTP_HDR_M_MASK   BIT(7)
 Mask for the marker (M) bit within rtp_header::mpt.
#define RTP_HDR_PT_MASK   GENMASK(6, 0)
 Mask for the payload type (PT) field within rtp_header::mpt.
#define RTP_MAX_CSRC_COUNT   CONFIG_RTP_MAX_CSRC_COUNT
 Maximum number of csrc's that can be stored.
#define RTP_SESSION_DEFINE(_name, _local_port)
 Define an RTP session.

Typedefs

typedef void(* rtp_rx_cb_t) (struct rtp_session *session, struct rtp_packet *packet, void *user_data)
 RTP packet receive callback type.

Enumerations

enum  rtp_role { RTP_ROLE_SINK , RTP_ROLE_SOURCE , RTP_ROLE_BOTH }
 Role of an RTP session. More...
enum  rtp_transport_type { RTP_TRANSPORT_NUM }
 Transport backend used by an RTP session. More...

Functions

int rtp_init_header_extension (struct rtp_header_extension *hdr_x, uint16_t definition, uint8_t *data, size_t len)
 Initialize an RTP header extension.
int rtp_session_init (struct rtp_session *session, struct net_if *iface, struct net_sockaddr *sock_addr, enum rtp_role role, uint8_t payload_type, rtp_rx_cb_t callback, void *user_data, enum rtp_transport_type transport_type)
 Initialize an RTP session.
static int rtp_session_init_rx (struct rtp_session *session, struct net_if *iface, struct net_sockaddr *sock_addr, rtp_rx_cb_t callback, void *user_data, enum rtp_transport_type transport_type)
 Initialize a receive-only RTP session.
static int rtp_session_init_tx (struct rtp_session *session, struct net_if *iface, struct net_sockaddr *sock_addr, uint8_t payload_type, enum rtp_transport_type transport_type)
 Initialize a transmit-only RTP session.
int rtp_session_start (struct rtp_session *session)
 Start an RTP session.
int rtp_session_stop (struct rtp_session *session)
 Stop an RTP session.
int rtp_session_add_csrc (struct rtp_session *session, uint32_t csrc)
 Add a contributing source (CSRC) to the session.
int rtp_session_remove_csrc (struct rtp_session *session, uint32_t csrc)
 Remove a contributing source (CSRC) from the session.
int rtp_session_send (struct rtp_session *session, void *data, size_t len, uint32_t delta_ts, uint8_t padding, uint8_t marker, struct rtp_header_extension *hdr_x, uint32_t *timestamp)
 Send an RTP packet with an optional header extension and optional padding.
static int rtp_session_send_simple (struct rtp_session *session, void *data, size_t len, uint32_t delta_ts)
 Send an RTP packet without a header extension, padding or marker.
static uint8_t rtp_header_get_v (const struct rtp_header *h)
 Get the RTP version (V) field.
static uint8_t rtp_header_get_p (const struct rtp_header *h)
 Get the padding (P) flag.
static uint8_t rtp_header_get_x (const struct rtp_header *h)
 Get the extension (X) flag.
static uint8_t rtp_header_get_cc (const struct rtp_header *h)
 Get the CSRC count (CC) field.
static uint8_t rtp_header_get_m (const struct rtp_header *h)
 Get the marker (M) bit.
static uint8_t rtp_header_get_pt (const struct rtp_header *h)
 Get the payload type (PT) field.
static void rtp_header_set_v (struct rtp_header *h, uint8_t value)
 Set the RTP version (V) field.
static void rtp_header_set_p (struct rtp_header *h, uint8_t value)
 Set the padding (P) flag.
static void rtp_header_set_x (struct rtp_header *h, uint8_t value)
 Set the extension (X) flag.
static void rtp_header_set_cc (struct rtp_header *h, uint8_t value)
 Set the CSRC count (CC) field.
static void rtp_header_set_m (struct rtp_header *h, uint8_t value)
 Set the marker (M) bit.
static void rtp_header_set_pt (struct rtp_header *h, uint8_t value)
 Set the payload type (PT) field.

Detailed Description

RTP (Real-time Transport Protocol) API.