VART-X  0.3.0
vart_videoframe.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2024-2026 Advanced Micro Devices Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
24 #include <xrt/xrt_bo.h>
25 #include <vector>
26 #include "vart_device.hpp"
27 #include "vart_memory_types.hpp"
29 
32 namespace vart {
33 
37 class VideoFrameImplBase;
38 
48 class VideoFrame {
49  public:
69  VideoFrame(VideoFrameImplType type, size_t size, uint8_t mbank_idx, VideoInfo& vinfo, std::shared_ptr<Device> device);
70 
91  std::vector<uint8_t*>& data_vec,
92  VideoInfo& vinfo,
93  std::shared_ptr<Device> device);
94 
118  uint8_t mbank_idx,
119  std::vector<xrt::bo*>& bo_vec,
120  VideoInfo& vinfo,
121  std::shared_ptr<Device> device);
122 
142  VideoFrame(VideoFrameImplType type, int dma_buf_fd, VideoInfo& vinfo, std::shared_ptr<Device> device);
143 
144  ~VideoFrame() = default;
145 
160  const VideoFrameMapInfo& map(DataMapFlags map_flags);
161 
167  void unmap();
168 
175  const VideoInfo& get_video_info() const;
176 
184  std::shared_ptr<Device> get_device_handle() const;
185 
192  const std::shared_ptr<VideoFrameImplBase>& get_pimpl_handle() const;
193 
208  int export_buffer() const;
209 
210  private:
211  std::shared_ptr<VideoFrameImplBase> pimpl;
212 };
213 } // namespace vart
This module simplifies the management of video frame memory and provides APIs for mapping and unmappi...
Definition: vart_videoframe.hpp:48
~VideoFrame()=default
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 bas...
VideoFrame(VideoFrameImplType type, int dma_buf_fd, VideoInfo &vinfo, std::shared_ptr< Device > device)
VideoFrame() - Constructor to create VideoFrame from a dma-buf fd.
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.
int export_buffer() const
export_buffer() - Export the video frame buffer as a dma-buf file descriptor.
const std::shared_ptr< VideoFrameImplBase > & get_pimpl_handle() const
get_pimpl_handle() - Retrieves pointer to implementation class.
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)
std::shared_ptr< Device > get_device_handle() const
get_device_handle() - Retrieves the device handle associated with the current frame
const VideoFrameMapInfo & map(DataMapFlags map_flags)
map() - Maps video frame data to user space
void unmap()
unmap() - Unmaps video frame data from user space
const VideoInfo & get_video_info() const
get_video_info() - Retrieves the video frame information from video frame.
VART (Vitis AI Runtime) public API namespace.
DataMapFlags
Definition: vart_memory_types.hpp:30
VideoFrameImplType
Video Frame implementation type.
Definition: vart_videoframe_types.hpp:38
Structure encapsulating details of a video frame after a map operation.
Definition: vart_videoframe_types.hpp:214
Contains information related to a video frame.
Definition: vart_videoframe_types.hpp:144
Device module managing hardware context and xclbin loading.
Type definitions for the VideoFrame module.