FrameFactory class, which provides some static functions to create frame objects.
More...
#include <Frame.hpp>
|
typedef std::function< void(uint8_t *)> | BufferDestroyCallback |
| The callback function to destroy the buffer when the frame is destroyed.
|
|
|
static std::shared_ptr< Frame > | createFrame (OBFrameType frameType, OBFormat format, uint32_t dataSize) |
| Create a Frame object of a specific type with a given format and data size.
|
|
static std::shared_ptr< VideoFrame > | createVideoFrame (OBFrameType frameType, OBFormat format, uint32_t width, uint32_t height, uint32_t stride=0) |
| Create a VideoFrame object of a specific type with a given format, width, height, and stride.
|
|
static std::shared_ptr< Frame > | createFrameFromOtherFrame (std::shared_ptr< const Frame > otherFrame, bool shouldCopyData=true) |
| Create (clone) a frame object based on the specified other frame object.
|
|
static std::shared_ptr< Frame > | createFrameFromStreamProfile (std::shared_ptr< const StreamProfile > profile) |
| Create a Frame From (according to)Stream Profile object.
|
|
static std::shared_ptr< Frame > | createFrameFromBuffer (OBFrameType frameType, OBFormat format, uint8_t *buffer, BufferDestroyCallback destroyCallback, uint32_t bufferSize) |
| Create a frame object based on an externally created buffer.
|
|
static std::shared_ptr< VideoFrame > | createVideoFrameFromBuffer (OBFrameType frameType, OBFormat format, uint32_t width, uint32_t height, uint8_t *buffer, BufferDestroyCallback destroyCallback, uint32_t bufferSize, uint32_t stride=0) |
| Create a video frame object based on an externally created buffer.
|
|
FrameFactory class, which provides some static functions to create frame objects.
Definition at line 822 of file Frame.hpp.
◆ BufferDestroyCallback
The callback function to destroy the buffer when the frame is destroyed.
Definition at line 897 of file Frame.hpp.
◆ createFrame()
static std::shared_ptr< Frame > ob::FrameFactory::createFrame |
( |
OBFrameType | frameType, |
|
|
OBFormat | format, |
|
|
uint32_t | dataSize ) |
|
inlinestatic |
Create a Frame object of a specific type with a given format and data size.
- Parameters
-
frameType | The type of the frame. |
format | The format of the frame. |
dataSize | The size of the data in bytes. |
- Returns
- std::shared_ptr<Frame> The created frame object.
Definition at line 832 of file Frame.hpp.
◆ createVideoFrame()
static std::shared_ptr< VideoFrame > ob::FrameFactory::createVideoFrame |
( |
OBFrameType | frameType, |
|
|
OBFormat | format, |
|
|
uint32_t | width, |
|
|
uint32_t | height, |
|
|
uint32_t | stride = 0 ) |
|
inlinestatic |
Create a VideoFrame object of a specific type with a given format, width, height, and stride.
- Note
- If stride is not specified, it will be calculated based on the width and format.
- Parameters
-
frameType | The type of the frame. |
format | The format of the frame. |
width | The width of the frame. |
height | The height of the frame. |
stride | The stride of the frame. |
- Returns
- std::shared_ptr<VideoFrame> The created video frame object.
Definition at line 852 of file Frame.hpp.
◆ createFrameFromOtherFrame()
static std::shared_ptr< Frame > ob::FrameFactory::createFrameFromOtherFrame |
( |
std::shared_ptr< const Frame > | otherFrame, |
|
|
bool | shouldCopyData = true ) |
|
inlinestatic |
Create (clone) a frame object based on the specified other frame object.
The new frame object will have the same properties as the other frame object, but the data buffer is newly allocated.
- Parameters
-
shouldCopyData | If true, the data of the source frame object will be copied to the new frame object. If false, the new frame object will have a data buffer with random data. The default value is true. |
- Returns
- std::shared_ptr<Frame> The new frame object.
Definition at line 870 of file Frame.hpp.
◆ createFrameFromStreamProfile()
static std::shared_ptr< Frame > ob::FrameFactory::createFrameFromStreamProfile |
( |
std::shared_ptr< const StreamProfile > | profile | ) |
|
|
inlinestatic |
Create a Frame From (according to)Stream Profile object.
- Parameters
-
profile | The stream profile object to create the frame from. |
- Returns
- std::shared_ptr<Frame> The created frame object.
Definition at line 886 of file Frame.hpp.
◆ createFrameFromBuffer()
Create a frame object based on an externally created buffer.
- Attention
- The buffer is owned by the caller, and will not be destroyed by the frame object. The user should ensure that the buffer is valid and not modified.
- Parameters
-
[in] | frame_type | Frame object type. |
[in] | format | Frame object format. |
[in] | buffer | Frame object buffer. |
[in] | buffer_size | Frame object buffer size. |
[in] | destroyCallback | Destroy callback, will be called when the frame object is destroyed. |
- Returns
- std::shared_ptr<Frame> The created frame object.
Definition at line 913 of file Frame.hpp.
◆ createVideoFrameFromBuffer()
static std::shared_ptr< VideoFrame > ob::FrameFactory::createVideoFrameFromBuffer |
( |
OBFrameType | frameType, |
|
|
OBFormat | format, |
|
|
uint32_t | width, |
|
|
uint32_t | height, |
|
|
uint8_t * | buffer, |
|
|
BufferDestroyCallback | destroyCallback, |
|
|
uint32_t | bufferSize, |
|
|
uint32_t | stride = 0 ) |
|
inlinestatic |
Create a video frame object based on an externally created buffer.
- Attention
- The buffer is owned by the user and will not be destroyed by the frame object. The user should ensure that the buffer is valid and not modified.
-
The frame object is created with a reference count of 1, and the reference count should be decreased by calling ob_delete_frame() when it is no longer needed.
- Parameters
-
[in] | frameType | Frame object type. |
[in] | format | Frame object format. |
[in] | width | Frame object width. |
[in] | height | Frame object height. |
[in] | buffer | Frame object buffer. |
[in] | bufferSize | Frame object buffer size. |
[in] | destroyCallback | Destroy callback, will be called when the frame object is destroyed. |
[in] | stride | Row span in bytes. If 0, the stride is calculated based on the width and format. |
- Returns
- std::shared_ptr<VideoFrame> The created video frame object.
Definition at line 942 of file Frame.hpp.
The documentation for this class was generated from the following file:
- C:/Users/hzcyf/Projects/openorbbecsdkgroup/OpenOrbbecSDK/include/libobsensor/hpp/Frame.hpp