|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
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. | |
| #define RTP_HDR_CC_MASK GENMASK(3, 0) |
#include <zephyr/net/rtp.h>
Mask for the CSRC count (CC) field within rtp_header::vpxcc.
| #define RTP_HDR_M_MASK BIT(7) |
#include <zephyr/net/rtp.h>
Mask for the marker (M) bit within rtp_header::mpt.
| #define RTP_HDR_P_MASK BIT(5) |
#include <zephyr/net/rtp.h>
Mask for the padding (P) flag within rtp_header::vpxcc.
| #define RTP_HDR_PT_MASK GENMASK(6, 0) |
#include <zephyr/net/rtp.h>
Mask for the payload type (PT) field within rtp_header::mpt.
| #define RTP_HDR_V_MASK GENMASK(7, 6) |
#include <zephyr/net/rtp.h>
Mask for the version (V) field within rtp_header::vpxcc.
| #define RTP_HDR_X_MASK BIT(4) |
#include <zephyr/net/rtp.h>
Mask for the extension (X) flag within rtp_header::vpxcc.
| #define RTP_MARKER 1 |
#include <zephyr/net/rtp.h>
Convenience value for the marker argument of rtp_session_send that sets the RTP marker bit.
Pass 0 to clear the bit.
| #define RTP_MAX_CSRC_COUNT CONFIG_RTP_MAX_CSRC_COUNT |
#include <zephyr/net/rtp.h>
Maximum number of csrc's that can be stored.
| #define RTP_MIN_HEADER_LEN 12 |
#include <zephyr/net/rtp.h>
Minimum RTP header length in bytes, excluding any CSRC list or extension.
| #define RTP_PAYLOAD_TYPE_MAX 127 |
#include <zephyr/net/rtp.h>
Maximum value for the payload type in an RTP packet.
| #define RTP_SESSION_DEFINE | ( | _name, | |
| _local_port ) |
#include <zephyr/net/rtp.h>
Define an RTP session.
Declares and zero-initializes a rtp_session variable. Call rtp_session_init to configure the session before starting it with rtp_session_start.
| _name | Name of the rtp_session variable to define. |
| _local_port | Local UDP port used when transmitting packets. Set to 0 to let the stack select a port automatically (see CONFIG_RTP_LOCAL_PORT_BASE). Only used for RTP_TRANSPORT_NET_PKT. |
| #define RTP_VERSION 2 |
#include <zephyr/net/rtp.h>
RTP protocol version 2 as defined in RFC 3550.
| typedef void(* rtp_rx_cb_t) (struct rtp_session *session, struct rtp_packet *packet, void *user_data) |
#include <zephyr/net/rtp.h>
RTP packet receive callback type.
Called from the network receive context when an RTP packet arrives. Keep the callback short and non-blocking. The packet payload pointer is only valid for the duration of the callback.
The callback may still be invoked concurrently with, or immediately after, a stop of the session's receive path from another thread; a session being stopped is not a guarantee that no further callback is in flight or about to be dispatched. Implementations must tolerate a call landing after they consider the session stopped.
| session | Pointer to the RTP session that received the packet. |
| packet | Pointer to the received RTP packet. |
| user_data | Opaque user data supplied during session initialization. |
| enum rtp_role |
#include <zephyr/net/rtp.h>
Role of an RTP session.
| Enumerator | |
|---|---|
| RTP_ROLE_SINK | Session receives packets only. |
| RTP_ROLE_SOURCE | Session transmits packets only. |
| RTP_ROLE_BOTH | Session both transmits and receives packets. |
| enum rtp_transport_type |
#include <zephyr/net/rtp.h>
Transport backend used by an RTP session.
Passed to rtp_session_init.
| Enumerator | |
|---|---|
| RTP_TRANSPORT_NUM | Shall not be used as a transport type. Indicator of maximum transport types possible. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Get the CSRC count (CC) field.
| h | RTP header to read. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Get the marker (M) bit.
| h | RTP header to read. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Get the padding (P) flag.
| h | RTP header to read. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Get the payload type (PT) field.
| h | RTP header to read. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Get the RTP version (V) field.
| h | RTP header to read. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Get the extension (X) flag.
| h | RTP header to read. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Set the CSRC count (CC) field.
| h | RTP header to modify. |
| value | CSRC count field value. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Set the marker (M) bit.
| h | RTP header to modify. |
| value | Marker bit value. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Set the padding (P) flag.
| h | RTP header to modify. |
| value | Padding flag value. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Set the payload type (PT) field.
| h | RTP header to modify. |
| value | Payload type field value. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Set the RTP version (V) field.
| h | RTP header to modify. |
| value | Version field value. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Set the extension (X) flag.
| h | RTP header to modify. |
| value | Extension flag value. |
| int rtp_init_header_extension | ( | struct rtp_header_extension * | hdr_x, |
| uint16_t | definition, | ||
| uint8_t * | data, | ||
| size_t | len ) |
#include <zephyr/net/rtp.h>
Initialize an RTP header extension.
| hdr_x | Pointer to the header extension struct to initialize. |
| definition | Profile-defined extension header identifier. |
| data | Pointer to the extension data. |
| len | Length of data in bytes; must be aligned to a 32-bit word boundary. |
| 0 | On success. |
| negative | Errno value on failure. |
| int rtp_session_add_csrc | ( | struct rtp_session * | session, |
| uint32_t | csrc ) |
#include <zephyr/net/rtp.h>
Add a contributing source (CSRC) to the session.
| session | Pointer to the RTP session. |
| csrc | CSRC identifier to add. |
| 0 | On success. |
| negative | Errno value on failure. |
| 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 ) |
#include <zephyr/net/rtp.h>
Initialize an RTP session.
Configure a session for transmit, receive, or both, as determined by role.
| session | Pointer to the RTP session to initialize. |
| iface | Network interface to use. |
| sock_addr | Session address and port (multicast group or unicast peer). The application should be aware of the fact that unicast sinks accept RTP packets from any sender. |
| role | Whether the session acts as a sink, source, or both. |
| payload_type | RTP payload type field value used when transmitting; ignored when role is RTP_ROLE_SINK. |
| callback | Callback invoked on packet reception; required when role is RTP_ROLE_SINK or RTP_ROLE_BOTH. |
| user_data | Opaque user data forwarded to callback. |
| transport_type | Transport backend to use; see rtp_transport_type. |
| 0 | On success. |
| negative | Errno value on failure. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Initialize a receive-only RTP session.
Convenience wrapper around rtp_session_init that configures the session for receive only.
| session | Pointer to the RTP session to initialize. |
| iface | Network interface to use. |
| sock_addr | Session address and port to listen on. |
| callback | Callback invoked when a packet is received. |
| user_data | Opaque user data forwarded to callback. |
| transport_type | Transport backend to use; see rtp_transport_type. |
| 0 | On success. |
| negative | Errno value on failure. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Initialize a transmit-only RTP session.
Convenience wrapper around rtp_session_init that configures the session for transmit only.
| session | Pointer to the RTP session to initialize. |
| iface | Network interface to use. |
| sock_addr | Session address and port to send packets to. |
| payload_type | RTP payload type field value. |
| transport_type | Transport backend to use; see rtp_transport_type. |
| 0 | On success. |
| negative | Errno value on failure. |
| int rtp_session_remove_csrc | ( | struct rtp_session * | session, |
| uint32_t | csrc ) |
#include <zephyr/net/rtp.h>
Remove a contributing source (CSRC) from the session.
| session | Pointer to the RTP session. |
| csrc | CSRC identifier to remove. |
| 0 | On success. |
| negative | Errno value on failure. |
| 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 ) |
#include <zephyr/net/rtp.h>
Send an RTP packet with an optional header extension and optional padding.
| session | Pointer to the RTP session. | |
| data | Pointer to the payload data to send. | |
| len | Length of data in bytes. | |
| delta_ts | Timestamp increment to apply; for audio this is typically the number of sample periods covered by the payload. | |
| padding | Number of padding bytes to append (0–255); pass 0 for no padding. | |
| marker | Marker bit value; use RTP_MARKER to set the bit or 0 to clear it. | |
| hdr_x | Pointer to a header extension, or NULL for no extension. | |
| [out] | timestamp | Pointer to store the RTP timestamp used in the packet. Can be left NULL if the timestamp is of no interest for the caller. |
| 0 | On success. |
| negative | Errno value on failure. |
|
inlinestatic |
#include <zephyr/net/rtp.h>
Send an RTP packet without a header extension, padding or marker.
Convenience wrapper around rtp_session_send.
| session | Pointer to the RTP session. |
| data | Pointer to the payload data to send. |
| len | Length of data in bytes. |
| delta_ts | Timestamp increment to apply; for audio this is typically the number of sample periods covered by the payload. |
| 0 | On success. |
| negative | Errno value on failure. |
| int rtp_session_start | ( | struct rtp_session * | session | ) |
#include <zephyr/net/rtp.h>
Start an RTP session.
Open the network connections and begin processing packets. The session must have been configured with rtp_session_init before calling this function.
| session | Pointer to the RTP session. |
| 0 | On success. |
| negative | Errno value on failure. |
| int rtp_session_stop | ( | struct rtp_session * | session | ) |
#include <zephyr/net/rtp.h>
Stop an RTP session.
Close the network connections and stop processing packets.
| session | Pointer to the RTP session. |
| 0 | On success. |
| negative | Errno value on failure. |