| 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_definition.h |
| 24 |
//! \brief Media user setting item definition |
| 25 |
//! |
| 26 |
|
| 27 |
#ifndef __MEDIA_USER_SETTING_DEFINITION__H__ |
| 28 |
#define __MEDIA_USER_SETTING_DEFINITION__H__ |
| 29 |
|
| 30 |
#include <string> |
| 31 |
#include <map> |
| 32 |
#include <memory> |
| 33 |
#include <iosfwd> |
| 34 |
#include "mos_defs_specific.h" |
| 35 |
#include "media_user_setting_value.h" |
| 36 |
|
| 37 |
namespace MediaUserSetting { |
| 38 |
|
| 39 |
//! |
| 40 |
//! The media user setting group |
| 41 |
//! Device - for regkeys which are touched per device |
| 42 |
//! Sequence - for regkeys which are touched per video sequence |
| 43 |
//! Frame - for regkeys which are touched per frame |
| 44 |
//! MaxCount - is used to configure size of Configure::m_definitions array |
| 45 |
//! Note: you must not assign any numeric values to the enum items, except for |
| 46 |
//! the device being set to 0 |
| 47 |
//! |
| 48 |
enum Group |
| 49 |
{ |
| 50 |
Device = 0, |
| 51 |
Sequence, |
| 52 |
Frame, |
| 53 |
MaxCount |
| 54 |
}; |
| 55 |
|
| 56 |
namespace Internal { |
| 57 |
|
| 58 |
class Definition |
| 59 |
{ |
| 60 |
public: |
| 61 |
//! |
| 62 |
//! \brief Constructor |
| 63 |
//! \param [in] itemName |
| 64 |
//! Name of the item |
| 65 |
//! \param [in] defaultValue |
| 66 |
//! The default value of the item |
| 67 |
//! \param [in] isReportKey |
| 68 |
//! Whether this item can be reported |
| 69 |
//! \param [in] debugOnly |
| 70 |
//! Whether this item is only for debug/release-internal |
| 71 |
//! \param [in] useCustomPath |
| 72 |
//! Specifiy a read path |
| 73 |
//! \param [in] customPath |
| 74 |
//! The specified read path |
| 75 |
Definition(const std::string &itemName, |
| 76 |
const Value &defaultValue, |
| 77 |
bool isReportKey, |
| 78 |
bool debugOnly, |
| 79 |
bool useCustomPath, |
| 80 |
const std::string &subPath, |
| 81 |
UFKEY_NEXT rootKey, |
| 82 |
bool statePath); |
| 83 |
|
| 84 |
//! |
| 85 |
//! \brief Constructor |
| 86 |
//! \param [in] Definition |
| 87 |
//! Reference of definition |
| 88 |
Definition(const Definition& def); |
| 89 |
|
| 90 |
//! |
| 91 |
//! \brief Destructor |
| 92 |
//! |
| 93 |
virtual ~Definition(); |
| 94 |
|
| 95 |
Definition& operator=(const Definition& def); |
| 96 |
|
| 97 |
//! |
| 98 |
//! \brief Get the item name of the definition |
| 99 |
//! \return std::string |
| 100 |
//! the item name |
| 101 |
//! |
| 102 |
std::string ItemName() const { return m_itemName; } |
| 103 |
|
| 104 |
//! |
| 105 |
//! \brief Get the sub path of the definition |
| 106 |
//! \return std::string |
| 107 |
//! the custom path |
| 108 |
//! |
| 109 |
std::string &ItemEnvName() { return m_itemEnvName; } |
| 110 |
|
| 111 |
//! |
| 112 |
//! \brief Get the debug flag |
| 113 |
//! \return bool |
| 114 |
//! debug flag |
| 115 |
//! |
| 116 |
bool IsDebugOnly() const { return m_debugOnly; } |
| 117 |
|
| 118 |
//! |
| 119 |
//! \brief Get default value of the user setting item |
| 120 |
//! \return Value |
| 121 |
//! default value |
| 122 |
//! |
| 123 |
Value DefaultValue() const { return m_defaultValue; } |
| 124 |
|
| 125 |
//! |
| 126 |
//! \brief Get report flag |
| 127 |
//! \return bool |
| 128 |
//! report flag |
| 129 |
//! |
| 130 |
bool IsReportKey() const { return m_isReportKey; } |
| 131 |
|
| 132 |
//! |
| 133 |
//! \brief Get report flag |
| 134 |
//! \return bool |
| 135 |
//! report flag |
| 136 |
//! |
| 137 |
bool UseCustomPath() const { return m_useCustomePath; } |
| 138 |
|
| 139 |
//! |
| 140 |
//! \brief Get the sub path of the definition |
| 141 |
//! \return std::string |
| 142 |
//! the custom path |
| 143 |
//! |
| 144 |
std::string GetSubPath() const { return m_subPath; } |
| 145 |
|
| 146 |
//! |
| 147 |
//! \brief Get the custom path of the definition |
| 148 |
//! \return std::string |
| 149 |
//! the custom path |
| 150 |
//! |
| 151 |
UFKEY_NEXT GetRootKey() const { return m_rootKey; } |
| 152 |
|
| 153 |
//! |
| 154 |
//! \brief Get the custom path of the definition |
| 155 |
//! \return std::string |
| 156 |
//! the custom path |
| 157 |
//! |
| 158 |
bool UseStatePath() const { return m_statePath; } |
| 159 |
private: |
| 160 |
//! |
| 161 |
//! \brief Set the values of definition |
| 162 |
//! \param [in] Definition |
| 163 |
//! Reference of definition |
| 164 |
void SetData(const Definition& def); |
| 165 |
|
| 166 |
private: |
| 167 |
std::string m_itemName{}; //!< Item name |
| 168 |
std::string m_itemEnvName{}; //!< Item name |
| 169 |
Value m_defaultValue {}; //!< Default value |
| 170 |
bool m_isReportKey = false; //!< This item value can be reported |
| 171 |
bool m_debugOnly = false; //!< Whether the item is only enabled in debug/release-internal mode |
| 172 |
bool m_useCustomePath = false; //!< Whether the item read from a specific path |
| 173 |
std::string m_subPath{}; //!< custome path is a relative path, it could be null |
| 174 |
UFKEY_NEXT m_rootKey{}; //!< root key |
| 175 |
bool m_statePath = true; //!< Whether the item read from a specific path |
| 176 |
}; |
| 177 |
|
| 178 |
using Definitions = std::map<std::size_t, std::shared_ptr<Definition>>; |
| 179 |
|
| 180 |
} |
| 181 |
} |
| 182 |
#endif |