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