• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 OHOS_CAMERA_H_STREAM_DEPTH_DATA_H
17 #define OHOS_CAMERA_H_STREAM_DEPTH_DATA_H
18 
19 #include <cstdint>
20 #include <functional>
21 #include <iostream>
22 #include <refbase.h>
23 
24 #include "camera_metadata_info.h"
25 #include "hstream_common.h"
26 #include "stream_depth_data_stub.h"
27 #include "istream_depth_data_callback.h"
28 #include "v1_0/istream_operator.h"
29 #include "icamera_ipc_checker.h"
30 
31 namespace OHOS {
32 namespace CameraStandard {
33 
34 enum class DepthDataStreamStatus {
35     STOPED,
36     STARTED
37 };
38 
39 class HStreamDepthData : public StreamDepthDataStub, public HStreamCommon, public ICameraIpcChecker {
40 public:
41     HStreamDepthData(
42         sptr<OHOS::IBufferProducer> producer, int32_t format, int32_t width, int32_t height);
43     ~HStreamDepthData();
44 
45     int32_t LinkInput(wptr<OHOS::HDI::Camera::V1_0::IStreamOperator> streamOperator,
46         std::shared_ptr<OHOS::Camera::CameraMetadata> cameraAbility) override;
47     void SetStreamInfo(StreamInfo_V1_1& streamInfo) override;
48     int32_t ReleaseStream(bool isDelay) override;
49     int32_t Release() override;
50     int32_t Start() override;
51     int32_t Stop() override;
52     int32_t SetCallback(const sptr<IStreamDepthDataCallback>& callback) override;
53     int32_t UnSetCallback() override;
54     int32_t OnDepthDataError(int32_t errorType);
55     int32_t SetDataAccuracy(int32_t accuracy) override;
56     void DumpStreamInfo(CameraInfoDumper& infoDumper) override;
57     int32_t OperatePermissionCheck(uint32_t interfaceCode) override;
58     int32_t CallbackEnter([[maybe_unused]] uint32_t code) override;
59     int32_t CallbackExit([[maybe_unused]] uint32_t code, [[maybe_unused]] int32_t result) override;
60 
61 private:
62     sptr<IStreamDepthDataCallback> streamDepthDataCallback_;
63     std::mutex callbackLock_;
64     std::mutex streamStartStopLock_;
65     wptr<HStreamDepthData> parentStreamDepthData_;
66     DepthDataStreamStatus depthDataStreamStatus_ = DepthDataStreamStatus::STOPED;
67     sptr<OHOS::IBufferProducer> metaProducer_;
68     std::vector<int32_t> streamDepthDataAccuracy_ = {};
69 };
70 } // namespace CameraStandard
71 } // namespace OHOS
72 #endif // OHOS_CAMERA_H_STREAM_DEPTH_DATA_H
73