Fixed seeking to the end of files with FFMPEG plug-in

CQTexperiment
Chris Moeller 2014-03-26 02:27:51 -07:00
parent aacffb9981
commit 104e4c140f
1 changed files with 5 additions and 1 deletions

View File

@ -303,7 +303,11 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op)
- (long)seek:(long)frame
{
if (frame >= totalFrames) { return -1; }
if (frame >= totalFrames)
{
framesRead = totalFrames;
return -1;
}
int64_t ts = frame * (formatCtx->duration) / totalFrames;
avformat_seek_file(formatCtx, -1, ts - 1000, ts, ts, AVSEEK_FLAG_ANY);
avcodec_flush_buffers(codecCtx);