libwebsockets
Lightweight C library for HTML5 websockets
Toggle main menu visibility
class="ui-resizable-handle">
Loading...
Searching...
No Matches
lws-alsa.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_ALSA_H__
26
#define __LWS_ALSA_H__
27
28
struct
lws_alsa_ctx;
29
30
struct
lws_alsa_info
{
31
const
char
*
device_name
;
/* e.g. "default" */
32
uint32_t
rate
;
33
uint32_t
channels
;
34
uint32_t
samples_per_frame
;
35
};
36
37
struct
lws_alsa_control
{
38
uint32_t
id
;
39
char
name
[64];
40
long
min
;
41
long
max
;
42
long
step
;
43
long
val
;
44
};
45
46
typedef
int (*
lws_alsa_control_cb
)(
void
*user,
const
struct
lws_alsa_control
*c);
47
48
LWS_VISIBLE
LWS_EXTERN
struct
lws_alsa_ctx *
49
lws_alsa_create_capture
(
const
struct
lws_alsa_info
*info);
50
51
LWS_VISIBLE
LWS_EXTERN
void
52
lws_alsa_destroy
(
struct
lws_alsa_ctx **ctx);
53
54
LWS_VISIBLE
LWS_EXTERN
int
55
lws_alsa_get_fd
(
struct
lws_alsa_ctx *ctx);
56
57
LWS_VISIBLE
LWS_EXTERN
int
58
lws_alsa_read
(
struct
lws_alsa_ctx *ctx,
void
*buf,
size_t
samples);
59
60
LWS_VISIBLE
LWS_EXTERN
int
61
lws_alsa_enum_controls
(
struct
lws_alsa_ctx *ctx,
lws_alsa_control_cb
cb,
void
*user);
62
63
LWS_VISIBLE
LWS_EXTERN
int
64
lws_alsa_set_control
(
struct
lws_alsa_ctx *ctx,
uint32_t
id
,
long
val);
65
66
#if defined(LWS_WITH_OPUS)
67
68
struct
lws_alsa_opus_capture;
69
70
typedef
void (*lws_alsa_opus_encoded_cb_t)(
void
*user_data,
const
uint8_t
*payload,
size_t
len);
71
72
LWS_VISIBLE
LWS_EXTERN
struct
lws_alsa_opus_capture *
73
lws_alsa_opus_capture_create(
const
struct
lws_alsa_info
*info, lws_alsa_opus_encoded_cb_t cb,
void
*user_data);
74
75
LWS_VISIBLE
LWS_EXTERN
void
76
lws_alsa_opus_capture_destroy(
struct
lws_alsa_opus_capture **cap);
77
78
LWS_VISIBLE
LWS_EXTERN
int
79
lws_alsa_opus_get_fd(
struct
lws_alsa_opus_capture *cap);
80
81
LWS_VISIBLE
LWS_EXTERN
int
82
lws_alsa_opus_read(
struct
lws_alsa_opus_capture *cap);
83
84
LWS_VISIBLE
LWS_EXTERN
int
85
lws_alsa_opus_send_capabilities(
struct
lws_alsa_opus_capture *cap,
char
*buf,
size_t
max_len);
86
87
LWS_VISIBLE
LWS_EXTERN
int
88
lws_alsa_opus_set_control(
struct
lws_alsa_opus_capture *cap,
uint32_t
id
,
long
val);
89
90
#endif
91
92
#endif
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_alsa_info::rate
uint32_t rate
Definition
lws-alsa.h:32
lws_alsa_read
LWS_VISIBLE LWS_EXTERN int lws_alsa_read(struct lws_alsa_ctx *ctx, void *buf, size_t samples)
lws_alsa_set_control
LWS_VISIBLE LWS_EXTERN int lws_alsa_set_control(struct lws_alsa_ctx *ctx, uint32_t id, long val)
lws_alsa_enum_controls
LWS_VISIBLE LWS_EXTERN int lws_alsa_enum_controls(struct lws_alsa_ctx *ctx, lws_alsa_control_cb cb, void *user)
lws_alsa_control::name
char name[64]
Definition
lws-alsa.h:39
lws_alsa_info::samples_per_frame
uint32_t samples_per_frame
Definition
lws-alsa.h:34
lws_alsa_info::device_name
const char * device_name
Definition
lws-alsa.h:31
lws_alsa_control::min
long min
Definition
lws-alsa.h:40
lws_alsa_destroy
LWS_VISIBLE LWS_EXTERN void lws_alsa_destroy(struct lws_alsa_ctx **ctx)
lws_alsa_control::val
long val
Definition
lws-alsa.h:43
lws_alsa_control::id
uint32_t id
Definition
lws-alsa.h:38
lws_alsa_get_fd
LWS_VISIBLE LWS_EXTERN int lws_alsa_get_fd(struct lws_alsa_ctx *ctx)
lws_alsa_control_cb
int(* lws_alsa_control_cb)(void *user, const struct lws_alsa_control *c)
Definition
lws-alsa.h:46
lws_alsa_info::channels
uint32_t channels
Definition
lws-alsa.h:33
lws_alsa_create_capture
LWS_VISIBLE LWS_EXTERN struct lws_alsa_ctx * lws_alsa_create_capture(const struct lws_alsa_info *info)
lws_alsa_control::max
long max
Definition
lws-alsa.h:41
lws_alsa_control::step
long step
Definition
lws-alsa.h:42
lws_alsa_control
Definition
lws-alsa.h:37
lws_alsa_info
Definition
lws-alsa.h:30
include
libwebsockets
lws-alsa.h
Generated on
for libwebsockets by
1.18.0