• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024-2024 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 #include "video_post_processor.h"
22 
23 namespace OHOS {
24 namespace CameraStandard {
25 namespace DeferredProcessing {
26 class VideoProcessCommand : public Command {
27 public:
28     VideoProcessCommand(const int32_t userId);
29     ~VideoProcessCommand() = default;
30 
31 protected:
32     int32_t Initialize();
33 
34     const int32_t userId_;
35     std::atomic<bool> initialized_ {false};
36     std::shared_ptr<VideoPostProcessor> videoPostProcess_ {nullptr};
37 };
38 
39 class VideoProcessSuccessCommand : public VideoProcessCommand {
40     DECLARE_CMD_CLASS(VideoProcessSuccessCommand);
41 public:
42     VideoProcessSuccessCommand(const int32_t userId, const std::string& videoId,
43         std::unique_ptr<MediaUserInfo> userInfo = nullptr)
VideoProcessCommand(userId)44         : VideoProcessCommand(userId), videoId_(videoId), userInfo_(std::move(userInfo))
45     {
46         DP_DEBUG_LOG("entered.");
47     }
48     ~VideoProcessSuccessCommand() = default;
49 
50 protected:
51     int32_t Executing() override;
52 
53     const std::string videoId_;
54     std::unique_ptr<MediaUserInfo> userInfo_;
55 };
56 
57 class VideoProcessFailedCommand : public VideoProcessCommand {
58     DECLARE_CMD_CLASS(VideoProcessFailedCommand);
59 public:
VideoProcessFailedCommand(const int32_t userId,const std::string & videoId,DpsError errorCode)60     VideoProcessFailedCommand(const int32_t userId, const std::string& videoId, DpsError errorCode)
61         : VideoProcessCommand(userId), videoId_(videoId), error_(errorCode)
62     {
63         DP_DEBUG_LOG("entered.");
64     }
65     ~VideoProcessFailedCommand() = default;
66 
67 protected:
68     int32_t Executing() override;
69 
70     const std::string videoId_;
71     DpsError error_;
72 };
73 
74 class VideoStateChangedCommand : public VideoProcessCommand {
75     DECLARE_CMD_CLASS(VideoStateChangedCommand);
76 public:
VideoStateChangedCommand(const int32_t userId,HdiStatus status)77     VideoStateChangedCommand(const int32_t userId, HdiStatus status)
78         : VideoProcessCommand(userId), status_(status)
79     {
80         DP_DEBUG_LOG("entered.");
81     }
82     ~VideoStateChangedCommand() = default;
83 
84 protected:
85     int32_t Executing() override;
86 
87     HdiStatus status_;
88 };
89 } // namespace DeferredProcessing
90 } // namespace CameraStandard
91 } // namespace OHOS
92 #endif // OHOS_CAMERA_DPS_VIDEO_PROCESS_COMMAND_H