This class implements utilities functions for the media library.
More...
|
typedef std::vector< uint8_t > | Buffer |
| Definition of a vector holding 8 bit elements. More...
|
|
|
static Frame | loadImage (const std::string &url) |
| Loads an image defined by the url and returns the frame. More...
|
|
static Frame | loadImage (const void *imageBuffer, const size_t imageBufferSize, const std::string &imageBufferTypeIn=std::string(""), std::string *imageBufferTypeOut=nullptr) |
| Loads an image defined by a memory buffer, the size of the buffer and the type of the stored image information. More...
|
|
static bool | saveImage (const Frame &frame, const std::string &url, const bool addTimeSuffix=true) |
| Saves a frame as image file. More...
|
|
static bool | saveImage (const Frame &frame, const std::string &imageType, Buffer &buffer) |
| Saves a frame into a memory buffer. More...
|
|
static void | encodeFrame (const Frame &frame, const std::string &imageType, Buffer &buffer) |
| Encodes a frame to a buffer and adds further control parameters to the buffer. More...
|
|
static Buffer | encodeFrame (const Frame &frame, const std::string &imageType, const size_t reservedHeaderSize=0) |
| Encodes a frame to a buffer and adds further control parameters to the buffer. More...
|
|
static bool | decodeFrame (const uint8_t *&data, size_t &size, Frame &frame) |
| Decodes a frame from a maintenance data buffer. More...
|
|
static bool | decodeFrame (const Buffer &buffer, Frame &frame) |
| Decodes a frame from a data buffer holding the compressed image content as well as further control parameters. More...
|
|
This class implements utilities functions for the media library.
◆ Buffer
Definition of a vector holding 8 bit elements.
◆ decodeFrame() [1/2]
bool Ocean::Media::Utilities::decodeFrame |
( |
const Buffer & |
buffer, |
|
|
Frame & |
frame |
|
) |
| |
|
inlinestatic |
Decodes a frame from a data buffer holding the compressed image content as well as further control parameters.
- Parameters
-
buffer | The buffer from which the frame will be decoded |
frame | The resulting frame |
- Returns
- True, if succeeded
◆ decodeFrame() [2/2]
static bool Ocean::Media::Utilities::decodeFrame |
( |
const uint8_t *& |
data, |
|
|
size_t & |
size, |
|
|
Frame & |
frame |
|
) |
| |
|
static |
Decodes a frame from a maintenance data buffer.
- Parameters
-
data | The buffer providing the frame, will be shifted by the number of consumed bytes afterwards |
size | The size of the entire buffer, will be reduced by the number of consumed bytes afterwards |
frame | The resulting frame |
- Returns
- True, if succeeded
◆ encodeFrame() [1/2]
static void Ocean::Media::Utilities::encodeFrame |
( |
const Frame & |
frame, |
|
|
const std::string & |
imageType, |
|
|
Buffer & |
buffer |
|
) |
| |
|
static |
Encodes a frame to a buffer and adds further control parameters to the buffer.
- Parameters
-
frame | The frame to encode |
imageType | Optional type of the image, e.g. bmp, jpg, png |
buffer | The resulting buffer |
◆ encodeFrame() [2/2]
Utilities::Buffer Ocean::Media::Utilities::encodeFrame |
( |
const Frame & |
frame, |
|
|
const std::string & |
imageType, |
|
|
const size_t |
reservedHeaderSize = 0 |
|
) |
| |
|
inlinestatic |
Encodes a frame to a buffer and adds further control parameters to the buffer.
- Parameters
-
frame | The frame to encode |
imageType | Optional type of the image, e.g. bmp, jpg, png |
reservedHeaderSize | The number of bytes which will be reserved for an optional header, so that the resulting buffer has a header followed by the payload data |
- Returns
- The resulting buffer
◆ loadImage() [1/2]
static Frame Ocean::Media::Utilities::loadImage |
( |
const std::string & |
url | ) |
|
|
static |
Loads an image defined by the url and returns the frame.
Beware: A media library supporting the image format must be loaded before.
- Parameters
-
url | Url of the image to be loaded |
- Returns
- Resutling frame, the frame is Null if loading fails
- See also
- saveImage(), Manager, Library.
◆ loadImage() [2/2]
static Frame Ocean::Media::Utilities::loadImage |
( |
const void * |
imageBuffer, |
|
|
const size_t |
imageBufferSize, |
|
|
const std::string & |
imageBufferTypeIn = std::string("") , |
|
|
std::string * |
imageBufferTypeOut = nullptr |
|
) |
| |
|
static |
Loads an image defined by a memory buffer, the size of the buffer and the type of the stored image information.
Beware: A media library supporting the image format must be loaded before.
- Parameters
-
imageBuffer | Buffer of the image to be loaded |
imageBufferSize | Size of the image buffer in bytes |
imageBufferTypeIn | Type of the given image that is stored in the buffer, should be specified if known (e.g. the file extension of a corresponding image file) |
imageBufferTypeOut | Optional type of the given image that is stored in the buffer, as determined by the decoder (if possible) |
- Returns
- Resutling frame, the frame is Null if loading fails
- See also
- saveImage(), Manager, Library.
◆ saveImage() [1/2]
static bool Ocean::Media::Utilities::saveImage |
( |
const Frame & |
frame, |
|
|
const std::string & |
imageType, |
|
|
Buffer & |
buffer |
|
) |
| |
|
static |
Saves a frame into a memory buffer.
Beware: A media library supporting the image format must be loaded before.
- Parameters
-
frame | The frame to be saved as image |
imageType | Type of the image to be created in the memory buffer e.g. the file extension of a corresponding image file (bmp, jpg, png, ...) |
buffer | Resulting memory buffer holding the (compressed) image which will be extended so that already existing data stays untouched |
- Returns
- True, if succeeded
- See also
- loadImage(), Manager, Library.
◆ saveImage() [2/2]
static bool Ocean::Media::Utilities::saveImage |
( |
const Frame & |
frame, |
|
|
const std::string & |
url, |
|
|
const bool |
addTimeSuffix = true |
|
) |
| |
|
static |
Saves a frame as image file.
Beware: A media library supporting the image format must be loaded before.
- Parameters
-
frame | The frame to be saved as image, must be valid |
url | Url of the image to be saved |
addTimeSuffix | If True the time and date is added to the url as suffix |
- Returns
- True, if succeeded
- See also
- loadImage(), Manager, Library.
The documentation for this class was generated from the following file: