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 DETAIL_ENHANCER_VIDEO_NATIVE_H
17 #define DETAIL_ENHANCER_VIDEO_NATIVE_H
18 
19 #include <atomic>
20 #include <functional>
21 #include <mutex>
22 
23 #include "detail_enhancer.h"
24 #include "video_processing_native.h"
25 
26 namespace OHOS {
27 namespace Media {
28 namespace VideoProcessingEngine {
29 /**
30  * Detail enhancer interface implementation.
31  */
32 class DetailEnhancerVideoNative : public VideoProcessingNative {
33 public:
DetailEnhancerVideoNative(OH_VideoProcessing * context)34     explicit DetailEnhancerVideoNative(OH_VideoProcessing* context) : VideoProcessingNative(context) {};
35     virtual ~DetailEnhancerVideoNative() = default;
36     DetailEnhancerVideoNative(const DetailEnhancerVideoNative&) = delete;
37     DetailEnhancerVideoNative& operator=(const DetailEnhancerVideoNative&) = delete;
38     DetailEnhancerVideoNative(DetailEnhancerVideoNative&&) = delete;
39     DetailEnhancerVideoNative& operator=(DetailEnhancerVideoNative&&) = delete;
40 
41 protected:
42     VideoProcessing_ErrorCode InitializeInner() final;
43     VideoProcessing_ErrorCode DeinitializeInner() final;
44     VideoProcessing_ErrorCode SetParameter(const OHOS::Media::Format& parameter) final;
45     VideoProcessing_ErrorCode GetParameter(OHOS::Media::Format& parameter) final;
46     VideoProcessing_ErrorCode SetProducerSurface(const OHNativeWindow& window, BufferRequestConfig& requestCfg) final;
47     VideoProcessing_ErrorCode Process(const sptr<SurfaceBuffer>& sourceImage,
48         sptr<SurfaceBuffer>& destinationImage) final;
49     void UpdateRequestCfg(const sptr<SurfaceBuffer>& consumerBuffer, BufferRequestConfig& requestCfg) final;
50 
51 private:
52     int NDKLevelToInner(int level) const;
53 
54     DetailEnhancer detailEnhancer_{};
55 };
56 } // namespace VideoProcessingEngine
57 } // namespace Media
58 } // namespace OHOS
59 
60 #endif // DETAIL_ENHANCER_VIDEO_NATIVE_H