availability: mgl 2.0 Mac OS X 64-bit Matlab only
usage: movieStruct = mglMovie(filename,position) or mglMovie(movieStruct,command,<argument>);
purpose: Used to display quicktime movies. (This *only* works on 64 bit Mac. There is some issue with the quicktime library QTKit and threads which does not seem to be a problem on 64 bit). You also need to be using a cocoa window, so make sure to set mglSetParam('movieMode',1) before running mglOpen. Check the sample experiment, taskTemplateMovie for a working example.
Also, note that the movies will play in front of the openGL buffer. Thus you can't draw on top of the movie and mglFrameGrab won't grab the movie frame – you can grab movie frames with mglMovie(m,'getFrame');
To init the movie, you open with a filename, and an optional position array [x y width height] and save the returned structure.
mglSetParam('movieMode',1);
mglOpen; m = mglMovie('movie.mov');
Then you can run commands on the movie:
mglMovie(m,'play');
If no position is specified, the movie will be made to fill the display. Then pass in the structure with any of the following commands:
command | purpose |
---|---|
0:'close“ | Close the movie. After you run this, you will no longer be able to play the movieStruct again since the memory will have been released. |
1:'play' | Play the movie |
2:'pause' | Pause the movie |
3:'gotoBeginning' | Goto the beginning of the movie |
4:'gotoEnd' | Goto the end of the movie |
5:'stepForward' | Step one frame forward in the movie |
6:'stepBackward' | Step one frame backward in the movie |
7:'hide' | Hide the movie. This does not close the movie, so you will be able to show the movieStruct again by using show. |
8:'show' | Show the movie after it has been hidden |
9:'getDuration' | Get a string that represents the length of the movie |
10:'getCurrentTime' | Gets the current time of the movie |
11:'setCurrentTime' | Sets the current time of the movie to the string\passed in. Make sure the string is one returned from getCurrentTime |
12:'getFrame' | Returns a nxmx3 matrix containing RGB data for current frame |
Here is a sample quicktime movie that should work with mglMovie: bosque.mov