libwebsockets
Lightweight C library for HTML5 websockets
Toggle main menu visibility
Loading...
Searching...
No Matches
lws-transcode.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_TRANSCODE_H__
26
#define __LWS_TRANSCODE_H__
27
28
struct
lws_transcode_ctx;
29
30
enum
lws_transcode_codec
{
31
LWS_TCC_H264
,
32
LWS_TCC_AV1
,
33
};
34
35
struct
lws_transcode_info
{
36
enum
lws_transcode_codec
codec
;
37
uint32_t
width
;
38
uint32_t
height
;
39
uint32_t
fps
;
40
uint32_t
bitrate
;
41
};
42
43
LWS_VISIBLE
LWS_EXTERN
struct
lws_transcode_ctx *
44
lws_transcode_encoder_create
(
const
struct
lws_transcode_info
*info);
45
46
LWS_VISIBLE
LWS_EXTERN
struct
lws_transcode_ctx *
47
lws_transcode_decoder_create
(
enum
lws_transcode_codec
codec);
48
49
LWS_VISIBLE
LWS_EXTERN
void
50
lws_transcode_destroy
(
struct
lws_transcode_ctx **ctx);
51
52
/*
53
* We need to abstract the frame so the user doesn't need to include ffmpeg headers.
54
* But for now, we'll just use void * and internal casting.
55
*/
56
57
LWS_VISIBLE
LWS_EXTERN
void
*
58
lws_transcode_frame_alloc
(
uint32_t
w,
uint32_t
h);
59
60
LWS_VISIBLE
LWS_EXTERN
void
61
lws_transcode_frame_free
(
void
**frame);
62
63
LWS_VISIBLE
LWS_EXTERN
int
64
lws_transcode_decode
(
struct
lws_transcode_ctx *ctx,
const
uint8_t
*buf,
size_t
len,
void
*frame);
65
66
LWS_VISIBLE
LWS_EXTERN
int
67
lws_transcode_encode
(
struct
lws_transcode_ctx *ctx,
void
*frame,
uint8_t
**buf,
size_t
*len);
68
69
LWS_VISIBLE
LWS_EXTERN
void
*
70
lws_transcode_scaler_create
(
uint32_t
src_w,
uint32_t
src_h,
uint32_t
dst_w,
uint32_t
dst_h);
71
72
LWS_VISIBLE
LWS_EXTERN
void
73
lws_transcode_scaler_destroy
(
void
**sws);
74
75
LWS_VISIBLE
LWS_EXTERN
int
76
lws_transcode_scale
(
void
*sws,
void
*src_frame,
void
*dst_frame);
77
78
LWS_VISIBLE
LWS_EXTERN
void
79
lws_transcode_yuyv_to_yuv420p
(
const
uint8_t
*yuyv,
uint8_t
*yuv,
uint32_t
w,
uint32_t
h);
80
81
LWS_VISIBLE
LWS_EXTERN
int
82
lws_transcode_mjpeg_to_yuv420p
(
void
*jpeg_dec,
const
uint8_t
*mjpeg,
size_t
len,
uint8_t
*yuv,
uint32_t
w,
uint32_t
h);
83
84
LWS_VISIBLE
LWS_EXTERN
int
85
lws_transcode_frame_import_yuv
(
void
*frame,
uint8_t
*yuv_buf);
86
87
LWS_VISIBLE
LWS_EXTERN
uint8_t
**
88
lws_transcode_frame_get_data
(
void
*frame);
89
90
LWS_VISIBLE
LWS_EXTERN
int
*
91
lws_transcode_frame_get_linesize
(
void
*frame);
92
93
LWS_VISIBLE
LWS_EXTERN
int
94
lws_transcode_frame_get_width
(
void
*frame);
95
96
LWS_VISIBLE
LWS_EXTERN
int
97
lws_transcode_frame_get_height
(
void
*frame);
98
99
#endif
uint32_t
unsigned int uint32_t
Definition
libwebsockets.h:704
LWS_EXTERN
#define LWS_EXTERN
Definition
libwebsockets.h:296
uint8_t
unsigned char uint8_t
Definition
libwebsockets.h:706
LWS_VISIBLE
#define LWS_VISIBLE
Definition
libwebsockets.h:291
lws_transcode_mjpeg_to_yuv420p
LWS_VISIBLE LWS_EXTERN int lws_transcode_mjpeg_to_yuv420p(void *jpeg_dec, const uint8_t *mjpeg, size_t len, uint8_t *yuv, uint32_t w, uint32_t h)
lws_transcode_info::width
uint32_t width
Definition
lws-transcode.h:37
lws_transcode_info::bitrate
uint32_t bitrate
Definition
lws-transcode.h:40
lws_transcode_scaler_create
LWS_VISIBLE LWS_EXTERN void * lws_transcode_scaler_create(uint32_t src_w, uint32_t src_h, uint32_t dst_w, uint32_t dst_h)
lws_transcode_decode
LWS_VISIBLE LWS_EXTERN int lws_transcode_decode(struct lws_transcode_ctx *ctx, const uint8_t *buf, size_t len, void *frame)
lws_transcode_destroy
LWS_VISIBLE LWS_EXTERN void lws_transcode_destroy(struct lws_transcode_ctx **ctx)
lws_transcode_codec
lws_transcode_codec
Definition
lws-transcode.h:30
LWS_TCC_H264
@ LWS_TCC_H264
Definition
lws-transcode.h:31
LWS_TCC_AV1
@ LWS_TCC_AV1
Definition
lws-transcode.h:32
lws_transcode_yuyv_to_yuv420p
LWS_VISIBLE LWS_EXTERN void lws_transcode_yuyv_to_yuv420p(const uint8_t *yuyv, uint8_t *yuv, uint32_t w, uint32_t h)
lws_transcode_frame_get_width
LWS_VISIBLE LWS_EXTERN int lws_transcode_frame_get_width(void *frame)
lws_transcode_info::height
uint32_t height
Definition
lws-transcode.h:38
lws_transcode_frame_get_linesize
LWS_VISIBLE LWS_EXTERN int * lws_transcode_frame_get_linesize(void *frame)
lws_transcode_frame_get_height
LWS_VISIBLE LWS_EXTERN int lws_transcode_frame_get_height(void *frame)
lws_transcode_frame_import_yuv
LWS_VISIBLE LWS_EXTERN int lws_transcode_frame_import_yuv(void *frame, uint8_t *yuv_buf)
lws_transcode_encode
LWS_VISIBLE LWS_EXTERN int lws_transcode_encode(struct lws_transcode_ctx *ctx, void *frame, uint8_t **buf, size_t *len)
lws_transcode_frame_free
LWS_VISIBLE LWS_EXTERN void lws_transcode_frame_free(void **frame)
lws_transcode_scaler_destroy
LWS_VISIBLE LWS_EXTERN void lws_transcode_scaler_destroy(void **sws)
lws_transcode_decoder_create
LWS_VISIBLE LWS_EXTERN struct lws_transcode_ctx * lws_transcode_decoder_create(enum lws_transcode_codec codec)
lws_transcode_info::codec
enum lws_transcode_codec codec
Definition
lws-transcode.h:36
lws_transcode_scale
LWS_VISIBLE LWS_EXTERN int lws_transcode_scale(void *sws, void *src_frame, void *dst_frame)
lws_transcode_info::fps
uint32_t fps
Definition
lws-transcode.h:39
lws_transcode_frame_get_data
LWS_VISIBLE LWS_EXTERN uint8_t ** lws_transcode_frame_get_data(void *frame)
lws_transcode_frame_alloc
LWS_VISIBLE LWS_EXTERN void * lws_transcode_frame_alloc(uint32_t w, uint32_t h)
lws_transcode_encoder_create
LWS_VISIBLE LWS_EXTERN struct lws_transcode_ctx * lws_transcode_encoder_create(const struct lws_transcode_info *info)
lws_transcode_info
Definition
lws-transcode.h:35
include
libwebsockets
lws-transcode.h
Generated on
for libwebsockets by
1.18.0