VideoWriter Class Reference
Represents a video writer. More...
Public Member Functions
VideoWriter (VideoWriterType type, Error &err=Error::Default()) Creates a new video writer. |
|
bool | is_valid () const noexcept Checks whether this video writer is a valid object. |
bool | beginFile (const char *file_name, const ImageType &image_type, double frame_rate, Error &err=Error::Default()) Opens a new video file ready to write images into. |
bool | beginFile (const std::string &file_name, const ImageType &image_type, double frame_rate, Error &err=Error::Default()) Opens a new video file ready to write images into. |
bool | finishFile (Error &err=Error::Default()) Finishes writing a video file. |
bool | addFrame (const std::shared_ptr< ImageBuffer > &buffer, Error &err=Error::Default()) Adds an image to the currently open video file. |
bool | addFrame (const ImageBuffer &buffer, Error &err=Error::Default()) Adds an image to the currently open video file, copying its contents in the process. |
PropertyMap | propertyMap (Error &err=Error::Default()) Returns the property map for encoder configuration. |
Detailed Description
Represents a video writer.
To create a video writer, use the VideoWriter::VideoWriter constructor, passing the type of the desired video file.
After creating the video writer, call VideoWriter::beginFile() to start writing a new video file. Call VideoWriter::addFrame() to add images to the video file. To complete the recording, call VideoWriter::finishFile().
Use VideoWriter::propertyMap() to access encoder configuration options.
VideoWriter objects are movable.
Constructor & Destructor Documentation
◆ VideoWriter()
|
inline |
Creates a new video writer.
- Parameters
-
[in] type The type of video file to create a writer for [out] err Reference to an error handler. See Error Handling for details.
- Note
- If the constructor fails, the video writer object is in an invalid state. All member function calls will fail.
- See also
- VideoWriter::is_valid
Member Function Documentation
◆ addFrame() [1/2]
|
inline |
Adds an image to the currently open video file, copying its contents in the process.
- Parameters
-
[in] buffer Image buffer to be added to the video file. [out] err Reference to an error handler. See Error Handling for details.
- Returns
true
on success, otherwisefalse
.
Check the err output parameter for error code and error message.
- Precondition
- VideoWriter::beginFile() must be called before adding images to the video file.
- Note
- The image buffer's image type must be equal to the image_type parameter passed to VideoWriter::beginFile() when starting the file.
◆ addFrame() [2/2]
|
inline |
Adds an image to the currently open video file.
- Parameters
-
[in] buffer Image buffer to be added to the video file. [out] err Reference to an error handler. See Error Handling for details.
- Returns
true
on success, otherwisefalse
.
Check the err output parameter for error code and error message.
- Precondition
- VideoWriter::beginFile() must be called before adding images to the video file.
- Note
- The image buffer's image type must be equal to the image_type parameter passed to VideoWriter::beginFile() when starting the file.
-
The video writer can retain a reference to the image buffer. This can delay the release and possible reuse of the image buffer. In this case, the buffer becomes shared, and is no longer safely writable (see ImageBuffer::isWritable).
◆ beginFile() [1/2]
|
inline |
Opens a new video file ready to write images into.
- Parameters
-
[in] file_name Name of the new video file [in] image_type Image type of the images that are going to be written [in] frame_rate Playback frame rate of the video file [out] err Reference to an error handler. See Error Handling for details.
- Returns
true
on success, otherwisefalse
.
Check the err output parameter for error code and error message.
- See also
- VideoWriter::finishFile()
◆ beginFile() [2/2]
|
inline |
Opens a new video file ready to write images into.
- Parameters
-
[in] file_name Name of the new video file [in] image_type Image type of the images that are going to be written [in] frame_rate Playback frame rate of the video file [out] err Reference to an error handler. See Error Handling for details.
- Returns
true
on success, otherwisefalse
.
Check the err output parameter for error code and error message.
- See also
- VideoWriter::finishFile()
◆ finishFile()
|
inline |
Finishes writing a video file.
- Parameters
-
[out] err Reference to an error handler. See Error Handling for details.
- Returns
true
on success, otherwisefalse
.
Check the err output parameter for error code and error message.
- See also
- VideoWriter::beginFile()
◆ is_valid()
|
inlinenoexcept |
Checks whether this video writer is a valid object.
If the constructor could not create a valid device information object, and the passed err
was not set to ic4::Error::Throw(), an invalid object is created. All member function calls will fail.
- Returns
true
, if this video writer object was constructed successfully, otherwisefalse
.
In case of an error, check the error parameter of the source function for details.
- See also
- Error Handling
◆ propertyMap()
|
inline |
Returns the property map for encoder configuration.
- Parameters
-
[out] err Reference to an error handler. See Error Handling for details.
- Returns
- A property map. If the function fails, the property map is invalid.
Check the err output parameter or PropertyMap::is_valid().