libwebsockets
Lightweight C library for HTML5 websockets
Toggle main menu visibility
class="ui-resizable-handle">
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
49
struct
lws_rtp_ctx
{
50
uint32_t
ssrc
;
51
uint32_t
ts
;
52
uint32_t
last_ts
;
53
uint16_t
seq
;
54
uint8_t
pt
;
/* Payload Type */
55
uint8_t
new_frame
;
56
};
57
58
typedef
void (*
lws_rtp_cb_t
)(
void
*priv,
const
uint8_t
*pkt,
size_t
len,
int
marker);
59
67
LWS_VISIBLE
LWS_EXTERN
void
68
lws_rtp_init
(
struct
lws_rtp_ctx
*ctx,
uint32_t
ssrc,
uint8_t
pt);
69
79
LWS_VISIBLE
LWS_EXTERN
void
80
lws_rtp_write_header
(
struct
lws_rtp_ctx
*ctx,
uint8_t
*buf,
int
marker);
81
95
LWS_VISIBLE
LWS_EXTERN
int
96
lws_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
99
LWS_VISIBLE
LWS_EXTERN
int
100
lws_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__ */
uint16_t
unsigned short uint16_t
Definition
libwebsockets.h:696
uint32_t
unsigned int uint32_t
Definition
libwebsockets.h:695
LWS_EXTERN
#define LWS_EXTERN
Definition
libwebsockets.h:296
uint8_t
unsigned char uint8_t
Definition
libwebsockets.h:697
LWS_VISIBLE
#define LWS_VISIBLE
Definition
libwebsockets.h:291
lws_rtp_init
LWS_VISIBLE LWS_EXTERN void lws_rtp_init(struct lws_rtp_ctx *ctx, uint32_t ssrc, uint8_t pt)
lws_rtp_ctx::seq
uint16_t seq
Definition
lws-rtp.h:53
lws_rtp_ctx::ts
uint32_t ts
Definition
lws-rtp.h:51
lws_rtp_ctx::last_ts
uint32_t last_ts
Definition
lws-rtp.h:52
lws_rtp_ctx::ssrc
uint32_t ssrc
Definition
lws-rtp.h:50
lws_rtp_cb_t
void(* lws_rtp_cb_t)(void *priv, const uint8_t *pkt, size_t len, int marker)
Definition
lws-rtp.h:58
lws_rtp_ctx::pt
uint8_t pt
Definition
lws-rtp.h:54
lws_rtp_av1_packetize
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_rtp_write_header
LWS_VISIBLE LWS_EXTERN void lws_rtp_write_header(struct lws_rtp_ctx *ctx, uint8_t *buf, int marker)
lws_rtp_ctx::new_frame
uint8_t new_frame
Definition
lws-rtp.h:55
lws_rtp_h264_packetize
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)
lws_rtp_ctx
Definition
lws-rtp.h:49
include
libwebsockets
lws-rtp.h
Generated on
for libwebsockets by
1.18.0