1 /*
2  * Copyright (c) 2023 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  *     http://www.apache.org/licenses/LICENSE-2.0
7  * Unless required by applicable law or agreed to in writing, software
8  * distributed under the License is distributed on an "AS IS" BASIS,
9  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10  * See the License for the specific language governing permissions and
11  * limitations under the License.
12  */
13 
14 #ifndef HOS_CAMERA_RKEXIF_NODE_H
15 #define HOS_CAMERA_RKEXIF_NODE_H
16 
17 #include <vector>
18 #include <condition_variable>
19 #include <ctime>
20 #include "device_manager_adapter.h"
21 #include "utils.h"
22 #include "camera.h"
23 #include "source_node.h"
24 
25 enum GpsIndex : int32_t {
26     LATITUDE_INDEX = 0,
27     LONGITUDE_INDEX,
28     ALTITUDE_INDEX,
29 };
30 
31 namespace OHOS::Camera {
32 class ExifNode : public NodeBase {
33 public:
34     ExifNode(const std::string &name, const std::string &type, const std::string &cameraId);
35     ~ExifNode() override;
36     RetCode Start(const int32_t streamId) override;
37     RetCode Stop(const int32_t streamId) override;
38     void DeliverBuffer(std::shared_ptr<IBuffer> &buffer) override;
39     virtual RetCode Capture(const int32_t streamId, const int32_t captureId) override;
40     RetCode CancelCapture(const int32_t streamId) override;
41     RetCode Flush(const int32_t streamId);
42     RetCode Config(const int32_t streamId, const CaptureMeta &meta) override;
43 private:
44     RetCode SendMetadata(std::shared_ptr<CameraMetadata> meta);
45     RetCode SetGpsInfoMetadata(common_metadata_header_t *data);
46 
47     std::vector<std::shared_ptr<IPort>> outPutPorts_;
48     std::mutex gpsMetaDatalock_;
49     std::vector<double> gpsInfo_;
50 };
51 } // namespace OHOS::Camera
52 #endif
53