'From Squeak3.1alpha of 5 February 2001 [latest update: #3841] on 15 March 2001 at 10:47:29 am'! "Change Set: MPEGAgain Date: 15 March 2001 Author: Karl Ramberg - removes some minor performance tuning stuff"! Object subclass: #MPEGPlayer2 instanceVariableNames: 'soundQueue startTime audioPlayerProcess videoPlayerProcess timecode volume videoMorph startFrame dropOut time myMpegFile ' classVariableNames: '' poolDictionaries: '' category: 'MPEG3-Kernel'! !MPEGPlayer2 methodsFor: 'video' stamp: 'kfr 3/15/2001 13:27'! playVideo: aStream | morphsForm | morphsForm _ self videoMorph rotatedForm. startTime _ Time millisecondClockValue. startFrame _ myMpegFile videoGetFrame: aStream. videoPlayerProcess _ [ [ (myMpegFile videoGetFrame: 0) <= (myMpegFile videoFrames: 0) ] whileTrue: [ self timing. myMpegFile videoReadNextFrameInto: morphsForm bits width: morphsForm width height: morphsForm height stream: aStream. morphsForm displayAt: videoMorph topLeft. ]. videoPlayerProcess _ nil ] forkAt:4 ! ! !MPEGPlayer2 methodsFor: 'video' stamp: 'kfr 3/15/2001 13:27'! timing | frameNow frameItShouldBe timeNow frameRate totalFrames delay | frameRate _ myMpegFile videoFrameRate: 0. frameNow _ myMpegFile videoGetFrame: 0. totalFrames _ myMpegFile videoFrames: 0. delay _ 1000 // frameRate. timeNow _ Time millisecondsSince: startTime . frameItShouldBe _ timeNow * frameRate // 1000 + startFrame. timecode _ frameItShouldBe / totalFrames. frameNow < frameItShouldBe ifTrue:[ myMpegFile videoDropFrames: (frameItShouldBe - frameNow) stream: 0 ] ifFalse: [ frameNow > frameItShouldBe ifTrue:[ (Delay forMilliseconds: frameNow - frameItShouldBe * delay) wait ] ]. ! ! Object subclass: #MPEGPlayer2 instanceVariableNames: 'soundQueue startTime audioPlayerProcess videoPlayerProcess timecode volume videoMorph startFrame myMpegFile ' classVariableNames: '' poolDictionaries: '' category: 'MPEG3-Kernel'!