Handle events as discussed in the Overview section.
Using the movie for GL pixel operations - To use the
movie in standard (non-texturing) situations, use the
getImageDimensions method to get the demensions of the actual frame
data, and do all operations on the DMbuffer data from (0,0) to
(imageSizeX,imageSizeY).
Using the movie for texture mapping - To use the movie as
a texture map, use the getBufferDimensions method to get the
size of the DMbuffer that's actally used for the frame data. A
number of methods are provided to make setting proper texture
coordinates for your texture map easier. See the
movieTexCoord2d, movieTexCoord2f, getTexCoordScaleXF and
getTexCoordScaleYF for more information.
See the source code for more info and implementation details.
Public Methods
- dmuMovieIn()
Performs construction of object and initialization of internal
member variables
- ~dmuMovieIn()
Performs destruction of the object. This closes an open movie
file, cleans up the associated DMbufferPool, and frees memory
resources.
- virtual int setup(char *newFileName)
Opens the file pointed to by newFileName and extracts the
size, buffer size and other information associated with the image
track of the movie. Returns DMU_OK on success, or a dmuError
value on failure
- virtual int init(dmuParams *params = NULL)
This method is purely virtual, and is implemented by any class
that inherits from dmuMovieIn. Handles DMbuffer allocation,
and other setup needed before the read thread starts
- virtual int start(int propagate = DMU_PROPAGATE)
Starts the movie read thread. This creates a separate thread
and starts reading the movie which has been opened by setup.
Once the read thread is started, it can only be stopped by
destrying the object.
- int handleEvents(fd_set fdSet)
Standard handle events - Called when the file descriptor has
signalled the use program that there's a new frame to be had.
This will pass the latest video frame down the dmu chain
- int getFD()
Gets the file descriptor which is associated with the movie
read loop. This file descriptor should be used with select
or poll to stall the user program until there is a new
movie frame available from the read loop.
- int setBufferDimensions(int newSizeX,int newSizeY)
This can only be called after setup and before
init(). The default behavior of movieIn objects is to
render into a buffer size that is rounded up to the next power of
two.. This allows easy texture mapping capabilities. There are
cases where This may not be appropriate (for example, when
sending the movie buffers directly to video out). This method
allows you to override the default buffer size before the
DMBuffer pool is created in init(). The new dimensions must
be at least as large as the movie image dimensions. If they
are not, then DMU_BAD_BUFFER_SIZE is returned.
- void movieTexCoord2d(GLdouble x, GLdouble y)
This method calls glTexCoord2d with appropiately scaled texture
coordinates. This is used to compensate for the fact that the
DMbuffer that is actually used to store the texture is (usually)
larger than the movie frame. Call this with texture coordinates
that assume 0.0->1.0 mapping of the texture, and it will scale
them by texCoordScaleXD, and texCoordScaleYD.
- void movieTexCoord2f(GLfloat x, GLfloat y)
Same as movieTexCoord2d, except this method uses float values,
and calls glTexCoord2f instead of glTexCoord2d
Overview Object List Object Hierarchy
Sample Apps