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 OHOS_NAPI_QUEUE_ITEM_H 17 #define OHOS_NAPI_QUEUE_ITEM_H 18 19 #include "avmedia_description.h" 20 #include "avqueue_item.h" 21 #include "napi/native_api.h" 22 23 namespace OHOS::AVSession { 24 class NapiQueueItem { 25 public: 26 static napi_status GetValue(napi_env env, napi_value in, AVQueueItem& out); 27 static napi_status SetValue(napi_env env, const AVQueueItem& in, napi_value& out); 28 29 using GetterType = std::function<napi_status(napi_env, napi_value in, AVQueueItem& out)>; 30 using SetterType = std::function<napi_status(napi_env env, const AVQueueItem& in, napi_value& out)>; 31 32 private: 33 static napi_status GetItemId(napi_env env, napi_value in, AVQueueItem& out); 34 static napi_status SetItemId(napi_env env, const AVQueueItem& in, napi_value& out); 35 36 static napi_status GetDescription(napi_env env, napi_value in, AVQueueItem& out); 37 static napi_status SetDescription(napi_env env, const AVQueueItem& in, napi_value& out); 38 39 static std::map<std::string, GetterType> getterMap_; 40 static std::map<int32_t, SetterType> setterMap_; 41 42 static constexpr int GETTER_INDEX = 0; 43 static constexpr int SETTER_INDEX = 1; 44 static constexpr int ENUM_INDEX = 2; 45 }; 46 } 47 #endif // OHOS_NAPI_QUEUE_ITEM_H 48