[etoys-dev] Etoys: Movies-kfr.4.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jun 2 07:21:20 EDT 2011


Karl Ramberg uploaded a new version of Movies to project Etoys:
http://source.squeak.org/etoys/Movies-kfr.4.mcz

==================== Summary ====================

Name: Movies-kfr.4
Author: kfr
Time: 2 June 2011, 1:21:04 pm
UUID: 964a20be-32ec-6047-9114-ee4e9bffa31a
Ancestors: Movies-kfr.3

Try to play example videos across project saves and moves

=============== Diff against Movies-kfr.3 ===============

Item was changed:
  ----- Method: MPEGDisplayMorph>>mpegFileIsOpen (in category 'file open/close') -----
  mpegFileIsOpen
- 	"Answer true if I have an open, valid MPEG file handle. If the
- 	handle is not valid, try to re-open the file."
- 	| fileName |
  	mpegFile
  		ifNil: [^ false].
  	mpegFile fileHandle
+ 		ifNil: [^ false].
- 		ifNil: ["try to reopen the file, which may have been saved in a
- 			snapshot "
- 			fileName := mpegFile fileName.
- 			self openFileNamed: mpegFile fileName.
- 			mpegFile 
- 				ifNil: [self inform: 'Path changed. Enter new one for: ' translated
- 							, fileName.
- 					self openMPEGFile. mpegFile ifNil:[^false]].
- 			mpegFile fileHandle
- 				ifNil: [mpegFile := nil]].
  	^ mpegFile notNil!

Item was added:
+ ----- Method: MPEGDisplayMorph>>openExampleEtoysFile (in category 'file open/close') -----
+ openExampleEtoysFile
+ 	
+ 	| fullFileName fileName slash newFullFileName |
+ 	fullFileName := mpegFile fileName.
+ 	(fullFileName occurrencesOf: $/) > (fullFileName occurrencesOf: $\)
+                                  ifTrue:[ slash := $/]
+ 							 ifFalse:[ slash := $\].
+ 	fileName := mpegFile fileName copyAfterLast: slash.
+ 	newFullFileName := Smalltalk imagePath, FileDirectory slash, 'ExampleEtoys', FileDirectory slash, fileName.
+ 	self openFileNamed: newFullFileName
+ 	!

Item was changed:
  ----- Method: MPEGDisplayMorph>>startPlaying (in category 'commands') -----
  startPlaying
+ 	| frameIndex fileName |
+ 	fileName := mpegFile fileName.
- 	"Start playing the movie at the current position."
- 
- 	| frameIndex |
  	self stopPlaying.
+ 	stopFrame := nil.
+ 	self mpegFileIsOpen
+ 		ifFalse: [self openFileNamed: mpegFile fileName.
+ 			mpegFile
+ 				ifNil: [self inform: 'Path changed. Enter new one for: ' translated , fileName.
+ 					self openMPEGFile.
+ 					mpegFile
+ 						ifNil: [^ self]].
+ 			mpegFile fileHandle
+ 				ifNil: [mpegFile := nil]].
- 	stopFrame _ nil.
- 	self mpegFileIsOpen ifFalse: [^ self].
- 
- 	
- 	
  	mpegFile hasAudio
+ 		ifTrue: [mpegFile hasVideo
+ 				ifTrue: [soundTrack reset.
+ 					soundTrack soundPosition: (mpegFile videoGetFrame: 0) asFloat
+ 							/ (mpegFile videoFrames: 0).
+ 					frameIndex := soundTrack millisecondsSinceStart * desiredFrameRate // 1000.
+ 					frameIndex := (frameIndex max: 0)
+ 								min: (mpegFile videoFrames: 0)
+ 										- 3.
+ 					mpegFile videoSetFrame: frameIndex stream: 0].
- 		ifTrue:
- 			[mpegFile hasVideo ifTrue:
- 				["set movie frame position from soundTrack position"
- 				soundTrack reset.  "ensure file is open before positioning"
- 				soundTrack soundPosition: (mpegFile videoGetFrame: 0) asFloat / (mpegFile videoFrames: 0).
- 				"now set frame index from the soundtrack position for best sync"
- 				frameIndex _ ((soundTrack millisecondsSinceStart * desiredFrameRate) // 1000).
- 				frameIndex _ (frameIndex max: 0) min: ((mpegFile videoFrames: 0) - 3).
- 				mpegFile videoSetFrame: frameIndex stream: 0].
- 
  			SoundPlayer stopReverb.
  			soundTrack volume: volume.
  			soundTrack repeat: repeat.
  			soundTrack resumePlaying.
+ 			startFrame := startMSecs := 0]
+ 		ifFalse: [soundTrack := nil.
+ 			startFrame := mpegFile videoGetFrame: 0.
+ 			startMSecs := Time millisecondClockValue].
+ 	running := true!
- 			startFrame _ startMSecs _ 0]
- 		ifFalse:
- 			[soundTrack _ nil.
- 			startFrame _ mpegFile videoGetFrame: 0.
- 			startMSecs _ Time millisecondClockValue].
- 	running _  true!

Item was added:
+ ----- Method: MPEGDisplayMorph>>startPlayingEtoysExample (in category 'commands') -----
+ startPlayingEtoysExample
+ 	self openExampleEtoysFile.
+ 	self startPlaying
+ !



More information about the etoys-dev mailing list