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