diff options
author | Peter Schlaile <peter@schlaile.de> | 2012-09-08 01:41:38 +0400 |
---|---|---|
committer | Peter Schlaile <peter@schlaile.de> | 2012-09-08 01:41:38 +0400 |
commit | c95d4f68b863c851d0b8bddef8092fdc0932610e (patch) | |
tree | c3d0647274aa50776a32707dd50c53636ee7112b /source/blender/imbuf/intern/anim_movie.c | |
parent | d6a68ea850974a271dfd4c83a64d36ba763babf8 (diff) |
== FFMPEG ==
This fixes [#32399] VSE doesn't show last 3 frames of Quicktime movie.
Some decoders store frames internally until EOF.
So one has to feed the decoding engine with empty packets after EOF
until all frames could be extracted properly.
Diffstat (limited to 'source/blender/imbuf/intern/anim_movie.c')
-rw-r--r-- | source/blender/imbuf/intern/anim_movie.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c index 9092d59c351..16dbd0823da 100644 --- a/source/blender/imbuf/intern/anim_movie.c +++ b/source/blender/imbuf/intern/anim_movie.c @@ -801,6 +801,34 @@ static int ffmpeg_decode_video_frame(struct anim *anim) anim->next_packet.stream_index = -1; } + if (rval == AVERROR_EOF) { + anim->next_packet.size = 0; + anim->next_packet.data = 0; + + anim->pFrameComplete = 0; + + avcodec_decode_video2( + anim->pCodecCtx, + anim->pFrame, &anim->pFrameComplete, + &anim->next_packet); + + if (anim->pFrameComplete) { + anim->next_pts = av_get_pts_from_frame( + anim->pFormatCtx, anim->pFrame); + + av_log(anim->pFormatCtx, + AV_LOG_DEBUG, + " FRAME DONE (after EOF): next_pts=%lld " + "pkt_pts=%lld, guessed_pts=%lld\n", + (anim->pFrame->pts == AV_NOPTS_VALUE) ? + -1 : (long long int)anim->pFrame->pts, + (anim->pFrame->pkt_pts == AV_NOPTS_VALUE) ? + -1 : (long long int)anim->pFrame->pkt_pts, + (long long int)anim->next_pts); + rval = 0; + } + } + if (rval < 0) { anim->next_packet.stream_index = -1; |