1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ci#ifndef HOS_CAMERA_IBUFFER_H 17094332d3Sopenharmony_ci#define HOS_CAMERA_IBUFFER_H 18094332d3Sopenharmony_ci 19094332d3Sopenharmony_ci#include "camera.h" 20094332d3Sopenharmony_ci 21094332d3Sopenharmony_cinamespace OHOS { 22094332d3Sopenharmony_cinamespace Camera { 23094332d3Sopenharmony_cienum CameraBufferStatus { 24094332d3Sopenharmony_ci CAMERA_BUFFER_STATUS_OK = 0, 25094332d3Sopenharmony_ci CAMERA_BUFFER_STATUS_DROP, 26094332d3Sopenharmony_ci CAMERA_BUFFER_STATUS_INVALID, 27094332d3Sopenharmony_ci}; 28094332d3Sopenharmony_ci 29094332d3Sopenharmony_ciclass IBuffer { 30094332d3Sopenharmony_cipublic: 31094332d3Sopenharmony_ci virtual ~IBuffer() {} 32094332d3Sopenharmony_ci 33094332d3Sopenharmony_ci virtual int32_t GetIndex() const = 0; 34094332d3Sopenharmony_ci virtual uint32_t GetWidth() const = 0; 35094332d3Sopenharmony_ci virtual uint32_t GetCurWidth() const = 0; 36094332d3Sopenharmony_ci virtual uint32_t GetHeight() const = 0; 37094332d3Sopenharmony_ci virtual uint32_t GetCurHeight() const = 0; 38094332d3Sopenharmony_ci virtual uint32_t GetStride() const = 0; 39094332d3Sopenharmony_ci virtual int32_t GetFormat() const = 0; 40094332d3Sopenharmony_ci virtual int32_t GetCurFormat() const = 0; 41094332d3Sopenharmony_ci virtual uint32_t GetSize() const = 0; 42094332d3Sopenharmony_ci virtual uint32_t GetSuffaceBufferSize() const = 0; 43094332d3Sopenharmony_ci virtual void* GetSuffaceBufferAddr() const = 0; 44094332d3Sopenharmony_ci virtual uint64_t GetUsage() const = 0; 45094332d3Sopenharmony_ci virtual void* GetVirAddress() const = 0; 46094332d3Sopenharmony_ci virtual uint64_t GetPhyAddress() const = 0; 47094332d3Sopenharmony_ci virtual int32_t GetFileDescriptor() const = 0; 48094332d3Sopenharmony_ci virtual int32_t GetSourceType() const = 0; 49094332d3Sopenharmony_ci virtual uint64_t GetTimestamp() const = 0; 50094332d3Sopenharmony_ci virtual uint64_t GetFrameNumber() const = 0; 51094332d3Sopenharmony_ci virtual int64_t GetPoolId() const = 0; 52094332d3Sopenharmony_ci virtual int32_t GetCaptureId() const = 0; 53094332d3Sopenharmony_ci virtual CameraBufferStatus GetBufferStatus() const = 0; 54094332d3Sopenharmony_ci virtual int32_t GetSequenceId() const = 0; 55094332d3Sopenharmony_ci virtual int32_t GetFenceId() const = 0; 56094332d3Sopenharmony_ci virtual EsFrameInfo GetEsFrameInfo() const = 0; 57094332d3Sopenharmony_ci virtual int32_t GetEncodeType() const = 0; 58094332d3Sopenharmony_ci virtual int32_t GetStreamId() const = 0; 59094332d3Sopenharmony_ci virtual bool GetIsValidDataInSurfaceBuffer() const = 0; 60094332d3Sopenharmony_ci 61094332d3Sopenharmony_ci virtual void SetIndex(const int32_t index) = 0; 62094332d3Sopenharmony_ci virtual void SetWidth(const uint32_t width) = 0; 63094332d3Sopenharmony_ci virtual void SetCurWidth(const uint32_t width) = 0; 64094332d3Sopenharmony_ci virtual void SetHeight(const uint32_t height) = 0; 65094332d3Sopenharmony_ci virtual void SetCurHeight(const uint32_t height) = 0; 66094332d3Sopenharmony_ci virtual void SetStride(const uint32_t stride) = 0; 67094332d3Sopenharmony_ci virtual void SetFormat(const int32_t format) = 0; 68094332d3Sopenharmony_ci virtual void SetCurFormat(const int32_t format) = 0; 69094332d3Sopenharmony_ci virtual void SetSize(const uint32_t size) = 0; 70094332d3Sopenharmony_ci virtual void SetSuffaceBufferAddr(const void* addr) = 0; 71094332d3Sopenharmony_ci virtual void SetSuffaceBufferSize(const uint32_t size) = 0; 72094332d3Sopenharmony_ci virtual void SetUsage(const uint64_t usage) = 0; 73094332d3Sopenharmony_ci virtual void SetVirAddress(const void* addr) = 0; 74094332d3Sopenharmony_ci virtual void SetPhyAddress(const uint64_t addr) = 0; 75094332d3Sopenharmony_ci virtual void SetFileDescriptor(const int32_t fd) = 0; 76094332d3Sopenharmony_ci virtual void SetTimestamp(const uint64_t timestamp) = 0; 77094332d3Sopenharmony_ci virtual void SetFrameNumber(const uint64_t frameNumber) = 0; 78094332d3Sopenharmony_ci virtual void SetPoolId(const int64_t id) = 0; 79094332d3Sopenharmony_ci virtual void SetCaptureId(const int32_t id) = 0; 80094332d3Sopenharmony_ci virtual void SetBufferStatus(const CameraBufferStatus flag) = 0; 81094332d3Sopenharmony_ci virtual void SetSequenceId(const int32_t sequence) = 0; 82094332d3Sopenharmony_ci virtual void SetFenceId(const int32_t fence) = 0; 83094332d3Sopenharmony_ci virtual void SetEncodeType(const int32_t type) = 0; 84094332d3Sopenharmony_ci virtual void SetEsFrameSize(const int32_t frameSize) = 0; 85094332d3Sopenharmony_ci virtual void SetEsTimestamp(const int64_t timeStamp) = 0; 86094332d3Sopenharmony_ci virtual void SetEsKeyFrame(const int32_t isKey) = 0; 87094332d3Sopenharmony_ci virtual void SetEsFrameNum(const int32_t frameNum) = 0; 88094332d3Sopenharmony_ci virtual void SetStreamId(const int32_t streamId) = 0; 89094332d3Sopenharmony_ci virtual void SetIsValidDataInSurfaceBuffer(const bool isValid) = 0; 90094332d3Sopenharmony_ci 91094332d3Sopenharmony_ci virtual void Free() = 0; 92094332d3Sopenharmony_ci 93094332d3Sopenharmony_ci virtual bool operator==(const IBuffer& u) = 0; 94094332d3Sopenharmony_ci}; 95094332d3Sopenharmony_ci} // namespace Camera 96094332d3Sopenharmony_ci} // namespace OHOS 97094332d3Sopenharmony_ci#endif 98094332d3Sopenharmony_ci 99