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.
Files changed (185) hide show
  1. package/COPYING +339 -0
  2. package/README.md +46 -0
  3. package/bin/64bit/obs.lib +0 -0
  4. package/binding.gyp +23 -0
  5. package/dist/bin/Qt6Core.dll +0 -0
  6. package/dist/bin/Qt6Gui.dll +0 -0
  7. package/dist/bin/Qt6Network.dll +0 -0
  8. package/dist/bin/Qt6Svg.dll +0 -0
  9. package/dist/bin/Qt6Widgets.dll +0 -0
  10. package/dist/bin/Qt6Xml.dll +0 -0
  11. package/dist/bin/avcodec-61.dll +0 -0
  12. package/dist/bin/avdevice-61.dll +0 -0
  13. package/dist/bin/avfilter-10.dll +0 -0
  14. package/dist/bin/avformat-61.dll +0 -0
  15. package/dist/bin/avutil-59.dll +0 -0
  16. package/dist/bin/datachannel.dll +0 -0
  17. package/dist/bin/libcurl.dll +0 -0
  18. package/dist/bin/libobs-d3d11.dll +0 -0
  19. package/dist/bin/libobs-opengl.dll +0 -0
  20. package/dist/bin/libobs-winrt.dll +0 -0
  21. package/dist/bin/librist.dll +0 -0
  22. package/dist/bin/libx264-164.dll +0 -0
  23. package/dist/bin/lua51.dll +0 -0
  24. package/dist/bin/obs-amf-test.exe +0 -0
  25. package/dist/bin/obs-ffmpeg-mux.exe +0 -0
  26. package/dist/bin/obs-frontend-api.dll +0 -0
  27. package/dist/bin/obs-scripting.dll +0 -0
  28. package/dist/bin/obs.dll +0 -0
  29. package/dist/bin/srt.dll +0 -0
  30. package/dist/bin/swresample-5.dll +0 -0
  31. package/dist/bin/swscale-8.dll +0 -0
  32. package/dist/bin/w32-pthreads.dll +0 -0
  33. package/dist/bin/zlib.dll +0 -0
  34. package/dist/effects/area.effect +250 -0
  35. package/dist/effects/bicubic_scale.effect +236 -0
  36. package/dist/effects/bilinear_lowres_scale.effect +123 -0
  37. package/dist/effects/color.effect +172 -0
  38. package/dist/effects/default.effect +254 -0
  39. package/dist/effects/default_rect.effect +84 -0
  40. package/dist/effects/deinterlace_base.effect +325 -0
  41. package/dist/effects/deinterlace_blend.effect +21 -0
  42. package/dist/effects/deinterlace_blend_2x.effect +21 -0
  43. package/dist/effects/deinterlace_discard.effect +21 -0
  44. package/dist/effects/deinterlace_discard_2x.effect +21 -0
  45. package/dist/effects/deinterlace_linear.effect +21 -0
  46. package/dist/effects/deinterlace_linear_2x.effect +21 -0
  47. package/dist/effects/deinterlace_yadif.effect +21 -0
  48. package/dist/effects/deinterlace_yadif_2x.effect +21 -0
  49. package/dist/effects/format_conversion.effect +1823 -0
  50. package/dist/effects/lanczos_scale.effect +292 -0
  51. package/dist/effects/opaque.effect +159 -0
  52. package/dist/effects/premultiplied_alpha.effect +38 -0
  53. package/dist/effects/repeat.effect +36 -0
  54. package/dist/effects/solid.effect +80 -0
  55. package/dist/noobs.node +0 -0
  56. package/dist/plugins/obs-ffmpeg.dll +0 -0
  57. package/dist/plugins/obs-x264.dll +0 -0
  58. package/dist/plugins/win-capture.dll +0 -0
  59. package/include/audio-monitoring/osx/mac-helpers.h +13 -0
  60. package/include/audio-monitoring/pulse/pulseaudio-wrapper.h +212 -0
  61. package/include/audio-monitoring/win32/wasapi-output.h +22 -0
  62. package/include/callback/calldata.h +195 -0
  63. package/include/callback/decl.h +61 -0
  64. package/include/callback/proc.h +52 -0
  65. package/include/callback/signal.h +73 -0
  66. package/include/graphics/axisang.h +65 -0
  67. package/include/graphics/bounds.h +108 -0
  68. package/include/graphics/device-exports.h +177 -0
  69. package/include/graphics/effect-parser.h +290 -0
  70. package/include/graphics/effect.h +190 -0
  71. package/include/graphics/graphics-internal.h +335 -0
  72. package/include/graphics/graphics.h +1024 -0
  73. package/include/graphics/half.h +100 -0
  74. package/include/graphics/image-file.h +124 -0
  75. package/include/graphics/input.h +34 -0
  76. package/include/graphics/libnsgif/libnsgif.h +142 -0
  77. package/include/graphics/math-defs.h +45 -0
  78. package/include/graphics/math-extra.h +61 -0
  79. package/include/graphics/matrix3.h +98 -0
  80. package/include/graphics/matrix4.h +102 -0
  81. package/include/graphics/plane.h +85 -0
  82. package/include/graphics/quat.h +170 -0
  83. package/include/graphics/shader-parser.h +273 -0
  84. package/include/graphics/srgb.h +177 -0
  85. package/include/graphics/vec2.h +148 -0
  86. package/include/graphics/vec3.h +224 -0
  87. package/include/graphics/vec4.h +241 -0
  88. package/include/media-io/audio-io.h +228 -0
  89. package/include/media-io/audio-math.h +43 -0
  90. package/include/media-io/audio-resampler.h +44 -0
  91. package/include/media-io/format-conversion.h +50 -0
  92. package/include/media-io/frame-rate.h +29 -0
  93. package/include/media-io/media-io-defs.h +20 -0
  94. package/include/media-io/media-remux.h +37 -0
  95. package/include/media-io/video-frame.h +64 -0
  96. package/include/media-io/video-io.h +338 -0
  97. package/include/media-io/video-scaler.h +43 -0
  98. package/include/obs-audio-controls.h +250 -0
  99. package/include/obs-av1.h +47 -0
  100. package/include/obs-avc.h +55 -0
  101. package/include/obs-config.h +52 -0
  102. package/include/obs-data.h +311 -0
  103. package/include/obs-defs.h +52 -0
  104. package/include/obs-encoder.h +361 -0
  105. package/include/obs-ffmpeg-compat.h +13 -0
  106. package/include/obs-hevc.h +81 -0
  107. package/include/obs-hotkey.h +271 -0
  108. package/include/obs-hotkeys.h +653 -0
  109. package/include/obs-interaction.h +56 -0
  110. package/include/obs-internal.h +1459 -0
  111. package/include/obs-missing-files.h +53 -0
  112. package/include/obs-module.h +181 -0
  113. package/include/obs-nal.h +37 -0
  114. package/include/obs-nix-platform.h +53 -0
  115. package/include/obs-nix-wayland.h +24 -0
  116. package/include/obs-nix-x11.h +22 -0
  117. package/include/obs-nix.h +42 -0
  118. package/include/obs-output.h +96 -0
  119. package/include/obs-properties.h +364 -0
  120. package/include/obs-scene.h +127 -0
  121. package/include/obs-service.h +115 -0
  122. package/include/obs-source.h +568 -0
  123. package/include/obs.h +2608 -0
  124. package/include/obsconfig.h +13 -0
  125. package/include/obsversion.h +5 -0
  126. package/include/util/apple/cfstring-utils.h +16 -0
  127. package/include/util/array-serializer.h +37 -0
  128. package/include/util/base.h +97 -0
  129. package/include/util/bitstream.h +28 -0
  130. package/include/util/bmem.h +94 -0
  131. package/include/util/buffered-file-serializer.h +32 -0
  132. package/include/util/c99defs.h +75 -0
  133. package/include/util/cf-lexer.h +199 -0
  134. package/include/util/cf-parser.h +281 -0
  135. package/include/util/circlebuf.h +319 -0
  136. package/include/util/config-file.h +103 -0
  137. package/include/util/crc32.h +29 -0
  138. package/include/util/curl/curl-helper.h +35 -0
  139. package/include/util/darray.h +606 -0
  140. package/include/util/deque.h +319 -0
  141. package/include/util/dstr.h +320 -0
  142. package/include/util/file-serializer.h +34 -0
  143. package/include/util/lexer.h +273 -0
  144. package/include/util/pipe.h +52 -0
  145. package/include/util/platform.h +223 -0
  146. package/include/util/profiler.h +97 -0
  147. package/include/util/serializer.h +158 -0
  148. package/include/util/simde/check.h +285 -0
  149. package/include/util/simde/debug-trap.h +117 -0
  150. package/include/util/simde/hedley.h +2123 -0
  151. package/include/util/simde/simde-align.h +481 -0
  152. package/include/util/simde/simde-arch.h +537 -0
  153. package/include/util/simde/simde-common.h +918 -0
  154. package/include/util/simde/simde-constify.h +925 -0
  155. package/include/util/simde/simde-detect-clang.h +114 -0
  156. package/include/util/simde/simde-diagnostic.h +447 -0
  157. package/include/util/simde/simde-features.h +550 -0
  158. package/include/util/simde/simde-math.h +1858 -0
  159. package/include/util/simde/x86/mmx.h +2456 -0
  160. package/include/util/simde/x86/sse.h +4479 -0
  161. package/include/util/simde/x86/sse2.h +7549 -0
  162. package/include/util/source-profiler.h +66 -0
  163. package/include/util/sse-intrin.h +32 -0
  164. package/include/util/task.h +22 -0
  165. package/include/util/text-lookup.h +45 -0
  166. package/include/util/threading-posix.h +77 -0
  167. package/include/util/threading-windows.h +142 -0
  168. package/include/util/threading.h +103 -0
  169. package/include/util/utf8.h +35 -0
  170. package/include/util/uthash.h +34 -0
  171. package/include/util/util_uint128.h +108 -0
  172. package/include/util/util_uint64.h +34 -0
  173. package/include/util/windows/device-enum.h +14 -0
  174. package/include/util/windows/obfuscate.h +16 -0
  175. package/include/util/windows/win-registry.h +37 -0
  176. package/include/util/windows/win-version.h +57 -0
  177. package/include/util/windows/window-helpers.h +47 -0
  178. package/index.d.ts +38 -0
  179. package/index.js +8 -0
  180. package/package.json +31 -0
  181. package/src/main.cpp +321 -0
  182. package/src/obs_interface.cpp +605 -0
  183. package/src/obs_interface.h +74 -0
  184. package/src/utils.cpp +80 -0
  185. package/src/utils.h +3 -0
