@scrypted/libav 1.0.20 → 1.0.21

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/decode.cpp +16 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrypted/libav",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "dependencies": {
5
5
  "node-addon-api": "^8.1.0",
6
6
  "prebuild-install": "npm:@scrypted/prebuild-install@^7.1.8"
package/src/decode.cpp CHANGED
@@ -50,6 +50,20 @@ Napi::Value set_console_callback(const Napi::CallbackInfo &info)
50
50
  return env.Null();
51
51
  }
52
52
 
53
+ void printAVError(int errnum)
54
+ {
55
+ char errbuf[256];
56
+
57
+ // Convert the error code to a string
58
+ if (av_strerror(errnum, errbuf, sizeof(errbuf)) < 0)
59
+ {
60
+ printf("Unknown error code: %d", errnum);
61
+ return;
62
+ }
63
+
64
+ printf("Error: %s\n", errbuf);
65
+ }
66
+
53
67
  class ReadFrameWorker : public Napi::AsyncWorker
54
68
  {
55
69
  public:
@@ -96,12 +110,12 @@ public:
96
110
  }
97
111
  else
98
112
  {
99
- fprintf(stderr, "Error while receiving a frame from the decoder: %d\n", ret);
113
+ printAVError(ret);
100
114
  }
101
115
  }
102
116
  else
103
117
  {
104
- fprintf(stderr, "Error while sending a packet to the decoder: %d\n", ret);
118
+ printAVError(ret);
105
119
  }
106
120
  }
107
121
  av_packet_unref(packet); // Reset the packet for the next frame