@scrypted/libav 1.0.21 → 1.0.23
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 -5
package/package.json
CHANGED
package/src/decode.cpp
CHANGED
|
@@ -87,30 +87,52 @@ public:
|
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
int ret = avcodec_receive_frame(codecContext, frame);
|
|
91
|
+
if (ret == AVERROR(EAGAIN))
|
|
91
92
|
{
|
|
93
|
+
// fall through to read more data
|
|
94
|
+
}
|
|
95
|
+
else if (ret < 0 || ret == AVERROR_EOF)
|
|
96
|
+
{
|
|
97
|
+
printAVError(ret);
|
|
98
|
+
av_packet_free(&packet);
|
|
99
|
+
SetError("Could not read frame");
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
else
|
|
103
|
+
{
|
|
104
|
+
printf("returning frame 0\n");
|
|
92
105
|
av_packet_free(&packet);
|
|
93
106
|
result = frame;
|
|
94
107
|
return;
|
|
95
108
|
}
|
|
96
109
|
|
|
97
110
|
// Decode video frames
|
|
98
|
-
int ret;
|
|
99
111
|
while (av_read_frame(fmt_ctx_, packet) >= 0)
|
|
100
112
|
{
|
|
101
113
|
if (packet->stream_index == videoStreamIndex)
|
|
102
114
|
{
|
|
115
|
+
printf("av packet size: %d\n", packet->size);
|
|
103
116
|
if ((ret = avcodec_send_packet(codecContext, packet)) == 0)
|
|
104
117
|
{
|
|
105
|
-
|
|
118
|
+
ret = avcodec_receive_frame(codecContext, frame);
|
|
119
|
+
if (ret == AVERROR(EAGAIN))
|
|
120
|
+
{
|
|
121
|
+
// fall through to read more data
|
|
122
|
+
}
|
|
123
|
+
else if (ret < 0 || ret == AVERROR_EOF)
|
|
106
124
|
{
|
|
125
|
+
printAVError(ret);
|
|
107
126
|
av_packet_free(&packet);
|
|
108
|
-
|
|
127
|
+
SetError("Could not read frame");
|
|
109
128
|
return;
|
|
110
129
|
}
|
|
111
130
|
else
|
|
112
131
|
{
|
|
113
|
-
|
|
132
|
+
printf("returning frame 0\n");
|
|
133
|
+
av_packet_free(&packet);
|
|
134
|
+
result = frame;
|
|
135
|
+
return;
|
|
114
136
|
}
|
|
115
137
|
}
|
|
116
138
|
else
|