• 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  *
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_PREVIEW_OUTPUT_H
17 #define OHOS_CAMERA_PREVIEW_OUTPUT_H
18 
19 #include "capture_output.h"
20 #include "istream_repeat.h"
21 #include "istream_repeat_callback.h"
22 
23 namespace OHOS {
24 namespace CameraStandard {
25 class PreviewCallback {
26 public:
27     PreviewCallback() = default;
28     virtual ~PreviewCallback() = default;
29     virtual void OnFrameStarted() const = 0;
30     virtual void OnFrameEnded(const int32_t frameCount) const = 0;
31     virtual void OnError(const int32_t errorCode) const = 0;
32 };
33 
34 class PreviewOutput : public CaptureOutput {
35 public:
36     PreviewOutput(sptr<IStreamRepeat> &streamRepeat);
37     void SetCallback(std::shared_ptr<PreviewCallback> callback);
38     void Release() override;
39     sptr<IStreamRepeat> GetStreamRepeat();
40     std::shared_ptr<PreviewCallback> GetApplicationCallback();
41 
42 private:
43     sptr<IStreamRepeat> streamRepeat_;
44     std::shared_ptr<PreviewCallback> appCallback_;
45     sptr<IStreamRepeatCallback> svcCallback_;
46 };
47 } // namespace CameraStandard
48 } // namespace OHOS
49 #endif // OHOS_CAMERA_PREVIEW_OUTPUT_H