xref: /aosp_15_r20/external/intel-media-driver/media_softlet/agnostic/common/shared/features/media_feature.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
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 //! \file     media_feature.h
24 //! \brief    Defines the common interface for media feature
25 //!
26 #ifndef __MEDIA_FEATURE_H__
27 #define __MEDIA_FEATURE_H__
28 
29 #include "media_user_setting.h"
30 #include "mos_defs.h"
31 #include "mos_os_specific.h"
32 #include "media_feature_manager.h"
33 
34 class MediaFeature
35 {
36 public:
MediaFeature()37     MediaFeature(){};
MediaFeature(void * constSettings)38     MediaFeature(void *constSettings) : m_constSettings(constSettings){};
39     MediaFeature(void *constSettings, PMOS_INTERFACE mosInterface);
40     MediaFeature(PMOS_INTERFACE mosInterface);
~MediaFeature()41     virtual ~MediaFeature() {}
42 
43     //!
44     //! \brief  Init parameter
45     //! \param  [in] settings
46     //!         Pointer to settings
47     //! \return MOS_STATUS
48     //!         MOS_STATUS_SUCCESS if success, else fail reason
49     //!
50     virtual MOS_STATUS Init(void *settings);
51 
52     //!
53     //! \brief  Update parameter
54     //! \param  [in] params
55     //!         Pointer to parameters
56     //! \return MOS_STATUS
57     //!         MOS_STATUS_SUCCESS if success, else fail reason
58     //!
59     virtual MOS_STATUS Update(void *params);
60 
61     //! \brief  Check whether the feather is enabled
62     //! \return bool
63     //!         true if enabled, otherwise false
64     //!
IsEnabled()65     bool IsEnabled() const { return m_enabled; }
66 
67 protected:
68 
69     //! \brief  Allocate feature related resources
70     //! \return MOS_STATUS
71     //!         MOS_STATUS_SUCCESS if success, else fail reason
72     //!
AllocateResources()73     virtual MOS_STATUS AllocateResources() { return MOS_STATUS_SUCCESS; };
74 
75     //! \brief  set feature refer to const settings.
76     //! \return MOS_STATUS
77     //!         MOS_STATUS_SUCCESS if success, else fail reason
78     //!
SetConstSettings()79     virtual MOS_STATUS SetConstSettings(){ return MOS_STATUS_SUCCESS; };
80 
81     bool               m_enabled = false;
82 
83     MediaFeatureManager *m_featureManager = nullptr;
84     void                *m_constSettings = nullptr;
85     MediaUserSettingSharedPtr m_userSettingPtr = nullptr;  //!< usersettingInstance
86 MEDIA_CLASS_DEFINE_END(MediaFeature)
87 };
88 
89 #endif  // !__ENCODE_FEATURE_H__
90