@scrypted/libav 1.0.20 → 1.0.22
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 +17 -2
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:
|
|
@@ -86,6 +100,7 @@ public:
|
|
|
86
100
|
{
|
|
87
101
|
if (packet->stream_index == videoStreamIndex)
|
|
88
102
|
{
|
|
103
|
+
printf("av packet size: %d\n", packet->size);
|
|
89
104
|
if ((ret = avcodec_send_packet(codecContext, packet)) == 0)
|
|
90
105
|
{
|
|
91
106
|
if ((ret = avcodec_receive_frame(codecContext, frame)) == 0)
|
|
@@ -96,12 +111,12 @@ public:
|
|
|
96
111
|
}
|
|
97
112
|
else
|
|
98
113
|
{
|
|
99
|
-
|
|
114
|
+
printAVError(ret);
|
|
100
115
|
}
|
|
101
116
|
}
|
|
102
117
|
else
|
|
103
118
|
{
|
|
104
|
-
|
|
119
|
+
printAVError(ret);
|
|
105
120
|
}
|
|
106
121
|
}
|
|
107
122
|
av_packet_unref(packet); // Reset the packet for the next frame
|