Created
January 15, 2016 21:39
-
-
Save hiroMTB/26eaa40424e9a0ba3689 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// QuickTimeImplAvf.mm | |
// line 296 | |
void MovieBase::seekToFrame( int frame ) | |
{ | |
if( ! mPlayer ) | |
return; | |
//CMTime currentTime = [mPlayer currentTime]; | |
//CMTime oneFrame = CMTimeMakeWithSeconds(1.0 / mFrameRate, currentTime.timescale); // ERROR, timescale=1 | |
// Plan A : Get correct timescale | |
CMTime oneFrame = CMTimeMakeWithSeconds(1.0 / mFrameRate, mPlayer.currentItem.asset.duration.timescale ); | |
// plan B : set timescale 600 manualy | |
//CMTime oneFrame = CMTimeMakeWithSeconds(1.0 / mFrameRate, 600 ); | |
// plan C : Use frameRate | |
//CMTime oneFrame = CMTimeMake(1, 20); | |
CMTime startTime = kCMTimeZero; | |
CMTime addedFrame = CMTimeMultiply(oneFrame, frame); | |
CMTime added = CMTimeAdd(startTime, addedFrame); | |
[mPlayer seekToTime:added toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CMTimeReference
https://developer.apple.com/library/mac/documentation/CoreMedia/Reference/CMTime/