@scrypted/libav 1.0.18 → 1.0.20
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 +16 -6
package/package.json
CHANGED
package/src/decode.cpp
CHANGED
|
@@ -81,24 +81,27 @@ public:
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// Decode video frames
|
|
84
|
+
int ret;
|
|
84
85
|
while (av_read_frame(fmt_ctx_, packet) >= 0)
|
|
85
86
|
{
|
|
86
87
|
if (packet->stream_index == videoStreamIndex)
|
|
87
88
|
{
|
|
88
|
-
if (avcodec_send_packet(codecContext, packet) == 0)
|
|
89
|
+
if ((ret = avcodec_send_packet(codecContext, packet)) == 0)
|
|
89
90
|
{
|
|
90
|
-
if (avcodec_receive_frame(codecContext, frame) == 0)
|
|
91
|
+
if ((ret = avcodec_receive_frame(codecContext, frame)) == 0)
|
|
91
92
|
{
|
|
92
93
|
av_packet_free(&packet);
|
|
93
94
|
result = frame;
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
96
|
-
else
|
|
97
|
-
|
|
97
|
+
else
|
|
98
|
+
{
|
|
99
|
+
fprintf(stderr, "Error while receiving a frame from the decoder: %d\n", ret);
|
|
98
100
|
}
|
|
99
101
|
}
|
|
100
|
-
else
|
|
101
|
-
|
|
102
|
+
else
|
|
103
|
+
{
|
|
104
|
+
fprintf(stderr, "Error while sending a packet to the decoder: %d\n", ret);
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
av_packet_unref(packet); // Reset the packet for the next frame
|
|
@@ -553,6 +556,13 @@ Napi::Value AVFormatContextObject::GetPointer(const Napi::CallbackInfo &info)
|
|
|
553
556
|
|
|
554
557
|
Napi::Object Init(Napi::Env env, Napi::Object exports)
|
|
555
558
|
{
|
|
559
|
+
int error_code = AVERROR(EAGAIN);
|
|
560
|
+
printf("AVERROR(EAGAIN) = %d\n", error_code);
|
|
561
|
+
error_code = AVERROR(AVERROR_EOF);
|
|
562
|
+
printf("AVERROR(AVERROR_EOF) = %d\n", error_code);
|
|
563
|
+
error_code = AVERROR(EINVAL);
|
|
564
|
+
printf("AVERROR(EINVAL) = %d\n", error_code);
|
|
565
|
+
|
|
556
566
|
AVFilterGraphObject::Init(env, exports);
|
|
557
567
|
AVFrameObject::Init(env, exports);
|
|
558
568
|
AVFormatContextObject::Init(env, exports);
|