• 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 VIDEO_PROCESSING_NATIVE_TEMPLATE_H
17 #define VIDEO_PROCESSING_NATIVE_TEMPLATE_H
18 
19 #include <memory>
20 
21 #include "nocopyable.h"
22 #include "video_processing_native_base.h"
23 
24 #define DEFINE_WITH_DISALLOW_COPY_AND_MOVE(className) \
25     className([[maybe_unused]] Protected mask, OH_VideoProcessing* context) \
26         : VideoProcessingNativeTemplate<className>(context) {} \
27     virtual ~className() = default; \
28     DISALLOW_COPY_AND_MOVE(className)
29 
30 namespace OHOS {
31 namespace Media {
32 namespace VideoProcessingEngine {
33 /**
34  * Base implementaion for video processing.
35  */
36 template <typename T>
37 class VideoProcessingNativeTemplate : public VideoProcessingNativeBase, public std::enable_shared_from_this<T> {
38 public:
Create(OH_VideoProcessing * context)39     static inline std::shared_ptr<T> Create(OH_VideoProcessing* context)
40     {
41         return std::make_shared<T>(Protected(), context);
42     }
43 
44 protected:
45     struct Protected { explicit Protected() = default; };
46 
VideoProcessingNativeTemplate(OH_VideoProcessing * context)47     explicit VideoProcessingNativeTemplate(OH_VideoProcessing* context) : VideoProcessingNativeBase(context) {}
48     virtual ~VideoProcessingNativeTemplate() = default;
49     VideoProcessingNativeTemplate(const VideoProcessingNativeTemplate&) = delete;
50     VideoProcessingNativeTemplate& operator=(const VideoProcessingNativeTemplate&) = delete;
51     VideoProcessingNativeTemplate(VideoProcessingNativeTemplate&&) = delete;
52     VideoProcessingNativeTemplate& operator=(VideoProcessingNativeTemplate&&) = delete;
53 };
54 } // namespace VideoProcessingEngine
55 } // namespace Media
56 } // namespace OHOS
57 
58 #endif // VIDEO_PROCESSING_NATIVE_TEMPLATE_H
59