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_VIDEO_OUTPUT_H 17 #define OHOS_CAMERA_VIDEO_OUTPUT_H 18 19 #include <iostream> 20 #include <vector> 21 #include "output/capture_output.h" 22 #include "istream_repeat.h" 23 #include "istream_repeat_callback.h" 24 25 namespace OHOS { 26 namespace CameraStandard { 27 class VideoCallback { 28 public: 29 VideoCallback() = default; 30 virtual ~VideoCallback() = default; 31 virtual void OnFrameStarted() const = 0; 32 virtual void OnFrameEnded(const int32_t frameCount) const = 0; 33 virtual void OnError(const int32_t errorCode) const = 0; 34 }; 35 36 class VideoOutput : public CaptureOutput { 37 public: 38 VideoOutput(sptr<IStreamRepeat> &streamRepeat); 39 void Release() override; 40 sptr<IStreamRepeat> GetStreamRepeat(); 41 void SetCallback(std::shared_ptr<VideoCallback> callback); 42 std::vector<float> GetSupportedFps(); 43 float GetFps(); 44 int32_t SetFps(float fps); 45 int32_t Start(); 46 int32_t Stop(); 47 int32_t Pause(); 48 int32_t Resume(); 49 std::shared_ptr<VideoCallback> GetApplicationCallback(); 50 51 private: 52 sptr<IStreamRepeat> streamRepeat_; 53 std::shared_ptr<VideoCallback> appCallback_; 54 sptr<IStreamRepeatCallback> svcCallback_; 55 }; 56 } // namespace CameraStandard 57 } // namespace OHOS 58 #endif // OHOS_CAMERA_VIDEO_OUTPUT_H 59