SmolRTSP  0.1.3
A small, portable, extensible RTSP 1.0 implementation in C99
rtp_transport.h File Reference

An RTP data transport. More...

#include <smolrtsp/droppable.h>
#include <smolrtsp/transport.h>
#include <stdbool.h>
#include <stdint.h>
#include <datatype99.h>
#include <slice99.h>
#include <smolrtsp/priv/compiler_attrs.h>
Include dependency graph for rtp_transport.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct SmolRTSP_RtpTransport SmolRTSP_RtpTransport
 An RTP data transport.
 

Functions

 datatype99 (SmolRTSP_RtpTimestamp,(SmolRTSP_RtpTimestamp_Raw, uint32_t),(SmolRTSP_RtpTimestamp_SysClockUs, uint64_t))
 An RTP timestamp. More...
 
SmolRTSP_RtpTransportSmolRTSP_RtpTransport_new (SmolRTSP_Transport t, uint8_t payload_ty, uint32_t clock_rate) SMOLRTSP_PRIV_MUST_USE
 Creates a new RTP transport from the underlying level-4 protocol t. More...
 
int SmolRTSP_RtpTransport_send_packet (SmolRTSP_RtpTransport *self, SmolRTSP_RtpTimestamp ts, bool marker, U8Slice99 payload_header, U8Slice99 payload) SMOLRTSP_PRIV_MUST_USE
 Sends an RTP packet. More...
 
 declImplExtern99 (SmolRTSP_Droppable, SmolRTSP_RtpTransport)
 Implements SmolRTSP_Droppable_IFACE for SmolRTSP_RtpTransport. More...
 
bool SmolRTSP_RtpTransport_is_full (SmolRTSP_RtpTransport *self)
 

Detailed Description

An RTP data transport.

Function Documentation

◆ datatype99()

datatype99 ( SmolRTSP_RtpTimestamp  ,
(SmolRTSP_RtpTimestamp_Raw, uint32_t)  ,
(SmolRTSP_RtpTimestamp_SysClockUs, uint64_t)   
)

An RTP timestamp.

Variants

  • Raw – The value to be assigned to SmolRTSP_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()

declImplExtern99 ( SmolRTSP_Droppable  ,
SmolRTSP_RtpTransport   
)

Implements SmolRTSP_Droppable_IFACE for SmolRTSP_RtpTransport.

See Interface99 for the macro usage.

◆ SmolRTSP_RtpTransport_new()

SmolRTSP_RtpTransport* SmolRTSP_RtpTransport_new ( SmolRTSP_Transport  t,
uint8_t  payload_ty,
uint32_t  clock_rate 
)

Creates a new RTP transport from the underlying level-4 protocol t.

Parameters
[in]tThe level-4 protocol (such as TCP or UDP).
[in]payload_tyThe RTP payload type. The list of payload types is available here: https://en.wikipedia.org/wiki/RTP_payload_formats.
[in]clock_rateThe RTP clock rate of payload_ty (HZ).
Precondition
t.self && t.vptr
The rand PRNG must be set up via srand.

◆ SmolRTSP_RtpTransport_send_packet()

int SmolRTSP_RtpTransport_send_packet ( SmolRTSP_RtpTransport self,
SmolRTSP_RtpTimestamp  ts,
bool  marker,
U8Slice99  payload_header,
U8Slice99  payload 
)

Sends an RTP packet.

Parameters
[out]selfThe RTP transport for sending this packet.
[in]tsThe RTP timestamp for this packet.
[in]markerThe RTP marker flag.
[in]payload_headerThe payload header. Can be U8Slice99_empty().
[in]payloadThe payload data.
Precondition
self != NULL
Returns
-1 if an I/O error occurred and sets errno appropriately, 0 on success.