From 092fdda05af36eebb1036382f7b6da3085a2be75 Mon Sep 17 00:00:00 2001 From: Chris Moeller Date: Thu, 14 Nov 2013 23:28:02 -0800 Subject: [PATCH] Fixed FFMPEG seeking --- Plugins/FFMPEG/FFMPEGDecoder.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/FFMPEG/FFMPEGDecoder.m b/Plugins/FFMPEG/FFMPEGDecoder.m index d5422e7dd..8b5682e7d 100644 --- a/Plugins/FFMPEG/FFMPEGDecoder.m +++ b/Plugins/FFMPEG/FFMPEGDecoder.m @@ -290,12 +290,13 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op) - (long)seek:(long)frame { - if (frame > totalFrames) { return -1; } + if (frame >= 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); readNextPacket = YES; // so we immediately read next packet bytesConsumedFromDecodedFrame = INT_MAX; // so we immediately begin decoding next frame + framesRead = frame; return frame; }