1 /*
2  * Copyright (C) 2023 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 FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_RECEIVER_MDK_KITS_H
17 #define FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_RECEIVER_MDK_KITS_H
18 
19 #include "common_utils.h"
20 #include "native_image.h"
21 #include "image_receiver_napi.h"
22 #include "image_receiver_mdk.h"
23 
24 namespace OHOS {
25 namespace Media {
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 struct ImageReceiverArgs {
31     char* id;
32     size_t inLen;
33     int32_t inNum0;
34     int32_t inNum1;
35     int32_t inNum2;
36     int32_t inNum3;
37     napi_env inEnv;
38     OH_Image_Receiver_On_Callback callback;
39     napi_value* outValue;
40     int32_t* outNum0;
41     struct OhosImageSize* outSize;
42 };
43 
44 enum {
45     ENV_FUNC_IMAGE_RECEIVER_CREATE,
46     CTX_FUNC_IMAGE_RECEIVER_GET_RECEIVER_ID,
47     CTX_FUNC_IMAGE_RECEIVER_READ_LATEST_IMAGE,
48     CTX_FUNC_IMAGE_RECEIVER_READ_NEXT_IMAGE,
49     CTX_FUNC_IMAGE_RECEIVER_ON,
50     CTX_FUNC_IMAGE_RECEIVER_GET_SIZE,
51     CTX_FUNC_IMAGE_RECEIVER_GET_CAPACITY,
52     CTX_FUNC_IMAGE_RECEIVER_GET_FORMAT,
53 };
54 
55 ImageReceiverNapi* ImageReceiver_Unwrap(napi_env env, napi_value value);
56 int32_t ImageReceiverNativeEnvCall(int32_t mode, napi_env env, struct ImageReceiverArgs* args);
57 int32_t ImageReceiverNativeCtxCall(int32_t mode, ImageReceiverNapi* native, struct ImageReceiverArgs* args);
58 #ifdef __cplusplus
59 };
60 #endif
61 } // namespace Media
62 } // namespace OHOS
63 #endif // FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_RECEIVER_MDK_KITS_H
64