From 64fc6cc5168840398d3b85281983d0efdfae4401 Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Sat, 4 Apr 2015 15:34:31 +0200 Subject: [PATCH] Resume always from last iframe --- player.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/player.cc b/player.cc index e965a2c..3811a76 100644 --- a/player.cc +++ b/player.cc @@ -147,7 +147,20 @@ int Player::shutdown() void Player::setStartFrame(ULONG startFrame) { - currentFrameNumber = startFrame; + ULONG nextiframeNumber; + ULONG iframeLength; + ULONG iframeNumber; + ULLONG filePos; + + // newFrame could be anywhere, go forwards to next I-Frame + if (!vdr->getNextIFrame(startFrame, 1, &filePos, &nextiframeNumber, &iframeLength)) return; + + // Now step back a GOP. This ensures we go to the greatest I-Frame equal to or less than the requested frame + vdr->getNextIFrame(nextiframeNumber, 0, &filePos, &iframeNumber, &iframeLength); + + logger->log("Player", Log::DEBUG, "setStartFrame %lu %lu %lu", startFrame, nextiframeNumber,iframeNumber); + currentFrameNumber = iframeNumber; + } void Player::setLengthBytes(ULLONG length) -- 2.39.5