| 1 |
/* |
| 2 |
* Copyright (c) 2009-2020, 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_libva_caps_cp_interface.cpp |
| 24 |
//! \brief The class implementation of MediaLibvaCapsCpInterface |
| 25 |
//! |
| 26 |
|
| 27 |
#include "media_libva_caps_cp_interface.h" |
| 28 |
#include "cp_interfaces.h" |
| 29 |
#include "media_libva_util.h" |
| 30 |
#include <typeinfo> |
| 31 |
|
| 32 |
static void CapsStubMessage() |
| 33 |
{ |
| 34 |
MOS_NORMALMESSAGE( |
| 35 |
MOS_COMPONENT_CP, |
| 36 |
MOS_CP_SUBCOMP_CAPS, |
| 37 |
"This function is stubbed as CP is not enabled."); |
| 38 |
} |
| 39 |
|
| 40 |
MediaLibvaCapsCpInterface::MediaLibvaCapsCpInterface(DDI_MEDIA_CONTEXT *mediaCtx, MediaLibvaCaps *mediaCaps) |
| 41 |
{ |
| 42 |
m_mediaCtx = mediaCtx; |
| 43 |
m_mediaCaps = mediaCaps; |
| 44 |
} |
| 45 |
|
| 46 |
MediaLibvaCapsCpInterface* Create_MediaLibvaCapsCpInterface(DDI_MEDIA_CONTEXT *mediaCtx, MediaLibvaCaps *mediaCaps) |
| 47 |
{ |
| 48 |
if (nullptr == mediaCtx || nullptr == mediaCaps) |
| 49 |
{ |
| 50 |
MOS_NORMALMESSAGE(MOS_COMPONENT_CP, MOS_CP_SUBCOMP_CAPS, "NULL pointer parameters"); |
| 51 |
return nullptr; |
| 52 |
} |
| 53 |
|
| 54 |
MediaLibvaCapsCpInterface* pInterface = nullptr; |
| 55 |
CpInterfaces *cp_interface = CpInterfacesFactory::Create(CP_INTERFACE); |
| 56 |
if (cp_interface) |
| 57 |
{ |
| 58 |
pInterface = cp_interface->Create_MediaLibvaCapsCpInterface(mediaCtx, mediaCaps); |
| 59 |
MOS_Delete(cp_interface); |
| 60 |
} |
| 61 |
|
| 62 |
if (nullptr == pInterface) |
| 63 |
{ |
| 64 |
CapsStubMessage(); |
| 65 |
} |
| 66 |
|
| 67 |
return nullptr == pInterface ? MOS_New(MediaLibvaCapsCpInterface, mediaCtx, mediaCaps) : pInterface; |
| 68 |
} |
| 69 |
|
| 70 |
void Delete_MediaLibvaCapsCpInterface(MediaLibvaCapsCpInterface* pInterface) |
| 71 |
{ |
| 72 |
CpInterfaces *cp_interface = CpInterfacesFactory::Create(CP_INTERFACE); |
| 73 |
if (pInterface != nullptr && cp_interface != nullptr) |
| 74 |
{ |
| 75 |
cp_interface->Delete_MediaLibvaCapsCpInterface(pInterface); |
| 76 |
pInterface = nullptr; |
| 77 |
} |
| 78 |
MOS_Delete(pInterface); |
| 79 |
MOS_Delete(cp_interface); |
| 80 |
} |
| 81 |
|
| 82 |
bool MediaLibvaCapsCpInterface::IsDecEncryptionSupported(DDI_MEDIA_CONTEXT* mediaCtx) |
| 83 |
{ |
| 84 |
CapsStubMessage(); |
| 85 |
return false; |
| 86 |
} |
| 87 |
|
| 88 |
int32_t MediaLibvaCapsCpInterface::GetEncryptionTypes( |
| 89 |
VAProfile profile, |
| 90 |
uint32_t *encryptionType, |
| 91 |
uint32_t arraySize) |
| 92 |
{ |
| 93 |
CapsStubMessage(); |
| 94 |
return -1; |
| 95 |
} |
| 96 |
|
| 97 |
VAStatus MediaLibvaCapsCpInterface::LoadCpProfileEntrypoints() |
| 98 |
{ |
| 99 |
CapsStubMessage(); |
| 100 |
return VA_STATUS_SUCCESS; |
| 101 |
} |
| 102 |
|
| 103 |
bool MediaLibvaCapsCpInterface::IsCpConfigId(VAConfigID configId) |
| 104 |
{ |
| 105 |
CapsStubMessage(); |
| 106 |
return false; |
| 107 |
} |
| 108 |
|
| 109 |
VAStatus MediaLibvaCapsCpInterface::CreateCpConfig( |
| 110 |
int32_t profileTableIdx, |
| 111 |
VAEntrypoint entrypoint, |
| 112 |
VAConfigAttrib *attribList, |
| 113 |
int32_t numAttribs, |
| 114 |
VAConfigID *configId) |
| 115 |
{ |
| 116 |
CapsStubMessage(); |
| 117 |
return VA_STATUS_SUCCESS; |
| 118 |
} |
| 119 |
|
| 120 |
MediaLibvaCaps::ProfileEntrypoint* MediaLibvaCapsCpInterface::GetProfileEntrypoint(int32_t profileTableIdx) |
| 121 |
{ |
| 122 |
DDI_CHK_NULL(m_mediaCaps, "nullptr m_mediaCaps", nullptr); |
| 123 |
|
| 124 |
if (profileTableIdx >= MediaLibvaCaps::m_maxProfileEntries) |
| 125 |
{ |
| 126 |
DDI_ASSERTMESSAGE("profileTableIdx %d out of bounds", profileTableIdx); |
| 127 |
return nullptr; |
| 128 |
} |
| 129 |
|
| 130 |
return &(m_mediaCaps->m_profileEntryTbl[profileTableIdx]); |
| 131 |
} |
| 132 |
|
| 133 |
uint16_t MediaLibvaCapsCpInterface::GetProfileEntryCount() |
| 134 |
{ |
| 135 |
DDI_CHK_NULL(m_mediaCaps, "nullptr m_mediaCaps", 0); |
| 136 |
|
| 137 |
return m_mediaCaps->m_profileEntryCount; |
| 138 |
} |
| 139 |
|
| 140 |
VAStatus MediaLibvaCapsCpInterface::GetProfileEntrypointFromConfigId( |
| 141 |
VAConfigID configId, |
| 142 |
VAProfile *profile, |
| 143 |
VAEntrypoint *entrypoint, |
| 144 |
int32_t *profileTableIdx) |
| 145 |
{ |
| 146 |
VAStatus status = VA_STATUS_SUCCESS; |
| 147 |
|
| 148 |
DDI_CHK_NULL(m_mediaCaps, "nullptr m_mediaCaps", VA_STATUS_ERROR_OPERATION_FAILED); |
| 149 |
|
| 150 |
status = m_mediaCaps->GetProfileEntrypointFromConfigId(configId, profile, entrypoint, profileTableIdx); |
| 151 |
|
| 152 |
return status; |
| 153 |
} |
| 154 |
|
| 155 |
VAStatus MediaLibvaCapsCpInterface::AddProfileEntry( |
| 156 |
VAProfile profile, |
| 157 |
VAEntrypoint entrypoint, |
| 158 |
AttribMap *attributeList, |
| 159 |
int32_t configIdxStart, |
| 160 |
int32_t configNum) |
| 161 |
{ |
| 162 |
VAStatus status = VA_STATUS_SUCCESS; |
| 163 |
|
| 164 |
DDI_CHK_NULL(m_mediaCaps, "nullptr m_mediaCaps", VA_STATUS_ERROR_OPERATION_FAILED); |
| 165 |
|
| 166 |
status = m_mediaCaps->AddProfileEntry(profile, entrypoint, attributeList, configIdxStart, configNum); |
| 167 |
|
| 168 |
return status; |
| 169 |
} |