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 #include "mos_os.h"
29 #include "media_feature_manager.h"
30 #include "media_utils.h"
31 
32 class MediaFeatureManager;
33 
34 class MediaFeature
35 {
36 public:
MediaFeature(void * constSettings)37     MediaFeature(void *constSettings) : m_constSettings(constSettings){};
MediaFeature()38     MediaFeature() {};
~MediaFeature()39     virtual ~MediaFeature() { }
40 
41     //!
42     //! \brief  Init parameter
43     //! \param  [in] settings
44     //!         Pointer to settings
45     //! \return MOS_STATUS
46     //!         MOS_STATUS_SUCCESS if success, else fail reason
47     //!
48     virtual MOS_STATUS Init(void *settings);
49 
50     //!
51     //! \brief  Update parameter
52     //! \param  [in] params
53     //!         Pointer to parameters
54     //! \return MOS_STATUS
55     //!         MOS_STATUS_SUCCESS if success, else fail reason
56     //!
57     virtual MOS_STATUS Update(void *params);
58 
59 protected:
60 
61     //! \brief  Allocate feature related resources
62     //! \return MOS_STATUS
63     //!         MOS_STATUS_SUCCESS if success, else fail reason
64     //!
AllocateResources()65     virtual MOS_STATUS AllocateResources() { return MOS_STATUS_SUCCESS; };
66 
67     //! \brief  set feature refer to const settings.
68     //! \return MOS_STATUS
69     //!         MOS_STATUS_SUCCESS if success, else fail reason
70     //!
SetConstSettings()71     virtual MOS_STATUS SetConstSettings(){ return MOS_STATUS_SUCCESS; };
72 
73     //! \brief  Check whether the feather is enabled
74     //! \return bool
75     //!         true if enabled, otherwise false
76     //!
IsEnabled()77     bool IsEnabled() const { return m_enabled; }
78 
79     bool               m_enabled = false;
80 
81     MediaFeatureManager *m_featureManager = nullptr;
82     void                *m_constSettings = nullptr;
83 };
84 
85 #endif  // !__ENCODE_FEATURE_H__
86