1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef HOS_CAMERA_IBUFFER_H 17 #define HOS_CAMERA_IBUFFER_H 18 19 #include "camera.h" 20 21 namespace OHOS { 22 namespace Camera { 23 enum CameraBufferStatus { 24 CAMERA_BUFFER_STATUS_OK = 0, 25 CAMERA_BUFFER_STATUS_DROP, 26 CAMERA_BUFFER_STATUS_INVALID, 27 }; 28 29 class IBuffer { 30 public: ~IBuffer()31 virtual ~IBuffer() {} 32 33 virtual int32_t GetIndex() const = 0; 34 virtual uint32_t GetWidth() const = 0; 35 virtual uint32_t GetHeight() const = 0; 36 virtual uint32_t GetStride() const = 0; 37 virtual int32_t GetFormat() const = 0; 38 virtual uint32_t GetSize() const = 0; 39 virtual uint64_t GetUsage() const = 0; 40 virtual void* GetVirAddress() const = 0; 41 virtual uint64_t GetPhyAddress() const = 0; 42 virtual int32_t GetFileDescriptor() const = 0; 43 virtual int32_t GetSourceType() const = 0; 44 virtual uint64_t GetTimestamp() const = 0; 45 virtual uint64_t GetFrameNumber() const = 0; 46 virtual int64_t GetPoolId() const = 0; 47 virtual int32_t GetCaptureId() const = 0; 48 virtual CameraBufferStatus GetBufferStatus() const = 0; 49 virtual int32_t GetSequenceId() const = 0; 50 virtual int32_t GetFenceId() const = 0; 51 virtual EsFrameInfo GetEsFrameInfo() const = 0; 52 virtual int32_t GetEncodeType() const = 0; 53 virtual int32_t GetStreamId() const = 0; 54 55 virtual void SetIndex(const int32_t index) = 0; 56 virtual void SetWidth(const uint32_t width) = 0; 57 virtual void SetHeight(const uint32_t height) = 0; 58 virtual void SetStride(const uint32_t stride) = 0; 59 virtual void SetFormat(const int32_t format) = 0; 60 virtual void SetSize(const uint32_t size) = 0; 61 virtual void SetUsage(const uint64_t usage) = 0; 62 virtual void SetVirAddress(const void* addr) = 0; 63 virtual void SetPhyAddress(const uint64_t addr) = 0; 64 virtual void SetFileDescriptor(const int32_t fd) = 0; 65 virtual void SetTimestamp(const uint64_t timestamp) = 0; 66 virtual void SetFrameNumber(const uint64_t frameNumber) = 0; 67 virtual void SetPoolId(const int64_t id) = 0; 68 virtual void SetCaptureId(const int32_t id) = 0; 69 virtual void SetBufferStatus(const CameraBufferStatus flag) = 0; 70 virtual void SetSequenceId(const int32_t sequence) = 0; 71 virtual void SetFenceId(const int32_t fence) = 0; 72 virtual void SetEncodeType(const int32_t type) = 0; 73 virtual void SetEsFrameSize(const int32_t frameSize) = 0; 74 virtual void SetEsTimestamp(const int64_t timeStamp) = 0; 75 virtual void SetEsKeyFrame(const int32_t isKey) = 0; 76 virtual void SetEsFrameNum(const int32_t frameNum) = 0; 77 virtual void SetStreamId(const int32_t streamId) = 0; 78 79 virtual void Free() = 0; 80 81 virtual bool operator==(const IBuffer& u) = 0; 82 }; 83 } // namespace Camera 84 } // namespace OHOS 85 #endif 86 87