| 1 | /* |
| 2 | * Copyright (c) 2021-2022, Intel Corporation |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 8 | * and/or sell copies of the Software, and to permit persons to whom the |
| 9 | * Software is furnished to do so, subject to the following conditions: |
| 10 | * |
| 11 | * The above copyright notice and this permission notice shall be included |
| 12 | * in all copies or substantial portions of the Software. |
| 13 | * |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 20 | * OTHER DEALINGS IN THE SOFTWARE. |
| 21 | */ |
| 22 | //! |
| 23 | //! \file media_user_setting.cpp |
| 24 | //! \brief The interface of media user setting |
| 25 | //! |
| 26 | |
| 27 | #include <algorithm> |
| 28 | #include "media_user_setting.h" |
| 29 | |
| 30 | namespace MediaUserSetting { |
| 31 | |
| 32 | MediaUserSetting::MediaUserSetting() |
| 33 | { |
| 34 | } |
| 35 | MediaUserSetting::MediaUserSetting(MOS_USER_FEATURE_KEY_PATH_INFO *keyPathInfo) : m_configure(keyPathInfo) |
| 36 | { |
| 37 | |
| 38 | } |
| 39 | |
| 40 | MediaUserSetting::~MediaUserSetting() |
| 41 | { |
| 42 | } |
| 43 | |
| 44 | MOS_STATUS MediaUserSetting::Register( |
| 45 | const std::string &valueName, |
| 46 | const Group &group, |
| 47 | const Value &defaultValue, |
| 48 | bool isReportKey, |
| 49 | bool debugOnly, |
| 50 | bool useCustomPath, |
| 51 | const std::string &customPath, |
| 52 | bool statePath) |
| 53 | { |
| 54 | return m_configure.Register( |
| 55 | valueName, |
| 56 | group, |
| 57 | defaultValue, |
| 58 | isReportKey, |
| 59 | debugOnly, |
| 60 | useCustomPath, |
| 61 | customPath, |
| 62 | statePath); |
| 63 | } |
| 64 | |
| 65 | MOS_STATUS MediaUserSetting::Read(Value &value, |
| 66 | const std::string &valueName, |
| 67 | const Group &group, |
| 68 | const Value &customValue, |
| 69 | bool useCustomValue, |
| 70 | uint32_t option) |
| 71 | { |
| 72 | auto status = m_configure.Read(value, valueName, group, customValue, useCustomValue, option); |
| 73 | if(status != MOS_STATUS_SUCCESS) |
| 74 | { |
| 75 | MOS_OS_NORMALMESSAGE("User setting %s read error", valueName.c_str()); |
| 76 | } |
| 77 | return status; |
| 78 | } |
| 79 | |
| 80 | MOS_STATUS MediaUserSetting::Write( |
| 81 | const std::string &valueName, |
| 82 | const Value &value, |
| 83 | const Group &group, |
| 84 | bool isForReport, |
| 85 | uint32_t option) |
| 86 | { |
| 87 | return m_configure.Write(valueName, value, group, isForReport, option); |
| 88 | } |
| 89 | |
| 90 | bool MediaUserSetting::IsDeclaredUserSetting(const std::string &valueName) |
| 91 | { |
| 92 | return m_configure.IsDefinitionExist(valueName); |
| 93 | } |
| 94 | |
| 95 | MOS_STATUS MediaUserSetting::UserFeatureReadValue( |
| 96 | PMOS_USER_FEATURE_INTERFACE pOsUserFeatureInterface, |
| 97 | uint32_t valueID, |
| 98 | PMOS_USER_FEATURE_VALUE_DATA pValueData, |
| 99 | MOS_CONTEXT_HANDLE mosCtx) |
| 100 | { |
| 101 | return MosUtilities::MosUserFeatureReadValueID(pOsUserFeatureInterface, valueID, pValueData, mosCtx); |
| 102 | } |
| 103 | |
| 104 | MOS_STATUS MediaUserSetting::UserFeatureWriteValue( |
| 105 | PMOS_USER_FEATURE_INTERFACE pOsUserFeatureInterface, |
| 106 | PMOS_USER_FEATURE_VALUE_WRITE_DATA pWriteValues, |
| 107 | uint32_t uiNumOfValues, |
| 108 | MOS_CONTEXT_HANDLE mosCtx) |
| 109 | { |
| 110 | return MosUtilities::MosUserFeatureWriteValuesID(pOsUserFeatureInterface, pWriteValues, uiNumOfValues, mosCtx); |
| 111 | } |
| 112 | |
| 113 | } |
| 114 |