• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 #include "native_module_ohos_camera.h"
17 
18 namespace OHOS {
19 namespace CameraStandard {
20 /*
21  * Function registering all props and functions of ohos.camera module
22  */
Export(napi_env env,napi_value exports)23 static napi_value Export(napi_env env, napi_value exports)
24 {
25     MEDIA_INFO_LOG("Export called()");
26     CameraDeviceNapi::Init(env, exports);
27     CameraInputNapi::Init(env, exports);
28     PreviewOutputNapi::Init(env, exports);
29     PhotoOutputNapi::Init(env, exports);
30     VideoOutputNapi::Init(env, exports);
31     CameraSessionNapi::Init(env, exports);
32     CameraManagerNapi::Init(env, exports);
33     CameraNapi::Init(env, exports);
34     CameraOutputCapabilityNapi::Init(env, exports);
35     CameraSizeNapi::Init(env, exports);
36     CameraVideoProfileNapi::Init(env, exports);
37     CameraPrelaunchConfigNapi::Init(env, exports);
38     MetadataOutputNapi::Init(env, exports);
39     MetadataObjectNapi::Init(env, exports);
40     PortraitSessionNapi::Init(env, exports);
41     ModeManagerNapi::Init(env, exports);
42     return exports;
43 }
44 
45 /*
46  * module define
47  */
48 static napi_module g_module = {
49     .nm_version = 1,
50     .nm_flags = 0,
51     .nm_filename = nullptr,
52     .nm_register_func = Export,
53     .nm_modname = "multimedia.camera",
54     .nm_priv = (reinterpret_cast<void*>(0)),
55     .reserved = {0}
56 };
57 
58 /*
59  * module register
60  */
RegisterModule(void)61 extern "C" __attribute__((constructor)) void RegisterModule(void)
62 {
63     MEDIA_DEBUG_LOG("RegisterModule is called");
64     napi_module_register(&g_module);
65 }
66 } // namespace CameraStandard
67 } // namespace OHOS
68