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,212 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2014 by Leonhard Oelke <leonhard@in-verted.de>
|
|
3
|
+
Copyright (C) 2017 by Fabio Madia <admshao@gmail.com>
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify
|
|
6
|
+
it under the terms of the GNU General Public License as published by
|
|
7
|
+
the Free Software Foundation, either version 2 of the License, or
|
|
8
|
+
(at your option) any later version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful,
|
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License
|
|
16
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
#include <inttypes.h>
|
|
20
|
+
#include <pulse/stream.h>
|
|
21
|
+
#include <pulse/context.h>
|
|
22
|
+
#include <pulse/introspect.h>
|
|
23
|
+
|
|
24
|
+
#pragma once
|
|
25
|
+
|
|
26
|
+
struct pulseaudio_default_output {
|
|
27
|
+
char *default_sink_name;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
struct enum_cb {
|
|
31
|
+
obs_enum_audio_device_cb cb;
|
|
32
|
+
void *data;
|
|
33
|
+
int cont;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
void get_default_id(char **id);
|
|
37
|
+
|
|
38
|
+
bool devices_match(const char *id1, const char *id2);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Initialize the pulseaudio mainloop and increase the reference count
|
|
42
|
+
*/
|
|
43
|
+
int_fast32_t pulseaudio_init();
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Unreference the pulseaudio mainloop, when the reference count reaches
|
|
47
|
+
* zero the mainloop will automatically be destroyed
|
|
48
|
+
*/
|
|
49
|
+
void pulseaudio_unref();
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Lock the mainloop
|
|
53
|
+
*
|
|
54
|
+
* In order to allow for multiple threads to use the same mainloop pulseaudio
|
|
55
|
+
* provides it's own locking mechanism. This function should be called before
|
|
56
|
+
* using any pulseaudio function that is in any way related to the mainloop or
|
|
57
|
+
* context.
|
|
58
|
+
*
|
|
59
|
+
* @note use of this function may cause deadlocks
|
|
60
|
+
*
|
|
61
|
+
* @warning do not use with pulseaudio_ wrapper functions
|
|
62
|
+
*/
|
|
63
|
+
void pulseaudio_lock();
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Unlock the mainloop
|
|
67
|
+
*
|
|
68
|
+
* @see pulseaudio_lock()
|
|
69
|
+
*/
|
|
70
|
+
void pulseaudio_unlock();
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Wait for events to happen
|
|
74
|
+
*
|
|
75
|
+
* This function should be called when waiting for an event to happen.
|
|
76
|
+
*/
|
|
77
|
+
void pulseaudio_wait();
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Wait for accept signal from calling thread
|
|
81
|
+
*
|
|
82
|
+
* This function tells the pulseaudio mainloop whether the data provided to
|
|
83
|
+
* the callback should be retained until the calling thread executes
|
|
84
|
+
* pulseaudio_accept()
|
|
85
|
+
*
|
|
86
|
+
* If wait_for_accept is 0 the function returns and the data is freed.
|
|
87
|
+
*/
|
|
88
|
+
void pulseaudio_signal(int wait_for_accept);
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Signal the waiting callback to return
|
|
92
|
+
*
|
|
93
|
+
* This function is used in conjunction with pulseaudio_signal()
|
|
94
|
+
*/
|
|
95
|
+
void pulseaudio_accept();
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Request source information
|
|
99
|
+
*
|
|
100
|
+
* The function will block until the operation was executed and the mainloop
|
|
101
|
+
* called the provided callback function.
|
|
102
|
+
*
|
|
103
|
+
* @return negative on error
|
|
104
|
+
*
|
|
105
|
+
* @note The function will block until the server context is ready.
|
|
106
|
+
*
|
|
107
|
+
* @warning call without active locks
|
|
108
|
+
*/
|
|
109
|
+
int_fast32_t pulseaudio_get_source_info_list(pa_source_info_cb_t cb, void *userdata);
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Request source information from a specific source
|
|
113
|
+
*
|
|
114
|
+
* The function will block until the operation was executed and the mainloop
|
|
115
|
+
* called the provided callback function.
|
|
116
|
+
*
|
|
117
|
+
* @param cb pointer to the callback function
|
|
118
|
+
* @param name the source name to get information for
|
|
119
|
+
* @param userdata pointer to userdata the callback will be called with
|
|
120
|
+
*
|
|
121
|
+
* @return negative on error
|
|
122
|
+
*
|
|
123
|
+
* @note The function will block until the server context is ready.
|
|
124
|
+
*
|
|
125
|
+
* @warning call without active locks
|
|
126
|
+
*/
|
|
127
|
+
int_fast32_t pulseaudio_get_source_info(pa_source_info_cb_t cb, const char *name, void *userdata);
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Request sink information
|
|
131
|
+
*
|
|
132
|
+
* The function will block until the operation was executed and the mainloop
|
|
133
|
+
* called the provided callback function.
|
|
134
|
+
*
|
|
135
|
+
* @return negative on error
|
|
136
|
+
*
|
|
137
|
+
* @note The function will block until the server context is ready.
|
|
138
|
+
*
|
|
139
|
+
* @warning call without active locks
|
|
140
|
+
*/
|
|
141
|
+
int_fast32_t pulseaudio_get_sink_info_list(pa_sink_info_cb_t cb, void *userdata);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Request sink information from a specific sink
|
|
145
|
+
*
|
|
146
|
+
* The function will block until the operation was executed and the mainloop
|
|
147
|
+
* called the provided callback function.
|
|
148
|
+
*
|
|
149
|
+
* @param cb pointer to the callback function
|
|
150
|
+
* @param name the sink name to get information for
|
|
151
|
+
* @param userdata pointer to userdata the callback will be called with
|
|
152
|
+
*
|
|
153
|
+
* @return negative on error
|
|
154
|
+
*
|
|
155
|
+
* @note The function will block until the server context is ready.
|
|
156
|
+
*
|
|
157
|
+
* @warning call without active locks
|
|
158
|
+
*/
|
|
159
|
+
int_fast32_t pulseaudio_get_sink_info(pa_sink_info_cb_t cb, const char *name, void *userdata);
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Request server information
|
|
163
|
+
*
|
|
164
|
+
* The function will block until the operation was executed and the mainloop
|
|
165
|
+
* called the provided callback function.
|
|
166
|
+
*
|
|
167
|
+
* @return negative on error
|
|
168
|
+
*
|
|
169
|
+
* @note The function will block until the server context is ready.
|
|
170
|
+
*
|
|
171
|
+
* @warning call without active locks
|
|
172
|
+
*/
|
|
173
|
+
int_fast32_t pulseaudio_get_server_info(pa_server_info_cb_t cb, void *userdata);
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Create a new stream with the default properties
|
|
177
|
+
*
|
|
178
|
+
* @note The function will block until the server context is ready.
|
|
179
|
+
*
|
|
180
|
+
* @warning call without active locks
|
|
181
|
+
*/
|
|
182
|
+
pa_stream *pulseaudio_stream_new(const char *name, const pa_sample_spec *ss, const pa_channel_map *map);
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Connect to a pulseaudio playback stream
|
|
186
|
+
*
|
|
187
|
+
* @param s pa_stream to connect to. NULL for default
|
|
188
|
+
* @param attr pa_buffer_attr
|
|
189
|
+
* @param name Device name. NULL for default device
|
|
190
|
+
* @param flags pa_stream_flags_t
|
|
191
|
+
* @return negative on error
|
|
192
|
+
*/
|
|
193
|
+
int_fast32_t pulseaudio_connect_playback(pa_stream *s, const char *name, const pa_buffer_attr *attr,
|
|
194
|
+
pa_stream_flags_t flags);
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Sets a callback function for when data can be written to the stream
|
|
198
|
+
*
|
|
199
|
+
* @param p pa_stream to connect to. NULL for default
|
|
200
|
+
* @param cb pa_stream_request_cb_t
|
|
201
|
+
* @param userdata pointer to userdata the callback will be called with
|
|
202
|
+
*/
|
|
203
|
+
void pulseaudio_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata);
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Sets a callback function for when an underflow happen
|
|
207
|
+
*
|
|
208
|
+
* @param p pa_stream to connect to. NULL for default
|
|
209
|
+
* @param cb pa_stream_notify_cb_t
|
|
210
|
+
* @param userdata pointer to userdata the callback will be called with
|
|
211
|
+
*/
|
|
212
|
+
void pulseaudio_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <windows.h>
|
|
4
|
+
#include <mmdeviceapi.h>
|
|
5
|
+
#include <audioclient.h>
|
|
6
|
+
|
|
7
|
+
#ifndef KSAUDIO_SPEAKER_2POINT1
|
|
8
|
+
#define KSAUDIO_SPEAKER_2POINT1 (KSAUDIO_SPEAKER_STEREO | SPEAKER_LOW_FREQUENCY)
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
#define KSAUDIO_SPEAKER_SURROUND_AVUTIL (KSAUDIO_SPEAKER_STEREO | SPEAKER_FRONT_CENTER)
|
|
12
|
+
|
|
13
|
+
#ifndef KSAUDIO_SPEAKER_4POINT1
|
|
14
|
+
#define KSAUDIO_SPEAKER_4POINT1 (KSAUDIO_SPEAKER_SURROUND | SPEAKER_LOW_FREQUENCY)
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#define safe_release(ptr) \
|
|
18
|
+
do { \
|
|
19
|
+
if (ptr) { \
|
|
20
|
+
ptr->lpVtbl->Release(ptr); \
|
|
21
|
+
} \
|
|
22
|
+
} while (false)
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023 Lain Bailey <lain@obsproject.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission to use, copy, modify, and distribute this software for any
|
|
5
|
+
* purpose with or without fee is hereby granted, provided that the above
|
|
6
|
+
* copyright notice and this permission notice appear in all copies.
|
|
7
|
+
*
|
|
8
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#pragma once
|
|
18
|
+
|
|
19
|
+
#include <string.h>
|
|
20
|
+
#include "../util/c99defs.h"
|
|
21
|
+
#include "../util/bmem.h"
|
|
22
|
+
|
|
23
|
+
#ifdef __cplusplus
|
|
24
|
+
extern "C" {
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
* Procedure call data structure
|
|
29
|
+
*
|
|
30
|
+
* This is used to store parameters (and return value) sent to/from signals,
|
|
31
|
+
* procedures, and callbacks.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
enum call_param_type {
|
|
35
|
+
CALL_PARAM_TYPE_VOID,
|
|
36
|
+
CALL_PARAM_TYPE_INT,
|
|
37
|
+
CALL_PARAM_TYPE_FLOAT,
|
|
38
|
+
CALL_PARAM_TYPE_BOOL,
|
|
39
|
+
CALL_PARAM_TYPE_PTR,
|
|
40
|
+
CALL_PARAM_TYPE_STRING
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
#define CALL_PARAM_IN (1 << 0)
|
|
44
|
+
#define CALL_PARAM_OUT (1 << 1)
|
|
45
|
+
|
|
46
|
+
struct calldata {
|
|
47
|
+
uint8_t *stack;
|
|
48
|
+
size_t size; /* size of the stack, in bytes */
|
|
49
|
+
size_t capacity; /* capacity of the stack, in bytes */
|
|
50
|
+
bool fixed; /* fixed size (using call stack) */
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
typedef struct calldata calldata_t;
|
|
54
|
+
|
|
55
|
+
static inline void calldata_init(struct calldata *data)
|
|
56
|
+
{
|
|
57
|
+
memset(data, 0, sizeof(struct calldata));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static inline void calldata_clear(struct calldata *data);
|
|
61
|
+
|
|
62
|
+
static inline void calldata_init_fixed(struct calldata *data, uint8_t *stack, size_t size)
|
|
63
|
+
{
|
|
64
|
+
data->stack = stack;
|
|
65
|
+
data->capacity = size;
|
|
66
|
+
data->fixed = true;
|
|
67
|
+
data->size = 0;
|
|
68
|
+
calldata_clear(data);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static inline void calldata_free(struct calldata *data)
|
|
72
|
+
{
|
|
73
|
+
if (!data->fixed)
|
|
74
|
+
bfree(data->stack);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
EXPORT bool calldata_get_data(const calldata_t *data, const char *name, void *out, size_t size);
|
|
78
|
+
EXPORT void calldata_set_data(calldata_t *data, const char *name, const void *in, size_t new_size);
|
|
79
|
+
|
|
80
|
+
static inline void calldata_clear(struct calldata *data)
|
|
81
|
+
{
|
|
82
|
+
if (data->stack) {
|
|
83
|
+
data->size = sizeof(size_t);
|
|
84
|
+
memset(data->stack, 0, sizeof(size_t));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
static inline calldata_t *calldata_create(void)
|
|
89
|
+
{
|
|
90
|
+
return (calldata_t *)bzalloc(sizeof(struct calldata));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
static inline void calldata_destroy(calldata_t *cd)
|
|
94
|
+
{
|
|
95
|
+
calldata_free(cd);
|
|
96
|
+
bfree(cd);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* ------------------------------------------------------------------------- */
|
|
100
|
+
/* NOTE: 'get' functions return true only if parameter exists, and is the
|
|
101
|
+
* same type. They return false otherwise. */
|
|
102
|
+
|
|
103
|
+
static inline bool calldata_get_int(const calldata_t *data, const char *name, long long *val)
|
|
104
|
+
{
|
|
105
|
+
return calldata_get_data(data, name, val, sizeof(*val));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
static inline bool calldata_get_float(const calldata_t *data, const char *name, double *val)
|
|
109
|
+
{
|
|
110
|
+
return calldata_get_data(data, name, val, sizeof(*val));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
static inline bool calldata_get_bool(const calldata_t *data, const char *name, bool *val)
|
|
114
|
+
{
|
|
115
|
+
return calldata_get_data(data, name, val, sizeof(*val));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
static inline bool calldata_get_ptr(const calldata_t *data, const char *name, void *p_ptr)
|
|
119
|
+
{
|
|
120
|
+
return calldata_get_data(data, name, p_ptr, sizeof(p_ptr));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
EXPORT bool calldata_get_string(const calldata_t *data, const char *name, const char **str);
|
|
124
|
+
|
|
125
|
+
/* ------------------------------------------------------------------------- */
|
|
126
|
+
/* call if you know your data is valid */
|
|
127
|
+
|
|
128
|
+
static inline long long calldata_int(const calldata_t *data, const char *name)
|
|
129
|
+
{
|
|
130
|
+
long long val = 0;
|
|
131
|
+
calldata_get_int(data, name, &val);
|
|
132
|
+
return val;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
static inline double calldata_float(const calldata_t *data, const char *name)
|
|
136
|
+
{
|
|
137
|
+
double val = 0.0;
|
|
138
|
+
calldata_get_float(data, name, &val);
|
|
139
|
+
return val;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
static inline bool calldata_bool(const calldata_t *data, const char *name)
|
|
143
|
+
{
|
|
144
|
+
bool val = false;
|
|
145
|
+
calldata_get_bool(data, name, &val);
|
|
146
|
+
return val;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
static inline void *calldata_ptr(const calldata_t *data, const char *name)
|
|
150
|
+
{
|
|
151
|
+
void *val = NULL;
|
|
152
|
+
calldata_get_ptr(data, name, &val);
|
|
153
|
+
return val;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static inline const char *calldata_string(const calldata_t *data, const char *name)
|
|
157
|
+
{
|
|
158
|
+
const char *val = NULL;
|
|
159
|
+
calldata_get_string(data, name, &val);
|
|
160
|
+
return val;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/* ------------------------------------------------------------------------- */
|
|
164
|
+
|
|
165
|
+
static inline void calldata_set_int(calldata_t *data, const char *name, long long val)
|
|
166
|
+
{
|
|
167
|
+
calldata_set_data(data, name, &val, sizeof(val));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static inline void calldata_set_float(calldata_t *data, const char *name, double val)
|
|
171
|
+
{
|
|
172
|
+
calldata_set_data(data, name, &val, sizeof(val));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
static inline void calldata_set_bool(calldata_t *data, const char *name, bool val)
|
|
176
|
+
{
|
|
177
|
+
calldata_set_data(data, name, &val, sizeof(val));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
static inline void calldata_set_ptr(calldata_t *data, const char *name, void *ptr)
|
|
181
|
+
{
|
|
182
|
+
calldata_set_data(data, name, &ptr, sizeof(ptr));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
static inline void calldata_set_string(calldata_t *data, const char *name, const char *str)
|
|
186
|
+
{
|
|
187
|
+
if (str)
|
|
188
|
+
calldata_set_data(data, name, str, strlen(str) + 1);
|
|
189
|
+
else
|
|
190
|
+
calldata_set_data(data, name, NULL, 0);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
#ifdef __cplusplus
|
|
194
|
+
}
|
|
195
|
+
#endif
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023 Lain Bailey <lain@obsproject.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission to use, copy, modify, and distribute this software for any
|
|
5
|
+
* purpose with or without fee is hereby granted, provided that the above
|
|
6
|
+
* copyright notice and this permission notice appear in all copies.
|
|
7
|
+
*
|
|
8
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#pragma once
|
|
18
|
+
|
|
19
|
+
#include "calldata.h"
|
|
20
|
+
#include "../util/darray.h"
|
|
21
|
+
|
|
22
|
+
#ifdef __cplusplus
|
|
23
|
+
extern "C" {
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
struct decl_param {
|
|
27
|
+
char *name;
|
|
28
|
+
enum call_param_type type;
|
|
29
|
+
uint32_t flags;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
static inline void decl_param_free(struct decl_param *param)
|
|
33
|
+
{
|
|
34
|
+
if (param->name)
|
|
35
|
+
bfree(param->name);
|
|
36
|
+
memset(param, 0, sizeof(struct decl_param));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
struct decl_info {
|
|
40
|
+
char *name;
|
|
41
|
+
const char *decl_string;
|
|
42
|
+
DARRAY(struct decl_param) params;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
static inline void decl_info_free(struct decl_info *decl)
|
|
46
|
+
{
|
|
47
|
+
if (decl) {
|
|
48
|
+
for (size_t i = 0; i < decl->params.num; i++)
|
|
49
|
+
decl_param_free(decl->params.array + i);
|
|
50
|
+
da_free(decl->params);
|
|
51
|
+
|
|
52
|
+
bfree(decl->name);
|
|
53
|
+
memset(decl, 0, sizeof(struct decl_info));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
EXPORT bool parse_decl_string(struct decl_info *decl, const char *decl_string);
|
|
58
|
+
|
|
59
|
+
#ifdef __cplusplus
|
|
60
|
+
}
|
|
61
|
+
#endif
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023 Lain Bailey <lain@obsproject.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission to use, copy, modify, and distribute this software for any
|
|
5
|
+
* purpose with or without fee is hereby granted, provided that the above
|
|
6
|
+
* copyright notice and this permission notice appear in all copies.
|
|
7
|
+
*
|
|
8
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#pragma once
|
|
18
|
+
|
|
19
|
+
#include "../util/c99defs.h"
|
|
20
|
+
|
|
21
|
+
#include "calldata.h"
|
|
22
|
+
|
|
23
|
+
#ifdef __cplusplus
|
|
24
|
+
extern "C" {
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
* Procedure handler
|
|
29
|
+
*
|
|
30
|
+
* This handler is used to allow access to one or more procedures that can be
|
|
31
|
+
* added and called without having to have direct access to declarations or
|
|
32
|
+
* procedure callback pointers.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
struct proc_handler;
|
|
36
|
+
typedef struct proc_handler proc_handler_t;
|
|
37
|
+
typedef void (*proc_handler_proc_t)(void *, calldata_t *);
|
|
38
|
+
|
|
39
|
+
EXPORT proc_handler_t *proc_handler_create(void);
|
|
40
|
+
EXPORT void proc_handler_destroy(proc_handler_t *handler);
|
|
41
|
+
|
|
42
|
+
EXPORT void proc_handler_add(proc_handler_t *handler, const char *decl_string, proc_handler_proc_t proc, void *data);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Calls a function in a procedure handler. Returns false if the named
|
|
46
|
+
* procedure is not found.
|
|
47
|
+
*/
|
|
48
|
+
EXPORT bool proc_handler_call(proc_handler_t *handler, const char *name, calldata_t *params);
|
|
49
|
+
|
|
50
|
+
#ifdef __cplusplus
|
|
51
|
+
}
|
|
52
|
+
#endif
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023 Lain Bailey <lain@obsproject.com>
|
|
3
|
+
*
|
|
4
|
+
* Permission to use, copy, modify, and distribute this software for any
|
|
5
|
+
* purpose with or without fee is hereby granted, provided that the above
|
|
6
|
+
* copyright notice and this permission notice appear in all copies.
|
|
7
|
+
*
|
|
8
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
9
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
10
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
11
|
+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
12
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
13
|
+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
14
|
+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#pragma once
|
|
18
|
+
|
|
19
|
+
#include "../util/c99defs.h"
|
|
20
|
+
|
|
21
|
+
#include "calldata.h"
|
|
22
|
+
|
|
23
|
+
#ifdef __cplusplus
|
|
24
|
+
extern "C" {
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
/*
|
|
28
|
+
* Signal handler
|
|
29
|
+
*
|
|
30
|
+
* This is used to create a signal handler which can broadcast events
|
|
31
|
+
* to one or more callbacks connected to a signal.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
struct signal_handler;
|
|
35
|
+
typedef struct signal_handler signal_handler_t;
|
|
36
|
+
typedef void (*global_signal_callback_t)(void *, const char *, calldata_t *);
|
|
37
|
+
typedef void (*signal_callback_t)(void *, calldata_t *);
|
|
38
|
+
|
|
39
|
+
EXPORT signal_handler_t *signal_handler_create(void);
|
|
40
|
+
EXPORT void signal_handler_destroy(signal_handler_t *handler);
|
|
41
|
+
|
|
42
|
+
EXPORT bool signal_handler_add(signal_handler_t *handler, const char *signal_decl);
|
|
43
|
+
|
|
44
|
+
static inline bool signal_handler_add_array(signal_handler_t *handler, const char **signal_decls)
|
|
45
|
+
{
|
|
46
|
+
bool success = true;
|
|
47
|
+
if (!signal_decls)
|
|
48
|
+
return false;
|
|
49
|
+
|
|
50
|
+
while (*signal_decls)
|
|
51
|
+
if (!signal_handler_add(handler, *(signal_decls++)))
|
|
52
|
+
success = false;
|
|
53
|
+
|
|
54
|
+
return success;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
EXPORT void signal_handler_connect(signal_handler_t *handler, const char *signal, signal_callback_t callback,
|
|
58
|
+
void *data);
|
|
59
|
+
EXPORT void signal_handler_connect_ref(signal_handler_t *handler, const char *signal, signal_callback_t callback,
|
|
60
|
+
void *data);
|
|
61
|
+
EXPORT void signal_handler_disconnect(signal_handler_t *handler, const char *signal, signal_callback_t callback,
|
|
62
|
+
void *data);
|
|
63
|
+
|
|
64
|
+
EXPORT void signal_handler_connect_global(signal_handler_t *handler, global_signal_callback_t callback, void *data);
|
|
65
|
+
EXPORT void signal_handler_disconnect_global(signal_handler_t *handler, global_signal_callback_t callback, void *data);
|
|
66
|
+
|
|
67
|
+
EXPORT void signal_handler_remove_current(void);
|
|
68
|
+
|
|
69
|
+
EXPORT void signal_handler_signal(signal_handler_t *handler, const char *signal, calldata_t *params);
|
|
70
|
+
|
|
71
|
+
#ifdef __cplusplus
|
|
72
|
+
}
|
|
73
|
+
#endif
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
struct quat;
|
|
27
|
+
|
|
28
|
+
struct axisang {
|
|
29
|
+
union {
|
|
30
|
+
struct {
|
|
31
|
+
float x, y, z, w;
|
|
32
|
+
};
|
|
33
|
+
float ptr[4];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
static inline void axisang_zero(struct axisang *dst)
|
|
38
|
+
{
|
|
39
|
+
dst->x = 0.0f;
|
|
40
|
+
dst->y = 0.0f;
|
|
41
|
+
dst->z = 0.0f;
|
|
42
|
+
dst->w = 0.0f;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static inline void axisang_copy(struct axisang *dst, struct axisang *aa)
|
|
46
|
+
{
|
|
47
|
+
dst->x = aa->x;
|
|
48
|
+
dst->y = aa->y;
|
|
49
|
+
dst->z = aa->z;
|
|
50
|
+
dst->w = aa->w;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static inline void axisang_set(struct axisang *dst, float x, float y, float z, float w)
|
|
54
|
+
{
|
|
55
|
+
dst->x = x;
|
|
56
|
+
dst->y = y;
|
|
57
|
+
dst->z = z;
|
|
58
|
+
dst->w = w;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
EXPORT void axisang_from_quat(struct axisang *dst, const struct quat *q);
|
|
62
|
+
|
|
63
|
+
#ifdef __cplusplus
|
|
64
|
+
}
|
|
65
|
+
#endif
|