@scrypted/libav 1.0.24 → 1.0.26

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 +22 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrypted/libav",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
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,19 +50,19 @@ 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];
53
+ void printAVError(int errnum)
54
+ {
55
+ char errbuf[256];
56
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
- // }
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
63
 
64
- // printf("Error: %s\n", errbuf);
65
- // }
64
+ printf("Error: %s\n", errbuf);
65
+ }
66
66
 
67
67
  class ReadFrameWorker : public Napi::AsyncWorker
68
68
  {
@@ -91,10 +91,11 @@ public:
91
91
  if (ret == AVERROR(EAGAIN))
92
92
  {
93
93
  // fall through to read more data
94
+ printAVError(ret);
94
95
  }
95
96
  else if (ret < 0 || ret == AVERROR_EOF)
96
97
  {
97
- // printAVError(ret);
98
+ printAVError(ret);
98
99
  av_packet_free(&packet);
99
100
  SetError("Could not read frame");
100
101
  return;
@@ -119,10 +120,11 @@ public:
119
120
  if (ret == AVERROR(EAGAIN))
120
121
  {
121
122
  // fall through to read more data
123
+ printAVError(ret);
122
124
  }
123
125
  else if (ret < 0 || ret == AVERROR_EOF)
124
126
  {
125
- // printAVError(ret);
127
+ printAVError(ret);
126
128
  av_packet_free(&packet);
127
129
  SetError("Could not read frame");
128
130
  return;
@@ -209,7 +211,7 @@ static enum AVPixelFormat get_hw_format(AVCodecContext *ctx,
209
211
  return *p;
210
212
  }
211
213
 
212
- fprintf(stderr, "Failed to get HW surface format.\n");
214
+ // fprintf(stderr, "Failed to get HW surface format.\n");
213
215
  return AV_PIX_FMT_NONE;
214
216
  }
215
217
 
@@ -592,12 +594,12 @@ Napi::Value AVFormatContextObject::GetPointer(const Napi::CallbackInfo &info)
592
594
 
593
595
  Napi::Object Init(Napi::Env env, Napi::Object exports)
594
596
  {
595
- int error_code = AVERROR(EAGAIN);
596
- printf("AVERROR(EAGAIN) = %d\n", error_code);
597
- error_code = AVERROR(AVERROR_EOF);
598
- printf("AVERROR(AVERROR_EOF) = %d\n", error_code);
599
- error_code = AVERROR(EINVAL);
600
- printf("AVERROR(EINVAL) = %d\n", error_code);
597
+ // int error_code = AVERROR(EAGAIN);
598
+ // printf("AVERROR(EAGAIN) = %d\n", error_code);
599
+ // error_code = AVERROR(AVERROR_EOF);
600
+ // printf("AVERROR(AVERROR_EOF) = %d\n", error_code);
601
+ // error_code = AVERROR(EINVAL);
602
+ // printf("AVERROR(EINVAL) = %d\n", error_code);
601
603
 
602
604
  AVFilterGraphObject::Init(env, exports);
603
605
  AVFrameObject::Init(env, exports);