/* * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OHOS_CAMERA_H_STREAM_REPEAT_H #define OHOS_CAMERA_H_STREAM_REPEAT_H #include #include #include #include "camera_metadata_info.h" #include "hstream_common.h" #include "hstream_repeat_stub.h" #include "istream_repeat_callback.h" #include "v1_0/istream_operator.h" namespace OHOS { namespace CameraStandard { enum class RepeatStreamType { PREVIEW, VIDEO, SKETCH }; class HStreamRepeat : public HStreamRepeatStub, public HStreamCommon { public: HStreamRepeat( sptr producer, int32_t format, int32_t width, int32_t height, RepeatStreamType type); ~HStreamRepeat(); int32_t LinkInput(sptr streamOperator, std::shared_ptr cameraAbility) override; void SetStreamInfo(StreamInfo_V1_1& streamInfo) override; int32_t ReleaseStream(bool isDelay) override; int32_t Release() override; int32_t Start() override; int32_t Start(std::shared_ptr settings); int32_t Stop() override; int32_t SetCallback(sptr& callback) override; int32_t OnFrameStarted(); int32_t OnFrameEnded(int32_t frameCount); int32_t OnFrameError(int32_t errorType); int32_t OnSketchStatusChanged(SketchStatus status); int32_t AddDeferredSurface(const sptr& producer) override; int32_t ForkSketchStreamRepeat( int32_t width, int32_t height, sptr& sketchStream, float sketchRatio) override; int32_t RemoveSketchStreamRepeat() override; int32_t UpdateSketchRatio(float sketchRatio) override; sptr GetSketchStream(); RepeatStreamType GetRepeatStreamType(); void DumpStreamInfo(std::string& dumpString) override; int32_t OperatePermissionCheck(uint32_t interfaceCode) override; private: void SetStreamTransform(); void StartSketchStream(std::shared_ptr settings); void UpdateSketchStatus(SketchStatus status); RepeatStreamType repeatStreamType_; sptr streamRepeatCallback_; std::mutex callbackLock_; std::mutex sketchStreamLock_; // Guard sketchStreamRepeat_ sptr sketchStreamRepeat_; wptr parentStreamRepeat_; float sketchRatio_ = -1.0f; SketchStatus sketchStatus_ = SketchStatus::STOPED; }; } // namespace CameraStandard } // namespace OHOS #endif // OHOS_CAMERA_H_STREAM_REPEAT_H