| 1 | /* |
| 2 | * Copyright (c) 2018, 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 | //! |
| 24 | //! \file media_feature_const_settings.h |
| 25 | //! \brief Defines the common interface for meda feature default settings |
| 26 | //! \details The meda feature default settings is further sub-divided by codec type |
| 27 | //! this file is for the base interface which is shared by all components. |
| 28 | //! |
| 29 | |
| 30 | #ifndef __MEDIA_FEATURE_CONST_SETTINGS_H__ |
| 31 | #define __MEDIA_FEATURE_CONST_SETTINGS_H__ |
| 32 | #include "mos_os.h" |
| 33 | #include "mos_interface.h" |
| 34 | |
| 35 | struct ConstTableSet |
| 36 | { |
| 37 | void *data = nullptr; |
| 38 | uint32_t size = 0; |
| 39 | }; |
| 40 | |
| 41 | struct MediaFeatureSettings |
| 42 | { |
| 43 | virtual ~MediaFeatureSettings() {}; |
| 44 | }; |
| 45 | |
| 46 | class MediaFeatureConstSettings |
| 47 | { |
| 48 | public: |
| 49 | |
| 50 | //! |
| 51 | //! \brief MediaFeatureConstSettings constructor |
| 52 | //! |
| 53 | MediaFeatureConstSettings(){}; |
| 54 | MediaFeatureConstSettings(PMOS_INTERFACE osInterface) |
| 55 | { |
| 56 | if (osInterface && osInterface->pfnGetUserSettingInstance) |
| 57 | { |
| 58 | m_userSettingPtr = osInterface->pfnGetUserSettingInstance(osInterface); |
| 59 | } |
| 60 | if (!m_userSettingPtr) |
| 61 | { |
| 62 | MOS_OS_NORMALMESSAGE("Initialize m_userSettingPtr instance failed!"); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | //! |
| 67 | //! \brief MediaFeatureConstSettings deconstructor |
| 68 | //! |
| 69 | virtual ~MediaFeatureConstSettings() |
| 70 | { |
| 71 | if (m_featureSetting != nullptr) |
| 72 | { |
| 73 | MOS_Delete(m_featureSetting); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | //! |
| 78 | //! \brief Prepare const settings |
| 79 | //! \return MOS_STATUS |
| 80 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 81 | //! |
| 82 | virtual MOS_STATUS PrepareConstSettings() { return MOS_STATUS_SUCCESS; }; |
| 83 | |
| 84 | //! |
| 85 | //! \brief Get const settings |
| 86 | //! \return feature default settings |
| 87 | //! |
| 88 | void* GetConstSettings() {return m_featureSetting;}; |
| 89 | |
| 90 | protected: |
| 91 | |
| 92 | //! |
| 93 | //! \brief Prepare TU specific settings |
| 94 | //! \return MOS_STATUS |
| 95 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 96 | //! |
| 97 | virtual MOS_STATUS SetTUSettings() { return MOS_STATUS_SUCCESS; }; |
| 98 | |
| 99 | //! |
| 100 | //! \brief Prepare common settings |
| 101 | //! \return MOS_STATUS |
| 102 | //! MOS_STATUS_SUCCESS if success, else fail reason |
| 103 | //! |
| 104 | virtual MOS_STATUS SetCommonSettings() { return MOS_STATUS_SUCCESS; }; |
| 105 | |
| 106 | MediaFeatureSettings *m_featureSetting = nullptr; |
| 107 | MediaUserSettingSharedPtr m_userSettingPtr = nullptr; //!< usersettingInstance |
| 108 | MEDIA_CLASS_DEFINE_END(MediaFeatureConstSettings) |
| 109 | }; |
| 110 | |
| 111 | #endif // !__MEDIA_FEATURE_CONST_SETTINGS_H__ |