• 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     MetadataOutputNapi::Init(env, exports);
38     MetadataObjectNapi::Init(env, exports);
39     return exports;
40 }
41 
42 /*
43  * module define
44  */
45 static napi_module g_module = {
46     .nm_version = 1,
47     .nm_flags = 0,
48     .nm_filename = nullptr,
49     .nm_register_func = Export,
50     .nm_modname = "multimedia.camera",
51     .nm_priv = (reinterpret_cast<void*>(0)),
52     .reserved = {0}
53 };
54 
55 /*
56  * module register
57  */
RegisterModule(void)58 extern "C" __attribute__((constructor)) void RegisterModule(void)
59 {
60     MEDIA_INFO_LOG("RegisterModule called()");
61     napi_module_register(&g_module);
62 }
63 } // namespace CameraStandard
64 } // namespace OHOS
65