noobs 0.0.190 → 0.0.200

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/bin/obs.dll CHANGED
Binary file
package/dist/noobs.node CHANGED
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noobs",
3
- "version": "0.0.190",
3
+ "version": "0.0.200",
4
4
  "description": "A native Node.js addon with libobs bindings for Warcraft Recorder.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -23,6 +23,10 @@ void call_jscb(Napi::Env env, Napi::Function cb, SignalData* sd) {
23
23
  obj.Set("error", Napi::String::New(env, sd->error.value()));
24
24
  }
25
25
 
26
+ if (sd->path.has_value()) {
27
+ obj.Set("path", Napi::String::New(env, sd->path.value()));
28
+ }
29
+
26
30
  cb.Call({ obj });
27
31
  delete sd;
28
32
  }
@@ -597,25 +601,40 @@ obs_properties_t* ObsInterface::getSourceProperties(std::string name) {
597
601
  }
598
602
 
599
603
  void ObsInterface::output_signal_handler(void *data, calldata_t *cd) {
600
- long long code = calldata_int(cd, "code");
601
- const char *err = calldata_string(cd, "last_error");
604
+ SignalContext* ctx = static_cast<SignalContext*>(data);
605
+ ObsInterface* self = ctx->self;
606
+ SignalData* sd;
602
607
 
603
- std::optional<std::string> error;
608
+ blog(LOG_INFO, "Handling %s signal from libobs", ctx->id.c_str());
604
609
 
605
- if (err) {
606
- error = std::string(err);
607
- }
610
+ if (ctx->id == "converted") {
611
+ const char *path = calldata_string(cd, "file");
608
612
 
609
- SignalContext* ctx = static_cast<SignalContext*>(data);
610
- ObsInterface* self = ctx->self;
613
+ sd = new SignalData{
614
+ "output",
615
+ "converted",
616
+ 0, // Never actually get a code for a converted signal, so just set it to 0.
617
+ std::nullopt, // No value, that's only used for volmeters.
618
+ std::nullopt, // Never expect errors here.
619
+ std::string(path),
620
+ };
621
+ } else {
622
+ long long code = calldata_int(cd, "code");
623
+ const char *err = calldata_string(cd, "last_error");
624
+ std::optional<std::string> error;
611
625
 
612
- SignalData* sd = new SignalData{
613
- "output",
614
- ctx->id.c_str(),
615
- code,
616
- std::nullopt, // No value, that's only used for volmeters.
617
- error,
618
- };
626
+ if (err) {
627
+ error = std::string(err);
628
+ }
629
+
630
+ sd = new SignalData{
631
+ "output",
632
+ ctx->id.c_str(),
633
+ code,
634
+ std::nullopt, // No value, that's only used for volmeters.
635
+ error,
636
+ };
637
+ }
619
638
 
620
639
  self->jscb.NonBlockingCall(sd, call_jscb);
621
640
  }
@@ -628,6 +647,7 @@ void ObsInterface::connect_signal_handlers(obs_output_t *output) {
628
647
  signal_handler_connect(sh, "stop", output_signal_handler, stop_ctx);
629
648
  signal_handler_connect(sh, "activate", output_signal_handler, activate_ctx);
630
649
  signal_handler_connect(sh, "deactivate", output_signal_handler, deactivate_ctx);
650
+ signal_handler_connect(sh, "converted", output_signal_handler, converted_ctx);
631
651
  }
632
652
 
633
653
  void ObsInterface::disconnect_signal_handlers(obs_output_t *output) {
@@ -637,7 +657,8 @@ void ObsInterface::disconnect_signal_handlers(obs_output_t *output) {
637
657
  signal_handler_disconnect(sh, "stopping", output_signal_handler, stopping_ctx);
638
658
  signal_handler_disconnect(sh, "stop", output_signal_handler, stop_ctx);
639
659
  signal_handler_disconnect(sh, "activate", output_signal_handler, activate_ctx);
640
- signal_handler_disconnect(sh, "deactivate ", output_signal_handler, deactivate_ctx);
660
+ signal_handler_disconnect(sh, "deactivate", output_signal_handler, deactivate_ctx);
661
+ signal_handler_disconnect(sh, "converted ", output_signal_handler, converted_ctx);
641
662
  }
642
663
 
643
664
  bool draw_source_outline(obs_scene_t *scene, obs_sceneitem_t *item, void *p) {
@@ -955,6 +976,7 @@ ObsInterface::ObsInterface(
955
976
  stop_ctx = new SignalContext{ this, "stop" };
956
977
  activate_ctx = new SignalContext{this, "activate"};
957
978
  deactivate_ctx = new SignalContext{this, "deactivate"};
979
+ converted_ctx = new SignalContext{this, "converted"};
958
980
 
959
981
  // Create the resources we rely on.
960
982
  create_scene();
@@ -987,6 +1009,7 @@ ObsInterface::~ObsInterface() {
987
1009
  delete stop_ctx;
988
1010
  delete activate_ctx;
989
1011
  delete deactivate_ctx;
1012
+ delete converted_ctx;
990
1013
 
991
1014
  for (auto& kv : sources) {
992
1015
  std::string name = kv.first;
@@ -19,6 +19,7 @@ struct SignalData {
19
19
  long long code;
20
20
  std::optional<float> value;
21
21
  std::optional<std::string> error;
22
+ std::optional<std::string> path; // used by converted signal handler
22
23
  };
23
24
 
24
25
  struct SignalContext {
@@ -124,6 +125,7 @@ class ObsInterface {
124
125
  SignalContext* stop_ctx;
125
126
  SignalContext* activate_ctx;
126
127
  SignalContext* deactivate_ctx;
128
+ SignalContext* converted_ctx;
127
129
  static void output_signal_handler(void *data, calldata_t *cd);
128
130
 
129
131
  void list_encoders(obs_encoder_type type = OBS_ENCODER_VIDEO);