The extension to the VideoFile class for handling multiple files. More...
#include <videofileset.h>
Public Types | |
enum | OpenError { FILE_OPEN_FAILED, INVALID_FRAMECOUNT, OK, WRONG_FRAMERATE, WRONG_RESOLUTION } |
Values that the VideoFileSet::open() function can return. | |
Public Member Functions | |
VideoFileSet (SourceID desired_id=UNDEFINED_SOURCE) | |
Creates a new source. More... | |
FrameCapture | get (FrameTime passed_time) override |
Retrieves the next frame from the camera. More... | |
double | getBarrelCorrection () override |
Returns the barrel correction applied to the source frames. More... | |
std::string | getDescription () const override |
Retrieves the description of the source. More... | |
double | getFramerate () const override |
Retrieves the framerate. More... | |
std::vector< std::string > | getFilenames () const override |
Returns the filenames of the source. More... | |
cv::Size | getResolution () const override |
Retrieves the resolution of the source. More... | |
SourceType | getSourceType () const override |
Returns the type of the source. More... | |
SourceStats | getStats () override |
Retrieves the source statistical information. More... | |
bool | hasNew () override |
Checks whether the device has a new image to be retrieved or not. More... | |
bool | open (const std::string &filename, bool get_first, FrameTime start_point) override |
Opens a video file. More... | |
OpenError | open (const std::vector< std::string > &paths, FrameTime start_point) |
Opens the multifile video source. More... | |
void | play () override |
Starts frame updates on the file. More... | |
bool | skipFrame (int step) override |
Skips the specific amount of frames on the video. More... | |
void | setBarrelCorrection (double amount) override |
Sets the new barrel correction value. More... | |
void | stop () override |
Will stop the file from playing. More... | |
Public Member Functions inherited from cavapa_gui::VideoFile | |
VideoFile (SourceID desired_id=UNDEFINED_SOURCE) | |
Creates a new source. More... | |
bool | canRecord () const overridefinal |
Returns information on the source recording abilities. More... | |
virtual void | fetchFirstFrame () |
Seeks the startup point of the video and the first frame. | |
int | getCurrentFrame () const |
Returns the current frame of the video shown. More... | |
virtual FrameTime | getLength () const final |
Retrieves the video file length. More... | |
virtual FrameTime | getPosition () const overridefinal |
Retrieves the current time position of the source. More... | |
virtual bool | isOpen () const override |
Checks whether the source has been initialized or not. More... | |
virtual bool | isPlaying () const override |
Checks whether the source is playing or not. More... | |
bool | record (const std::string &filename, const std::string &codec="") overridefinal |
Starts the recording of the source to the file. More... | |
virtual void | release () |
Forces the release of the worker thread. More... | |
bool | seekTime (FrameTime pos) |
Seeks a specific position of the video frame. More... | |
void | setCurrentAsStartPoint () |
Sets the current video time as the seeking start point. More... | |
bool | setResolution (const cv::Size &new_size) overridefinal |
Should change resolution, but does not have an effect on video files. More... | |
virtual FrameTime | startPoint () const final |
Returns the start point of the video file. More... | |
int | totalFrames () const |
Returns the total count of the frames in the video file. More... | |
Public Member Functions inherited from cavapa_gui::Source | |
DISALLOW_COPY_AND_ASSIGN (Source) | |
Copy and assign of the class is not allowed. | |
virtual SourceID | getID () const final |
Gets the unique source ID number. More... | |
virtual void | resetStats () final |
Resets the source statistics. | |
Additional Inherited Members | |
Static Public Member Functions inherited from cavapa_gui::VideoFile | |
static void | setSpeed (double multiplier) |
Sets playing speed of the video file. More... | |
Protected Member Functions inherited from cavapa_gui::VideoFile | |
FrameTime | currentFrameTime () const |
Returns the time of the currently buffered frame. More... | |
int | frameFromFrameTime (FrameTime time) const |
Returns the expected frame number from the frame time. More... | |
FrameTime | frameTimeFromFrame (int frame) const |
Returns the expected frame time of the given frame. More... | |
Protected Member Functions inherited from cavapa_gui::Source | |
Source (SourceID desired_id=UNDEFINED_SOURCE) | |
General Source creator. More... | |
Protected Attributes inherited from cavapa_gui::VideoFile | |
int | current_frame |
The number of the currently buffered frame. | |
FrameTime | initial_position |
The initial position of the video file. | |
bool | opened = false |
The open status of the video file. | |
bool | playing = false |
The flag indicates if the video file is playing or not. | |
int | total_frames = 0 |
The total frames in the video file. | |
FrameTime | video_time = 0 |
The current time of the video file. | |
Protected Attributes inherited from cavapa_gui::Source | |
SourceStats | statistics = EMPTY_SOURCE_STATS |
The statistics of the source. | |
Static Protected Attributes inherited from cavapa_gui::VideoFile | |
static double | speed_ratio = 1.0 |
The multiplier of the video file playing speed. | |
The extension to the VideoFile class for handling multiple files.
When there is a need to play multiple video files in sequence, the VideoFile class is not enough. This class provides functionality to automatically switch between the files to provide a seamless playback.
|
inline |
Creates a new source.
desired_id | The Desired ID number. Use UNDEFINED_SOURCE if you do not want to define it to a specific ID. This does not check if a source with the given ID already exists. The ID-number will not be given to other new sources with UNDEFINED_SOURCE ID numbers. |
|
overridevirtual |
Retrieves the next frame from the camera.
The time supplied to the function informs the source about how much time has passed since the last image retrieval. The source will depend on its internal clock, either retrieving a new image or returning the buffered image that it retrieved previously.
passed_time | The time passed since the last call (in milliseconds). |
Reimplemented from cavapa_gui::VideoFile.
|
overridevirtual |
Returns the barrel correction applied to the source frames.
Reimplemented from cavapa_gui::VideoFile.
|
overridevirtual |
Retrieves the description of the source.
Reimplemented from cavapa_gui::VideoFile.
|
overridevirtual |
Returns the filenames of the source.
Reimplemented from cavapa_gui::VideoFile.
|
overridevirtual |
Retrieves the framerate.
Reimplemented from cavapa_gui::VideoFile.
|
overridevirtual |
Retrieves the resolution of the source.
Reimplemented from cavapa_gui::VideoFile.
|
inlineoverridevirtual |
|
overridevirtual |
Retrieves the source statistical information.
Reimplemented from cavapa_gui::VideoFile.
|
inlineoverridevirtual |
Checks whether the device has a new image to be retrieved or not.
This checks if the FrameTime on the buffered image differs from what was retrieved on the last get().
Reimplemented from cavapa_gui::VideoFile.
|
inlineoverridevirtual |
Opens a video file.
filename | The path of the video file. |
get_first | If the first image of the video should be retrieved or not. This is useful in most cases, but if we are opening multiple video files of the same source it might be wise to set this false. This way a worker thread of the frame retrieval is not automatically started. |
start_point | The video start point. This will be used as the initial position of the video. All seekTime() calls will be based on the position. |
Reimplemented from cavapa_gui::VideoFile.
VideoFileSet::OpenError cavapa_gui::VideoFileSet::open | ( | const std::vector< std::string > & | paths, |
FrameTime | start_point | ||
) |
Opens the multifile video source.
paths | The paths of the video files. |
start_point | The video start point. This will be used as the initial position of the video. All seekTime() calls will be based on this position. |
|
overridevirtual |
Starts frame updates on the file.
After the video file has been set to play, it will start to retrieve new frames for each get() call.
Reimplemented from cavapa_gui::VideoFile.
|
overridevirtual |
Sets the new barrel correction value.
The value is used to correct barrel effect (lens correction) on each image that the source will return.
amount | The barrel value. |
Reimplemented from cavapa_gui::VideoFile.
|
overridevirtual |
Skips the specific amount of frames on the video.
The positive numbers skip forward and negatives skip backward. The frame will be limited to the actual limits of the video, skipping 10 million frames will just seek to the last frame of the video.
step | The desired frame change. |
Reimplemented from cavapa_gui::VideoFile.
|
overridevirtual |
Will stop the file from playing.
Any calls to function get() will return the same buffered image and will not advance the videos internal clock. Use play() to start retrieving images again.
Reimplemented from cavapa_gui::VideoFile.