• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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_COMMON_H
17 #define OHOS_CAMERA_H_STREAM_COMMON_H
18 
19 #include "camera_metadata_info.h"
20 #include "istream_common.h"
21 #include "v1_0/istream_operator.h"
22 #include "v1_1/istream_operator.h"
23 
24 #include <refbase.h>
25 #include <iostream>
26 
27 namespace OHOS {
28 namespace CameraStandard {
29 using namespace OHOS::HDI::Camera::V1_0;
30 using OHOS::HDI::Camera::V1_1::StreamInfo_V1_1;
31 class HStreamCommon : virtual public RefBase {
32 public:
33     HStreamCommon(StreamType streamType, sptr<OHOS::IBufferProducer> producer,
34                   int32_t format, int32_t width, int32_t height);
35     virtual ~HStreamCommon();
36     virtual int32_t LinkInput(sptr<OHOS::HDI::Camera::V1_1::IStreamOperator> streamOperator,
37         std::shared_ptr<OHOS::Camera::CameraMetadata> cameraAbility, int32_t streamId) = 0;
38     virtual void SetStreamInfo(StreamInfo_V1_1 &streamInfo) = 0;
39     virtual int32_t Release() = 0;
40     virtual void DumpStreamInfo(std::string& dumpString) = 0;
41     virtual bool IsReleaseStream() final;
42     virtual int32_t SetReleaseStream(bool isReleaseStream) final;
43     virtual int32_t GetStreamId() final;
44     virtual StreamType GetStreamType() final;
45 
46     int32_t curCaptureID_;
47     int32_t streamId_;
48     int32_t format_;
49     int32_t width_;
50     int32_t height_;
51     sptr<OHOS::IBufferProducer> producer_;
52     sptr<IStreamOperator> streamOperator_;
53     std::shared_ptr<OHOS::Camera::CameraMetadata> cameraAbility_;
54 
55 protected:
56     std::mutex producerLock_;
57     std::mutex cameraAbilityLock_;
58     std::mutex streamOperatorLock_;
59 
60 private:
61     StreamType streamType_;
62     bool isReleaseStream_;
63 };
64 } // namespace CameraStandard
65 } // namespace OHOS
66 #endif // OHOS_CAMERA_H_STREAM_COMMON_H
67