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:
@@ -115,6 +115,7 @@ Controller::Controller()
|
|||||||
|
|
||||||
fPendingSeekRequests(0),
|
fPendingSeekRequests(0),
|
||||||
fSeekFrame(-1),
|
fSeekFrame(-1),
|
||||||
|
fRequestedSeekFrame(-1),
|
||||||
|
|
||||||
fGlobalSettingsListener(this),
|
fGlobalSettingsListener(this),
|
||||||
|
|
||||||
@@ -262,6 +263,7 @@ Controller::SetTo(const PlaylistItemRef& item)
|
|||||||
|
|
||||||
fPendingSeekRequests = 0;
|
fPendingSeekRequests = 0;
|
||||||
fSeekFrame = -1;
|
fSeekFrame = -1;
|
||||||
|
fRequestedSeekFrame = -1;
|
||||||
|
|
||||||
if (fItem.Get() == NULL)
|
if (fItem.Get() == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
@@ -717,10 +719,14 @@ Controller::SetFramePosition(int64 value)
|
|||||||
BAutolock _(this);
|
BAutolock _(this);
|
||||||
|
|
||||||
fPendingSeekRequests++;
|
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
|
// Snap to a video keyframe, since that will be the fastest
|
||||||
// to display and seeking will feel more snappy.
|
// 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)
|
if (Duration() > 240 && fVideoTrackSupplier != NULL)
|
||||||
fVideoTrackSupplier->FindKeyFrameForFrame(&fSeekFrame);
|
fVideoTrackSupplier->FindKeyFrameForFrame(&fSeekFrame);
|
||||||
|
|
||||||
@@ -735,7 +741,7 @@ Controller::SetFramePosition(int64 value)
|
|||||||
// if next current frame == seek frame.
|
// if next current frame == seek frame.
|
||||||
return seekFrame;
|
return seekFrame;
|
||||||
} else
|
} else
|
||||||
NotifySeekHandled(fSeekFrame);
|
NotifySeekHandled(fRequestedSeekFrame);
|
||||||
return currentFrame;
|
return currentFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -940,7 +946,7 @@ Controller::_TimePosition() const
|
|||||||
// frames asynchronously.
|
// frames asynchronously.
|
||||||
int64 frame;
|
int64 frame;
|
||||||
if (fPendingSeekRequests > 0)
|
if (fPendingSeekRequests > 0)
|
||||||
frame = fSeekFrame;
|
frame = fRequestedSeekFrame;
|
||||||
else
|
else
|
||||||
frame = fCurrentFrame;
|
frame = fCurrentFrame;
|
||||||
|
|
||||||
@@ -1166,8 +1172,10 @@ Controller::NotifySeekHandled(int64 seekedFrame) const
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fPendingSeekRequests--;
|
fPendingSeekRequests--;
|
||||||
if (fPendingSeekRequests == 0)
|
if (fPendingSeekRequests == 0) {
|
||||||
fSeekFrame = -1;
|
fSeekFrame = -1;
|
||||||
|
fRequestedSeekFrame = -1;
|
||||||
|
}
|
||||||
|
|
||||||
_NotifySeekHandled(seekedFrame);
|
_NotifySeekHandled(seekedFrame);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ private:
|
|||||||
|
|
||||||
mutable int32 fPendingSeekRequests;
|
mutable int32 fPendingSeekRequests;
|
||||||
mutable int64 fSeekFrame;
|
mutable int64 fSeekFrame;
|
||||||
|
mutable int64 fRequestedSeekFrame;
|
||||||
|
|
||||||
ListenerAdapter fGlobalSettingsListener;
|
ListenerAdapter fGlobalSettingsListener;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user