OrbbecSDK 2.1.1
OrbbecSDK: Software-Development-Kit for Orbbec 3D Cameras
Loading...
Searching...
No Matches
ob::FrameFactory Class Reference

FrameFactory class, which provides some static functions to create frame objects. More...

#include <Frame.hpp>

+ Inheritance diagram for ob::FrameFactory:

Public Types

typedef std::function< void(uint8_t *)> BufferDestroyCallback
 The callback function to destroy the buffer when the frame is destroyed.
 

Static Public Member Functions

static std::shared_ptr< FramecreateFrame (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< VideoFramecreateVideoFrame (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< FramecreateFrameFromOtherFrame (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< FramecreateFrameFromStreamProfile (std::shared_ptr< const StreamProfile > profile)
 Create a Frame From (according to)Stream Profile object.
 
static std::shared_ptr< FramecreateFrameFromBuffer (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< VideoFramecreateVideoFrameFromBuffer (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.
 

Detailed Description

FrameFactory class, which provides some static functions to create frame objects.

Definition at line 822 of file Frame.hpp.

Member Typedef Documentation

◆ BufferDestroyCallback

std::function<void(uint8_t *)> ob::FrameFactory::BufferDestroyCallback

The callback function to destroy the buffer when the frame is destroyed.

Definition at line 897 of file Frame.hpp.

Member Function Documentation

◆ 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
frameTypeThe type of the frame.
formatThe format of the frame.
dataSizeThe 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
frameTypeThe type of the frame.
formatThe format of the frame.
widthThe width of the frame.
heightThe height of the frame.
strideThe 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
shouldCopyDataIf 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
profileThe 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()

static std::shared_ptr< Frame > ob::FrameFactory::createFrameFromBuffer ( OBFrameType frameType,
OBFormat format,
uint8_t * buffer,
BufferDestroyCallback destroyCallback,
uint32_t bufferSize )
inlinestatic

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_typeFrame object type.
[in]formatFrame object format.
[in]bufferFrame object buffer.
[in]buffer_sizeFrame object buffer size.
[in]destroyCallbackDestroy 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]frameTypeFrame object type.
[in]formatFrame object format.
[in]widthFrame object width.
[in]heightFrame object height.
[in]bufferFrame object buffer.
[in]bufferSizeFrame object buffer size.
[in]destroyCallbackDestroy callback, will be called when the frame object is destroyed.
[in]strideRow 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: