From 21f2531ebc68797926d38ab2e6dfb32b7be7b71e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Mon, 30 Aug 2010 09:52:32 +0000 Subject: [PATCH] For videos that are longer than 240 frames, we anticipate that the graphical precision of the seeking slider is not enough to seek to individual frames on purpose. So we filter the requested seeking position to keyframes if there is a video track. The difference in snappiness when seeking is like night and day. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38439 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/mediaplayer/Controller.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/apps/mediaplayer/Controller.cpp b/src/apps/mediaplayer/Controller.cpp index c83ef75935..804fdcfae7 100644 --- a/src/apps/mediaplayer/Controller.cpp +++ b/src/apps/mediaplayer/Controller.cpp @@ -712,8 +712,12 @@ Controller::SetFramePosition(int32 value) { BAutolock _(this); - int32 seekFrame = max_c(0, min_c(Duration(), value)); - int32 currentFrame = CurrentFrame(); + int64 seekFrame = max_c(0, min_c(Duration(), value)); + int64 currentFrame = CurrentFrame(); + // Snap to video keyframe, since that will be the fastest + // to display and seeking will feel more snappy. + if (Duration() > 240 && fVideoTrackSupplier != NULL) + fVideoTrackSupplier->FindKeyFrameForFrame(&seekFrame); if (seekFrame != currentFrame) { fSeekFrame = seekFrame; fSeekRequested = true;