• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 OH_VEF_EDITOR_IMPL_H
17 #define OH_VEF_EDITOR_IMPL_H
18 
19 #include <mutex>
20 #include "video_editor.h"
21 #include "data_center/data_center.h"
22 #include "composite_engine/composite_engine.h"
23 
24 namespace OHOS {
25 namespace Media {
26 
27 enum class VideoEditorState : int32_t {
28     INIT,
29     IDLE,
30     COMPOSITING,
31     CANCELLING
32 };
33 
34 class VideoEditorImpl : public VideoEditor {
35 public:
36     explicit VideoEditorImpl(uint64_t id);
37     ~VideoEditorImpl() override;
38 
39     uint64_t GetId() const;
40     VideoEditorState GetState() const;
41 
42     VEFError Init();
43 
44     VEFError AppendVideoFile(int fileFd, const std::string &effectDescription) override;
45     VEFError StartComposite(const std::shared_ptr<CompositionOptions> &options) override;
46     VEFError CancelComposite() override;
47 
48 private:
49     void OnCompositeResult(VEFResult result);
50 
51 private:
52     mutable std::mutex editorLock_;
53     uint64_t id_{ 0 };
54     std::string logTag_;
55     VideoEditorState state_{ VideoEditorState::INIT };
56     std::shared_ptr<IDataCenter> dataCenter_{ nullptr };
57     std::shared_ptr<ICompositeEngine> compositeEngine_{ nullptr };
58 };
59 }  // namespace Media
60 }  // namespace OHOS
61 
62 #endif  // OH_VEF_EDITOR_IMPL_H
63