@scrypted/libav 1.0.19 → 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.
- package/package.json +1 -1
- package/src/decode.cpp +27 -4
package/package.json
CHANGED
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:
|
|
@@ -94,12 +108,14 @@ public:
|
|
|
94
108
|
result = frame;
|
|
95
109
|
return;
|
|
96
110
|
}
|
|
97
|
-
else
|
|
98
|
-
|
|
111
|
+
else
|
|
112
|
+
{
|
|
113
|
+
printAVError(ret);
|
|
99
114
|
}
|
|
100
115
|
}
|
|
101
|
-
else
|
|
102
|
-
|
|
116
|
+
else
|
|
117
|
+
{
|
|
118
|
+
printAVError(ret);
|
|
103
119
|
}
|
|
104
120
|
}
|
|
105
121
|
av_packet_unref(packet); // Reset the packet for the next frame
|
|
@@ -554,6 +570,13 @@ Napi::Value AVFormatContextObject::GetPointer(const Napi::CallbackInfo &info)
|
|
|
554
570
|
|
|
555
571
|
Napi::Object Init(Napi::Env env, Napi::Object exports)
|
|
556
572
|
{
|
|
573
|
+
int error_code = AVERROR(EAGAIN);
|
|
574
|
+
printf("AVERROR(EAGAIN) = %d\n", error_code);
|
|
575
|
+
error_code = AVERROR(AVERROR_EOF);
|
|
576
|
+
printf("AVERROR(AVERROR_EOF) = %d\n", error_code);
|
|
577
|
+
error_code = AVERROR(EINVAL);
|
|
578
|
+
printf("AVERROR(EINVAL) = %d\n", error_code);
|
|
579
|
+
|
|
557
580
|
AVFilterGraphObject::Init(env, exports);
|
|
558
581
|
AVFrameObject::Init(env, exports);
|
|
559
582
|
AVFormatContextObject::Init(env, exports);
|