@@ -0,0 +1,66 @@
1
+ /******************************************************************************
2
+ Copyright (C) 2023 by Dennis Sädtler <dennis@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 "obs.h"
21
+
22
+ #ifdef __cplusplus
23
+ extern "C" {
24
+ #endif
25
+
26
+ typedef struct profiler_result {
27
+ /* Tick times in ns */
28
+ uint64_t tick_avg;
29
+ uint64_t tick_max;
30
+
31
+ /* Average and max render times for CPU and GPU in ns */
32
+ uint64_t render_avg;
33
+ uint64_t render_max;
34
+ uint64_t render_gpu_avg;
35
+ uint64_t render_gpu_max;
36
+
37
+ /* Average of the sum of all render passes in a frame in ns
38
+ * (a source can be rendered more than once per frame). */
39
+ uint64_t render_sum;
40
+ uint64_t render_gpu_sum;
41
+
42
+ /* FPS of submitted async input */
43
+ double async_input;
44
+ /* Actually rendered async frames */
45
+ double async_rendered;
46
+
47
+ /* Best and worst frame times of input/output in ns */
48
+ uint64_t async_input_best;
49
+ uint64_t async_input_worst;
50
+ uint64_t async_rendered_best;
51
+ uint64_t async_rendered_worst;
52
+ } profiler_result_t;
53
+
54
+ /* Enable/disable profiler (applied on next frame) */
55
+ EXPORT void source_profiler_enable(bool enable);
56
+ /* Enable/disable GPU profiling (applied on next frame) */
57
+ EXPORT void source_profiler_gpu_enable(bool enable);
58
+
59
+ /* Get latest profiling results for source (must be freed by user) */
60
+ EXPORT profiler_result_t *source_profiler_get_result(obs_source_t *source);
61
+ /* Update existing profiler results object for source */
62
+ EXPORT bool source_profiler_fill_result(obs_source_t *source, profiler_result_t *result);
63
+
64
+ #ifdef __cplusplus
65
+ }
66
+ #endif
@@ -0,0 +1,32 @@
1
+ /******************************************************************************
2
+ Copyright (C) 2019 by Peter Geis <pgwipeout@gmail.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 "c99defs.h"
21
+
22
+ #if (defined(_MSC_VER) || defined(__MINGW32__)) && ((defined(_M_X64) && !defined(_M_ARM64EC)) || defined(_M_IX86))
23
+ #include <emmintrin.h>
24
+ #else
25
+ #ifndef WIN32_LEAN_AND_MEAN
26
+ #define WIN32_LEAN_AND_MEAN
27
+ #endif
28
+ #define SIMDE_ENABLE_NATIVE_ALIASES
29
+ PRAGMA_WARN_PUSH
30
+ #include "simde/x86/sse2.h"
31
+ PRAGMA_WARN_POP
32
+ #endif
@@ -0,0 +1,22 @@
1
+ #pragma once
2
+
3
+ #include "c99defs.h"
4
+
5
+ #ifdef __cplusplus
6
+ extern "C" {
7
+ #endif
8
+
9
+ struct os_task_queue;
10
+ typedef struct os_task_queue os_task_queue_t;
11
+
12
+ typedef void (*os_task_t)(void *param);
13
+
14
+ EXPORT os_task_queue_t *os_task_queue_create(void);
15
+ EXPORT bool os_task_queue_queue_task(os_task_queue_t *tt, os_task_t task, void *param);
16
+ EXPORT void os_task_queue_destroy(os_task_queue_t *tt);
17
+ EXPORT bool os_task_queue_wait(os_task_queue_t *tt);
18
+ EXPORT bool os_task_queue_inside(os_task_queue_t *tt);
19
+
20
+ #ifdef __cplusplus
21
+ }
22
+ #endif
@@ -0,0 +1,45 @@
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
+ /*
20
+ * Text Lookup interface
21
+ *
22
+ * Used for storing and looking up localized strings. Stores localization
23
+ * strings in a hashmap to efficiently look up associated strings via a
24
+ * unique string identifier name.
25
+ */
26
+
27
+ #include "c99defs.h"
28
+
29
+ #ifdef __cplusplus
30
+ extern "C" {
31
+ #endif
32
+
33
+ /* opaque typedef */
34
+ struct text_lookup;
35
+ typedef struct text_lookup lookup_t;
36
+
37
+ /* functions */
38
+ EXPORT lookup_t *text_lookup_create(const char *path);
39
+ EXPORT bool text_lookup_add(lookup_t *lookup, const char *path);
40
+ EXPORT void text_lookup_destroy(lookup_t *lookup);
41
+ EXPORT bool text_lookup_getstr(lookup_t *lookup, const char *lookup_val, const char **out);
42
+
43
+ #ifdef __cplusplus
44
+ }
45
+ #endif
@@ -0,0 +1,77 @@
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
+ static inline long os_atomic_inc_long(volatile long *val)
20
+ {
21
+ return __atomic_add_fetch(val, 1, __ATOMIC_SEQ_CST);
22
+ }
23
+
24
+ static inline long os_atomic_dec_long(volatile long *val)
25
+ {
26
+ return __atomic_sub_fetch(val, 1, __ATOMIC_SEQ_CST);
27
+ }
28
+
29
+ static inline void os_atomic_store_long(volatile long *ptr, long val)
30
+ {
31
+ __atomic_store_n(ptr, val, __ATOMIC_SEQ_CST);
32
+ }
33
+
34
+ static inline long os_atomic_set_long(volatile long *ptr, long val)
35
+ {
36
+ return __atomic_exchange_n(ptr, val, __ATOMIC_SEQ_CST);
37
+ }
38
+
39
+ static inline long os_atomic_exchange_long(volatile long *ptr, long val)
40
+ {
41
+ return os_atomic_set_long(ptr, val);
42
+ }
43
+
44
+ static inline long os_atomic_load_long(const volatile long *ptr)
45
+ {
46
+ return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
47
+ }
48
+
49
+ static inline bool os_atomic_compare_swap_long(volatile long *val, long old_val, long new_val)
50
+ {
51
+ return __atomic_compare_exchange_n(val, &old_val, new_val, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
52
+ }
53
+
54
+ static inline bool os_atomic_compare_exchange_long(volatile long *val, long *old_val, long new_val)
55
+ {
56
+ return __atomic_compare_exchange_n(val, old_val, new_val, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
57
+ }
58
+
59
+ static inline void os_atomic_store_bool(volatile bool *ptr, bool val)
60
+ {
61
+ __atomic_store_n(ptr, val, __ATOMIC_SEQ_CST);
62
+ }
63
+
64
+ static inline bool os_atomic_set_bool(volatile bool *ptr, bool val)
65
+ {
66
+ return __atomic_exchange_n(ptr, val, __ATOMIC_SEQ_CST);
67
+ }
68
+
69
+ static inline bool os_atomic_exchange_bool(volatile bool *ptr, bool val)
70
+ {
71
+ return os_atomic_set_bool(ptr, val);
72
+ }
73
+
74
+ static inline bool os_atomic_load_bool(const volatile bool *ptr)
75
+ {
76
+ return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
77
+ }
@@ -0,0 +1,142 @@
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 <intrin.h>
20
+ #include <string.h>
21
+
22
+ #if !defined(_M_IX86) && !defined(_M_X64) && !defined(_M_ARM) && !defined(_M_ARM64)
23
+ #error Processor not supported
24
+ #endif
25
+
26
+ static inline long os_atomic_inc_long(volatile long *val)
27
+ {
28
+ return _InterlockedIncrement(val);
29
+ }
30
+
31
+ static inline long os_atomic_dec_long(volatile long *val)
32
+ {
33
+ return _InterlockedDecrement(val);
34
+ }
35
+
36
+ static inline void os_atomic_store_long(volatile long *ptr, long val)
37
+ {
38
+ #if defined(_M_ARM64)
39
+ _ReadWriteBarrier();
40
+ __stlr32((volatile unsigned *)ptr, val);
41
+ _ReadWriteBarrier();
42
+ #elif defined(_M_ARM)
43
+ __dmb(_ARM_BARRIER_ISH);
44
+ __iso_volatile_store32((volatile __int32 *)ptr, val);
45
+ __dmb(_ARM_BARRIER_ISH);
46
+ #else
47
+ _InterlockedExchange(ptr, val);
48
+ #endif
49
+ }
50
+
51
+ static inline long os_atomic_set_long(volatile long *ptr, long val)
52
+ {
53
+ return _InterlockedExchange(ptr, val);
54
+ }
55
+
56
+ static inline long os_atomic_exchange_long(volatile long *ptr, long val)
57
+ {
58
+ return os_atomic_set_long(ptr, val);
59
+ }
60
+
61
+ static inline long os_atomic_load_long(const volatile long *ptr)
62
+ {
63
+ #if defined(_M_ARM64)
64
+ const long val = __ldar32((volatile unsigned *)ptr);
65
+ #else
66
+ const long val = __iso_volatile_load32((const volatile __int32 *)ptr);
67
+ #endif
68
+
69
+ #if defined(_M_ARM)
70
+ __dmb(_ARM_BARRIER_ISH);
71
+ #else
72
+ _ReadWriteBarrier();
73
+ #endif
74
+
75
+ return val;
76
+ }
77
+
78
+ static inline bool os_atomic_compare_swap_long(volatile long *val, long old_val, long new_val)
79
+ {
80
+ return _InterlockedCompareExchange(val, new_val, old_val) == old_val;
81
+ }
82
+
83
+ static inline bool os_atomic_compare_exchange_long(volatile long *val, long *old_ptr, long new_val)
84
+ {
85
+ const long old_val = *old_ptr;
86
+ const long previous = _InterlockedCompareExchange(val, new_val, old_val);
87
+ *old_ptr = previous;
88
+ return previous == old_val;
89
+ }
90
+
91
+ static inline void os_atomic_store_bool(volatile bool *ptr, bool val)
92
+ {
93
+ #if defined(_M_ARM64)
94
+ _ReadWriteBarrier();
95
+ __stlr8((volatile unsigned char *)ptr, val);
96
+ _ReadWriteBarrier();
97
+ #elif defined(_M_ARM)
98
+ __dmb(_ARM_BARRIER_ISH);
99
+ __iso_volatile_store8((volatile char *)ptr, val);
100
+ __dmb(_ARM_BARRIER_ISH);
101
+ #else
102
+ _InterlockedExchange8((volatile char *)ptr, (char)val);
103
+ #endif
104
+ }
105
+
106
+ static inline bool os_atomic_set_bool(volatile bool *ptr, bool val)
107
+ {
108
+ const char c = _InterlockedExchange8((volatile char *)ptr, (char)val);
109
+ bool b;
110
+
111
+ /* Avoid unnecesary char to bool conversion. Value known 0 or 1. */
112
+ memcpy(&b, &c, sizeof(b));
113
+
114
+ return b;
115
+ }
116
+
117
+ static inline bool os_atomic_exchange_bool(volatile bool *ptr, bool val)
118
+ {
119
+ return os_atomic_set_bool(ptr, val);
120
+ }
121
+
122
+ static inline bool os_atomic_load_bool(const volatile bool *ptr)
123
+ {
124
+ bool b;
125
+
126
+ #if defined(_M_ARM64)
127
+ const unsigned char c = __ldar8((volatile unsigned char *)ptr);
128
+ #else
129
+ const char c = __iso_volatile_load8((const volatile char *)ptr);
130
+ #endif
131
+
132
+ #if defined(_M_ARM)
133
+ __dmb(_ARM_BARRIER_ISH);
134
+ #else
135
+ _ReadWriteBarrier();
136
+ #endif
137
+
138
+ /* Avoid unnecesary char to bool conversion. Value known 0 or 1. */
139
+ memcpy(&b, &c, sizeof(b));
140
+
141
+ return b;
142
+ }
@@ -0,0 +1,103 @@
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
+ /*
20
+ * Allows posix thread usage on windows as well as other operating systems.
21
+ * Use this header if you want to make your code more platform independent.
22
+ *
23
+ * Also provides a custom platform-independent "event" handler via
24
+ * pthread conditional waits.
25
+ */
26
+
27
+ #include "c99defs.h"
28
+
29
+ #ifndef _MSC_VER
30
+ #include <errno.h>
31
+ #endif
32
+ #include <pthread.h>
33
+
34
+ #ifdef __cplusplus
35
+ extern "C" {
36
+ #endif
37
+
38
+ #ifdef _WIN32
39
+ #include "threading-windows.h"
40
+ #else
41
+ #include "threading-posix.h"
42
+ #endif
43
+
44
+ /* this may seem strange, but you can't use it unless it's an initializer */
45
+ static inline void pthread_mutex_init_value(pthread_mutex_t *mutex)
46
+ {
47
+ pthread_mutex_t init_val = PTHREAD_MUTEX_INITIALIZER;
48
+ if (!mutex)
49
+ return;
50
+
51
+ *mutex = init_val;
52
+ }
53
+
54
+ static inline int pthread_mutex_init_recursive(pthread_mutex_t *mutex)
55
+ {
56
+ pthread_mutexattr_t attr;
57
+ int ret = pthread_mutexattr_init(&attr);
58
+ if (ret == 0) {
59
+ ret = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
60
+ if (ret == 0) {
61
+ ret = pthread_mutex_init(mutex, &attr);
62
+ }
63
+
64
+ pthread_mutexattr_destroy(&attr);
65
+ }
66
+
67
+ return ret;
68
+ }
69
+
70
+ enum os_event_type {
71
+ OS_EVENT_TYPE_AUTO,
72
+ OS_EVENT_TYPE_MANUAL,
73
+ };
74
+
75
+ struct os_event_data;
76
+ struct os_sem_data;
77
+ typedef struct os_event_data os_event_t;
78
+ typedef struct os_sem_data os_sem_t;
79
+
80
+ EXPORT int os_event_init(os_event_t **event, enum os_event_type type);
81
+ EXPORT void os_event_destroy(os_event_t *event);
82
+ EXPORT int os_event_wait(os_event_t *event);
83
+ EXPORT int os_event_timedwait(os_event_t *event, unsigned long milliseconds);
84
+ EXPORT int os_event_try(os_event_t *event);
85
+ EXPORT int os_event_signal(os_event_t *event);
86
+ EXPORT void os_event_reset(os_event_t *event);
87
+
88
+ EXPORT int os_sem_init(os_sem_t **sem, int value);
89
+ EXPORT void os_sem_destroy(os_sem_t *sem);
90
+ EXPORT int os_sem_post(os_sem_t *sem);
91
+ EXPORT int os_sem_wait(os_sem_t *sem);
92
+
93
+ EXPORT void os_set_thread_name(const char *name);
94
+
95
+ #ifdef _MSC_VER
96
+ #define THREAD_LOCAL __declspec(thread)
97
+ #else
98
+ #define THREAD_LOCAL __thread
99
+ #endif
100
+
101
+ #ifdef __cplusplus
102
+ }
103
+ #endif
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Copyright (c) 2007 Alexey Vatchenko <av@bsdua.org>
3
+ *
4
+ * Permission to use, copy, modify, and/or 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
+ /*
20
+ * utf8: implementation of UTF-8 charset encoding (RFC3629).
21
+ */
22
+
23
+ #ifdef __cplusplus
24
+ extern "C" {
25
+ #endif
26
+
27
+ #define UTF8_IGNORE_ERROR 0x01
28
+ #define UTF8_SKIP_BOM 0x02
29
+
30
+ size_t utf8_to_wchar(const char *in, size_t insize, wchar_t *out, size_t outsize, int flags);
31
+ size_t wchar_to_utf8(const wchar_t *in, size_t insize, char *out, size_t outsize, int flags);
32
+
33
+ #ifdef __cplusplus
34
+ }
35
+ #endif
@@ -0,0 +1,34 @@
1
+ /******************************************************************************
2
+ Copyright (C) 2023 by Dennis Sädtler <dennis@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
+ /*
21
+ * This file (re)defines various uthash settings for use in libobs
22
+ */
23
+
24
+ #include <uthash.h>
25
+
26
+ /* Use OBS allocator */
27
+ #undef uthash_malloc
28
+ #undef uthash_free
29
+ #define uthash_malloc(sz) bmalloc(sz)
30
+ #define uthash_free(ptr, sz) bfree(ptr)
31
+
32
+ /* Use SFH (Super Fast Hash) function instead of JEN */
33
+ #undef HASH_FUNCTION
34
+ #define HASH_FUNCTION HASH_SFH
@@ -0,0 +1,108 @@
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
+ struct util_uint128 {
20
+ union {
21
+ uint32_t i32[4];
22
+ struct {
23
+ uint64_t low;
24
+ uint64_t high;
25
+ };
26
+ };
27
+ };
28
+
29
+ typedef struct util_uint128 util_uint128_t;
30
+
31
+ static inline util_uint128_t util_add128(util_uint128_t a, util_uint128_t b)
32
+ {
33
+ util_uint128_t out;
34
+ uint64_t val;
35
+
36
+ val = (a.low & 0xFFFFFFFFULL) + (b.low & 0xFFFFFFFFULL);
37
+ out.i32[0] = (uint32_t)(val & 0xFFFFFFFFULL);
38
+ val >>= 32;
39
+
40
+ val += (a.low >> 32) + (b.low >> 32);
41
+ out.i32[1] = (uint32_t)val;
42
+ val >>= 32;
43
+
44
+ val += (a.high & 0xFFFFFFFFULL) + (b.high & 0xFFFFFFFFULL);
45
+ out.i32[2] = (uint32_t)(val & 0xFFFFFFFFULL);
46
+ val >>= 32;
47
+
48
+ val += (a.high >> 32) + (b.high >> 32);
49
+ out.i32[3] = (uint32_t)val;
50
+
51
+ return out;
52
+ }
53
+
54
+ static inline util_uint128_t util_lshift64_internal_32(uint64_t a)
55
+ {
56
+ util_uint128_t val;
57
+ val.low = a << 32;
58
+ val.high = a >> 32;
59
+ return val;
60
+ }
61
+
62
+ static inline util_uint128_t util_lshift64_internal_64(uint64_t a)
63
+ {
64
+ util_uint128_t val;
65
+ val.low = 0;
66
+ val.high = a;
67
+ return val;
68
+ }
69
+
70
+ static inline util_uint128_t util_mul64_64(uint64_t a, uint64_t b)
71
+ {
72
+ util_uint128_t out;
73
+ uint64_t m;
74
+
75
+ m = (a & 0xFFFFFFFFULL) * (b & 0xFFFFFFFFULL);
76
+ out.low = m;
77
+ out.high = 0;
78
+
79
+ m = (a >> 32) * (b & 0xFFFFFFFFULL);
80
+ out = util_add128(out, util_lshift64_internal_32(m));
81
+
82
+ m = (a & 0xFFFFFFFFULL) * (b >> 32);
83
+ out = util_add128(out, util_lshift64_internal_32(m));
84
+
85
+ m = (a >> 32) * (b >> 32);
86
+ out = util_add128(out, util_lshift64_internal_64(m));
87
+
88
+ return out;
89
+ }
90
+
91
+ static inline util_uint128_t util_div128_32(util_uint128_t a, uint32_t b)
92
+ {
93
+ util_uint128_t out;
94
+ uint64_t val = 0;
95
+
96
+ for (int i = 3; i >= 0; i--) {
97
+ val = (val << 32) | a.i32[i];
98
+ if (val < b) {
99
+ out.i32[i] = 0;
100
+ continue;
101
+ }
102
+
103
+ out.i32[i] = (uint32_t)(val / b);
104
+ val = val % b;
105
+ }
106
+
107
+ return out;
108
+ }