• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  *     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_V4L2_SOURCE_NODE_RK_H
15 #define HOS_CAMERA_V4L2_SOURCE_NODE_RK_H
16 
17 #include <vector>
18 #include "device_manager_adapter.h"
19 #include "v4l2_device_manager.h"
20 #include "utils.h"
21 #include "source_node.h"
22 #include "sensor_controller.h"
23 #include "sensor_manager.h"
24 
25 namespace OHOS::Camera {
26 class V4L2SourceNodeRK : public SourceNode {
27 public:
28     V4L2SourceNodeRK(const std::string& name, const std::string& type, const std::string &cameraId);
29     ~V4L2SourceNodeRK() override;
30     RetCode Init(const int32_t streamId) override;
31     RetCode Start(const int32_t streamId) override;
32     RetCode Flush(const int32_t streamId) override;
33     RetCode Stop(const int32_t streamId) override;
34     RetCode GetDeviceController();
35     RetCode SetCallback() override;
36     void SetBufferCallback() override;
37     RetCode ProvideBuffers(std::shared_ptr<FrameSpec> frameSpec) override;
38 private:
39     void OnMetadataChanged(const std::shared_ptr<CameraMetadata>& metadata);
40     int32_t GetStreamId(const CaptureMeta &meta);
41 
42 private:
43     std::mutex                              requestLock_;
44     std::map<int32_t, std::list<int32_t>>   captureRequests_ = {};
45     std::shared_ptr<SensorController>       sensorController_ = nullptr;
46     std::shared_ptr<IDeviceManager>     deviceManager_ = nullptr;
47 };
48 } // namespace OHOS::Camera
49 #endif
50