noobs 0.0.144 → 0.0.146

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 CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noobs",
3
- "version": "0.0.144",
3
+ "version": "0.0.146",
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",
@@ -10,14 +10,20 @@
10
10
 
11
11
  void call_jscb(Napi::Env env, Napi::Function cb, SignalData* sd) {
12
12
  Napi::Object obj = Napi::Object::New(env);
13
+
13
14
  obj.Set("type", Napi::String::New(env, sd->type));
14
15
  obj.Set("id", Napi::String::New(env, sd->id));
15
16
  obj.Set("code", Napi::Number::New(env, sd->code));
17
+
16
18
 
17
19
  if (sd->value.has_value()) {
18
20
  obj.Set("value", Napi::Number::New(env, sd->value.value()));
19
21
  }
20
22
 
23
+ if (sd->error.has_value()) {
24
+ obj.Set("error", Napi::String::New(env, sd->error.value()));
25
+ }
26
+
21
27
  cb.Call({ obj });
22
28
  delete sd;
23
29
  }
@@ -571,11 +577,25 @@ obs_properties_t* ObsInterface::getSourceProperties(std::string name) {
571
577
 
572
578
  void ObsInterface::output_signal_handler(void *data, calldata_t *cd) {
573
579
  long long code = calldata_int(cd, "code");
580
+ const char *err = calldata_string(cd, "last_error");
581
+
582
+ std::optional<std::string> error;
583
+
584
+ if (err) {
585
+ error = std::string(err);
586
+ }
574
587
 
575
588
  SignalContext* ctx = static_cast<SignalContext*>(data);
576
589
  ObsInterface* self = ctx->self;
577
590
 
578
- SignalData* sd = new SignalData{ "output", ctx->id.c_str(), code };
591
+ SignalData* sd = new SignalData{
592
+ "output",
593
+ ctx->id.c_str(),
594
+ code,
595
+ std::nullopt, // No value, that's only used for volmeters.
596
+ error,
597
+ };
598
+
579
599
  self->jscb.NonBlockingCall(sd, call_jscb);
580
600
  }
581
601
 
@@ -695,7 +715,10 @@ void draw_callback(void* data, uint32_t cx, uint32_t cy) {
695
715
  gs_set_viewport(previewX, previewY, previewCX, previewCY);
696
716
 
697
717
  // Renders the scene now the graphics context is setup.
698
- obs_render_main_texture();
718
+ // obs_render_main_texture();
719
+ obs_source_t *source = obs_scene_get_source(obsInterface->scene);
720
+ if (source)
721
+ obs_source_video_render(source);
699
722
 
700
723
  // Draw boxes around sources, if enabled.
701
724
  if (obsInterface->getDrawSourceOutlineEnabled()) {
@@ -18,6 +18,7 @@ struct SignalData {
18
18
  std::string id;
19
19
  long long code;
20
20
  std::optional<float> value;
21
+ std::optional<std::string> error;
21
22
  };
22
23
 
23
24
  struct SignalContext {
@@ -91,9 +92,10 @@ class ObsInterface {
91
92
  void sourceCallback(std::string name); // Send callback for source change.
92
93
  void zeroVolmeter(std::string name); // Zero the volmeter for a source.
93
94
 
95
+ obs_scene_t *scene = nullptr;
96
+
94
97
  private:
95
98
  obs_output_t *output = nullptr;
96
- obs_scene_t *scene = nullptr;
97
99
 
98
100
  obs_encoder_t *video_encoder = nullptr;
99
101
  obs_encoder_t *audio_encoder = nullptr;