noobs 0.0.150 → 0.0.158
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 +39 -12
- 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()));
|
|
@@ -120,7 +119,6 @@ void ObsInterface::setVideoContext(int fps, int width, int height) {
|
|
|
120
119
|
create_video_encoders();
|
|
121
120
|
}
|
|
122
121
|
|
|
123
|
-
|
|
124
122
|
int ObsInterface::reset_video(int fps, int width, int height) {
|
|
125
123
|
blog(LOG_INFO, "Reset video");
|
|
126
124
|
obs_video_info ovi = {};
|
|
@@ -140,7 +138,14 @@ int ObsInterface::reset_video(int fps, int width, int height) {
|
|
|
140
138
|
ovi.gpu_conversion = true;
|
|
141
139
|
ovi.graphics_module = "libobs-d3d11.dll";
|
|
142
140
|
|
|
143
|
-
|
|
141
|
+
int rc = obs_reset_video(&ovi);
|
|
142
|
+
|
|
143
|
+
if (rc == OBS_VIDEO_SUCCESS) {
|
|
144
|
+
// Without this HDR doesn't work.
|
|
145
|
+
obs_set_video_levels(300.0f, 1000.0f);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return rc;
|
|
144
149
|
}
|
|
145
150
|
|
|
146
151
|
bool ObsInterface::reset_audio() {
|
|
@@ -220,6 +225,7 @@ void ObsInterface::init_obs(const std::string& distPath) {
|
|
|
220
225
|
}
|
|
221
226
|
|
|
222
227
|
obs_post_load_modules();
|
|
228
|
+
register_preview_window_class();
|
|
223
229
|
|
|
224
230
|
list_encoders();
|
|
225
231
|
list_source_types();
|
|
@@ -753,14 +759,14 @@ void ObsInterface::initPreview(HWND parent) {
|
|
|
753
759
|
if (!preview_hwnd) {
|
|
754
760
|
blog(LOG_INFO, "Creating preview child window");
|
|
755
761
|
|
|
756
|
-
preview_hwnd =
|
|
757
|
-
0,
|
|
758
|
-
"
|
|
759
|
-
"OBS Preview", // Window name
|
|
760
|
-
|
|
762
|
+
preview_hwnd = CreateWindowEx(
|
|
763
|
+
0,
|
|
764
|
+
TEXT("PreviewWindowClass"), // Window class we already registered earlier
|
|
765
|
+
TEXT("OBS Preview"), // Window name
|
|
766
|
+
WS_POPUP,
|
|
761
767
|
0, 0, // Initial position (x, y)
|
|
762
768
|
0, 0, // Initial size (width, height)
|
|
763
|
-
|
|
769
|
+
NULL, // No parent yet
|
|
764
770
|
NULL, // No menu
|
|
765
771
|
GetModuleHandle(NULL),
|
|
766
772
|
NULL
|
|
@@ -770,6 +776,17 @@ void ObsInterface::initPreview(HWND parent) {
|
|
|
770
776
|
blog(LOG_ERROR, "Failed to create preview child window");
|
|
771
777
|
return;
|
|
772
778
|
}
|
|
779
|
+
|
|
780
|
+
SetParent(preview_hwnd, parent);
|
|
781
|
+
|
|
782
|
+
LONG_PTR style = GetWindowLongPtr(preview_hwnd, GWL_STYLE);
|
|
783
|
+
style &= ~WS_POPUP;
|
|
784
|
+
style |= WS_CHILD;
|
|
785
|
+
SetWindowLongPtr(preview_hwnd, GWL_STYLE, style);
|
|
786
|
+
|
|
787
|
+
LONG_PTR exStyle = GetWindowLongPtr(preview_hwnd, GWL_EXSTYLE);
|
|
788
|
+
exStyle |= WS_EX_TRANSPARENT;
|
|
789
|
+
SetWindowLongPtr(preview_hwnd, GWL_EXSTYLE, exStyle);
|
|
773
790
|
}
|
|
774
791
|
|
|
775
792
|
if (!display) {
|
|
@@ -800,11 +817,16 @@ void ObsInterface::initPreview(HWND parent) {
|
|
|
800
817
|
void ObsInterface::configurePreview(int x, int y, int width, int height) {
|
|
801
818
|
blog(LOG_INFO, "ObsInterface::configurePreview");
|
|
802
819
|
|
|
803
|
-
if (!preview_hwnd
|
|
820
|
+
if (!preview_hwnd) {
|
|
804
821
|
blog(LOG_ERROR, "Preview window not initialized");
|
|
805
822
|
return;
|
|
806
823
|
}
|
|
807
824
|
|
|
825
|
+
if (!display) {
|
|
826
|
+
blog(LOG_ERROR, "Preview display not initialized");
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
|
|
808
830
|
blog(LOG_INFO, "Moving preview child window to (%d, %d) with size (%d x %d)", x, y, width, height);
|
|
809
831
|
|
|
810
832
|
// Resize and move the existing child window.
|
|
@@ -828,11 +850,16 @@ void ObsInterface::configurePreview(int x, int y, int width, int height) {
|
|
|
828
850
|
void ObsInterface::showPreview() {
|
|
829
851
|
blog(LOG_INFO, "ObsInterface::showPreview");
|
|
830
852
|
|
|
831
|
-
if (!preview_hwnd
|
|
853
|
+
if (!preview_hwnd) {
|
|
832
854
|
blog(LOG_ERROR, "Preview window not initialized");
|
|
833
855
|
return;
|
|
834
856
|
}
|
|
835
857
|
|
|
858
|
+
if (!display) {
|
|
859
|
+
blog(LOG_ERROR, "Preview display not initialized");
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
|
|
836
863
|
ShowWindow(preview_hwnd, SW_SHOW);
|
|
837
864
|
obs_display_set_enabled(display, true);
|
|
838
865
|
}
|
|
@@ -850,7 +877,7 @@ void ObsInterface::disablePreview() {
|
|
|
850
877
|
blog(LOG_INFO, "ObsInterface::disablePreview");
|
|
851
878
|
|
|
852
879
|
if (!display) {
|
|
853
|
-
blog(LOG_ERROR, "Preview
|
|
880
|
+
blog(LOG_ERROR, "Preview display not initialized");
|
|
854
881
|
return;
|
|
855
882
|
}
|
|
856
883
|
|
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
|
+
}
|