Fixed winding for video. We need to distingish between

requested seek-frame and snapped-to-keyframe seek-frame.
Not comletely perfect, since sometimes video snaps back
to the same keyframe two or more times, but winding works
anyway.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38600 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-09-10 14:40:04 +00:00
parent 4d6c88624e
commit 8f0617aa0d
2 changed files with 15 additions and 6 deletions
+14 -6
View File
@@ -115,6 +115,7 @@ Controller::Controller()
fPendingSeekRequests(0),
fSeekFrame(-1),
fRequestedSeekFrame(-1),
fGlobalSettingsListener(this),
@@ -262,6 +263,7 @@ Controller::SetTo(const PlaylistItemRef& item)
fPendingSeekRequests = 0;
fSeekFrame = -1;
fRequestedSeekFrame = -1;
if (fItem.Get() == NULL)
return B_BAD_VALUE;
@@ -717,10 +719,14 @@ Controller::SetFramePosition(int64 value)
BAutolock _(this);
fPendingSeekRequests++;
fSeekFrame = max_c(0, min_c(_FrameDuration(), value));
fRequestedSeekFrame = max_c(0, min_c(_FrameDuration(), value));
fSeekFrame = fRequestedSeekFrame;
// Snap to video keyframe, since that will be the fastest
// to display and seeking will feel more snappy.
// Snap to a video keyframe, since that will be the fastest
// to display and seeking will feel more snappy. Note that we
// don't store this change in fSeekFrame, since we still want
// to report the originally requested seek frame in TimePosition()
// until we could reach that frame.
if (Duration() > 240 && fVideoTrackSupplier != NULL)
fVideoTrackSupplier->FindKeyFrameForFrame(&fSeekFrame);
@@ -735,7 +741,7 @@ Controller::SetFramePosition(int64 value)
// if next current frame == seek frame.
return seekFrame;
} else
NotifySeekHandled(fSeekFrame);
NotifySeekHandled(fRequestedSeekFrame);
return currentFrame;
}
@@ -940,7 +946,7 @@ Controller::_TimePosition() const
// frames asynchronously.
int64 frame;
if (fPendingSeekRequests > 0)
frame = fSeekFrame;
frame = fRequestedSeekFrame;
else
frame = fCurrentFrame;
@@ -1166,8 +1172,10 @@ Controller::NotifySeekHandled(int64 seekedFrame) const
return;
fPendingSeekRequests--;
if (fPendingSeekRequests == 0)
if (fPendingSeekRequests == 0) {
fSeekFrame = -1;
fRequestedSeekFrame = -1;
}
_NotifySeekHandled(seekedFrame);
}
+1
View File
@@ -202,6 +202,7 @@ private:
mutable int32 fPendingSeekRequests;
mutable int64 fSeekFrame;
mutable int64 fRequestedSeekFrame;
ListenerAdapter fGlobalSettingsListener;