• 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 IMAGE_ENVIRONMENT_NATIVE_H
17 #define IMAGE_ENVIRONMENT_NATIVE_H
18 
19 #include <cinttypes>
20 #include <mutex>
21 
22 #include "image_processing_types.h"
23 
24 namespace OHOS {
25 namespace Media {
26 namespace VideoProcessingEngine {
27 class ImageEnvironmentNative {
28 public:
29     static ImageEnvironmentNative& Get();
30 
31     ImageProcessing_ErrorCode Initialize();
32     ImageProcessing_ErrorCode Deinitialize();
33     ImageProcessing_ErrorCode InitializeByDefault();
34     ImageProcessing_ErrorCode DeinitializeByDefault();
35 
36 private:
37     ImageEnvironmentNative() = default;
38     virtual ~ImageEnvironmentNative() = default;
39     ImageEnvironmentNative(const ImageEnvironmentNative&) = delete;
40     ImageEnvironmentNative& operator=(const ImageEnvironmentNative&) = delete;
41     ImageEnvironmentNative(ImageEnvironmentNative&&) = delete;
42     ImageEnvironmentNative& operator=(ImageEnvironmentNative&&) = delete;
43 
44     ImageProcessing_ErrorCode InitializeLocked();
45     ImageProcessing_ErrorCode DeinitializeLocked();
46     ImageProcessing_ErrorCode InitializeEnvLocked();
47     ImageProcessing_ErrorCode DeinitializeEnvLocked();
48 
49     std::mutex lock_{};
50     // Guarded by lock_ begin
51     bool isExplicitInit_{};
52     uint32_t referenceCount_{};
53     // Guarded by lock_ end
54 };
55 } // namespace VideoProcessingEngine
56 } // namespace Media
57 } // namespace OHOS
58 
59 #endif // IMAGE_ENVIRONMENT_NATIVE_H
60