libwebsockets
Lightweight C library for HTML5 websockets
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
28struct lws_transcode_ctx;
29
34
42
43LWS_VISIBLE LWS_EXTERN struct lws_transcode_ctx *
45
46LWS_VISIBLE LWS_EXTERN struct lws_transcode_ctx *
48
50lws_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
59
62
64lws_transcode_decode(struct lws_transcode_ctx *ctx, const uint8_t *buf, size_t len, void *frame);
65
67lws_transcode_encode(struct lws_transcode_ctx *ctx, void *frame, uint8_t **buf, size_t *len);
68
71
74
76lws_transcode_scale(void *sws, void *src_frame, void *dst_frame);
77
80
82lws_transcode_mjpeg_to_yuv420p(void *jpeg_dec, const uint8_t *mjpeg, size_t len, uint8_t *yuv, uint32_t w, uint32_t h);
83
86
89
92
95
98
99#endif
unsigned int uint32_t
#define LWS_EXTERN
unsigned char uint8_t
#define LWS_VISIBLE
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_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_VISIBLE LWS_EXTERN int lws_transcode_decode(struct lws_transcode_ctx *ctx, const uint8_t *buf, size_t len, void *frame)
LWS_VISIBLE LWS_EXTERN void lws_transcode_destroy(struct lws_transcode_ctx **ctx)
lws_transcode_codec
@ LWS_TCC_H264
@ LWS_TCC_AV1
LWS_VISIBLE LWS_EXTERN void lws_transcode_yuyv_to_yuv420p(const uint8_t *yuyv, uint8_t *yuv, uint32_t w, uint32_t h)
LWS_VISIBLE LWS_EXTERN int lws_transcode_frame_get_width(void *frame)
LWS_VISIBLE LWS_EXTERN int * lws_transcode_frame_get_linesize(void *frame)
LWS_VISIBLE LWS_EXTERN int lws_transcode_frame_get_height(void *frame)
LWS_VISIBLE LWS_EXTERN int lws_transcode_frame_import_yuv(void *frame, uint8_t *yuv_buf)
LWS_VISIBLE LWS_EXTERN int lws_transcode_encode(struct lws_transcode_ctx *ctx, void *frame, uint8_t **buf, size_t *len)
LWS_VISIBLE LWS_EXTERN void lws_transcode_frame_free(void **frame)
LWS_VISIBLE LWS_EXTERN void lws_transcode_scaler_destroy(void **sws)
LWS_VISIBLE LWS_EXTERN struct lws_transcode_ctx * lws_transcode_decoder_create(enum lws_transcode_codec codec)
enum lws_transcode_codec codec
LWS_VISIBLE LWS_EXTERN int lws_transcode_scale(void *sws, void *src_frame, void *dst_frame)
LWS_VISIBLE LWS_EXTERN uint8_t ** lws_transcode_frame_get_data(void *frame)
LWS_VISIBLE LWS_EXTERN void * lws_transcode_frame_alloc(uint32_t w, uint32_t h)
LWS_VISIBLE LWS_EXTERN struct lws_transcode_ctx * lws_transcode_encoder_create(const struct lws_transcode_info *info)