libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-rtp.h
Go to the documentation of this file.
1/*
2 * libwebsockets - small server side websockets and web server implementation
3 *
4 * Copyright (C) 2010 - 2026 Andy Green <andy@warmcat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
25#ifndef __LWS_RTP_H__
26#define __LWS_RTP_H__
27
28/* Video resolutions */
29#define LWS_RTP_VIDEO_WIDTH_1080P 1920
30#define LWS_RTP_VIDEO_HEIGHT_1080P 1080
31#define LWS_RTP_VIDEO_WIDTH_720P 1280
32#define LWS_RTP_VIDEO_HEIGHT_720P 720
33#define LWS_RTP_VIDEO_WIDTH_360P 640
34#define LWS_RTP_VIDEO_HEIGHT_360P 360
35
36#define LWS_RTP_MTU_DEFAULT 1200
37
38/* Audio properties */
39#define LWS_RTP_AUDIO_SAMPLE_RATE 48000
40#define LWS_RTP_AUDIO_CHANNELS 2
41
42/* Common Payload Types (Dynamic usually) */
43#define LWS_RTP_PT_OPUS 111
44#define LWS_RTP_PT_H264 126
45
46/* RTP Header (RFC 3550) length */
47#define LWS_RTP_HEADER_LEN 12
48
57
58typedef void (*lws_rtp_cb_t)(void *priv, const uint8_t *pkt, size_t len, int marker);
59
69
80lws_rtp_write_header(struct lws_rtp_ctx *ctx, uint8_t *buf, int marker);
81
96lws_rtp_h264_packetize(struct lws_rtp_ctx *ctx, const uint8_t *nal, size_t len,
97 int last_nal, size_t mtu, lws_rtp_cb_t cb, void *priv);
98
100lws_rtp_av1_packetize(struct lws_rtp_ctx *ctx, const uint8_t *obu, size_t len,
101 int last_obu, size_t mtu, lws_rtp_cb_t cb, void *priv);
102
103#endif /* __LWS_RTP_H__ */
unsigned short uint16_t
unsigned int uint32_t
#define LWS_EXTERN
unsigned char uint8_t
#define LWS_VISIBLE
LWS_VISIBLE LWS_EXTERN void lws_rtp_init(struct lws_rtp_ctx *ctx, uint32_t ssrc, uint8_t pt)
uint16_t seq
Definition lws-rtp.h:53
uint32_t ts
Definition lws-rtp.h:51
uint32_t last_ts
Definition lws-rtp.h:52
uint32_t ssrc
Definition lws-rtp.h:50
void(* lws_rtp_cb_t)(void *priv, const uint8_t *pkt, size_t len, int marker)
Definition lws-rtp.h:58
uint8_t pt
Definition lws-rtp.h:54
LWS_VISIBLE LWS_EXTERN int lws_rtp_av1_packetize(struct lws_rtp_ctx *ctx, const uint8_t *obu, size_t len, int last_obu, size_t mtu, lws_rtp_cb_t cb, void *priv)
LWS_VISIBLE LWS_EXTERN void lws_rtp_write_header(struct lws_rtp_ctx *ctx, uint8_t *buf, int marker)
uint8_t new_frame
Definition lws-rtp.h:55
LWS_VISIBLE LWS_EXTERN int lws_rtp_h264_packetize(struct lws_rtp_ctx *ctx, const uint8_t *nal, size_t len, int last_nal, size_t mtu, lws_rtp_cb_t cb, void *priv)