• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 DETAIL_ENHANCER_VIDEO_IMPL_H
17 #define DETAIL_ENHANCER_VIDEO_IMPL_H
18 
19 #include <atomic>
20 #include <memory>
21 #include <mutex>
22 
23 #include "algorithm_video_common.h"
24 #include "detail_enhancer_video.h"
25 #include "detail_enhancer_video_fwk.h"
26 
27 namespace OHOS {
28 namespace Media {
29 namespace VideoProcessingEngine {
30 class DetailEnhancerVideoImpl : public DetailEnhancerVideo {
31 public:
32     DetailEnhancerVideoImpl() = default;
33     ~DetailEnhancerVideoImpl() = default;
34 
35     int32_t Init();
36 
37     VPEAlgoErrCode RegisterCallback(const std::shared_ptr<VpeVideoCallback>& callback) override;
38     VPEAlgoErrCode SetOutputSurface(const sptr<Surface>& surface) override;
39     sptr<Surface> GetInputSurface() override;
40     VPEAlgoErrCode SetParameter(const DetailEnhancerParameters& parameter, SourceType type) override;
41     VPEAlgoErrCode Start() override;
42     VPEAlgoErrCode Stop() override;
43     VPEAlgoErrCode Release() override;
44     VPEAlgoErrCode RenderOutputBuffer(uint32_t index) override;
45     VPEAlgoErrCode ReleaseOutputBuffer(uint32_t index, bool render) override;
46 
47     VPEAlgoErrCode NotifyEos() override;
48 
49 private:
50     std::mutex lock_{};
51     // Guarded by lock_ begin
52     std::atomic<bool> isInitialized_{false};
53     std::shared_ptr<VpeVideoImpl> detailEnhancerVideo_{};
54     // Guarded by lock_ end
55 };
56 } // namespace VideoProcessingEngine
57 } // namespace Media
58 } // namespace OHOS
59 
60 #endif // DETAIL_ENHANCER_VIDEO_IMPL_H
61