VideoVis
0.9
Generates a volume visualisation of a video
|
This class loads video files. More...
#include <VideoFrameLoader.h>
Public Member Functions | |
CVideoFrameLoader (void) | |
This is the default constructor. More... | |
CVideoFrameLoader (PWSTR filePath) | |
Constructor to load a file. More... | |
~CVideoFrameLoader (void) | |
Destructor. More... | |
VFLResult | setVideoPath (PWSTR filePath) |
Opens a new videofile. More... | |
VFLResult | setVideoURL (PWSTR fileURL) |
Opens a new videofile. More... | |
VFLResult | loadAllFramesIntoBuffer () |
Loads all video frames of the opend video file. More... | |
VFLResult | loadAllFramesIntoBuffer (int offset, int distanceBetween) |
Loads all video frames with offset and distance between. More... | |
VFLResult | loadAllFramesIntoBuffer (int offset, int distanceBetween, int lastFrame) |
Loads all video frames with offset, distance between and sets a last frame. More... | |
VFLResult | addNextFrameToBuffer () |
Adds the next frame at the current video file position. More... | |
VFLResult | addNextFrameToBuffer (int distanceFromLast) |
Adds the next frame at an offset from the current video file position. More... | |
VFLResult | getVideoResolution (int *width, int *height) |
Returns the resolution of the current loaded video file. More... | |
VFLResult | getVideoBuffer (PBYTE *videoArray) |
Returns the BYTE-Array in which the video data is stored. More... | |
VFLResult | getBufferFrameCount (int *frameCount) |
Returns the number of fames that have been saved to the byte array. More... | |
void | reset () |
Resets the "play head" to the starting position. More... | |
HRESULT | setPosition (const LONGLONG &hnsPosition) |
Sets the position of the "play head" to a new time code. More... | |
Protected Member Functions | |
virtual VFLResult | resetProperties () |
Completly resets the object. More... | |
void | copyVideoListToVideoArray () |
Copies the video data from the internal storage into the video array. More... | |
Protected Attributes | |
PBYTE | p_videoArray |
This class loads video files.
This class can load video files into a BYTE-Array. It uses the windows media foundation framework and should work under Windows 7, 8 and later. It can load all frames of a video file, all frames after an offset or single frames with a given distance to the last loaded frame.
Definition at line 40 of file VideoFrameLoader.h.
CVideoFrameLoader::CVideoFrameLoader | ( | void | ) |
This is the default constructor.
It simple initialises the object. To open a video file you can use the other constructor, the setVideoPath(PWSTR filePath) method or the setVideoURL(PWSTR fileURL) method.
Definition at line 9 of file VideoFrameLoader.cpp.
CVideoFrameLoader::CVideoFrameLoader | ( | PWSTR | filePath) |
Constructor to load a file.
Initialises the object and loads the specified file.
filePath | a pointer to a WSTR which contains the path to the video file in windows syntax |
Definition at line 14 of file VideoFrameLoader.cpp.
CVideoFrameLoader::~CVideoFrameLoader | ( | void | ) |
VFLResult CVideoFrameLoader::addNextFrameToBuffer | ( | ) |
Adds the next frame at the current video file position.
After that, the "play head" moves to the next frame.
Definition at line 196 of file VideoFrameLoader.cpp.
VFLResult CVideoFrameLoader::addNextFrameToBuffer | ( | int | distanceFromLast) |
Adds the next frame at an offset from the current video file position.
The function skipps the specified number of frames in the video file and reads the frame at that position
distanceFromLast | integer value that specifies the distance from the last read frame; if 0 the next consecutive frame is read |
Definition at line 201 of file VideoFrameLoader.cpp.
|
protected |
Copies the video data from the internal storage into the video array.
Call this method in your derived class if you want to access the data in a consecutive memory block. After the call the p_videoArray pointer points to a byte array with the video data. If only this method is invoked, the byte array will be destroyed bevor a new video is loaded or the object is deleted.
Definition at line 353 of file VideoFrameLoader.cpp.
VFLResult CVideoFrameLoader::getBufferFrameCount | ( | int * | frameCount) |
Returns the number of fames that have been saved to the byte array.
frameCount | a pointer to an integer where the number of captured frames will be saved |
Definition at line 266 of file VideoFrameLoader.cpp.
VFLResult CVideoFrameLoader::getVideoBuffer | ( | PBYTE * | videoArray) |
Returns the BYTE-Array in which the video data is stored.
The caller receives a pointer to the byte array in which the video data resides in BGRA-format. The size of the array is the number of frames times the width and the height of the video times 4. These values can be obtained by calling the apropriate methods. After this method has been called, the array will never be delete. It falls to the caller to delete the array after usage.
videoArray | a pointer to a pointer to a BYTE |
Definition at line 252 of file VideoFrameLoader.cpp.
VFLResult CVideoFrameLoader::getVideoResolution | ( | int * | width, |
int * | height | ||
) |
Returns the resolution of the current loaded video file.
This method returns good data, only after the video file has been succesfully loaded.
width | pointer to an integer, where the video width will be saved |
height | pointer to an integer, where the video height will be saved |
Definition at line 241 of file VideoFrameLoader.cpp.
VFLResult CVideoFrameLoader::loadAllFramesIntoBuffer | ( | ) |
Loads all video frames of the opend video file.
The frames will be saved into a BYTE buffer. The buffer can then be retrieved by calling getVideoBuffer(PBYTE *videoArray).
Definition at line 164 of file VideoFrameLoader.cpp.
VFLResult CVideoFrameLoader::loadAllFramesIntoBuffer | ( | int | offset, |
int | distanceBetween | ||
) |
Loads all video frames with offset and distance between.
The frames will be saved into a BYTE buffer. The buffer can then be retrieved by calling getVideoBuffer(PBYTE *videoArray).
offset | an integer value starting by 0 that specifies the offset of frames from the start of the video |
distanceBetween | an integer value the specifies the number of frames between to frames, that are left out |
Definition at line 169 of file VideoFrameLoader.cpp.
VFLResult CVideoFrameLoader::loadAllFramesIntoBuffer | ( | int | offset, |
int | distanceBetween, | ||
int | lastFrame | ||
) |
Loads all video frames with offset, distance between and sets a last frame.
The frames will be saved into a BYTE buffer. The buffer can then be retrieved by calling getVideoBuffer(PBYTE *videoArray).
offset | an integer value starting by 0 that specifies the offset of frames from the start of the video |
distanceBetween | an integer value the specifies the number of frames between to frames, that are left out |
lastFrame | an inteber value specifying the last frame that should be read; if 0 the method reads till the last frame of the video file |
Definition at line 174 of file VideoFrameLoader.cpp.
void CVideoFrameLoader::reset | ( | ) |
Resets the "play head" to the starting position.
The byte array will remain filled. To completly reset the object you have to reopen the video file.
Definition at line 276 of file VideoFrameLoader.cpp.
|
protectedvirtual |
Completly resets the object.
This virtual method is called to reset the reset all neccessary member properties bevor a new video file is loaded. Overwrite this method to reset your own properties before a new video file is loaded, if you derive from this class.
Reimplemented in CVideoFrameToTextureLoader.
Definition at line 74 of file VideoFrameLoader.cpp.
HRESULT CVideoFrameLoader::setPosition | ( | const LONGLONG & | hnsPosition) |
Sets the position of the "play head" to a new time code.
The byte array will remain filled. To completly reset the object you have to reopen the video file.
hnsPosition | a LONGLONG value of the new "play head" position in 100 ms increments. |
Definition at line 340 of file VideoFrameLoader.cpp.
VFLResult CVideoFrameLoader::setVideoPath | ( | PWSTR | filePath) |
Opens a new videofile.
If there is another video file loaded, the file will be closed and all references will be deleted.
filePath | a pointer to a WSTR which contains the path to the video file in windows syntax |
Definition at line 90 of file VideoFrameLoader.cpp.
VFLResult CVideoFrameLoader::setVideoURL | ( | PWSTR | fileURL) |
Opens a new videofile.
If there is another video file loaded, the file will be closed and all references will be deleted.
fileURL | a pointer to a WSTR which contains the URL to the video file |
Definition at line 110 of file VideoFrameLoader.cpp.
|
protected |
Pointer to the video array. It's only filled when the getVideoBuffer(PBYTE *videoArray) or the getVideoBuffer(PBYTE *videoArray) method is called.
Definition at line 196 of file VideoFrameLoader.h.