This class implements support for video files of the OGG/Vorbis format. More...
#include <CVideo.h>
Public Member Functions | |
cVideo () | |
Default constructor of cVideo. More... | |
virtual | ~cVideo () |
Destructor of cVideo. More... | |
cVideoPtr | copy () |
This method creates a copy of this object. More... | |
void | erase () |
This method frees video from memory. More... | |
bool | isInitialized () const |
This method returns true if a video file has been loaded in memory, false otherwise. More... | |
unsigned int | getWidth () const |
This method returns the width of video image. More... | |
unsigned int | getHeight () const |
This method returns the height of video image. More... | |
unsigned int | getFrameCount () const |
This method returns the number of frames of this video stream. More... | |
double | getDuration () const |
This method returns the duration of this video in seconds. More... | |
double | getFPS () const |
This method returns the rate of this video in frames per second. More... | |
void | play () |
This method starts playing the video. More... | |
void | setPlaybackSpeed (double a_speed) |
This method control playback speed. More... | |
double | getPlaybackSpeed () |
This method retrieves playback speed. More... | |
void | pause () |
This method pauses the video. More... | |
void | stop () |
This method stops the video. More... | |
void | setAutoReplay (bool a_replay=true) |
This method enables or disables the auto-replay mode. More... | |
bool | isPaused () |
This method returns the video playing status. More... | |
bool | seek (double a_time) |
This method seeks a particular time in the video. More... | |
bool | seekFrame (unsigned int a_index) |
This method seeks a particular frame in the video. More... | |
int | getCurrentFrameIndex () |
This method returns the index number of the current video frame. More... | |
double | getCurrentTimePosition () |
This method returns the time position of the current video frame. More... | |
bool | getCurrentFramePointer (cImage &a_image) |
This method returns a pointer to the current frame (does not allocate a copy). More... | |
bool | getCurrentFrame (cImage &a_image) |
This method returns a copy of the current frame. More... | |
bool | getFramePointer (int a_index, cImage &a_image) |
This method returns a pointer to any frame (does not allocate a copy). More... | |
bool | getFrame (int a_index, cImage &a_image) |
This method returns a copy of any frame. More... | |
bool | loadFromFile (const std::string &a_filename) |
This method loads the video file by passing image path and name as argument. More... | |
std::string | getFilename () const |
This method returns the filename from which this video was last loaded or saved. More... | |
std::string | getName () const |
This method returns the video title. More... | |
Static Public Member Functions | |
static cVideoPtr | create () |
Shared cVideo allocator. More... | |
Protected Member Functions | |
void | defaults () |
This method initializes member variables. More... | |
void | cleanup () |
This method deletes memory and removes any video that was previously loaded. More... | |
bool | update () |
This method updates the frame index and pointer to the current time. More... | |
void | reset () |
This method reset the video to the first frame and make it ready to play again. More... | |
void | storeFrame (void *frame) |
This method stores a frame locally (and flip horizontally). More... | |
Protected Attributes | |
std::string | m_filename |
Video filename. More... | |
std::string | m_name |
Video name. More... | |
unsigned int | m_width |
Width in pixels of the current video. More... | |
unsigned int | m_height |
Height in pixels of the current video. More... | |
unsigned int | m_frameCount |
Frame count of the current video. More... | |
unsigned int | m_frameIndex |
Current frame index of the current video. More... | |
double | m_duration |
Duration in seconds of the current video. More... | |
double | m_lastUpdate |
Last time the frame index was updated. More... | |
bool | m_firstFrame |
First frame flag. More... | |
bool | m_autoReplay |
Auto replay flag. More... | |
double | m_fps |
Frame per seconds of the current video. More... | |
cPrecisionClock | m_clock |
Video manager time base. More... | |
void * | m_clip |
Video clip object. More... | |
unsigned char * | m_data |
Video frame data. More... | |
Static Protected Attributes | |
static unsigned int | m_clipCount = 0 |
Shared clip counter. More... | |
static cMutex | m_sharedLock |
Shared members lock. More... | |
static void * | m_manager = NULL |
Shared video manager. More... | |
static void * | m_audio = NULL |
Interface to audio control. More... | |
This class implements support for video files of the OGG/Vorbis format. Audio is also supported.
chai3d::cVideo::cVideo | ( | ) |
Default constructor of cVideo.
|
virtual |
Destructor of cVideo.
|
inlinestatic |
cVideoPtr chai3d::cVideo::copy | ( | ) |
This method creates a copy of itself.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void chai3d::cVideo::play | ( | ) |
This method start playing the video, and also starts audio decoding if available. At any given moment, the correct frame can be retrieved by calling cVideo::getCurrentFramePointer() or cVideo::getCurrentFrame().
void chai3d::cVideo::setPlaybackSpeed | ( | double | a_speed | ) |
This method sets the playback speed as a ratio of normal speed.
a_speed | Ratio of normal speed to use for playback. |
double chai3d::cVideo::getPlaybackSpeed | ( | ) |
This method retrieves the playback speed as a ratio of normal speed.
void chai3d::cVideo::pause | ( | ) |
This method pauses the video if it is playing. The current (frozen) frame can still be retrieved with cVideo::getCurrentFramePointer() or cVideo::getCurrentFrame(), but will not be updated until cVideo::play() is called again.
void chai3d::cVideo::stop | ( | ) |
This method stops the video. This resets the current frame and the time position to the beginning of the video. cVideo::getCurrentFramePointer() or cVideo::getCurrentFrame() return the first video frame.
void chai3d::cVideo::setAutoReplay | ( | bool | a_replay = true | ) |
This method controls the auto-replay setting. When auto-replay is enabled, the video will automatically start playing again after it reaches the last frame. If auto-replay is disabled, cVideo::play() must be called again to restart the video.
a_replay | Set to true to make the movie auto-replay, false to disable auto-replay. |
bool chai3d::cVideo::isPaused | ( | ) |
This method checks if the video is paused, as opposed to playing. The paused state is entered after calling cVideo::pause() or cVideo::stop(), or after loading a new video using cVideo::loadFromFile().
bool chai3d::cVideo::seek | ( | double | a_time | ) |
This method seeks a given time position in the video stream. If the video is playing, keep playing from the new position.
a_time | The desired time position to seek in the video. |
bool chai3d::cVideo::seekFrame | ( | unsigned int | a_index | ) |
This method seeks a given frame in the video stream. If the video is playing, keep playing from the new frame position.
a_index | The desired frame index to seek in the video. |
|
inline |
double chai3d::cVideo::getCurrentTimePosition | ( | ) |
This method retrieves the video time position.
bool chai3d::cVideo::getCurrentFramePointer | ( | cImage & | a_image | ) |
This method fills a cImage object to point to the image data of the current video frame. The actual data buffer is still owned by the video, and may be destroyed when the video moves on to the next frame (if it is playing). To get a permanent copy of a frame buffer, use getCurrentFrame() instead.
a_image | Image object to set to frame data. |
bool chai3d::cVideo::getCurrentFrame | ( | cImage & | a_image | ) |
This method fills a cImage object with a copy of the image data of the current video frame. The actual data buffer is copied from the video frame. To get a temporary copy of the current frame buffer, use getCurrentFramePointer() instead.
a_image | Image object to set to frame data. |
bool chai3d::cVideo::getFramePointer | ( | int | a_index, |
cImage & | a_image | ||
) |
Fill a cImage object with a copy of the image data of a given video frame. The actual data buffer is copied from the video frame.
a_index | Index of the video frame to copy. |
a_image | Image object to set to frame data. |
bool chai3d::cVideo::getFrame | ( | int | a_index, |
cImage & | a_image | ||
) |
This method fills a cImage object with a copy of the image data of a given video frame. The actual data buffer is copied from the video frame.
a_index | Index of the video frame to copy. |
a_image | Image object to set to frame data. |
bool chai3d::cVideo::loadFromFile | ( | const std::string & | a_filename | ) |
This method loads this video from the specified file. Returns true if all goes well. Note that regardless of whether it succeeds, this overwrites any video that had previously been loaded by this object.
a_filename | Video filename. |
|
inline |
|
inline |
|
protected |
This method initializes internal variables.
|
protected |
This method frees memory that was used for video data, and re-initialize internal variables.
|
protected |
This method updates the current frame pointer to the current time. This method is used internally by cVideo::getCurrentFramePointer() and cVideo::getCurrentFrame() to keep track of the correct frame over time.
|
protected |
This internal method is used to reset the video to its first frame, launch the background decoder thread, and wait until enough frames have been buffered so that we should be safe to start playing the video.
|
inlineprotected |
This method flips a new frame the right way around before making it available to the outside world.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |