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,13 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#define OBS_DATA_PATH "../../data"
|
|
4
|
+
#define OBS_PLUGIN_PATH "../..//obs-plugins/64bit"
|
|
5
|
+
#define OBS_PLUGIN_DESTINATION "obs-plugins/64bit"
|
|
6
|
+
|
|
7
|
+
/* #undef GIO_FOUND */
|
|
8
|
+
/* #undef PULSEAUDIO_FOUND */
|
|
9
|
+
/* #undef XCB_XINPUT_FOUND */
|
|
10
|
+
/* #undef ENABLE_WAYLAND */
|
|
11
|
+
|
|
12
|
+
#define OBS_RELEASE_CANDIDATE 1
|
|
13
|
+
#define OBS_BETA 0
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "../c99defs.h"
|
|
4
|
+
#include "../dstr.h"
|
|
5
|
+
|
|
6
|
+
#ifdef __cplusplus
|
|
7
|
+
extern "C" {
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
EXPORT char *cfstr_copy_cstr(CFStringRef cfstr, CFStringEncoding cfstr_enc);
|
|
11
|
+
|
|
12
|
+
EXPORT bool cfstr_copy_dstr(CFStringRef cfstr, CFStringEncoding cfstr_enc, struct dstr *str);
|
|
13
|
+
|
|
14
|
+
#ifdef __cplusplus
|
|
15
|
+
}
|
|
16
|
+
#endif
|
|
@@ -0,0 +1,37 @@
|
|
|
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 "serializer.h"
|
|
20
|
+
#include "darray.h"
|
|
21
|
+
|
|
22
|
+
#ifdef __cplusplus
|
|
23
|
+
extern "C" {
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
struct array_output_data {
|
|
27
|
+
DARRAY(uint8_t) bytes;
|
|
28
|
+
size_t cur_pos;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
EXPORT void array_output_serializer_init(struct serializer *s, struct array_output_data *data);
|
|
32
|
+
EXPORT void array_output_serializer_free(struct array_output_data *data);
|
|
33
|
+
EXPORT void array_output_serializer_reset(struct array_output_data *data);
|
|
34
|
+
|
|
35
|
+
#ifdef __cplusplus
|
|
36
|
+
}
|
|
37
|
+
#endif
|
|
@@ -0,0 +1,97 @@
|
|
|
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 <stdarg.h>
|
|
20
|
+
|
|
21
|
+
#include "c99defs.h"
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Just contains logging/crash related stuff
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
#ifdef __cplusplus
|
|
28
|
+
extern "C" {
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
#define STRINGIFY(x) #x
|
|
32
|
+
#define STRINGIFY_(x) STRINGIFY(x)
|
|
33
|
+
#define S__LINE__ STRINGIFY_(__LINE__)
|
|
34
|
+
|
|
35
|
+
#define INT_CUR_LINE __LINE__
|
|
36
|
+
#define FILE_LINE __FILE__ " (" S__LINE__ "): "
|
|
37
|
+
|
|
38
|
+
#define OBS_COUNTOF(x) (sizeof(x) / sizeof(x[0]))
|
|
39
|
+
|
|
40
|
+
enum {
|
|
41
|
+
/**
|
|
42
|
+
* Use if there's a problem that can potentially affect the program,
|
|
43
|
+
* but isn't enough to require termination of the program.
|
|
44
|
+
*
|
|
45
|
+
* Use in creation functions and core subsystem functions. Places that
|
|
46
|
+
* should definitely not fail.
|
|
47
|
+
*/
|
|
48
|
+
LOG_ERROR = 100,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Use if a problem occurs that doesn't affect the program and is
|
|
52
|
+
* recoverable.
|
|
53
|
+
*
|
|
54
|
+
* Use in places where failure isn't entirely unexpected, and can
|
|
55
|
+
* be handled safely.
|
|
56
|
+
*/
|
|
57
|
+
LOG_WARNING = 200,
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Informative message to be displayed in the log.
|
|
61
|
+
*/
|
|
62
|
+
LOG_INFO = 300,
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Debug message to be used mostly by developers.
|
|
66
|
+
*/
|
|
67
|
+
LOG_DEBUG = 400
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
typedef void (*log_handler_t)(int lvl, const char *msg, va_list args, void *p);
|
|
71
|
+
|
|
72
|
+
EXPORT void base_get_log_handler(log_handler_t *handler, void **param);
|
|
73
|
+
EXPORT void base_set_log_handler(log_handler_t handler, void *param);
|
|
74
|
+
|
|
75
|
+
EXPORT void base_set_crash_handler(void (*handler)(const char *, va_list, void *), void *param);
|
|
76
|
+
|
|
77
|
+
EXPORT void blogva(int log_level, const char *format, va_list args);
|
|
78
|
+
|
|
79
|
+
#if !defined(_MSC_VER) && !defined(SWIG)
|
|
80
|
+
#define PRINTFATTR(f, a) __attribute__((__format__(__printf__, f, a)))
|
|
81
|
+
#else
|
|
82
|
+
#define PRINTFATTR(f, a)
|
|
83
|
+
#endif
|
|
84
|
+
|
|
85
|
+
PRINTFATTR(2, 3)
|
|
86
|
+
EXPORT void blog(int log_level, const char *format, ...);
|
|
87
|
+
PRINTFATTR(1, 2)
|
|
88
|
+
#ifndef SWIG
|
|
89
|
+
OBS_NORETURN
|
|
90
|
+
#endif
|
|
91
|
+
EXPORT void bcrash(const char *format, ...);
|
|
92
|
+
|
|
93
|
+
#undef PRINTFATTR
|
|
94
|
+
|
|
95
|
+
#ifdef __cplusplus
|
|
96
|
+
}
|
|
97
|
+
#endif
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "c99defs.h"
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* General programmable serialization functions. (A shared interface to
|
|
7
|
+
* various reading/writing to/from different inputs/outputs)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#ifdef __cplusplus
|
|
11
|
+
extern "C" {
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
struct bitstream_reader {
|
|
15
|
+
uint8_t pos;
|
|
16
|
+
uint8_t subPos;
|
|
17
|
+
uint8_t *buf;
|
|
18
|
+
size_t len;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
EXPORT void bitstream_reader_init(struct bitstream_reader *r, uint8_t *data, size_t len);
|
|
22
|
+
EXPORT uint8_t bitstream_reader_read_bits(struct bitstream_reader *r, int bits);
|
|
23
|
+
EXPORT uint8_t bitstream_reader_r8(struct bitstream_reader *r);
|
|
24
|
+
EXPORT uint16_t bitstream_reader_r16(struct bitstream_reader *r);
|
|
25
|
+
|
|
26
|
+
#ifdef __cplusplus
|
|
27
|
+
}
|
|
28
|
+
#endif
|
|
@@ -0,0 +1,94 @@
|
|
|
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 "c99defs.h"
|
|
20
|
+
#include "base.h"
|
|
21
|
+
#include <wchar.h>
|
|
22
|
+
#include <string.h>
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
struct base_allocator {
|
|
29
|
+
void *(*malloc)(size_t);
|
|
30
|
+
void *(*realloc)(void *, size_t);
|
|
31
|
+
void (*free)(void *);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
EXPORT void *bmalloc(size_t size);
|
|
35
|
+
EXPORT void *brealloc(void *ptr, size_t size);
|
|
36
|
+
EXPORT void bfree(void *ptr);
|
|
37
|
+
|
|
38
|
+
EXPORT int base_get_alignment(void);
|
|
39
|
+
|
|
40
|
+
EXPORT long bnum_allocs(void);
|
|
41
|
+
|
|
42
|
+
EXPORT void *bmemdup(const void *ptr, size_t size);
|
|
43
|
+
|
|
44
|
+
static inline void *bzalloc(size_t size)
|
|
45
|
+
{
|
|
46
|
+
void *mem = bmalloc(size);
|
|
47
|
+
if (mem)
|
|
48
|
+
memset(mem, 0, size);
|
|
49
|
+
return mem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static inline char *bstrdup_n(const char *str, size_t n)
|
|
53
|
+
{
|
|
54
|
+
char *dup;
|
|
55
|
+
if (!str)
|
|
56
|
+
return NULL;
|
|
57
|
+
|
|
58
|
+
dup = (char *)bmemdup(str, n + 1);
|
|
59
|
+
dup[n] = 0;
|
|
60
|
+
|
|
61
|
+
return dup;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static inline wchar_t *bwstrdup_n(const wchar_t *str, size_t n)
|
|
65
|
+
{
|
|
66
|
+
wchar_t *dup;
|
|
67
|
+
if (!str)
|
|
68
|
+
return NULL;
|
|
69
|
+
|
|
70
|
+
dup = (wchar_t *)bmemdup(str, (n + 1) * sizeof(wchar_t));
|
|
71
|
+
dup[n] = 0;
|
|
72
|
+
|
|
73
|
+
return dup;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static inline char *bstrdup(const char *str)
|
|
77
|
+
{
|
|
78
|
+
if (!str)
|
|
79
|
+
return NULL;
|
|
80
|
+
|
|
81
|
+
return bstrdup_n(str, strlen(str));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static inline wchar_t *bwstrdup(const wchar_t *str)
|
|
85
|
+
{
|
|
86
|
+
if (!str)
|
|
87
|
+
return NULL;
|
|
88
|
+
|
|
89
|
+
return bwstrdup_n(str, wcslen(str));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
#ifdef __cplusplus
|
|
93
|
+
}
|
|
94
|
+
#endif
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Dennis Sädtler <dennis@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 "serializer.h"
|
|
20
|
+
|
|
21
|
+
#ifdef __cplusplus
|
|
22
|
+
extern "C" {
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
EXPORT bool buffered_file_serializer_init_defaults(struct serializer *s, const char *path);
|
|
26
|
+
EXPORT bool buffered_file_serializer_init(struct serializer *s, const char *path, size_t max_bufsize,
|
|
27
|
+
size_t chunk_size);
|
|
28
|
+
EXPORT void buffered_file_serializer_free(struct serializer *s);
|
|
29
|
+
|
|
30
|
+
#ifdef __cplusplus
|
|
31
|
+
}
|
|
32
|
+
#endif
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
* Contains hacks for getting some C99 stuff working in VC, things like
|
|
21
|
+
* bool, stdint
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
#define UNUSED_PARAMETER(param) (void)param
|
|
25
|
+
|
|
26
|
+
#ifdef _MSC_VER
|
|
27
|
+
#define _OBS_DEPRECATED __declspec(deprecated)
|
|
28
|
+
#define OBS_NORETURN __declspec(noreturn)
|
|
29
|
+
#define FORCE_INLINE __forceinline
|
|
30
|
+
#else
|
|
31
|
+
#define _OBS_DEPRECATED __attribute__((deprecated))
|
|
32
|
+
#define OBS_NORETURN __attribute__((noreturn))
|
|
33
|
+
#define FORCE_INLINE inline __attribute__((always_inline))
|
|
34
|
+
#endif
|
|
35
|
+
|
|
36
|
+
#if defined(SWIG_TYPE_TABLE)
|
|
37
|
+
#define OBS_DEPRECATED
|
|
38
|
+
#else
|
|
39
|
+
#define OBS_DEPRECATED _OBS_DEPRECATED
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
#if defined(IS_LIBOBS)
|
|
43
|
+
#define OBS_EXTERNAL_DEPRECATED
|
|
44
|
+
#else
|
|
45
|
+
#define OBS_EXTERNAL_DEPRECATED OBS_DEPRECATED
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
#ifdef _MSC_VER
|
|
49
|
+
#define EXPORT __declspec(dllexport)
|
|
50
|
+
#else
|
|
51
|
+
#define EXPORT __attribute__((visibility("default")))
|
|
52
|
+
#endif
|
|
53
|
+
|
|
54
|
+
#ifdef _MSC_VER
|
|
55
|
+
#define PRAGMA_WARN_PUSH _Pragma("warning(push)")
|
|
56
|
+
#define PRAGMA_WARN_POP _Pragma("warning(pop)")
|
|
57
|
+
#define PRAGMA_WARN_DEPRECATION _Pragma("warning(disable: 4996)")
|
|
58
|
+
#elif defined(__clang__)
|
|
59
|
+
#define PRAGMA_WARN_PUSH _Pragma("clang diagnostic push")
|
|
60
|
+
#define PRAGMA_WARN_POP _Pragma("clang diagnostic pop")
|
|
61
|
+
#define PRAGMA_WARN_DEPRECATION _Pragma("clang diagnostic warning \"-Wdeprecated-declarations\"")
|
|
62
|
+
#elif defined(__GNUC__)
|
|
63
|
+
#define PRAGMA_WARN_PUSH _Pragma("GCC diagnostic push")
|
|
64
|
+
#define PRAGMA_WARN_POP _Pragma("GCC diagnostic pop")
|
|
65
|
+
#define PRAGMA_WARN_DEPRECATION _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
|
|
66
|
+
#else
|
|
67
|
+
#define PRAGMA_WARN_PUSH
|
|
68
|
+
#define PRAGMA_WARN_POP
|
|
69
|
+
#define PRAGMA_WARN_DEPRECATION
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
#include <stddef.h>
|
|
73
|
+
#include <stdint.h>
|
|
74
|
+
#include <stdbool.h>
|
|
75
|
+
#include <sys/types.h>
|
|
@@ -0,0 +1,199 @@
|
|
|
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 "lexer.h"
|
|
20
|
+
|
|
21
|
+
#ifdef __cplusplus
|
|
22
|
+
extern "C" {
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
EXPORT char *cf_literal_to_str(const char *literal, size_t count);
|
|
26
|
+
|
|
27
|
+
/* ------------------------------------------------------------------------- */
|
|
28
|
+
/*
|
|
29
|
+
* A C-family lexer token is defined as:
|
|
30
|
+
* 1.) A generic 'name' token. (abc123_def456)
|
|
31
|
+
* 2.) A numeric sequence (usually starting with a number)
|
|
32
|
+
* 3.) A sequence of generic whitespace defined as spaces and tabs
|
|
33
|
+
* 4.) A newline
|
|
34
|
+
* 5.) A string or character sequence (surrounded by single or double quotes)
|
|
35
|
+
* 6.) A single character of a type not specified above
|
|
36
|
+
*/
|
|
37
|
+
enum cf_token_type {
|
|
38
|
+
CFTOKEN_NONE,
|
|
39
|
+
CFTOKEN_NAME,
|
|
40
|
+
CFTOKEN_NUM,
|
|
41
|
+
CFTOKEN_SPACETAB,
|
|
42
|
+
CFTOKEN_NEWLINE,
|
|
43
|
+
CFTOKEN_STRING,
|
|
44
|
+
CFTOKEN_OTHER
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
struct cf_token {
|
|
48
|
+
const struct cf_lexer *lex;
|
|
49
|
+
struct strref str;
|
|
50
|
+
struct strref unmerged_str;
|
|
51
|
+
enum cf_token_type type;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
typedef DARRAY(struct cf_token) cf_token_array_t;
|
|
55
|
+
|
|
56
|
+
static inline void cf_token_clear(struct cf_token *t)
|
|
57
|
+
{
|
|
58
|
+
memset(t, 0, sizeof(struct cf_token));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static inline void cf_token_copy(struct cf_token *dst, const struct cf_token *src)
|
|
62
|
+
{
|
|
63
|
+
memcpy(dst, src, sizeof(struct cf_token));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static inline void cf_token_add(struct cf_token *dst, const struct cf_token *add)
|
|
67
|
+
{
|
|
68
|
+
strref_add(&dst->str, &add->str);
|
|
69
|
+
strref_add(&dst->unmerged_str, &add->unmerged_str);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* ------------------------------------------------------------------------- */
|
|
73
|
+
/*
|
|
74
|
+
* The c-family lexer is a base lexer for generating a list of string
|
|
75
|
+
* reference tokens to be used with c-style languages.
|
|
76
|
+
*
|
|
77
|
+
* This base lexer is meant to be used as a stepping stone for an actual
|
|
78
|
+
* language lexer/parser.
|
|
79
|
+
*
|
|
80
|
+
* It reformats the text in the two following ways:
|
|
81
|
+
* 1.) Spliced lines (escaped newlines) are merged
|
|
82
|
+
* 2.) All comments are converted to a single space
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
struct cf_lexer {
|
|
86
|
+
char *file;
|
|
87
|
+
struct lexer base_lexer;
|
|
88
|
+
char *reformatted, *write_offset;
|
|
89
|
+
cf_token_array_t tokens;
|
|
90
|
+
bool unexpected_eof; /* unexpected multi-line comment eof */
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
EXPORT void cf_lexer_init(struct cf_lexer *lex);
|
|
94
|
+
EXPORT void cf_lexer_free(struct cf_lexer *lex);
|
|
95
|
+
|
|
96
|
+
static inline struct cf_token *cf_lexer_get_tokens(struct cf_lexer *lex)
|
|
97
|
+
{
|
|
98
|
+
return lex->tokens.array;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
EXPORT bool cf_lexer_lex(struct cf_lexer *lex, const char *str, const char *file);
|
|
102
|
+
|
|
103
|
+
/* ------------------------------------------------------------------------- */
|
|
104
|
+
/* c-family preprocessor definition */
|
|
105
|
+
|
|
106
|
+
struct cf_def {
|
|
107
|
+
struct cf_token name;
|
|
108
|
+
cf_token_array_t params;
|
|
109
|
+
cf_token_array_t tokens;
|
|
110
|
+
bool macro;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
static inline void cf_def_init(struct cf_def *cfd)
|
|
114
|
+
{
|
|
115
|
+
cf_token_clear(&cfd->name);
|
|
116
|
+
da_init(cfd->params);
|
|
117
|
+
da_init(cfd->tokens);
|
|
118
|
+
cfd->macro = false;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
static inline void cf_def_addparam(struct cf_def *cfd, struct cf_token *param)
|
|
122
|
+
{
|
|
123
|
+
da_push_back(cfd->params, param);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
static inline void cf_def_addtoken(struct cf_def *cfd, struct cf_token *token)
|
|
127
|
+
{
|
|
128
|
+
da_push_back(cfd->tokens, token);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
static inline struct cf_token *cf_def_getparam(const struct cf_def *cfd, size_t idx)
|
|
132
|
+
{
|
|
133
|
+
return cfd->params.array + idx;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
static inline void cf_def_free(struct cf_def *cfd)
|
|
137
|
+
{
|
|
138
|
+
cf_token_clear(&cfd->name);
|
|
139
|
+
da_free(cfd->params);
|
|
140
|
+
da_free(cfd->tokens);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* ------------------------------------------------------------------------- */
|
|
144
|
+
/*
|
|
145
|
+
* C-family preprocessor
|
|
146
|
+
*
|
|
147
|
+
* This preprocessor allows for standard c-style preprocessor directives
|
|
148
|
+
* to be applied to source text, such as:
|
|
149
|
+
*
|
|
150
|
+
* + #include
|
|
151
|
+
* + #define/#undef
|
|
152
|
+
* + #ifdef/#ifndef/#if/#elif/#else/#endif
|
|
153
|
+
*
|
|
154
|
+
* Still left to implement (TODO):
|
|
155
|
+
* + #if/#elif
|
|
156
|
+
* + "defined" preprocessor keyword
|
|
157
|
+
* + system includes
|
|
158
|
+
* + variadic macros
|
|
159
|
+
* + custom callbacks (for things like pragma)
|
|
160
|
+
* + option to exclude features such as #import, variadic macros, and other
|
|
161
|
+
* features for certain language implementations
|
|
162
|
+
* + macro parameter string operator #
|
|
163
|
+
* + macro parameter token concatenation operator ##
|
|
164
|
+
* + restricted macros
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
struct cf_preprocessor {
|
|
168
|
+
struct cf_lexer *lex;
|
|
169
|
+
struct error_data *ed;
|
|
170
|
+
DARRAY(struct cf_def) defines;
|
|
171
|
+
DARRAY(char *) sys_include_dirs;
|
|
172
|
+
DARRAY(struct cf_lexer) dependencies;
|
|
173
|
+
cf_token_array_t tokens;
|
|
174
|
+
bool ignore_state;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
EXPORT void cf_preprocessor_init(struct cf_preprocessor *pp);
|
|
178
|
+
EXPORT void cf_preprocessor_free(struct cf_preprocessor *pp);
|
|
179
|
+
|
|
180
|
+
EXPORT bool cf_preprocess(struct cf_preprocessor *pp, struct cf_lexer *lex, struct error_data *ed);
|
|
181
|
+
|
|
182
|
+
static inline void cf_preprocessor_add_sys_include_dir(struct cf_preprocessor *pp, const char *include_dir)
|
|
183
|
+
{
|
|
184
|
+
char *str = bstrdup(include_dir);
|
|
185
|
+
if (include_dir)
|
|
186
|
+
da_push_back(pp->sys_include_dirs, &str);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
EXPORT void cf_preprocessor_add_def(struct cf_preprocessor *pp, struct cf_def *def);
|
|
190
|
+
EXPORT void cf_preprocessor_remove_def(struct cf_preprocessor *pp, const char *def_name);
|
|
191
|
+
|
|
192
|
+
static inline struct cf_token *cf_preprocessor_get_tokens(struct cf_preprocessor *pp)
|
|
193
|
+
{
|
|
194
|
+
return pp->tokens.array;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
#ifdef __cplusplus
|
|
198
|
+
}
|
|
199
|
+
#endif
|