This module simplifies the management of video frame memory and provides APIs for mapping and unmapping frame data to user space to read and write. The VideoFrame class offers flexibility for applications to encapsulate their own memory into the VideoFrame class. In such instances, the application bears the responsibility for deallocating the frame memory.
More...
#include <vart_videoframe.hpp>
|
| | VideoFrame (VideoFrameImplType type, size_t size, uint8_t mbank_idx, VideoInfo &vinfo, std::shared_ptr< Device > device) |
| | VideoFrame() - Constructor for creating video frame instance using implementation specific method based on input 'type'. More...
|
| |
| | VideoFrame (VideoFrameImplType type, std::vector< uint8_t * > &data_vec, VideoInfo &vinfo, std::shared_ptr< Device > device) |
| | VideoFrame() - Constructor for creating video frame instance using input data pointers. More...
|
| |
| | VideoFrame (VideoFrameImplType type, uint8_t mbank_idx, std::vector< xrt::bo * > &bo_vec, VideoInfo &vinfo, std::shared_ptr< Device > device) |
| | VideoFrame() - Constructor for creating video frame instance using input XRT Buffer object(BO) More...
|
| |
| | VideoFrame (VideoFrameImplType type, int dma_buf_fd, VideoInfo &vinfo, std::shared_ptr< Device > device) |
| | VideoFrame() - Constructor to create VideoFrame from a dma-buf fd. More...
|
| |
| | ~VideoFrame ()=default |
| |
| const VideoFrameMapInfo & | map (DataMapFlags map_flags) |
| | map() - Maps video frame data to user space More...
|
| |
| void | unmap () |
| | unmap() - Unmaps video frame data from user space More...
|
| |
| const VideoInfo & | get_video_info () const |
| | get_video_info() - Retrieves the video frame information from video frame. More...
|
| |
| std::shared_ptr< Device > | get_device_handle () const |
| | get_device_handle() - Retrieves the device handle associated with the current frame More...
|
| |
| const std::shared_ptr< VideoFrameImplBase > & | get_pimpl_handle () const |
| | get_pimpl_handle() - Retrieves pointer to implementation class. More...
|
| |
| int | export_buffer () const |
| | export_buffer() - Export the video frame buffer as a dma-buf file descriptor. More...
|
| |
This module simplifies the management of video frame memory and provides APIs for mapping and unmapping frame data to user space to read and write. The VideoFrame class offers flexibility for applications to encapsulate their own memory into the VideoFrame class. In such instances, the application bears the responsibility for deallocating the frame memory.
- See also
- VideoFrameImplBase
◆ VideoFrame() [1/4]
VideoFrame() - Constructor for creating video frame instance using implementation specific method based on input 'type'.
- Parameters
-
| [in] | type | Enum class to specify which type of memory allocation method to use |
| [in] | size | Size of the buffer |
| [in] | mbank_idx | Memory bank index on which memory needs to be allocated |
| [in] | vinfo | VideoInfo instance which contains video frame specific information |
| [in] | device | Device handle. Must be non-null. See vart::Device for more details. |
◆ VideoFrame() [2/4]
VideoFrame() - Constructor for creating video frame instance using input data pointers.
- Parameters
-
| [in] | type | Enum class to specify which type of memory allocation method to use |
| [in] | data_vec | Vector of user allocated buffer pointers |
| [in] | vinfo | VideoInfo instance which contains video frame specific information |
| [in] | device | Device handle to be used by implementation. Must be non-null. See vart::Device for more details. |
- Note
type must be VideoFrameImplType::NON_CMA. Any other type will throw a std::runtime_error.
◆ VideoFrame() [3/4]
VideoFrame() - Constructor for creating video frame instance using input XRT Buffer object(BO)
- Parameters
-
| [in] | type | Enum class to specify which type of memory allocation method to use |
| [in] | mbank_idx | Memory bank index on which memory was allocated |
| [in] | bo_vec | Vector of XRT BOs allocated by user |
| [in] | vinfo | VideoInfo instance which contains video frame specific information |
| [in] | device | Device handle to be used by implementation. Must be non-null. See vart::Device for more details. |
- Note
type must be VideoFrameImplType::XRT. Any other type will throw a std::runtime_error.
◆ VideoFrame() [4/4]
VideoFrame() - Constructor to create VideoFrame from a dma-buf fd.
- Parameters
-
| [in] | type | VideoFrame implementation type (e.g. VideoFrameImplType::XRT) |
| [in] | dma_buf_fd | DMA-BUF file descriptor for the entire frame. Must be CMA-backed. |
| [in] | vinfo | Video format, dimensions, and plane layout. |
| [in] | device | Device handle to be used by implementation. Must be non-null. See vart::Device for more details. |
- Note
type must be VideoFrameImplType::XRT (CMA-backed). Any other type, or an invalid/negative dma_buf_fd, will throw a std::runtime_error.
◆ ~VideoFrame()
| vart::VideoFrame::~VideoFrame |
( |
| ) |
|
|
default |
◆ export_buffer()
| int vart::VideoFrame::export_buffer |
( |
| ) |
const |
export_buffer() - Export the video frame buffer as a dma-buf file descriptor.
Exports the underlying XRT buffer object (BO) backing the entire frame as a dma-buf file descriptor. Only frames backed by a single BO are supported; frames constructed from per-plane BOs (multi-BO) are not exportable.
- Returns
- Returns a file descriptor (int) representing the dma-buf on success (>= 0), or -1 on failure (non-CMA allocation or invalid state).
- Note
- Throws
std::runtime_error if the frame is backed by multiple BOs (e.g. constructed via the bo_vec constructor with more than one BO).
◆ get_device_handle()
| std::shared_ptr<Device> vart::VideoFrame::get_device_handle |
( |
| ) |
const |
get_device_handle() - Retrieves the device handle associated with the current frame
- Returns
- Returns the device handle associated with this frame.
◆ get_pimpl_handle()
get_pimpl_handle() - Retrieves pointer to implementation class.
- Returns
- Returns a constant reference of pointer to implementation class.
◆ get_video_info()
| const VideoInfo& vart::VideoFrame::get_video_info |
( |
| ) |
const |
get_video_info() - Retrieves the video frame information from video frame.
- Returns
- Returns information related to video frame
◆ map()
map() - Maps video frame data to user space
- Parameters
-
| [in] | map_flags | Flag used to indicate mode of memory mapping |
- Returns
- Returns information containing user space data pointer(s) and its corresponding video frame information.
- Note
- Only VideoFrame instances allocated with
VideoFrameImplType::XRT (CMA-backed memory) can be mapped. Calling map() on a NON_CMA frame will throw a std::runtime_error.
◆ unmap()
| void vart::VideoFrame::unmap |
( |
| ) |
|
unmap() - Unmaps video frame data from user space
- Note
- Throws
std::runtime_error if called without a prior successful call to map().
The documentation for this class was generated from the following file: