1 /* 2 * dma_video_buffer.h - dma video buffer 3 * 4 * Copyright (c) 2016 Intel Corporation 5 * Copyright (c) 2021 Rockchip Corporation 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * 19 * Author: Wind Yuan <feng.yuan@intel.com> 20 * Author: Cody Xie <cody.xie@rock-chips.com> 21 */ 22 #ifndef XCAM_DMA_VIDEO_BUFFER_H 23 #define XCAM_DMA_VIDEO_BUFFER_H 24 25 #include <dma_buffer.h> 26 #include <unistd.h> 27 #include <video_buffer.h> 28 #include <xcam_std.h> 29 30 namespace XCam { 31 32 class DmaVideoBuffer : virtual public DmaBuffer, public VideoBuffer { 33 public: 34 DmaVideoBuffer(const VideoBufferInfo& info, int dma_fd, bool need_close_fd = false); 35 DmaVideoBuffer(const DmaVideoBuffer&) = delete; 36 const DmaVideoBuffer& operator=(const DmaVideoBuffer&) = delete; 37 38 virtual ~DmaVideoBuffer(); 39 40 virtual uint8_t* map(); 41 virtual bool unmap(); 42 virtual int get_fd(); 43 44 private: 45 int _dma_fd; 46 bool _need_close_fd; 47 }; 48 49 } // namespace XCam 50 51 #endif // XCAM_DMA_VIDEO_BUFFER_H 52