[haiku-commits] r38600 - haiku/trunk/src/apps/mediaplayer

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 10 Sep 2010 16:40:04 +0200 (CEST)

Author: stippi
Date: 2010-09-10 16:40:04 +0200 (Fri, 10 Sep 2010)
New Revision: 38600
Changeset: http://dev.haiku-os.org/changeset/38600

Modified:
   haiku/trunk/src/apps/mediaplayer/Controller.cpp
   haiku/trunk/src/apps/mediaplayer/Controller.h
Log:
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.


Modified: haiku/trunk/src/apps/mediaplayer/Controller.cpp
===================================================================
--- haiku/trunk/src/apps/mediaplayer/Controller.cpp     2010-09-10 12:04:57 UTC 
(rev 38599)
+++ haiku/trunk/src/apps/mediaplayer/Controller.cpp     2010-09-10 14:40:04 UTC 
(rev 38600)
@@ -115,6 +115,7 @@
 
        fPendingSeekRequests(0),
        fSeekFrame(-1),
+       fRequestedSeekFrame(-1),
 
        fGlobalSettingsListener(this),
 
@@ -262,6 +263,7 @@
 
        fPendingSeekRequests = 0;
        fSeekFrame = -1;
+       fRequestedSeekFrame = -1;
 
        if (fItem.Get() == NULL)
                return B_BAD_VALUE;
@@ -717,10 +719,14 @@
        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 @@
                        // if next current frame == seek frame.
                return seekFrame;
        } else
-               NotifySeekHandled(fSeekFrame);
+               NotifySeekHandled(fRequestedSeekFrame);
        return currentFrame;
 }
 
@@ -940,7 +946,7 @@
        // frames asynchronously.
        int64 frame;
        if (fPendingSeekRequests > 0)
-               frame = fSeekFrame;
+               frame = fRequestedSeekFrame;
        else
                frame = fCurrentFrame;
 
@@ -1166,8 +1172,10 @@
                return;
 
        fPendingSeekRequests--;
-       if (fPendingSeekRequests == 0)
+       if (fPendingSeekRequests == 0) {
                fSeekFrame = -1;
+               fRequestedSeekFrame = -1;
+       }
 
        _NotifySeekHandled(seekedFrame);
 }

Modified: haiku/trunk/src/apps/mediaplayer/Controller.h
===================================================================
--- haiku/trunk/src/apps/mediaplayer/Controller.h       2010-09-10 12:04:57 UTC 
(rev 38599)
+++ haiku/trunk/src/apps/mediaplayer/Controller.h       2010-09-10 14:40:04 UTC 
(rev 38600)
@@ -202,6 +202,7 @@
 
        mutable int32                           fPendingSeekRequests;
        mutable int64                           fSeekFrame;
+       mutable int64                           fRequestedSeekFrame;
 
                        ListenerAdapter         fGlobalSettingsListener;
 


Other related posts:

  • » [haiku-commits] r38600 - haiku/trunk/src/apps/mediaplayer - superstippi