noobs 0.0.130 → 0.0.131
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/dist/noobs.node +0 -0
- package/package.json +1 -1
- package/src/obs_interface.cpp +28 -13
- package/src/obs_interface.h +1 -0
package/dist/noobs.node
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/obs_interface.cpp
CHANGED
|
@@ -401,11 +401,12 @@ std::string ObsInterface::createSource(std::string name, std::string type) {
|
|
|
401
401
|
obs_volmeter_t *volmeter = obs_volmeter_create(OBS_FADER_CUBIC);
|
|
402
402
|
obs_volmeter_attach_source(volmeter, source);
|
|
403
403
|
|
|
404
|
-
SignalContext* ctx = new SignalContext{ this, real_name };
|
|
404
|
+
SignalContext* ctx = new SignalContext{ this, real_name };
|
|
405
405
|
obs_volmeter_add_callback(volmeter, volmeter_callback, ctx);
|
|
406
406
|
|
|
407
407
|
// Store the volmeter in the volmeters map.
|
|
408
408
|
volmeters[real_name] = volmeter;
|
|
409
|
+
volmeter_cb_ctx[real_name] = ctx; // Track this so we can free it later.
|
|
409
410
|
}
|
|
410
411
|
|
|
411
412
|
if (type == AUDIO_INPUT && force_mono) {
|
|
@@ -462,6 +463,15 @@ void ObsInterface::deleteSource(std::string name) {
|
|
|
462
463
|
volmeters.erase(name);
|
|
463
464
|
}
|
|
464
465
|
|
|
466
|
+
// Now deal with the callback context.
|
|
467
|
+
auto ctx_it = volmeter_cb_ctx.find(name);
|
|
468
|
+
|
|
469
|
+
if (ctx_it != volmeter_cb_ctx.end()) {
|
|
470
|
+
SignalContext* ctx = ctx_it->second;
|
|
471
|
+
delete ctx;
|
|
472
|
+
volmeter_cb_ctx.erase(ctx_it);
|
|
473
|
+
}
|
|
474
|
+
|
|
465
475
|
// Now deal with the source itself.
|
|
466
476
|
auto it = sources.find(name);
|
|
467
477
|
|
|
@@ -508,7 +518,6 @@ obs_data_t* ObsInterface::getSourceSettings(std::string name) {
|
|
|
508
518
|
throw std::runtime_error("Failed to get source settings!");
|
|
509
519
|
}
|
|
510
520
|
|
|
511
|
-
// obs_data_release(settings); TODO release after returning to client.
|
|
512
521
|
return settings;
|
|
513
522
|
}
|
|
514
523
|
|
|
@@ -743,8 +752,8 @@ void ObsInterface::initPreview(HWND parent) {
|
|
|
743
752
|
|
|
744
753
|
gs_init_data gs_data = {};
|
|
745
754
|
gs_data.adapter = 0;
|
|
746
|
-
gs_data.cx = 1920; //
|
|
747
|
-
gs_data.cy = 1080; //
|
|
755
|
+
gs_data.cx = 1920; // Gets overwritten when we call configurePreview().
|
|
756
|
+
gs_data.cy = 1080; // Gets overwritten when we call configurePreview().
|
|
748
757
|
gs_data.format = GS_BGRA;
|
|
749
758
|
gs_data.zsformat = GS_ZS_NONE;
|
|
750
759
|
gs_data.num_backbuffers = 1;
|
|
@@ -787,9 +796,6 @@ void ObsInterface::configurePreview(int x, int y, int width, int height) {
|
|
|
787
796
|
return;
|
|
788
797
|
}
|
|
789
798
|
|
|
790
|
-
uint32_t w, h;
|
|
791
|
-
obs_display_size(display, &w, &h); // Get the display size to match the video context.
|
|
792
|
-
blog(LOG_INFO, "Current Display size set to (%d x %d)", w, h);
|
|
793
799
|
obs_display_resize(display, width, height);
|
|
794
800
|
obs_display_set_enabled(display, true);
|
|
795
801
|
}
|
|
@@ -897,6 +903,12 @@ ObsInterface::~ObsInterface() {
|
|
|
897
903
|
volmeters.erase(kv.first);
|
|
898
904
|
}
|
|
899
905
|
|
|
906
|
+
for (auto& kv : volmeter_cb_ctx) {
|
|
907
|
+
SignalContext* ctx = kv.second;
|
|
908
|
+
delete ctx;
|
|
909
|
+
volmeter_cb_ctx.erase(kv.first);
|
|
910
|
+
}
|
|
911
|
+
|
|
900
912
|
delete starting_ctx;
|
|
901
913
|
delete start_ctx;
|
|
902
914
|
delete stopping_ctx;
|
|
@@ -1114,22 +1126,25 @@ std::string ObsInterface::getLastRecording() {
|
|
|
1114
1126
|
void ObsInterface::addSourceToScene(std::string name) {
|
|
1115
1127
|
blog(LOG_INFO, "ObsInterface::addSourceToScene called for source: %s", name.c_str());
|
|
1116
1128
|
|
|
1129
|
+
obs_sceneitem_t *item = obs_scene_find_source(scene, name.c_str());
|
|
1130
|
+
|
|
1131
|
+
if (item) {
|
|
1132
|
+
blog(LOG_WARNING, "Source %s already in scene", name.c_str());
|
|
1133
|
+
return;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1117
1136
|
auto it = sources.find(name);
|
|
1118
1137
|
|
|
1119
1138
|
if (it == sources.end()) {
|
|
1120
1139
|
blog(LOG_WARNING, "Source %s not found when adding to scene", name.c_str());
|
|
1121
|
-
|
|
1140
|
+
return;
|
|
1122
1141
|
}
|
|
1123
1142
|
|
|
1124
1143
|
obs_source_t* source = it->second;
|
|
1125
|
-
|
|
1126
|
-
// TODO refuse to add twice?
|
|
1127
|
-
obs_sceneitem_t *item = obs_scene_add(scene, source);
|
|
1144
|
+
item = obs_scene_add(scene, source);
|
|
1128
1145
|
|
|
1129
1146
|
if (!item) {
|
|
1130
1147
|
blog(LOG_ERROR, "Failed to add source to scene: %s", name.c_str());
|
|
1131
|
-
obs_source_release(source);
|
|
1132
|
-
throw std::runtime_error("Failed to add source to scene");
|
|
1133
1148
|
}
|
|
1134
1149
|
|
|
1135
1150
|
blog(LOG_INFO, "ObsInterface::addSourceToScene exited");
|
package/src/obs_interface.h
CHANGED
|
@@ -85,6 +85,7 @@ class ObsInterface {
|
|
|
85
85
|
std::map<std::string, obs_source_t*> sources; // Map of source names to obs_source_t pointers.
|
|
86
86
|
std::map<std::string, SourceSize> sizes; // Map of source names to their last known size, used for firing callbacks on size changes.
|
|
87
87
|
std::map<std::string, obs_volmeter_t*> volmeters; // Map of source names to obs_volmeter_t pointers.
|
|
88
|
+
std::map<std::string, SignalContext*> volmeter_cb_ctx; // Map of volmeter callback contexts.
|
|
88
89
|
std::map<std::string, obs_source_t*> filters; // Map of source names to obs_source_t filter pointers.
|
|
89
90
|
|
|
90
91
|
void sourceCallback(std::string name); // Send callback for source change.
|