noobs 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COPYING +339 -0
- package/README.md +46 -0
- package/bin/64bit/obs.lib +0 -0
- package/binding.gyp +23 -0
- package/dist/bin/Qt6Core.dll +0 -0
- package/dist/bin/Qt6Gui.dll +0 -0
- package/dist/bin/Qt6Network.dll +0 -0
- package/dist/bin/Qt6Svg.dll +0 -0
- package/dist/bin/Qt6Widgets.dll +0 -0
- package/dist/bin/Qt6Xml.dll +0 -0
- package/dist/bin/avcodec-61.dll +0 -0
- package/dist/bin/avdevice-61.dll +0 -0
- package/dist/bin/avfilter-10.dll +0 -0
- package/dist/bin/avformat-61.dll +0 -0
- package/dist/bin/avutil-59.dll +0 -0
- package/dist/bin/datachannel.dll +0 -0
- package/dist/bin/libcurl.dll +0 -0
- package/dist/bin/libobs-d3d11.dll +0 -0
- package/dist/bin/libobs-opengl.dll +0 -0
- package/dist/bin/libobs-winrt.dll +0 -0
- package/dist/bin/librist.dll +0 -0
- package/dist/bin/libx264-164.dll +0 -0
- package/dist/bin/lua51.dll +0 -0
- package/dist/bin/obs-amf-test.exe +0 -0
- package/dist/bin/obs-ffmpeg-mux.exe +0 -0
- package/dist/bin/obs-frontend-api.dll +0 -0
- package/dist/bin/obs-scripting.dll +0 -0
- package/dist/bin/obs.dll +0 -0
- package/dist/bin/srt.dll +0 -0
- package/dist/bin/swresample-5.dll +0 -0
- package/dist/bin/swscale-8.dll +0 -0
- package/dist/bin/w32-pthreads.dll +0 -0
- package/dist/bin/zlib.dll +0 -0
- package/dist/effects/area.effect +250 -0
- package/dist/effects/bicubic_scale.effect +236 -0
- package/dist/effects/bilinear_lowres_scale.effect +123 -0
- package/dist/effects/color.effect +172 -0
- package/dist/effects/default.effect +254 -0
- package/dist/effects/default_rect.effect +84 -0
- package/dist/effects/deinterlace_base.effect +325 -0
- package/dist/effects/deinterlace_blend.effect +21 -0
- package/dist/effects/deinterlace_blend_2x.effect +21 -0
- package/dist/effects/deinterlace_discard.effect +21 -0
- package/dist/effects/deinterlace_discard_2x.effect +21 -0
- package/dist/effects/deinterlace_linear.effect +21 -0
- package/dist/effects/deinterlace_linear_2x.effect +21 -0
- package/dist/effects/deinterlace_yadif.effect +21 -0
- package/dist/effects/deinterlace_yadif_2x.effect +21 -0
- package/dist/effects/format_conversion.effect +1823 -0
- package/dist/effects/lanczos_scale.effect +292 -0
- package/dist/effects/opaque.effect +159 -0
- package/dist/effects/premultiplied_alpha.effect +38 -0
- package/dist/effects/repeat.effect +36 -0
- package/dist/effects/solid.effect +80 -0
- package/dist/noobs.node +0 -0
- package/dist/plugins/obs-ffmpeg.dll +0 -0
- package/dist/plugins/obs-x264.dll +0 -0
- package/dist/plugins/win-capture.dll +0 -0
- package/include/audio-monitoring/osx/mac-helpers.h +13 -0
- package/include/audio-monitoring/pulse/pulseaudio-wrapper.h +212 -0
- package/include/audio-monitoring/win32/wasapi-output.h +22 -0
- package/include/callback/calldata.h +195 -0
- package/include/callback/decl.h +61 -0
- package/include/callback/proc.h +52 -0
- package/include/callback/signal.h +73 -0
- package/include/graphics/axisang.h +65 -0
- package/include/graphics/bounds.h +108 -0
- package/include/graphics/device-exports.h +177 -0
- package/include/graphics/effect-parser.h +290 -0
- package/include/graphics/effect.h +190 -0
- package/include/graphics/graphics-internal.h +335 -0
- package/include/graphics/graphics.h +1024 -0
- package/include/graphics/half.h +100 -0
- package/include/graphics/image-file.h +124 -0
- package/include/graphics/input.h +34 -0
- package/include/graphics/libnsgif/libnsgif.h +142 -0
- package/include/graphics/math-defs.h +45 -0
- package/include/graphics/math-extra.h +61 -0
- package/include/graphics/matrix3.h +98 -0
- package/include/graphics/matrix4.h +102 -0
- package/include/graphics/plane.h +85 -0
- package/include/graphics/quat.h +170 -0
- package/include/graphics/shader-parser.h +273 -0
- package/include/graphics/srgb.h +177 -0
- package/include/graphics/vec2.h +148 -0
- package/include/graphics/vec3.h +224 -0
- package/include/graphics/vec4.h +241 -0
- package/include/media-io/audio-io.h +228 -0
- package/include/media-io/audio-math.h +43 -0
- package/include/media-io/audio-resampler.h +44 -0
- package/include/media-io/format-conversion.h +50 -0
- package/include/media-io/frame-rate.h +29 -0
- package/include/media-io/media-io-defs.h +20 -0
- package/include/media-io/media-remux.h +37 -0
- package/include/media-io/video-frame.h +64 -0
- package/include/media-io/video-io.h +338 -0
- package/include/media-io/video-scaler.h +43 -0
- package/include/obs-audio-controls.h +250 -0
- package/include/obs-av1.h +47 -0
- package/include/obs-avc.h +55 -0
- package/include/obs-config.h +52 -0
- package/include/obs-data.h +311 -0
- package/include/obs-defs.h +52 -0
- package/include/obs-encoder.h +361 -0
- package/include/obs-ffmpeg-compat.h +13 -0
- package/include/obs-hevc.h +81 -0
- package/include/obs-hotkey.h +271 -0
- package/include/obs-hotkeys.h +653 -0
- package/include/obs-interaction.h +56 -0
- package/include/obs-internal.h +1459 -0
- package/include/obs-missing-files.h +53 -0
- package/include/obs-module.h +181 -0
- package/include/obs-nal.h +37 -0
- package/include/obs-nix-platform.h +53 -0
- package/include/obs-nix-wayland.h +24 -0
- package/include/obs-nix-x11.h +22 -0
- package/include/obs-nix.h +42 -0
- package/include/obs-output.h +96 -0
- package/include/obs-properties.h +364 -0
- package/include/obs-scene.h +127 -0
- package/include/obs-service.h +115 -0
- package/include/obs-source.h +568 -0
- package/include/obs.h +2608 -0
- package/include/obsconfig.h +13 -0
- package/include/obsversion.h +5 -0
- package/include/util/apple/cfstring-utils.h +16 -0
- package/include/util/array-serializer.h +37 -0
- package/include/util/base.h +97 -0
- package/include/util/bitstream.h +28 -0
- package/include/util/bmem.h +94 -0
- package/include/util/buffered-file-serializer.h +32 -0
- package/include/util/c99defs.h +75 -0
- package/include/util/cf-lexer.h +199 -0
- package/include/util/cf-parser.h +281 -0
- package/include/util/circlebuf.h +319 -0
- package/include/util/config-file.h +103 -0
- package/include/util/crc32.h +29 -0
- package/include/util/curl/curl-helper.h +35 -0
- package/include/util/darray.h +606 -0
- package/include/util/deque.h +319 -0
- package/include/util/dstr.h +320 -0
- package/include/util/file-serializer.h +34 -0
- package/include/util/lexer.h +273 -0
- package/include/util/pipe.h +52 -0
- package/include/util/platform.h +223 -0
- package/include/util/profiler.h +97 -0
- package/include/util/serializer.h +158 -0
- package/include/util/simde/check.h +285 -0
- package/include/util/simde/debug-trap.h +117 -0
- package/include/util/simde/hedley.h +2123 -0
- package/include/util/simde/simde-align.h +481 -0
- package/include/util/simde/simde-arch.h +537 -0
- package/include/util/simde/simde-common.h +918 -0
- package/include/util/simde/simde-constify.h +925 -0
- package/include/util/simde/simde-detect-clang.h +114 -0
- package/include/util/simde/simde-diagnostic.h +447 -0
- package/include/util/simde/simde-features.h +550 -0
- package/include/util/simde/simde-math.h +1858 -0
- package/include/util/simde/x86/mmx.h +2456 -0
- package/include/util/simde/x86/sse.h +4479 -0
- package/include/util/simde/x86/sse2.h +7549 -0
- package/include/util/source-profiler.h +66 -0
- package/include/util/sse-intrin.h +32 -0
- package/include/util/task.h +22 -0
- package/include/util/text-lookup.h +45 -0
- package/include/util/threading-posix.h +77 -0
- package/include/util/threading-windows.h +142 -0
- package/include/util/threading.h +103 -0
- package/include/util/utf8.h +35 -0
- package/include/util/uthash.h +34 -0
- package/include/util/util_uint128.h +108 -0
- package/include/util/util_uint64.h +34 -0
- package/include/util/windows/device-enum.h +14 -0
- package/include/util/windows/obfuscate.h +16 -0
- package/include/util/windows/win-registry.h +37 -0
- package/include/util/windows/win-version.h +57 -0
- package/include/util/windows/window-helpers.h +47 -0
- package/index.d.ts +38 -0
- package/index.js +8 -0
- package/package.json +31 -0
- package/src/main.cpp +321 -0
- package/src/obs_interface.cpp +605 -0
- package/src/obs_interface.h +74 -0
- package/src/utils.cpp +80 -0
- package/src/utils.h +3 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (C) 2023 by Lain Bailey <lain@obsproject.com>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 2 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
******************************************************************************/
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
#include "math-defs.h"
|
|
21
|
+
#include "srgb.h"
|
|
22
|
+
|
|
23
|
+
#include "../util/sse-intrin.h"
|
|
24
|
+
|
|
25
|
+
#ifdef __cplusplus
|
|
26
|
+
extern "C" {
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
struct vec3;
|
|
30
|
+
struct matrix4;
|
|
31
|
+
|
|
32
|
+
struct vec4 {
|
|
33
|
+
union {
|
|
34
|
+
struct {
|
|
35
|
+
float x, y, z, w;
|
|
36
|
+
};
|
|
37
|
+
float ptr[4];
|
|
38
|
+
__m128 m;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
static inline void vec4_zero(struct vec4 *v)
|
|
43
|
+
{
|
|
44
|
+
v->m = _mm_setzero_ps();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static inline void vec4_set(struct vec4 *dst, float x, float y, float z, float w)
|
|
48
|
+
{
|
|
49
|
+
dst->m = _mm_set_ps(w, z, y, x);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static inline void vec4_copy(struct vec4 *dst, const struct vec4 *v)
|
|
53
|
+
{
|
|
54
|
+
dst->m = v->m;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
EXPORT void vec4_from_vec3(struct vec4 *dst, const struct vec3 *v);
|
|
58
|
+
|
|
59
|
+
static inline void vec4_add(struct vec4 *dst, const struct vec4 *v1, const struct vec4 *v2)
|
|
60
|
+
{
|
|
61
|
+
dst->m = _mm_add_ps(v1->m, v2->m);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static inline void vec4_sub(struct vec4 *dst, const struct vec4 *v1, const struct vec4 *v2)
|
|
65
|
+
{
|
|
66
|
+
dst->m = _mm_sub_ps(v1->m, v2->m);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static inline void vec4_mul(struct vec4 *dst, const struct vec4 *v1, const struct vec4 *v2)
|
|
70
|
+
{
|
|
71
|
+
dst->m = _mm_mul_ps(v1->m, v2->m);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static inline void vec4_div(struct vec4 *dst, const struct vec4 *v1, const struct vec4 *v2)
|
|
75
|
+
{
|
|
76
|
+
dst->m = _mm_div_ps(v1->m, v2->m);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static inline void vec4_addf(struct vec4 *dst, const struct vec4 *v, float f)
|
|
80
|
+
{
|
|
81
|
+
dst->m = _mm_add_ps(v->m, _mm_set1_ps(f));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static inline void vec4_subf(struct vec4 *dst, const struct vec4 *v, float f)
|
|
85
|
+
{
|
|
86
|
+
dst->m = _mm_sub_ps(v->m, _mm_set1_ps(f));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static inline void vec4_mulf(struct vec4 *dst, const struct vec4 *v, float f)
|
|
90
|
+
{
|
|
91
|
+
dst->m = _mm_mul_ps(v->m, _mm_set1_ps(f));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
static inline void vec4_divf(struct vec4 *dst, const struct vec4 *v, float f)
|
|
95
|
+
{
|
|
96
|
+
dst->m = _mm_div_ps(v->m, _mm_set1_ps(f));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static inline float vec4_dot(const struct vec4 *v1, const struct vec4 *v2)
|
|
100
|
+
{
|
|
101
|
+
struct vec4 add;
|
|
102
|
+
__m128 mul = _mm_mul_ps(v1->m, v2->m);
|
|
103
|
+
add.m = _mm_add_ps(_mm_movehl_ps(mul, mul), mul);
|
|
104
|
+
add.m = _mm_add_ps(_mm_shuffle_ps(add.m, add.m, 0x55), add.m);
|
|
105
|
+
return add.x;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
static inline void vec4_neg(struct vec4 *dst, const struct vec4 *v)
|
|
109
|
+
{
|
|
110
|
+
dst->x = -v->x;
|
|
111
|
+
dst->y = -v->y;
|
|
112
|
+
dst->z = -v->z;
|
|
113
|
+
dst->w = -v->w;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
static inline float vec4_len(const struct vec4 *v)
|
|
117
|
+
{
|
|
118
|
+
float dot_val = vec4_dot(v, v);
|
|
119
|
+
return (dot_val > 0.0f) ? sqrtf(dot_val) : 0.0f;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
static inline float vec4_dist(const struct vec4 *v1, const struct vec4 *v2)
|
|
123
|
+
{
|
|
124
|
+
struct vec4 temp;
|
|
125
|
+
float dot_val;
|
|
126
|
+
|
|
127
|
+
vec4_sub(&temp, v1, v2);
|
|
128
|
+
dot_val = vec4_dot(&temp, &temp);
|
|
129
|
+
return (dot_val > 0.0f) ? sqrtf(dot_val) : 0.0f;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static inline void vec4_norm(struct vec4 *dst, const struct vec4 *v)
|
|
133
|
+
{
|
|
134
|
+
float dot_val = vec4_dot(v, v);
|
|
135
|
+
dst->m = (dot_val > 0.0f) ? _mm_mul_ps(v->m, _mm_set1_ps(1.0f / sqrtf(dot_val))) : _mm_setzero_ps();
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
static inline int vec4_close(const struct vec4 *v1, const struct vec4 *v2, float epsilon)
|
|
139
|
+
{
|
|
140
|
+
struct vec4 test;
|
|
141
|
+
vec4_sub(&test, v1, v2);
|
|
142
|
+
return test.x < epsilon && test.y < epsilon && test.z < epsilon && test.w < epsilon;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
static inline void vec4_min(struct vec4 *dst, const struct vec4 *v1, const struct vec4 *v2)
|
|
146
|
+
{
|
|
147
|
+
dst->m = _mm_min_ps(v1->m, v2->m);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static inline void vec4_minf(struct vec4 *dst, const struct vec4 *v, float f)
|
|
151
|
+
{
|
|
152
|
+
dst->m = _mm_min_ps(v->m, _mm_set1_ps(f));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static inline void vec4_max(struct vec4 *dst, const struct vec4 *v1, const struct vec4 *v2)
|
|
156
|
+
{
|
|
157
|
+
dst->m = _mm_max_ps(v1->m, v2->m);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
static inline void vec4_maxf(struct vec4 *dst, const struct vec4 *v, float f)
|
|
161
|
+
{
|
|
162
|
+
dst->m = _mm_max_ps(v->m, _mm_set1_ps(f));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
static inline void vec4_abs(struct vec4 *dst, const struct vec4 *v)
|
|
166
|
+
{
|
|
167
|
+
dst->x = fabsf(v->x);
|
|
168
|
+
dst->y = fabsf(v->y);
|
|
169
|
+
dst->z = fabsf(v->z);
|
|
170
|
+
dst->w = fabsf(v->w);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
static inline void vec4_floor(struct vec4 *dst, const struct vec4 *v)
|
|
174
|
+
{
|
|
175
|
+
dst->x = floorf(v->x);
|
|
176
|
+
dst->y = floorf(v->y);
|
|
177
|
+
dst->z = floorf(v->z);
|
|
178
|
+
dst->w = floorf(v->w);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
static inline void vec4_ceil(struct vec4 *dst, const struct vec4 *v)
|
|
182
|
+
{
|
|
183
|
+
dst->x = ceilf(v->x);
|
|
184
|
+
dst->y = ceilf(v->y);
|
|
185
|
+
dst->z = ceilf(v->z);
|
|
186
|
+
dst->w = ceilf(v->w);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
static inline uint32_t vec4_to_rgba(const struct vec4 *src)
|
|
190
|
+
{
|
|
191
|
+
float f[4];
|
|
192
|
+
memcpy(f, src->ptr, sizeof(f));
|
|
193
|
+
uint8_t u[4];
|
|
194
|
+
gs_float4_to_u8x4(u, f);
|
|
195
|
+
uint32_t val;
|
|
196
|
+
memcpy(&val, u, sizeof(val));
|
|
197
|
+
return val;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
static inline uint32_t vec4_to_bgra(const struct vec4 *src)
|
|
201
|
+
{
|
|
202
|
+
float f[4];
|
|
203
|
+
memcpy(f, src->ptr, sizeof(f));
|
|
204
|
+
uint8_t u[4];
|
|
205
|
+
gs_float4_to_u8x4(u, f);
|
|
206
|
+
uint8_t temp = u[0];
|
|
207
|
+
u[0] = u[2];
|
|
208
|
+
u[2] = temp;
|
|
209
|
+
uint32_t val;
|
|
210
|
+
memcpy(&val, u, sizeof(val));
|
|
211
|
+
return val;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
static inline void vec4_from_rgba(struct vec4 *dst, uint32_t rgba)
|
|
215
|
+
{
|
|
216
|
+
uint8_t u[4];
|
|
217
|
+
memcpy(u, &rgba, sizeof(u));
|
|
218
|
+
gs_u8x4_to_float4(dst->ptr, u);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
static inline void vec4_from_bgra(struct vec4 *dst, uint32_t bgra)
|
|
222
|
+
{
|
|
223
|
+
uint8_t u[4];
|
|
224
|
+
memcpy(u, &bgra, sizeof(u));
|
|
225
|
+
uint8_t temp = u[0];
|
|
226
|
+
u[0] = u[2];
|
|
227
|
+
u[2] = temp;
|
|
228
|
+
gs_u8x4_to_float4(dst->ptr, u);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
static inline void vec4_from_rgba_srgb(struct vec4 *dst, uint32_t rgba)
|
|
232
|
+
{
|
|
233
|
+
vec4_from_rgba(dst, rgba);
|
|
234
|
+
gs_float3_srgb_nonlinear_to_linear(dst->ptr);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
EXPORT void vec4_transform(struct vec4 *dst, const struct vec4 *v, const struct matrix4 *m);
|
|
238
|
+
|
|
239
|
+
#ifdef __cplusplus
|
|
240
|
+
}
|
|
241
|
+
#endif
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (C) 2023 by Lain Bailey <lain@obsproject.com>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 2 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
******************************************************************************/
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
#include "media-io-defs.h"
|
|
21
|
+
#include "../util/c99defs.h"
|
|
22
|
+
#include "../util/util_uint64.h"
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#define MAX_AUDIO_MIXES 6
|
|
29
|
+
#define MAX_AUDIO_CHANNELS 8
|
|
30
|
+
#define MAX_DEVICE_INPUT_CHANNELS 64
|
|
31
|
+
#define AUDIO_OUTPUT_FRAMES 1024
|
|
32
|
+
|
|
33
|
+
#define TOTAL_AUDIO_SIZE (MAX_AUDIO_MIXES * MAX_AUDIO_CHANNELS * AUDIO_OUTPUT_FRAMES * sizeof(float))
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
* Base audio output component. Use this to create an audio output track
|
|
37
|
+
* for the media.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
struct audio_output;
|
|
41
|
+
typedef struct audio_output audio_t;
|
|
42
|
+
|
|
43
|
+
enum audio_format {
|
|
44
|
+
AUDIO_FORMAT_UNKNOWN,
|
|
45
|
+
|
|
46
|
+
AUDIO_FORMAT_U8BIT,
|
|
47
|
+
AUDIO_FORMAT_16BIT,
|
|
48
|
+
AUDIO_FORMAT_32BIT,
|
|
49
|
+
AUDIO_FORMAT_FLOAT,
|
|
50
|
+
|
|
51
|
+
AUDIO_FORMAT_U8BIT_PLANAR,
|
|
52
|
+
AUDIO_FORMAT_16BIT_PLANAR,
|
|
53
|
+
AUDIO_FORMAT_32BIT_PLANAR,
|
|
54
|
+
AUDIO_FORMAT_FLOAT_PLANAR,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The speaker layout describes where the speakers are located in the room.
|
|
59
|
+
* For OBS it dictates:
|
|
60
|
+
* * how many channels are available and
|
|
61
|
+
* * which channels are used for which speakers.
|
|
62
|
+
*
|
|
63
|
+
* Standard channel layouts where retrieved from ffmpeg documentation at:
|
|
64
|
+
* https://trac.ffmpeg.org/wiki/AudioChannelManipulation
|
|
65
|
+
*/
|
|
66
|
+
enum speaker_layout {
|
|
67
|
+
SPEAKERS_UNKNOWN, /**< Unknown setting, fallback is stereo. */
|
|
68
|
+
SPEAKERS_MONO, /**< Channels: MONO */
|
|
69
|
+
SPEAKERS_STEREO, /**< Channels: FL, FR */
|
|
70
|
+
SPEAKERS_2POINT1, /**< Channels: FL, FR, LFE */
|
|
71
|
+
SPEAKERS_4POINT0, /**< Channels: FL, FR, FC, RC */
|
|
72
|
+
SPEAKERS_4POINT1, /**< Channels: FL, FR, FC, LFE, RC */
|
|
73
|
+
SPEAKERS_5POINT1, /**< Channels: FL, FR, FC, LFE, RL, RR */
|
|
74
|
+
SPEAKERS_7POINT1 = 8, /**< Channels: FL, FR, FC, LFE, RL, RR, SL, SR */
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
struct audio_data {
|
|
78
|
+
uint8_t *data[MAX_AV_PLANES];
|
|
79
|
+
uint32_t frames;
|
|
80
|
+
uint64_t timestamp;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
struct audio_output_data {
|
|
84
|
+
float *data[MAX_AUDIO_CHANNELS];
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
typedef bool (*audio_input_callback_t)(void *param, uint64_t start_ts, uint64_t end_ts, uint64_t *new_ts,
|
|
88
|
+
uint32_t active_mixers, struct audio_output_data *mixes);
|
|
89
|
+
|
|
90
|
+
struct audio_output_info {
|
|
91
|
+
const char *name;
|
|
92
|
+
|
|
93
|
+
uint32_t samples_per_sec;
|
|
94
|
+
enum audio_format format;
|
|
95
|
+
enum speaker_layout speakers;
|
|
96
|
+
|
|
97
|
+
audio_input_callback_t input_callback;
|
|
98
|
+
void *input_param;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
struct audio_convert_info {
|
|
102
|
+
uint32_t samples_per_sec;
|
|
103
|
+
enum audio_format format;
|
|
104
|
+
enum speaker_layout speakers;
|
|
105
|
+
bool allow_clipping;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
static inline uint32_t get_audio_channels(enum speaker_layout speakers)
|
|
109
|
+
{
|
|
110
|
+
switch (speakers) {
|
|
111
|
+
case SPEAKERS_MONO:
|
|
112
|
+
return 1;
|
|
113
|
+
case SPEAKERS_STEREO:
|
|
114
|
+
return 2;
|
|
115
|
+
case SPEAKERS_2POINT1:
|
|
116
|
+
return 3;
|
|
117
|
+
case SPEAKERS_4POINT0:
|
|
118
|
+
return 4;
|
|
119
|
+
case SPEAKERS_4POINT1:
|
|
120
|
+
return 5;
|
|
121
|
+
case SPEAKERS_5POINT1:
|
|
122
|
+
return 6;
|
|
123
|
+
case SPEAKERS_7POINT1:
|
|
124
|
+
return 8;
|
|
125
|
+
case SPEAKERS_UNKNOWN:
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static inline size_t get_audio_bytes_per_channel(enum audio_format format)
|
|
133
|
+
{
|
|
134
|
+
switch (format) {
|
|
135
|
+
case AUDIO_FORMAT_U8BIT:
|
|
136
|
+
case AUDIO_FORMAT_U8BIT_PLANAR:
|
|
137
|
+
return 1;
|
|
138
|
+
|
|
139
|
+
case AUDIO_FORMAT_16BIT:
|
|
140
|
+
case AUDIO_FORMAT_16BIT_PLANAR:
|
|
141
|
+
return 2;
|
|
142
|
+
|
|
143
|
+
case AUDIO_FORMAT_FLOAT:
|
|
144
|
+
case AUDIO_FORMAT_FLOAT_PLANAR:
|
|
145
|
+
case AUDIO_FORMAT_32BIT:
|
|
146
|
+
case AUDIO_FORMAT_32BIT_PLANAR:
|
|
147
|
+
return 4;
|
|
148
|
+
|
|
149
|
+
case AUDIO_FORMAT_UNKNOWN:
|
|
150
|
+
return 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return 0;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static inline bool is_audio_planar(enum audio_format format)
|
|
157
|
+
{
|
|
158
|
+
switch (format) {
|
|
159
|
+
case AUDIO_FORMAT_U8BIT:
|
|
160
|
+
case AUDIO_FORMAT_16BIT:
|
|
161
|
+
case AUDIO_FORMAT_32BIT:
|
|
162
|
+
case AUDIO_FORMAT_FLOAT:
|
|
163
|
+
return false;
|
|
164
|
+
|
|
165
|
+
case AUDIO_FORMAT_U8BIT_PLANAR:
|
|
166
|
+
case AUDIO_FORMAT_FLOAT_PLANAR:
|
|
167
|
+
case AUDIO_FORMAT_16BIT_PLANAR:
|
|
168
|
+
case AUDIO_FORMAT_32BIT_PLANAR:
|
|
169
|
+
return true;
|
|
170
|
+
|
|
171
|
+
case AUDIO_FORMAT_UNKNOWN:
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
static inline size_t get_audio_planes(enum audio_format format, enum speaker_layout speakers)
|
|
179
|
+
{
|
|
180
|
+
return (is_audio_planar(format) ? get_audio_channels(speakers) : 1);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
static inline size_t get_audio_size(enum audio_format format, enum speaker_layout speakers, uint32_t frames)
|
|
184
|
+
{
|
|
185
|
+
bool planar = is_audio_planar(format);
|
|
186
|
+
|
|
187
|
+
return (planar ? 1 : get_audio_channels(speakers)) * get_audio_bytes_per_channel(format) * frames;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
static inline size_t get_total_audio_size(enum audio_format format, enum speaker_layout speakers, uint32_t frames)
|
|
191
|
+
{
|
|
192
|
+
return get_audio_channels(speakers) * get_audio_bytes_per_channel(format) * frames;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
static inline uint64_t audio_frames_to_ns(size_t sample_rate, uint64_t frames)
|
|
196
|
+
{
|
|
197
|
+
return util_mul_div64(frames, 1000000000ULL, sample_rate);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
static inline uint64_t ns_to_audio_frames(size_t sample_rate, uint64_t frames)
|
|
201
|
+
{
|
|
202
|
+
return util_mul_div64(frames, sample_rate, 1000000000ULL);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
#define AUDIO_OUTPUT_SUCCESS 0
|
|
206
|
+
#define AUDIO_OUTPUT_INVALIDPARAM -1
|
|
207
|
+
#define AUDIO_OUTPUT_FAIL -2
|
|
208
|
+
|
|
209
|
+
EXPORT int audio_output_open(audio_t **audio, struct audio_output_info *info);
|
|
210
|
+
EXPORT void audio_output_close(audio_t *audio);
|
|
211
|
+
|
|
212
|
+
typedef void (*audio_output_callback_t)(void *param, size_t mix_idx, struct audio_data *data);
|
|
213
|
+
|
|
214
|
+
EXPORT bool audio_output_connect(audio_t *video, size_t mix_idx, const struct audio_convert_info *conversion,
|
|
215
|
+
audio_output_callback_t callback, void *param);
|
|
216
|
+
EXPORT void audio_output_disconnect(audio_t *video, size_t mix_idx, audio_output_callback_t callback, void *param);
|
|
217
|
+
|
|
218
|
+
EXPORT bool audio_output_active(const audio_t *audio);
|
|
219
|
+
|
|
220
|
+
EXPORT size_t audio_output_get_block_size(const audio_t *audio);
|
|
221
|
+
EXPORT size_t audio_output_get_planes(const audio_t *audio);
|
|
222
|
+
EXPORT size_t audio_output_get_channels(const audio_t *audio);
|
|
223
|
+
EXPORT uint32_t audio_output_get_sample_rate(const audio_t *audio);
|
|
224
|
+
EXPORT const struct audio_output_info *audio_output_get_info(const audio_t *audio);
|
|
225
|
+
|
|
226
|
+
#ifdef __cplusplus
|
|
227
|
+
}
|
|
228
|
+
#endif
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (C) 2023 by Lain Bailey <lain@obsproject.com>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 2 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
******************************************************************************/
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
#include "../util/c99defs.h"
|
|
21
|
+
#include <math.h>
|
|
22
|
+
|
|
23
|
+
#ifdef _MSC_VER
|
|
24
|
+
#include <float.h>
|
|
25
|
+
|
|
26
|
+
#pragma warning(push)
|
|
27
|
+
#pragma warning(disable : 4056)
|
|
28
|
+
#pragma warning(disable : 4756)
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
static inline float mul_to_db(const float mul)
|
|
32
|
+
{
|
|
33
|
+
return (mul == 0.0f) ? -INFINITY : (20.0f * log10f(mul));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static inline float db_to_mul(const float db)
|
|
37
|
+
{
|
|
38
|
+
return isfinite((double)db) ? powf(10.0f, db / 20.0f) : 0.0f;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#ifdef _MSC_VER
|
|
42
|
+
#pragma warning(pop)
|
|
43
|
+
#endif
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (C) 2023 by Lain Bailey <lain@obsproject.com>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 2 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
******************************************************************************/
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
#include "../util/c99defs.h"
|
|
21
|
+
#include "audio-io.h"
|
|
22
|
+
|
|
23
|
+
#ifdef __cplusplus
|
|
24
|
+
extern "C" {
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
struct audio_resampler;
|
|
28
|
+
typedef struct audio_resampler audio_resampler_t;
|
|
29
|
+
|
|
30
|
+
struct resample_info {
|
|
31
|
+
uint32_t samples_per_sec;
|
|
32
|
+
enum audio_format format;
|
|
33
|
+
enum speaker_layout speakers;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
EXPORT audio_resampler_t *audio_resampler_create(const struct resample_info *dst, const struct resample_info *src);
|
|
37
|
+
EXPORT void audio_resampler_destroy(audio_resampler_t *resampler);
|
|
38
|
+
|
|
39
|
+
EXPORT bool audio_resampler_resample(audio_resampler_t *resampler, uint8_t *output[], uint32_t *out_frames,
|
|
40
|
+
uint64_t *ts_offset, const uint8_t *const input[], uint32_t in_frames);
|
|
41
|
+
|
|
42
|
+
#ifdef __cplusplus
|
|
43
|
+
}
|
|
44
|
+
#endif
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (C) 2023 by Lain Bailey <lain@obsproject.com>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 2 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
******************************************************************************/
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
#include "../util/c99defs.h"
|
|
21
|
+
|
|
22
|
+
#ifdef __cplusplus
|
|
23
|
+
extern "C" {
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* Functions for converting to and from packed 444 YUV
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
EXPORT void compress_uyvx_to_i420(const uint8_t *input, uint32_t in_linesize, uint32_t start_y, uint32_t end_y,
|
|
31
|
+
uint8_t *output[], const uint32_t out_linesize[]);
|
|
32
|
+
|
|
33
|
+
EXPORT void compress_uyvx_to_nv12(const uint8_t *input, uint32_t in_linesize, uint32_t start_y, uint32_t end_y,
|
|
34
|
+
uint8_t *output[], const uint32_t out_linesize[]);
|
|
35
|
+
|
|
36
|
+
EXPORT void convert_uyvx_to_i444(const uint8_t *input, uint32_t in_linesize, uint32_t start_y, uint32_t end_y,
|
|
37
|
+
uint8_t *output[], const uint32_t out_linesize[]);
|
|
38
|
+
|
|
39
|
+
EXPORT void decompress_nv12(const uint8_t *const input[], const uint32_t in_linesize[], uint32_t start_y,
|
|
40
|
+
uint32_t end_y, uint8_t *output, uint32_t out_linesize);
|
|
41
|
+
|
|
42
|
+
EXPORT void decompress_420(const uint8_t *const input[], const uint32_t in_linesize[], uint32_t start_y, uint32_t end_y,
|
|
43
|
+
uint8_t *output, uint32_t out_linesize);
|
|
44
|
+
|
|
45
|
+
EXPORT void decompress_422(const uint8_t *input, uint32_t in_linesize, uint32_t start_y, uint32_t end_y,
|
|
46
|
+
uint8_t *output, uint32_t out_linesize, bool leading_lum);
|
|
47
|
+
|
|
48
|
+
#ifdef __cplusplus
|
|
49
|
+
}
|
|
50
|
+
#endif
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#ifdef __cplusplus
|
|
4
|
+
extern "C" {
|
|
5
|
+
#endif
|
|
6
|
+
|
|
7
|
+
struct media_frames_per_second {
|
|
8
|
+
uint32_t numerator;
|
|
9
|
+
uint32_t denominator;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
static inline double media_frames_per_second_to_frame_interval(struct media_frames_per_second fps)
|
|
13
|
+
{
|
|
14
|
+
return (double)fps.denominator / fps.numerator;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static inline double media_frames_per_second_to_fps(struct media_frames_per_second fps)
|
|
18
|
+
{
|
|
19
|
+
return (double)fps.numerator / fps.denominator;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static inline bool media_frames_per_second_is_valid(struct media_frames_per_second fps)
|
|
23
|
+
{
|
|
24
|
+
return fps.numerator && fps.denominator;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#ifdef __cplusplus
|
|
28
|
+
}
|
|
29
|
+
#endif
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (C) 2023 by Lain Bailey <lain@obsproject.com>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 2 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
******************************************************************************/
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
#define MAX_AV_PLANES 8
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (C) 2014 by Ruwen Hahn <palana@stunned.de>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 2 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
******************************************************************************/
|
|
17
|
+
|
|
18
|
+
#include "../util/c99defs.h"
|
|
19
|
+
|
|
20
|
+
#pragma once
|
|
21
|
+
|
|
22
|
+
struct media_remux_job;
|
|
23
|
+
typedef struct media_remux_job *media_remux_job_t;
|
|
24
|
+
|
|
25
|
+
typedef bool(media_remux_progress_callback)(void *data, float percent);
|
|
26
|
+
|
|
27
|
+
#ifdef __cplusplus
|
|
28
|
+
extern "C" {
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
EXPORT bool media_remux_job_create(media_remux_job_t *job, const char *in_filename, const char *out_filename);
|
|
32
|
+
EXPORT bool media_remux_job_process(media_remux_job_t job, media_remux_progress_callback callback, void *data);
|
|
33
|
+
EXPORT void media_remux_job_destroy(media_remux_job_t job);
|
|
34
|
+
|
|
35
|
+
#ifdef __cplusplus
|
|
36
|
+
}
|
|
37
|
+
#endif
|