send additional packets to decoder as required
This commit is contained in:
parent
db8de06306
commit
9a614820f0
15
src/thumb.c
15
src/thumb.c
|
@ -73,7 +73,20 @@ int main(int argc, char *argv[])
|
||||||
AVRational cur_time = { pkt.pts, vstream->time_base.den };
|
AVRational cur_time = { pkt.pts, vstream->time_base.den };
|
||||||
AVRational next_time = { pkt.pts + pkt.duration, vstream->time_base.den };
|
AVRational next_time = { pkt.pts + pkt.duration, vstream->time_base.den };
|
||||||
|
|
||||||
if (avcodec_send_packet(vctx, &pkt) != 0 || avcodec_receive_frame(vctx, frame) != 0) {
|
if (avcodec_send_packet(vctx, &pkt) != 0) {
|
||||||
|
// Decoder returned an error
|
||||||
|
printf("Couldn't read file\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ret = avcodec_receive_frame(vctx, frame);
|
||||||
|
|
||||||
|
if (ret == AVERROR(EAGAIN)) {
|
||||||
|
// Need more data, can't receive frame yet
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret != 0) {
|
||||||
// Decoder returned an error
|
// Decoder returned an error
|
||||||
printf("Couldn't read file\n");
|
printf("Couldn't read file\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue