noobs 0.0.149 → 0.0.157
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/binding.gyp +1 -1
- package/dist/noobs.node +0 -0
- package/package.json +1 -1
- package/src/obs_interface.cpp +32 -28
- package/src/utils.cpp +39 -0
- package/src/utils.h +1 -0
package/binding.gyp
CHANGED
package/dist/noobs.node
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/obs_interface.cpp
CHANGED
|
@@ -14,7 +14,6 @@ void call_jscb(Napi::Env env, Napi::Function cb, SignalData* sd) {
|
|
|
14
14
|
obj.Set("type", Napi::String::New(env, sd->type));
|
|
15
15
|
obj.Set("id", Napi::String::New(env, sd->id));
|
|
16
16
|
obj.Set("code", Napi::Number::New(env, sd->code));
|
|
17
|
-
|
|
18
17
|
|
|
19
18
|
if (sd->value.has_value()) {
|
|
20
19
|
obj.Set("value", Napi::Number::New(env, sd->value.value()));
|
|
@@ -61,22 +60,6 @@ void ObsInterface::list_output_types()
|
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
bool log_adapter(void *param, const char *node, uint32_t idx)
|
|
65
|
-
{
|
|
66
|
-
blog(LOG_INFO, " - %d: %s", idx, node);
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
void list_adapters()
|
|
71
|
-
{
|
|
72
|
-
// Pretty sure OBS logs all this stuff anyway but do it ourselves for good measure.
|
|
73
|
-
obs_enter_graphics();
|
|
74
|
-
uint32_t count = gs_get_adapter_count();
|
|
75
|
-
blog(LOG_INFO, "Adapter count: %d", count);
|
|
76
|
-
gs_enum_adapters(log_adapter, NULL);
|
|
77
|
-
obs_leave_graphics();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
63
|
void ObsInterface::load_module(const char* module, const char* data, bool allowFail) {
|
|
81
64
|
blog(LOG_INFO, "Loading module: %s", module);
|
|
82
65
|
blog(LOG_INFO, "Data path: %s", data);
|
|
@@ -153,7 +136,7 @@ int ObsInterface::reset_video(int fps, int width, int height) {
|
|
|
153
136
|
ovi.range = VIDEO_RANGE_PARTIAL;
|
|
154
137
|
ovi.scale_type = OBS_SCALE_BILINEAR;
|
|
155
138
|
ovi.adapter = 0;
|
|
156
|
-
ovi.gpu_conversion =
|
|
139
|
+
ovi.gpu_conversion = true;
|
|
157
140
|
ovi.graphics_module = "libobs-d3d11.dll";
|
|
158
141
|
|
|
159
142
|
return obs_reset_video(&ovi);
|
|
@@ -236,11 +219,11 @@ void ObsInterface::init_obs(const std::string& distPath) {
|
|
|
236
219
|
}
|
|
237
220
|
|
|
238
221
|
obs_post_load_modules();
|
|
222
|
+
register_preview_window_class();
|
|
239
223
|
|
|
240
224
|
list_encoders();
|
|
241
225
|
list_source_types();
|
|
242
226
|
list_output_types();
|
|
243
|
-
list_adapters();
|
|
244
227
|
|
|
245
228
|
blog(LOG_INFO, "Initializing complete");
|
|
246
229
|
}
|
|
@@ -770,14 +753,14 @@ void ObsInterface::initPreview(HWND parent) {
|
|
|
770
753
|
if (!preview_hwnd) {
|
|
771
754
|
blog(LOG_INFO, "Creating preview child window");
|
|
772
755
|
|
|
773
|
-
preview_hwnd =
|
|
774
|
-
0,
|
|
775
|
-
"
|
|
776
|
-
"OBS Preview", // Window name
|
|
777
|
-
|
|
756
|
+
preview_hwnd = CreateWindowEx(
|
|
757
|
+
0,
|
|
758
|
+
TEXT("PreviewWindowClass"), // Window class we already registered earlier
|
|
759
|
+
TEXT("OBS Preview"), // Window name
|
|
760
|
+
WS_POPUP,
|
|
778
761
|
0, 0, // Initial position (x, y)
|
|
779
762
|
0, 0, // Initial size (width, height)
|
|
780
|
-
|
|
763
|
+
NULL, // No parent yet
|
|
781
764
|
NULL, // No menu
|
|
782
765
|
GetModuleHandle(NULL),
|
|
783
766
|
NULL
|
|
@@ -787,6 +770,17 @@ void ObsInterface::initPreview(HWND parent) {
|
|
|
787
770
|
blog(LOG_ERROR, "Failed to create preview child window");
|
|
788
771
|
return;
|
|
789
772
|
}
|
|
773
|
+
|
|
774
|
+
SetParent(preview_hwnd, parent);
|
|
775
|
+
|
|
776
|
+
LONG_PTR style = GetWindowLongPtr(preview_hwnd, GWL_STYLE);
|
|
777
|
+
style &= ~WS_POPUP;
|
|
778
|
+
style |= WS_CHILD;
|
|
779
|
+
SetWindowLongPtr(preview_hwnd, GWL_STYLE, style);
|
|
780
|
+
|
|
781
|
+
LONG_PTR exStyle = GetWindowLongPtr(preview_hwnd, GWL_EXSTYLE);
|
|
782
|
+
exStyle |= WS_EX_TRANSPARENT;
|
|
783
|
+
SetWindowLongPtr(preview_hwnd, GWL_EXSTYLE, exStyle);
|
|
790
784
|
}
|
|
791
785
|
|
|
792
786
|
if (!display) {
|
|
@@ -817,11 +811,16 @@ void ObsInterface::initPreview(HWND parent) {
|
|
|
817
811
|
void ObsInterface::configurePreview(int x, int y, int width, int height) {
|
|
818
812
|
blog(LOG_INFO, "ObsInterface::configurePreview");
|
|
819
813
|
|
|
820
|
-
if (!preview_hwnd
|
|
814
|
+
if (!preview_hwnd) {
|
|
821
815
|
blog(LOG_ERROR, "Preview window not initialized");
|
|
822
816
|
return;
|
|
823
817
|
}
|
|
824
818
|
|
|
819
|
+
if (!display) {
|
|
820
|
+
blog(LOG_ERROR, "Preview display not initialized");
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
|
|
825
824
|
blog(LOG_INFO, "Moving preview child window to (%d, %d) with size (%d x %d)", x, y, width, height);
|
|
826
825
|
|
|
827
826
|
// Resize and move the existing child window.
|
|
@@ -845,11 +844,16 @@ void ObsInterface::configurePreview(int x, int y, int width, int height) {
|
|
|
845
844
|
void ObsInterface::showPreview() {
|
|
846
845
|
blog(LOG_INFO, "ObsInterface::showPreview");
|
|
847
846
|
|
|
848
|
-
if (!preview_hwnd
|
|
847
|
+
if (!preview_hwnd) {
|
|
849
848
|
blog(LOG_ERROR, "Preview window not initialized");
|
|
850
849
|
return;
|
|
851
850
|
}
|
|
852
851
|
|
|
852
|
+
if (!display) {
|
|
853
|
+
blog(LOG_ERROR, "Preview display not initialized");
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
|
|
853
857
|
ShowWindow(preview_hwnd, SW_SHOW);
|
|
854
858
|
obs_display_set_enabled(display, true);
|
|
855
859
|
}
|
|
@@ -867,7 +871,7 @@ void ObsInterface::disablePreview() {
|
|
|
867
871
|
blog(LOG_INFO, "ObsInterface::disablePreview");
|
|
868
872
|
|
|
869
873
|
if (!display) {
|
|
870
|
-
blog(LOG_ERROR, "Preview
|
|
874
|
+
blog(LOG_ERROR, "Preview display not initialized");
|
|
871
875
|
return;
|
|
872
876
|
}
|
|
873
877
|
|
package/src/utils.cpp
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
#include <iomanip>
|
|
6
6
|
#include <sstream>
|
|
7
7
|
#include "utils.h"
|
|
8
|
+
#include <windows.h>
|
|
8
9
|
|
|
9
10
|
void log_handler(int lvl, const char *msg, va_list args, void *p) {
|
|
10
11
|
static std::ofstream logFile;
|
|
@@ -381,3 +382,41 @@ std::string get_current_date_time() {
|
|
|
381
382
|
ss << std::put_time(std::localtime(&time_t), "%Y-%m-%d %H-%M-%S");
|
|
382
383
|
return ss.str();
|
|
383
384
|
}
|
|
385
|
+
|
|
386
|
+
LRESULT CALLBACK DisplayWndProc(
|
|
387
|
+
_In_ HWND hwnd,
|
|
388
|
+
_In_ UINT uMsg,
|
|
389
|
+
_In_ WPARAM wParam,
|
|
390
|
+
_In_ LPARAM lParam)
|
|
391
|
+
{
|
|
392
|
+
switch (uMsg) {
|
|
393
|
+
case WM_NCHITTEST:
|
|
394
|
+
return HTTRANSPARENT;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
void register_preview_window_class() {
|
|
401
|
+
WNDCLASSEX klass;
|
|
402
|
+
|
|
403
|
+
klass.cbSize = sizeof(WNDCLASSEX);
|
|
404
|
+
klass.style = CS_NOCLOSE | CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
|
405
|
+
klass.lpfnWndProc = DisplayWndProc;
|
|
406
|
+
klass.cbClsExtra = 0;
|
|
407
|
+
klass.cbWndExtra = 0;
|
|
408
|
+
klass.hInstance = GetModuleHandle(NULL);
|
|
409
|
+
klass.hIcon = NULL;
|
|
410
|
+
klass.hCursor = NULL;
|
|
411
|
+
klass.hbrBackground = NULL;
|
|
412
|
+
klass.lpszMenuName = NULL;
|
|
413
|
+
klass.lpszClassName = TEXT("PreviewWindowClass");
|
|
414
|
+
klass.hIconSm = NULL;
|
|
415
|
+
|
|
416
|
+
if (RegisterClassEx(&klass) == NULL) {
|
|
417
|
+
blog(LOG_ERROR, "Failed to register window class");
|
|
418
|
+
throw new std::runtime_error("Failed to register window class");
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
blog(LOG_INFO, "Registered preview window class");
|
|
422
|
+
}
|