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 INTERFACES_KITS_JS_MEDIALIBRARY_INCLUDE_MEDIA_ASSET_DATA_HANDLER_NAPI_H 17 #define INTERFACES_KITS_JS_MEDIALIBRARY_INCLUDE_MEDIA_ASSET_DATA_HANDLER_NAPI_H 18 19 #include "medialibrary_napi_utils.h" 20 21 namespace OHOS { 22 namespace Media { 23 enum class ReturnDataType { 24 TYPE_IMAGE_SOURCE = 0, 25 TYPE_ARRAY_BUFFER, 26 }; 27 28 enum class DeliveryMode { 29 FAST = 0, 30 HIGH_QUALITY, 31 BALANCED_MODE, 32 }; 33 34 enum class SourceMode { 35 ORIGINAL_MODE = 0, 36 EDITED_MODE, 37 }; 38 39 class NapiMediaAssetDataHandler { 40 public: 41 NapiMediaAssetDataHandler(napi_env env, napi_value jsMediaAssetDataHandler, ReturnDataType dataType); 42 ~NapiMediaAssetDataHandler() = default; 43 ReturnDataType GetHandlerType(); 44 void JsOnDataPreared(napi_value exports); 45 46 private: 47 ReturnDataType dataType_; 48 napi_value ondataPreparedFunc_ = nullptr; 49 napi_value thisVar_ = nullptr; 50 napi_env env_ = nullptr; 51 }; 52 53 } // Media 54 } // OHOS 55 #endif // INTERFACES_KITS_JS_MEDIALIBRARY_INCLUDE_MEDIA_ASSET_DATA_HANDLER_NAPI_H 56