|
Compy 0.2.0
A lightweight RTSP 1.0 server library for embedded systems
|
An RTP data transport. More...
#include <compy/droppable.h>#include <compy/transport.h>#include <stdbool.h>#include <stdint.h>#include <datatype99.h>#include <slice99.h>#include <compy/priv/compiler_attrs.h>

Go to the source code of this file.
Typedefs | |
| typedef struct Compy_RtpTransport | Compy_RtpTransport |
| An RTP data transport. | |
Functions | |
| datatype99 (Compy_RtpTimestamp,(Compy_RtpTimestamp_Raw, uint32_t),(Compy_RtpTimestamp_SysClockUs, uint64_t)) | |
| An RTP timestamp. | |
| Compy_RtpTransport * | Compy_RtpTransport_new (Compy_Transport t, uint8_t payload_ty, uint32_t clock_rate) COMPY_PRIV_MUST_USE |
Creates a new RTP transport from the underlying level-4 protocol t. | |
| int | Compy_RtpTransport_send_packet (Compy_RtpTransport *self, Compy_RtpTimestamp ts, bool marker, U8Slice99 payload_header, U8Slice99 payload) COMPY_PRIV_MUST_USE |
| Sends an RTP packet. | |
| declImplExtern99 (Compy_Droppable, Compy_RtpTransport) | |
| Implements Compy_Droppable_IFACE for Compy_RtpTransport. | |
| bool | Compy_RtpTransport_is_full (Compy_RtpTransport *self) |
| uint32_t | Compy_RtpTransport_get_ssrc (const Compy_RtpTransport *self) |
| Returns the SSRC identifier of this transport. | |
| void | Compy_RtpTransport_set_ssrc (Compy_RtpTransport *self, uint32_t ssrc) |
| Sets the SSRC identifier of this transport. | |
| void | Compy_RtpTransport_set_extension (Compy_RtpTransport *self, uint8_t id, const uint8_t *value, uint8_t len) |
| Sets a persistent one-byte RTP header extension (RFC 8285). | |
| uint16_t | Compy_RtpTransport_get_seq (const Compy_RtpTransport *self) |
| Returns the current RTP sequence number of this transport. | |
| uint32_t | Compy_RtpTransport_get_packet_count (const Compy_RtpTransport *self) |
| Returns the total number of RTP packets sent. | |
| uint32_t | Compy_RtpTransport_get_octet_count (const Compy_RtpTransport *self) |
| Returns the total number of payload octets sent (excludes RTP headers). | |
| uint32_t | Compy_RtpTransport_get_last_rtp_timestamp (const Compy_RtpTransport *self) |
| Returns the RTP timestamp of the last sent packet. | |
An RTP data transport.
| uint32_t Compy_RtpTransport_get_last_rtp_timestamp | ( | const Compy_RtpTransport * | self | ) |
Returns the RTP timestamp of the last sent packet.
self != NULL | uint32_t Compy_RtpTransport_get_octet_count | ( | const Compy_RtpTransport * | self | ) |
Returns the total number of payload octets sent (excludes RTP headers).
self != NULL | uint32_t Compy_RtpTransport_get_packet_count | ( | const Compy_RtpTransport * | self | ) |
Returns the total number of RTP packets sent.
self != NULL | uint16_t Compy_RtpTransport_get_seq | ( | const Compy_RtpTransport * | self | ) |
Returns the current RTP sequence number of this transport.
self != NULL | uint32_t Compy_RtpTransport_get_ssrc | ( | const Compy_RtpTransport * | self | ) |
Returns the SSRC identifier of this transport.
self != NULL | Compy_RtpTransport * Compy_RtpTransport_new | ( | Compy_Transport | t, |
| uint8_t | payload_ty, | ||
| uint32_t | clock_rate | ||
| ) |
Creates a new RTP transport from the underlying level-4 protocol t.
| [in] | t | The level-4 protocol (such as TCP or UDP). |
| [in] | payload_ty | The RTP payload type. The list of payload types is available here: https://en.wikipedia.org/wiki/RTP_payload_formats. |
| [in] | clock_rate | The RTP clock rate of payload_ty (HZ). |
t.self && t.vptr rand PRNG must be set up via srand. | int Compy_RtpTransport_send_packet | ( | Compy_RtpTransport * | self, |
| Compy_RtpTimestamp | ts, | ||
| bool | marker, | ||
| U8Slice99 | payload_header, | ||
| U8Slice99 | payload | ||
| ) |
Sends an RTP packet.
| [out] | self | The RTP transport for sending this packet. |
| [in] | ts | The RTP timestamp for this packet. |
| [in] | marker | The RTP marker flag. |
| [in] | payload_header | The payload header. Can be U8Slice99_empty(). |
| [in] | payload | The payload data. |
self != NULLerrno appropriately, 0 on success. | void Compy_RtpTransport_set_extension | ( | Compy_RtpTransport * | self, |
| uint8_t | id, | ||
| const uint8_t * | value, | ||
| uint8_t | len | ||
| ) |
Sets a persistent one-byte RTP header extension (RFC 8285).
The extension is included in every outgoing packet. Profile is 0xBEDE (one-byte header format). The extension element is: [id(4 bits) | len-1(4 bits) | value(len bytes)].
| [in] | id | Extension ID (1-14). |
| [in] | value | Extension value bytes. |
| [in] | len | Length of value (1-8 bytes). |
self != NULL id >= 1 && id <= 14 len >= 1 && len <= 8 | void Compy_RtpTransport_set_ssrc | ( | Compy_RtpTransport * | self, |
| uint32_t | ssrc | ||
| ) |
Sets the SSRC identifier of this transport.
Call before sending any packets. Used when the SSRC must match a value declared in the SDP (e.g., WebRTC a=ssrc lines).
self != NULL | datatype99 | ( | Compy_RtpTimestamp | , |
| (Compy_RtpTimestamp_Raw, uint32_t) | , | ||
| (Compy_RtpTimestamp_SysClockUs, uint64_t) | |||
| ) |
An RTP timestamp.
Raw – The value to be assigned to Compy_RtpHeader.timestamp without further conversion.SysClockUs – The timestamp value in microseconds derived from a system clock (e.g., clock_gettime). It should be used when a raw timestamp cannot be computed, as typically occurs with real-time video.See Datatype99 for the macro usage.
| declImplExtern99 | ( | Compy_Droppable | , |
| Compy_RtpTransport | |||
| ) |
Implements Compy_Droppable_IFACE for Compy_RtpTransport.
See Interface99 for the macro usage.