• 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_REPEAT_H
17 #define OHOS_CAMERA_H_STREAM_REPEAT_H
18 
19 #include "camera_metadata_info.h"
20 #include "display_type.h"
21 #include "hstream_repeat_stub.h"
22 #include "istream_operator.h"
23 
24 #include <refbase.h>
25 #include <iostream>
26 
27 namespace OHOS {
28 namespace CameraStandard {
29 class HStreamRepeat : public HStreamRepeatStub {
30 public:
31     HStreamRepeat(sptr<OHOS::IBufferProducer> producer, int32_t format);
32     HStreamRepeat(sptr<OHOS::IBufferProducer> producer, int32_t format, int32_t width, int32_t height);
33     HStreamRepeat(sptr<OHOS::IBufferProducer> producer, int32_t format, bool isVideo);
34     ~HStreamRepeat();
35 
36     static void ResetCaptureIds();
37     int32_t LinkInput(sptr<Camera::IStreamOperator> streamOperator,
38     std::shared_ptr<Camera::CameraMetadata> cameraAbility, int32_t streamId);
39     void SetStreamInfo(std::shared_ptr<Camera::StreamInfo> streamInfo);
40     int32_t Release() override;
41     int32_t Start() override;
42     int32_t Stop() override;
43     sptr<OHOS::IBufferProducer> GetBufferProducer();
44     int32_t SetFps(float Fps) override;
45     int32_t SetCallback(sptr<IStreamRepeatCallback> &callback) override;
46     int32_t OnFrameStarted();
47     int32_t OnFrameEnded(int32_t frameCount);
48     int32_t OnFrameError(int32_t errorType);
49     bool IsVideo();
50     bool IsReleaseStream();
51     int32_t SetReleaseStream(bool isReleaseStream);
52     int32_t GetStreamId();
53     void dumpRepeatStreamInfo(std::string& dumpString);
54 
55 private:
56     static int32_t videoCaptureId_;
57     static int32_t previewCaptureId_;
58     int32_t StartPreview();
59     int32_t StartVideo();
60     bool IsvalidCaptureID();
61     int32_t curCaptureID_;
62     bool isVideo_;
63     bool isReleaseStream_;
64     int32_t customPreviewWidth_;
65     int32_t customPreviewHeight_;
66     sptr<Camera::IStreamOperator> streamOperator_;
67     int32_t streamId_;
68     int32_t format_;
69     sptr<OHOS::IBufferProducer> producer_;
70     sptr<IStreamRepeatCallback> streamRepeatCallback_;
71     std::shared_ptr<Camera::CameraMetadata> cameraAbility_;
72 };
73 } // namespace CameraStandard
74 } // namespace OHOS
75 #endif // OHOS_CAMERA_H_STREAM_REPEAT_H
76