Squeak Class Documentation category index | class index  
 
MPEGDisplayMorph
  category: MPEG-Player
  superclass: Morph
  subclasses:

I am a simple display screen for an MPEG movie player. My step method advances the movie according to the current frame rate. If necessary, frames as skipped to maintain the desired frame rate. However, since even skipping frames takes time, it may not be possible to achieve fast frame rates with large frame sizes on slow machines.

instance methods
  accessing
  extent:
moviePosition
moviePosition:
repeat
repeat:
volume
volume:

  commands
  nextFrame
previousFrame
rewindMovie
setFrameRate
startPlaying
stopPlaying

  drawing
  areasRemainingToFill:
drawOn:
drawScaledOn:

  file open/close
  closeFile
mpegFileIsOpen
openFileNamed:
openMPEGFile

  initialization
  initialize

  other
  advanceFrame
jpegMovieSize:
measureMaxFrameRate

  stepping
  step
stepTime

class methods
  no messages
 

instance methods
  accessing top  
 

extent:

Overridden to maintain movie aspect ratio.


 

moviePosition

Answer a number between 0.0 and 1.0 indicating the current position within the movie.


 

moviePosition:

Jump to the position the given fraction through the movie. The argument is a number between 0.0 and 1.0.


 

repeat

Answer the repeat flag.


 

repeat:

Set the repeat flag. If true, the movie will loop back to the beginning when it gets to the end.


 

volume

Answer the sound playback volume.


 

volume:

Set the sound playback volume to the given level, between 0.0 and 1.0.


  commands top  
 

nextFrame

Fetch the next frame into the frame buffer.


 

previousFrame

Go to the previous frame.


 

rewindMovie

Rewind to the beginning of the movie.


 

setFrameRate

Ask the user to specify the desired frame rate.


 

startPlaying

Start playing the movie at the current position.


 

stopPlaying

Stop playing the movie.


  drawing top  
 

areasRemainingToFill:

Drawing optimization. Since I completely fill my bounds with opaque pixels, this method tells Morphic that it isn't necessary to draw any morphs covered by me.


 

drawOn:

Draw the current frame image, if there is one. Otherwise, fill screen with gray.


 

drawScaledOn:

Draw the current frame image scaled to my bounds.


  file open/close top  
 

closeFile

Close my MPEG file, if any.


 

mpegFileIsOpen

Answer true if I have an open, valid MPEG file handle. If the handle is not valid, try to re-open the file.


 

openFileNamed:

Try to open the MPEG file with the given name. Answer true if successful.


 

openMPEGFile

Invoked by the 'Open' button. Prompt for a file name and try to open that file as an MPEG file.


  initialization top  
 

initialize


  other top  
 

advanceFrame

Advance to the next frame if it is time to do so, skipping frames if necessary.


 

jpegMovieSize:

Convert all my frames to a JPEG and measure the total size.


 

measureMaxFrameRate

For testing. Play through the movie as fast as possible, updating the world each time, and report the frame rate.


  stepping top  
 

step

If I'm running and the mpegFile is open and has video, advance to the next frame. Stop if we we hit the end of the video.


 

stepTime

Run my step method as often as possible. Step does very little work if it is not time to advance to the next frame.


class methods
  no messages top