![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/ImageCompressionCodec.h>
Saving and loading of compressed image data through video codecs. More...
Saving and loading of compressed image data through video codecs.
This class supports asynchronous saving of images. You need to instantiate a new object of this class with an image container that already has at least one image inside.
Public Types | |
enum | CompressionCodec { FFV1 , H264 } |
Enum of supported video codecs. More... | |
Public Member Functions | |
ImageCompressionCodec (SharedImageSet *is, const ImageDescriptor &desc) | |
Constructor for loading data with empty image set container. | |
ImageCompressionCodec (SharedImageSet *is) | |
Constructor with an allocated image set container to save. | |
virtual | ~ImageCompressionCodec () |
Destructor. | |
bool | load (std::istream &file) |
Loads a compressed image set. | |
bool | save (std::ostream &file) |
Saves a compressed image set in one go. | |
bool | startSaveAsync (std::ostream &file) |
Prepares the asynchronous saving of images. | |
bool | addFrameAsync (TypedImage< unsigned char > *memImg) |
After calling startSaveAsync(), call this method to encode an image. Blocking. | |
bool | closeAsync () |
After calling startSaveAsync() and addFrameAsync() for each image, finalize the operation with this method. | |
void | setProgress (Progress *p) |
Set optional progress callback. | |
void | setCodec (CompressionCodec c) |
Sets the compression codec. | |
CompressionCodec | codec () const |
Returns the compression codec. | |
Static Public Member Functions | |
static void | registerAllCodecs () |
To be called from base factory. | |
Protected Member Functions | |
bool | encodeFrameInBuffer () |
enum CompressionCodec |
bool save | ( | std::ostream & | file | ) |
Saves a compressed image set in one go.
Internally calls startSaveAsync(), addFrameAsync() for each frame, and eventually closeAsync().
bool startSaveAsync | ( | std::ostream & | file | ) |
Prepares the asynchronous saving of images.
The SharedImageSet provided in the constructor must already at construction (!) be filled with at least one image to ensure correct encoder metadata. Does not save any images, call addFrameAsync() for each image.
bool closeAsync | ( | ) |
After calling startSaveAsync() and addFrameAsync() for each image, finalize the operation with this method.
Without it, the data will not be readable.