1 /* 2 * Copyright (c) 2023-2023 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_DPS_VIDEO_PROCESS_COMMAND_H 17 #define OHOS_CAMERA_DPS_VIDEO_PROCESS_COMMAND_H 18 19 #include "command.h" 20 #include "scheduler_manager.h" 21 22 namespace OHOS { 23 namespace CameraStandard { 24 namespace DeferredProcessing { 25 class VideoProcessCommand : public Command { 26 public: 27 VideoProcessCommand(const int32_t userId); 28 ~VideoProcessCommand(); 29 30 protected: 31 int32_t Initialize(); 32 33 const int32_t userId_; 34 std::atomic<bool> initialized_ {false}; 35 std::shared_ptr<SchedulerManager> schedulerManager_ {nullptr}; 36 std::shared_ptr<DeferredVideoController> controller_ {nullptr}; 37 }; 38 39 class VideoProcessSuccessCommand : public VideoProcessCommand { 40 DECLARE_CMD_CLASS(VideoProcessSuccessCommand); 41 public: 42 VideoProcessSuccessCommand(const int32_t userId, const DeferredVideoWorkPtr& work); 43 ~VideoProcessSuccessCommand() override; 44 45 protected: 46 int32_t Executing() override; 47 48 DeferredVideoWorkPtr work_; 49 }; 50 51 class VideoProcessFailedCommand : public VideoProcessCommand { 52 DECLARE_CMD_CLASS(VideoProcessFailedCommand); 53 public: 54 VideoProcessFailedCommand(const int32_t userId, const DeferredVideoWorkPtr& work, DpsError errorCode); 55 ~VideoProcessFailedCommand() override; 56 57 protected: 58 int32_t Executing() override; 59 60 DeferredVideoWorkPtr work_; 61 DpsError error_; 62 }; 63 64 class VideoStateChangedCommand : public VideoProcessCommand { 65 DECLARE_CMD_CLASS(VideoStateChangedCommand); 66 public: VideoStateChangedCommand(const int32_t userId,HdiStatus status)67 VideoStateChangedCommand(const int32_t userId, HdiStatus status) 68 : VideoProcessCommand(userId), status_(status) 69 { 70 DP_DEBUG_LOG("entered."); 71 } 72 ~VideoStateChangedCommand() override = default; 73 74 protected: 75 int32_t Executing() override; 76 77 HdiStatus status_; 78 }; 79 } // namespace DeferredProcessing 80 } // namespace CameraStandard 81 } // namespace OHOS 82 #endif // OHOS_CAMERA_DPS_VIDEO_PROCESS_COMMAND_H