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,100 @@
|
|
|
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
|
+
/******************************************************************************
|
|
19
|
+
The MIT License (MIT)
|
|
20
|
+
|
|
21
|
+
Copyright (c) 2011-2019 Microsoft Corp
|
|
22
|
+
|
|
23
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
|
24
|
+
software and associated documentation files (the "Software"), to deal in the Software
|
|
25
|
+
without restriction, including without limitation the rights to use, copy, modify,
|
|
26
|
+
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
27
|
+
permit persons to whom the Software is furnished to do so, subject to the following
|
|
28
|
+
conditions:
|
|
29
|
+
|
|
30
|
+
The above copyright notice and this permission notice shall be included in all copies
|
|
31
|
+
or substantial portions of the Software.
|
|
32
|
+
|
|
33
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
34
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
35
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
36
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
37
|
+
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
|
38
|
+
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
39
|
+
******************************************************************************/
|
|
40
|
+
|
|
41
|
+
#pragma once
|
|
42
|
+
|
|
43
|
+
#include "math-defs.h"
|
|
44
|
+
|
|
45
|
+
#ifdef __cplusplus
|
|
46
|
+
extern "C" {
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
struct half {
|
|
50
|
+
uint16_t u;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/* adapted from DirectXMath XMConvertFloatToHalf */
|
|
54
|
+
static inline struct half half_from_float(float f)
|
|
55
|
+
{
|
|
56
|
+
uint32_t Result;
|
|
57
|
+
|
|
58
|
+
uint32_t IValue;
|
|
59
|
+
memcpy(&IValue, &f, sizeof(IValue));
|
|
60
|
+
uint32_t Sign = (IValue & 0x80000000U) >> 16U;
|
|
61
|
+
IValue = IValue & 0x7FFFFFFFU; // Hack off the sign
|
|
62
|
+
|
|
63
|
+
if (IValue > 0x477FE000U) {
|
|
64
|
+
// The number is too large to be represented as a half. Saturate to infinity.
|
|
65
|
+
if (((IValue & 0x7F800000) == 0x7F800000) && ((IValue & 0x7FFFFF) != 0)) {
|
|
66
|
+
Result = 0x7FFF; // NAN
|
|
67
|
+
} else {
|
|
68
|
+
Result = 0x7C00U; // INF
|
|
69
|
+
}
|
|
70
|
+
} else if (!IValue) {
|
|
71
|
+
Result = 0;
|
|
72
|
+
} else {
|
|
73
|
+
if (IValue < 0x38800000U) {
|
|
74
|
+
// The number is too small to be represented as a normalized half.
|
|
75
|
+
// Convert it to a denormalized value.
|
|
76
|
+
uint32_t Shift = 113U - (IValue >> 23U);
|
|
77
|
+
IValue = (0x800000U | (IValue & 0x7FFFFFU)) >> Shift;
|
|
78
|
+
} else {
|
|
79
|
+
// Rebias the exponent to represent the value as a normalized half.
|
|
80
|
+
IValue += 0xC8000000U;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Result = ((IValue + 0x0FFFU + ((IValue >> 13U) & 1U)) >> 13U) & 0x7FFFU;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
struct half h;
|
|
87
|
+
h.u = (uint16_t)(Result | Sign);
|
|
88
|
+
return h;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static inline struct half half_from_bits(uint16_t u)
|
|
92
|
+
{
|
|
93
|
+
struct half h;
|
|
94
|
+
h.u = u;
|
|
95
|
+
return h;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#ifdef __cplusplus
|
|
99
|
+
}
|
|
100
|
+
#endif
|
|
@@ -0,0 +1,124 @@
|
|
|
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 "graphics.h"
|
|
21
|
+
#include "libnsgif/libnsgif.h"
|
|
22
|
+
|
|
23
|
+
#ifdef __cplusplus
|
|
24
|
+
extern "C" {
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
struct gs_image_file {
|
|
28
|
+
gs_texture_t *texture;
|
|
29
|
+
enum gs_color_format format;
|
|
30
|
+
uint32_t cx;
|
|
31
|
+
uint32_t cy;
|
|
32
|
+
bool is_animated_gif;
|
|
33
|
+
bool frame_updated;
|
|
34
|
+
bool loaded;
|
|
35
|
+
|
|
36
|
+
gif_animation gif;
|
|
37
|
+
uint8_t *gif_data;
|
|
38
|
+
uint8_t **animation_frame_cache;
|
|
39
|
+
uint8_t *animation_frame_data;
|
|
40
|
+
uint64_t cur_time;
|
|
41
|
+
int cur_frame;
|
|
42
|
+
int cur_loop;
|
|
43
|
+
int last_decoded_frame;
|
|
44
|
+
|
|
45
|
+
uint8_t *texture_data;
|
|
46
|
+
gif_bitmap_callback_vt bitmap_callbacks;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
struct gs_image_file2 {
|
|
50
|
+
struct gs_image_file image;
|
|
51
|
+
uint64_t mem_usage;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
struct gs_image_file3 {
|
|
55
|
+
struct gs_image_file2 image2;
|
|
56
|
+
enum gs_image_alpha_mode alpha_mode;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
struct gs_image_file4 {
|
|
60
|
+
struct gs_image_file3 image3;
|
|
61
|
+
enum gs_color_space space;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
typedef struct gs_image_file gs_image_file_t;
|
|
65
|
+
typedef struct gs_image_file2 gs_image_file2_t;
|
|
66
|
+
typedef struct gs_image_file3 gs_image_file3_t;
|
|
67
|
+
typedef struct gs_image_file4 gs_image_file4_t;
|
|
68
|
+
|
|
69
|
+
EXPORT void gs_image_file_init(gs_image_file_t *image, const char *file);
|
|
70
|
+
EXPORT void gs_image_file_free(gs_image_file_t *image);
|
|
71
|
+
|
|
72
|
+
EXPORT void gs_image_file_init_texture(gs_image_file_t *image);
|
|
73
|
+
EXPORT bool gs_image_file_tick(gs_image_file_t *image, uint64_t elapsed_time_ns);
|
|
74
|
+
EXPORT void gs_image_file_update_texture(gs_image_file_t *image);
|
|
75
|
+
|
|
76
|
+
EXPORT void gs_image_file2_init(gs_image_file2_t *if2, const char *file);
|
|
77
|
+
|
|
78
|
+
EXPORT bool gs_image_file2_tick(gs_image_file2_t *if2, uint64_t elapsed_time_ns);
|
|
79
|
+
EXPORT void gs_image_file2_update_texture(gs_image_file2_t *if2);
|
|
80
|
+
|
|
81
|
+
EXPORT void gs_image_file3_init(gs_image_file3_t *if3, const char *file, enum gs_image_alpha_mode alpha_mode);
|
|
82
|
+
|
|
83
|
+
EXPORT bool gs_image_file3_tick(gs_image_file3_t *if3, uint64_t elapsed_time_ns);
|
|
84
|
+
EXPORT void gs_image_file3_update_texture(gs_image_file3_t *if3);
|
|
85
|
+
|
|
86
|
+
EXPORT void gs_image_file4_init(gs_image_file4_t *if4, const char *file, enum gs_image_alpha_mode alpha_mode);
|
|
87
|
+
|
|
88
|
+
EXPORT bool gs_image_file4_tick(gs_image_file4_t *if4, uint64_t elapsed_time_ns);
|
|
89
|
+
EXPORT void gs_image_file4_update_texture(gs_image_file4_t *if4);
|
|
90
|
+
|
|
91
|
+
static inline void gs_image_file2_free(gs_image_file2_t *if2)
|
|
92
|
+
{
|
|
93
|
+
gs_image_file_free(&if2->image);
|
|
94
|
+
if2->mem_usage = 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static inline void gs_image_file2_init_texture(gs_image_file2_t *if2)
|
|
98
|
+
{
|
|
99
|
+
gs_image_file_init_texture(&if2->image);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
static inline void gs_image_file3_free(gs_image_file3_t *if3)
|
|
103
|
+
{
|
|
104
|
+
gs_image_file2_free(&if3->image2);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static inline void gs_image_file3_init_texture(gs_image_file3_t *if3)
|
|
108
|
+
{
|
|
109
|
+
gs_image_file2_init_texture(&if3->image2);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static inline void gs_image_file4_free(gs_image_file4_t *if4)
|
|
113
|
+
{
|
|
114
|
+
gs_image_file3_free(&if4->image3);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static inline void gs_image_file4_init_texture(gs_image_file4_t *if4)
|
|
118
|
+
{
|
|
119
|
+
gs_image_file3_init_texture(&if4->image3);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
#ifdef __cplusplus
|
|
123
|
+
}
|
|
124
|
+
#endif
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
/* TODO: incomplete/may not be necessary */
|
|
21
|
+
|
|
22
|
+
#ifdef __cplusplus
|
|
23
|
+
extern "C" {
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
/* wrapped opaque data types */
|
|
27
|
+
struct input_subsystem;
|
|
28
|
+
typedef struct input_subsystem input_t;
|
|
29
|
+
|
|
30
|
+
EXPORT int input_getbuttonstate(input_t *input, uint32_t button);
|
|
31
|
+
|
|
32
|
+
#ifdef __cplusplus
|
|
33
|
+
}
|
|
34
|
+
#endif
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2004 Richard Wilson <richard.wilson@netsurf-browser.org>
|
|
3
|
+
* Copyright 2008 Sean Fox <dyntryx@gmail.com>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of NetSurf's libnsgif, http://www.netsurf-browser.org/
|
|
6
|
+
* Licenced under the MIT License,
|
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** \file
|
|
11
|
+
* Progressive animated GIF file decoding (interface).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
#ifndef _LIBNSGIF_H_
|
|
15
|
+
#define _LIBNSGIF_H_
|
|
16
|
+
|
|
17
|
+
#include <stdbool.h>
|
|
18
|
+
#include <inttypes.h>
|
|
19
|
+
|
|
20
|
+
#if defined(__cplusplus)
|
|
21
|
+
extern "C"
|
|
22
|
+
{
|
|
23
|
+
#endif
|
|
24
|
+
/* Error return values
|
|
25
|
+
*/
|
|
26
|
+
typedef enum {
|
|
27
|
+
GIF_WORKING = 1,
|
|
28
|
+
GIF_OK = 0,
|
|
29
|
+
GIF_INSUFFICIENT_FRAME_DATA = -1,
|
|
30
|
+
GIF_FRAME_DATA_ERROR = -2,
|
|
31
|
+
GIF_INSUFFICIENT_DATA = -3,
|
|
32
|
+
GIF_DATA_ERROR = -4,
|
|
33
|
+
GIF_INSUFFICIENT_MEMORY = -5,
|
|
34
|
+
GIF_FRAME_NO_DISPLAY = -6,
|
|
35
|
+
GIF_END_OF_FRAME = -7
|
|
36
|
+
} gif_result;
|
|
37
|
+
|
|
38
|
+
/* Maximum LZW bits available
|
|
39
|
+
*/
|
|
40
|
+
#define GIF_MAX_LZW 12
|
|
41
|
+
|
|
42
|
+
/* The GIF frame data
|
|
43
|
+
*/
|
|
44
|
+
typedef struct gif_frame {
|
|
45
|
+
bool display; /**< whether the frame should be displayed/animated */
|
|
46
|
+
unsigned int frame_delay; /**< delay (in 100th second intervals) before animating the frame */
|
|
47
|
+
/** Internal members are listed below
|
|
48
|
+
*/
|
|
49
|
+
unsigned int frame_pointer; /**< offset (in bytes) to the GIF frame data */
|
|
50
|
+
bool virgin; /**< whether the frame has previously been used */
|
|
51
|
+
bool opaque; /**< whether the frame is totally opaque */
|
|
52
|
+
bool redraw_required; /**< whether a forcable screen redraw is required */
|
|
53
|
+
unsigned char disposal_method; /**< how the previous frame should be disposed; affects plotting */
|
|
54
|
+
bool transparency; /**< whether we acknowledge transparency */
|
|
55
|
+
unsigned char transparency_index; /**< the index designating a transparent pixel */
|
|
56
|
+
unsigned int redraw_x; /**< x co-ordinate of redraw rectangle */
|
|
57
|
+
unsigned int redraw_y; /**< y co-ordinate of redraw rectangle */
|
|
58
|
+
unsigned int redraw_width; /**< width of redraw rectangle */
|
|
59
|
+
unsigned int redraw_height; /**< height of redraw rectangle */
|
|
60
|
+
} gif_frame;
|
|
61
|
+
|
|
62
|
+
/* API for Bitmap callbacks
|
|
63
|
+
*/
|
|
64
|
+
typedef void* (*gif_bitmap_cb_create)(int width, int height);
|
|
65
|
+
typedef void (*gif_bitmap_cb_destroy)(void *bitmap);
|
|
66
|
+
typedef unsigned char* (*gif_bitmap_cb_get_buffer)(void *bitmap);
|
|
67
|
+
typedef void (*gif_bitmap_cb_set_opaque)(void *bitmap, bool opaque);
|
|
68
|
+
typedef bool (*gif_bitmap_cb_test_opaque)(void *bitmap);
|
|
69
|
+
typedef void (*gif_bitmap_cb_modified)(void *bitmap);
|
|
70
|
+
|
|
71
|
+
/* The Bitmap callbacks function table
|
|
72
|
+
*/
|
|
73
|
+
typedef struct gif_bitmap_callback_vt {
|
|
74
|
+
gif_bitmap_cb_create bitmap_create; /**< Create a bitmap. */
|
|
75
|
+
gif_bitmap_cb_destroy bitmap_destroy; /**< Free a bitmap. */
|
|
76
|
+
gif_bitmap_cb_get_buffer bitmap_get_buffer; /**< Return a pointer to the pixel data in a bitmap. */
|
|
77
|
+
/** Members below are optional
|
|
78
|
+
*/
|
|
79
|
+
gif_bitmap_cb_set_opaque bitmap_set_opaque; /**< Sets whether a bitmap should be plotted opaque. */
|
|
80
|
+
gif_bitmap_cb_test_opaque bitmap_test_opaque; /**< Tests whether a bitmap has an opaque alpha channel. */
|
|
81
|
+
gif_bitmap_cb_modified bitmap_modified; /**< The bitmap image has changed, so flush any persistent cache. */
|
|
82
|
+
} gif_bitmap_callback_vt;
|
|
83
|
+
|
|
84
|
+
/* The GIF animation data
|
|
85
|
+
*/
|
|
86
|
+
typedef struct gif_animation {
|
|
87
|
+
gif_bitmap_callback_vt bitmap_callbacks; /**< callbacks for bitmap functions */
|
|
88
|
+
unsigned char *gif_data; /**< pointer to GIF data */
|
|
89
|
+
unsigned int width; /**< width of GIF (may increase during decoding) */
|
|
90
|
+
unsigned int height; /**< height of GIF (may increase during decoding) */
|
|
91
|
+
unsigned int frame_count; /**< number of frames decoded */
|
|
92
|
+
unsigned int frame_count_partial; /**< number of frames partially decoded */
|
|
93
|
+
gif_frame *frames; /**< decoded frames */
|
|
94
|
+
int decoded_frame; /**< current frame decoded to bitmap */
|
|
95
|
+
void *frame_image; /**< currently decoded image; stored as bitmap from bitmap_create callback */
|
|
96
|
+
int loop_count; /**< number of times to loop animation */
|
|
97
|
+
gif_result current_error; /**< current error type, or 0 for none*/
|
|
98
|
+
/** Internal members are listed below
|
|
99
|
+
*/
|
|
100
|
+
unsigned int buffer_position; /**< current index into GIF data */
|
|
101
|
+
unsigned int buffer_size; /**< total number of bytes of GIF data available */
|
|
102
|
+
unsigned int frame_holders; /**< current number of frame holders */
|
|
103
|
+
unsigned int background_index; /**< index in the colour table for the background colour */
|
|
104
|
+
unsigned int aspect_ratio; /**< image aspect ratio (ignored) */
|
|
105
|
+
unsigned int colour_table_size; /**< size of colour table (in entries) */
|
|
106
|
+
bool global_colours; /**< whether the GIF has a global colour table */
|
|
107
|
+
unsigned int *global_colour_table; /**< global colour table */
|
|
108
|
+
unsigned int *local_colour_table; /**< local colour table */
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
/* General LZW values. They are NO LONGER shared for all GIFs being decoded BECAUSE
|
|
112
|
+
THAT IS A TERRIBLE IDEA TO SAVE 10Kb or so per GIF.
|
|
113
|
+
*/
|
|
114
|
+
unsigned char buf[4];
|
|
115
|
+
unsigned char *direct;
|
|
116
|
+
|
|
117
|
+
int table[2][(1 << GIF_MAX_LZW)];
|
|
118
|
+
unsigned char stack[(1 << GIF_MAX_LZW) * 2];
|
|
119
|
+
unsigned char *stack_pointer;
|
|
120
|
+
int code_size, set_code_size;
|
|
121
|
+
int max_code, max_code_size;
|
|
122
|
+
int clear_code, end_code;
|
|
123
|
+
int curbit, lastbit, last_byte;
|
|
124
|
+
int firstcode, oldcode;
|
|
125
|
+
bool zero_data_block;
|
|
126
|
+
bool get_done;
|
|
127
|
+
|
|
128
|
+
/* Whether to clear the decoded image rather than plot
|
|
129
|
+
*/
|
|
130
|
+
bool clear_image;
|
|
131
|
+
} gif_animation;
|
|
132
|
+
|
|
133
|
+
void gif_create(gif_animation *gif, gif_bitmap_callback_vt *bitmap_callbacks);
|
|
134
|
+
gif_result gif_initialise(gif_animation *gif, size_t size, unsigned char *data);
|
|
135
|
+
gif_result gif_decode_frame(gif_animation *gif, unsigned int frame);
|
|
136
|
+
void gif_finalise(gif_animation *gif);
|
|
137
|
+
|
|
138
|
+
#if defined(__cplusplus)
|
|
139
|
+
};
|
|
140
|
+
#endif
|
|
141
|
+
|
|
142
|
+
#endif
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (C) 2023 by Lain Bailey <lain@obsproject.com>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU General Public License as published by
|
|
6
|
+
the Free Software Foundation, either version 2 of the License, or
|
|
7
|
+
(at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
******************************************************************************/
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
#include "../util/c99defs.h"
|
|
21
|
+
#include <math.h>
|
|
22
|
+
|
|
23
|
+
#ifdef __cplusplus
|
|
24
|
+
extern "C" {
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
#ifndef M_PI
|
|
28
|
+
#define M_PI 3.1415926535897932384626433832795f
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
#define RAD(val) ((val) * 0.0174532925199432957692369076848f)
|
|
32
|
+
#define DEG(val) ((val) * 57.295779513082320876798154814105f)
|
|
33
|
+
#define LARGE_EPSILON 1e-2f
|
|
34
|
+
#define EPSILON 1e-4f
|
|
35
|
+
#define TINY_EPSILON 1e-5f
|
|
36
|
+
#define M_INFINITE 3.4e38f
|
|
37
|
+
|
|
38
|
+
static inline bool close_float(float f1, float f2, float precision)
|
|
39
|
+
{
|
|
40
|
+
return fabsf(f1 - f2) <= precision;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#ifdef __cplusplus
|
|
44
|
+
}
|
|
45
|
+
#endif
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
/*
|
|
23
|
+
* A few general math functions that I couldn't really decide where to put.
|
|
24
|
+
*
|
|
25
|
+
* Polar/Cart conversion, torque functions (for smooth movement), percentage,
|
|
26
|
+
* random floats.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
#ifdef __cplusplus
|
|
30
|
+
extern "C" {
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
struct vec2;
|
|
34
|
+
struct vec3;
|
|
35
|
+
|
|
36
|
+
EXPORT void polar_to_cart(struct vec3 *dst, const struct vec3 *v);
|
|
37
|
+
EXPORT void cart_to_polar(struct vec3 *dst, const struct vec3 *v);
|
|
38
|
+
|
|
39
|
+
EXPORT void norm_to_polar(struct vec2 *dst, const struct vec3 *norm);
|
|
40
|
+
EXPORT void polar_to_norm(struct vec3 *dst, const struct vec2 *polar);
|
|
41
|
+
|
|
42
|
+
EXPORT float calc_torquef(float val1, float val2, float torque, float min_adjust, float t);
|
|
43
|
+
|
|
44
|
+
EXPORT void calc_torque(struct vec3 *dst, const struct vec3 *v1, const struct vec3 *v2, float torque, float min_adjust,
|
|
45
|
+
float t);
|
|
46
|
+
|
|
47
|
+
static inline float get_percentage(float start, float end, float mid)
|
|
48
|
+
{
|
|
49
|
+
return (mid - start) / (end - start);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static inline float get_percentagei(int start, int end, int mid)
|
|
53
|
+
{
|
|
54
|
+
return (float)(mid - start) / (float)(end - start);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
EXPORT float rand_float(int positive_only);
|
|
58
|
+
|
|
59
|
+
#ifdef __cplusplus
|
|
60
|
+
}
|
|
61
|
+
#endif
|
|
@@ -0,0 +1,98 @@
|
|
|
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 "vec3.h"
|
|
21
|
+
#include "axisang.h"
|
|
22
|
+
|
|
23
|
+
/* 3x4 Matrix */
|
|
24
|
+
|
|
25
|
+
#ifdef __cplusplus
|
|
26
|
+
extern "C" {
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
struct matrix4;
|
|
30
|
+
|
|
31
|
+
struct matrix3 {
|
|
32
|
+
struct vec3 x;
|
|
33
|
+
struct vec3 y;
|
|
34
|
+
struct vec3 z;
|
|
35
|
+
struct vec3 t;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
static inline void matrix3_copy(struct matrix3 *dst, const struct matrix3 *m)
|
|
39
|
+
{
|
|
40
|
+
vec3_copy(&dst->x, &m->x);
|
|
41
|
+
vec3_copy(&dst->y, &m->y);
|
|
42
|
+
vec3_copy(&dst->z, &m->z);
|
|
43
|
+
vec3_copy(&dst->t, &m->t);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static inline void matrix3_identity(struct matrix3 *dst)
|
|
47
|
+
{
|
|
48
|
+
vec3_zero(&dst->x);
|
|
49
|
+
vec3_zero(&dst->y);
|
|
50
|
+
vec3_zero(&dst->z);
|
|
51
|
+
vec3_zero(&dst->t);
|
|
52
|
+
dst->x.x = dst->y.y = dst->z.z = 1.0f;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
EXPORT void matrix3_from_quat(struct matrix3 *dst, const struct quat *q);
|
|
56
|
+
EXPORT void matrix3_from_axisang(struct matrix3 *dst, const struct axisang *aa);
|
|
57
|
+
EXPORT void matrix3_from_matrix4(struct matrix3 *dst, const struct matrix4 *m);
|
|
58
|
+
|
|
59
|
+
EXPORT void matrix3_mul(struct matrix3 *dst, const struct matrix3 *m1, const struct matrix3 *m2);
|
|
60
|
+
static inline void matrix3_translate(struct matrix3 *dst, const struct matrix3 *m, const struct vec3 *v)
|
|
61
|
+
{
|
|
62
|
+
vec3_sub(&dst->t, &m->t, v);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
EXPORT void matrix3_rotate(struct matrix3 *dst, const struct matrix3 *m, const struct quat *q);
|
|
66
|
+
EXPORT void matrix3_rotate_aa(struct matrix3 *dst, const struct matrix3 *m, const struct axisang *aa);
|
|
67
|
+
EXPORT void matrix3_scale(struct matrix3 *dst, const struct matrix3 *m, const struct vec3 *v);
|
|
68
|
+
EXPORT void matrix3_transpose(struct matrix3 *dst, const struct matrix3 *m);
|
|
69
|
+
EXPORT void matrix3_inv(struct matrix3 *dst, const struct matrix3 *m);
|
|
70
|
+
|
|
71
|
+
EXPORT void matrix3_mirror(struct matrix3 *dst, const struct matrix3 *m, const struct plane *p);
|
|
72
|
+
EXPORT void matrix3_mirrorv(struct matrix3 *dst, const struct matrix3 *m, const struct vec3 *v);
|
|
73
|
+
|
|
74
|
+
static inline void matrix3_translate3f(struct matrix3 *dst, const struct matrix3 *m, float x, float y, float z)
|
|
75
|
+
{
|
|
76
|
+
struct vec3 v;
|
|
77
|
+
vec3_set(&v, x, y, z);
|
|
78
|
+
matrix3_translate(dst, m, &v);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
static inline void matrix3_rotate_aa4f(struct matrix3 *dst, const struct matrix3 *m, float x, float y, float z,
|
|
82
|
+
float rot)
|
|
83
|
+
{
|
|
84
|
+
struct axisang aa;
|
|
85
|
+
axisang_set(&aa, x, y, z, rot);
|
|
86
|
+
matrix3_rotate_aa(dst, m, &aa);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static inline void matrix3_scale3f(struct matrix3 *dst, const struct matrix3 *m, float x, float y, float z)
|
|
90
|
+
{
|
|
91
|
+
struct vec3 v;
|
|
92
|
+
vec3_set(&v, x, y, z);
|
|
93
|
+
matrix3_scale(dst, m, &v);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
#ifdef __cplusplus
|
|
97
|
+
}
|
|
98
|
+
#endif
|