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_BUFFER_TRACE_H 17 #define HOS_CAMERA_BUFFER_TRACE_H 18 19 #include "camera.h" 20 #include <list> 21 #include <map> 22 #include <string> 23 24 namespace OHOS::Camera { 25 enum { 26 INVALID_TRACKING_ID = -1, 27 NODE_IS_EMPTY, 28 NODE_IS_NOT_EMPTY, 29 }; 30 31 struct BufferTrackingMessage { 32 int32_t trackingId = -1; 33 uint64_t frameNumber = 0; 34 std::string nodeName = ""; 35 36 // isReturnBack = true indicate a buffer is recycled. 37 bool isReturnBack = false; 38 }; 39 40 class TrackingBuffer { 41 public: TrackingBuffer(const uint64_t frameNumber)42 explicit TrackingBuffer(const uint64_t frameNumber) 43 { 44 frameNumber_ = frameNumber; 45 } 46 ~TrackingBuffer() = default; 47 48 bool operator==(const TrackingBuffer& id) 49 { 50 return this->frameNumber_ == id.frameNumber_; 51 } 52 GetFrameNumber()53 uint64_t GetFrameNumber() const 54 { 55 return frameNumber_; 56 } 57 58 private: 59 TrackingBuffer() = default; 60 61 private: 62 uint64_t frameNumber_ = 0; 63 }; 64 65 using BufferTraceGraph = std::list<std::pair<std::string, std::list<TrackingBuffer>>>; 66 } // namespace OHOS::Camera 67 #endif 68