mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
init
This commit is contained in:
262
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/AMFFactory.cpp
vendored
Normal file
262
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/AMFFactory.cpp
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "AMFFactory.h"
|
||||
#include "Thread.h"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wexit-time-destructors"
|
||||
#pragma clang diagnostic ignored "-Wglobal-constructors"
|
||||
#endif
|
||||
|
||||
AMFFactoryHelper g_AMFFactory;
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef AMF_CORE_STATIC
|
||||
extern "C"
|
||||
{
|
||||
extern AMF_CORE_LINK AMF_RESULT AMF_CDECL_CALL AMFInit(amf_uint64 version, amf::AMFFactory **ppFactory);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFFactoryHelper::AMFFactoryHelper() :
|
||||
m_hDLLHandle(NULL),
|
||||
m_pFactory(NULL),
|
||||
m_pDebug(NULL),
|
||||
m_pTrace(NULL),
|
||||
m_AMFRuntimeVersion(0),
|
||||
m_iRefCount(0)
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFFactoryHelper::~AMFFactoryHelper()
|
||||
{
|
||||
Terminate();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMFFactoryHelper::Init(const wchar_t* dllName)
|
||||
{
|
||||
dllName;
|
||||
|
||||
#ifndef AMF_CORE_STATIC
|
||||
if (m_hDLLHandle != NULL)
|
||||
{
|
||||
amf_atomic_inc(&m_iRefCount);
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
const wchar_t* dllName_ = dllName == NULL ? AMF_DLL_NAME : dllName;
|
||||
#if defined (_WIN32) || defined (__APPLE__)
|
||||
m_hDLLHandle = amf_load_library(dllName_);
|
||||
#else
|
||||
m_hDLLHandle = amf_load_library1(dllName_, false); //load with local flags
|
||||
#endif
|
||||
if(m_hDLLHandle == NULL)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
|
||||
AMFInit_Fn initFun = (AMFInit_Fn)::amf_get_proc_address(m_hDLLHandle, AMF_INIT_FUNCTION_NAME);
|
||||
if(initFun == NULL)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
AMF_RESULT res = initFun(AMF_FULL_VERSION, &m_pFactory);
|
||||
if(res != AMF_OK)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
AMFQueryVersion_Fn versionFun = (AMFQueryVersion_Fn)::amf_get_proc_address(m_hDLLHandle, AMF_QUERY_VERSION_FUNCTION_NAME);
|
||||
if(versionFun == NULL)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
res = versionFun(&m_AMFRuntimeVersion);
|
||||
if(res != AMF_OK)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
AMF_RESULT res = AMFInit(AMF_FULL_VERSION, &m_pFactory);
|
||||
if (res != AMF_OK)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
m_AMFRuntimeVersion = AMF_FULL_VERSION;
|
||||
#endif
|
||||
m_pFactory->GetTrace(&m_pTrace);
|
||||
m_pFactory->GetDebug(&m_pDebug);
|
||||
|
||||
amf_atomic_inc(&m_iRefCount);
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMFFactoryHelper::Terminate()
|
||||
{
|
||||
if(m_hDLLHandle != NULL)
|
||||
{
|
||||
amf_atomic_dec(&m_iRefCount);
|
||||
if(m_iRefCount == 0)
|
||||
{
|
||||
amf_free_library(m_hDLLHandle);
|
||||
m_hDLLHandle = NULL;
|
||||
m_pFactory= NULL;
|
||||
m_pDebug = NULL;
|
||||
m_pTrace = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
amf::AMFFactory* AMFFactoryHelper::GetFactory()
|
||||
{
|
||||
return m_pFactory;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
amf::AMFDebug* AMFFactoryHelper::GetDebug()
|
||||
{
|
||||
return m_pDebug;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
amf::AMFTrace* AMFFactoryHelper::GetTrace()
|
||||
{
|
||||
return m_pTrace;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
amf_uint64 AMFFactoryHelper::AMFQueryVersion()
|
||||
{
|
||||
return m_AMFRuntimeVersion;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMFFactoryHelper::LoadExternalComponent(amf::AMFContext* pContext, const wchar_t* dll, const char* function, void* reserved, amf::AMFComponent** ppComponent)
|
||||
{
|
||||
// check passed in parameters
|
||||
if (!pContext || !dll || !function)
|
||||
{
|
||||
return AMF_INVALID_ARG;
|
||||
}
|
||||
|
||||
// check if DLL has already been loaded
|
||||
amf_handle hDll = NULL;
|
||||
for (std::vector<ComponentHolder>::iterator it = m_extComponents.begin(); it != m_extComponents.end(); ++it)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
if (wcsicmp(it->m_DLL.c_str(), dll) == 0) // ignore case on Windows
|
||||
#elif defined(__linux) // Linux
|
||||
if (wcscmp(it->m_DLL.c_str(), dll) == 0) // case sensitive on Linux
|
||||
#endif
|
||||
{
|
||||
if (it->m_hDLLHandle != NULL)
|
||||
{
|
||||
hDll = it->m_hDLLHandle;
|
||||
amf_atomic_inc(&it->m_iRefCount);
|
||||
break;
|
||||
}
|
||||
|
||||
return AMF_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
// DLL wasn't loaded before so load it now and
|
||||
// add it to the internal list
|
||||
if (hDll == NULL)
|
||||
{
|
||||
ComponentHolder component;
|
||||
component.m_iRefCount = 0;
|
||||
component.m_hDLLHandle = NULL;
|
||||
component.m_DLL = dll;
|
||||
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
hDll = amf_load_library(dll);
|
||||
#else
|
||||
hDll = amf_load_library1(dll, false); //global flag set to true
|
||||
#endif
|
||||
if (hDll == NULL)
|
||||
return AMF_FAIL;
|
||||
|
||||
// since LoadLibrary succeeded add the information
|
||||
// into the internal list so we can properly free
|
||||
// the DLL later on, even if we fail to get the
|
||||
// required information from it...
|
||||
component.m_hDLLHandle = hDll;
|
||||
amf_atomic_inc(&component.m_iRefCount);
|
||||
m_extComponents.push_back(component);
|
||||
}
|
||||
|
||||
// look for function we want in the dll we just loaded
|
||||
typedef AMF_RESULT(AMF_CDECL_CALL *AMFCreateComponentFunc)(amf::AMFContext*, void* reserved, amf::AMFComponent**);
|
||||
AMFCreateComponentFunc initFn = (AMFCreateComponentFunc)::amf_get_proc_address(hDll, function);
|
||||
if (initFn == NULL)
|
||||
return AMF_FAIL;
|
||||
|
||||
return initFn(pContext, reserved, ppComponent);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMFFactoryHelper::UnLoadExternalComponent(const wchar_t* dll)
|
||||
{
|
||||
if (!dll)
|
||||
{
|
||||
return AMF_INVALID_ARG;
|
||||
}
|
||||
for (std::vector<ComponentHolder>::iterator it = m_extComponents.begin(); it != m_extComponents.end(); ++it)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
if (wcsicmp(it->m_DLL.c_str(), dll) == 0) // ignore case on Windows
|
||||
#elif defined(__linux) // Linux
|
||||
if (wcscmp(it->m_DLL.c_str(), dll) == 0) // case sensitive on Linux
|
||||
#endif
|
||||
{
|
||||
if (it->m_hDLLHandle == NULL)
|
||||
{
|
||||
return AMF_UNEXPECTED;
|
||||
}
|
||||
amf_atomic_dec(&it->m_iRefCount);
|
||||
if (it->m_iRefCount == 0)
|
||||
{
|
||||
amf_free_library(it->m_hDLLHandle);
|
||||
m_extComponents.erase(it);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
89
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/AMFFactory.h
vendored
Normal file
89
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/AMFFactory.h
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_AMFFactory_h
|
||||
#define AMF_AMFFactory_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../include/core/Factory.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
class AMFFactoryHelper
|
||||
{
|
||||
public:
|
||||
AMFFactoryHelper();
|
||||
virtual ~AMFFactoryHelper();
|
||||
|
||||
AMF_RESULT Init(const wchar_t* dllName = NULL);
|
||||
AMF_RESULT Terminate();
|
||||
|
||||
AMF_RESULT LoadExternalComponent(amf::AMFContext* pContext, const wchar_t* dll, const char* function, void* reserved, amf::AMFComponent** ppComponent);
|
||||
AMF_RESULT UnLoadExternalComponent(const wchar_t* dll);
|
||||
|
||||
amf::AMFFactory* GetFactory();
|
||||
amf::AMFDebug* GetDebug();
|
||||
amf::AMFTrace* GetTrace();
|
||||
|
||||
amf_uint64 AMFQueryVersion();
|
||||
|
||||
amf_handle GetAMFDLLHandle() { return m_hDLLHandle; }
|
||||
protected:
|
||||
struct ComponentHolder
|
||||
{
|
||||
amf_handle m_hDLLHandle;
|
||||
amf_long m_iRefCount;
|
||||
std::wstring m_DLL;
|
||||
|
||||
ComponentHolder()
|
||||
{
|
||||
m_hDLLHandle = NULL;
|
||||
m_iRefCount = 0;
|
||||
}
|
||||
};
|
||||
|
||||
amf_handle m_hDLLHandle;
|
||||
amf::AMFFactory* m_pFactory;
|
||||
amf::AMFDebug* m_pDebug;
|
||||
amf::AMFTrace* m_pTrace;
|
||||
amf_uint64 m_AMFRuntimeVersion;
|
||||
|
||||
amf_long m_iRefCount;
|
||||
|
||||
std::vector<ComponentHolder> m_extComponents;
|
||||
};
|
||||
|
||||
extern ::AMFFactoryHelper g_AMFFactory;
|
||||
#endif // AMF_AMFFactory_h
|
||||
1279
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/AMFMath.h
vendored
Normal file
1279
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/AMFMath.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1298
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/AMFSTL.cpp
vendored
Normal file
1298
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/AMFSTL.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
362
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/AMFSTL.h
vendored
Normal file
362
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/AMFSTL.h
vendored
Normal file
@@ -0,0 +1,362 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_AMFSTL_h
|
||||
#define AMF_AMFSTL_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(__GNUC__)
|
||||
//disable gcc warinings on STL code
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
#include <memory> //default stl allocator
|
||||
#else
|
||||
|
||||
#include <xmemory> //default stl allocator
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <deque>
|
||||
#include <queue>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include "../include/core/Interface.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
// allocator
|
||||
void* AMF_STD_CALL amf_alloc(amf_size count);
|
||||
void AMF_STD_CALL amf_free(void* ptr);
|
||||
void* AMF_STD_CALL amf_aligned_alloc(size_t count, size_t alignment);
|
||||
void AMF_STD_CALL amf_aligned_free(void* ptr);
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace amf
|
||||
{
|
||||
#pragma warning(push)
|
||||
|
||||
#pragma warning(disable: 4996) // was declared deprecated
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// STL allocator redefined - will allocate all memory in "C" runtime of Common.DLL
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
template<class _Ty>
|
||||
class amf_allocator : public std::allocator<_Ty>
|
||||
{
|
||||
public:
|
||||
amf_allocator() : std::allocator<_Ty>()
|
||||
{}
|
||||
amf_allocator(const amf_allocator<_Ty>& rhs) : std::allocator<_Ty>(rhs)
|
||||
{}
|
||||
template<class _Other> amf_allocator(const amf_allocator<_Other>& rhs) : std::allocator<_Ty>(rhs)
|
||||
{}
|
||||
template<class _Other> struct rebind // convert an allocator<_Ty> to an allocator <_Other>
|
||||
{
|
||||
typedef amf_allocator<_Other> other;
|
||||
};
|
||||
void deallocate(_Ty* const _Ptr, const size_t _Count)
|
||||
{
|
||||
_Count;
|
||||
amf_free((void*)_Ptr);
|
||||
}
|
||||
_Ty* allocate(const size_t _Count, const void* = static_cast<const void*>(0))
|
||||
{ // allocate array of _Count el ements
|
||||
return static_cast<_Ty*>(amf_alloc(_Count * sizeof(_Ty)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// STL container templates with changed memory allocation
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
template<class _Ty>
|
||||
class amf_vector
|
||||
: public std::vector<_Ty, amf_allocator<_Ty> >
|
||||
{
|
||||
public:
|
||||
typedef std::vector<_Ty, amf_allocator<_Ty> > _base;
|
||||
|
||||
amf_vector() : _base() {}
|
||||
explicit amf_vector(size_t _Count) : _base(_Count) {} //MM GCC has strange compile error. to get around replaced size_type with size_t
|
||||
amf_vector(size_t _Count, const _Ty& _Val) : _base(_Count,_Val) {}
|
||||
};
|
||||
|
||||
template<class _Ty>
|
||||
class amf_list
|
||||
: public std::list<_Ty, amf_allocator<_Ty> >
|
||||
{};
|
||||
|
||||
template<class _Ty>
|
||||
class amf_deque
|
||||
: public std::deque<_Ty, amf_allocator<_Ty> >
|
||||
{};
|
||||
|
||||
template<class _Ty>
|
||||
class amf_queue
|
||||
: public std::queue<_Ty, amf_deque<_Ty> >
|
||||
{};
|
||||
|
||||
template<class _Kty, class _Ty, class _Pr = std::less<_Kty> >
|
||||
class amf_map
|
||||
: public std::map<_Kty, _Ty, _Pr, amf_allocator<std::pair<const _Kty, _Ty>> >
|
||||
{};
|
||||
|
||||
template<class _Kty, class _Pr = std::less<_Kty> >
|
||||
class amf_set
|
||||
: public std::set<_Kty, _Pr, amf_allocator<_Kty> >
|
||||
{};
|
||||
|
||||
template<class _Ty>
|
||||
class amf_limited_deque
|
||||
: public amf_deque<_Ty> // circular queue of pointers to blocks
|
||||
{
|
||||
public:
|
||||
typedef amf_deque<_Ty> _base;
|
||||
amf_limited_deque(size_t size_limit) : _base(), _size_limit(size_limit)
|
||||
{ // construct empty deque
|
||||
}
|
||||
size_t size_limit()
|
||||
{
|
||||
return _size_limit;
|
||||
}
|
||||
|
||||
void set_size_limit(size_t size_limit)
|
||||
{
|
||||
_size_limit = size_limit;
|
||||
while(_base::size() > _size_limit)
|
||||
{
|
||||
_base::pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
_Ty push_front(const _Ty& _Val)
|
||||
{ // insert element at beginning
|
||||
_Ty ret;
|
||||
if(_size_limit > 0)
|
||||
{
|
||||
_base::push_front(_Val);
|
||||
if(_base::size() > _size_limit)
|
||||
{
|
||||
ret = _base::back();
|
||||
_base::pop_back();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
void push_front_ex(const _Ty& _Val)
|
||||
{ // insert element at beginning
|
||||
_base::push_front(_Val);
|
||||
}
|
||||
|
||||
_Ty push_back(const _Ty& _Val)
|
||||
{ // insert element at beginning
|
||||
_Ty ret;
|
||||
if(_size_limit > 0)
|
||||
{
|
||||
_base::push_back(_Val);
|
||||
if(_base::size() > _size_limit)
|
||||
{
|
||||
ret = _base::front();
|
||||
_base::pop_front();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected:
|
||||
size_t _size_limit;
|
||||
};
|
||||
#pragma warning(pop)
|
||||
//---------------------------------------------------------------
|
||||
#if defined(__GNUC__)
|
||||
//disable gcc warinings on STL code
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
#endif
|
||||
|
||||
template<class _Interf>
|
||||
class AMFInterfacePtr_TAdapted : public AMFInterfacePtr_T<_Interf>
|
||||
{
|
||||
public:
|
||||
AMFInterfacePtr_TAdapted* operator&()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
AMFInterfacePtr_TAdapted()
|
||||
: AMFInterfacePtr_T<_Interf>()
|
||||
{}
|
||||
|
||||
AMFInterfacePtr_TAdapted(_Interf* pOther)
|
||||
: AMFInterfacePtr_T<_Interf>(pOther)
|
||||
{}
|
||||
|
||||
AMFInterfacePtr_TAdapted(const AMFInterfacePtr_T<_Interf>& other)
|
||||
: AMFInterfacePtr_T<_Interf>(other)
|
||||
{}
|
||||
};
|
||||
|
||||
template<class _Interf>
|
||||
class amf_vector<AMFInterfacePtr_T<_Interf> >
|
||||
: public std::vector<AMFInterfacePtr_TAdapted<_Interf>, amf_allocator<AMFInterfacePtr_TAdapted<_Interf> > >
|
||||
{
|
||||
public:
|
||||
typedef AMFInterfacePtr_T<_Interf>& reference;
|
||||
typedef std::vector<AMFInterfacePtr_TAdapted<_Interf>, amf_allocator<AMFInterfacePtr_TAdapted<_Interf> > > baseclass;
|
||||
reference operator[](size_t n)
|
||||
{
|
||||
return baseclass::operator[](n);
|
||||
}
|
||||
};
|
||||
|
||||
template<class _Interf>
|
||||
class amf_deque<AMFInterfacePtr_T<_Interf> >
|
||||
: public std::deque<AMFInterfacePtr_TAdapted<_Interf>, amf_allocator<AMFInterfacePtr_TAdapted<_Interf> > >
|
||||
{};
|
||||
|
||||
template<class _Interf>
|
||||
class amf_list<AMFInterfacePtr_T<_Interf> >
|
||||
: public std::list<AMFInterfacePtr_TAdapted<_Interf>, amf_allocator<AMFInterfacePtr_TAdapted<_Interf> > >
|
||||
{};
|
||||
#if defined(__GNUC__)
|
||||
// restore gcc warnings
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// string classes
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
typedef std::basic_string<char, std::char_traits<char>, amf::amf_allocator<char> > amf_string;
|
||||
typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, amf::amf_allocator<wchar_t> > amf_wstring;
|
||||
|
||||
template <class TAmfString>
|
||||
std::size_t amf_string_hash(TAmfString const& s) noexcept
|
||||
{
|
||||
#if defined(_WIN64) || defined(__x86_64__)
|
||||
constexpr size_t fnvOffsetBasis = 14695981039346656037ULL;
|
||||
constexpr size_t fnvPrime = 1099511628211ULL;
|
||||
#else // defined(_WIN64) || defined(__x86_64__)
|
||||
constexpr size_t fnvOffsetBasis = 2166136261U;
|
||||
constexpr size_t fnvPrime = 16777619U;
|
||||
#endif // defined(_WIN64) || defined(__x86_64__)
|
||||
|
||||
const unsigned char* const pStr = reinterpret_cast<const unsigned char*>(s.c_str());
|
||||
const size_t count = s.size() * sizeof(typename TAmfString::value_type);
|
||||
size_t value = fnvOffsetBasis;
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
value ^= static_cast<size_t>(pStr[i]);
|
||||
value *= fnvPrime;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
template<>
|
||||
struct std::hash<amf_wstring>
|
||||
{
|
||||
std::size_t operator()(amf_wstring const& s) const noexcept
|
||||
{
|
||||
return amf_string_hash<amf_wstring>(s);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct std::hash<amf_string>
|
||||
{
|
||||
std::size_t operator()(amf_string const& s) const noexcept
|
||||
{
|
||||
return amf_string_hash<amf_string>(s);
|
||||
}
|
||||
};
|
||||
|
||||
namespace amf
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// string conversion
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
amf_string AMF_STD_CALL amf_from_unicode_to_utf8(const amf_wstring& str);
|
||||
amf_wstring AMF_STD_CALL amf_from_utf8_to_unicode(const amf_string& str);
|
||||
amf_string AMF_STD_CALL amf_from_unicode_to_multibyte(const amf_wstring& str);
|
||||
amf_wstring AMF_STD_CALL amf_from_multibyte_to_unicode(const amf_string& str);
|
||||
amf_string AMF_STD_CALL amf_from_string_to_hex_string(const amf_string& str);
|
||||
amf_string AMF_STD_CALL amf_from_hex_string_to_string(const amf_string& str);
|
||||
|
||||
amf_string AMF_STD_CALL amf_string_to_lower(const amf_string& str);
|
||||
amf_wstring AMF_STD_CALL amf_string_to_lower(const amf_wstring& str);
|
||||
amf_string AMF_STD_CALL amf_string_to_upper(const amf_string& str);
|
||||
amf_wstring AMF_STD_CALL amf_string_to_upper(const amf_wstring& str);
|
||||
|
||||
amf_string AMF_STD_CALL amf_from_unicode_to_url_utf8(const amf_wstring& data, bool bQuery = false); // converts to UTF8 and replace fobidden symbols
|
||||
amf_wstring AMF_STD_CALL amf_from_url_utf8_to_unicode(const amf_string& data);
|
||||
|
||||
amf_wstring AMF_STD_CALL amf_convert_path_to_os_accepted_path(const amf_wstring& path);
|
||||
amf_wstring AMF_STD_CALL amf_convert_path_to_url_accepted_path(const amf_wstring& path);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// string helpers
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
amf_wstring AMF_STD_CALL amf_string_format(const wchar_t* format, ...);
|
||||
amf_string AMF_STD_CALL amf_string_format(const char* format, ...);
|
||||
|
||||
amf_wstring AMF_STD_CALL amf_string_formatVA(const wchar_t* format, va_list args);
|
||||
amf_string AMF_STD_CALL amf_string_formatVA(const char* format, va_list args);
|
||||
|
||||
amf_int AMF_STD_CALL amf_string_ci_compare(const amf_wstring& left, const amf_wstring& right);
|
||||
amf_int AMF_STD_CALL amf_string_ci_compare(const amf_string& left, const amf_string& right);
|
||||
|
||||
amf_size AMF_STD_CALL amf_string_ci_find(const amf_wstring& left, const amf_wstring& right, amf_size off = 0);
|
||||
amf_size AMF_STD_CALL amf_string_ci_rfind(const amf_wstring& left, const amf_wstring& right, amf_size off = amf_wstring::npos);
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
} // namespace amf
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
// restore gcc warnings
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // AMF_AMFSTL_h
|
||||
|
||||
136
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/ByteArray.h
vendored
Normal file
136
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/ByteArray.h
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_ByteArray_h
|
||||
#define AMF_ByteArray_h
|
||||
|
||||
|
||||
#pragma once
|
||||
#include "../include/core/Platform.h"
|
||||
#define INIT_ARRAY_SIZE 1024
|
||||
#define ARRAY_MAX_SIZE (1LL << 60LL) // extremely large maximum size
|
||||
//------------------------------------------------------------------------
|
||||
class AMFByteArray
|
||||
{
|
||||
protected:
|
||||
amf_uint8 *m_pData;
|
||||
amf_size m_iSize;
|
||||
amf_size m_iMaxSize;
|
||||
public:
|
||||
AMFByteArray() : m_pData(0), m_iSize(0), m_iMaxSize(0)
|
||||
{
|
||||
}
|
||||
AMFByteArray(const AMFByteArray &other) : m_pData(0), m_iSize(0), m_iMaxSize(0)
|
||||
{
|
||||
*this = other;
|
||||
}
|
||||
AMFByteArray(amf_size num) : m_pData(0), m_iSize(0), m_iMaxSize(0)
|
||||
{
|
||||
SetSize(num);
|
||||
}
|
||||
virtual ~AMFByteArray()
|
||||
{
|
||||
if (m_pData != 0)
|
||||
{
|
||||
delete[] m_pData;
|
||||
}
|
||||
}
|
||||
void SetSize(amf_size num)
|
||||
{
|
||||
if (num == m_iSize)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (num < m_iSize)
|
||||
{
|
||||
memset(m_pData + num, 0, m_iMaxSize - num);
|
||||
}
|
||||
else if (num > m_iMaxSize)
|
||||
{
|
||||
// This is done to prevent the following error from surfacing
|
||||
// for the pNewData allocation on some compilers:
|
||||
// -Werror=alloc-size-larger-than=
|
||||
amf_size newSize = (num / INIT_ARRAY_SIZE) * INIT_ARRAY_SIZE + INIT_ARRAY_SIZE;
|
||||
if (newSize > ARRAY_MAX_SIZE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_iMaxSize = newSize;
|
||||
|
||||
amf_uint8 *pNewData = new amf_uint8[m_iMaxSize];
|
||||
memset(pNewData, 0, m_iMaxSize);
|
||||
if (m_pData != NULL)
|
||||
{
|
||||
memcpy(pNewData, m_pData, m_iSize);
|
||||
delete[] m_pData;
|
||||
}
|
||||
m_pData = pNewData;
|
||||
}
|
||||
m_iSize = num;
|
||||
}
|
||||
void Copy(const AMFByteArray &old)
|
||||
{
|
||||
if (m_iMaxSize < old.m_iSize)
|
||||
{
|
||||
m_iMaxSize = old.m_iMaxSize;
|
||||
if (m_pData != NULL)
|
||||
{
|
||||
delete[] m_pData;
|
||||
}
|
||||
m_pData = new amf_uint8[m_iMaxSize];
|
||||
memset(m_pData, 0, m_iMaxSize);
|
||||
}
|
||||
memcpy(m_pData, old.m_pData, old.m_iSize);
|
||||
m_iSize = old.m_iSize;
|
||||
}
|
||||
amf_uint8 operator[] (amf_size iPos) const
|
||||
{
|
||||
return m_pData[iPos];
|
||||
}
|
||||
amf_uint8& operator[] (amf_size iPos)
|
||||
{
|
||||
return m_pData[iPos];
|
||||
}
|
||||
AMFByteArray& operator=(const AMFByteArray &other)
|
||||
{
|
||||
SetSize(other.GetSize());
|
||||
if (GetSize() > 0)
|
||||
{
|
||||
memcpy(GetData(), other.GetData(), GetSize());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
amf_uint8 *GetData() const { return m_pData; }
|
||||
amf_size GetSize() const { return m_iSize; }
|
||||
};
|
||||
#endif // AMF_ByteArray_h
|
||||
275
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/CPUCaps.h
vendored
Normal file
275
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/CPUCaps.h
vendored
Normal file
@@ -0,0 +1,275 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <bitset>
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
class InstructionSet
|
||||
{
|
||||
// forward declarations
|
||||
class InstructionSet_Internal;
|
||||
|
||||
public:
|
||||
// getters
|
||||
static std::string Vendor(void) { return CPU_Rep.vendor_; }
|
||||
static std::string Brand(void) { return CPU_Rep.brand_; }
|
||||
|
||||
static bool SSE3(void) { return CPU_Rep.f_1_ECX_[0]; }
|
||||
static bool PCLMULQDQ(void) { return CPU_Rep.f_1_ECX_[1]; }
|
||||
static bool MONITOR(void) { return CPU_Rep.f_1_ECX_[3]; }
|
||||
static bool SSSE3(void) { return CPU_Rep.f_1_ECX_[9]; }
|
||||
static bool FMA(void) { return CPU_Rep.f_1_ECX_[12]; }
|
||||
static bool CMPXCHG16B(void) { return CPU_Rep.f_1_ECX_[13]; }
|
||||
static bool SSE41(void) { return CPU_Rep.f_1_ECX_[19]; }
|
||||
static bool SSE42(void) { return CPU_Rep.f_1_ECX_[20]; }
|
||||
static bool MOVBE(void) { return CPU_Rep.f_1_ECX_[22]; }
|
||||
static bool POPCNT(void) { return CPU_Rep.f_1_ECX_[23]; }
|
||||
static bool AES(void) { return CPU_Rep.f_1_ECX_[25]; }
|
||||
static bool XSAVE(void) { return CPU_Rep.f_1_ECX_[26]; }
|
||||
static bool OSXSAVE(void) { return CPU_Rep.f_1_ECX_[27]; }
|
||||
static bool AVX(void) { return CPU_Rep.f_1_ECX_[28]; }
|
||||
static bool F16C(void) { return CPU_Rep.f_1_ECX_[29]; }
|
||||
static bool RDRAND(void) { return CPU_Rep.f_1_ECX_[30]; }
|
||||
|
||||
static bool MSR(void) { return CPU_Rep.f_1_EDX_[5]; }
|
||||
static bool CX8(void) { return CPU_Rep.f_1_EDX_[8]; }
|
||||
static bool SEP(void) { return CPU_Rep.f_1_EDX_[11]; }
|
||||
static bool CMOV(void) { return CPU_Rep.f_1_EDX_[15]; }
|
||||
static bool CLFSH(void) { return CPU_Rep.f_1_EDX_[19]; }
|
||||
static bool MMX(void) { return CPU_Rep.f_1_EDX_[23]; }
|
||||
static bool FXSR(void) { return CPU_Rep.f_1_EDX_[24]; }
|
||||
static bool SSE(void) { return CPU_Rep.f_1_EDX_[25]; }
|
||||
static bool SSE2(void) { return CPU_Rep.f_1_EDX_[26]; }
|
||||
|
||||
static bool FSGSBASE(void) { return CPU_Rep.f_7_EBX_[0]; }
|
||||
static bool BMI1(void) { return CPU_Rep.f_7_EBX_[3]; }
|
||||
static bool HLE(void) { return CPU_Rep.isIntel_ && CPU_Rep.f_7_EBX_[4]; }
|
||||
static bool AVX2(void) { return CPU_Rep.f_7_EBX_[5]; }
|
||||
static bool BMI2(void) { return CPU_Rep.f_7_EBX_[8]; }
|
||||
static bool ERMS(void) { return CPU_Rep.f_7_EBX_[9]; }
|
||||
static bool INVPCID(void) { return CPU_Rep.f_7_EBX_[10]; }
|
||||
static bool RTM(void) { return CPU_Rep.isIntel_ && CPU_Rep.f_7_EBX_[11]; }
|
||||
static bool AVX512F(void) { return CPU_Rep.f_7_EBX_[16]; }
|
||||
static bool RDSEED(void) { return CPU_Rep.f_7_EBX_[18]; }
|
||||
static bool ADX(void) { return CPU_Rep.f_7_EBX_[19]; }
|
||||
static bool AVX512PF(void) { return CPU_Rep.f_7_EBX_[26]; }
|
||||
static bool AVX512ER(void) { return CPU_Rep.f_7_EBX_[27]; }
|
||||
static bool AVX512CD(void) { return CPU_Rep.f_7_EBX_[28]; }
|
||||
static bool SHA(void) { return CPU_Rep.f_7_EBX_[29]; }
|
||||
static bool AVX512BW(void) { return CPU_Rep.f_7_EBX_[30]; }
|
||||
static bool AVX512VL(void) { return CPU_Rep.f_7_EBX_[31]; }
|
||||
|
||||
static bool PREFETCHWT1(void) { return CPU_Rep.f_7_ECX_[0]; }
|
||||
|
||||
static bool LAHF(void) { return CPU_Rep.f_81_ECX_[0]; }
|
||||
static bool LZCNT(void) { return CPU_Rep.isIntel_ && CPU_Rep.f_81_ECX_[5]; }
|
||||
static bool ABM(void) { return CPU_Rep.isAMD_ && CPU_Rep.f_81_ECX_[5]; }
|
||||
static bool SSE4a(void) { return CPU_Rep.isAMD_ && CPU_Rep.f_81_ECX_[6]; }
|
||||
static bool XOP(void) { return CPU_Rep.isAMD_ && CPU_Rep.f_81_ECX_[11]; }
|
||||
static bool TBM(void) { return CPU_Rep.isAMD_ && CPU_Rep.f_81_ECX_[21]; }
|
||||
|
||||
static bool SYSCALL(void) { return CPU_Rep.isIntel_ && CPU_Rep.f_81_EDX_[11]; }
|
||||
static bool MMXEXT(void) { return CPU_Rep.isAMD_ && CPU_Rep.f_81_EDX_[22]; }
|
||||
static bool RDTSCP(void) { return CPU_Rep.isIntel_ && CPU_Rep.f_81_EDX_[27]; }
|
||||
static bool _3DNOWEXT(void) { return CPU_Rep.isAMD_ && CPU_Rep.f_81_EDX_[30]; }
|
||||
static bool _3DNOW(void) { return CPU_Rep.isAMD_ && CPU_Rep.f_81_EDX_[31]; }
|
||||
|
||||
private:
|
||||
static const InstructionSet_Internal CPU_Rep;
|
||||
|
||||
class InstructionSet_Internal
|
||||
{
|
||||
protected:
|
||||
void GetCpuID
|
||||
(
|
||||
int32_t registers[4], //out
|
||||
int32_t functionID,
|
||||
int32_t subfunctionID = 0
|
||||
)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if(!subfunctionID)
|
||||
{
|
||||
__cpuid((int *)registers, (int)functionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
__cpuidex((int *)registers, (int)functionID, subfunctionID);
|
||||
}
|
||||
#else
|
||||
|
||||
asm volatile
|
||||
(
|
||||
"cpuid":
|
||||
"=a" (registers[0]),
|
||||
"=b" (registers[1]),
|
||||
"=c" (registers[2]),
|
||||
"=d" (registers[3]):
|
||||
"a" (functionID),
|
||||
"c" (subfunctionID)
|
||||
);
|
||||
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
InstructionSet_Internal()
|
||||
: nIds_( 0 ),
|
||||
nExIds_( 0 ),
|
||||
isIntel_( false ),
|
||||
isAMD_( false ),
|
||||
f_1_ECX_( 0 ),
|
||||
f_1_EDX_( 0 ),
|
||||
f_7_EBX_( 0 ),
|
||||
f_7_ECX_( 0 ),
|
||||
f_81_ECX_( 0 ),
|
||||
f_81_EDX_( 0 )
|
||||
{
|
||||
//int cpuInfo[4] = {-1};
|
||||
std::array<int, 4> cpui;
|
||||
|
||||
// Calling __cpuid with 0x0 as the function_id argument
|
||||
// gets the number of the highest valid function ID.
|
||||
|
||||
//todo: verify
|
||||
//__cpuid(cpui.data(), 0);
|
||||
GetCpuID(cpui.data(), 0);
|
||||
|
||||
nIds_ = cpui[0];
|
||||
|
||||
for (int i = 0; i <= nIds_; ++i)
|
||||
{
|
||||
//todo: verify
|
||||
//__cpuidex(cpui.data(), i, 0);
|
||||
GetCpuID(cpui.data(), i, 0);
|
||||
|
||||
data_.push_back(cpui);
|
||||
}
|
||||
|
||||
// Capture vendor string
|
||||
char vendor[0x20];
|
||||
std::memset(vendor, 0, sizeof(vendor));
|
||||
*reinterpret_cast<int*>(vendor) = data_[0][1];
|
||||
*reinterpret_cast<int*>(vendor + 4) = data_[0][3];
|
||||
*reinterpret_cast<int*>(vendor + 8) = data_[0][2];
|
||||
vendor_ = vendor;
|
||||
if (vendor_ == "GenuineIntel")
|
||||
{
|
||||
isIntel_ = true;
|
||||
}
|
||||
else if (vendor_ == "AuthenticAMD")
|
||||
{
|
||||
isAMD_ = true;
|
||||
}
|
||||
|
||||
// load bitset with flags for function 0x00000001
|
||||
if (nIds_ >= 1)
|
||||
{
|
||||
f_1_ECX_ = data_[1][2];
|
||||
f_1_EDX_ = data_[1][3];
|
||||
}
|
||||
|
||||
// load bitset with flags for function 0x00000007
|
||||
if (nIds_ >= 7)
|
||||
{
|
||||
f_7_EBX_ = data_[7][1];
|
||||
f_7_ECX_ = data_[7][2];
|
||||
}
|
||||
|
||||
// Calling __cpuid with 0x80000000 as the function_id argument
|
||||
// gets the number of the highest valid extended ID.
|
||||
//todo: verify
|
||||
//__cpuid(cpui.data(), 0x80000000);
|
||||
GetCpuID(cpui.data(), 0x80000000);
|
||||
|
||||
nExIds_ = cpui[0];
|
||||
|
||||
char brand[0x40];
|
||||
memset(brand, 0, sizeof(brand));
|
||||
|
||||
for (int i = 0x80000000; i <= nExIds_; ++i)
|
||||
{
|
||||
//todo: verify
|
||||
//__cpuidex(cpui.data(), i, 0);
|
||||
GetCpuID(cpui.data(), i, 0);
|
||||
|
||||
extdata_.push_back(cpui);
|
||||
}
|
||||
|
||||
// load bitset with flags for function 0x80000001
|
||||
if (nExIds_ >= 0x80000001)
|
||||
{
|
||||
f_81_ECX_ = extdata_[1][2];
|
||||
f_81_EDX_ = extdata_[1][3];
|
||||
}
|
||||
|
||||
// Interpret CPU brand string if reported
|
||||
if (nExIds_ >= 0x80000004)
|
||||
{
|
||||
memcpy(brand, extdata_[2].data(), sizeof(cpui));
|
||||
memcpy(brand + 16, extdata_[3].data(), sizeof(cpui));
|
||||
memcpy(brand + 32, extdata_[4].data(), sizeof(cpui));
|
||||
brand_ = brand;
|
||||
}
|
||||
};
|
||||
|
||||
virtual ~InstructionSet_Internal()
|
||||
{
|
||||
int i = 0;
|
||||
++i;
|
||||
}
|
||||
|
||||
int nIds_;
|
||||
int nExIds_;
|
||||
std::string vendor_;
|
||||
std::string brand_;
|
||||
bool isIntel_;
|
||||
bool isAMD_;
|
||||
std::bitset<32> f_1_ECX_;
|
||||
std::bitset<32> f_1_EDX_;
|
||||
std::bitset<32> f_7_EBX_;
|
||||
std::bitset<32> f_7_ECX_;
|
||||
std::bitset<32> f_81_ECX_;
|
||||
std::bitset<32> f_81_EDX_;
|
||||
std::vector<std::array<int, 4>> data_;
|
||||
std::vector<std::array<int, 4>> extdata_;
|
||||
};
|
||||
};
|
||||
71
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/CurrentTimeImpl.cpp
vendored
Normal file
71
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/CurrentTimeImpl.cpp
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "CurrentTimeImpl.h"
|
||||
|
||||
namespace amf
|
||||
{
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFCurrentTimeImpl::AMFCurrentTimeImpl()
|
||||
: m_timeOfFirstCall(-1)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFCurrentTimeImpl::~AMFCurrentTimeImpl()
|
||||
{
|
||||
m_timeOfFirstCall = -1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
amf_pts AMF_STD_CALL AMFCurrentTimeImpl::Get()
|
||||
{
|
||||
amf::AMFLock lock(&m_sync);
|
||||
|
||||
// We want pts time to start at 0 and subsequent
|
||||
// times to be relative to that
|
||||
if (m_timeOfFirstCall < 0)
|
||||
{
|
||||
m_timeOfFirstCall = amf_high_precision_clock();
|
||||
return 0;
|
||||
}
|
||||
return (amf_high_precision_clock() - m_timeOfFirstCall); // In nanoseconds
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
void AMF_STD_CALL AMFCurrentTimeImpl::Reset()
|
||||
{
|
||||
m_timeOfFirstCall = -1;
|
||||
}
|
||||
}
|
||||
69
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/CurrentTimeImpl.h
vendored
Normal file
69
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/CurrentTimeImpl.h
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_CurrentTimeImpl_h
|
||||
#define AMF_CurrentTimeImpl_h
|
||||
|
||||
#include "../include/core/CurrentTime.h"
|
||||
#include "InterfaceImpl.h"
|
||||
#include "Thread.h"
|
||||
|
||||
namespace amf
|
||||
{
|
||||
|
||||
class AMFCurrentTimeImpl : public AMFInterfaceImpl<AMFCurrentTime>
|
||||
{
|
||||
public:
|
||||
AMFCurrentTimeImpl();
|
||||
~AMFCurrentTimeImpl();
|
||||
|
||||
AMF_BEGIN_INTERFACE_MAP
|
||||
AMF_INTERFACE_ENTRY(AMFCurrentTime)
|
||||
AMF_END_INTERFACE_MAP
|
||||
|
||||
virtual amf_pts AMF_STD_CALL Get();
|
||||
|
||||
virtual void AMF_STD_CALL Reset();
|
||||
|
||||
private:
|
||||
amf_pts m_timeOfFirstCall;
|
||||
mutable AMFCriticalSection m_sync;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFCurrentTime> AMFCurrentTimePtr;
|
||||
//----------------------------------------------------------------------------------------------}
|
||||
}
|
||||
#endif // AMF_CurrentTimeImpl_h
|
||||
109
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStream.h
vendored
Normal file
109
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStream.h
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
/**
|
||||
***************************************************************************************************
|
||||
* @file DataStream.h
|
||||
* @brief AMFDataStream declaration
|
||||
***************************************************************************************************
|
||||
*/
|
||||
#ifndef AMF_DataStream_h
|
||||
#define AMF_DataStream_h
|
||||
#pragma once
|
||||
|
||||
#include "../include/core/Interface.h"
|
||||
|
||||
namespace amf
|
||||
{
|
||||
// currently supports only
|
||||
// file://
|
||||
// memory://
|
||||
|
||||
// eventually can be extended with:
|
||||
// rtsp://
|
||||
// rtmp://
|
||||
// http://
|
||||
// etc
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
enum AMF_STREAM_OPEN
|
||||
{
|
||||
AMFSO_READ = 0,
|
||||
AMFSO_WRITE = 1,
|
||||
AMFSO_READ_WRITE = 2,
|
||||
AMFSO_APPEND = 3,
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
enum AMF_FILE_SHARE
|
||||
{
|
||||
AMFFS_EXCLUSIVE = 0,
|
||||
AMFFS_SHARE_READ = 1,
|
||||
AMFFS_SHARE_WRITE = 2,
|
||||
AMFFS_SHARE_READ_WRITE = 3,
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
enum AMF_SEEK_ORIGIN
|
||||
{
|
||||
AMF_SEEK_BEGIN = 0,
|
||||
AMF_SEEK_CURRENT = 1,
|
||||
AMF_SEEK_END = 2,
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFDataStream interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMF_NO_VTABLE AMFDataStream : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xdb08fe70, 0xb743, 0x4c26, 0xb2, 0x77, 0xa5, 0xc8, 0xe8, 0x14, 0xda, 0x4)
|
||||
|
||||
// interface
|
||||
virtual AMF_RESULT AMF_STD_CALL Open(const wchar_t* pFileUrl, AMF_STREAM_OPEN eOpenType, AMF_FILE_SHARE eShareType) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Close() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Read(void* pData, amf_size iSize, amf_size* pRead) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Write(const void* pData, amf_size iSize, amf_size* pWritten) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Seek(AMF_SEEK_ORIGIN eOrigin, amf_int64 iPosition, amf_int64* pNewPosition) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetPosition(amf_int64* pPosition) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetSize(amf_int64* pSize) = 0;
|
||||
virtual bool AMF_STD_CALL IsSeekable() = 0;
|
||||
|
||||
static AMF_RESULT AMF_STD_CALL OpenDataStream(const wchar_t* pFileUrl, AMF_STREAM_OPEN eOpenType, AMF_FILE_SHARE eShareType, AMFDataStream** str);
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFDataStream> AMFDataStreamPtr;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
} //namespace amf
|
||||
|
||||
#endif // AMF_DataStream_h
|
||||
86
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStreamFactory.cpp
vendored
Normal file
86
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStreamFactory.cpp
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "DataStream.h"
|
||||
#include "DataStreamMemory.h"
|
||||
#include "DataStreamFile.h"
|
||||
#include "TraceAdapter.h"
|
||||
#include <string>
|
||||
|
||||
using namespace amf;
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL amf::AMFDataStream::OpenDataStream(const wchar_t* pFileUrl, AMF_STREAM_OPEN eOpenType, AMF_FILE_SHARE eShareType, AMFDataStream** str)
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(pFileUrl != NULL, AMF_INVALID_ARG);
|
||||
|
||||
AMF_RESULT res = AMF_NOT_SUPPORTED;
|
||||
std::wstring url(pFileUrl);
|
||||
|
||||
std::wstring protocol;
|
||||
std::wstring path;
|
||||
std::wstring::size_type found_pos = url.find(L"://", 0);
|
||||
if(found_pos != std::wstring::npos)
|
||||
{
|
||||
protocol = url.substr(0, found_pos);
|
||||
path = url.substr(found_pos + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
protocol = L"file";
|
||||
path = url;
|
||||
}
|
||||
AMFDataStreamPtr ptr = NULL;
|
||||
if(protocol == L"file")
|
||||
{
|
||||
ptr = new AMFDataStreamFileImpl;
|
||||
res = AMF_OK;
|
||||
}
|
||||
if(protocol == L"memory")
|
||||
{
|
||||
ptr = new AMFDataStreamMemoryImpl();
|
||||
res = AMF_OK;
|
||||
}
|
||||
if( res == AMF_OK )
|
||||
{
|
||||
res = ptr->Open(path.c_str(), eOpenType, eShareType);
|
||||
if( res != AMF_OK )
|
||||
{
|
||||
return res;
|
||||
}
|
||||
*str = ptr.Detach();
|
||||
return AMF_OK;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
271
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStreamFile.cpp
vendored
Normal file
271
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStreamFile.cpp
vendored
Normal file
@@ -0,0 +1,271 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "TraceAdapter.h"
|
||||
#include "DataStreamFile.h"
|
||||
|
||||
#pragma warning(disable: 4996)
|
||||
#if defined(_WIN32)
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define amf_close _close
|
||||
#define amf_read _read
|
||||
#define amf_write _write
|
||||
#define amf_seek64 _lseeki64
|
||||
#elif defined(__linux)// Linux
|
||||
#include <unistd.h>
|
||||
#define amf_close close
|
||||
#define amf_read read
|
||||
#define amf_write write
|
||||
#define amf_seek64 lseek64
|
||||
#elif defined(__APPLE__)
|
||||
#include <unistd.h>
|
||||
#define amf_close close
|
||||
#define amf_read read
|
||||
#define amf_write write
|
||||
#define amf_seek64 lseek
|
||||
#endif
|
||||
|
||||
using namespace amf;
|
||||
|
||||
#define AMF_FACILITY L"AMFDataStreamFileImpl"
|
||||
|
||||
#define AMF_FILE_PROTOCOL L"file"
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFDataStreamFileImpl::AMFDataStreamFileImpl()
|
||||
: m_iFileDescriptor(-1), m_Path()
|
||||
{}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFDataStreamFileImpl::~AMFDataStreamFileImpl()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamFileImpl::Close()
|
||||
{
|
||||
AMF_RESULT err = AMF_OK;
|
||||
if(m_iFileDescriptor != -1)
|
||||
{
|
||||
const int status = amf_close(m_iFileDescriptor);
|
||||
if(status != 0)
|
||||
{
|
||||
err = AMF_FAIL;
|
||||
}
|
||||
m_iFileDescriptor = -1;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamFileImpl::Read(void* pData, amf_size iSize, amf_size* pRead)
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(m_iFileDescriptor != -1, AMF_FILE_NOT_OPEN, L"Read() - File not open");
|
||||
AMF_RESULT err = AMF_OK;
|
||||
|
||||
int ready = amf_read(m_iFileDescriptor, pData, (amf_uint)iSize);
|
||||
|
||||
if(pRead != NULL)
|
||||
{
|
||||
*pRead = ready;
|
||||
}
|
||||
if(ready == 0) // eof
|
||||
{
|
||||
err = AMF_EOF;
|
||||
}
|
||||
else if(ready == -1)
|
||||
{
|
||||
err = AMF_FAIL;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamFileImpl::Write(const void* pData, amf_size iSize, amf_size* pWritten)
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(m_iFileDescriptor != -1, AMF_FILE_NOT_OPEN, L"Write() - File not Open");
|
||||
AMF_RESULT err = AMF_OK;
|
||||
amf_uint32 written = amf_write(m_iFileDescriptor, pData, (amf_uint)iSize);
|
||||
|
||||
if(pWritten != NULL)
|
||||
{
|
||||
*pWritten = written;
|
||||
}
|
||||
if(written != iSize) // check errors
|
||||
{
|
||||
err = AMF_FAIL;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamFileImpl::Seek(AMF_SEEK_ORIGIN eOrigin, amf_int64 iPosition, amf_int64* pNewPosition)
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(m_iFileDescriptor != -1, AMF_FILE_NOT_OPEN, L"Seek() - File not Open");
|
||||
|
||||
int org = 0;
|
||||
|
||||
switch(eOrigin)
|
||||
{
|
||||
case AMF_SEEK_BEGIN:
|
||||
org = SEEK_SET;
|
||||
break;
|
||||
|
||||
case AMF_SEEK_CURRENT:
|
||||
org = SEEK_CUR;
|
||||
break;
|
||||
|
||||
case AMF_SEEK_END:
|
||||
org = SEEK_END;
|
||||
break;
|
||||
}
|
||||
amf_int64 new_pos = 0;
|
||||
|
||||
new_pos = amf_seek64(m_iFileDescriptor, iPosition, org);
|
||||
if(new_pos == -1L) // check errors
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
if(pNewPosition != NULL)
|
||||
{
|
||||
*pNewPosition = new_pos;
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamFileImpl::GetPosition(amf_int64* pPosition)
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(pPosition != NULL, AMF_INVALID_POINTER);
|
||||
AMF_RETURN_IF_FALSE(m_iFileDescriptor != -1, AMF_FILE_NOT_OPEN, L"GetPosition() - File not Open");
|
||||
*pPosition = amf_seek64(m_iFileDescriptor, 0, SEEK_CUR);
|
||||
if(*pPosition == -1L)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamFileImpl::GetSize(amf_int64* pSize)
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(pSize != NULL, AMF_INVALID_POINTER);
|
||||
AMF_RETURN_IF_FALSE(m_iFileDescriptor != -1, AMF_FILE_NOT_OPEN, L"GetSize() - File not open");
|
||||
|
||||
amf_int64 cur_pos = amf_seek64(m_iFileDescriptor, 0, SEEK_CUR);
|
||||
*pSize = amf_seek64(m_iFileDescriptor, 0, SEEK_END);
|
||||
amf_seek64(m_iFileDescriptor, cur_pos, SEEK_SET);
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL AMFDataStreamFileImpl::IsSeekable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamFileImpl::Open(const wchar_t* pFilePath, AMF_STREAM_OPEN eOpenType, AMF_FILE_SHARE eShareType)
|
||||
{
|
||||
if(m_iFileDescriptor != -1)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
AMF_RETURN_IF_FALSE(pFilePath != NULL, AMF_INVALID_ARG);
|
||||
|
||||
m_Path = pFilePath;
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
int access = _O_BINARY;
|
||||
#else
|
||||
int access = 0;
|
||||
#endif
|
||||
|
||||
switch(eOpenType)
|
||||
{
|
||||
case AMFSO_READ:
|
||||
access |= O_RDONLY;
|
||||
break;
|
||||
|
||||
case AMFSO_WRITE:
|
||||
access |= O_CREAT | O_TRUNC | O_WRONLY;
|
||||
break;
|
||||
|
||||
case AMFSO_READ_WRITE:
|
||||
access |= O_CREAT | O_TRUNC | O_RDWR;
|
||||
break;
|
||||
|
||||
case AMFSO_APPEND:
|
||||
access |= O_CREAT | O_APPEND | O_RDWR;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
int shflag = 0;
|
||||
switch(eShareType)
|
||||
{
|
||||
case AMFFS_EXCLUSIVE:
|
||||
shflag = _SH_DENYRW;
|
||||
break;
|
||||
|
||||
case AMFFS_SHARE_READ:
|
||||
shflag = _SH_DENYWR;
|
||||
break;
|
||||
|
||||
case AMFFS_SHARE_WRITE:
|
||||
shflag = _SH_DENYRD;
|
||||
break;
|
||||
|
||||
case AMFFS_SHARE_READ_WRITE:
|
||||
shflag = _SH_DENYNO;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef O_BINARY
|
||||
access |= O_BINARY;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
m_iFileDescriptor = _wsopen(m_Path.c_str(), access, shflag, 0666);
|
||||
#else
|
||||
amf_string str = amf_from_unicode_to_utf8(m_Path);
|
||||
m_iFileDescriptor = open(str.c_str(), access, 0666);
|
||||
#endif
|
||||
|
||||
if(m_iFileDescriptor == -1)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
67
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStreamFile.h
vendored
Normal file
67
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStreamFile.h
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_DataStreamFile_h
|
||||
#define AMF_DataStreamFile_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DataStream.h"
|
||||
#include "InterfaceImpl.h"
|
||||
#include "AMFSTL.h"
|
||||
#include <string>
|
||||
|
||||
namespace amf
|
||||
{
|
||||
class AMFDataStreamFileImpl : public AMFInterfaceImpl<AMFDataStream>
|
||||
{
|
||||
public:
|
||||
AMFDataStreamFileImpl();
|
||||
virtual ~AMFDataStreamFileImpl();
|
||||
// interface
|
||||
virtual AMF_RESULT AMF_STD_CALL Close();
|
||||
virtual AMF_RESULT AMF_STD_CALL Read(void* pData, amf_size iSize, amf_size* pRead);
|
||||
virtual AMF_RESULT AMF_STD_CALL Write(const void* pData, amf_size iSize, amf_size* pWritten);
|
||||
virtual AMF_RESULT AMF_STD_CALL Seek(AMF_SEEK_ORIGIN eOrigin, amf_int64 iPosition, amf_int64* pNewPosition);
|
||||
virtual AMF_RESULT AMF_STD_CALL GetPosition(amf_int64* pPosition);
|
||||
virtual AMF_RESULT AMF_STD_CALL GetSize(amf_int64* pSize);
|
||||
virtual bool AMF_STD_CALL IsSeekable();
|
||||
|
||||
// local
|
||||
// aways pass full URL just in case
|
||||
virtual AMF_RESULT AMF_STD_CALL Open(const wchar_t* pFilePath, AMF_STREAM_OPEN eOpenType, AMF_FILE_SHARE eShareType);
|
||||
protected:
|
||||
int m_iFileDescriptor;
|
||||
amf_wstring m_Path;
|
||||
};
|
||||
} //namespace amf
|
||||
#endif // AMF_DataStreamFile_h
|
||||
175
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStreamMemory.cpp
vendored
Normal file
175
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStreamMemory.cpp
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "Thread.h"
|
||||
#include "TraceAdapter.h"
|
||||
#include "DataStreamMemory.h"
|
||||
|
||||
using namespace amf;
|
||||
|
||||
#define AMF_FACILITY L"AMFDataStreamMemoryImpl"
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFDataStreamMemoryImpl::AMFDataStreamMemoryImpl()
|
||||
: m_pMemory(NULL),
|
||||
m_uiMemorySize(0),
|
||||
m_uiAllocatedSize(0),
|
||||
m_pos(0)
|
||||
{}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFDataStreamMemoryImpl::~AMFDataStreamMemoryImpl()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// interface
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamMemoryImpl::Close()
|
||||
{
|
||||
if(m_pMemory != NULL)
|
||||
{
|
||||
amf_virtual_free(m_pMemory);
|
||||
}
|
||||
m_pMemory = NULL,
|
||||
m_uiMemorySize = 0,
|
||||
m_uiAllocatedSize = 0,
|
||||
m_pos = 0;
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMFDataStreamMemoryImpl::Realloc(amf_size iSize)
|
||||
{
|
||||
if(iSize > m_uiMemorySize)
|
||||
{
|
||||
amf_uint8* pNewMemory = (amf_uint8*)amf_virtual_alloc(iSize);
|
||||
if(pNewMemory == NULL)
|
||||
{
|
||||
return AMF_OUT_OF_MEMORY;
|
||||
}
|
||||
m_uiAllocatedSize = iSize;
|
||||
if(m_pMemory != NULL)
|
||||
{
|
||||
memcpy(pNewMemory, m_pMemory, m_uiMemorySize);
|
||||
amf_virtual_free(m_pMemory);
|
||||
}
|
||||
|
||||
m_pMemory = pNewMemory;
|
||||
}
|
||||
m_uiMemorySize = iSize;
|
||||
if(m_pos > m_uiMemorySize)
|
||||
{
|
||||
m_pos = m_uiMemorySize;
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamMemoryImpl::Read(void* pData, amf_size iSize, amf_size* pRead)
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(pData != NULL, AMF_INVALID_POINTER, L"Read() - pData==NULL");
|
||||
AMF_RETURN_IF_FALSE(m_pMemory != NULL, AMF_NOT_INITIALIZED, L"Read() - Stream is not allocated");
|
||||
|
||||
amf_size toRead = AMF_MIN(iSize, m_uiMemorySize - m_pos);
|
||||
memcpy(pData, m_pMemory + m_pos, toRead);
|
||||
m_pos += toRead;
|
||||
if(pRead != NULL)
|
||||
{
|
||||
*pRead = toRead;
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamMemoryImpl::Write(const void* pData, amf_size iSize, amf_size* pWritten)
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(pData != NULL, AMF_INVALID_POINTER, L"Write() - pData==NULL");
|
||||
AMF_RETURN_IF_FAILED(Realloc(m_pos + iSize), L"Write() - Stream is not allocated");
|
||||
|
||||
amf_size toWrite = AMF_MIN(iSize, m_uiMemorySize - m_pos);
|
||||
memcpy(m_pMemory + m_pos, pData, toWrite);
|
||||
m_pos += toWrite;
|
||||
if(pWritten != NULL)
|
||||
{
|
||||
*pWritten = toWrite;
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamMemoryImpl::Seek(AMF_SEEK_ORIGIN eOrigin, amf_int64 iPosition, amf_int64* pNewPosition)
|
||||
{
|
||||
switch(eOrigin)
|
||||
{
|
||||
case AMF_SEEK_BEGIN:
|
||||
m_pos = (amf_size)iPosition;
|
||||
break;
|
||||
|
||||
case AMF_SEEK_CURRENT:
|
||||
m_pos += (amf_size)iPosition;
|
||||
break;
|
||||
|
||||
case AMF_SEEK_END:
|
||||
m_pos = m_uiMemorySize - (amf_size)iPosition;
|
||||
break;
|
||||
}
|
||||
|
||||
if(m_pos > m_uiMemorySize)
|
||||
{
|
||||
m_pos = m_uiMemorySize;
|
||||
}
|
||||
if(pNewPosition != NULL)
|
||||
{
|
||||
*pNewPosition = m_pos;
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamMemoryImpl::GetPosition(amf_int64* pPosition)
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(pPosition != NULL, AMF_INVALID_POINTER, L"GetPosition() - pPosition==NULL");
|
||||
*pPosition = m_pos;
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_STD_CALL AMFDataStreamMemoryImpl::GetSize(amf_int64* pSize)
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(pSize != NULL, AMF_INVALID_POINTER, L"GetPosition() - pSize==NULL");
|
||||
*pSize = m_uiMemorySize;
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL AMFDataStreamMemoryImpl::IsSeekable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
77
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStreamMemory.h
vendored
Normal file
77
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/DataStreamMemory.h
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_DataStreamMemory_h
|
||||
#define AMF_DataStreamMemory_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DataStream.h"
|
||||
#include "InterfaceImpl.h"
|
||||
|
||||
namespace amf
|
||||
{
|
||||
class AMFDataStreamMemoryImpl : public AMFInterfaceImpl<AMFDataStream>
|
||||
{
|
||||
public:
|
||||
AMFDataStreamMemoryImpl();
|
||||
virtual ~AMFDataStreamMemoryImpl();
|
||||
// interface
|
||||
virtual AMF_RESULT AMF_STD_CALL Open(const wchar_t* /*pFileUrl*/, AMF_STREAM_OPEN /*eOpenType*/, AMF_FILE_SHARE /*eShareType*/)
|
||||
{
|
||||
//pFileUrl;
|
||||
//eOpenType;
|
||||
//eShareType;
|
||||
return AMF_OK;
|
||||
}
|
||||
virtual AMF_RESULT AMF_STD_CALL Close();
|
||||
virtual AMF_RESULT AMF_STD_CALL Read(void* pData, amf_size iSize, amf_size* pRead);
|
||||
virtual AMF_RESULT AMF_STD_CALL Write(const void* pData, amf_size iSize, amf_size* pWritten);
|
||||
virtual AMF_RESULT AMF_STD_CALL Seek(AMF_SEEK_ORIGIN eOrigin, amf_int64 iPosition, amf_int64* pNewPosition);
|
||||
virtual AMF_RESULT AMF_STD_CALL GetPosition(amf_int64* pPosition);
|
||||
virtual AMF_RESULT AMF_STD_CALL GetSize(amf_int64* pSize);
|
||||
virtual bool AMF_STD_CALL IsSeekable();
|
||||
|
||||
protected:
|
||||
AMF_RESULT Realloc(amf_size iSize);
|
||||
|
||||
amf_uint8* m_pMemory;
|
||||
amf_size m_uiMemorySize;
|
||||
amf_size m_uiAllocatedSize;
|
||||
amf_size m_pos;
|
||||
private:
|
||||
AMFDataStreamMemoryImpl(const AMFDataStreamMemoryImpl&);
|
||||
AMFDataStreamMemoryImpl& operator=(const AMFDataStreamMemoryImpl&);
|
||||
};
|
||||
} //namespace amf
|
||||
|
||||
#endif // AMF_DataStreamMemory_h
|
||||
250
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/IOCapsImpl.cpp
vendored
Normal file
250
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/IOCapsImpl.cpp
vendored
Normal file
@@ -0,0 +1,250 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "IOCapsImpl.h"
|
||||
|
||||
namespace amf
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AMFIOCapsImpl::SurfaceFormat::SurfaceFormat() :
|
||||
m_Format(AMF_SURFACE_UNKNOWN),
|
||||
m_Native(false)
|
||||
{
|
||||
}
|
||||
|
||||
AMFIOCapsImpl::SurfaceFormat::SurfaceFormat(AMF_SURFACE_FORMAT format, amf_bool native) :
|
||||
m_Format(format),
|
||||
m_Native(native)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
AMFIOCapsImpl::MemoryType::MemoryType() :
|
||||
m_Type(AMF_MEMORY_UNKNOWN),
|
||||
m_Native(false)
|
||||
{
|
||||
}
|
||||
|
||||
AMFIOCapsImpl::MemoryType::MemoryType(AMF_MEMORY_TYPE type, amf_bool native) :
|
||||
m_Type(type),
|
||||
m_Native(native)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AMFIOCapsImpl::AMFIOCapsImpl() :
|
||||
m_MinWidth(-1),
|
||||
m_MaxWidth(-1),
|
||||
m_MinHeight(-1),
|
||||
m_MaxHeight(-1),
|
||||
m_VertAlign(-1),
|
||||
m_InterlacedSupported(false)
|
||||
{
|
||||
}
|
||||
|
||||
AMFIOCapsImpl::AMFIOCapsImpl(amf_int32 minWidth, amf_int32 maxWidth,
|
||||
amf_int32 minHeight, amf_int32 maxHeight,
|
||||
amf_int32 vertAlign, amf_bool interlacedSupport,
|
||||
amf_int32 numOfNativeFormats, const AMF_SURFACE_FORMAT* nativeFormats,
|
||||
amf_int32 numOfNonNativeFormats, const AMF_SURFACE_FORMAT* nonNativeFormats,
|
||||
amf_int32 numOfNativeMemTypes, const AMF_MEMORY_TYPE* nativeMemTypes,
|
||||
amf_int32 numOfNonNativeMemTypes, const AMF_MEMORY_TYPE* nonNativeMemTypes)
|
||||
{
|
||||
m_MinWidth = minWidth;
|
||||
m_MaxWidth = maxWidth;
|
||||
m_MinHeight = minHeight;
|
||||
m_MaxHeight = maxHeight;
|
||||
m_VertAlign = vertAlign;
|
||||
m_InterlacedSupported = interlacedSupport;
|
||||
PopulateSurfaceFormats(numOfNativeFormats, nativeFormats, true);
|
||||
PopulateSurfaceFormats(numOfNonNativeFormats, nonNativeFormats, false);
|
||||
PopulateMemoryTypes(numOfNativeMemTypes, nativeMemTypes, true);
|
||||
PopulateMemoryTypes(numOfNonNativeMemTypes, nonNativeMemTypes, false);
|
||||
}
|
||||
|
||||
void AMFIOCapsImpl::PopulateSurfaceFormats(amf_int32 numOfFormats, const AMF_SURFACE_FORMAT* formats, amf_bool native)
|
||||
{
|
||||
if (formats != NULL)
|
||||
{
|
||||
for (amf_int32 i = 0; i < numOfFormats; i++)
|
||||
{
|
||||
bool found = false;
|
||||
for(amf_size exists_idx = 0; exists_idx < m_SurfaceFormats.size(); exists_idx++)
|
||||
{
|
||||
if(m_SurfaceFormats[exists_idx].GetFormat() == formats[i])
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
{
|
||||
m_SurfaceFormats.push_back(SurfaceFormat(formats[i], native));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AMFIOCapsImpl::PopulateMemoryTypes(amf_int32 numOfTypes, const AMF_MEMORY_TYPE* memTypes, amf_bool native)
|
||||
{
|
||||
if (memTypes != NULL)
|
||||
{
|
||||
for (amf_int32 i = 0; i < numOfTypes; i++)
|
||||
{
|
||||
bool found = false;
|
||||
for(amf_size exists_idx = 0; exists_idx < m_MemoryTypes.size(); exists_idx++)
|
||||
{
|
||||
if(m_MemoryTypes[exists_idx].GetType() == memTypes[i])
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if(!found)
|
||||
{
|
||||
m_MemoryTypes.push_back(MemoryType(memTypes[i], native));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get supported resolution ranges in pixels/lines:
|
||||
void AMF_STD_CALL AMFIOCapsImpl::GetWidthRange(amf_int32* minWidth, amf_int32* maxWidth) const
|
||||
{
|
||||
if (minWidth != NULL)
|
||||
{
|
||||
*minWidth = m_MinWidth;
|
||||
}
|
||||
if (maxWidth != NULL)
|
||||
{
|
||||
*maxWidth = m_MaxWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void AMF_STD_CALL AMFIOCapsImpl::GetHeightRange(amf_int32* minHeight, amf_int32* maxHeight) const
|
||||
{
|
||||
if (minHeight != NULL)
|
||||
{
|
||||
*minHeight = m_MinHeight;
|
||||
}
|
||||
if (maxHeight != NULL)
|
||||
{
|
||||
*maxHeight = m_MaxHeight;
|
||||
}
|
||||
}
|
||||
|
||||
// Get memory alignment in lines:
|
||||
// Vertical aligmnent should be multiples of this number
|
||||
amf_int32 AMF_STD_CALL AMFIOCapsImpl::GetVertAlign() const
|
||||
{
|
||||
return m_VertAlign;
|
||||
}
|
||||
|
||||
// Enumerate supported surface pixel formats:
|
||||
amf_int32 AMF_STD_CALL AMFIOCapsImpl::GetNumOfFormats() const
|
||||
{
|
||||
return (amf_int32)m_SurfaceFormats.size();
|
||||
}
|
||||
|
||||
AMF_RESULT AMF_STD_CALL AMFIOCapsImpl::GetFormatAt(amf_int32 index, AMF_SURFACE_FORMAT* format, bool* native) const
|
||||
{
|
||||
if (index >= 0 && index < static_cast<amf_int32>(m_SurfaceFormats.size()))
|
||||
{
|
||||
SurfaceFormat curFormat(m_SurfaceFormats.at(index));
|
||||
if (format != NULL)
|
||||
{
|
||||
*format = curFormat.GetFormat();
|
||||
}
|
||||
if (native != NULL)
|
||||
{
|
||||
*native = curFormat.IsNative();
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return AMF_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
// Enumerate supported surface formats:
|
||||
amf_int32 AMF_STD_CALL AMFIOCapsImpl::GetNumOfMemoryTypes() const
|
||||
{
|
||||
return (amf_int32)m_MemoryTypes.size();
|
||||
}
|
||||
|
||||
AMF_RESULT AMF_STD_CALL AMFIOCapsImpl::GetMemoryTypeAt(amf_int32 index, AMF_MEMORY_TYPE* memType, bool* native) const
|
||||
{
|
||||
if (index >= 0 && index < static_cast<amf_int32>(m_MemoryTypes.size()))
|
||||
{
|
||||
MemoryType curType(m_MemoryTypes.at(index));
|
||||
if (memType != NULL)
|
||||
{
|
||||
*memType = curType.GetType();
|
||||
}
|
||||
if (native != NULL)
|
||||
{
|
||||
*native = curType.IsNative();
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return AMF_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
// interlaced support:
|
||||
amf_bool AMF_STD_CALL AMFIOCapsImpl::IsInterlacedSupported() const
|
||||
{
|
||||
return m_InterlacedSupported;
|
||||
}
|
||||
|
||||
void AMFIOCapsImpl::SetResolution(amf_int32 minWidth, amf_int32 maxWidth, amf_int32 minHeight, amf_int32 maxHeight)
|
||||
{
|
||||
m_MinWidth = minWidth;
|
||||
m_MaxWidth = maxWidth;
|
||||
m_MinHeight = minHeight;
|
||||
m_MaxHeight = maxHeight;
|
||||
}
|
||||
|
||||
void AMFIOCapsImpl::SetVertAlign(amf_int32 vertAlign)
|
||||
{
|
||||
m_VertAlign = vertAlign;
|
||||
}
|
||||
|
||||
void AMFIOCapsImpl::SetInterlacedSupport(amf_bool interlaced)
|
||||
{
|
||||
m_InterlacedSupported = interlaced;
|
||||
}
|
||||
|
||||
}
|
||||
132
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/IOCapsImpl.h
vendored
Normal file
132
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/IOCapsImpl.h
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_IOCapsImpl_h
|
||||
#define AMF_IOCapsImpl_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "InterfaceImpl.h"
|
||||
#include "../include/components/ComponentCaps.h"
|
||||
#include <vector>
|
||||
|
||||
namespace amf
|
||||
{
|
||||
class AMFIOCapsImpl : public AMFInterfaceImpl<AMFIOCaps>
|
||||
{
|
||||
protected:
|
||||
class SurfaceFormat
|
||||
{
|
||||
public:
|
||||
typedef std::vector<SurfaceFormat> Collection;
|
||||
public:
|
||||
SurfaceFormat();
|
||||
SurfaceFormat(AMF_SURFACE_FORMAT format, amf_bool native);
|
||||
|
||||
inline AMF_SURFACE_FORMAT GetFormat() const throw() { return m_Format; }
|
||||
inline amf_bool IsNative() const throw() { return m_Native; }
|
||||
private:
|
||||
AMF_SURFACE_FORMAT m_Format;
|
||||
amf_bool m_Native;
|
||||
};
|
||||
|
||||
class MemoryType
|
||||
{
|
||||
public:
|
||||
typedef std::vector<MemoryType> Collection;
|
||||
public:
|
||||
MemoryType();
|
||||
MemoryType(AMF_MEMORY_TYPE type, amf_bool native);
|
||||
|
||||
inline AMF_MEMORY_TYPE GetType() const throw() { return m_Type; }
|
||||
inline amf_bool IsNative() const throw() { return m_Native; }
|
||||
private:
|
||||
AMF_MEMORY_TYPE m_Type;
|
||||
amf_bool m_Native;
|
||||
};
|
||||
|
||||
struct Resolution
|
||||
{
|
||||
amf_int32 m_Width;
|
||||
amf_int32 m_Height;
|
||||
};
|
||||
|
||||
protected:
|
||||
AMFIOCapsImpl();
|
||||
AMFIOCapsImpl(amf_int32 minWidth, amf_int32 maxWidth,
|
||||
amf_int32 minHeight, amf_int32 maxHeight,
|
||||
amf_int32 vertAlign, amf_bool interlacedSupport,
|
||||
amf_int32 numOfNativeFormats, const AMF_SURFACE_FORMAT* nativeFormats,
|
||||
amf_int32 numOfNonNativeFormats, const AMF_SURFACE_FORMAT* nonNativeFormats,
|
||||
amf_int32 numOfNativeMemTypes, const AMF_MEMORY_TYPE* nativeMemTypes,
|
||||
amf_int32 numOfNonNativeMemTypes, const AMF_MEMORY_TYPE* nonNativeMemTypes);
|
||||
|
||||
public:
|
||||
// Get supported resolution ranges in pixels/lines:
|
||||
virtual void AMF_STD_CALL GetWidthRange(amf_int32* minWidth, amf_int32* maxWidth) const;
|
||||
virtual void AMF_STD_CALL GetHeightRange(amf_int32* minHeight, amf_int32* maxHeight) const;
|
||||
|
||||
// Get memory alignment in lines:
|
||||
// Vertical aligmnent should be multiples of this number
|
||||
virtual amf_int32 AMF_STD_CALL GetVertAlign() const;
|
||||
|
||||
// Enumerate supported surface pixel formats:
|
||||
virtual amf_int32 AMF_STD_CALL GetNumOfFormats() const;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetFormatAt(amf_int32 index, AMF_SURFACE_FORMAT* format, amf_bool* native) const;
|
||||
|
||||
// Enumerate supported surface formats:
|
||||
virtual amf_int32 AMF_STD_CALL GetNumOfMemoryTypes() const;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetMemoryTypeAt(amf_int32 index, AMF_MEMORY_TYPE* memType, amf_bool* native) const;
|
||||
|
||||
// interlaced support:
|
||||
virtual amf_bool AMF_STD_CALL IsInterlacedSupported() const;
|
||||
|
||||
protected:
|
||||
void SetResolution(amf_int32 minWidth, amf_int32 maxWidth, amf_int32 minHeight, amf_int32 maxHeight);
|
||||
void SetVertAlign(amf_int32 alignment);
|
||||
void SetInterlacedSupport(amf_bool interlaced);
|
||||
void PopulateSurfaceFormats(amf_int32 numOfFormats, const AMF_SURFACE_FORMAT* formats, amf_bool native);
|
||||
void PopulateMemoryTypes(amf_int32 numOfTypes, const AMF_MEMORY_TYPE* memTypes, amf_bool native);
|
||||
|
||||
|
||||
protected:
|
||||
amf_int32 m_MinWidth;
|
||||
amf_int32 m_MaxWidth;
|
||||
amf_int32 m_MinHeight;
|
||||
amf_int32 m_MaxHeight;
|
||||
amf_int32 m_VertAlign;
|
||||
amf_bool m_InterlacedSupported;
|
||||
SurfaceFormat::Collection m_SurfaceFormats;
|
||||
MemoryType::Collection m_MemoryTypes;
|
||||
};
|
||||
}
|
||||
#endif // AMF_IOCapsImpl_h
|
||||
214
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/InterfaceImpl.h
vendored
Normal file
214
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/InterfaceImpl.h
vendored
Normal file
@@ -0,0 +1,214 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_InterfaceImpl_h
|
||||
#define AMF_InterfaceImpl_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../include/core/Interface.h"
|
||||
#include "Thread.h"
|
||||
|
||||
#pragma warning(disable : 4511)
|
||||
namespace amf
|
||||
{
|
||||
#define AMF_BEGIN_INTERFACE_MAP \
|
||||
virtual AMF_RESULT AMF_STD_CALL QueryInterface(const amf::AMFGuid & interfaceID, void** ppInterface) \
|
||||
{ \
|
||||
AMF_RESULT err = AMF_NO_INTERFACE; \
|
||||
|
||||
|
||||
#define AMF_INTERFACE_ENTRY(T) \
|
||||
if(AMFCompareGUIDs(interfaceID, T::IID())) \
|
||||
{ \
|
||||
*ppInterface = (void*)static_cast<T*>(this); \
|
||||
this->Acquire(); \
|
||||
err = AMF_OK; \
|
||||
} \
|
||||
else \
|
||||
|
||||
#define AMF_INTERFACE_ENTRY_THIS(T, _TI) \
|
||||
if(AMFCompareGUIDs(interfaceID, T::IID())) \
|
||||
{ \
|
||||
*ppInterface = (void*)static_cast<T*>(static_cast<_TI*>(this)); \
|
||||
this->Acquire(); \
|
||||
err = AMF_OK; \
|
||||
} \
|
||||
else \
|
||||
|
||||
#define AMF_INTERFACE_MULTI_ENTRY(T) \
|
||||
if(AMFCompareGUIDs(interfaceID, T::IID())) \
|
||||
{ \
|
||||
*ppInterface = (void*)static_cast<T*>(this); \
|
||||
AcquireInternal(); \
|
||||
err = AMF_OK; \
|
||||
} \
|
||||
else \
|
||||
|
||||
#define AMF_INTERFACE_CHAIN_ENTRY(T) \
|
||||
if(static_cast<T&>(*this).T::QueryInterface(interfaceID, ppInterface) == AMF_OK) \
|
||||
{err = AMF_OK;} \
|
||||
else \
|
||||
|
||||
//good as an example but we should not use aggregate pattern without big reason - very hard to debug
|
||||
#define AMF_INTERFACE_AGREGATED_ENTRY(T, _Ptr) \
|
||||
if(AMFCompareGUIDs(interfaceID, T::IID())) \
|
||||
{ \
|
||||
T* ptr = static_cast<T*>(_Ptr); \
|
||||
*ppInterface = (void*)ptr; \
|
||||
ptr->Acquire(); \
|
||||
err = AMF_OK; \
|
||||
} \
|
||||
else \
|
||||
|
||||
#define AMF_INTERFACE_CHAIN_AGREGATED_ENTRY(T, _Ptr) \
|
||||
if(err = static_cast<T*>(_Ptr)->QueryInterface(interfaceID, ppInterface)) { \
|
||||
} \
|
||||
else \
|
||||
|
||||
#define AMF_END_INTERFACE_MAP \
|
||||
{} \
|
||||
return err; \
|
||||
} \
|
||||
|
||||
|
||||
//---------------------------------------------------------------
|
||||
class AMFInterfaceBase
|
||||
{
|
||||
protected:
|
||||
amf_long m_refCount;
|
||||
virtual ~AMFInterfaceBase()
|
||||
#if __GNUC__ == 11 //WORKAROUND for gcc-11 bug
|
||||
__attribute__ ((noinline))
|
||||
#endif
|
||||
{}
|
||||
public:
|
||||
AMFInterfaceBase() : m_refCount(0)
|
||||
{}
|
||||
virtual amf_long AMF_STD_CALL AcquireInternal()
|
||||
{
|
||||
amf_long newVal = amf_atomic_inc(&m_refCount);
|
||||
return newVal;
|
||||
}
|
||||
virtual amf_long AMF_STD_CALL ReleaseInternal()
|
||||
{
|
||||
amf_long newVal = amf_atomic_dec(&m_refCount);
|
||||
if(newVal == 0)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
return newVal;
|
||||
}
|
||||
virtual amf_long AMF_STD_CALL RefCountInternal()
|
||||
{
|
||||
return m_refCount;
|
||||
}
|
||||
};
|
||||
//---------------------------------------------------------------
|
||||
template<class _Base , typename _Param1 = int, typename _Param2 = int, typename _Param3 = int>
|
||||
class AMFInterfaceImpl : public _Base, public AMFInterfaceBase
|
||||
{
|
||||
protected:
|
||||
virtual ~AMFInterfaceImpl()
|
||||
{}
|
||||
public:
|
||||
AMFInterfaceImpl(_Param1 param1, _Param2 param2, _Param3 param3) : _Base(param1, param2, param3)
|
||||
{}
|
||||
AMFInterfaceImpl(_Param1 param1, _Param2 param2) : _Base(param1, param2)
|
||||
{}
|
||||
AMFInterfaceImpl(_Param1 param1) : _Base(param1)
|
||||
{}
|
||||
AMFInterfaceImpl()
|
||||
{}
|
||||
virtual amf_long AMF_STD_CALL Acquire()
|
||||
{
|
||||
return AMFInterfaceBase::AcquireInternal();
|
||||
}
|
||||
virtual amf_long AMF_STD_CALL Release()
|
||||
{
|
||||
return AMFInterfaceBase::ReleaseInternal();
|
||||
}
|
||||
virtual amf_long AMF_STD_CALL RefCount()
|
||||
{
|
||||
return AMFInterfaceBase::RefCountInternal();
|
||||
}
|
||||
|
||||
AMF_BEGIN_INTERFACE_MAP
|
||||
AMF_INTERFACE_ENTRY(AMFInterface)
|
||||
AMF_INTERFACE_ENTRY(_Base)
|
||||
AMF_END_INTERFACE_MAP
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------
|
||||
template<class _Base, class _BaseInterface, typename _Param1 = int, typename _Param2 = int, typename _Param3 = int, typename _Param4 = int, typename _Param5 = int, typename _Param6 = int>
|
||||
class AMFInterfaceMultiImpl : public _Base
|
||||
{
|
||||
protected:
|
||||
virtual ~AMFInterfaceMultiImpl()
|
||||
{}
|
||||
public:
|
||||
AMFInterfaceMultiImpl(_Param1 param1, _Param2 param2, _Param3 param3, _Param4 param4, _Param5 param5, _Param6 param6) : _Base(param1, param2, param3, param4, param5, param6)
|
||||
{}
|
||||
AMFInterfaceMultiImpl(_Param1 param1, _Param2 param2, _Param3 param3, _Param4 param4, _Param5 param5) : _Base(param1, param2, param3, param4, param5)
|
||||
{}
|
||||
AMFInterfaceMultiImpl(_Param1 param1, _Param2 param2, _Param3 param3, _Param4 param4) : _Base(param1, param2, param3, param4)
|
||||
{}
|
||||
AMFInterfaceMultiImpl(_Param1 param1, _Param2 param2, _Param3 param3) : _Base(param1, param2, param3)
|
||||
{}
|
||||
AMFInterfaceMultiImpl(_Param1 param1, _Param2 param2) : _Base(param1, param2)
|
||||
{}
|
||||
AMFInterfaceMultiImpl(_Param1 param1) : _Base(param1)
|
||||
{}
|
||||
AMFInterfaceMultiImpl()
|
||||
{}
|
||||
virtual amf_long AMF_STD_CALL Acquire()
|
||||
{
|
||||
return AMFInterfaceBase::AcquireInternal();
|
||||
}
|
||||
virtual amf_long AMF_STD_CALL Release()
|
||||
{
|
||||
return AMFInterfaceBase::ReleaseInternal();
|
||||
}
|
||||
virtual amf_long AMF_STD_CALL RefCount()
|
||||
{
|
||||
return AMFInterfaceBase::RefCountInternal();
|
||||
}
|
||||
|
||||
AMF_BEGIN_INTERFACE_MAP
|
||||
AMF_INTERFACE_ENTRY_THIS(AMFInterface, _BaseInterface)
|
||||
AMF_INTERFACE_CHAIN_ENTRY(_Base)
|
||||
AMF_END_INTERFACE_MAP
|
||||
};
|
||||
|
||||
|
||||
} // namespace amf
|
||||
#endif // AMF_InterfaceImpl_h
|
||||
318
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Json.h
vendored
Normal file
318
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Json.h
vendored
Normal file
@@ -0,0 +1,318 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "public/include/core/Interface.h"
|
||||
#include "public/include/core/Variant.h"
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace amf
|
||||
{
|
||||
class JSONParser : public amf::AMFInterface
|
||||
{
|
||||
public:
|
||||
//-----------------------------------------------------------------------------------------
|
||||
enum Result
|
||||
{
|
||||
OK,
|
||||
MISSING_QUOTE,
|
||||
MISSING_BRACE,
|
||||
MISSING_BRACKET,
|
||||
MISSING_DELIMITER,
|
||||
MISSING_VALUE,
|
||||
UNEXPECTED_END,
|
||||
DUPLICATE_NAME,
|
||||
INVALID_ARG,
|
||||
INVALID_VALUE
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------
|
||||
typedef amf::AMFInterfacePtr_T<JSONParser> Ptr;
|
||||
AMF_DECLARE_IID(0x14aefb78, 0x80af, 0x4ee1, 0x82, 0x9f, 0xa2, 0xfc, 0xc7, 0xae, 0xab, 0x33)
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class Error
|
||||
{
|
||||
public:
|
||||
Error(JSONParser::Result error) :
|
||||
m_Ofs(0),
|
||||
m_Error(error)
|
||||
{
|
||||
}
|
||||
|
||||
Error(size_t ofs, JSONParser::Result error) :
|
||||
m_Ofs(ofs),
|
||||
m_Error(error)
|
||||
{
|
||||
}
|
||||
|
||||
inline size_t GetOffset() const { return m_Ofs; }
|
||||
inline JSONParser::Result GetResult() const { return m_Error; }
|
||||
|
||||
private:
|
||||
size_t m_Ofs;
|
||||
JSONParser::Result m_Error;
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------
|
||||
struct OutputFormatDesc
|
||||
{
|
||||
|
||||
bool bHumanReadable;
|
||||
bool bNewLineBeforeBrace;
|
||||
char cOffsetWith;
|
||||
uint8_t nOffsetSize;
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class Element : public amf::AMFInterface
|
||||
{
|
||||
public:
|
||||
typedef amf::AMFInterfacePtr_T<Element> Ptr;
|
||||
AMF_DECLARE_IID(0xd2d71993, 0xbbcb, 0x420f, 0xbc, 0xdd, 0xd8, 0xd6, 0xb6, 0x2e, 0x46, 0x5e)
|
||||
|
||||
virtual Error Parse(const std::string& str, size_t start, size_t end) = 0;
|
||||
virtual std::string Stringify() const = 0;
|
||||
virtual std::string StringifyFormatted(const OutputFormatDesc& format, int indent) const = 0;
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class Value : public Element
|
||||
{
|
||||
public:
|
||||
typedef amf::AMFInterfacePtr_T<Value> Ptr;
|
||||
AMF_DECLARE_IID(0xba0e44d4, 0xa487, 0x4d64, 0xa4, 0x94, 0x93, 0x9b, 0xfd, 0x76, 0x72, 0x32)
|
||||
|
||||
virtual void SetValue(const std::string& val) = 0;
|
||||
virtual void SetValueAsInt32(int32_t val) = 0;
|
||||
virtual void SetValueAsUInt32(uint32_t val) = 0;
|
||||
virtual void SetValueAsInt64(int64_t val) = 0;
|
||||
virtual void SetValueAsUInt64(uint64_t val) = 0;
|
||||
virtual void SetValueAsDouble(double val) = 0;
|
||||
virtual void SetValueAsFloat(float val) = 0;
|
||||
virtual void SetValueAsBool(bool val) = 0;
|
||||
virtual void SetValueAsTime(time_t date, bool utc) = 0;
|
||||
virtual void SetToNull() = 0;
|
||||
|
||||
virtual const std::string& GetValue() const = 0;
|
||||
virtual int32_t GetValueAsInt32() const = 0;
|
||||
virtual uint32_t GetValueAsUInt32() const = 0;
|
||||
virtual int64_t GetValueAsInt64() const = 0;
|
||||
virtual uint64_t GetValueAsUInt64() const = 0;
|
||||
virtual double GetValueAsDouble() const = 0;
|
||||
virtual float GetValueAsFloat() const = 0;
|
||||
virtual bool GetValueAsBool() const = 0;
|
||||
virtual time_t GetValueAsTime() const = 0;
|
||||
virtual bool IsNull() const = 0;
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class Node : public Element
|
||||
{
|
||||
public:
|
||||
typedef amf::AMFInterfacePtr_T<Node> Ptr;
|
||||
AMF_DECLARE_IID(0x6623d6b8, 0x533d, 0x4824, 0x9d, 0x3b, 0x45, 0x1a, 0xa8, 0xc3, 0x7b, 0x5d)
|
||||
|
||||
virtual size_t GetElementCount() const = 0;
|
||||
virtual JSONParser::Element* GetElementByName(const std::string& name) const = 0;
|
||||
virtual JSONParser::Result AddElement(const std::string& name, Element* element) = 0;
|
||||
virtual JSONParser::Element* GetElementAt(size_t idx, std::string& name) const = 0;
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class Array : public Element
|
||||
{
|
||||
public:
|
||||
typedef amf::AMFInterfacePtr_T<Array> Ptr;
|
||||
AMF_DECLARE_IID(0x8c066a6d, 0xb377, 0x44e8, 0x8c, 0xf5, 0xf8, 0xbf, 0x88, 0x85, 0xbb, 0xe9)
|
||||
|
||||
virtual size_t GetElementCount() const = 0;
|
||||
virtual JSONParser::Element* GetElementAt(size_t idx) const = 0;
|
||||
virtual void AddElement(Element* element) = 0;
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------
|
||||
virtual Result Parse(const std::string& str, Node** root) = 0; // Parse a JSON string into a tree of DOM elements
|
||||
virtual std::string Stringify(const Node* root) const = 0; // Convert a DOM to a JSON string
|
||||
virtual std::string StringifyFormatted(const Node* root, const OutputFormatDesc& format, int indent = 0) const = 0;
|
||||
|
||||
virtual Result CreateNode(Node** node) const = 0;
|
||||
virtual Result CreateValue(Value** value) const = 0;
|
||||
virtual Result CreateArray(Array** array) const = 0;
|
||||
|
||||
virtual size_t GetLastErrorOffset() const = 0; // Returns the offset of the last syntax error (same as what is passed in the exception if thrown)
|
||||
};
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// Helpers
|
||||
#define TAG_JSON_VALUE "Val"
|
||||
|
||||
void SetBoolValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, bool val);
|
||||
void CreateBoolValue(amf::JSONParser* parser, amf::JSONParser::Value** node, bool val);
|
||||
bool GetBoolValue(const amf::JSONParser::Node* root, const char* name, bool& val);
|
||||
bool GetBoolFromJSON(const amf::JSONParser::Value* element, bool& val);
|
||||
|
||||
void SetDoubleValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, double val);
|
||||
void CreateDoubleValue(amf::JSONParser* parser, amf::JSONParser::Value** node, double val);
|
||||
bool GetDoubleValue(const amf::JSONParser::Node* root, const char* name, double& val);
|
||||
bool GetDoubleFromJSON(const amf::JSONParser::Value* element, double& val);
|
||||
|
||||
void SetFloatValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, float val);
|
||||
void CreateFloatValue(amf::JSONParser* parser, amf::JSONParser::Value** node, float val);
|
||||
bool GetFloatValue(const amf::JSONParser::Node* root, const char* name, float& val);
|
||||
bool GetFloatFromJSON(const amf::JSONParser::Value* element, float& val);
|
||||
|
||||
void SetInt64Value(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, int64_t val);
|
||||
void CreateInt64Value(amf::JSONParser* parser, amf::JSONParser::Value** node, const int64_t val);
|
||||
bool GetInt64Value(const amf::JSONParser::Node* root, const char* name, int64_t& val);
|
||||
bool GetInt64FromJSON(const amf::JSONParser::Value* element, int64_t& val);
|
||||
|
||||
void SetUInt64Value(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, uint64_t val);
|
||||
bool GetUInt64Value(const amf::JSONParser::Node* root, const char* name, uint64_t& val);
|
||||
bool GetUInt64FromJSON(const amf::JSONParser::Value* element, uint64_t& val);
|
||||
|
||||
void SetInt32Value(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, int32_t val);
|
||||
bool GetInt32Value(const amf::JSONParser::Node* root, const char* name, int32_t& val);
|
||||
bool GetInt32FromJSON(const amf::JSONParser::Value* element, int32_t& val);
|
||||
|
||||
void SetUInt32Value(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, uint32_t val);
|
||||
bool GetUInt32Value(const amf::JSONParser::Node* root, const char* name, uint32_t& val);
|
||||
bool GetUInt32FromJSON(const amf::JSONParser::Value* element, uint32_t& val);
|
||||
|
||||
void SetUInt32Array(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const uint32_t* val, size_t size);
|
||||
void CreateUInt32Array(amf::JSONParser* parser, amf::JSONParser::Array** array, const uint32_t* val, size_t size);
|
||||
bool GetUInt32Array(const amf::JSONParser::Node* root, const char* name, uint32_t* val, size_t& size);
|
||||
bool GetUInt32ArrayFromJSON(const amf::JSONParser::Array* element, uint32_t* val, size_t& size);
|
||||
|
||||
void SetInt32Array(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const int32_t* val, size_t size);
|
||||
void CreateInt32Array(amf::JSONParser* parser, amf::JSONParser::Array** array, const int32_t* val, size_t size);
|
||||
bool GetInt32Array(const amf::JSONParser::Node* root, const char* name, int32_t* val, size_t& size);
|
||||
bool GetInt32ArrayFromJSON(const amf::JSONParser::Array* element, int32_t* val, size_t& size);
|
||||
|
||||
void SetInt64Array(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const int64_t* val, size_t size);
|
||||
bool GetInt64Array(const amf::JSONParser::Node* root, const char* name, int64_t* val, size_t& size);
|
||||
bool GetInt64ArrayFromJSON(const amf::JSONParser::Array* element, int64_t* val, size_t& size);
|
||||
|
||||
void SetFloatArray(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const float* val, size_t size);
|
||||
void CreateFloatArray(amf::JSONParser* parser, amf::JSONParser::Array** array, const float* val, size_t size);
|
||||
bool GetFloatArray(const amf::JSONParser::Node* root, const char* name, float* val, size_t& size);
|
||||
bool GetFloatArrayFromJSON(const amf::JSONParser::Array* element, float* val, size_t& size);
|
||||
|
||||
void SetDoubleArray(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const double* val, size_t size);
|
||||
bool GetDoubleArray(const amf::JSONParser::Node* root, const char* name, double* val, size_t& size);
|
||||
bool GetDoubleArrayFromJSON(const amf::JSONParser::Array* element, double* val, size_t& size);
|
||||
|
||||
void SetSizeValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const AMFSize& val);
|
||||
void CreateSizeValue(amf::JSONParser* parser, amf::JSONParser::Array** array, const AMFSize& val);
|
||||
bool GetSizeValue(const amf::JSONParser::Node* root, const char* name, AMFSize& val);
|
||||
bool GetSizeFromJSON(const amf::JSONParser::Element* element, AMFSize& val);
|
||||
|
||||
void SetRectValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const AMFRect& val);
|
||||
void CreateRectValue(amf::JSONParser* parser, amf::JSONParser::Array** array, const AMFRect& val);
|
||||
bool GetRectValue(const amf::JSONParser::Node* root, const char* name, AMFRect& val);
|
||||
bool GetRectFromJSON(const amf::JSONParser::Element* element, AMFRect& val);
|
||||
|
||||
void SetPointValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const AMFPoint& val);
|
||||
void CreatePointValue(amf::JSONParser* parser, amf::JSONParser::Array** array, const AMFPoint& val);
|
||||
bool GetPointValue(const amf::JSONParser::Node* root, const char* name, AMFPoint& val);
|
||||
bool GetPointFromJSON(const amf::JSONParser::Element* element, AMFPoint& val);
|
||||
|
||||
void SetRateValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const AMFRate& val);
|
||||
void CreateRateValue(amf::JSONParser* parser, amf::JSONParser::Array** array, const AMFRate& val);
|
||||
bool GetRateValue(const amf::JSONParser::Node* root, const char* name, AMFRate& val);
|
||||
bool GetRateFromJSON(const amf::JSONParser::Element* element, AMFRate& val);
|
||||
|
||||
void SetRatioValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const AMFRatio& val);
|
||||
void CreateRatioValue(amf::JSONParser* parser, amf::JSONParser::Array** array, const AMFRatio& val);
|
||||
bool GetRatioValue(const amf::JSONParser::Node* root, const char* name, AMFRatio& val);
|
||||
bool GetRatioFromJSON(const amf::JSONParser::Element* element, AMFRatio& val);
|
||||
|
||||
void SetColorValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const AMFColor& val);
|
||||
void CreateColorValue(amf::JSONParser* parser, amf::JSONParser::Array** array, const AMFColor& val);
|
||||
bool GetColorValue(const amf::JSONParser::Node* root, const char* name, AMFColor& val);
|
||||
bool GetColorFromJSON(const amf::JSONParser::Element* element, AMFColor& val);
|
||||
|
||||
void SetFloatSizeValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const AMFFloatSize& val);
|
||||
void CreateFloatSizeValue(amf::JSONParser* parser, amf::JSONParser::Array** array, const AMFFloatSize& val);
|
||||
bool GetFloatSizeValue(const amf::JSONParser::Node* root, const char* name, AMFFloatSize& val);
|
||||
bool GetFloatSizeFromJSON(const amf::JSONParser::Element* element, AMFFloatSize& val);
|
||||
|
||||
void SetFloatPoint2DValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const AMFFloatPoint2D& val);
|
||||
void CreateFloatPoint2DValue(amf::JSONParser* parser, amf::JSONParser::Array** array, const AMFFloatPoint2D& val);
|
||||
bool GetFloatPoint2DValue(const amf::JSONParser::Node* root, const char* name, AMFFloatPoint2D& val);
|
||||
bool GetFloatPoint2DFromJSON(const amf::JSONParser::Element* element, AMFFloatPoint2D& val);
|
||||
|
||||
void SetFloatPoint3DValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const AMFFloatPoint3D& val);
|
||||
void CreateFloatPoint3DValue(amf::JSONParser* parser, amf::JSONParser::Array** array, const AMFFloatPoint3D& val);
|
||||
bool GetFloatPoint3DValue(const amf::JSONParser::Node* root, const char* name, AMFFloatPoint3D& val);
|
||||
bool GetFloatPoint3DFromJSON(const amf::JSONParser::Element* element, AMFFloatPoint3D& val);
|
||||
|
||||
void SetFloatVector4DValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const AMFFloatVector4D& val);
|
||||
void CreateFloatVector4DValue(amf::JSONParser* parser, amf::JSONParser::Array** array, const AMFFloatVector4D& val);
|
||||
bool GetFloatVector4DValue(const amf::JSONParser::Node* root, const char* name, AMFFloatVector4D& val);
|
||||
bool GetFloatVector4DFromJSON(const amf::JSONParser::Element* element, AMFFloatVector4D& val);
|
||||
|
||||
void SetStringValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const std::string& val);
|
||||
void CreateStringValue(amf::JSONParser* parser, amf::JSONParser::Value** node, const std::string& val);
|
||||
bool GetStringValue(const amf::JSONParser::Node* root, const char* name, std::string& val);
|
||||
bool GetStringFromJSON(const amf::JSONParser::Value* element, std::string& val);
|
||||
|
||||
void SetInterfaceValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, /*const*/ AMFInterface* pVal);
|
||||
void CreateInterfaceValue(amf::JSONParser* parser, amf::JSONParser::Node** node, /*const*/ AMFInterface* pval);
|
||||
bool GetInterfaceValue(const amf::JSONParser::Node* root, const char* name, AMFInterface* ppVal);
|
||||
bool GetInterfaceFromJSON(const amf::JSONParser::Element* element, AMFInterface* ppVal);
|
||||
|
||||
void SetVariantValue(amf::JSONParser* parser, amf::JSONParser::Node* root, const char* name, const amf::AMFVariant& value);
|
||||
void SetVariantToJSON(amf::JSONParser* parser, amf::JSONParser::Node** node, const amf::AMFVariant& value);
|
||||
bool GetVariantValue(const amf::JSONParser::Node* root, const char* name, amf::AMFVariant& val);
|
||||
bool GetVariantFromJSON(const amf::JSONParser::Node* element, amf::AMFVariant& val);
|
||||
|
||||
// variant value only; variant type assumed to be pre-set
|
||||
void CreateVariantValue(amf::JSONParser* parser, amf::JSONParser::Element** el, const amf::AMFVariant& value);
|
||||
bool GetVariantValueFromJSON(const amf::JSONParser::Element* element, amf::AMFVariant& val);
|
||||
}
|
||||
|
||||
class AMFInterfaceJSONSerializable : public amf::AMFInterface
|
||||
{
|
||||
public:
|
||||
// {EC40A26C-1345-4281-9B6C-362DDD6E05B5}
|
||||
AMF_DECLARE_IID(0xec40a26c, 0x1345, 0x4281, 0x9b, 0x6c, 0x36, 0x2d, 0xdd, 0x6e, 0x5, 0xb5)
|
||||
//
|
||||
virtual AMF_RESULT AMF_STD_CALL ToJson(amf::JSONParser* parser, amf::JSONParser::Node* node) const = 0;
|
||||
|
||||
//
|
||||
virtual AMF_RESULT AMF_STD_CALL FromJson(const amf::JSONParser::Node* node) = 0;
|
||||
};
|
||||
typedef AMFInterfacePtr_T<AMFInterfaceJSONSerializable> AMFInterfaceJSONSerializablePtr;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
AMF_RESULT AMF_CDECL_CALL CreateJSONParser(amf::JSONParser** parser);
|
||||
#define AMF_JSON_PARSER_FACTORY "CreateJSONParser"
|
||||
}
|
||||
1877
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/JsonImpl.cpp
vendored
Normal file
1877
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/JsonImpl.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
185
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/JsonImpl.h
vendored
Normal file
185
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/JsonImpl.h
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Json.h"
|
||||
#include "InterfaceImpl.h"
|
||||
#include <map>
|
||||
#include <ctime>
|
||||
|
||||
namespace amf
|
||||
{
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class JSONParserImpl :
|
||||
public AMFInterfaceImpl<JSONParser>
|
||||
{
|
||||
public:
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class ElementHelper
|
||||
{
|
||||
protected:
|
||||
ElementHelper();
|
||||
|
||||
Error CreateElement(const std::string& str, size_t start, size_t& valueStart, size_t& valueEnd, JSONParser::Element** val);
|
||||
size_t FindClosure(const std::string& str, char opener, char closer, size_t start);
|
||||
void InsertTabs(std::string& target, int count, const OutputFormatDesc& format) const;
|
||||
protected:
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class ValueImpl :
|
||||
public AMFInterfaceImpl<JSONParser::Value>,
|
||||
public ElementHelper
|
||||
{
|
||||
public:
|
||||
ValueImpl();
|
||||
|
||||
AMF_BEGIN_INTERFACE_MAP
|
||||
AMF_INTERFACE_ENTRY(JSONParser::Element)
|
||||
AMF_INTERFACE_ENTRY(JSONParser::Value)
|
||||
AMF_END_INTERFACE_MAP
|
||||
|
||||
|
||||
virtual JSONParser::Error Parse(const std::string& str, size_t start, size_t end);
|
||||
virtual std::string Stringify() const;
|
||||
virtual std::string StringifyFormatted(const OutputFormatDesc& format, int indent) const;
|
||||
|
||||
virtual void SetValue(const std::string& val);
|
||||
virtual void SetValueAsInt32(int32_t val);
|
||||
virtual void SetValueAsUInt32(uint32_t val);
|
||||
virtual void SetValueAsInt64(int64_t val);
|
||||
virtual void SetValueAsUInt64(uint64_t val);
|
||||
virtual void SetValueAsDouble(double val);
|
||||
virtual void SetValueAsFloat(float val);
|
||||
virtual void SetValueAsBool(bool val);
|
||||
virtual void SetValueAsTime(time_t date, bool utc);
|
||||
virtual void SetToNull();
|
||||
|
||||
virtual const std::string& GetValue() const;
|
||||
virtual int32_t GetValueAsInt32() const;
|
||||
virtual uint32_t GetValueAsUInt32() const;
|
||||
virtual int64_t GetValueAsInt64() const;
|
||||
virtual uint64_t GetValueAsUInt64() const;
|
||||
virtual double GetValueAsDouble() const;
|
||||
virtual float GetValueAsFloat() const;
|
||||
virtual bool GetValueAsBool() const;
|
||||
virtual time_t GetValueAsTime() const;
|
||||
virtual bool IsNull() const;
|
||||
|
||||
private:
|
||||
enum VALUE_TYPE
|
||||
{
|
||||
VT_Unknown = 0,
|
||||
VT_Null = 1,
|
||||
VT_Bool = 2,
|
||||
VT_String = 3,
|
||||
VT_Numeric = 4,
|
||||
};
|
||||
VALUE_TYPE m_eType;
|
||||
std::string m_Value;
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class NodeImpl :
|
||||
public AMFInterfaceImpl<JSONParser::Node>,
|
||||
public ElementHelper
|
||||
{
|
||||
public:
|
||||
typedef std::map<std::string, Element::Ptr> ElementMap;
|
||||
|
||||
AMF_BEGIN_INTERFACE_MAP
|
||||
AMF_INTERFACE_ENTRY(JSONParser::Element)
|
||||
AMF_INTERFACE_ENTRY(JSONParser::Node)
|
||||
AMF_END_INTERFACE_MAP
|
||||
|
||||
NodeImpl();
|
||||
|
||||
virtual JSONParser::Error Parse(const std::string& str, size_t start, size_t end);
|
||||
virtual std::string Stringify() const;
|
||||
virtual std::string StringifyFormatted(const OutputFormatDesc& format, int indent) const;
|
||||
|
||||
|
||||
virtual size_t GetElementCount() const;
|
||||
virtual JSONParser::Element* GetElementByName(const std::string& name) const;
|
||||
virtual JSONParser::Result AddElement(const std::string& name, JSONParser::Element* element);
|
||||
virtual JSONParser::Element* GetElementAt(size_t idx, std::string& name) const;
|
||||
|
||||
const ElementMap& GetElements() const { return m_Elements; }
|
||||
|
||||
private:
|
||||
ElementMap m_Elements;
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------
|
||||
class ArrayImpl :
|
||||
public AMFInterfaceImpl<JSONParser::Array>,
|
||||
public ElementHelper
|
||||
{
|
||||
public:
|
||||
typedef std::vector<Element::Ptr> ElementVector;
|
||||
|
||||
AMF_BEGIN_INTERFACE_MAP
|
||||
AMF_INTERFACE_ENTRY(JSONParser::Element)
|
||||
AMF_INTERFACE_ENTRY(JSONParser::Array)
|
||||
AMF_END_INTERFACE_MAP
|
||||
|
||||
ArrayImpl();
|
||||
|
||||
virtual JSONParser::Error Parse(const std::string& str, size_t start, size_t end);
|
||||
virtual std::string Stringify() const;
|
||||
virtual std::string StringifyFormatted(const OutputFormatDesc& format, int indent) const;
|
||||
|
||||
virtual size_t GetElementCount() const;
|
||||
virtual JSONParser::Element* GetElementAt(size_t idx) const;
|
||||
virtual void AddElement(Element* element);
|
||||
|
||||
private:
|
||||
ElementVector m_Elements;
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------
|
||||
JSONParserImpl();
|
||||
|
||||
virtual JSONParser::Result Parse(const std::string& str, Node** root);
|
||||
virtual std::string Stringify(const Node* root) const;
|
||||
virtual std::string StringifyFormatted(const Node* root, const OutputFormatDesc& format, int indent) const;
|
||||
|
||||
virtual size_t GetLastErrorOffset() const;
|
||||
|
||||
virtual Result CreateNode(Node** node) const;
|
||||
virtual Result CreateValue(Value** value) const;
|
||||
virtual Result CreateArray(Array** array) const;
|
||||
|
||||
private:
|
||||
size_t m_LastErrorOfs;
|
||||
};
|
||||
}
|
||||
90
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/CairoImportTable.cpp
vendored
Normal file
90
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/CairoImportTable.cpp
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
///-------------------------------------------------------------------------
|
||||
/// @file PulseAudioImprotTable.cpp
|
||||
/// @brief pulseaudio import table
|
||||
///-------------------------------------------------------------------------
|
||||
#include "CairoImportTable.h"
|
||||
#include "public/common/TraceAdapter.h"
|
||||
#include "../Thread.h"
|
||||
|
||||
using namespace amf;
|
||||
|
||||
#define GET_SO_ENTRYPOINT(m, h, f) m = reinterpret_cast<decltype(&f)>(amf_get_proc_address(h, #f)); \
|
||||
AMF_RETURN_IF_FALSE(nullptr != m, AMF_FAIL, L"Failed to acquire entrypoint %S", #f);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
CairoImportTable::CairoImportTable()
|
||||
{}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
CairoImportTable::~CairoImportTable()
|
||||
{
|
||||
UnloadFunctionsTable();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT CairoImportTable::LoadFunctionsTable()
|
||||
{
|
||||
if (nullptr == m_hLibCairoSO)
|
||||
{
|
||||
m_hLibCairoSO = amf_load_library(L"libcairo.so.2");
|
||||
AMF_RETURN_IF_FALSE(nullptr != m_hLibCairoSO, AMF_FAIL, L"Failed to load libcairo.so.2");
|
||||
}
|
||||
|
||||
GET_SO_ENTRYPOINT(m_cairo_image_surface_create_from_png_stream, m_hLibCairoSO, cairo_image_surface_create_from_png_stream);
|
||||
GET_SO_ENTRYPOINT(m_cairo_surface_destroy, m_hLibCairoSO, cairo_surface_destroy);
|
||||
GET_SO_ENTRYPOINT(m_cairo_image_surface_get_width, m_hLibCairoSO, cairo_image_surface_get_width);
|
||||
GET_SO_ENTRYPOINT(m_cairo_image_surface_get_height, m_hLibCairoSO, cairo_image_surface_get_height);
|
||||
GET_SO_ENTRYPOINT(m_cairo_image_surface_get_stride, m_hLibCairoSO, cairo_image_surface_get_stride);
|
||||
GET_SO_ENTRYPOINT(m_cairo_image_surface_get_format, m_hLibCairoSO, cairo_image_surface_get_format);
|
||||
GET_SO_ENTRYPOINT(m_cairo_image_surface_get_data, m_hLibCairoSO, cairo_image_surface_get_data);
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
void CairoImportTable::UnloadFunctionsTable()
|
||||
{
|
||||
if (nullptr != m_hLibCairoSO)
|
||||
{
|
||||
amf_free_library(m_hLibCairoSO);
|
||||
m_hLibCairoSO = nullptr;
|
||||
}
|
||||
|
||||
m_cairo_image_surface_create_from_png_stream = nullptr;
|
||||
m_cairo_surface_destroy = nullptr;
|
||||
m_cairo_image_surface_get_width = nullptr;
|
||||
m_cairo_image_surface_get_height = nullptr;
|
||||
m_cairo_image_surface_get_stride = nullptr;
|
||||
m_cairo_image_surface_get_format = nullptr;
|
||||
m_cairo_image_surface_get_data = nullptr;
|
||||
}
|
||||
63
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/CairoImportTable.h
vendored
Normal file
63
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/CairoImportTable.h
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
///-------------------------------------------------------------------------
|
||||
/// @file CairoImportTable.h
|
||||
/// @brief Cairo import table
|
||||
///-------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
#include "../../include/core/Result.h"
|
||||
|
||||
#include <memory>
|
||||
#include <cairo.h>
|
||||
|
||||
struct CairoImportTable{
|
||||
|
||||
CairoImportTable();
|
||||
~CairoImportTable();
|
||||
|
||||
AMF_RESULT LoadFunctionsTable();
|
||||
void UnloadFunctionsTable();
|
||||
|
||||
decltype(&cairo_image_surface_create_from_png_stream) m_cairo_image_surface_create_from_png_stream = nullptr;
|
||||
decltype(&cairo_surface_destroy) m_cairo_surface_destroy = nullptr;
|
||||
decltype(&cairo_image_surface_get_width) m_cairo_image_surface_get_width = nullptr;
|
||||
decltype(&cairo_image_surface_get_height) m_cairo_image_surface_get_height = nullptr;
|
||||
decltype(&cairo_image_surface_get_stride) m_cairo_image_surface_get_stride = nullptr;
|
||||
decltype(&cairo_image_surface_get_format) m_cairo_image_surface_get_format = nullptr;
|
||||
decltype(&cairo_image_surface_get_data) m_cairo_image_surface_get_data = nullptr;
|
||||
|
||||
amf_handle m_hLibCairoSO = nullptr;
|
||||
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<CairoImportTable> CairoImportTablePtr;
|
||||
309
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/DRMDevice.cpp
vendored
Normal file
309
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/DRMDevice.cpp
vendored
Normal file
@@ -0,0 +1,309 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; AV1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
#include "DRMDevice.h"
|
||||
#include <drm.h>
|
||||
#include <drm_fourcc.h>
|
||||
#include <drm_mode.h>
|
||||
#include <amdgpu_drm.h>
|
||||
#include <xf86drm.h>
|
||||
#include <xf86drmMode.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define AMF_FACILITY L"DRMDevice"
|
||||
|
||||
struct FormatMapEntry
|
||||
{
|
||||
amf::AMF_SURFACE_FORMAT formatAMF;
|
||||
uint32_t formatDRM;
|
||||
};
|
||||
static const FormatMapEntry formatMap [] =
|
||||
{
|
||||
#ifdef DRM_FORMAT_R8
|
||||
{ amf::AMF_SURFACE_GRAY8, DRM_FORMAT_R8 },
|
||||
#endif
|
||||
#ifdef DRM_FORMAT_R16
|
||||
// { , DRM_FORMAT_R16 },
|
||||
// { , DRM_FORMAT_R16 | DRM_FORMAT_BIG_ENDIAN },
|
||||
#endif
|
||||
// { , DRM_FORMAT_BGR233 },
|
||||
// { , DRM_FORMAT_XRGB1555 },
|
||||
// { , DRM_FORMAT_XRGB1555 | DRM_FORMAT_BIG_ENDIAN },
|
||||
// { , DRM_FORMAT_XBGR1555 },
|
||||
// { , DRM_FORMAT_XBGR1555 | DRM_FORMAT_BIG_ENDIAN },
|
||||
// { , DRM_FORMAT_RGB565 },
|
||||
// { , DRM_FORMAT_RGB565 | DRM_FORMAT_BIG_ENDIAN },
|
||||
// { , DRM_FORMAT_BGR565 },
|
||||
// { , DRM_FORMAT_BGR565 | DRM_FORMAT_BIG_ENDIAN },
|
||||
// { , DRM_FORMAT_RGB888 },
|
||||
// { , DRM_FORMAT_BGR888 },
|
||||
{ amf::AMF_SURFACE_BGRA, DRM_FORMAT_BGRX8888 },
|
||||
{ amf::AMF_SURFACE_RGBA, DRM_FORMAT_RGBX8888 },
|
||||
{ amf::AMF_SURFACE_BGRA, DRM_FORMAT_XBGR8888 },
|
||||
{ amf::AMF_SURFACE_BGRA /*AMF_SURFACE_ARGB*/, DRM_FORMAT_XRGB8888 },
|
||||
{ amf::AMF_SURFACE_RGBA, DRM_FORMAT_BGRA8888 },
|
||||
{ amf::AMF_SURFACE_ARGB, DRM_FORMAT_ARGB8888 },
|
||||
{ amf::AMF_SURFACE_YUY2, DRM_FORMAT_YUYV },
|
||||
// { , DRM_FORMAT_YVYU },
|
||||
{ amf::AMF_SURFACE_UYVY, DRM_FORMAT_UYVY },
|
||||
};
|
||||
|
||||
amf::AMF_SURFACE_FORMAT AMF_STD_CALL FromDRMtoAMF(uint32_t formatDRM)
|
||||
{
|
||||
for(int i = 0; i < amf_countof(formatMap); i++)
|
||||
{
|
||||
if(formatMap[i].formatDRM == formatDRM)
|
||||
{
|
||||
return formatMap[i].formatAMF;
|
||||
}
|
||||
}
|
||||
return amf::AMF_SURFACE_UNKNOWN;
|
||||
}
|
||||
|
||||
drmModeFB2Ptr AMF_STD_CALL AMFdrmModeGetFB2(int fd, uint32_t fb_id)
|
||||
{
|
||||
struct drm_mode_fb_cmd2 get = {
|
||||
.fb_id = fb_id,
|
||||
};
|
||||
drmModeFB2Ptr ret;
|
||||
int err;
|
||||
|
||||
err = drmIoctl(fd, DRM_IOCTL_MODE_GETFB2, &get);
|
||||
if (err != 0)
|
||||
return NULL;
|
||||
|
||||
ret = (drmModeFB2Ptr)drmMalloc(sizeof(drmModeFB2));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->fb_id = fb_id;
|
||||
ret->width = get.width;
|
||||
ret->height = get.height;
|
||||
ret->pixel_format = get.pixel_format;
|
||||
ret->flags = get.flags;
|
||||
ret->modifier = get.modifier[0];
|
||||
memcpy(ret->handles, get.handles, sizeof(uint32_t) * 4);
|
||||
memcpy(ret->pitches, get.pitches, sizeof(uint32_t) * 4);
|
||||
memcpy(ret->offsets, get.offsets, sizeof(uint32_t) * 4);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void AMF_STD_CALL AMFdrmModeFreeFB2(drmModeFB2Ptr ptr)
|
||||
{
|
||||
drmFree(ptr);
|
||||
}
|
||||
|
||||
DRMDevice::DRMDevice() {}
|
||||
|
||||
DRMDevice::~DRMDevice()
|
||||
{
|
||||
Terminate();
|
||||
}
|
||||
|
||||
AMF_RESULT AMF_STD_CALL DRMDevice::InitFromVulkan(int pciDomain, int pciBus, int pciDevice, int pciFunction)
|
||||
{
|
||||
int dirfd = open("/dev/dri/by-path", O_RDONLY);
|
||||
AMF_RETURN_IF_FALSE(dirfd != -1, AMF_FAIL, L"Couldn't open /dev/dri/by-path")
|
||||
DIR *pDir = fdopendir(dirfd);
|
||||
if (pDir == nullptr)
|
||||
{
|
||||
close(dirfd);
|
||||
return AMF_FAIL;
|
||||
}
|
||||
|
||||
struct dirent *entry;
|
||||
while ((entry = readdir(pDir)) != NULL)
|
||||
{
|
||||
int entryDomain = -1, entryBus = -1, entryDevice = -1, entryFunction = -1, length = -1;
|
||||
|
||||
int res = sscanf(entry->d_name, "pci-%x:%x:%x.%x-card%n",
|
||||
&entryDomain, &entryBus, &entryDevice, &entryFunction, &length);
|
||||
//check if matches pattern
|
||||
if (res != 4 || length != strlen(entry->d_name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (entryDomain == pciDomain && entryBus == pciBus && entryDevice == pciDevice && entryFunction == pciFunction)
|
||||
{
|
||||
m_fd = openat(dirfd, entry->d_name, O_RDWR | O_CLOEXEC);
|
||||
m_pathToCard = entry->d_name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
closedir(pDir); //implicitly closes dirfd
|
||||
if (m_fd < 0)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
return SetupDevice();
|
||||
}
|
||||
|
||||
AMF_RESULT AMF_STD_CALL DRMDevice::InitFromPath(const char* pathToCard)
|
||||
{
|
||||
m_fd = open(pathToCard, O_RDWR | O_CLOEXEC);
|
||||
m_pathToCard = pathToCard;
|
||||
|
||||
if (m_fd < 0)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
return SetupDevice();
|
||||
}
|
||||
|
||||
AMF_RESULT DRMDevice::SetupDevice()
|
||||
{
|
||||
drmVersionPtr version = drmGetVersion(m_fd);
|
||||
AMF_RETURN_IF_FALSE(version != nullptr, AMF_FAIL, L"drmGetVersion() failed from %S", m_pathToCard.c_str());
|
||||
|
||||
AMFTraceDebug(AMF_FACILITY, L"Opened DRM device %S: driver name %S version %d.%d.%d", m_pathToCard.c_str(), version->name,
|
||||
version->version_major, version->version_minor, version->version_patchlevel);
|
||||
|
||||
drmFreeVersion(version);
|
||||
|
||||
uint64_t valueExport = 0;
|
||||
int err = drmGetCap(m_fd, DRM_PRIME_CAP_EXPORT, &valueExport);
|
||||
|
||||
err = drmSetClientCap(m_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
|
||||
if (err < 0)
|
||||
{
|
||||
AMFTraceWarning(AMF_FACILITY, L"drmSetClientCap(DRM_CLIENT_CAP_UNIVERSAL_PLANES) Failed with %d", err);
|
||||
}
|
||||
drmSetClientCap(m_fd, DRM_CLIENT_CAP_ATOMIC, 1);
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
AMF_RESULT AMF_STD_CALL DRMDevice::Terminate()
|
||||
{
|
||||
if (m_fd >= 0)
|
||||
{
|
||||
close(m_fd);
|
||||
m_fd = -1;
|
||||
}
|
||||
m_pathToCard = "";
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
int AMF_STD_CALL DRMDevice::GetFD() const
|
||||
{
|
||||
return m_fd;
|
||||
}
|
||||
|
||||
std::string AMF_STD_CALL DRMDevice::GetPathToCard() const
|
||||
{
|
||||
return m_pathToCard;
|
||||
}
|
||||
|
||||
AMF_RESULT AMF_STD_CALL DRMDevice::GetCRTCs(std::vector<DRMCRTC>& crtcs) const
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(m_fd >= 0, AMF_FAIL, L"Not Initialized");
|
||||
|
||||
AMFdrmModeResPtr resources = drmModeGetResources(m_fd);
|
||||
AMF_RETURN_IF_FALSE(resources.p != nullptr, AMF_FAIL, L"drmModeGetResources() return nullptr");
|
||||
|
||||
crtcs.clear();
|
||||
for(int i = 0; i < resources.p->count_crtcs; i ++)
|
||||
{
|
||||
AMFdrmModeCrtcPtr crtc = drmModeGetCrtc(m_fd, resources.p->crtcs[i]);
|
||||
|
||||
AMFRect crop = {};
|
||||
amf::AMF_SURFACE_FORMAT formatAMF = amf::AMF_SURFACE_UNKNOWN;
|
||||
int formatDRM = 0;
|
||||
int handle = 0;
|
||||
if(GetCrtcInfo(crtc, crop, formatDRM, formatAMF, handle) != AMF_OK)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
AMFTraceDebug(AMF_FACILITY, L" CRTC id=%d fb=%d crop(%d,%d,%d,%d)", crtc.p->crtc_id, crtc.p->buffer_id, crop.left, crop.top, crop.right, crop.bottom);
|
||||
|
||||
DRMCRTC drmCrtc = {};
|
||||
drmCrtc.crtcID = crtc.p->crtc_id;
|
||||
drmCrtc.fbID = crtc.p->buffer_id;
|
||||
drmCrtc.crop = crop;
|
||||
drmCrtc.formatDRM = formatDRM;
|
||||
drmCrtc.formatAMF = formatAMF;
|
||||
drmCrtc.handle = handle;
|
||||
crtcs.push_back(drmCrtc);
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
|
||||
AMF_RESULT AMF_STD_CALL DRMDevice::GetCrtcInfo(const AMFdrmModeCrtcPtr& crtc, AMFRect &crop, int& formatDRM, amf::AMF_SURFACE_FORMAT& formatAMF, int& handle) const
|
||||
{
|
||||
if(crtc.p == nullptr)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
if(crtc.p->buffer_id == 0)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
// check if active
|
||||
AMFdrmModeObjectPropertiesPtr properties = drmModeObjectGetProperties (m_fd, crtc.p->crtc_id, DRM_MODE_OBJECT_CRTC);
|
||||
if(properties.p == nullptr)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
|
||||
for(int k = 0; k < properties.p->count_props; k++)
|
||||
{
|
||||
AMFdrmModePropertyPtr prop = drmModeGetProperty(m_fd, properties.p->props[k]);
|
||||
|
||||
if(std::string(prop.p->name) == "ACTIVE" && properties.p->prop_values[k] == 0)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
}
|
||||
// check FB
|
||||
|
||||
AMFdrmModeFB2Ptr fb2 = AMFdrmModeGetFB2(m_fd, crtc.p->buffer_id);
|
||||
if(fb2.p == nullptr)
|
||||
{
|
||||
return AMF_FAIL;
|
||||
}
|
||||
|
||||
crop.left = crtc.p->x;
|
||||
crop.top = crtc.p->y;
|
||||
crop.right = crtc.p->x + crtc.p->width;
|
||||
crop.bottom = crtc.p->y + crtc.p->height;
|
||||
formatDRM = fb2.p->pixel_format;
|
||||
formatAMF= FromDRMtoAMF(fb2.p->pixel_format);
|
||||
handle = fb2.p->handles[0];
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
123
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/DRMDevice.h
vendored
Normal file
123
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/DRMDevice.h
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; AV1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "public/common/TraceAdapter.h"
|
||||
#include "public/include/core/Surface.h"
|
||||
|
||||
#include <drm.h>
|
||||
#include <drm_fourcc.h>
|
||||
#include <drm_mode.h>
|
||||
#include <amdgpu_drm.h>
|
||||
#include <xf86drm.h>
|
||||
#include <xf86drmMode.h>
|
||||
|
||||
// These classed provide a nice interface to a DRM card using libdrm
|
||||
|
||||
amf::AMF_SURFACE_FORMAT AMF_STD_CALL FromDRMtoAMF(uint32_t formatDRM);
|
||||
drmModeFB2Ptr AMF_STD_CALL AMFdrmModeGetFB2(int fd, uint32_t fb_id);
|
||||
void AMF_STD_CALL AMFdrmModeFreeFB2(drmModeFB2Ptr ptr);
|
||||
|
||||
template <class type, void function(type)>
|
||||
class AMFAutoDRMPtr
|
||||
{
|
||||
public:
|
||||
AMFAutoDRMPtr() : p(nullptr){}
|
||||
AMFAutoDRMPtr(type ptr) : p(ptr){}
|
||||
~AMFAutoDRMPtr()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
AMFAutoDRMPtr<type, function>& operator=(type ptr)
|
||||
{
|
||||
if(p != ptr)
|
||||
{
|
||||
Clear();
|
||||
p = ptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
void Clear()
|
||||
{
|
||||
if(p != nullptr)
|
||||
{
|
||||
function(p);
|
||||
p = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
type p;
|
||||
|
||||
private:
|
||||
AMFAutoDRMPtr<type, function>& operator=(const AMFAutoDRMPtr<type, function>& other);
|
||||
};
|
||||
|
||||
typedef AMFAutoDRMPtr<drmModePlanePtr, drmModeFreePlane> AMFdrmModePlanePtr;
|
||||
typedef AMFAutoDRMPtr<drmModeFBPtr, drmModeFreeFB> AMFdrmModeFBPtr;
|
||||
typedef AMFAutoDRMPtr<drmModeFB2Ptr, AMFdrmModeFreeFB2> AMFdrmModeFB2Ptr;
|
||||
typedef AMFAutoDRMPtr<drmModePlaneResPtr, drmModeFreePlaneResources> AMFdrmModePlaneResPtr;
|
||||
typedef AMFAutoDRMPtr<drmModeObjectPropertiesPtr, drmModeFreeObjectProperties> AMFdrmModeObjectPropertiesPtr;
|
||||
typedef AMFAutoDRMPtr<drmModePropertyPtr, drmModeFreeProperty> AMFdrmModePropertyPtr;
|
||||
typedef AMFAutoDRMPtr<drmModeCrtcPtr, drmModeFreeCrtc> AMFdrmModeCrtcPtr;
|
||||
typedef AMFAutoDRMPtr<drmModeResPtr, drmModeFreeResources> AMFdrmModeResPtr;
|
||||
|
||||
struct DRMCRTC {
|
||||
int crtcID;
|
||||
int fbID;
|
||||
AMFRect crop;
|
||||
int formatDRM;
|
||||
amf::AMF_SURFACE_FORMAT formatAMF;
|
||||
int handle;
|
||||
};
|
||||
|
||||
class DRMDevice {
|
||||
public:
|
||||
DRMDevice();
|
||||
~DRMDevice();
|
||||
|
||||
AMF_RESULT AMF_STD_CALL InitFromVulkan(int pciDomain, int pciBus, int pciDevice, int pciFunction);
|
||||
AMF_RESULT AMF_STD_CALL InitFromPath(const char* pathToCard);
|
||||
|
||||
AMF_RESULT AMF_STD_CALL Terminate();
|
||||
|
||||
int AMF_STD_CALL GetFD() const;
|
||||
std::string AMF_STD_CALL GetPathToCard() const;
|
||||
|
||||
AMF_RESULT AMF_STD_CALL GetCRTCs(std::vector<DRMCRTC>& crtcs) const;
|
||||
AMF_RESULT AMF_STD_CALL GetCrtcInfo(const AMFdrmModeCrtcPtr& crtc, AMFRect &crop, int& formatDRM, amf::AMF_SURFACE_FORMAT& formatAMF, int& handle) const;
|
||||
private:
|
||||
AMF_RESULT SetupDevice();
|
||||
|
||||
int m_fd = -1;
|
||||
std::string m_pathToCard;
|
||||
};
|
||||
155
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/PulseAudioImportTable.cpp
vendored
Normal file
155
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/PulseAudioImportTable.cpp
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
///-------------------------------------------------------------------------
|
||||
/// @file PulseAudioImprotTable.cpp
|
||||
/// @brief pulseaudio import table
|
||||
///-------------------------------------------------------------------------
|
||||
#include "PulseAudioImportTable.h"
|
||||
#include "public/common/TraceAdapter.h"
|
||||
#include "../Thread.h"
|
||||
|
||||
using namespace amf;
|
||||
|
||||
#define GET_SO_ENTRYPOINT(m, h, f) m = reinterpret_cast<decltype(&f)>(amf_get_proc_address(h, #f)); \
|
||||
AMF_RETURN_IF_FALSE(nullptr != m, AMF_FAIL, L"Failed to acquire entrypoint %S", #f);
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
PulseAudioImportTable::PulseAudioImportTable()
|
||||
{}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
PulseAudioImportTable::~PulseAudioImportTable()
|
||||
{
|
||||
UnloadFunctionsTable();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT PulseAudioImportTable::LoadFunctionsTable()
|
||||
{
|
||||
// Load pulseaudio simple api shared library and pulseaudio shared library.
|
||||
if (nullptr == m_hLibPulseSimpleSO)
|
||||
{
|
||||
m_hLibPulseSimpleSO = amf_load_library(L"libpulse-simple.so.0");
|
||||
AMF_RETURN_IF_FALSE(nullptr != m_hLibPulseSimpleSO, AMF_FAIL, L"Failed to load libpulse-simple.so.0");
|
||||
}
|
||||
|
||||
if (nullptr == m_hLibPulseSO)
|
||||
{
|
||||
m_hLibPulseSO = amf_load_library(L"libpulse.so.0");
|
||||
AMF_RETURN_IF_FALSE(nullptr != m_hLibPulseSO, AMF_FAIL, L"Failed to load libpulse.so.0");
|
||||
}
|
||||
|
||||
// Load pulseaudio mainloop functions.
|
||||
GET_SO_ENTRYPOINT(m_pPA_Mainloop_Free, m_hLibPulseSO, pa_mainloop_free);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Mainloop_New, m_hLibPulseSO, pa_mainloop_new);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Mainloop_Quit, m_hLibPulseSO, pa_mainloop_quit);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Mainloop_Get_API, m_hLibPulseSO, pa_mainloop_get_api);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Mainloop_Run, m_hLibPulseSO, pa_mainloop_run);
|
||||
|
||||
// Load pulseaudio context functions.
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_Unref, m_hLibPulseSO, pa_context_unref);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_Load_Module, m_hLibPulseSO, pa_context_load_module);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_Unload_Module, m_hLibPulseSO, pa_context_unload_module);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_New, m_hLibPulseSO, pa_context_new);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_Get_State, m_hLibPulseSO, pa_context_get_state);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_Set_State_Callback, m_hLibPulseSO, pa_context_set_state_callback);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_Get_Server_Info, m_hLibPulseSO, pa_context_get_server_info);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_Connect, m_hLibPulseSO, pa_context_connect);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_Disconnect, m_hLibPulseSO, pa_context_disconnect);
|
||||
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_Get_Sink_Info_By_Name, m_hLibPulseSO, pa_context_get_sink_info_by_name);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_Get_Sink_Info_List, m_hLibPulseSO, pa_context_get_sink_info_list);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Context_Get_Source_Info_List, m_hLibPulseSO, pa_context_get_source_info_list);
|
||||
|
||||
// Load other pulse audio functions.
|
||||
GET_SO_ENTRYPOINT(m_pPA_Operation_Unref, m_hLibPulseSO, pa_operation_unref);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Strerror, m_hLibPulseSO, pa_strerror);
|
||||
|
||||
// Load pulse audio simple api functions.
|
||||
GET_SO_ENTRYPOINT(m_pPA_Simple_New, m_hLibPulseSimpleSO, pa_simple_new);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Simple_Free, m_hLibPulseSimpleSO, pa_simple_free);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Simple_Write, m_hLibPulseSimpleSO, pa_simple_write);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Simple_Read, m_hLibPulseSimpleSO, pa_simple_read);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Simple_Flush, m_hLibPulseSimpleSO, pa_simple_flush);
|
||||
GET_SO_ENTRYPOINT(m_pPA_Simple_Get_Latency, m_hLibPulseSimpleSO, pa_simple_get_latency);
|
||||
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
void PulseAudioImportTable::UnloadFunctionsTable()
|
||||
{
|
||||
if (nullptr != m_hLibPulseSimpleSO)
|
||||
{
|
||||
amf_free_library(m_hLibPulseSimpleSO);
|
||||
m_hLibPulseSO = nullptr;
|
||||
}
|
||||
|
||||
if (nullptr != m_hLibPulseSO)
|
||||
{
|
||||
amf_free_library(m_hLibPulseSO);
|
||||
m_hLibPulseSO = nullptr;
|
||||
}
|
||||
|
||||
m_pPA_Mainloop_Free = nullptr;
|
||||
m_pPA_Mainloop_Quit = nullptr;
|
||||
m_pPA_Mainloop_New = nullptr;
|
||||
m_pPA_Mainloop_Get_API = nullptr;
|
||||
m_pPA_Mainloop_Run = nullptr;
|
||||
|
||||
// Context functions.
|
||||
m_pPA_Context_Unref = nullptr;
|
||||
m_pPA_Context_Load_Module = nullptr;
|
||||
m_pPA_Context_Unload_Module = nullptr;
|
||||
m_pPA_Context_New = nullptr;
|
||||
m_pPA_Context_Get_State = nullptr;
|
||||
m_pPA_Context_Set_State_Callback = nullptr;
|
||||
m_pPA_Context_Get_Server_Info = nullptr;
|
||||
m_pPA_Context_Connect = nullptr;
|
||||
m_pPA_Context_Disconnect = nullptr;
|
||||
|
||||
m_pPA_Context_Get_Sink_Info_By_Name = nullptr;
|
||||
m_pPA_Context_Get_Sink_Info_List = nullptr;
|
||||
m_pPA_Context_Get_Source_Info_List = nullptr;
|
||||
|
||||
// Others
|
||||
m_pPA_Operation_Unref = nullptr;
|
||||
m_pPA_Strerror = nullptr;
|
||||
|
||||
// PulseAudio Simple API functions.
|
||||
m_pPA_Simple_New = nullptr;
|
||||
m_pPA_Simple_Free = nullptr;
|
||||
m_pPA_Simple_Write = nullptr;
|
||||
m_pPA_Simple_Read = nullptr;
|
||||
m_pPA_Simple_Flush = nullptr;
|
||||
m_pPA_Simple_Get_Latency = nullptr;
|
||||
}
|
||||
91
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/PulseAudioImportTable.h
vendored
Normal file
91
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/PulseAudioImportTable.h
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
///-------------------------------------------------------------------------
|
||||
/// @file PulseAudioImportTable.h
|
||||
/// @brief pulseaudio import table
|
||||
///-------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
#include "../../include/core/Result.h"
|
||||
|
||||
#include <memory>
|
||||
#include <pulse/simple.h>
|
||||
#include <pulse/pulseaudio.h>
|
||||
|
||||
struct PulseAudioImportTable{
|
||||
|
||||
PulseAudioImportTable();
|
||||
~PulseAudioImportTable();
|
||||
|
||||
AMF_RESULT LoadFunctionsTable();
|
||||
void UnloadFunctionsTable();
|
||||
|
||||
// PulseAudio functions.
|
||||
// Mainloop functions.
|
||||
decltype(&pa_mainloop_free) m_pPA_Mainloop_Free = nullptr;
|
||||
decltype(&pa_mainloop_quit) m_pPA_Mainloop_Quit = nullptr;
|
||||
decltype(&pa_mainloop_new) m_pPA_Mainloop_New = nullptr;
|
||||
decltype(&pa_mainloop_get_api) m_pPA_Mainloop_Get_API = nullptr;
|
||||
decltype(&pa_mainloop_run) m_pPA_Mainloop_Run = nullptr;
|
||||
|
||||
// Context functions.
|
||||
decltype(&pa_context_unref) m_pPA_Context_Unref = nullptr;
|
||||
decltype(&pa_context_load_module) m_pPA_Context_Load_Module = nullptr;
|
||||
decltype(&pa_context_unload_module) m_pPA_Context_Unload_Module = nullptr;
|
||||
decltype(&pa_context_new) m_pPA_Context_New = nullptr;
|
||||
decltype(&pa_context_get_state) m_pPA_Context_Get_State = nullptr;
|
||||
decltype(&pa_context_set_state_callback) m_pPA_Context_Set_State_Callback = nullptr;
|
||||
decltype(&pa_context_get_server_info) m_pPA_Context_Get_Server_Info = nullptr;
|
||||
decltype(&pa_context_connect) m_pPA_Context_Connect = nullptr;
|
||||
decltype(&pa_context_disconnect) m_pPA_Context_Disconnect = nullptr;
|
||||
|
||||
decltype(&pa_context_get_sink_info_by_name) m_pPA_Context_Get_Sink_Info_By_Name = nullptr;
|
||||
decltype(&pa_context_get_sink_info_list) m_pPA_Context_Get_Sink_Info_List = nullptr;
|
||||
decltype(&pa_context_get_source_info_list) m_pPA_Context_Get_Source_Info_List = nullptr;
|
||||
|
||||
// Others
|
||||
decltype(&pa_operation_unref) m_pPA_Operation_Unref = nullptr;
|
||||
decltype(&pa_strerror) m_pPA_Strerror = nullptr;
|
||||
|
||||
// PulseAudio Simple API functions.
|
||||
decltype(&pa_simple_new) m_pPA_Simple_New = nullptr;
|
||||
decltype(&pa_simple_free) m_pPA_Simple_Free = nullptr;
|
||||
decltype(&pa_simple_write) m_pPA_Simple_Write = nullptr;
|
||||
decltype(&pa_simple_read) m_pPA_Simple_Read = nullptr;
|
||||
decltype(&pa_simple_flush) m_pPA_Simple_Flush = nullptr;
|
||||
decltype(&pa_simple_get_latency) m_pPA_Simple_Get_Latency = nullptr;
|
||||
|
||||
amf_handle m_hLibPulseSO = nullptr;
|
||||
amf_handle m_hLibPulseSimpleSO = nullptr;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<PulseAudioImportTable> PulseAudioImportTablePtr;
|
||||
757
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/ThreadLinux.cpp
vendored
Normal file
757
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/ThreadLinux.cpp
vendored
Normal file
@@ -0,0 +1,757 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "../Thread.h"
|
||||
|
||||
|
||||
#if defined (__linux) || (__APPLE__)
|
||||
|
||||
#if defined(__GNUC__)
|
||||
//disable gcc warinings on STL code
|
||||
#pragma GCC diagnostic ignored "-Weffc++"
|
||||
#endif
|
||||
|
||||
#define POSIX
|
||||
|
||||
#include <locale>
|
||||
#include <algorithm>
|
||||
#include <dirent.h>
|
||||
#include <fnmatch.h>
|
||||
#include <pwd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <dlfcn.h>
|
||||
#include <sys/time.h>
|
||||
#include <fstream>
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <semaphore.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include "../AMFSTL.h"
|
||||
|
||||
using namespace amf;
|
||||
|
||||
extern "C" void AMF_STD_CALL amf_debug_trace(const wchar_t* text);
|
||||
|
||||
|
||||
void perror(const char* errorModule)
|
||||
{
|
||||
char buf[128];
|
||||
#if defined(__ANDROID__) || (__APPLE__)
|
||||
strerror_r(errno, buf, sizeof(buf));
|
||||
fprintf(stderr, "%s: %s", buf, errorModule);
|
||||
#else
|
||||
char* err = strerror_r(errno, buf, sizeof(buf));
|
||||
fprintf(stderr, "%s: %s", err, errorModule);
|
||||
#endif
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
amf_uint64 AMF_STD_CALL get_current_thread_id()
|
||||
{
|
||||
return reinterpret_cast<amf_uint64>(pthread_self());
|
||||
}
|
||||
#else
|
||||
amf_uint32 AMF_STD_CALL get_current_thread_id()
|
||||
{
|
||||
return static_cast<amf_uint32>(pthread_self());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// int clock_gettime(clockid_t clk_id, struct timespec *tp);
|
||||
//----------------------------------------------------------------------------------------
|
||||
// threading
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_long AMF_STD_CALL amf_atomic_inc(amf_long* X)
|
||||
{
|
||||
return __sync_add_and_fetch(X, 1);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_long AMF_STD_CALL amf_atomic_dec(amf_long* X)
|
||||
{
|
||||
return __sync_sub_and_fetch(X, 1);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_handle AMF_STD_CALL amf_create_critical_section()
|
||||
{
|
||||
pthread_mutex_t* mutex = new pthread_mutex_t;
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(mutex, &attr);
|
||||
|
||||
return (amf_handle)mutex;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_delete_critical_section(amf_handle cs)
|
||||
{
|
||||
if(cs == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
pthread_mutex_t* mutex = (pthread_mutex_t*)cs;
|
||||
int err = pthread_mutex_destroy(mutex);
|
||||
delete mutex;
|
||||
return err == 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_enter_critical_section(amf_handle cs)
|
||||
{
|
||||
if(cs == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
pthread_mutex_t* mutex = (pthread_mutex_t*)cs;
|
||||
return pthread_mutex_lock(mutex) == 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_wait_critical_section(amf_handle cs, amf_ulong ulTimeout)
|
||||
{
|
||||
if(cs == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return amf_wait_for_mutex(cs, ulTimeout);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_leave_critical_section(amf_handle cs)
|
||||
{
|
||||
if(cs == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
pthread_mutex_t* mutex = (pthread_mutex_t*)cs;
|
||||
return pthread_mutex_unlock(mutex) == 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
struct MyEvent
|
||||
{
|
||||
bool m_manual_reset;
|
||||
pthread_cond_t m_cond;
|
||||
pthread_mutex_t m_mutex;
|
||||
bool m_triggered;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
amf_handle AMF_STD_CALL amf_create_event(bool initially_owned, bool manual_reset, const wchar_t* name)
|
||||
{
|
||||
MyEvent* event = new MyEvent;
|
||||
|
||||
|
||||
// Linux does not natively support Named Condition variables
|
||||
// so raise an error.
|
||||
// Implement this using boost (NamedCondition), Qt, or some other framework.
|
||||
if(name != NULL)
|
||||
{
|
||||
perror("Named Events not supported under Linux yet");
|
||||
exit(1);
|
||||
}
|
||||
event->m_manual_reset = manual_reset;
|
||||
pthread_cond_t cond_tmp = PTHREAD_COND_INITIALIZER;
|
||||
event->m_cond = cond_tmp;
|
||||
pthread_mutex_t mutex_tmp = PTHREAD_MUTEX_INITIALIZER;
|
||||
event->m_mutex = mutex_tmp;
|
||||
|
||||
event->m_triggered = false;
|
||||
if(initially_owned)
|
||||
{
|
||||
amf_set_event((amf_handle)event);
|
||||
}
|
||||
|
||||
return (amf_handle)event;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_delete_event(amf_handle hevent)
|
||||
{
|
||||
if(hevent == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
MyEvent* event = (MyEvent*)hevent;
|
||||
int err1 = pthread_mutex_destroy(&event->m_mutex);
|
||||
int err2 = pthread_cond_destroy(&event->m_cond);
|
||||
delete event;
|
||||
return err1 == 0 && err2 == 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_set_event(amf_handle hevent)
|
||||
{
|
||||
if(hevent == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
MyEvent* event = (MyEvent*)hevent;
|
||||
pthread_mutex_lock(&event->m_mutex);
|
||||
event->m_triggered = true;
|
||||
int err1 = pthread_cond_broadcast(&event->m_cond);
|
||||
pthread_mutex_unlock(&event->m_mutex);
|
||||
|
||||
return err1 == 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_reset_event(amf_handle hevent)
|
||||
{
|
||||
if(hevent == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
MyEvent* event = (MyEvent*)hevent;
|
||||
pthread_mutex_lock(&event->m_mutex);
|
||||
event->m_triggered = false;
|
||||
int err = pthread_mutex_unlock(&event->m_mutex);
|
||||
|
||||
return err == 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
static bool AMF_STD_CALL amf_wait_for_event_int(amf_handle hevent, unsigned long timeout, bool bTimeoutErr)
|
||||
{
|
||||
if(hevent == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool ret = true;
|
||||
int err = 0;
|
||||
MyEvent* event = (MyEvent*)hevent;
|
||||
pthread_mutex_lock(&event->m_mutex);
|
||||
|
||||
timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
amf_uint64 start_time = ((amf_uint64)ts.tv_sec) * 1000 + ((amf_uint64)ts.tv_nsec) / 1000000; //to msec
|
||||
|
||||
if(event->m_manual_reset)
|
||||
{
|
||||
while(!event->m_triggered)
|
||||
{
|
||||
if(timeout == AMF_INFINITE)
|
||||
{
|
||||
err = pthread_cond_wait(&event->m_cond, &event->m_mutex); //MM todo - timeout is not supported
|
||||
ret = err == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
amf_uint64 current_time = ((amf_uint64)ts.tv_sec) * 1000 + ((amf_uint64)ts.tv_nsec) / 1000000; //to msec
|
||||
if(current_time - start_time > (amf_uint64)timeout)
|
||||
{
|
||||
ret = bTimeoutErr ? false : true;
|
||||
break;
|
||||
}
|
||||
amf_uint64 to_wait = start_time + timeout;
|
||||
|
||||
timespec abstime;
|
||||
abstime.tv_sec = (time_t)(to_wait / 1000); // timeout is in millisec
|
||||
abstime.tv_nsec = (time_t)((to_wait - ((amf_uint64)abstime.tv_sec) * 1000) * 1000000); // the rest to nanosec
|
||||
|
||||
err = pthread_cond_timedwait(&event->m_cond, &event->m_mutex, &abstime);
|
||||
ret = err == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(event->m_triggered)
|
||||
{
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (timeout == AMF_INFINITE) {
|
||||
err = pthread_cond_wait(&event->m_cond, &event->m_mutex);
|
||||
} else {
|
||||
start_time += timeout;
|
||||
timespec abstime;
|
||||
abstime.tv_sec = (time_t) (start_time / 1000); // timeout is in millisec
|
||||
abstime.tv_nsec = (time_t) ((start_time - (amf_uint64) (abstime.tv_sec) * 1000) *
|
||||
1000000); // the rest to nanosec
|
||||
err = pthread_cond_timedwait(&event->m_cond, &event->m_mutex, &abstime);
|
||||
}
|
||||
|
||||
if (bTimeoutErr) {
|
||||
ret = (err == 0);
|
||||
} else {
|
||||
ret = (err == 0 || err == ETIMEDOUT);
|
||||
}
|
||||
}
|
||||
if(ret == true)
|
||||
{
|
||||
event->m_triggered = false;
|
||||
}
|
||||
}
|
||||
pthread_mutex_unlock(&event->m_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_wait_for_event(amf_handle hevent, unsigned long timeout)
|
||||
{
|
||||
return amf_wait_for_event_int(hevent, timeout, true);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_wait_for_event_timeout(amf_handle hevent, amf_ulong ulTimeout)
|
||||
{
|
||||
return amf_wait_for_event_int(hevent, ulTimeout, false);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_handle AMF_STD_CALL amf_create_mutex(bool initially_owned, const wchar_t* name)
|
||||
{
|
||||
pthread_mutex_t* mutex = new pthread_mutex_t;
|
||||
pthread_mutex_t mutex_tmp = PTHREAD_MUTEX_INITIALIZER;
|
||||
*mutex = mutex_tmp;
|
||||
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(mutex, &attr);
|
||||
|
||||
if(initially_owned)
|
||||
{
|
||||
pthread_mutex_lock(mutex);
|
||||
}
|
||||
return (amf_handle)mutex;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_handle AMF_STD_CALL amf_open_mutex(const wchar_t* pName)
|
||||
{
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_delete_mutex(amf_handle hmutex)
|
||||
{
|
||||
if(hmutex == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
pthread_mutex_t* mutex = (pthread_mutex_t*)hmutex;
|
||||
int err = pthread_mutex_destroy(mutex);
|
||||
delete mutex;
|
||||
return err == 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#if defined(__APPLE__)
|
||||
int sem_timedwait1(sem_t* semaphore, const struct timespec* timeout)
|
||||
{
|
||||
struct timeval timenow;
|
||||
struct timespec sleepytime;
|
||||
int retcode;
|
||||
|
||||
/// This is just to avoid a completely busy wait
|
||||
sleepytime.tv_sec = 0;
|
||||
sleepytime.tv_nsec = 10000000; // 10ms
|
||||
|
||||
while((retcode = sem_trywait(semaphore)) != 0)
|
||||
{
|
||||
gettimeofday (&timenow, NULL);
|
||||
|
||||
if((timenow.tv_sec >= timeout->tv_sec) && ((timenow.tv_usec * 1000) >= timeout->tv_nsec))
|
||||
{
|
||||
return retcode;
|
||||
}
|
||||
nanosleep (&sleepytime, NULL);
|
||||
}
|
||||
return retcode;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__) || defined(__APPLE__)
|
||||
int pthread_mutex_timedlock1(pthread_mutex_t* mutex, const struct timespec* timeout)
|
||||
{
|
||||
struct timeval timenow;
|
||||
struct timespec sleepytime;
|
||||
int retcode;
|
||||
|
||||
/// This is just to avoid a completely busy wait
|
||||
sleepytime.tv_sec = 0;
|
||||
sleepytime.tv_nsec = 10000000; // 10ms
|
||||
|
||||
while((retcode = pthread_mutex_trylock (mutex)) == EBUSY)
|
||||
{
|
||||
gettimeofday (&timenow, NULL);
|
||||
|
||||
if((timenow.tv_sec >= timeout->tv_sec) && ((timenow.tv_usec * 1000) >= timeout->tv_nsec))
|
||||
{
|
||||
return ETIMEDOUT;
|
||||
}
|
||||
nanosleep (&sleepytime, NULL);
|
||||
}
|
||||
return retcode;
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_wait_for_mutex(amf_handle hmutex, unsigned long timeout)
|
||||
{
|
||||
if(hmutex == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
pthread_mutex_t* mutex = (pthread_mutex_t*)hmutex;
|
||||
if(timeout == AMF_INFINITE)
|
||||
{
|
||||
return pthread_mutex_lock(mutex) == 0;
|
||||
}
|
||||
|
||||
// ulTimeout is in milliseconds
|
||||
long timeout_sec = timeout / 1000; /* Seconds */;
|
||||
long timeout_nsec = (timeout - (timeout / 1000) * 1000) * 1000000;
|
||||
|
||||
timespec wait_time; //absolute time
|
||||
clock_gettime(CLOCK_REALTIME, &wait_time);
|
||||
|
||||
wait_time.tv_sec += timeout_sec;
|
||||
wait_time.tv_nsec += timeout_nsec;
|
||||
|
||||
if (wait_time.tv_nsec >= 1000000000)
|
||||
{
|
||||
wait_time.tv_sec++;
|
||||
wait_time.tv_nsec -= 1000000000;
|
||||
}
|
||||
|
||||
#if defined(__ANDROID__) || defined (__APPLE__)
|
||||
return pthread_mutex_timedlock1(mutex, &wait_time) == 0;
|
||||
#else
|
||||
return pthread_mutex_timedlock(mutex, &wait_time) == 0;
|
||||
#endif
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_release_mutex(amf_handle hmutex)
|
||||
{
|
||||
if(hmutex == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
pthread_mutex_t* mutex = (pthread_mutex_t*)hmutex;
|
||||
return pthread_mutex_unlock(mutex) == 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_handle AMF_STD_CALL amf_create_semaphore(amf_long iInitCount, amf_long iMaxCount, const wchar_t* /*pName*/)
|
||||
{
|
||||
if(iMaxCount == 0 || iInitCount > iMaxCount)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
sem_t* semaphore = new sem_t;
|
||||
if(sem_init(semaphore, 0, iInitCount) != 0)
|
||||
{
|
||||
delete semaphore;
|
||||
return NULL;
|
||||
}
|
||||
return (amf_handle)semaphore;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_delete_semaphore(amf_handle hsemaphore)
|
||||
{
|
||||
if(hsemaphore == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool ret = true;
|
||||
sem_t* semaphore = (sem_t*)hsemaphore;
|
||||
ret = (0==sem_destroy(semaphore)) ? 1:0;
|
||||
delete semaphore;
|
||||
return ret;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_wait_for_semaphore(amf_handle hsemaphore, amf_ulong timeout)
|
||||
{
|
||||
if(hsemaphore == NULL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// ulTimeout is in milliseconds
|
||||
long timeout_sec = timeout / 1000; /* Seconds */;
|
||||
long timeout_nsec = (timeout - (timeout / 1000) * 1000) * 1000000;
|
||||
|
||||
timespec wait_time; //absolute time
|
||||
clock_gettime(CLOCK_REALTIME, &wait_time);
|
||||
|
||||
wait_time.tv_sec += timeout_sec;
|
||||
wait_time.tv_nsec += timeout_nsec;
|
||||
|
||||
if (wait_time.tv_nsec >= 1000000000)
|
||||
{
|
||||
wait_time.tv_sec++;
|
||||
wait_time.tv_nsec -= 1000000000;
|
||||
}
|
||||
|
||||
sem_t* semaphore = (sem_t*)hsemaphore;
|
||||
if(timeout != AMF_INFINITE)
|
||||
{
|
||||
#if defined(__APPLE__)
|
||||
return sem_timedwait1 (semaphore, &wait_time) == 0; // errno=ETIMEDOU
|
||||
#else
|
||||
return sem_timedwait (semaphore, &wait_time) == 0; // errno=ETIMEDOUT
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
return sem_wait(semaphore) == 0;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_STD_CALL amf_release_semaphore(amf_handle hsemaphore, amf_long iCount, amf_long* iOldCount)
|
||||
{
|
||||
if(hsemaphore == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
sem_t* semaphore = (sem_t*)hsemaphore;
|
||||
|
||||
if(iOldCount != NULL)
|
||||
{
|
||||
int iTmp = 0;
|
||||
sem_getvalue(semaphore, &iTmp);
|
||||
*iOldCount = iTmp;
|
||||
}
|
||||
|
||||
for(int i = 0; i < iCount; i++)
|
||||
{
|
||||
sem_post(semaphore);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
* Delay is specified in milliseconds.
|
||||
* Function will return prematurely if msDelay value is invalid.
|
||||
*
|
||||
* */
|
||||
void AMF_STD_CALL amf_sleep(amf_ulong msDelay)
|
||||
{
|
||||
#if defined(NANOSLEEP_DONTUSE)
|
||||
struct timespec sts, sts_remaining;
|
||||
int iErrorCode;
|
||||
|
||||
ts.tv_sec = msDelay / 1000;
|
||||
ts.tv_nsec = (msDelay - sts.tv_sec * 1000) * 1000000; // nanosec
|
||||
// put in code to measure sleep clock jitter
|
||||
do
|
||||
{
|
||||
iErrorCode = nanosleep(&sts, &sts_remaining);
|
||||
if(iErrorCode)
|
||||
{
|
||||
switch(errno)
|
||||
{
|
||||
case EINTR:
|
||||
sts = sts_remaining;
|
||||
break;
|
||||
|
||||
case EFAULT:
|
||||
case EINVAL:
|
||||
case default:
|
||||
perror("amf_sleep");
|
||||
return;
|
||||
/* TODO: how to log errors? */
|
||||
}
|
||||
}
|
||||
} while(iErrorCode);
|
||||
#else
|
||||
usleep(msDelay * 1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------------------
|
||||
// memory
|
||||
//----------------------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------------------
|
||||
void AMF_STD_CALL amf_debug_trace(const wchar_t* text)
|
||||
{
|
||||
#if defined(__ANDROID__)
|
||||
__android_log_write(ANDROID_LOG_DEBUG, "AMF_TRACE", amf_from_unicode_to_multibyte(text).c_str());
|
||||
#else
|
||||
fprintf(stderr, "%ls", text);
|
||||
#endif
|
||||
}
|
||||
|
||||
void* AMF_STD_CALL amf_virtual_alloc(size_t size)
|
||||
{
|
||||
void* mem = NULL;
|
||||
#if defined(__ANDROID__)
|
||||
mem = memalign(sysconf(_SC_PAGESIZE), size);
|
||||
if(mem == NULL)
|
||||
{
|
||||
amf_debug_trace(L"Failed to alloc memory using memalign() function.");
|
||||
}
|
||||
#else
|
||||
int exitCode = posix_memalign(&mem, sysconf(_SC_PAGESIZE), size);
|
||||
if(exitCode != 0)
|
||||
{
|
||||
amf_debug_trace(L"Failed to alloc memory using posix_memaling() function.");
|
||||
}
|
||||
#endif
|
||||
|
||||
return mem;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
void AMF_STD_CALL amf_virtual_free(void* ptr)
|
||||
{
|
||||
free(ptr); // according to linux help memory allocated by memalign() must be freed by free()
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
amf_handle AMF_STD_CALL amf_load_library(const wchar_t* filename)
|
||||
{
|
||||
void *ret = dlopen(amf_from_unicode_to_multibyte(filename).c_str(), RTLD_NOW | RTLD_GLOBAL);
|
||||
if(ret ==0 )
|
||||
{
|
||||
const char *err = dlerror();
|
||||
int a=1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
amf_handle AMF_STD_CALL amf_load_library1(const wchar_t* filename, bool bGlobal)
|
||||
{
|
||||
void *ret;
|
||||
if (bGlobal) {
|
||||
ret = dlopen(amf_from_unicode_to_multibyte(filename).c_str(), RTLD_NOW | RTLD_GLOBAL);
|
||||
} else {
|
||||
#if defined(__ANDROID__) || (__APPLE__)
|
||||
ret = dlopen(amf_from_unicode_to_multibyte(filename).c_str(), RTLD_NOW | RTLD_LOCAL);
|
||||
#else
|
||||
ret = dlopen(amf_from_unicode_to_multibyte(filename).c_str(), RTLD_NOW | RTLD_LOCAL| RTLD_DEEPBIND);
|
||||
#endif
|
||||
}
|
||||
|
||||
if(ret == 0)
|
||||
{
|
||||
const char *err = dlerror();
|
||||
int a=1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void* AMF_STD_CALL amf_get_proc_address(amf_handle module, const char* procName)
|
||||
{
|
||||
return dlsym(module, procName);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
int AMF_STD_CALL amf_free_library(amf_handle module)
|
||||
{
|
||||
return dlclose(module) == 0;
|
||||
}
|
||||
void AMF_STD_CALL amf_increase_timer_precision()
|
||||
{
|
||||
}
|
||||
void AMF_STD_CALL amf_restore_timer_precision()
|
||||
{
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
double AMF_STD_CALL amf_clock()
|
||||
{
|
||||
//MM: clock() Win32 - returns time from beginning of the program
|
||||
//MM: clock() works different in Linux - returns consumed processor time
|
||||
timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
double cur_time = ((double)ts.tv_sec) + ((double)ts.tv_nsec) / 1000000000.; //to sec
|
||||
return cur_time;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_int64 AMF_STD_CALL get_time_in_seconds_with_fraction()
|
||||
{
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
amf_int64 ntp_time = ((tv.tv_sec * 1000) + (tv.tv_usec / 1000));
|
||||
return ntp_time;
|
||||
}
|
||||
//---------------------------------------------------------------------------------------
|
||||
amf_pts AMF_STD_CALL amf_high_precision_clock()
|
||||
{
|
||||
timespec ts;
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
return ts.tv_sec * 10000000LL + ts.tv_nsec / 100.; //to nanosec
|
||||
}
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Returns number of physical cores
|
||||
amf_int32 AMF_STD_CALL amf_get_cpu_cores()
|
||||
{
|
||||
// NOTE: get_nprocs is preffered way to get online cores on linux but it will
|
||||
// return number of logical cores. Uncomment line bellow if that's the behaviour needed
|
||||
//return get_nprocs();
|
||||
|
||||
const char CPUINFO_CORES_COUNT[] = "cpu cores";
|
||||
|
||||
std::ifstream cpuinfo("/proc/cpuinfo");
|
||||
std::string line;
|
||||
|
||||
while (std::getline(cpuinfo, line))
|
||||
{
|
||||
if (line.compare(0, strlen(CPUINFO_CORES_COUNT), CPUINFO_CORES_COUNT) == 0)
|
||||
{
|
||||
size_t pos = line.rfind(':') + 2;
|
||||
if (pos == std::string::npos)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string tmp = line.substr(pos);
|
||||
const char* value = tmp.c_str();
|
||||
int cores_online = std::atoi(value);
|
||||
// Make sure we always return at least 1
|
||||
return std::max(1, cores_online);
|
||||
}
|
||||
}
|
||||
|
||||
// Failure, return default
|
||||
return 1;
|
||||
}
|
||||
//--------------------------------------------------------------------------------
|
||||
// the end
|
||||
//--------------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
75
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/XDisplay.h
vendored
Normal file
75
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/XDisplay.h
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; AV1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
#pragma once
|
||||
#include <memory>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
//this pattern makes it impossible to use the x11 Display* pointer without first calling XLockDisplay
|
||||
class XDisplay {
|
||||
public:
|
||||
typedef std::shared_ptr<XDisplay> Ptr;
|
||||
|
||||
XDisplay()
|
||||
: m_pDisplay(XOpenDisplay(nullptr))
|
||||
, m_shouldClose(true)
|
||||
{}
|
||||
XDisplay(Display* dpy)
|
||||
: m_pDisplay(dpy)
|
||||
, m_shouldClose(false)
|
||||
{}
|
||||
~XDisplay() { if(IsValid() && m_shouldClose) XCloseDisplay(m_pDisplay); }
|
||||
|
||||
bool IsValid() { return m_pDisplay != nullptr; }
|
||||
|
||||
private:
|
||||
Display* m_pDisplay;
|
||||
bool m_shouldClose = false;
|
||||
friend class XDisplayPtr;
|
||||
};
|
||||
|
||||
class XDisplayPtr {
|
||||
public:
|
||||
|
||||
XDisplayPtr() = delete;
|
||||
XDisplayPtr(const XDisplayPtr&) = delete;
|
||||
XDisplayPtr& operator=(const XDisplayPtr&) =delete;
|
||||
|
||||
explicit XDisplayPtr(std::shared_ptr<XDisplay> display) : m_pDisplay(display) { XLockDisplay(m_pDisplay->m_pDisplay); }
|
||||
~XDisplayPtr() { XUnlockDisplay(m_pDisplay->m_pDisplay); }
|
||||
|
||||
//XDisplayPtr acts like a normal Display* pointer, but the only way to obtain it is by locking the Display
|
||||
operator Display*() { return m_pDisplay->m_pDisplay; }
|
||||
|
||||
private:
|
||||
XDisplay::Ptr m_pDisplay;
|
||||
};
|
||||
11
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/XrandrPtrs.h
vendored
Normal file
11
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Linux/XrandrPtrs.h
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
///-------------------------------------------------------------------------
|
||||
/// Copyright © 2020-2022 Advanced Micro Devices, Inc. All rights reserved.
|
||||
///-------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
|
||||
typedef std::shared_ptr<XRRScreenResources> XRRScreenResourcesPtr;
|
||||
typedef std::shared_ptr<XRRCrtcInfo> XRRCrtcInfoPtr;
|
||||
144
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/ObservableImpl.h
vendored
Normal file
144
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/ObservableImpl.h
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
/**
|
||||
***************************************************************************************************
|
||||
* @file ObservableImpl.h
|
||||
* @brief AMFObservableImpl common template declaration
|
||||
***************************************************************************************************
|
||||
*/
|
||||
#ifndef AMF_ObservableImpl_h
|
||||
#define AMF_ObservableImpl_h
|
||||
#pragma once
|
||||
|
||||
#include "Thread.h"
|
||||
#include <list>
|
||||
|
||||
namespace amf
|
||||
{
|
||||
template<typename Observer>
|
||||
class AMFObservableImpl
|
||||
{
|
||||
private:
|
||||
typedef std::list<Observer*> ObserversList;
|
||||
ObserversList m_observers;
|
||||
public:
|
||||
AMFObservableImpl() : m_observers()
|
||||
{}
|
||||
virtual ~AMFObservableImpl()
|
||||
{
|
||||
assert(m_observers.size() == 0);
|
||||
}
|
||||
virtual void AMF_STD_CALL AddObserver(Observer* pObserver)
|
||||
{
|
||||
if (pObserver == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
amf_bool found = false;
|
||||
AMFLock lock(&m_sc);
|
||||
|
||||
for (typename ObserversList::iterator it = m_observers.begin(); it != m_observers.end(); it++)
|
||||
{
|
||||
if (*it == pObserver)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found == false)
|
||||
{
|
||||
m_observers.push_back(pObserver);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void AMF_STD_CALL RemoveObserver(Observer* pObserver)
|
||||
{
|
||||
AMFLock lock(&m_sc);
|
||||
m_observers.remove(pObserver);
|
||||
}
|
||||
|
||||
protected:
|
||||
void AMF_STD_CALL ClearObservers()
|
||||
{
|
||||
AMFLock lock(&m_sc);
|
||||
m_observers.clear();
|
||||
}
|
||||
|
||||
void AMF_STD_CALL NotifyObservers(void (AMF_STD_CALL Observer::* pEvent)())
|
||||
{
|
||||
ObserversList tempList;
|
||||
{
|
||||
AMFLock lock(&m_sc);
|
||||
tempList = m_observers;
|
||||
}
|
||||
for (typename ObserversList::iterator it = tempList.begin(); it != tempList.end(); ++it)
|
||||
{
|
||||
Observer* pObserver = *it;
|
||||
(pObserver->*pEvent)();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename TArg0>
|
||||
void AMF_STD_CALL NotifyObservers(void (AMF_STD_CALL Observer::* pEvent)(TArg0), TArg0 arg0)
|
||||
{
|
||||
ObserversList tempList;
|
||||
{
|
||||
AMFLock lock(&m_sc);
|
||||
tempList = m_observers;
|
||||
}
|
||||
for (typename ObserversList::iterator it = tempList.begin(); it != tempList.end(); ++it)
|
||||
{
|
||||
Observer* pObserver = *it;
|
||||
(pObserver->*pEvent)(arg0);
|
||||
}
|
||||
}
|
||||
template<typename TArg0, typename TArg1>
|
||||
void AMF_STD_CALL NotifyObservers(void (AMF_STD_CALL Observer::* pEvent)(TArg0, TArg1), TArg0 arg0, TArg1 arg1)
|
||||
{
|
||||
ObserversList tempList;
|
||||
{
|
||||
AMFLock lock(&m_sc);
|
||||
tempList = m_observers;
|
||||
}
|
||||
for (typename ObserversList::iterator it = tempList.begin(); it != tempList.end(); it++)
|
||||
{
|
||||
Observer* pObserver = *it;
|
||||
(pObserver->*pEvent)(arg0, arg1);
|
||||
}
|
||||
}
|
||||
private:
|
||||
AMFCriticalSection m_sc;
|
||||
};
|
||||
}
|
||||
#endif //AMF_ObservableImpl_h
|
||||
563
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/OpenGLImportTable.cpp
vendored
Normal file
563
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/OpenGLImportTable.cpp
vendored
Normal file
@@ -0,0 +1,563 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
///-------------------------------------------------------------------------
|
||||
/// @file OpenGLImportTable.cpp
|
||||
/// @brief OpenGL import table
|
||||
///-------------------------------------------------------------------------
|
||||
#include "OpenGLImportTable.h"
|
||||
#include "public/common/TraceAdapter.h"
|
||||
#include "public/common/Thread.h"
|
||||
|
||||
using namespace amf;
|
||||
|
||||
#define AMF_FACILITY L"OpenGLImportTable"
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#define TRY_GET_DLL_ENTRY_POINT_CORE(w) \
|
||||
w = reinterpret_cast<w##_fn>(amf_get_proc_address(m_hOpenGLDll, #w));
|
||||
|
||||
#define GET_DLL_ENTRY_POINT_CORE(w)\
|
||||
TRY_GET_DLL_ENTRY_POINT_CORE(w)\
|
||||
AMF_RETURN_IF_FALSE(w != nullptr, AMF_NOT_FOUND, L"Failed to aquire entry point %S", #w);
|
||||
|
||||
// On windows, some functions are defined in the core opengl32.dll (especially the core old ones)
|
||||
// and some are not and we have to use wglGetProcAddress. Its a problem because the ones defined in
|
||||
// opengl32.dll are not included in the wglGetProcAddress and vice versa
|
||||
#if defined(_WIN32)
|
||||
|
||||
#define TRY_GET_DLL_ENTRY_POINT(w) \
|
||||
{\
|
||||
void const * const p = (void*)wglGetProcAddress(#w);\
|
||||
if (p == nullptr || p == (void*)0x1 || p == (void*)0x2 || p == (void*)0x3 || p == (void*)-1)\
|
||||
{\
|
||||
TRY_GET_DLL_ENTRY_POINT_CORE(w);\
|
||||
}\
|
||||
else\
|
||||
{\
|
||||
w = reinterpret_cast<w##_fn>(p);\
|
||||
}\
|
||||
}
|
||||
|
||||
#else
|
||||
#define TRY_GET_DLL_ENTRY_POINT(w) TRY_GET_DLL_ENTRY_POINT_CORE(w)
|
||||
#endif
|
||||
|
||||
#define GET_DLL_ENTRY_POINT(w)\
|
||||
TRY_GET_DLL_ENTRY_POINT(w)\
|
||||
AMF_RETURN_IF_FALSE(w != nullptr, AMF_NOT_FOUND, L"Failed to aquire entry point %S", #w);
|
||||
|
||||
OpenGLImportTable::OpenGLImportTable() :
|
||||
m_hOpenGLDll(nullptr),
|
||||
glGetError(nullptr),
|
||||
glGetString(nullptr),
|
||||
// glGetStringi(nullptr),
|
||||
glEnable(nullptr),
|
||||
glClear(nullptr),
|
||||
glClearAccum(nullptr),
|
||||
glClearColor(nullptr),
|
||||
glClearDepth(nullptr),
|
||||
glClearIndex(nullptr),
|
||||
glClearStencil(nullptr),
|
||||
glDrawArrays(nullptr),
|
||||
glViewport(nullptr),
|
||||
glFinish(nullptr),
|
||||
#if defined(_WIN32)
|
||||
wglCreateContext(nullptr),
|
||||
wglDeleteContext(nullptr),
|
||||
wglGetCurrentContext(nullptr),
|
||||
wglGetCurrentDC(nullptr),
|
||||
wglMakeCurrent(nullptr),
|
||||
wglGetProcAddress(nullptr),
|
||||
wglGetExtensionsStringARB(nullptr),
|
||||
wglSwapIntervalEXT(nullptr),
|
||||
|
||||
wndClass{},
|
||||
hDummyWnd(nullptr),
|
||||
hDummyDC(nullptr),
|
||||
hDummyOGLContext(nullptr),
|
||||
#elif defined(__ANDROID__)
|
||||
eglInitialize(nullptr),
|
||||
eglGetDisplay(nullptr),
|
||||
eglChooseConfig(nullptr),
|
||||
eglCreateContext(nullptr),
|
||||
eglDestroyImageKHR(nullptr),
|
||||
eglCreateImageKHR(nullptr),
|
||||
eglSwapInterval(nullptr),
|
||||
glEGLImageTargetTexture2DOES(nullptr),
|
||||
glReadPixels(nullptr),
|
||||
#elif defined(__linux)
|
||||
glXDestroyContext(nullptr),
|
||||
glXDestroyWindow(nullptr),
|
||||
glXSwapBuffers(nullptr),
|
||||
glXQueryExtension(nullptr),
|
||||
glXChooseFBConfig(nullptr),
|
||||
glXCreateWindow(nullptr),
|
||||
glXCreateNewContext(nullptr),
|
||||
glXMakeCurrent(nullptr),
|
||||
glXGetCurrentContext(nullptr),
|
||||
glXGetCurrentDrawable(nullptr),
|
||||
glXQueryExtensionsString(nullptr),
|
||||
glXSwapIntervalEXT(nullptr),
|
||||
#endif
|
||||
|
||||
glBindTexture(nullptr),
|
||||
glDeleteTextures(nullptr),
|
||||
glGenTextures(nullptr),
|
||||
glGetTexImage(nullptr),
|
||||
glGetTexLevelParameteriv(nullptr),
|
||||
glTexParameteri(nullptr),
|
||||
glTexImage2D(nullptr),
|
||||
glActiveTexture(nullptr),
|
||||
|
||||
glBindFramebuffer(nullptr),
|
||||
// glBindRenderbuffer(nullptr),
|
||||
glBlitFramebuffer(nullptr),
|
||||
glCheckFramebufferStatus(nullptr),
|
||||
glDeleteFramebuffers(nullptr),
|
||||
// glDeleteRenderbuffers(nullptr),
|
||||
// glFramebufferRenderbuffer(nullptr),
|
||||
// glFramebufferTexture1D(nullptr),
|
||||
glFramebufferTexture2D(nullptr),
|
||||
// glFramebufferTexture3D(nullptr),
|
||||
glFramebufferTextureLayer(nullptr),
|
||||
glGenFramebuffers(nullptr),
|
||||
// glGenRenderbuffers(nullptr),
|
||||
// glGenerateMipmap(nullptr),
|
||||
// glGetFramebufferAttachmentParameteriv(nullptr),
|
||||
// glGetRenderbufferParameteriv(nullptr),
|
||||
// glIsFramebuffer(nullptr),
|
||||
// glIsRenderbuffer(nullptr),
|
||||
// glRenderbufferStorage(nullptr),
|
||||
// glRenderbufferStorageMultisample(nullptr),
|
||||
|
||||
glGenBuffers(nullptr),
|
||||
glBindBuffer(nullptr),
|
||||
glBufferData(nullptr),
|
||||
glBufferSubData(nullptr),
|
||||
glDeleteBuffers(nullptr),
|
||||
|
||||
glVertexAttribPointer(nullptr),
|
||||
// glVertexAttribLPointer(nullptr),
|
||||
// glVertexAttribIPointer(nullptr),
|
||||
glBindVertexBuffer(nullptr),
|
||||
glDisableVertexAttribArray(nullptr),
|
||||
glEnableVertexAttribArray(nullptr),
|
||||
|
||||
glBindVertexArray(nullptr),
|
||||
glDeleteVertexArrays(nullptr),
|
||||
glGenVertexArrays(nullptr),
|
||||
glIsVertexArray(nullptr),
|
||||
|
||||
glCreateShader(nullptr),
|
||||
glShaderSource(nullptr),
|
||||
glCompileShader(nullptr),
|
||||
glGetShaderInfoLog(nullptr),
|
||||
glGetShaderSource(nullptr),
|
||||
glGetShaderiv(nullptr),
|
||||
glCreateProgram(nullptr),
|
||||
glAttachShader(nullptr),
|
||||
glLinkProgram(nullptr),
|
||||
glGetProgramInfoLog(nullptr),
|
||||
glGetProgramiv(nullptr),
|
||||
glValidateProgram(nullptr),
|
||||
glUseProgram(nullptr),
|
||||
glDeleteShader(nullptr),
|
||||
glDeleteProgram(nullptr),
|
||||
|
||||
glGetUniformLocation(nullptr),
|
||||
// glUniform1f(nullptr),
|
||||
// glUniform1fv(nullptr),
|
||||
glUniform1i(nullptr),
|
||||
// glUniform1iv(nullptr),
|
||||
// glUniform2f(nullptr),
|
||||
// glUniform2fv(nullptr),
|
||||
// glUniform2i(nullptr),
|
||||
// glUniform2iv(nullptr),
|
||||
// glUniform3f(nullptr),
|
||||
// glUniform3fv(nullptr),
|
||||
// glUniform3i(nullptr),
|
||||
// glUniform3iv(nullptr),
|
||||
// glUniform4f(nullptr),
|
||||
glUniform4fv(nullptr),
|
||||
// glUniform4i(nullptr),
|
||||
// glUniform4iv(nullptr),
|
||||
// glUniformMatrix2fv(nullptr),
|
||||
// glUniformMatrix3fv(nullptr),
|
||||
// glUniformMatrix4fv(nullptr),
|
||||
|
||||
glBindBufferBase(nullptr),
|
||||
glBindBufferRange(nullptr),
|
||||
glGetUniformBlockIndex(nullptr),
|
||||
glUniformBlockBinding(nullptr),
|
||||
|
||||
glBindSampler(nullptr),
|
||||
glDeleteSamplers(nullptr),
|
||||
glGenSamplers(nullptr),
|
||||
// glGetSamplerParameterIiv(nullptr),
|
||||
// glGetSamplerParameterIuiv(nullptr),
|
||||
// glGetSamplerParameterfv(nullptr),
|
||||
// glGetSamplerParameteriv(nullptr),
|
||||
// glIsSampler(nullptr),
|
||||
// glSamplerParameterIiv(nullptr),
|
||||
// glSamplerParameterIuiv(nullptr),
|
||||
glSamplerParameterf(nullptr),
|
||||
glSamplerParameterfv(nullptr),
|
||||
glSamplerParameteri(nullptr)
|
||||
// glSamplerParameteriv(nullptr)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
OpenGLImportTable::~OpenGLImportTable()
|
||||
{
|
||||
if (m_hOpenGLDll != nullptr)
|
||||
{
|
||||
amf_free_library(m_hOpenGLDll);
|
||||
}
|
||||
m_hOpenGLDll = nullptr;
|
||||
|
||||
#if defined(_WIN32)
|
||||
DestroyDummy();
|
||||
#endif
|
||||
}
|
||||
|
||||
AMF_RESULT OpenGLImportTable::LoadFunctionsTable()
|
||||
{
|
||||
if (m_hOpenGLDll != nullptr)
|
||||
{
|
||||
return AMF_OK;
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
m_hOpenGLDll = amf_load_library(L"opengl32.dll");
|
||||
#elif defined(__ANDROID__)
|
||||
m_hOpenGLDll = amf_load_library1(L"libGLES.so", true);
|
||||
#elif defined(__linux__)
|
||||
m_hOpenGLDll = amf_load_library1(L"libGL.so.1", true);
|
||||
#endif
|
||||
|
||||
if (m_hOpenGLDll == nullptr)
|
||||
{
|
||||
AMFTraceError(L"OpenGLImportTable", L"amf_load_library() failed to load opengl dll!");
|
||||
return AMF_FAIL;
|
||||
}
|
||||
|
||||
// Core
|
||||
GET_DLL_ENTRY_POINT_CORE(glGetError);
|
||||
GET_DLL_ENTRY_POINT_CORE(glGetString);
|
||||
|
||||
GET_DLL_ENTRY_POINT_CORE(glEnable);
|
||||
GET_DLL_ENTRY_POINT_CORE(glClear);
|
||||
GET_DLL_ENTRY_POINT_CORE(glClearAccum);
|
||||
GET_DLL_ENTRY_POINT_CORE(glClearColor);
|
||||
GET_DLL_ENTRY_POINT_CORE(glClearDepth);
|
||||
GET_DLL_ENTRY_POINT_CORE(glClearIndex);
|
||||
GET_DLL_ENTRY_POINT_CORE(glClearStencil);
|
||||
GET_DLL_ENTRY_POINT_CORE(glDrawArrays);
|
||||
GET_DLL_ENTRY_POINT_CORE(glViewport);
|
||||
GET_DLL_ENTRY_POINT_CORE(glFinish);
|
||||
|
||||
// Core (platform-dependent)
|
||||
#if defined(_WIN32)
|
||||
GET_DLL_ENTRY_POINT_CORE(wglCreateContext);
|
||||
GET_DLL_ENTRY_POINT_CORE(wglDeleteContext);
|
||||
GET_DLL_ENTRY_POINT_CORE(wglGetCurrentContext);
|
||||
GET_DLL_ENTRY_POINT_CORE(wglGetCurrentDC);
|
||||
GET_DLL_ENTRY_POINT_CORE(wglMakeCurrent);
|
||||
GET_DLL_ENTRY_POINT_CORE(wglGetProcAddress);
|
||||
#elif defined(__ANDROID__)
|
||||
GET_DLL_ENTRY_POINT_CORE(eglInitialize);
|
||||
GET_DLL_ENTRY_POINT_CORE(eglGetDisplay);
|
||||
GET_DLL_ENTRY_POINT_CORE(eglChooseConfig);
|
||||
GET_DLL_ENTRY_POINT_CORE(eglCreateContext);
|
||||
GET_DLL_ENTRY_POINT_CORE(eglDestroyImageKHR);
|
||||
GET_DLL_ENTRY_POINT_CORE(eglCreateImageKHR);
|
||||
GET_DLL_ENTRY_POINT_CORE(glEGLImageTargetTexture2DOES);
|
||||
GET_DLL_ENTRY_POINT_CORE(glReadPixels);
|
||||
#elif defined(__linux)
|
||||
GET_DLL_ENTRY_POINT_CORE(glXDestroyContext);
|
||||
GET_DLL_ENTRY_POINT_CORE(glXDestroyWindow);
|
||||
GET_DLL_ENTRY_POINT_CORE(glXSwapBuffers);
|
||||
GET_DLL_ENTRY_POINT_CORE(glXQueryExtension);
|
||||
GET_DLL_ENTRY_POINT_CORE(glXChooseFBConfig);
|
||||
GET_DLL_ENTRY_POINT_CORE(glXCreateWindow);
|
||||
GET_DLL_ENTRY_POINT_CORE(glXCreateNewContext);
|
||||
GET_DLL_ENTRY_POINT_CORE(glXMakeCurrent);
|
||||
GET_DLL_ENTRY_POINT_CORE(glXGetCurrentContext);
|
||||
GET_DLL_ENTRY_POINT_CORE(glXGetCurrentDrawable);
|
||||
#endif
|
||||
|
||||
// Textures
|
||||
GET_DLL_ENTRY_POINT_CORE(glBindTexture);
|
||||
GET_DLL_ENTRY_POINT_CORE(glDeleteTextures);
|
||||
GET_DLL_ENTRY_POINT_CORE(glGenTextures);
|
||||
GET_DLL_ENTRY_POINT_CORE(glGetTexImage);
|
||||
GET_DLL_ENTRY_POINT_CORE(glGetTexLevelParameteriv);
|
||||
GET_DLL_ENTRY_POINT_CORE(glTexParameteri);
|
||||
GET_DLL_ENTRY_POINT_CORE(glTexImage2D);
|
||||
|
||||
// For windows, we need to use wglGetProcAddress to get some
|
||||
// addresses however that requires a context. We can just create
|
||||
// a small dummy context/window and then delete it when we are done
|
||||
#if defined(_WIN32)
|
||||
{
|
||||
AMF_RESULT res = CreateDummy();
|
||||
if (res != AMF_OK)
|
||||
{
|
||||
DestroyDummy();
|
||||
AMF_RETURN_IF_FAILED(res, L"CreateDummy() failed");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
AMF_RESULT res = LoadContextFunctionsTable();
|
||||
AMF_RETURN_IF_FAILED(res, L"LoadContextFunctionsTable() failed");
|
||||
|
||||
#if defined(_WIN32)
|
||||
DestroyDummy();
|
||||
#endif
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
AMF_RESULT OpenGLImportTable::LoadContextFunctionsTable()
|
||||
{
|
||||
if (m_hOpenGLDll == nullptr)
|
||||
{
|
||||
AMF_RETURN_IF_FAILED(LoadFunctionsTable());
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
HGLRC context = wglGetCurrentContext();
|
||||
AMF_RETURN_IF_FALSE(context != nullptr, AMF_NOT_INITIALIZED, L"LoadContextFunctionsTable() - context is not initialized");
|
||||
#endif
|
||||
|
||||
// Core
|
||||
// GET_DLL_ENTRY_POINT(glGetStringi);
|
||||
|
||||
#if defined(_WIN32)
|
||||
TRY_GET_DLL_ENTRY_POINT(wglGetExtensionsStringARB);
|
||||
TRY_GET_DLL_ENTRY_POINT(wglSwapIntervalEXT);
|
||||
#elif defined(__ANDROID__)
|
||||
TRY_GET_DLL_ENTRY_POINT(eglSwapInterval);
|
||||
#elif defined(__linux)
|
||||
TRY_GET_DLL_ENTRY_POINT(glXQueryExtensionsString);
|
||||
TRY_GET_DLL_ENTRY_POINT(glXSwapIntervalEXT);
|
||||
#endif
|
||||
|
||||
// Textures
|
||||
GET_DLL_ENTRY_POINT(glActiveTexture);
|
||||
|
||||
// Frame buffer and render buffer objects
|
||||
GET_DLL_ENTRY_POINT(glBindFramebuffer);
|
||||
// GET_DLL_ENTRY_POINT(glBindRenderbuffer);
|
||||
GET_DLL_ENTRY_POINT(glBlitFramebuffer);
|
||||
GET_DLL_ENTRY_POINT(glCheckFramebufferStatus);
|
||||
GET_DLL_ENTRY_POINT(glDeleteFramebuffers);
|
||||
// GET_DLL_ENTRY_POINT(glDeleteRenderbuffers);
|
||||
// GET_DLL_ENTRY_POINT(glFramebufferRenderbuffer);
|
||||
// GET_DLL_ENTRY_POINT(glFramebufferTexture1D);
|
||||
GET_DLL_ENTRY_POINT(glFramebufferTexture2D);
|
||||
// GET_DLL_ENTRY_POINT(glFramebufferTexture3D);
|
||||
GET_DLL_ENTRY_POINT(glFramebufferTextureLayer);
|
||||
GET_DLL_ENTRY_POINT(glGenFramebuffers);
|
||||
// GET_DLL_ENTRY_POINT(glGenRenderbuffers);
|
||||
// GET_DLL_ENTRY_POINT(glGenerateMipmap);
|
||||
// GET_DLL_ENTRY_POINT(glGetFramebufferAttachmentParameteriv);
|
||||
// GET_DLL_ENTRY_POINT(glGetRenderbufferParameteriv);
|
||||
// GET_DLL_ENTRY_POINT(glIsFramebuffer);
|
||||
// GET_DLL_ENTRY_POINT(glIsRenderbuffer);
|
||||
// GET_DLL_ENTRY_POINT(glRenderbufferStorage);
|
||||
// GET_DLL_ENTRY_POINT(glRenderbufferStorageMultisample);
|
||||
|
||||
// Buffers
|
||||
GET_DLL_ENTRY_POINT(glGenBuffers);
|
||||
GET_DLL_ENTRY_POINT(glBindBuffer);
|
||||
GET_DLL_ENTRY_POINT(glBufferData);
|
||||
GET_DLL_ENTRY_POINT(glBufferSubData);
|
||||
GET_DLL_ENTRY_POINT(glDeleteBuffers);
|
||||
|
||||
// Vertex buffer attributes
|
||||
GET_DLL_ENTRY_POINT(glVertexAttribPointer);
|
||||
// GET_DLL_ENTRY_POINT(glVertexAttribLPointer);
|
||||
// GET_DLL_ENTRY_POINT(glVertexAttribIPointer);
|
||||
GET_DLL_ENTRY_POINT(glBindVertexBuffer);
|
||||
GET_DLL_ENTRY_POINT(glDisableVertexAttribArray);
|
||||
GET_DLL_ENTRY_POINT(glEnableVertexAttribArray);
|
||||
|
||||
GET_DLL_ENTRY_POINT(glBindVertexArray);
|
||||
GET_DLL_ENTRY_POINT(glDeleteVertexArrays);
|
||||
GET_DLL_ENTRY_POINT(glGenVertexArrays);
|
||||
GET_DLL_ENTRY_POINT(glIsVertexArray);
|
||||
|
||||
// Shaders
|
||||
GET_DLL_ENTRY_POINT(glCreateShader);
|
||||
GET_DLL_ENTRY_POINT(glShaderSource);
|
||||
GET_DLL_ENTRY_POINT(glCompileShader);
|
||||
GET_DLL_ENTRY_POINT(glGetShaderInfoLog);
|
||||
GET_DLL_ENTRY_POINT(glGetShaderSource);
|
||||
GET_DLL_ENTRY_POINT(glGetShaderiv);
|
||||
GET_DLL_ENTRY_POINT(glCreateProgram);
|
||||
GET_DLL_ENTRY_POINT(glAttachShader);
|
||||
GET_DLL_ENTRY_POINT(glLinkProgram);
|
||||
GET_DLL_ENTRY_POINT(glGetProgramInfoLog);
|
||||
GET_DLL_ENTRY_POINT(glGetProgramiv);
|
||||
GET_DLL_ENTRY_POINT(glValidateProgram);
|
||||
GET_DLL_ENTRY_POINT(glUseProgram);
|
||||
GET_DLL_ENTRY_POINT(glDeleteShader);
|
||||
GET_DLL_ENTRY_POINT(glDeleteProgram);
|
||||
|
||||
// Uniforms
|
||||
GET_DLL_ENTRY_POINT(glGetUniformLocation);
|
||||
// GET_DLL_ENTRY_POINT(glUniform1f);
|
||||
// GET_DLL_ENTRY_POINT(glUniform1fv);
|
||||
GET_DLL_ENTRY_POINT(glUniform1i);
|
||||
// GET_DLL_ENTRY_POINT(glUniform1iv);
|
||||
// GET_DLL_ENTRY_POINT(glUniform2f);
|
||||
// GET_DLL_ENTRY_POINT(glUniform2fv);
|
||||
// GET_DLL_ENTRY_POINT(glUniform2i);
|
||||
// GET_DLL_ENTRY_POINT(glUniform2iv);
|
||||
// GET_DLL_ENTRY_POINT(glUniform3f);
|
||||
// GET_DLL_ENTRY_POINT(glUniform3fv);
|
||||
// GET_DLL_ENTRY_POINT(glUniform3i);
|
||||
// GET_DLL_ENTRY_POINT(glUniform3iv);
|
||||
// GET_DLL_ENTRY_POINT(glUniform4f);
|
||||
GET_DLL_ENTRY_POINT(glUniform4fv);
|
||||
// GET_DLL_ENTRY_POINT(glUniform4i);
|
||||
// GET_DLL_ENTRY_POINT(glUniform4iv);
|
||||
// GET_DLL_ENTRY_POINT(glUniformMatrix2fv);
|
||||
// GET_DLL_ENTRY_POINT(glUniformMatrix3fv);
|
||||
// GET_DLL_ENTRY_POINT(glUniformMatrix4fv);
|
||||
|
||||
// Uniform buffer objects
|
||||
GET_DLL_ENTRY_POINT(glBindBufferBase);
|
||||
GET_DLL_ENTRY_POINT(glBindBufferRange);
|
||||
GET_DLL_ENTRY_POINT(glGetUniformBlockIndex);
|
||||
GET_DLL_ENTRY_POINT(glUniformBlockBinding);
|
||||
|
||||
// Sampler objects
|
||||
GET_DLL_ENTRY_POINT(glBindSampler);
|
||||
GET_DLL_ENTRY_POINT(glDeleteSamplers);
|
||||
GET_DLL_ENTRY_POINT(glGenSamplers);
|
||||
// GET_DLL_ENTRY_POINT(glGetSamplerParameterIiv);
|
||||
// GET_DLL_ENTRY_POINT(glGetSamplerParameterIuiv);
|
||||
// GET_DLL_ENTRY_POINT(glGetSamplerParameterfv);
|
||||
// GET_DLL_ENTRY_POINT(glGetSamplerParameteriv);
|
||||
// GET_DLL_ENTRY_POINT(glIsSampler);
|
||||
// GET_DLL_ENTRY_POINT(glSamplerParameterIiv);
|
||||
// GET_DLL_ENTRY_POINT(glSamplerParameterIuiv);
|
||||
GET_DLL_ENTRY_POINT(glSamplerParameterf);
|
||||
GET_DLL_ENTRY_POINT(glSamplerParameterfv);
|
||||
GET_DLL_ENTRY_POINT(glSamplerParameteri);
|
||||
// GET_DLL_ENTRY_POINT(glSamplerParameteriv);
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
AMF_RESULT OpenGLImportTable::CreateDummy()
|
||||
{
|
||||
DestroyDummy();
|
||||
|
||||
wndClass = { 0 };
|
||||
wndClass.cbSize = sizeof(wndClass);
|
||||
wndClass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
||||
wndClass.lpfnWndProc = DefWindowProcW;
|
||||
wndClass.hInstance = GetModuleHandle(0);
|
||||
wndClass.lpszClassName = L"OpenGL_Dummy_Class";
|
||||
|
||||
int ret = RegisterClassExW(&wndClass);
|
||||
AMF_RETURN_IF_FALSE(ret != 0, AMF_FAIL, L"CreateDummy() - RegisterClassA() failed, error=%d", GetLastError());
|
||||
|
||||
hDummyWnd = CreateWindowExW(0, wndClass.lpszClassName, L"Dummy OpenGL Window", 0, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, wndClass.hInstance, 0);
|
||||
AMF_RETURN_IF_FALSE(hDummyWnd != nullptr, AMF_FAIL, L"CreateDummy() - CreateWindowExA() failed to create window");
|
||||
|
||||
hDummyDC = GetDC(hDummyWnd);
|
||||
|
||||
PIXELFORMATDESCRIPTOR pfd = {};
|
||||
pfd.nSize = sizeof(pfd);
|
||||
pfd.nVersion = 1;
|
||||
pfd.iPixelType = PFD_TYPE_RGBA;
|
||||
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
|
||||
pfd.cColorBits = 32;
|
||||
pfd.cAlphaBits = 8;
|
||||
pfd.iLayerType = PFD_MAIN_PLANE;
|
||||
pfd.cDepthBits = 24;
|
||||
pfd.cStencilBits = 8;
|
||||
|
||||
int pixel_format = ChoosePixelFormat(hDummyDC, &pfd);
|
||||
AMF_RETURN_IF_FALSE(pixel_format != 0, AMF_FAIL, L"CreateDummy() - ChoosePixelFormat() failed to find a suitable pixel format.");
|
||||
|
||||
ret = SetPixelFormat(hDummyDC, pixel_format, &pfd);
|
||||
AMF_RETURN_IF_FALSE(ret != 0, AMF_FAIL, L"CreateDummy() - SetPixelFormat() failed");
|
||||
|
||||
hDummyOGLContext = wglCreateContext(hDummyDC);
|
||||
AMF_RETURN_IF_FALSE(hDummyOGLContext != nullptr, AMF_FAIL, L"CreateDummy() - wglCreateContext() failed");
|
||||
|
||||
ret = !wglMakeCurrent(hDummyDC, hDummyOGLContext);
|
||||
AMF_RETURN_IF_FALSE(hDummyOGLContext != nullptr, AMF_FAIL, L"CreateDummy() - wglMakeCurrent() failed");
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
|
||||
AMF_RESULT OpenGLImportTable::DestroyDummy()
|
||||
{
|
||||
if (hDummyOGLContext != nullptr)
|
||||
{
|
||||
wglDeleteContext(hDummyOGLContext);
|
||||
hDummyOGLContext = nullptr;
|
||||
}
|
||||
|
||||
if (hDummyWnd != nullptr || hDummyDC != nullptr)
|
||||
{
|
||||
if (wglMakeCurrent != nullptr)
|
||||
{
|
||||
wglMakeCurrent(hDummyDC, 0);
|
||||
}
|
||||
|
||||
ReleaseDC(hDummyWnd, hDummyDC);
|
||||
DestroyWindow(hDummyWnd);
|
||||
hDummyWnd = nullptr;
|
||||
hDummyDC = nullptr;
|
||||
}
|
||||
|
||||
if (wndClass.lpszClassName != nullptr)
|
||||
{
|
||||
UnregisterClassW(wndClass.lpszClassName, wndClass.hInstance);
|
||||
wndClass = {};
|
||||
}
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
#endif
|
||||
540
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/OpenGLImportTable.h
vendored
Normal file
540
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/OpenGLImportTable.h
vendored
Normal file
@@ -0,0 +1,540 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
///-------------------------------------------------------------------------
|
||||
/// @file OpenGLImportTable.h
|
||||
/// @brief OpenGL import table
|
||||
///-------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
#include "public/include/core/Result.h"
|
||||
#include "public/common/AMFSTL.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <Wingdi.h>
|
||||
#include <gl/GL.h>
|
||||
#include <gl/GLU.h>
|
||||
#elif defined(__ANDROID__)
|
||||
////todo:AA #include <android/native_window.h> // requires ndk r5 or newer
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
|
||||
#include <EGL/egl.h> // requires ndk r5 or newer
|
||||
#include <EGL/eglext.h>
|
||||
#include <GLES/gl.h> // requires ndk r5 or newer
|
||||
#include <GLES/glext.h> // requires ndk r5 or newer
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
////todo:AA #include <ui/FramebufferNativeWindow.h>
|
||||
// #include <gralloc_priv.h>
|
||||
#include <time.h>
|
||||
#if !defined(CLOCK_MONOTONIC_RAW)
|
||||
#define CLOCK_MONOTONIC_RAW 4
|
||||
#endif
|
||||
////todo:AA #include <amdgralloc.h>
|
||||
|
||||
////todo:AA using namespace android;
|
||||
#if !defined(GL_CLAMP)
|
||||
#define GL_CLAMP GL_CLAMP_TO_EDGE
|
||||
#endif
|
||||
|
||||
#elif defined(__linux)
|
||||
#include <GL/glx.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
#ifndef AMF_GLAPI
|
||||
#if defined(_WIN32)
|
||||
#define AMF_GLAPI WINGDIAPI
|
||||
#elif defined(__ANDROID__)
|
||||
#define AMF_GLAPI GL_API
|
||||
#else // __linux
|
||||
#define AMF_GLAPI
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef AMF_GLAPIENTRY
|
||||
#if defined(_WIN32)
|
||||
#define AMF_GLAPIENTRY APIENTRY
|
||||
#elif defined(__ANDROID__)
|
||||
#define AMF_GLAPIENTRY GL_APIENTRY
|
||||
#elif defined(__linux)
|
||||
#define AMF_GLAPIENTRY GLAPIENTRY
|
||||
#else
|
||||
#define AMF_GLAPIENTRY
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
typedef char GLchar;
|
||||
#if defined(__ANDROID__)
|
||||
typedef double GLclampd;
|
||||
#define GL_TEXTURE_BORDER_COLOR 0x1004
|
||||
#else
|
||||
typedef ptrdiff_t GLintptr;
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef size_t GLsizeiptr; // Defined in glx.h on linux
|
||||
#endif
|
||||
|
||||
|
||||
// Core
|
||||
typedef AMF_GLAPI GLenum (AMF_GLAPIENTRY* glGetError_fn) (void);
|
||||
typedef AMF_GLAPI const GLubyte* (AMF_GLAPIENTRY* glGetString_fn) (GLenum name);
|
||||
typedef AMF_GLAPI const GLubyte* (AMF_GLAPIENTRY* glGetStringi_fn) (GLenum name, GLuint index);
|
||||
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glEnable_fn) (GLenum cap);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glClear_fn) (GLbitfield mask);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glClearAccum_fn) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glClearColor_fn) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glClearDepth_fn) (GLclampd depth);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glClearIndex_fn) (GLfloat c);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glClearStencil_fn) (GLint s);
|
||||
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glDrawArrays_fn) (GLenum mode, GLint first, GLsizei count);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glViewport_fn) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glFinish_fn) (void);
|
||||
|
||||
// Textures
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBindTexture_fn) (GLenum target, GLuint texture);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glDeleteTextures_fn) (GLsizei n, const GLuint* textures);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGenTextures_fn) (GLsizei n, GLuint* textures);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetTexImage_fn) (GLenum target, GLint level, GLenum format, GLenum type, GLvoid* pixels);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetTexLevelParameteriv_fn) (GLenum target, GLint level, GLenum pname, GLint* params);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glTexParameteri_fn) (GLenum target, GLenum pname, GLint param);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glTexImage2D_fn) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
|
||||
GLint border, GLenum format, GLenum type, const GLvoid* pixels);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glActiveTexture_fn) (GLenum texture);
|
||||
|
||||
// Framebuffer and Renderbuffer objects - EXT: GL_ARB_framebuffer_object
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBindFramebuffer_fn) (GLenum target, GLuint framebuffer);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBindRenderbuffer_fn) (GLenum target, GLuint renderbuffer);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBlitFramebuffer_fn) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
|
||||
typedef AMF_GLAPI GLenum (AMF_GLAPIENTRY* glCheckFramebufferStatus_fn) (GLenum target);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glDeleteFramebuffers_fn) (GLsizei n, const GLuint* framebuffers);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glDeleteRenderbuffers_fn) (GLsizei n, const GLuint* renderbuffers);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glFramebufferRenderbuffer_fn) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glFramebufferTexture1D_fn) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glFramebufferTexture2D_fn) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glFramebufferTexture3D_fn) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint layer);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glFramebufferTextureLayer_fn) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGenFramebuffers_fn) (GLsizei n, GLuint* framebuffers);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGenRenderbuffers_fn) (GLsizei n, GLuint* renderbuffers);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGenerateMipmap_fn) (GLenum target);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetFramebufferAttachmentParameteriv_fn) (GLenum target, GLenum attachment, GLenum pname, GLint* params);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetRenderbufferParameteriv_fn) (GLenum target, GLenum pname, GLint* params);
|
||||
typedef AMF_GLAPI GLboolean (AMF_GLAPIENTRY* glIsFramebuffer_fn) (GLuint framebuffer);
|
||||
typedef AMF_GLAPI GLboolean (AMF_GLAPIENTRY* glIsRenderbuffer_fn) (GLuint renderbuffer);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glRenderbufferStorage_fn) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glRenderbufferStorageMultisample_fn) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
|
||||
// Buffers
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGenBuffers_fn) (GLsizei n, GLuint* buffers);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBindBuffer_fn) (GLenum target, GLuint buffer);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBufferData_fn) (GLenum target, GLsizeiptr size, const void* data, GLenum usage);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBufferSubData_fn) (GLenum target, GLintptr offset, GLsizeiptr size, const void* data);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glDeleteBuffers_fn) (GLsizei n, const GLuint* buffers);
|
||||
|
||||
// Vertex attributes
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glVertexAttribPointer_fn) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* pointer);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glVertexAttribLPointer_fn) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glVertexAttribIPointer_fn) (GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBindVertexBuffer_fn) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glDisableVertexAttribArray_fn) (GLuint index);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glEnableVertexAttribArray_fn) (GLuint index);
|
||||
|
||||
// Vertex array objects
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBindVertexArray_fn) (GLuint array);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glDeleteVertexArrays_fn) (GLsizei n, const GLuint* arrays);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGenVertexArrays_fn) (GLsizei n, GLuint* arrays);
|
||||
typedef AMF_GLAPI GLboolean (AMF_GLAPIENTRY* glIsVertexArray_fn) (GLuint array);
|
||||
|
||||
// Shaders
|
||||
typedef AMF_GLAPI GLuint (AMF_GLAPIENTRY* glCreateShader_fn) (GLenum type);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glShaderSource_fn) (GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glCompileShader_fn) (GLuint shader);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetShaderInfoLog_fn) (GLuint shader, GLsizei bufSize, GLsizei* length, GLchar* infoLog);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetShaderSource_fn) (GLuint obj, GLsizei maxLength, GLsizei* length, GLchar* source);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetShaderiv_fn) (GLuint shader, GLenum pname, GLint* param);
|
||||
typedef AMF_GLAPI GLuint (AMF_GLAPIENTRY* glCreateProgram_fn) (void);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glAttachShader_fn) (GLuint program, GLuint shader);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glLinkProgram_fn) (GLuint program);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetProgramInfoLog_fn) (GLuint program, GLsizei bufSize, GLsizei* length, GLchar* infoLog);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetProgramiv_fn) (GLuint program, GLenum pname, GLint* param);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glValidateProgram_fn) (GLuint program);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUseProgram_fn) (GLuint program);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glDeleteShader_fn) (GLuint shader);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glDeleteProgram_fn) (GLuint program);
|
||||
|
||||
// Uniforms
|
||||
typedef AMF_GLAPI GLint (AMF_GLAPIENTRY* glGetUniformLocation_fn) (GLuint program, const GLchar* name);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform1f_fn) (GLint location, GLfloat v0);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform1fv_fn) (GLint location, GLsizei count, const GLfloat* value);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform1i_fn) (GLint location, GLint v0);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform1iv_fn) (GLint location, GLsizei count, const GLint* value);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform2f_fn) (GLint location, GLfloat v0, GLfloat v1);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform2fv_fn) (GLint location, GLsizei count, const GLfloat* value);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform2i_fn) (GLint location, GLint v0, GLint v1);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform2iv_fn) (GLint location, GLsizei count, const GLint* value);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform3f_fn) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform3fv_fn) (GLint location, GLsizei count, const GLfloat* value);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform3i_fn) (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform3iv_fn) (GLint location, GLsizei count, const GLint* value);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform4f_fn) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform4fv_fn) (GLint location, GLsizei count, const GLfloat* value);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform4i_fn) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniform4iv_fn) (GLint location, GLsizei count, const GLint* value);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniformMatrix2fv_fn) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniformMatrix3fv_fn) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniformMatrix4fv_fn) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
|
||||
|
||||
// Uniform block objects - EXT: ARB_Uniform_Buffer_Object
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBindBufferBase_fn) (GLenum target, GLuint index, GLuint buffer);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBindBufferRange_fn) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
|
||||
typedef AMF_GLAPI GLuint (AMF_GLAPIENTRY* glGetUniformBlockIndex_fn) (GLuint program, const GLchar* uniformBlockName);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glUniformBlockBinding_fn) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
|
||||
|
||||
|
||||
// Sampler Objects - EXT: GL_ARB_sampler_objects
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glBindSampler_fn) (GLuint unit, GLuint sampler);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glDeleteSamplers_fn) (GLsizei count, const GLuint* samplers);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGenSamplers_fn) (GLsizei count, GLuint* samplers);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetSamplerParameterIiv_fn) (GLuint sampler, GLenum pname, GLint* params);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetSamplerParameterIuiv_fn) (GLuint sampler, GLenum pname, GLuint* params);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetSamplerParameterfv_fn) (GLuint sampler, GLenum pname, GLfloat* params);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glGetSamplerParameteriv_fn) (GLuint sampler, GLenum pname, GLint* params);
|
||||
typedef AMF_GLAPI GLboolean (AMF_GLAPIENTRY* glIsSampler_fn) (GLuint sampler);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glSamplerParameterIiv_fn) (GLuint sampler, GLenum pname, const GLint* params);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glSamplerParameterIuiv_fn) (GLuint sampler, GLenum pname, const GLuint* params);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glSamplerParameterf_fn) (GLuint sampler, GLenum pname, GLfloat param);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glSamplerParameterfv_fn) (GLuint sampler, GLenum pname, const GLfloat* params);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glSamplerParameteri_fn) (GLuint sampler, GLenum pname, GLint param);
|
||||
typedef AMF_GLAPI void (AMF_GLAPIENTRY* glSamplerParameteriv_fn) (GLuint sampler, GLenum pname, const GLint* params);
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
typedef WINGDIAPI HGLRC (WINAPI* wglCreateContext_fn) (HDC);
|
||||
typedef WINGDIAPI BOOL (WINAPI* wglDeleteContext_fn) (HGLRC);
|
||||
typedef WINGDIAPI HGLRC (WINAPI* wglGetCurrentContext_fn) (VOID);
|
||||
typedef WINGDIAPI HDC (WINAPI* wglGetCurrentDC_fn) (VOID);
|
||||
typedef WINGDIAPI BOOL (WINAPI* wglMakeCurrent_fn) (HDC, HGLRC);
|
||||
typedef WINGDIAPI PROC (WINAPI* wglGetProcAddress_fn) (LPCSTR func);
|
||||
typedef WINGDIAPI const char* (WINAPI* wglGetExtensionsStringARB_fn) (HDC hdc);
|
||||
typedef WINGDIAPI BOOL (WINAPI* wglSwapIntervalEXT_fn) (int interval);
|
||||
#elif defined(__ANDROID__)
|
||||
typedef EGLAPI EGLBoolean (EGLAPIENTRY* eglInitialize_fn) (EGLDisplay dpy, EGLint* major, EGLint* minor);
|
||||
typedef EGLAPI EGLDisplay (EGLAPIENTRY* eglGetDisplay_fn) (EGLNativeDisplayType display_id);
|
||||
typedef EGLAPI EGLBoolean (EGLAPIENTRY* eglChooseConfig_fn) (EGLDisplay dpy, const EGLint* attrib_list, EGLConfig* configs, EGLint config_size, EGLint* num_config);
|
||||
typedef EGLAPI EGLContext (EGLAPIENTRY* eglCreateContext_fn) (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint* attrib_list);
|
||||
typedef EGLAPI EGLBoolean (EGLAPIENTRY* eglDestroyImageKHR_fn) (EGLDisplay dpy, EGLImageKHR image);
|
||||
typedef EGLAPI EGLImageKHR (EGLAPIENTRY* eglCreateImageKHR_fn) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint* attrib_list);
|
||||
typedef EGLAPI EGLBoolean (EGLAPIENTRY* eglSwapInterval_fn) (EGLDisplay dpy, EGLint interval);
|
||||
typedef GL_API void (GL_APIENTRY* glEGLImageTargetTexture2DOES_fn) (GLenum target, GLeglImageOES image);
|
||||
typedef GL_API void (GL_APIENTRY* glReadPixels_fn) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
|
||||
#elif defined(__linux)
|
||||
typedef void (GLAPIENTRY* glXDestroyContext_fn) (Display* dpy, GLXContext ctx);
|
||||
typedef void (GLAPIENTRY* glXDestroyWindow_fn) (Display* dpy, GLXWindow window);
|
||||
typedef void (GLAPIENTRY* glXSwapBuffers_fn) (Display* dpy, GLXDrawable drawable);
|
||||
typedef Bool (GLAPIENTRY* glXQueryExtension_fn) (Display* dpy, int* errorb, int* event);
|
||||
typedef GLXFBConfig* (GLAPIENTRY* glXChooseFBConfig_fn) (Display* dpy, int screen, const int* attribList, int* nitems );
|
||||
typedef GLXWindow (GLAPIENTRY* glXCreateWindow_fn) (Display* dpy, GLXFBConfig config, Window win, const int* attribList );
|
||||
typedef GLXContext (GLAPIENTRY* glXCreateNewContext_fn) (Display* dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct );
|
||||
typedef Bool (GLAPIENTRY* glXMakeCurrent_fn) (Display* dpy, GLXDrawable drawable, GLXContext ctx);
|
||||
typedef GLXContext (GLAPIENTRY* glXGetCurrentContext_fn) (void);
|
||||
typedef GLXDrawable (GLAPIENTRY* glXGetCurrentDrawable_fn) (void);
|
||||
typedef const char* (GLAPIENTRY* glXQueryExtensionsString_fn) (Display* dpy, int screen);
|
||||
typedef void (GLAPIENTRY* glXSwapIntervalEXT_fn) (Display* dpy, GLXDrawable drawable, int interval);
|
||||
#endif
|
||||
|
||||
// Target
|
||||
#define GL_DEPTH_BUFFER 0x8223
|
||||
#define GL_STENCIL_BUFFER 0x8224
|
||||
#define GL_ARRAY_BUFFER 0x8892
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
#define GL_PIXEL_PACK_BUFFER 0x88EB
|
||||
#define GL_PIXEL_UNPACK_BUFFER 0x88EC
|
||||
#define GL_UNIFORM_BUFFER 0x8A11
|
||||
#define GL_TEXTURE_BUFFER 0x8C2A
|
||||
#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
|
||||
#define GL_READ_FRAMEBUFFER 0x8CA8
|
||||
#define GL_DRAW_FRAMEBUFFER 0x8CA9
|
||||
#define GL_FRAMEBUFFER 0x8D40
|
||||
#define GL_RENDERBUFFER 0x8D41
|
||||
#define GL_COPY_READ_BUFFER 0x8F36
|
||||
#define GL_COPY_WRITE_BUFFER 0x8F37
|
||||
#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
|
||||
#define GL_SHADER_STORAGE_BUFFER 0x90D2
|
||||
#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE
|
||||
#define GL_QUERY_BUFFER 0x9192
|
||||
#define GL_ATOMIC_COUNTER_BUFFER 0x92C0
|
||||
|
||||
// Attachments
|
||||
#define GL_COLOR_ATTACHMENT0 0x8CE0
|
||||
#define GL_COLOR_ATTACHMENT_UNIT(x) (GL_COLOR_ATTACHMENT0 + x)
|
||||
#define GL_DEPTH_ATTACHMENT 0x8D00
|
||||
#define GL_STENCIL_ATTACHMENT 0x8D20
|
||||
|
||||
// Frame Buffer Status
|
||||
#define GL_FRAMEBUFFER_UNDEFINED 0x8219
|
||||
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
|
||||
#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
|
||||
#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
|
||||
|
||||
// Texture unit
|
||||
#define GL_TEXTURE0 0x84C0
|
||||
#define GL_TEXTURE_UNIT(x) (GL_TEXTURE0 + x)
|
||||
|
||||
// Usage
|
||||
#define GL_STREAM_DRAW 0x88E0
|
||||
#define GL_STREAM_READ 0x88E1
|
||||
#define GL_STREAM_COPY 0x88E2
|
||||
#define GL_STATIC_DRAW 0x88E4
|
||||
#define GL_STATIC_READ 0x88E5
|
||||
#define GL_STATIC_COPY 0x88E6
|
||||
#define GL_DYNAMIC_DRAW 0x88E8
|
||||
#define GL_DYNAMIC_READ 0x88E9
|
||||
#define GL_DYNAMIC_COPY 0x88EA
|
||||
|
||||
// Shader Type
|
||||
#define GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GL_VERTEX_SHADER 0x8B31
|
||||
#define GL_GEOMETRY_SHADER 0x8DD9
|
||||
#define GL_TESS_EVALUATION_SHADER 0x8E87
|
||||
#define GL_TESS_CONTROL_SHADER 0x8E88
|
||||
#define GL_COMPUTE_SHADER 0x91B9
|
||||
|
||||
// Shader Info
|
||||
#define GL_DELETE_STATUS 0x8B80
|
||||
#define GL_COMPILE_STATUS 0x8B81
|
||||
#define GL_LINK_STATUS 0x8B82
|
||||
#define GL_VALIDATE_STATUS 0x8B83
|
||||
#define GL_INFO_LOG_LENGTH 0x8B84
|
||||
|
||||
// Sampler params
|
||||
#define GL_TEXTURE_MIN_LOD 0x813A
|
||||
#define GL_TEXTURE_MAX_LOD 0x813B
|
||||
#define GL_TEXTURE_WRAP_R 0x8072
|
||||
#define GL_TEXTURE_COMPARE_MODE 0x884C
|
||||
#define GL_TEXTURE_COMPARE_FUNC 0x884D
|
||||
|
||||
struct OpenGLImportTable
|
||||
{
|
||||
OpenGLImportTable();
|
||||
~OpenGLImportTable();
|
||||
|
||||
AMF_RESULT LoadFunctionsTable();
|
||||
AMF_RESULT LoadContextFunctionsTable();
|
||||
|
||||
amf_handle m_hOpenGLDll;
|
||||
|
||||
// Core
|
||||
glGetError_fn glGetError;
|
||||
glGetString_fn glGetString;
|
||||
// glGetStringi_fn glGetStringi;
|
||||
|
||||
glEnable_fn glEnable;
|
||||
glClear_fn glClear;
|
||||
glClearAccum_fn glClearAccum;
|
||||
glClearColor_fn glClearColor;
|
||||
glClearDepth_fn glClearDepth;
|
||||
glClearIndex_fn glClearIndex;
|
||||
glClearStencil_fn glClearStencil;
|
||||
glDrawArrays_fn glDrawArrays;
|
||||
glViewport_fn glViewport;
|
||||
glFinish_fn glFinish;
|
||||
|
||||
// Core (platform-dependent)
|
||||
#if defined(_WIN32)
|
||||
wglCreateContext_fn wglCreateContext;
|
||||
wglDeleteContext_fn wglDeleteContext;
|
||||
wglGetCurrentContext_fn wglGetCurrentContext;
|
||||
wglGetCurrentDC_fn wglGetCurrentDC;
|
||||
wglMakeCurrent_fn wglMakeCurrent;
|
||||
wglGetProcAddress_fn wglGetProcAddress;
|
||||
wglGetExtensionsStringARB_fn wglGetExtensionsStringARB;
|
||||
wglSwapIntervalEXT_fn wglSwapIntervalEXT;
|
||||
#elif defined(__ANDROID__)
|
||||
eglInitialize_fn eglInitialize;
|
||||
eglGetDisplay_fn eglGetDisplay;
|
||||
eglChooseConfig_fn eglChooseConfig;
|
||||
eglCreateContext_fn eglCreateContext;
|
||||
eglDestroyImageKHR_fn eglDestroyImageKHR;
|
||||
eglCreateImageKHR_fn eglCreateImageKHR;
|
||||
eglSwapInterval_fn eglSwapInterval;
|
||||
glEGLImageTargetTexture2DOES_fn glEGLImageTargetTexture2DOES;
|
||||
glReadPixels_fn glReadPixels;
|
||||
#elif defined(__linux)
|
||||
glXDestroyContext_fn glXDestroyContext;
|
||||
glXDestroyWindow_fn glXDestroyWindow;
|
||||
glXSwapBuffers_fn glXSwapBuffers;
|
||||
glXQueryExtension_fn glXQueryExtension;
|
||||
glXChooseFBConfig_fn glXChooseFBConfig;
|
||||
glXCreateWindow_fn glXCreateWindow;
|
||||
glXCreateNewContext_fn glXCreateNewContext;
|
||||
glXMakeCurrent_fn glXMakeCurrent;
|
||||
glXGetCurrentContext_fn glXGetCurrentContext;
|
||||
glXGetCurrentDrawable_fn glXGetCurrentDrawable;
|
||||
glXQueryExtensionsString_fn glXQueryExtensionsString;
|
||||
glXSwapIntervalEXT_fn glXSwapIntervalEXT;
|
||||
#endif
|
||||
|
||||
// Textures
|
||||
glBindTexture_fn glBindTexture;
|
||||
glDeleteTextures_fn glDeleteTextures;
|
||||
glGenTextures_fn glGenTextures;
|
||||
glGetTexImage_fn glGetTexImage;
|
||||
glGetTexLevelParameteriv_fn glGetTexLevelParameteriv;
|
||||
glTexParameteri_fn glTexParameteri;
|
||||
glTexImage2D_fn glTexImage2D;
|
||||
glActiveTexture_fn glActiveTexture;
|
||||
|
||||
// Frame buffer and render buffer objects
|
||||
glBindFramebuffer_fn glBindFramebuffer;
|
||||
// glBindRenderbuffer_fn glBindRenderbuffer;
|
||||
glBlitFramebuffer_fn glBlitFramebuffer;
|
||||
glCheckFramebufferStatus_fn glCheckFramebufferStatus;
|
||||
glDeleteFramebuffers_fn glDeleteFramebuffers;
|
||||
// glDeleteRenderbuffers_fn glDeleteRenderbuffers;
|
||||
// glFramebufferRenderbuffer_fn glFramebufferRenderbuffer;
|
||||
// glFramebufferTexture1D_fn glFramebufferTexture1D;
|
||||
glFramebufferTexture2D_fn glFramebufferTexture2D;
|
||||
// glFramebufferTexture3D_fn glFramebufferTexture3D;
|
||||
glFramebufferTextureLayer_fn glFramebufferTextureLayer;
|
||||
glGenFramebuffers_fn glGenFramebuffers;
|
||||
// glGenRenderbuffers_fn glGenRenderbuffers;
|
||||
// glGenerateMipmap_fn glGenerateMipmap;
|
||||
// glGetFramebufferAttachmentParameteriv_fn glGetFramebufferAttachmentParameteriv;
|
||||
// glGetRenderbufferParameteriv_fn glGetRenderbufferParameteriv;
|
||||
// glIsFramebuffer_fn glIsFramebuffer;
|
||||
// glIsRenderbuffer_fn glIsRenderbuffer;
|
||||
// glRenderbufferStorage_fn glRenderbufferStorage;
|
||||
// glRenderbufferStorageMultisample_fn glRenderbufferStorageMultisample;
|
||||
|
||||
// Buffers
|
||||
glGenBuffers_fn glGenBuffers;
|
||||
glBindBuffer_fn glBindBuffer;
|
||||
glBufferData_fn glBufferData;
|
||||
glBufferSubData_fn glBufferSubData;
|
||||
glDeleteBuffers_fn glDeleteBuffers;
|
||||
|
||||
// Vertex attributes
|
||||
glVertexAttribPointer_fn glVertexAttribPointer;
|
||||
// glVertexAttribLPointer_fn glVertexAttribLPointer;
|
||||
// glVertexAttribIPointer_fn glVertexAttribIPointer;
|
||||
glBindVertexBuffer_fn glBindVertexBuffer;
|
||||
glDisableVertexAttribArray_fn glDisableVertexAttribArray;
|
||||
glEnableVertexAttribArray_fn glEnableVertexAttribArray;
|
||||
|
||||
// Vertex array objects
|
||||
glBindVertexArray_fn glBindVertexArray;
|
||||
glDeleteVertexArrays_fn glDeleteVertexArrays;
|
||||
glGenVertexArrays_fn glGenVertexArrays;
|
||||
glIsVertexArray_fn glIsVertexArray;
|
||||
|
||||
// Shaders
|
||||
glCreateShader_fn glCreateShader;
|
||||
glShaderSource_fn glShaderSource;
|
||||
glCompileShader_fn glCompileShader;
|
||||
glGetShaderInfoLog_fn glGetShaderInfoLog;
|
||||
glGetShaderSource_fn glGetShaderSource;
|
||||
glGetShaderiv_fn glGetShaderiv;
|
||||
glCreateProgram_fn glCreateProgram;
|
||||
glAttachShader_fn glAttachShader;
|
||||
glLinkProgram_fn glLinkProgram;
|
||||
glGetProgramInfoLog_fn glGetProgramInfoLog;
|
||||
glGetProgramiv_fn glGetProgramiv;
|
||||
glValidateProgram_fn glValidateProgram;
|
||||
glUseProgram_fn glUseProgram;
|
||||
glDeleteShader_fn glDeleteShader;
|
||||
glDeleteProgram_fn glDeleteProgram;
|
||||
|
||||
// Uniforms
|
||||
glGetUniformLocation_fn glGetUniformLocation;
|
||||
// glUniform1f_fn glUniform1f;
|
||||
// glUniform1fv_fn glUniform1fv;
|
||||
glUniform1i_fn glUniform1i;
|
||||
// glUniform1iv_fn glUniform1iv;
|
||||
// glUniform2f_fn glUniform2f;
|
||||
// glUniform2fv_fn glUniform2fv;
|
||||
// glUniform2i_fn glUniform2i;
|
||||
// glUniform2iv_fn glUniform2iv;
|
||||
// glUniform3f_fn glUniform3f;
|
||||
// glUniform3fv_fn glUniform3fv;
|
||||
// glUniform3i_fn glUniform3i;
|
||||
// glUniform3iv_fn glUniform3iv;
|
||||
// glUniform4f_fn glUniform4f;
|
||||
glUniform4fv_fn glUniform4fv;
|
||||
// glUniform4i_fn glUniform4i;
|
||||
// glUniform4iv_fn glUniform4iv;
|
||||
// glUniformMatrix2fv_fn glUniformMatrix2fv;
|
||||
// glUniformMatrix3fv_fn glUniformMatrix3fv;
|
||||
// glUniformMatrix4fv_fn glUniformMatrix4fv;
|
||||
|
||||
// Uniform buffer objects
|
||||
glBindBufferBase_fn glBindBufferBase;
|
||||
glBindBufferRange_fn glBindBufferRange;
|
||||
glGetUniformBlockIndex_fn glGetUniformBlockIndex;
|
||||
glUniformBlockBinding_fn glUniformBlockBinding;
|
||||
|
||||
// Sampler objects
|
||||
glBindSampler_fn glBindSampler;
|
||||
glDeleteSamplers_fn glDeleteSamplers;
|
||||
glGenSamplers_fn glGenSamplers;
|
||||
// glGetSamplerParameterIiv_fn glGetSamplerParameterIiv;
|
||||
// glGetSamplerParameterIuiv_fn glGetSamplerParameterIuiv;
|
||||
// glGetSamplerParameterfv_fn glGetSamplerParameterfv;
|
||||
// glGetSamplerParameteriv_fn glGetSamplerParameteriv;
|
||||
// glIsSampler_fn glIsSampler;
|
||||
// glSamplerParameterIiv_fn glSamplerParameterIiv;
|
||||
// glSamplerParameterIuiv_fn glSamplerParameterIuiv;
|
||||
glSamplerParameterf_fn glSamplerParameterf;
|
||||
glSamplerParameterfv_fn glSamplerParameterfv;
|
||||
glSamplerParameteri_fn glSamplerParameteri;
|
||||
// glSamplerParameteriv_fn glSamplerParameteriv;
|
||||
|
||||
private:
|
||||
|
||||
#if defined(_WIN32)
|
||||
WNDCLASSEX wndClass;
|
||||
HWND hDummyWnd;
|
||||
HDC hDummyDC;
|
||||
HGLRC hDummyOGLContext;
|
||||
|
||||
AMF_RESULT CreateDummy();
|
||||
AMF_RESULT DestroyDummy();
|
||||
#endif
|
||||
};
|
||||
472
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/PropertyStorageExImpl.cpp
vendored
Normal file
472
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/PropertyStorageExImpl.cpp
vendored
Normal file
@@ -0,0 +1,472 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include <climits>
|
||||
#include "PropertyStorageExImpl.h"
|
||||
#include "PropertyStorageImpl.h"
|
||||
#include "TraceAdapter.h"
|
||||
|
||||
#pragma warning(disable: 4996)
|
||||
|
||||
using namespace amf;
|
||||
|
||||
#define AMF_FACILITY L"AMFPropertyStorageExImpl"
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wexit-time-destructors"
|
||||
#pragma clang diagnostic ignored "-Wglobal-constructors"
|
||||
#endif
|
||||
|
||||
amf::AMFCriticalSection amf::ms_csAMFPropertyStorageExImplMaps;
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT amf::CastVariantToAMFProperty(amf::AMFVariantStruct* pDest, const amf::AMFVariantStruct* pSrc, amf::AMF_VARIANT_TYPE eType,
|
||||
amf::AMF_PROPERTY_CONTENT_TYPE /*contentType*/,
|
||||
const amf::AMFEnumDescriptionEntry* pEnumDescription)
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(pDest);
|
||||
|
||||
AMF_RESULT err = AMF_OK;
|
||||
switch (eType)
|
||||
{
|
||||
case AMF_VARIANT_INTERFACE:
|
||||
if (pSrc->type == eType)
|
||||
{
|
||||
err = AMFVariantCopy(pDest, pSrc);
|
||||
}
|
||||
else
|
||||
{
|
||||
pDest->type = AMF_VARIANT_INTERFACE;
|
||||
pDest->pInterface = nullptr;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMF_VARIANT_INT64:
|
||||
{
|
||||
if(pEnumDescription)
|
||||
{
|
||||
const AMFEnumDescriptionEntry* pEnumDescriptionCache = pEnumDescription;
|
||||
err = AMFVariantChangeType(pDest, pSrc, AMF_VARIANT_INT64);
|
||||
bool found = false;
|
||||
if(err == AMF_OK)
|
||||
{
|
||||
//mean numeric came. validating
|
||||
while(pEnumDescriptionCache->name)
|
||||
{
|
||||
if(pEnumDescriptionCache->value == AMFVariantGetInt64(pDest))
|
||||
{
|
||||
AMFVariantAssignInt64(pDest, pEnumDescriptionCache->value);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
pEnumDescriptionCache++;
|
||||
}
|
||||
err = found ? AMF_OK : AMF_INVALID_ARG;
|
||||
}
|
||||
if(!found)
|
||||
{
|
||||
pEnumDescriptionCache = pEnumDescription;
|
||||
err = AMFVariantChangeType(pDest, pSrc, AMF_VARIANT_WSTRING);
|
||||
if(err == AMF_OK)
|
||||
{
|
||||
//string came. validating and assigning numeric
|
||||
found = false;
|
||||
while(pEnumDescriptionCache->name)
|
||||
{
|
||||
if(amf_wstring(pEnumDescriptionCache->name) == AMFVariantGetWString(pDest))
|
||||
{
|
||||
AMFVariantAssignInt64(pDest, pEnumDescriptionCache->value);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
pEnumDescriptionCache++;
|
||||
}
|
||||
err = found ? AMF_OK : AMF_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = AMFVariantChangeType(pDest, pSrc, AMF_VARIANT_INT64);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
err = AMFVariantChangeType(pDest, pSrc, eType);
|
||||
break;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFPropertyInfoImpl::AMFPropertyInfoImpl(const wchar_t* name, const wchar_t* desc, AMF_VARIANT_TYPE type, AMF_PROPERTY_CONTENT_TYPE contentType,
|
||||
AMFVariantStruct defaultValue, AMFVariantStruct minValue, AMFVariantStruct maxValue, bool allowChangeInRuntime,
|
||||
const AMFEnumDescriptionEntry* pEnumDescription) : m_name(), m_desc()
|
||||
{
|
||||
AMF_PROPERTY_ACCESS_TYPE accessTypeTmp = allowChangeInRuntime ? AMF_PROPERTY_ACCESS_FULL : AMF_PROPERTY_ACCESS_READ_WRITE;
|
||||
Init(name, desc, type, contentType, defaultValue, minValue, maxValue, accessTypeTmp, pEnumDescription);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFPropertyInfoImpl::AMFPropertyInfoImpl(const wchar_t* name, const wchar_t* desc, AMF_VARIANT_TYPE type, AMF_PROPERTY_CONTENT_TYPE contentType,
|
||||
AMFVariantStruct defaultValue, AMFVariantStruct minValue, AMFVariantStruct maxValue, AMF_PROPERTY_ACCESS_TYPE accessType,
|
||||
const AMFEnumDescriptionEntry* pEnumDescription) : m_name(), m_desc()
|
||||
{
|
||||
Init(name, desc, type, contentType, defaultValue, minValue, maxValue, accessType, pEnumDescription);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFPropertyInfoImpl::AMFPropertyInfoImpl() : m_name(), m_desc()
|
||||
{
|
||||
AMFVariantInit(&this->defaultValue);
|
||||
AMFVariantInit(&this->minValue);
|
||||
AMFVariantInit(&this->maxValue);
|
||||
|
||||
name = L"";
|
||||
desc = L"";
|
||||
type = AMF_VARIANT_EMPTY;
|
||||
contentType = AMF_PROPERTY_CONTENT_TYPE(-1);
|
||||
accessType = AMF_PROPERTY_ACCESS_FULL;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
void AMFPropertyInfoImpl::Init(const wchar_t* name_, const wchar_t* desc_, AMF_VARIANT_TYPE type_, AMF_PROPERTY_CONTENT_TYPE contentType_,
|
||||
AMFVariantStruct defaultValue_, AMFVariantStruct minValue_, AMFVariantStruct maxValue_, AMF_PROPERTY_ACCESS_TYPE accessType_,
|
||||
const AMFEnumDescriptionEntry* pEnumDescription_)
|
||||
{
|
||||
m_name = name_;
|
||||
name = m_name.c_str();
|
||||
|
||||
m_desc = desc_;
|
||||
desc = m_desc.c_str();
|
||||
|
||||
type = type_;
|
||||
contentType = contentType_;
|
||||
accessType = accessType_;
|
||||
AMFVariantInit(&defaultValue);
|
||||
AMFVariantInit(&minValue);
|
||||
AMFVariantInit(&maxValue);
|
||||
pEnumDescription = pEnumDescription_;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case AMF_VARIANT_BOOL:
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignBool(&defaultValue, false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_RECT:
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignRect(&defaultValue, AMFConstructRect(0, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_SIZE:
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignSize(&defaultValue, AMFConstructSize(0, 0));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&minValue, &minValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignSize(&minValue, AMFConstructSize(INT_MIN, INT_MIN));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&maxValue, &maxValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignSize(&maxValue, AMFConstructSize(INT_MAX, INT_MAX));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_POINT:
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignPoint(&defaultValue, AMFConstructPoint(0, 0));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&minValue, &minValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignPoint(&minValue, AMFConstructPoint(INT_MIN, INT_MIN));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&maxValue, &maxValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignPoint(&maxValue, AMFConstructPoint(INT_MAX, INT_MAX));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_RATE:
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignRate(&defaultValue, AMFConstructRate(0, 0));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&this->minValue, &minValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignRate(&this->minValue, AMFConstructRate(0, 1));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&this->maxValue, &maxValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignRate(&this->maxValue, AMFConstructRate(INT_MAX, INT_MAX));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_RATIO:
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignRatio(&defaultValue, AMFConstructRatio(0, 0));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_COLOR:
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignColor(&defaultValue, AMFConstructColor(0, 0, 0, 255));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AMF_VARIANT_INT64:
|
||||
{
|
||||
if(pEnumDescription)
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignInt64(&defaultValue, pEnumDescription->value);
|
||||
}
|
||||
}
|
||||
else //AMF_PROPERTY_CONTENT_DEFAULT
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignInt64(&defaultValue, 0);
|
||||
}
|
||||
if(CastVariantToAMFProperty(&minValue, &minValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignInt64(&minValue, INT_MIN);
|
||||
}
|
||||
if(CastVariantToAMFProperty(&maxValue, &maxValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignInt64(&maxValue, INT_MAX);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AMF_VARIANT_DOUBLE:
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignDouble(&defaultValue, 0);
|
||||
}
|
||||
if(CastVariantToAMFProperty(&minValue, &minValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignDouble(&minValue, DBL_MIN);
|
||||
}
|
||||
if(CastVariantToAMFProperty(&maxValue, &maxValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignDouble(&maxValue, DBL_MAX);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AMF_VARIANT_STRING:
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignString(&maxValue, "");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AMF_VARIANT_WSTRING:
|
||||
{
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignWString(&maxValue, L"");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AMF_VARIANT_INTERFACE:
|
||||
if(CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignWString(&maxValue, L"");
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_FLOAT:
|
||||
{
|
||||
if (CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloat(&defaultValue, 0);
|
||||
}
|
||||
if (CastVariantToAMFProperty(&minValue, &minValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloat(&minValue, FLT_MIN);
|
||||
}
|
||||
if (CastVariantToAMFProperty(&maxValue, &maxValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloat(&maxValue, FLT_MAX);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_FLOAT_SIZE:
|
||||
{
|
||||
if (CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatSize(&defaultValue, AMFConstructFloatSize(0, 0));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&minValue, &minValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatSize(&minValue, AMFConstructFloatSize(FLT_MIN, FLT_MIN));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&maxValue, &maxValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatSize(&maxValue, AMFConstructFloatSize(FLT_MAX, FLT_MAX));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_FLOAT_POINT2D:
|
||||
{
|
||||
if (CastVariantToAMFProperty(&defaultValue, &defaultValue, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatPoint2D(&defaultValue, AMFConstructFloatPoint2D(0, 0));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&minValue, &minValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatPoint2D(&minValue, AMFConstructFloatPoint2D(FLT_MIN, FLT_MIN));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&maxValue, &maxValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatPoint2D(&maxValue, AMFConstructFloatPoint2D(FLT_MAX, FLT_MAX));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_FLOAT_POINT3D:
|
||||
{
|
||||
if (CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatPoint3D(&defaultValue, AMFConstructFloatPoint3D(0, 0, 0));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&minValue, &minValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatPoint3D(&minValue, AMFConstructFloatPoint3D(FLT_MIN, FLT_MIN, FLT_MIN));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&maxValue, &maxValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatPoint3D(&maxValue, AMFConstructFloatPoint3D(FLT_MAX, FLT_MAX, FLT_MAX));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_FLOAT_VECTOR4D:
|
||||
{
|
||||
if (CastVariantToAMFProperty(&defaultValue, &defaultValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatVector4D(&defaultValue, AMFConstructFloatVector4D(0, 0, 0, 0));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&minValue, &minValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatVector4D(&minValue, AMFConstructFloatVector4D(FLT_MIN, FLT_MIN, FLT_MIN, FLT_MIN));
|
||||
}
|
||||
if (CastVariantToAMFProperty(&maxValue, &maxValue_, type, contentType, pEnumDescription) != AMF_OK)
|
||||
{
|
||||
AMFVariantAssignFloatVector4D(&maxValue, AMFConstructFloatVector4D(FLT_MAX, FLT_MAX, FLT_MAX, FLT_MAX));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
value = defaultValue;
|
||||
}
|
||||
|
||||
AMFPropertyInfoImpl::AMFPropertyInfoImpl(const AMFPropertyInfoImpl& propertyInfo) : AMFPropertyInfo(), m_name(), m_desc()
|
||||
{
|
||||
Init(propertyInfo.name, propertyInfo.desc, propertyInfo.type, propertyInfo.contentType, propertyInfo.defaultValue, propertyInfo.minValue, propertyInfo.maxValue, propertyInfo.accessType, propertyInfo.pEnumDescription);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFPropertyInfoImpl& AMFPropertyInfoImpl::operator=(const AMFPropertyInfoImpl& propertyInfo)
|
||||
{
|
||||
// store name and desc inside instance in m_sName and m_sDesc recpectively;
|
||||
// m_pName and m_pDesc are pointed to our local copies
|
||||
this->m_name = propertyInfo.name;
|
||||
this->m_desc = propertyInfo.desc;
|
||||
this->name = m_name.c_str();
|
||||
this->desc = m_desc.c_str();
|
||||
|
||||
this->type = propertyInfo.type;
|
||||
this->contentType = propertyInfo.contentType;
|
||||
this->accessType = propertyInfo.accessType;
|
||||
AMFVariantCopy(&this->defaultValue, &propertyInfo.defaultValue);
|
||||
AMFVariantCopy(&this->minValue, &propertyInfo.minValue);
|
||||
AMFVariantCopy(&this->maxValue, &propertyInfo.maxValue);
|
||||
this->pEnumDescription = propertyInfo.pEnumDescription;
|
||||
|
||||
this->value = propertyInfo.value;
|
||||
this->userModified = propertyInfo.userModified;
|
||||
|
||||
return *this;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFPropertyInfoImpl::~AMFPropertyInfoImpl()
|
||||
{
|
||||
AMFVariantClear(&this->defaultValue);
|
||||
AMFVariantClear(&this->minValue);
|
||||
AMFVariantClear(&this->maxValue);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
617
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/PropertyStorageExImpl.h
vendored
Normal file
617
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/PropertyStorageExImpl.h
vendored
Normal file
@@ -0,0 +1,617 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
///-------------------------------------------------------------------------
|
||||
/// @file PropertyStorageExImpl.h
|
||||
/// @brief AMFPropertyStorageExImpl header
|
||||
///-------------------------------------------------------------------------
|
||||
#ifndef AMF_PropertyStorageExImpl_h
|
||||
#define AMF_PropertyStorageExImpl_h
|
||||
#pragma once
|
||||
|
||||
#include "../include/core/PropertyStorageEx.h"
|
||||
#include "Thread.h"
|
||||
#include "InterfaceImpl.h"
|
||||
#include "ObservableImpl.h"
|
||||
#include "TraceAdapter.h"
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
#include <memory>
|
||||
|
||||
namespace amf
|
||||
{
|
||||
|
||||
AMF_RESULT CastVariantToAMFProperty(AMFVariantStruct* pDest, const AMFVariantStruct* pSrc, AMF_VARIANT_TYPE eType,
|
||||
AMF_PROPERTY_CONTENT_TYPE contentType,
|
||||
const AMFEnumDescriptionEntry* pEnumDescription = 0);
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
class AMFPropertyInfoImpl : public AMFPropertyInfo
|
||||
{
|
||||
private:
|
||||
amf_wstring m_name;
|
||||
amf_wstring m_desc;
|
||||
|
||||
void Init(const wchar_t* name, const wchar_t* desc, AMF_VARIANT_TYPE type, AMF_PROPERTY_CONTENT_TYPE contentType,
|
||||
AMFVariantStruct defaultValue, AMFVariantStruct minValue, AMFVariantStruct maxValue, AMF_PROPERTY_ACCESS_TYPE accessType,
|
||||
const AMFEnumDescriptionEntry* pEnumDescription);
|
||||
|
||||
public:
|
||||
AMFVariant value;
|
||||
amf_bool userModified = false;
|
||||
|
||||
public:
|
||||
AMFPropertyInfoImpl(const wchar_t* name, const wchar_t* desc, AMF_VARIANT_TYPE type, AMF_PROPERTY_CONTENT_TYPE contentType,
|
||||
AMFVariantStruct defaultValue, AMFVariantStruct minValue, AMFVariantStruct maxValue, bool allowChangeInRuntime,
|
||||
const AMFEnumDescriptionEntry* pEnumDescription);
|
||||
AMFPropertyInfoImpl(const wchar_t* name, const wchar_t* desc, AMF_VARIANT_TYPE type, AMF_PROPERTY_CONTENT_TYPE contentType,
|
||||
AMFVariantStruct defaultValue, AMFVariantStruct minValue, AMFVariantStruct maxValue, AMF_PROPERTY_ACCESS_TYPE accessType,
|
||||
const AMFEnumDescriptionEntry* pEnumDescription);
|
||||
AMFPropertyInfoImpl();
|
||||
|
||||
AMFPropertyInfoImpl(const AMFPropertyInfoImpl& propertyInfo);
|
||||
AMFPropertyInfoImpl& operator=(const AMFPropertyInfoImpl& propertyInfo);
|
||||
|
||||
virtual ~AMFPropertyInfoImpl();
|
||||
|
||||
virtual void OnPropertyChanged() { }
|
||||
};
|
||||
|
||||
typedef amf_map<amf_wstring, std::shared_ptr<AMFPropertyInfoImpl> > PropertyInfoMap;
|
||||
|
||||
//---------------------------------------------------------------------------------------------
|
||||
template<typename _TBase> class AMFPropertyStorageExImpl :
|
||||
public _TBase,
|
||||
public AMFObservableImpl<AMFPropertyStorageObserver>
|
||||
{
|
||||
protected:
|
||||
PropertyInfoMap m_PropertiesInfo;
|
||||
AMFCriticalSection m_Sync; //thread-safety lock.
|
||||
|
||||
public:
|
||||
AMFPropertyStorageExImpl()
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~AMFPropertyStorageExImpl()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// interface access
|
||||
AMF_BEGIN_INTERFACE_MAP
|
||||
AMF_INTERFACE_ENTRY(AMFPropertyStorage)
|
||||
AMF_INTERFACE_ENTRY(AMFPropertyStorageEx)
|
||||
AMF_END_INTERFACE_MAP
|
||||
|
||||
|
||||
using _TBase::GetProperty;
|
||||
using _TBase::SetProperty;
|
||||
|
||||
// interface
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL Clear()
|
||||
{
|
||||
ResetDefaultValues();
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL AddTo(AMFPropertyStorage* pDest, bool overwrite, bool /*deep*/) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(pDest);
|
||||
|
||||
if (pDest != this)
|
||||
{
|
||||
AMFLock lock(const_cast<AMFCriticalSection*>(&m_Sync));
|
||||
for (PropertyInfoMap::const_iterator it = m_PropertiesInfo.begin(); it != m_PropertiesInfo.end(); it++)
|
||||
{
|
||||
if (!overwrite && pDest->HasProperty(it->first.c_str()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
AMF_RESULT err = pDest->SetProperty(it->first.c_str(), it->second->value);
|
||||
if (err != AMF_INVALID_ARG) // not validated - skip it
|
||||
{
|
||||
AMF_RETURN_IF_FAILED(err, L"AddTo() - failed to copy property=%s", it->first.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL CopyTo(AMFPropertyStorage* pDest, bool deep) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(pDest);
|
||||
|
||||
if (pDest != this)
|
||||
{
|
||||
pDest->Clear();
|
||||
return AddTo(pDest, true, deep);
|
||||
}
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL SetProperty(const wchar_t* name, AMFVariantStruct value)
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(name);
|
||||
|
||||
const AMFPropertyInfo* pParamInfo = NULL;
|
||||
AMF_RESULT err = GetPropertyInfo(name, &pParamInfo);
|
||||
if (err != AMF_OK)
|
||||
{
|
||||
return err;
|
||||
}
|
||||
|
||||
if (pParamInfo && !pParamInfo->AllowedWrite())
|
||||
{
|
||||
return AMF_ACCESS_DENIED;
|
||||
}
|
||||
return SetPrivateProperty(name, value);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL GetProperty(const wchar_t* name, AMFVariantStruct* pValue) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(name);
|
||||
AMF_RETURN_IF_INVALID_POINTER(pValue);
|
||||
|
||||
const AMFPropertyInfo* pParamInfo = NULL;
|
||||
AMF_RESULT err = GetPropertyInfo(name, &pParamInfo);
|
||||
if (err != AMF_OK)
|
||||
{
|
||||
return err;
|
||||
}
|
||||
|
||||
if (pParamInfo && !pParamInfo->AllowedRead())
|
||||
{
|
||||
return AMF_ACCESS_DENIED;
|
||||
}
|
||||
return GetPrivateProperty(name, pValue);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual bool AMF_STD_CALL HasProperty(const wchar_t* name) const
|
||||
{
|
||||
const AMFPropertyInfo* pParamInfo = NULL;
|
||||
AMF_RESULT err = GetPropertyInfo(name, &pParamInfo);
|
||||
return (err != AMF_OK) ? false : true;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual amf_size AMF_STD_CALL GetPropertyCount() const
|
||||
{
|
||||
return m_PropertiesInfo.size();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL GetPropertyAt(amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(name);
|
||||
AMF_RETURN_IF_INVALID_POINTER(pValue);
|
||||
AMF_RETURN_IF_FALSE(nameSize != 0, AMF_INVALID_ARG);
|
||||
AMF_RETURN_IF_FALSE(index < m_PropertiesInfo.size(), AMF_INVALID_ARG);
|
||||
|
||||
PropertyInfoMap::const_iterator found = m_PropertiesInfo.begin();
|
||||
for (amf_size i = 0; i < index; i++)
|
||||
{
|
||||
found++;
|
||||
}
|
||||
|
||||
size_t copySize = AMF_MIN(nameSize-1, found->first.length());
|
||||
memcpy(name, found->first.c_str(), copySize * sizeof(wchar_t));
|
||||
name[copySize] = 0;
|
||||
AMFLock lock(const_cast<AMFCriticalSection*>(&m_Sync));
|
||||
AMFVariantCopy(pValue, &found->second->value);
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual amf_size AMF_STD_CALL GetPropertiesInfoCount() const
|
||||
{
|
||||
return m_PropertiesInfo.size();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL GetPropertyInfo(amf_size szInd, const AMFPropertyInfo** ppParamInfo) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(ppParamInfo);
|
||||
AMF_RETURN_IF_FALSE(szInd < m_PropertiesInfo.size(), AMF_INVALID_ARG);
|
||||
|
||||
PropertyInfoMap::const_iterator it = m_PropertiesInfo.begin();
|
||||
for (; szInd > 0; --szInd)
|
||||
{
|
||||
it++;
|
||||
}
|
||||
|
||||
*ppParamInfo = it->second.get();
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL GetPropertyInfo(const wchar_t* name, const AMFPropertyInfo** ppParamInfo) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(name);
|
||||
AMF_RETURN_IF_INVALID_POINTER(ppParamInfo);
|
||||
|
||||
PropertyInfoMap::const_iterator it = m_PropertiesInfo.find(name);
|
||||
if (it != m_PropertiesInfo.end())
|
||||
{
|
||||
*ppParamInfo = it->second.get();
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
return AMF_NOT_FOUND;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL ValidateProperty(const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(name);
|
||||
AMF_RETURN_IF_INVALID_POINTER(pOutValidated);
|
||||
|
||||
AMF_RESULT err = AMF_OK;
|
||||
const AMFPropertyInfo* pParamInfo = NULL;
|
||||
|
||||
AMF_RETURN_IF_FAILED(GetPropertyInfo(name, &pParamInfo), L"Property=%s", name);
|
||||
AMF_RETURN_IF_FAILED(CastVariantToAMFProperty(pOutValidated, &value, pParamInfo->type, pParamInfo->contentType, pParamInfo->pEnumDescription), L"Property=%s", name);
|
||||
|
||||
switch(pParamInfo->type)
|
||||
{
|
||||
case AMF_VARIANT_INT64:
|
||||
if((pParamInfo->minValue.type != AMF_VARIANT_EMPTY && AMFVariantGetInt64(pOutValidated) < AMFVariantGetInt64(&pParamInfo->minValue)) ||
|
||||
(pParamInfo->maxValue.type != AMF_VARIANT_EMPTY && AMFVariantGetInt64(pOutValidated) > AMFVariantGetInt64(&pParamInfo->maxValue)) )
|
||||
{
|
||||
err = AMF_OUT_OF_RANGE;
|
||||
}
|
||||
break;
|
||||
|
||||
case AMF_VARIANT_DOUBLE:
|
||||
if((AMFVariantGetDouble(pOutValidated) < AMFVariantGetDouble(&pParamInfo->minValue)) ||
|
||||
(AMFVariantGetDouble(pOutValidated) > AMFVariantGetDouble(&pParamInfo->maxValue)) )
|
||||
{
|
||||
err = AMF_OUT_OF_RANGE;
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_FLOAT:
|
||||
if ((AMFVariantGetFloat(pOutValidated) < AMFVariantGetFloat(&pParamInfo->minValue)) ||
|
||||
(AMFVariantGetFloat(pOutValidated) > AMFVariantGetFloat(&pParamInfo->maxValue)))
|
||||
{
|
||||
err = AMF_OUT_OF_RANGE;
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_RATE:
|
||||
{
|
||||
// NOTE: denominator can't be 0
|
||||
const AMFRate& validatedSize = AMFVariantGetRate(pOutValidated);
|
||||
AMFRate minSize = AMFConstructRate(0, 1);
|
||||
AMFRate maxSize = AMFConstructRate(INT_MAX, INT_MAX);
|
||||
if (pParamInfo->minValue.type != AMF_VARIANT_EMPTY)
|
||||
{
|
||||
minSize = AMFVariantGetRate(&pParamInfo->minValue);
|
||||
}
|
||||
if (pParamInfo->maxValue.type != AMF_VARIANT_EMPTY)
|
||||
{
|
||||
maxSize = AMFVariantGetRate(&pParamInfo->maxValue);
|
||||
}
|
||||
if (validatedSize.num < minSize.num || validatedSize.num > maxSize.num ||
|
||||
validatedSize.den < minSize.den || validatedSize.den > maxSize.den)
|
||||
{
|
||||
err = AMF_OUT_OF_RANGE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_SIZE:
|
||||
{
|
||||
AMFSize validatedSize = AMFVariantGetSize(pOutValidated);
|
||||
AMFSize minSize = AMFConstructSize(0, 0);
|
||||
AMFSize maxSize = AMFConstructSize(INT_MAX, INT_MAX);
|
||||
if (pParamInfo->minValue.type != AMF_VARIANT_EMPTY)
|
||||
{
|
||||
minSize = AMFVariantGetSize(&pParamInfo->minValue);
|
||||
}
|
||||
if (pParamInfo->maxValue.type != AMF_VARIANT_EMPTY)
|
||||
{
|
||||
maxSize = AMFVariantGetSize(&pParamInfo->maxValue);
|
||||
}
|
||||
if (validatedSize.width < minSize.width || validatedSize.height < minSize.height ||
|
||||
validatedSize.width > maxSize.width || validatedSize.height > maxSize.height)
|
||||
{
|
||||
err = AMF_OUT_OF_RANGE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AMF_VARIANT_FLOAT_SIZE:
|
||||
{
|
||||
AMFFloatSize validatedSize = AMFVariantGetFloatSize(pOutValidated);
|
||||
AMFFloatSize minSize = AMFConstructFloatSize(0, 0);
|
||||
AMFFloatSize maxSize = AMFConstructFloatSize(FLT_MIN, FLT_MAX);
|
||||
if (pParamInfo->minValue.type != AMF_VARIANT_EMPTY)
|
||||
{
|
||||
minSize = AMFVariantGetFloatSize(&pParamInfo->minValue);
|
||||
}
|
||||
if (pParamInfo->maxValue.type != AMF_VARIANT_EMPTY)
|
||||
{
|
||||
maxSize = AMFVariantGetFloatSize(&pParamInfo->maxValue);
|
||||
}
|
||||
if (validatedSize.width < minSize.width || validatedSize.height < minSize.height ||
|
||||
validatedSize.width > maxSize.width || validatedSize.height > maxSize.height)
|
||||
{
|
||||
err = AMF_OUT_OF_RANGE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default: // GK: Clang issues a warning when not every value of an enum is handled in a switch-case
|
||||
break;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual void AMF_STD_CALL OnPropertyChanged(const wchar_t* /*name*/){ }
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual void AMF_STD_CALL AddObserver(AMFPropertyStorageObserver* pObserver)
|
||||
{
|
||||
AMFLock lock(&m_Sync);
|
||||
AMFObservableImpl<AMFPropertyStorageObserver>::AddObserver(pObserver);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual void AMF_STD_CALL RemoveObserver(AMFPropertyStorageObserver* pObserver)
|
||||
{
|
||||
AMFLock lock(&m_Sync);
|
||||
AMFObservableImpl<AMFPropertyStorageObserver>::RemoveObserver(pObserver);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
protected:
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT SetAccessType(const wchar_t* name, AMF_PROPERTY_ACCESS_TYPE accessType)
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(name);
|
||||
|
||||
PropertyInfoMap::iterator found = m_PropertiesInfo.find(name);
|
||||
AMF_RETURN_IF_FALSE(found != m_PropertiesInfo.end(), AMF_NOT_FOUND);
|
||||
|
||||
if (found->second->accessType == accessType)
|
||||
{
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
found->second->accessType = accessType;
|
||||
OnPropertyChanged(name);
|
||||
NotifyObservers<const wchar_t*>(&AMFPropertyStorageObserver::OnPropertyChanged, name);
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT SetPrivateProperty(const wchar_t* name, AMFVariantStruct value)
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(name);
|
||||
|
||||
AMFVariant validatedValue;
|
||||
AMF_RESULT validateResult = ValidateProperty(name, value, &validatedValue);
|
||||
if (validateResult != AMF_OK)
|
||||
{
|
||||
return validateResult;
|
||||
}
|
||||
|
||||
PropertyInfoMap::iterator found = m_PropertiesInfo.find(name);
|
||||
if (found == m_PropertiesInfo.end())
|
||||
{
|
||||
return AMF_NOT_FOUND;
|
||||
}
|
||||
{
|
||||
AMFLock lock(&m_Sync);
|
||||
|
||||
if (found->second->value == validatedValue)
|
||||
{
|
||||
return AMF_OK;
|
||||
}
|
||||
found->second->value = validatedValue;
|
||||
}
|
||||
found->second->OnPropertyChanged();
|
||||
OnPropertyChanged(name);
|
||||
NotifyObservers<const wchar_t*>(&AMFPropertyStorageObserver::OnPropertyChanged, name);
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT GetPrivateProperty(const wchar_t* name, AMFVariantStruct* pValue) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(name);
|
||||
AMF_RETURN_IF_INVALID_POINTER(pValue);
|
||||
|
||||
|
||||
PropertyInfoMap::const_iterator found = m_PropertiesInfo.find(name);
|
||||
if (found != m_PropertiesInfo.end())
|
||||
{
|
||||
AMFLock lock(const_cast<AMFCriticalSection*>(&m_Sync));
|
||||
AMFVariantCopy(pValue, &found->second->value);
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
// NOTE: needed for internal components that don't automatically
|
||||
// expose their properties in the main map...
|
||||
const AMFPropertyInfo* pParamInfo;
|
||||
if (GetPropertyInfo(name, &pParamInfo) == AMF_OK)
|
||||
{
|
||||
AMFLock lock(const_cast<AMFCriticalSection*>(&m_Sync));
|
||||
AMFVariantCopy(pValue, &pParamInfo->defaultValue);
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
return AMF_NOT_FOUND;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
template<typename _T>
|
||||
AMF_RESULT AMF_STD_CALL SetPrivateProperty(const wchar_t* name, const _T& value)
|
||||
{
|
||||
AMF_RESULT err = SetPrivateProperty(name, static_cast<const AMFVariantStruct&>(AMFVariant(value)));
|
||||
return err;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
template<typename _T>
|
||||
AMF_RESULT AMF_STD_CALL GetPrivateProperty(const wchar_t* name, _T* pValue) const
|
||||
{
|
||||
AMFVariant var;
|
||||
AMF_RESULT err = GetPrivateProperty(name, static_cast<AMFVariantStruct*>(&var));
|
||||
if(err == AMF_OK)
|
||||
{
|
||||
*pValue = static_cast<_T>(var);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
bool HasPrivateProperty(const wchar_t* name) const
|
||||
{
|
||||
return m_PropertiesInfo.find(name) != m_PropertiesInfo.end();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
bool IsRuntimeChange(const wchar_t* name) const
|
||||
{
|
||||
PropertyInfoMap::const_iterator it = m_PropertiesInfo.find(name);
|
||||
return (it != m_PropertiesInfo.end()) ? it->second->AllowedChangeInRuntime() : false;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
void ResetDefaultValues()
|
||||
{
|
||||
AMFLock lock(&m_Sync);
|
||||
// copy defaults to property storage
|
||||
for (PropertyInfoMap::iterator it = m_PropertiesInfo.begin(); it != m_PropertiesInfo.end(); ++it)
|
||||
{
|
||||
AMFPropertyInfoImpl* info = it->second.get();
|
||||
|
||||
info->value = info->defaultValue;
|
||||
info->userModified = false;
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
AMFPropertyStorageExImpl(const AMFPropertyStorageExImpl&);
|
||||
AMFPropertyStorageExImpl& operator=(const AMFPropertyStorageExImpl&);
|
||||
};
|
||||
extern AMFCriticalSection ms_csAMFPropertyStorageExImplMaps;
|
||||
//---------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#define AMFPrimitivePropertyInfoMapBegin \
|
||||
{ \
|
||||
amf::AMFPropertyInfoImpl* s_PropertiesInfo[] = \
|
||||
{
|
||||
|
||||
#define AMFPrimitivePropertyInfoMapEnd \
|
||||
}; \
|
||||
for (amf_size i = 0; i < sizeof(s_PropertiesInfo) / sizeof(s_PropertiesInfo[0]); ++i) \
|
||||
{ \
|
||||
amf::AMFPropertyInfoImpl* pPropInfo = s_PropertiesInfo[i]; \
|
||||
m_PropertiesInfo[pPropInfo->name].reset(pPropInfo); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#define AMFPropertyInfoBool(_name, _desc, _defaultValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_BOOL, 0, amf::AMFVariant(_defaultValue), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoEnum(_name, _desc, _defaultValue, pEnumDescription, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_INT64, 0, amf::AMFVariant(amf_int64(_defaultValue)), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, pEnumDescription)
|
||||
|
||||
#define AMFPropertyInfoInt64(_name, _desc, _defaultValue, _minValue, _maxValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_INT64, 0, amf::AMFVariant(amf_int64(_defaultValue)), \
|
||||
amf::AMFVariant(amf_int64(_minValue)), amf::AMFVariant(amf_int64(_maxValue)), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoDouble(_name, _desc, _defaultValue, _minValue, _maxValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_DOUBLE, 0, amf::AMFVariant(amf_double(_defaultValue)), \
|
||||
amf::AMFVariant(amf_double(_minValue)), amf::AMFVariant(amf_double(_maxValue)), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoFloat(_name, _desc, _defaultValue, _minValue, _maxValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_FLOAT, 0, amf::AMFVariant(amf_float(_defaultValue)), \
|
||||
amf::AMFVariant(amf_float(_minValue)), amf::AMFVariant(amf_float(_maxValue)), _AccessType, 0)
|
||||
|
||||
|
||||
#define AMFPropertyInfoRect(_name, _desc, defaultLeft, defaultTop, defaultRight, defaultBottom, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_RECT, 0, amf::AMFVariant(AMFConstructRect(defaultLeft, defaultTop, defaultRight, defaultBottom)), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoPoint(_name, _desc, defaultX, defaultY, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_POINT, 0, amf::AMFVariant(AMFConstructPoint(defaultX, defaultY)), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoSize(_name, _desc, _defaultValue, _minValue, _maxValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_SIZE, 0, amf::AMFVariant(AMFSize(_defaultValue)), \
|
||||
amf::AMFVariant(AMFSize(_minValue)), amf::AMFVariant(AMFSize(_maxValue)), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoFloatSize(_name, _desc, _defaultValue, _minValue, _maxValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_FLOAT_SIZE, 0, amf::AMFVariant(AMFFloatSize(_defaultValue)), \
|
||||
amf::AMFVariant(AMFFloatSize(_minValue)), amf::AMFVariant(AMFFloatSize(_maxValue)), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoRate(_name, _desc, defaultNum, defaultDen, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_RATE, 0, amf::AMFVariant(AMFConstructRate(defaultNum, defaultDen)), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoRateEx(_name, _desc, _defaultValue, _minValue, _maxValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_RATE, 0, amf::AMFVariant(_defaultValue), \
|
||||
amf::AMFVariant(_minValue), amf::AMFVariant(_maxValue), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoRatio(_name, _desc, defaultNum, defaultDen, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_RATIO, 0, amf::AMFVariant(AMFConstructRatio(defaultNum, defaultDen)), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoColor(_name, _desc, defaultR, defaultG, defaultB, defaultA, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_COLOR, 0, amf::AMFVariant(AMFConstructColor(defaultR, defaultG, defaultB, defaultA)), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, 0)
|
||||
|
||||
|
||||
#define AMFPropertyInfoString(_name, _desc, _defaultValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_STRING, 0, amf::AMFVariant(_defaultValue), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoWString(_name, _desc, _defaultValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_WSTRING, 0, amf::AMFVariant(_defaultValue), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoInterface(_name, _desc, _defaultValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_INTERFACE, 0, amf::AMFVariant(amf::AMFInterfacePtr(_defaultValue)), \
|
||||
amf::AMFVariant(amf::AMFInterfacePtr()), amf::AMFVariant(amf::AMFInterfacePtr()), _AccessType, 0)
|
||||
|
||||
|
||||
#define AMFPropertyInfoXML(_name, _desc, _defaultValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_STRING, AMF_PROPERTY_CONTENT_XML, amf::AMFVariant(_defaultValue), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoPath(_name, _desc, _defaultValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_WSTRING, AMF_PROPERTY_CONTENT_FILE_OPEN_PATH, amf::AMFVariant(_defaultValue), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoSavePath(_name, _desc, _defaultValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_WSTRING, AMF_PROPERTY_CONTENT_FILE_SAVE_PATH, amf::AMFVariant(_defaultValue), \
|
||||
amf::AMFVariant(), amf::AMFVariant(), _AccessType, 0)
|
||||
|
||||
#define AMFPropertyInfoFloatVector4D(_name, _desc, _defaultValue, _minValue, _maxValue, _AccessType) \
|
||||
new amf::AMFPropertyInfoImpl(_name, _desc, amf::AMF_VARIANT_FLOAT_VECTOR4D, 0, amf::AMFVariant(_defaultValue), \
|
||||
amf::AMFVariant(_minValue), amf::AMFVariant(_maxValue), _AccessType, 0)
|
||||
|
||||
} // namespace amf
|
||||
|
||||
#endif // #ifndef AMF_PropertyStorageExImpl_h
|
||||
194
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/PropertyStorageImpl.h
vendored
Normal file
194
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/PropertyStorageImpl.h
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
///-------------------------------------------------------------------------
|
||||
/// @file PropertyStorageImpl.h
|
||||
/// @brief AMFPropertyStorageImpl header
|
||||
///-------------------------------------------------------------------------
|
||||
#ifndef AMF_PropertyStorageImpl_h
|
||||
#define AMF_PropertyStorageImpl_h
|
||||
#pragma once
|
||||
|
||||
#include "../include/core/PropertyStorage.h"
|
||||
#include "Thread.h"
|
||||
#include "InterfaceImpl.h"
|
||||
#include "ObservableImpl.h"
|
||||
#include "TraceAdapter.h"
|
||||
|
||||
namespace amf
|
||||
{
|
||||
//---------------------------------------------------------------------------------------------
|
||||
template<typename _TBase> class AMFPropertyStorageImpl :
|
||||
public _TBase,
|
||||
public AMFObservableImpl<AMFPropertyStorageObserver>
|
||||
{
|
||||
public:
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMFPropertyStorageImpl() : m_PropertyValues()
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual ~AMFPropertyStorageImpl()
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// interface access
|
||||
AMF_BEGIN_INTERFACE_MAP
|
||||
AMF_INTERFACE_ENTRY(AMFPropertyStorage)
|
||||
AMF_END_INTERFACE_MAP
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL SetProperty(const wchar_t* pName, AMFVariantStruct value)
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(pName);
|
||||
|
||||
m_PropertyValues[pName] = value;
|
||||
OnPropertyChanged(pName);
|
||||
NotifyObservers<const wchar_t*>(&AMFPropertyStorageObserver::OnPropertyChanged, pName);
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL GetProperty(const wchar_t* pName, AMFVariantStruct* pValue) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(pName);
|
||||
AMF_RETURN_IF_INVALID_POINTER(pValue);
|
||||
|
||||
amf_wstring name(pName);
|
||||
amf_map<amf_wstring, AMFVariant>::const_iterator found = m_PropertyValues.find(name);
|
||||
if(found != m_PropertyValues.end())
|
||||
{
|
||||
AMFVariantCopy(pValue, &found->second);
|
||||
return AMF_OK;
|
||||
}
|
||||
return AMF_NOT_FOUND;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual bool AMF_STD_CALL HasProperty(const wchar_t* pName) const
|
||||
{
|
||||
AMF_ASSERT(pName != NULL);
|
||||
return m_PropertyValues.find(pName) != m_PropertyValues.end();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual amf_size AMF_STD_CALL GetPropertyCount() const
|
||||
{
|
||||
return m_PropertyValues.size();
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL GetPropertyAt(amf_size index, wchar_t* pName, amf_size nameSize, AMFVariantStruct* pValue) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(pName);
|
||||
AMF_RETURN_IF_INVALID_POINTER(pValue);
|
||||
AMF_RETURN_IF_FALSE(nameSize != 0, AMF_INVALID_ARG);
|
||||
amf_map<amf_wstring, AMFVariant>::const_iterator found = m_PropertyValues.begin();
|
||||
if(found == m_PropertyValues.end())
|
||||
{
|
||||
return AMF_INVALID_ARG;
|
||||
}
|
||||
for( amf_size i = 0; i < index; i++)
|
||||
{
|
||||
found++;
|
||||
if(found == m_PropertyValues.end())
|
||||
{
|
||||
return AMF_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
size_t copySize = AMF_MIN(nameSize-1, found->first.length());
|
||||
memcpy(pName, found->first.c_str(), copySize * sizeof(wchar_t));
|
||||
pName[copySize] = 0;
|
||||
AMFVariantCopy(pValue, &found->second);
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL Clear()
|
||||
{
|
||||
m_PropertyValues.clear();
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL AddTo(AMFPropertyStorage* pDest, bool overwrite, bool /*deep*/) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(pDest);
|
||||
AMF_RESULT err = AMF_OK;
|
||||
amf_map<amf_wstring, AMFVariant>::const_iterator it = m_PropertyValues.begin();
|
||||
|
||||
for(; it != m_PropertyValues.end(); it++)
|
||||
{
|
||||
if(!HasProperty(it->first.c_str())) // ignore properties which aren't accessible
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!overwrite)
|
||||
{
|
||||
if(pDest->HasProperty(it->first.c_str()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
{
|
||||
err = pDest->SetProperty(it->first.c_str(), it->second);
|
||||
}
|
||||
if(err == AMF_ACCESS_DENIED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
AMF_RETURN_IF_FAILED(err, L"AddTo() - failed to copy property=%s", it->first.c_str());
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual AMF_RESULT AMF_STD_CALL CopyTo(AMFPropertyStorage* pDest, bool deep) const
|
||||
{
|
||||
AMF_RETURN_IF_INVALID_POINTER(pDest);
|
||||
if(pDest != this)
|
||||
{
|
||||
pDest->Clear();
|
||||
return AddTo(pDest, true, deep);
|
||||
}
|
||||
else
|
||||
{
|
||||
return AMF_OK;
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual void AMF_STD_CALL OnPropertyChanged(const wchar_t* /*name*/) { }
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual void AMF_STD_CALL AddObserver(AMFPropertyStorageObserver* pObserver) { AMFObservableImpl<AMFPropertyStorageObserver>::AddObserver(pObserver); }
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
virtual void AMF_STD_CALL RemoveObserver(AMFPropertyStorageObserver* pObserver) { AMFObservableImpl<AMFPropertyStorageObserver>::RemoveObserver(pObserver); }
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
protected:
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
amf_map<amf_wstring, AMFVariant> m_PropertyValues;
|
||||
};
|
||||
//---------------------------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------------------------
|
||||
}
|
||||
#endif // AMF_PropertyStorageImpl_h
|
||||
624
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Thread.cpp
vendored
Normal file
624
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Thread.cpp
vendored
Normal file
@@ -0,0 +1,624 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <process.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include "Thread.h"
|
||||
|
||||
#if defined(METRO_APP)
|
||||
#include <ppl.h>
|
||||
#include <ppltasks.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
namespace amf
|
||||
{
|
||||
//----------------------------------------------------------------------------
|
||||
AMFEvent::AMFEvent(bool bInitiallyOwned, bool bManualReset, const wchar_t* pName) : m_hSyncObject()
|
||||
{
|
||||
m_hSyncObject = amf_create_event(bInitiallyOwned, bManualReset, pName);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
AMFEvent::~AMFEvent()
|
||||
{
|
||||
amf_delete_event(m_hSyncObject);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFEvent::Lock(amf_ulong ulTimeout)
|
||||
{
|
||||
return amf_wait_for_event(m_hSyncObject, ulTimeout);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFEvent::LockTimeout(amf_ulong ulTimeout)
|
||||
{
|
||||
return amf_wait_for_event_timeout(m_hSyncObject, ulTimeout);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFEvent::Unlock()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFEvent::SetEvent()
|
||||
{
|
||||
return amf_set_event(m_hSyncObject);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFEvent::ResetEvent()
|
||||
{
|
||||
return amf_reset_event(m_hSyncObject);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
AMFMutex::AMFMutex(bool bInitiallyOwned, const wchar_t* pName
|
||||
#if defined(_WIN32)
|
||||
, bool bOpenExistent
|
||||
#endif
|
||||
):m_hSyncObject()
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
if(bOpenExistent)
|
||||
{
|
||||
m_hSyncObject = amf_open_mutex(pName);
|
||||
}
|
||||
else
|
||||
#else
|
||||
//#pragma message AMF_TODO("Open mutex!!! missing functionality in Linux!!!")
|
||||
#endif
|
||||
{
|
||||
m_hSyncObject = amf_create_mutex(bInitiallyOwned, pName);
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
AMFMutex::~AMFMutex()
|
||||
{
|
||||
if(m_hSyncObject)
|
||||
{
|
||||
amf_delete_mutex(m_hSyncObject);
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFMutex::Lock(amf_ulong ulTimeout)
|
||||
{
|
||||
if(m_hSyncObject)
|
||||
{
|
||||
return amf_wait_for_mutex(m_hSyncObject, ulTimeout);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFMutex::Unlock()
|
||||
{
|
||||
if(m_hSyncObject)
|
||||
{
|
||||
return amf_release_mutex(m_hSyncObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFMutex::IsValid()
|
||||
{
|
||||
return m_hSyncObject != NULL;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------
|
||||
AMFCriticalSection::AMFCriticalSection() : m_Sect()
|
||||
{
|
||||
m_Sect = amf_create_critical_section();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
AMFCriticalSection::~AMFCriticalSection()
|
||||
{
|
||||
amf_delete_critical_section(m_Sect);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFCriticalSection::Lock(amf_ulong ulTimeout)
|
||||
{
|
||||
return (ulTimeout != AMF_INFINITE) ? amf_wait_critical_section(m_Sect, ulTimeout)
|
||||
: amf_enter_critical_section(m_Sect);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFCriticalSection::Unlock()
|
||||
{
|
||||
return amf_leave_critical_section(m_Sect);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
AMFSemaphore::AMFSemaphore(amf_long iInitCount, amf_long iMaxCount, const wchar_t* pName)
|
||||
: m_hSemaphore(NULL)
|
||||
{
|
||||
Create(iInitCount, iMaxCount, pName);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
AMFSemaphore::~AMFSemaphore()
|
||||
{
|
||||
amf_delete_semaphore(m_hSemaphore);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFSemaphore::Create(amf_long iInitCount, amf_long iMaxCount, const wchar_t* pName)
|
||||
{
|
||||
if(m_hSemaphore != NULL) // delete old one
|
||||
{
|
||||
amf_delete_semaphore(m_hSemaphore);
|
||||
m_hSemaphore = NULL;
|
||||
}
|
||||
if(iMaxCount > 0)
|
||||
{
|
||||
m_hSemaphore = amf_create_semaphore(iInitCount, iMaxCount, pName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFSemaphore::Lock(amf_ulong ulTimeout)
|
||||
{
|
||||
return amf_wait_for_semaphore(m_hSemaphore, ulTimeout);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFSemaphore::Unlock()
|
||||
{
|
||||
amf_long iOldCount = 0;
|
||||
return amf_release_semaphore(m_hSemaphore, 1, &iOldCount);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
AMFLock::AMFLock(AMFSyncBase* pBase, amf_ulong ulTimeout)
|
||||
: m_pBase(pBase),
|
||||
m_bLocked()
|
||||
{
|
||||
m_bLocked = Lock(ulTimeout);
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
AMFLock::~AMFLock()
|
||||
{
|
||||
if (IsLocked() == true)
|
||||
{
|
||||
Unlock();
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFLock::Lock(amf_ulong ulTimeout)
|
||||
{
|
||||
if(m_pBase == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_bLocked = m_pBase->Lock(ulTimeout);
|
||||
return m_bLocked;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFLock::Unlock()
|
||||
{
|
||||
if(m_pBase == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
const bool unlockSucceeded = m_pBase->Unlock();
|
||||
m_bLocked = m_bLocked && (unlockSucceeded == false);
|
||||
return unlockSucceeded;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFLock::IsLocked()
|
||||
{
|
||||
return m_bLocked;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#if defined(METRO_APP)
|
||||
using namespace Platform;
|
||||
using namespace Windows::Foundation;
|
||||
using namespace Windows::UI::Xaml;
|
||||
using namespace Windows::UI::Xaml::Controls;
|
||||
using namespace Windows::UI::Xaml::Navigation;
|
||||
class AMFThreadObj
|
||||
{
|
||||
Windows::Foundation::IAsyncAction^ m_AsyncAction;
|
||||
AMFEvent m_StopEvent;
|
||||
AMFThread* m_pOwner;
|
||||
public:
|
||||
AMFThreadObj(AMFThread* owner);
|
||||
virtual ~AMFThreadObj();
|
||||
|
||||
virtual bool Start();
|
||||
virtual bool RequestStop();
|
||||
virtual bool WaitForStop();
|
||||
virtual bool StopRequested();
|
||||
|
||||
// this is executed in the thread and overloaded by implementor
|
||||
virtual void Run() { m_pOwner->Run(); }
|
||||
virtual bool Init(){ return m_pOwner->Init(); }
|
||||
virtual bool Terminate(){ return m_pOwner->Terminate();}
|
||||
};
|
||||
|
||||
|
||||
AMFThreadObj::AMFThreadObj(AMFThread* owner)
|
||||
: m_StopEvent(true, true), m_pOwner(owner)
|
||||
{}
|
||||
|
||||
AMFThreadObj::~AMFThreadObj()
|
||||
{}
|
||||
|
||||
bool AMFThreadObj::Start()
|
||||
{
|
||||
auto workItemDelegate = [this](IAsyncAction ^ workItem)
|
||||
{
|
||||
if( !this->Init() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->Run();
|
||||
this->Terminate();
|
||||
|
||||
this->m_AsyncAction = nullptr;
|
||||
if( this->StopRequested() )
|
||||
{
|
||||
this->m_StopEvent.SetEvent();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Windows::System::Threading::WorkItemPriority WorkPriority;
|
||||
WorkPriority = Windows::System::Threading::WorkItemPriority::Normal;
|
||||
|
||||
auto workItemHandler = ref new Windows::System::Threading::WorkItemHandler(workItemDelegate);
|
||||
m_AsyncAction = Windows::System::Threading::ThreadPool::RunAsync(workItemHandler, WorkPriority);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AMFThreadObj::RequestStop()
|
||||
{
|
||||
if( m_AsyncAction == nullptr )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
m_StopEvent.ResetEvent();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AMFThreadObj::WaitForStop()
|
||||
{
|
||||
if( m_AsyncAction == nullptr )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return m_StopEvent.Lock();
|
||||
}
|
||||
|
||||
bool AMFThreadObj::StopRequested()
|
||||
{
|
||||
return !m_StopEvent.Lock(0);
|
||||
}
|
||||
bool AMFThreadObj::IsRunning()
|
||||
{
|
||||
return m_AsyncAction != nullptr;
|
||||
}
|
||||
|
||||
void amf::ExitThread()
|
||||
{}
|
||||
|
||||
//#endif//#if defined(METRO_APP)
|
||||
//#if defined(_WIN32)
|
||||
#elif defined(_WIN32) // _WIN32 and METRO_APP defines are not mutually exclusive
|
||||
class AMFThreadObj
|
||||
{
|
||||
AMFThread* m_pOwner;
|
||||
uintptr_t m_pThread;
|
||||
AMFEvent m_StopEvent;
|
||||
AMFCriticalSection m_Lock;
|
||||
public:
|
||||
// this is called by owner
|
||||
AMFThreadObj(AMFThread* owner);
|
||||
virtual ~AMFThreadObj();
|
||||
|
||||
virtual bool Start();
|
||||
virtual bool RequestStop();
|
||||
virtual bool WaitForStop();
|
||||
virtual bool StopRequested();
|
||||
virtual bool IsRunning();
|
||||
|
||||
|
||||
protected:
|
||||
static void AMF_CDECL_CALL AMFThreadProc(void* pThis);
|
||||
|
||||
// this is executed in the thread and overloaded by implementor
|
||||
virtual void Run()
|
||||
{
|
||||
m_pOwner->Run();
|
||||
}
|
||||
virtual bool Init()
|
||||
{
|
||||
return m_pOwner->Init();
|
||||
}
|
||||
virtual bool Terminate()
|
||||
{
|
||||
return m_pOwner->Terminate();
|
||||
}
|
||||
};
|
||||
//----------------------------------------------------------------------------
|
||||
AMFThreadObj::AMFThreadObj(AMFThread* owner) :
|
||||
m_pOwner(owner),
|
||||
m_pThread(uintptr_t(-1)),
|
||||
m_StopEvent(true, true)
|
||||
{}
|
||||
//----------------------------------------------------------------------------
|
||||
AMFThreadObj::~AMFThreadObj()
|
||||
{
|
||||
// RequestStop();
|
||||
// WaitForStop();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void AMF_CDECL_CALL AMFThreadObj::AMFThreadProc(void* pThis)
|
||||
{
|
||||
AMFThreadObj* pT = (AMFThreadObj*)pThis;
|
||||
if(!pT->Init())
|
||||
{
|
||||
return;
|
||||
}
|
||||
pT->Run();
|
||||
pT->Terminate();
|
||||
|
||||
pT->m_pThread = uintptr_t(-1);
|
||||
if(pT->StopRequested())
|
||||
{
|
||||
pT->m_StopEvent.SetEvent(); // signal to stop that we just finished
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFThreadObj::Start()
|
||||
{
|
||||
if(m_pThread != (uintptr_t)-1L)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
AMFLock lock(&m_Lock);
|
||||
m_pThread = _beginthread(AMFThreadProc, 0, (void* )this);
|
||||
|
||||
return m_pThread != (uintptr_t)-1L;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFThreadObj::RequestStop()
|
||||
{
|
||||
if(m_pThread == (uintptr_t)-1L)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
m_StopEvent.ResetEvent();
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFThreadObj::WaitForStop()
|
||||
{
|
||||
AMFLock lock(&m_Lock);
|
||||
if(m_pThread == (uintptr_t)-1L)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool stopped = m_StopEvent.Lock();
|
||||
|
||||
m_pThread = (uintptr_t)-1L;
|
||||
return stopped;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
bool AMFThreadObj::StopRequested()
|
||||
{
|
||||
return !m_StopEvent.Lock(0);
|
||||
}
|
||||
bool AMFThreadObj::IsRunning()
|
||||
{
|
||||
return m_pThread != (uintptr_t)-1L;
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void ExitThread()
|
||||
{
|
||||
_endthread();
|
||||
}
|
||||
|
||||
#endif //#if defined(_WIN32)
|
||||
#if defined(__linux) || defined(__APPLE__)
|
||||
class AMFThreadObj
|
||||
{
|
||||
public:
|
||||
AMFThreadObj(AMFThread* owner);
|
||||
virtual ~AMFThreadObj();
|
||||
|
||||
virtual bool Start();
|
||||
virtual bool RequestStop();
|
||||
virtual bool WaitForStop();
|
||||
virtual bool StopRequested();
|
||||
virtual bool IsRunning();
|
||||
|
||||
// this is executed in the thread and overloaded by implementor
|
||||
virtual void Run() { m_pOwner->Run(); }
|
||||
virtual bool Init(){ return m_pOwner->Init(); }
|
||||
virtual bool Terminate(){ return m_pOwner->Terminate();}
|
||||
|
||||
private:
|
||||
AMFThread* m_pOwner;
|
||||
pthread_t m_hThread;
|
||||
bool m_bStopRequested;
|
||||
bool m_bRunning;
|
||||
bool m_bInternalRunning; //used to detect thread auto-exit case and make join in Start
|
||||
AMFCriticalSection m_Lock;
|
||||
|
||||
AMFThreadObj(const AMFThreadObj&);
|
||||
AMFThreadObj& operator=(const AMFThreadObj&);
|
||||
static void* AMF_CDECL_CALL AMFThreadProc(void* pThis);
|
||||
|
||||
};
|
||||
|
||||
AMFThreadObj::AMFThreadObj(AMFThread* owner)
|
||||
: m_pOwner(owner),
|
||||
m_bStopRequested(false),
|
||||
m_bRunning(false),
|
||||
m_bInternalRunning(false)
|
||||
{
|
||||
}
|
||||
|
||||
AMFThreadObj::~AMFThreadObj()
|
||||
{
|
||||
RequestStop();
|
||||
WaitForStop();
|
||||
}
|
||||
|
||||
void* AMF_CDECL_CALL AMFThreadObj::AMFThreadProc(void* pThis)
|
||||
{
|
||||
AMFThreadObj* pT = (AMFThreadObj*)pThis;
|
||||
if(!pT->Init())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
pT->Run();
|
||||
pT->Terminate();
|
||||
pT->m_bStopRequested = false;
|
||||
pT->m_bInternalRunning = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool AMFThreadObj::Start()
|
||||
{
|
||||
bool result = true;
|
||||
if(m_bRunning == true && m_bInternalRunning == false)
|
||||
{
|
||||
pthread_join(m_hThread, 0);
|
||||
m_bRunning = false;
|
||||
m_bStopRequested = false;
|
||||
}
|
||||
|
||||
if (IsRunning() == false)
|
||||
{
|
||||
WaitForStop();
|
||||
|
||||
AMFLock lock(&m_Lock);
|
||||
if (pthread_create(&m_hThread, 0, AMFThreadProc, (void*)this) == 0)
|
||||
{
|
||||
m_bRunning = true;
|
||||
m_bInternalRunning = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AMFThreadObj::RequestStop()
|
||||
{
|
||||
AMFLock lock(&m_Lock);
|
||||
if (IsRunning() == false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
m_bStopRequested = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AMFThreadObj::WaitForStop()
|
||||
{
|
||||
AMFLock lock(&m_Lock);
|
||||
|
||||
if (IsRunning() == true)
|
||||
{
|
||||
pthread_join(m_hThread, 0);
|
||||
m_bRunning = false;
|
||||
}
|
||||
|
||||
m_bStopRequested = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AMFThreadObj::StopRequested()
|
||||
{
|
||||
return m_bStopRequested;
|
||||
}
|
||||
|
||||
bool AMFThreadObj::IsRunning()
|
||||
{
|
||||
return m_bRunning && m_bInternalRunning;
|
||||
}
|
||||
|
||||
void ExitThread()
|
||||
{
|
||||
pthread_exit(0);
|
||||
}
|
||||
|
||||
#endif //#if defined(__linux)
|
||||
|
||||
AMFThread::AMFThread() : m_thread()
|
||||
{
|
||||
m_thread = new AMFThreadObj(this);
|
||||
}
|
||||
|
||||
AMFThread::~AMFThread()
|
||||
{
|
||||
delete m_thread;
|
||||
}
|
||||
|
||||
bool AMFThread::Start()
|
||||
{
|
||||
return m_thread->Start();
|
||||
}
|
||||
|
||||
bool AMFThread::RequestStop()
|
||||
{
|
||||
return m_thread->RequestStop();
|
||||
}
|
||||
|
||||
bool AMFThread::WaitForStop()
|
||||
{
|
||||
return m_thread->WaitForStop();
|
||||
}
|
||||
|
||||
bool AMFThread::StopRequested()
|
||||
{
|
||||
return m_thread->StopRequested();
|
||||
}
|
||||
bool AMFThread::IsRunning() const
|
||||
{
|
||||
return m_thread->IsRunning();
|
||||
}
|
||||
} //namespace
|
||||
721
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Thread.h
vendored
Normal file
721
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Thread.h
vendored
Normal file
@@ -0,0 +1,721 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Thread_h
|
||||
#define AMF_Thread_h
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
#include "../include/core/Platform.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// threads
|
||||
#define AMF_INFINITE (0xFFFFFFFF) // Infinite ulTimeout
|
||||
|
||||
// threads: atomic
|
||||
amf_long AMF_CDECL_CALL amf_atomic_inc(amf_long* X);
|
||||
amf_long AMF_CDECL_CALL amf_atomic_dec(amf_long* X);
|
||||
|
||||
// threads: critical section
|
||||
amf_handle AMF_CDECL_CALL amf_create_critical_section();
|
||||
bool AMF_CDECL_CALL amf_delete_critical_section(amf_handle cs);
|
||||
bool AMF_CDECL_CALL amf_enter_critical_section(amf_handle cs);
|
||||
bool AMF_CDECL_CALL amf_wait_critical_section(amf_handle cs, amf_ulong ulTimeout);
|
||||
bool AMF_CDECL_CALL amf_leave_critical_section(amf_handle cs);
|
||||
// threads: event
|
||||
amf_handle AMF_CDECL_CALL amf_create_event(bool bInitiallyOwned, bool bManualReset, const wchar_t* pName);
|
||||
bool AMF_CDECL_CALL amf_delete_event(amf_handle hevent);
|
||||
bool AMF_CDECL_CALL amf_set_event(amf_handle hevent);
|
||||
bool AMF_CDECL_CALL amf_reset_event(amf_handle hevent);
|
||||
bool AMF_CDECL_CALL amf_wait_for_event(amf_handle hevent, amf_ulong ulTimeout);
|
||||
bool AMF_CDECL_CALL amf_wait_for_event_timeout(amf_handle hevent, amf_ulong ulTimeout);
|
||||
|
||||
// threads: mutex
|
||||
amf_handle AMF_CDECL_CALL amf_create_mutex(bool bInitiallyOwned, const wchar_t* pName);
|
||||
#if defined(_WIN32)
|
||||
amf_handle AMF_CDECL_CALL amf_open_mutex(const wchar_t* pName);
|
||||
#endif
|
||||
bool AMF_CDECL_CALL amf_delete_mutex(amf_handle hmutex);
|
||||
bool AMF_CDECL_CALL amf_wait_for_mutex(amf_handle hmutex, amf_ulong ulTimeout);
|
||||
bool AMF_CDECL_CALL amf_release_mutex(amf_handle hmutex);
|
||||
|
||||
// threads: semaphore
|
||||
amf_handle AMF_CDECL_CALL amf_create_semaphore(amf_long iInitCount, amf_long iMaxCount, const wchar_t* pName);
|
||||
bool AMF_CDECL_CALL amf_delete_semaphore(amf_handle hsemaphore);
|
||||
bool AMF_CDECL_CALL amf_wait_for_semaphore(amf_handle hsemaphore, amf_ulong ulTimeout);
|
||||
bool AMF_CDECL_CALL amf_release_semaphore(amf_handle hsemaphore, amf_long iCount, amf_long* iOldCount);
|
||||
|
||||
// threads: delay
|
||||
void AMF_CDECL_CALL amf_sleep(amf_ulong delay);
|
||||
amf_pts AMF_CDECL_CALL amf_high_precision_clock(); // in 100 of nanosec
|
||||
|
||||
void AMF_CDECL_CALL amf_increase_timer_precision();
|
||||
void AMF_CDECL_CALL amf_restore_timer_precision();
|
||||
|
||||
amf_handle AMF_CDECL_CALL amf_load_library(const wchar_t* filename);
|
||||
amf_handle AMF_CDECL_CALL amf_load_library1(const wchar_t* filename, bool bGlobal);
|
||||
|
||||
void* AMF_CDECL_CALL amf_get_proc_address(amf_handle module, const char* procName);
|
||||
int AMF_CDECL_CALL amf_free_library(amf_handle module);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
amf_uint64 AMF_STD_CALL get_current_thread_id();
|
||||
#else
|
||||
amf_uint32 AMF_STD_CALL get_current_thread_id();
|
||||
#endif
|
||||
|
||||
#if !defined(METRO_APP)
|
||||
// virtual memory
|
||||
void* AMF_CDECL_CALL amf_virtual_alloc(amf_size size);
|
||||
void AMF_CDECL_CALL amf_virtual_free(void* ptr);
|
||||
#else
|
||||
#define amf_virtual_alloc amf_alloc
|
||||
#define amf_virtual_free amf_free
|
||||
#endif
|
||||
|
||||
// cpu
|
||||
#if defined(_WIN32) || (__linux__)
|
||||
amf_int32 AMF_STD_CALL amf_get_cpu_cores();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
namespace amf
|
||||
{
|
||||
//----------------------------------------------------------------
|
||||
class AMF_NO_VTABLE AMFSyncBase
|
||||
{
|
||||
public:
|
||||
virtual bool Lock(amf_ulong ulTimeout = AMF_INFINITE) = 0;
|
||||
virtual bool Unlock() = 0;
|
||||
};
|
||||
//----------------------------------------------------------------
|
||||
class AMFEvent : public AMFSyncBase
|
||||
{
|
||||
private:
|
||||
amf_handle m_hSyncObject;
|
||||
|
||||
AMFEvent(const AMFEvent&);
|
||||
AMFEvent& operator=(const AMFEvent&);
|
||||
|
||||
public:
|
||||
AMFEvent(bool bInitiallyOwned = false, bool bManualReset = false, const wchar_t* pName = NULL);
|
||||
virtual ~AMFEvent();
|
||||
|
||||
virtual bool Lock(amf_ulong ulTimeout = AMF_INFINITE);
|
||||
virtual bool LockTimeout(amf_ulong ulTimeout = AMF_INFINITE);
|
||||
virtual bool Unlock();
|
||||
bool SetEvent();
|
||||
bool ResetEvent();
|
||||
amf_handle GetNative() { return m_hSyncObject; }
|
||||
};
|
||||
//----------------------------------------------------------------
|
||||
class AMFMutex : public AMFSyncBase
|
||||
{
|
||||
private:
|
||||
amf_handle m_hSyncObject;
|
||||
|
||||
AMFMutex(const AMFMutex&);
|
||||
AMFMutex& operator=(const AMFMutex&);
|
||||
|
||||
public:
|
||||
AMFMutex(bool bInitiallyOwned = false, const wchar_t* pName = NULL
|
||||
#if defined(_WIN32)
|
||||
, bool bOpenExistent = false
|
||||
#endif
|
||||
);
|
||||
virtual ~AMFMutex();
|
||||
|
||||
virtual bool Lock(amf_ulong ulTimeout = AMF_INFINITE);
|
||||
virtual bool Unlock();
|
||||
bool IsValid();
|
||||
};
|
||||
//----------------------------------------------------------------
|
||||
class AMFCriticalSection : public AMFSyncBase
|
||||
{
|
||||
private:
|
||||
amf_handle m_Sect;
|
||||
|
||||
AMFCriticalSection(const AMFCriticalSection&);
|
||||
AMFCriticalSection& operator=(const AMFCriticalSection&);
|
||||
|
||||
public:
|
||||
AMFCriticalSection();
|
||||
virtual ~AMFCriticalSection();
|
||||
|
||||
virtual bool Lock(amf_ulong ulTimeout = AMF_INFINITE);
|
||||
virtual bool Unlock();
|
||||
};
|
||||
//----------------------------------------------------------------
|
||||
class AMFSemaphore : public AMFSyncBase
|
||||
{
|
||||
private:
|
||||
amf_handle m_hSemaphore;
|
||||
|
||||
AMFSemaphore(const AMFSemaphore&);
|
||||
AMFSemaphore& operator=(const AMFSemaphore&);
|
||||
|
||||
public:
|
||||
AMFSemaphore(amf_long iInitCount, amf_long iMaxCount, const wchar_t* pName = NULL);
|
||||
virtual ~AMFSemaphore();
|
||||
|
||||
virtual bool Create(amf_long iInitCount, amf_long iMaxCount, const wchar_t* pName = NULL);
|
||||
virtual bool Lock(amf_ulong ulTimeout = AMF_INFINITE);
|
||||
virtual bool Unlock();
|
||||
};
|
||||
//----------------------------------------------------------------
|
||||
class AMFLock
|
||||
{
|
||||
private:
|
||||
AMFSyncBase* m_pBase;
|
||||
bool m_bLocked;
|
||||
|
||||
AMFLock(const AMFLock&);
|
||||
AMFLock& operator=(const AMFLock&);
|
||||
|
||||
public:
|
||||
AMFLock(AMFSyncBase* pBase, amf_ulong ulTimeout = AMF_INFINITE);
|
||||
~AMFLock();
|
||||
|
||||
bool Lock(amf_ulong ulTimeout = AMF_INFINITE);
|
||||
bool Unlock();
|
||||
bool IsLocked();
|
||||
};
|
||||
//----------------------------------------------------------------
|
||||
class AMFReadWriteSync
|
||||
{
|
||||
private:
|
||||
struct ReadWriteResources
|
||||
{
|
||||
// max threads reading concurrently
|
||||
const int m_maxReadThreads;
|
||||
AMFSemaphore m_readSemaphore;
|
||||
AMFCriticalSection m_writeCriticalSection;
|
||||
ReadWriteResources() :
|
||||
m_maxReadThreads(10),
|
||||
m_readSemaphore(m_maxReadThreads, m_maxReadThreads),
|
||||
m_writeCriticalSection()
|
||||
{ }
|
||||
};
|
||||
class ReadSync : public AMFSyncBase
|
||||
{
|
||||
private:
|
||||
ReadSync(const ReadSync&);
|
||||
ReadSync& operator=(const ReadSync&);
|
||||
|
||||
ReadWriteResources& m_resources;
|
||||
public:
|
||||
ReadSync(ReadWriteResources& resources) : m_resources(resources)
|
||||
{ }
|
||||
virtual bool Lock(amf_ulong ulTimeout = AMF_INFINITE)
|
||||
{
|
||||
return m_resources.m_readSemaphore.Lock(ulTimeout);
|
||||
}
|
||||
virtual bool Unlock()
|
||||
{
|
||||
return m_resources.m_readSemaphore.Unlock();
|
||||
}
|
||||
};
|
||||
class WriteSync : public AMFSyncBase
|
||||
{
|
||||
private:
|
||||
WriteSync(const WriteSync&);
|
||||
WriteSync& operator=(const WriteSync&);
|
||||
|
||||
ReadWriteResources& m_resources;
|
||||
public:
|
||||
WriteSync(ReadWriteResources& resources) : m_resources(resources)
|
||||
{ }
|
||||
/// waits passed timeout for other writers; wait readers for infinite
|
||||
virtual bool Lock(amf_ulong ulTimeout = AMF_INFINITE)
|
||||
{
|
||||
if(!m_resources.m_writeCriticalSection.Lock(ulTimeout))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for(int i = 0; i < m_resources.m_maxReadThreads; i++)
|
||||
{
|
||||
m_resources.m_readSemaphore.Lock();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
virtual bool Unlock()
|
||||
{
|
||||
// there is windows function to release N times by one call - could be optimize later
|
||||
for(int i = 0; i < m_resources.m_maxReadThreads; i++)
|
||||
{
|
||||
m_resources.m_readSemaphore.Unlock();
|
||||
}
|
||||
return m_resources.m_writeCriticalSection.Unlock();
|
||||
}
|
||||
};
|
||||
private:
|
||||
ReadWriteResources m_resources;
|
||||
ReadSync m_readSync;
|
||||
WriteSync m_writeSync;
|
||||
public:
|
||||
AMFReadWriteSync() :
|
||||
m_resources(),
|
||||
m_readSync(m_resources),
|
||||
m_writeSync(m_resources)
|
||||
{ }
|
||||
|
||||
AMFSyncBase* GetReadSync()
|
||||
{
|
||||
return &m_readSync;
|
||||
}
|
||||
AMFSyncBase* GetWriteSync()
|
||||
{
|
||||
return &m_writeSync;
|
||||
}
|
||||
};
|
||||
//----------------------------------------------------------------
|
||||
class AMFThreadObj;
|
||||
class AMFThread
|
||||
{
|
||||
friend class AMFThreadObj;
|
||||
public:
|
||||
AMFThread();
|
||||
virtual ~AMFThread();
|
||||
|
||||
virtual bool Start();
|
||||
virtual bool RequestStop();
|
||||
virtual bool WaitForStop();
|
||||
virtual bool StopRequested();
|
||||
virtual bool IsRunning() const;
|
||||
|
||||
protected:
|
||||
// this is executed in the thread and overloaded by implementor
|
||||
virtual void Run() = 0;
|
||||
virtual bool Init()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
virtual bool Terminate()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
private:
|
||||
AMFThreadObj* m_thread;
|
||||
|
||||
AMFThread(const AMFThread&);
|
||||
AMFThread& operator=(const AMFThread&);
|
||||
};
|
||||
|
||||
void ExitThread();
|
||||
//----------------------------------------------------------------
|
||||
template<typename T>
|
||||
class AMFQueue
|
||||
{
|
||||
protected:
|
||||
class ItemData
|
||||
{
|
||||
public:
|
||||
T data;
|
||||
amf_ulong ulID;
|
||||
amf_long ulPriority;
|
||||
ItemData() : data(), ulID(), ulPriority(){}
|
||||
};
|
||||
typedef std::list< ItemData > QueueList;
|
||||
|
||||
QueueList m_Queue;
|
||||
AMFCriticalSection m_cSect;
|
||||
AMFEvent m_SomethingInQueueEvent;
|
||||
AMFSemaphore m_QueueSizeSem;
|
||||
amf_int32 m_iQueueSize;
|
||||
|
||||
bool InternalGet(amf_ulong& ulID, T& item)
|
||||
{
|
||||
AMFLock lock(&m_cSect);
|
||||
if(!m_Queue.empty()) // something to get
|
||||
{
|
||||
ItemData& itemdata = m_Queue.front();
|
||||
ulID = itemdata.ulID;
|
||||
item = itemdata.data;
|
||||
m_Queue.pop_front();
|
||||
m_QueueSizeSem.Unlock();
|
||||
if(m_Queue.empty())
|
||||
{
|
||||
m_SomethingInQueueEvent.ResetEvent();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public:
|
||||
AMFQueue(amf_int32 iQueueSize = 0)
|
||||
: m_Queue(),
|
||||
m_cSect(),
|
||||
m_SomethingInQueueEvent(false, false),
|
||||
m_QueueSizeSem(iQueueSize, iQueueSize > 0 ? iQueueSize + 1 : 0),
|
||||
m_iQueueSize(iQueueSize) {}
|
||||
virtual ~AMFQueue(){}
|
||||
|
||||
virtual bool SetQueueSize(amf_int32 iQueueSize)
|
||||
{
|
||||
bool success = m_QueueSizeSem.Create(iQueueSize, iQueueSize > 0 ? iQueueSize + 1 : 0);
|
||||
if(success)
|
||||
{
|
||||
m_iQueueSize = iQueueSize;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
virtual amf_int32 GetQueueSize()
|
||||
{
|
||||
return m_iQueueSize;
|
||||
}
|
||||
virtual bool Add(amf_ulong ulID, const T& item, amf_long ulPriority = 0, amf_ulong ulTimeout = AMF_INFINITE)
|
||||
{
|
||||
if(m_QueueSizeSem.Lock(ulTimeout) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
{
|
||||
AMFLock lock(&m_cSect);
|
||||
|
||||
|
||||
ItemData itemdata;
|
||||
itemdata.ulID = ulID;
|
||||
itemdata.data = item;
|
||||
itemdata.ulPriority = ulPriority;
|
||||
|
||||
typename QueueList::iterator iter = m_Queue.end();
|
||||
|
||||
for(; iter != m_Queue.begin(); )
|
||||
{
|
||||
iter--;
|
||||
if(ulPriority <= (iter->ulPriority))
|
||||
{
|
||||
iter++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Queue.insert(iter, itemdata);
|
||||
m_SomethingInQueueEvent.SetEvent(); // this will set all waiting threads - some of them get data, some of them not
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool Get(amf_ulong& ulID, T& item, amf_ulong ulTimeout)
|
||||
{
|
||||
if(InternalGet(ulID, item)) // try right away
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// wait for queue
|
||||
if(m_SomethingInQueueEvent.Lock(ulTimeout))
|
||||
{
|
||||
return InternalGet(ulID, item);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
virtual void Clear()
|
||||
{
|
||||
bool bValue = true;
|
||||
while(bValue)
|
||||
{
|
||||
amf_ulong ulID;
|
||||
T item;
|
||||
bValue = InternalGet(ulID, item);
|
||||
}
|
||||
}
|
||||
virtual amf_size GetSize()
|
||||
{
|
||||
AMFLock lock(&m_cSect);
|
||||
return m_Queue.size();
|
||||
}
|
||||
};
|
||||
//----------------------------------------------------------------
|
||||
template<class inT, class outT>
|
||||
class AMFQueueThread : public AMFThread
|
||||
{
|
||||
private:
|
||||
AMFQueueThread(const AMFQueueThread&);
|
||||
AMFQueueThread& operator=(const AMFQueueThread&);
|
||||
|
||||
protected:
|
||||
AMFQueue<inT>* m_pInQueue;
|
||||
AMFQueue<outT>* m_pOutQueue;
|
||||
AMFMutex m_mutexInProcess; ///< This mutex shows other threads that the thread function allocates
|
||||
///< some objects on stack and it is unsafe state. To manipulate objects owned by descendant classes
|
||||
///< client must lock this mutex by calling BlockProcessing member function. When client finished its work
|
||||
///< corresponding UnblockProcessing member function call must be done.
|
||||
|
||||
bool m_blockProcessingRequested;
|
||||
AMFCriticalSection m_csBlockingRequest;
|
||||
public:
|
||||
AMFQueueThread(AMFQueue<inT>* pInQueue,
|
||||
AMFQueue<outT>* pOutQueue) : m_pInQueue(pInQueue), m_pOutQueue(pOutQueue), m_mutexInProcess(),
|
||||
m_blockProcessingRequested(false), m_csBlockingRequest()
|
||||
{}
|
||||
virtual bool Process(amf_ulong& ulID, inT& inData, outT& outData) = 0;
|
||||
virtual void BlockProcessing()
|
||||
{
|
||||
AMFLock lock(&m_csBlockingRequest);
|
||||
m_blockProcessingRequested = true;
|
||||
m_mutexInProcess.Lock();
|
||||
}
|
||||
virtual void UnblockProcessing()
|
||||
{
|
||||
AMFLock lock(&m_csBlockingRequest);
|
||||
m_mutexInProcess.Unlock();
|
||||
m_blockProcessingRequested = false;
|
||||
}
|
||||
virtual bool IsPaused()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual void OnHaveOutput() {}
|
||||
virtual void OnIdle() {}
|
||||
|
||||
virtual void Run()
|
||||
{
|
||||
bool bStop = false;
|
||||
while(!bStop)
|
||||
{
|
||||
{
|
||||
AMFLock lock(&m_mutexInProcess);
|
||||
inT inData;
|
||||
amf_ulong ulID = 0;
|
||||
bool callProcess = true;
|
||||
if(m_pInQueue != NULL)
|
||||
{
|
||||
amf_ulong waitTimeout = 5;
|
||||
bool validInput = m_pInQueue->Get(ulID, inData, waitTimeout); // Pulse to check Stop from time to time
|
||||
if(StopRequested())
|
||||
{
|
||||
bStop = true;
|
||||
}
|
||||
if(!validInput)
|
||||
{
|
||||
callProcess = false;
|
||||
}
|
||||
}
|
||||
if(!bStop && callProcess)
|
||||
{
|
||||
outT outData;
|
||||
bool validOutput = Process(ulID, inData, outData);
|
||||
if(StopRequested())
|
||||
{
|
||||
bStop = true;
|
||||
}
|
||||
if(!bStop && (m_pOutQueue != NULL) && validOutput)
|
||||
{
|
||||
m_pOutQueue->Add(ulID, outData);
|
||||
OnHaveOutput();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OnIdle();
|
||||
}
|
||||
}
|
||||
if(StopRequested())
|
||||
{
|
||||
bStop = true;
|
||||
}
|
||||
#if defined(__linux) || defined(__APPLE__)
|
||||
///< HACK
|
||||
///< This amf_sleep(0) is required to emulate windows mutex behavior.
|
||||
///< In Windows release mutext causes some other waiting thread is receiving ownership of mutex.
|
||||
///< In Linux it is not true.
|
||||
///< Without sleep AMFLock destructor releases mutex but immediately on next cycle AMFLock constructor tries to lock
|
||||
///< the mutex and now system have two threads waiting for the mutex.
|
||||
///< Using some random logic system decides who will be unlocked.
|
||||
///< This thread may win during several seconds it looks like pipeline is hang.
|
||||
///< amf_sleep call causes waiting thread is becoming unlocked.
|
||||
if(m_blockProcessingRequested)
|
||||
{
|
||||
amf_sleep(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
};
|
||||
//----------------------------------------------------------------
|
||||
template<class inT, class outT, class _Thread, class ThreadParam>
|
||||
class AMFQueueThreadPipeline
|
||||
{
|
||||
private:
|
||||
AMFQueueThreadPipeline(const AMFQueueThreadPipeline&);
|
||||
AMFQueueThreadPipeline& operator=(const AMFQueueThreadPipeline&);
|
||||
|
||||
public:
|
||||
AMFQueue<inT>* m_pInQueue;
|
||||
AMFQueue<outT>* m_pOutQueue;
|
||||
std::vector<_Thread*> m_ThreadPool;
|
||||
|
||||
AMFQueueThreadPipeline(AMFQueue<inT>* pInQueue, AMFQueue<outT>* pOutQueue)
|
||||
: m_pInQueue(pInQueue),
|
||||
m_pOutQueue(pOutQueue),
|
||||
m_ThreadPool()
|
||||
{}
|
||||
virtual ~AMFQueueThreadPipeline()
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
void Start(int iNumberOfThreads, ThreadParam param)
|
||||
{
|
||||
if((long)m_ThreadPool.size() >= iNumberOfThreads)
|
||||
{
|
||||
Stop(); //temporary to remove stopped threads. need callback from thread to clean pool
|
||||
//return;
|
||||
}
|
||||
size_t initialSize = m_ThreadPool.size();
|
||||
for(size_t i = initialSize; i < (size_t)iNumberOfThreads; i++)
|
||||
{
|
||||
_Thread* pThread = new _Thread(m_pInQueue, m_pOutQueue, param);
|
||||
m_ThreadPool.push_back(pThread);
|
||||
pThread->Start();
|
||||
}
|
||||
}
|
||||
void RequestStop()
|
||||
{
|
||||
long num = (long)m_ThreadPool.size();
|
||||
for(long i = 0; i < num; i++)
|
||||
{
|
||||
m_ThreadPool[i]->RequestStop();
|
||||
}
|
||||
}
|
||||
void BlockProcessing()
|
||||
{
|
||||
long num = (long)m_ThreadPool.size();
|
||||
for(long i = 0; i < num; i++)
|
||||
{
|
||||
m_ThreadPool[i]->BlockProcessing();
|
||||
}
|
||||
}
|
||||
void UnblockProcessing()
|
||||
{
|
||||
long num = (long)m_ThreadPool.size();
|
||||
for(long i = 0; i < num; i++)
|
||||
{
|
||||
m_ThreadPool[i]->UnblockProcessing();
|
||||
}
|
||||
}
|
||||
void WaitForStop()
|
||||
{
|
||||
long num = (long)m_ThreadPool.size();
|
||||
for(long i = 0; i < num; i++)
|
||||
{
|
||||
_Thread* pThread = m_ThreadPool[i];
|
||||
pThread->WaitForStop();
|
||||
delete pThread;
|
||||
}
|
||||
m_ThreadPool.clear();
|
||||
}
|
||||
void Stop()
|
||||
{
|
||||
RequestStop();
|
||||
WaitForStop();
|
||||
}
|
||||
};
|
||||
//----------------------------------------------------------------
|
||||
class AMFPreciseWaiter
|
||||
{
|
||||
public:
|
||||
AMFPreciseWaiter() : m_WaitEvent(), m_bCancel(false)
|
||||
{}
|
||||
virtual ~AMFPreciseWaiter()
|
||||
{}
|
||||
amf_pts Wait(amf_pts waittime)
|
||||
{
|
||||
if (waittime < 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
m_bCancel = false;
|
||||
amf_pts start = amf_high_precision_clock();
|
||||
amf_pts waited = 0;
|
||||
int count = 0;
|
||||
while(!m_bCancel)
|
||||
{
|
||||
count++;
|
||||
if(!m_WaitEvent.LockTimeout(1))
|
||||
{
|
||||
break;
|
||||
}
|
||||
waited = amf_high_precision_clock() - start;
|
||||
if(waited >= waittime)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return waited;
|
||||
}
|
||||
amf_pts WaitEx(amf_pts waittime)
|
||||
{
|
||||
m_bCancel = false;
|
||||
amf_pts start = amf_high_precision_clock();
|
||||
amf_pts waited = 0;
|
||||
int count = 0;
|
||||
while (!m_bCancel && waited < waittime)
|
||||
{
|
||||
if (waittime - waited < 2 * AMF_SECOND / 1000)// last 2 ms burn CPU for precision
|
||||
{
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
count++;
|
||||
#ifdef _WIN32
|
||||
YieldProcessor();
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
else if (!m_WaitEvent.LockTimeout(1))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
waited = amf_high_precision_clock() - start;
|
||||
}
|
||||
return waited;
|
||||
}
|
||||
void Cancel()
|
||||
{
|
||||
m_bCancel = true;
|
||||
}
|
||||
protected:
|
||||
AMFEvent m_WaitEvent;
|
||||
bool m_bCancel;
|
||||
};
|
||||
//----------------------------------------------------------------
|
||||
} // namespace amf
|
||||
#endif // AMF_Thread_h
|
||||
252
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/TraceAdapter.cpp
vendored
Normal file
252
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/TraceAdapter.cpp
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "../include/core/Factory.h"
|
||||
#include "Thread.h"
|
||||
#include "TraceAdapter.h"
|
||||
|
||||
#pragma warning(disable: 4251)
|
||||
#pragma warning(disable: 4996)
|
||||
|
||||
using namespace amf;
|
||||
|
||||
#if defined(AMF_CORE_STATIC) || defined(AMF_RUNTIME) || defined(AMF_LITE)
|
||||
extern "C"
|
||||
{
|
||||
extern AMF_CORE_LINK AMF_RESULT AMF_CDECL_CALL AMFInit(amf_uint64 version, amf::AMFFactory **ppFactory);
|
||||
}
|
||||
#else
|
||||
#include "AMFFactory.h"
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
static AMFTrace *s_pTrace = NULL;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
static AMFTrace *GetTrace()
|
||||
{
|
||||
if (s_pTrace == NULL)
|
||||
{
|
||||
#if defined(AMF_CORE_STATIC) || defined(AMF_RUNTIME) || defined(AMF_LITE)
|
||||
AMFFactory *pFactory = NULL;
|
||||
AMFInit(AMF_FULL_VERSION, &pFactory);
|
||||
pFactory->GetTrace(&s_pTrace);
|
||||
#else
|
||||
s_pTrace = g_AMFFactory.GetTrace();
|
||||
if (s_pTrace == nullptr)
|
||||
{
|
||||
g_AMFFactory.Init(); // last resort, should not happen
|
||||
s_pTrace = g_AMFFactory.GetTrace();
|
||||
g_AMFFactory.Terminate();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return s_pTrace;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
static AMFDebug *s_pDebug = NULL;
|
||||
//------------------------------------------------------------------------------------------------
|
||||
static AMFDebug *GetDebug()
|
||||
{
|
||||
if (s_pDebug == NULL)
|
||||
{
|
||||
#if defined(AMF_CORE_STATIC) || defined(AMF_RUNTIME) || defined(AMF_LITE)
|
||||
AMFFactory *pFactory = NULL;
|
||||
AMFInit(AMF_FULL_VERSION, &pFactory);
|
||||
pFactory->GetDebug(&s_pDebug);
|
||||
#else
|
||||
s_pDebug = g_AMFFactory.GetDebug();
|
||||
if (s_pDebug == nullptr)
|
||||
{
|
||||
g_AMFFactory.Init(); // last resort, should not happen
|
||||
s_pDebug = g_AMFFactory.GetDebug();
|
||||
g_AMFFactory.Terminate();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return s_pDebug;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_CDECL_CALL amf::AMFSetCustomDebugger(AMFDebug *pDebugger)
|
||||
{
|
||||
s_pDebug = pDebugger;
|
||||
return AMF_OK;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_CDECL_CALL amf::AMFSetCustomTracer(AMFTrace *pTracer)
|
||||
{
|
||||
s_pTrace = pTracer;
|
||||
return AMF_OK;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_CDECL_CALL amf::AMFTraceEnableAsync(bool enable)
|
||||
{
|
||||
return GetTrace()->TraceEnableAsync(enable);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_CDECL_CALL amf::AMFTraceFlush()
|
||||
{
|
||||
return GetTrace()->TraceFlush();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
void AMF_CDECL_CALL amf::AMFTraceW(const wchar_t* src_path, amf_int32 line, amf_int32 level, const wchar_t* scope,
|
||||
amf_int32 countArgs, const wchar_t* format, ...) // if countArgs <= 0 -> no args, formatting could be optimized then
|
||||
{
|
||||
if(countArgs <= 0)
|
||||
{
|
||||
GetTrace()->Trace(src_path, line, level, scope, format, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list vl;
|
||||
va_start(vl, format);
|
||||
|
||||
GetTrace()->Trace(src_path, line, level, scope, format, &vl);
|
||||
|
||||
va_end(vl);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_CDECL_CALL amf::AMFTraceSetPath(const wchar_t* path)
|
||||
{
|
||||
return GetTrace()->SetPath(path);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT AMF_CDECL_CALL amf::AMFTraceGetPath(wchar_t* path, amf_size* pSize)
|
||||
{
|
||||
return GetTrace()->GetPath(path, pSize);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf::AMFTraceEnableWriter(const wchar_t* writerID, bool enable)
|
||||
{
|
||||
return GetTrace()->EnableWriter(writerID, enable);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf::AMFTraceWriterEnabled(const wchar_t* writerID)
|
||||
{
|
||||
return GetTrace()->WriterEnabled(writerID);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
amf_int32 AMF_CDECL_CALL amf::AMFTraceSetGlobalLevel(amf_int32 level)
|
||||
{
|
||||
return GetTrace()->SetGlobalLevel(level);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
amf_int32 AMF_CDECL_CALL amf::AMFTraceGetGlobalLevel()
|
||||
{
|
||||
return GetTrace()->GetGlobalLevel();
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
amf_int32 AMF_CDECL_CALL amf::AMFTraceSetWriterLevel(const wchar_t* writerID, amf_int32 level)
|
||||
{
|
||||
return GetTrace()->SetWriterLevel(writerID, level);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
amf_int32 AMF_CDECL_CALL amf::AMFTraceGetWriterLevel(const wchar_t* writerID)
|
||||
{
|
||||
return GetTrace()->GetWriterLevel(writerID);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
amf_int32 AMF_CDECL_CALL amf::AMFTraceSetWriterLevelForScope(const wchar_t* writerID, const wchar_t* scope, amf_int32 level)
|
||||
{
|
||||
return GetTrace()->SetWriterLevelForScope(writerID, scope, level);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
amf_int32 AMF_CDECL_CALL amf::AMFTraceGetWriterLevelForScope(const wchar_t* writerID, const wchar_t* scope)
|
||||
{
|
||||
return GetTrace()->GetWriterLevelForScope(writerID, scope);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
void AMF_CDECL_CALL amf::AMFTraceRegisterWriter(const wchar_t* writerID, AMFTraceWriter* pWriter)
|
||||
{
|
||||
GetTrace()->RegisterWriter(writerID, pWriter, true);
|
||||
}
|
||||
|
||||
void AMF_CDECL_CALL amf::AMFTraceUnregisterWriter(const wchar_t* writerID)
|
||||
{
|
||||
GetTrace()->UnregisterWriter(writerID);
|
||||
}
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wexit-time-destructors"
|
||||
#pragma clang diagnostic ignored "-Wglobal-constructors"
|
||||
#endif
|
||||
|
||||
void AMF_CDECL_CALL amf::AMFTraceEnterScope()
|
||||
{
|
||||
GetTrace()->Indent(1);
|
||||
}
|
||||
|
||||
amf_uint32 AMF_CDECL_CALL AMFTraceGetScopeDepth()
|
||||
{
|
||||
return GetTrace()->GetIndentation();
|
||||
}
|
||||
|
||||
void AMF_CDECL_CALL amf::AMFTraceExitScope()
|
||||
{
|
||||
GetTrace()->Indent(-1);
|
||||
}
|
||||
|
||||
void AMF_CDECL_CALL amf::AMFAssertsEnable(bool enable)
|
||||
{
|
||||
GetDebug()->AssertsEnable(enable);
|
||||
}
|
||||
bool AMF_CDECL_CALL amf::AMFAssertsEnabled()
|
||||
{
|
||||
return GetDebug()->AssertsEnabled();
|
||||
}
|
||||
amf_wstring AMF_CDECL_CALL amf::AMFFormatResult(AMF_RESULT result)
|
||||
{
|
||||
return amf::amf_string_format(L"AMF_ERROR %d : %s: ", result, GetTrace()->GetResultText(result));
|
||||
}
|
||||
|
||||
const wchar_t* AMF_STD_CALL amf::AMFGetResultText(AMF_RESULT res)
|
||||
{
|
||||
return GetTrace()->GetResultText(res);
|
||||
}
|
||||
const wchar_t* AMF_STD_CALL amf::AMFSurfaceGetFormatName(const AMF_SURFACE_FORMAT eSurfaceFormat)
|
||||
{
|
||||
return GetTrace()->SurfaceGetFormatName(eSurfaceFormat);
|
||||
}
|
||||
AMF_SURFACE_FORMAT AMF_STD_CALL amf::AMFSurfaceGetFormatByName(const wchar_t* pwName)
|
||||
{
|
||||
return GetTrace()->SurfaceGetFormatByName(pwName);
|
||||
}
|
||||
const wchar_t* AMF_STD_CALL amf::AMFGetMemoryTypeName(const AMF_MEMORY_TYPE memoryType)
|
||||
{
|
||||
return GetTrace()->GetMemoryTypeName(memoryType);
|
||||
}
|
||||
|
||||
AMF_MEMORY_TYPE AMF_STD_CALL amf::AMFGetMemoryTypeByName(const wchar_t* name)
|
||||
{
|
||||
return GetTrace()->GetMemoryTypeByName(name);
|
||||
}
|
||||
808
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/TraceAdapter.h
vendored
Normal file
808
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/TraceAdapter.h
vendored
Normal file
@@ -0,0 +1,808 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
///-------------------------------------------------------------------------
|
||||
/// @file TraceAdapter.h
|
||||
/// @brief AMFTrace interface
|
||||
///-------------------------------------------------------------------------
|
||||
#ifndef AMF_TraceAdapter_h
|
||||
#define AMF_TraceAdapter_h
|
||||
#pragma once
|
||||
|
||||
#include "../include/core/Debug.h"
|
||||
#include "../include/core/Trace.h"
|
||||
#include "../include/core/Result.h"
|
||||
#include "public/common/AMFFactory.h"
|
||||
#include "AMFSTL.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
//-----------------------------------
|
||||
// Visual Studio memory leak report
|
||||
#if defined(WIN32) && defined(_DEBUG) && defined(CRTDBG)
|
||||
|
||||
#include <crtdbg.h>
|
||||
|
||||
#if !defined(METRO_APP)
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
//-----------------------------------
|
||||
|
||||
#if defined(_DEBUG) && defined(__linux)
|
||||
#include <sys/ptrace.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
namespace amf
|
||||
{
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceEnableAsync
|
||||
*
|
||||
* @brief
|
||||
* Enable or disable async mode
|
||||
*
|
||||
* There are 2 modes trace can work in:
|
||||
* Synchronous - every Trace call immediately goes to writers: console, windows, file, ...
|
||||
* Asynchronous - trace message go to thread local queues; separate thread passes them to writes
|
||||
* Asynchronous mode offers no synchronization between working threads which are writing traces
|
||||
* and high performance.
|
||||
* Asynchronous mode is not enabled always as that dedicated thread (started in Media SDK module) cannot be
|
||||
* terminated safely. See msdn ExitProcess description: it terminates all threads without notifications.
|
||||
* ExitProcess is called after exit from main() -> before module static variables destroyed and before atexit
|
||||
* notifiers are called -> no way to finish trace dedicated thread.
|
||||
*
|
||||
* Therefore here is direct enable of asynchronous mode.
|
||||
* AMFTraceEnableAsync(true) increases internal asynchronous counter by 1; AMFTraceEnableAsync(false) decreases by 1
|
||||
* when counter becomes > 0 mode - switches to async; when becomes 0 - switches to sync
|
||||
*
|
||||
* Tracer must be switched to sync mode before quit application, otherwise async writing thread will be force terminated by OS (at lease Windows)
|
||||
* See MSDN ExitProcess article for details.
|
||||
*******************************************************************************
|
||||
*/
|
||||
extern "C"
|
||||
{
|
||||
AMF_RESULT AMF_CDECL_CALL AMFTraceEnableAsync(bool enable);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFDebugSetDebugger
|
||||
*
|
||||
* @brief
|
||||
* it is used to set a local debugger, or set NULL to remove
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
AMF_RESULT AMF_CDECL_CALL AMFSetCustomDebugger(AMFDebug *pDebugger);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceSetTracer
|
||||
*
|
||||
* @brief
|
||||
* it is used to set a local tracer, or set NULL to remove
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
AMF_RESULT AMF_CDECL_CALL AMFSetCustomTracer(AMFTrace *pTrace);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceFlush
|
||||
*
|
||||
* @brief
|
||||
* Enforce trace writers flush
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
AMF_RESULT AMF_CDECL_CALL AMFTraceFlush();
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* EXPAND
|
||||
*
|
||||
* @brief
|
||||
* Auxilary Macro used to evaluate __VA_ARGS__ from 1 macro argument into list of them
|
||||
*
|
||||
* It is needed for COUNT_ARGS macro
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define EXPAND(x) x
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* GET_TENTH_ARG
|
||||
*
|
||||
* @brief
|
||||
* Auxilary Macro for COUNT_ARGS macro
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define GET_TENTH_ARG(a, b, c, d, e, f, g, h, i, j, name, ...) name
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* COUNT_ARGS
|
||||
*
|
||||
* @brief
|
||||
* Macro returns number of arguments actually passed into it
|
||||
*
|
||||
* COUNT_ARGS macro works ok for 1..10 arguments
|
||||
* It is needed to distinguish macro call with optional parameters and without them
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define COUNT_ARGS(...) EXPAND(GET_TENTH_ARG(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1))
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceW
|
||||
*
|
||||
* @brief
|
||||
* General trace function with all possible parameters
|
||||
*******************************************************************************
|
||||
*/
|
||||
void AMF_CDECL_CALL AMFTraceW(const wchar_t* src_path, amf_int32 line, amf_int32 level, const wchar_t* scope,
|
||||
amf_int32 countArgs, const wchar_t* format, ...);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTrace
|
||||
*
|
||||
* @brief
|
||||
* Most general macro for trace, incapsulates passing source file and line
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMFTrace(level, scope, /*format, */...) amf::AMFTraceW(AMF_UNICODE(__FILE__), __LINE__, level, scope, COUNT_ARGS(__VA_ARGS__) - 1, __VA_ARGS__)
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceError
|
||||
*
|
||||
* @brief
|
||||
* Shortened macro to trace exactly error.
|
||||
*
|
||||
* Similar macroses are: AMFTraceWarning, AMFTraceInfo, AMFTraceDebug
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMFTraceError(scope, /*format, */...) amf::AMFTraceW(AMF_UNICODE(__FILE__), __LINE__, AMF_TRACE_ERROR, scope, COUNT_ARGS(__VA_ARGS__) - 1, __VA_ARGS__)
|
||||
#define AMFTraceWarning(scope, /*format, */...) amf::AMFTraceW(AMF_UNICODE(__FILE__), __LINE__, AMF_TRACE_WARNING, scope, COUNT_ARGS(__VA_ARGS__) - 1, __VA_ARGS__)
|
||||
#define AMFTraceInfo(scope, /*format, */...) amf::AMFTraceW(AMF_UNICODE(__FILE__), __LINE__, AMF_TRACE_INFO, scope, COUNT_ARGS(__VA_ARGS__) - 1, __VA_ARGS__)
|
||||
#define AMFTraceDebug(scope, /*format, */...) amf::AMFTraceW(AMF_UNICODE(__FILE__), __LINE__, AMF_TRACE_DEBUG, scope, COUNT_ARGS(__VA_ARGS__) - 1, __VA_ARGS__)
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFDebugHitEvent
|
||||
*
|
||||
* @brief
|
||||
* Designed to determine how many are specific events take place
|
||||
*******************************************************************************
|
||||
*/
|
||||
void AMF_CDECL_CALL AMFDebugHitEvent(const wchar_t* scope, const wchar_t* eventName);
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFDebugGetEventsCount
|
||||
*
|
||||
* @brief
|
||||
* Designed to acquire counter of events reported by call AMFDebugHitEvent
|
||||
*******************************************************************************
|
||||
*/
|
||||
amf_int64 AMF_CDECL_CALL AMFDebugGetEventsCount(const wchar_t* scope, const wchar_t* eventName);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFAssertsEnabled
|
||||
*
|
||||
* @brief
|
||||
* Returns bool values indicating if asserts were enabled or not
|
||||
*******************************************************************************
|
||||
*/
|
||||
bool AMF_CDECL_CALL AMFAssertsEnabled();
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceEnterScope
|
||||
*
|
||||
* @brief
|
||||
* Increase trace indentation value by 1
|
||||
*
|
||||
* Indentation value is thread specific
|
||||
*******************************************************************************
|
||||
*/
|
||||
void AMF_CDECL_CALL AMFTraceEnterScope();
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceExitScope
|
||||
*
|
||||
* @brief
|
||||
* Decrease trace indentation value by 1
|
||||
*
|
||||
* Indentation value is thread specific
|
||||
*******************************************************************************
|
||||
*/
|
||||
void AMF_CDECL_CALL AMFTraceExitScope();
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_FACILITY
|
||||
*
|
||||
* @brief
|
||||
* Default value for AMF_FACILITY, this NULL leads to generate facility from source file name
|
||||
*
|
||||
* This AMF_FACILITY could be overloaded locally with #define AMF_FACILITY L"LocalScope"
|
||||
*******************************************************************************
|
||||
*/
|
||||
static const wchar_t* AMF_FACILITY = NULL;
|
||||
} //extern "C"
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFDebugBreak
|
||||
*
|
||||
* @brief
|
||||
* Macro for switching to debug of application
|
||||
*******************************************************************************
|
||||
*/
|
||||
#if defined(_DEBUG)
|
||||
#if defined(_WIN32)
|
||||
#define AMFDebugBreak {if(amf::AMFAssertsEnabled()) {__debugbreak();} \
|
||||
} //{ }
|
||||
#elif defined(__linux)
|
||||
// #define AMFDebugBreak ((void)0)
|
||||
#define AMFDebugBreak {if(amf::AMFAssertsEnabled() && ptrace(PTRACE_TRACEME, 0, 1, 0) < 0) {raise(SIGTRAP);} \
|
||||
}//{ }
|
||||
#elif defined(__APPLE__)
|
||||
#define AMFDebugBreak {if(amf::AMFAssertsEnabled()) {assert(0);} \
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#define AMFDebugBreak
|
||||
#endif
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* __FormatMessage
|
||||
*
|
||||
* @brief
|
||||
* Auxilary function to select from 2 messages and preformat message if any arguments are specified
|
||||
*******************************************************************************
|
||||
*/
|
||||
inline amf_wstring __FormatMessage(int /*argsCount*/, const wchar_t* expression)
|
||||
{
|
||||
return amf_wstring(expression); // the only expression is provided - return this one
|
||||
}
|
||||
|
||||
inline amf_wstring __FormatMessage(int argsCount, const wchar_t* /*expression*/, const wchar_t* message, ...)
|
||||
{
|
||||
// this version of __FormatMessage for case when descriptive message is provided with optional args
|
||||
if(argsCount <= 0)
|
||||
{
|
||||
return amf_wstring(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list arglist;
|
||||
va_start(arglist, message);
|
||||
amf_wstring result = amf::amf_string_formatVA(message, arglist);
|
||||
va_end(arglist);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_FIRST_VALUE
|
||||
*
|
||||
* @brief
|
||||
* Auxilary macro: extracts first argument from the list
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMF_FIRST_VALUE(x, ...) x
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_BASE_RETURN
|
||||
*
|
||||
* @brief
|
||||
* Base generic macro: checks expression for success, if failed: trace error, debug break and return an error
|
||||
*
|
||||
* return_result is a parameter to return to upper level, could be hard-coded or
|
||||
* specified exp_res what means pass inner level error
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMF_BASE_RETURN(exp, exp_type, check_func, format_prefix, level, scope, return_result/*(could be exp_res)*/, /* optional message args*/ ...) \
|
||||
{ \
|
||||
exp_type exp_res = (exp_type)(exp); \
|
||||
if(!check_func(exp_res)) \
|
||||
{ \
|
||||
amf_wstring message = format_prefix(exp_res) + amf::__FormatMessage(COUNT_ARGS(__VA_ARGS__) - 2, __VA_ARGS__); \
|
||||
EXPAND(amf::AMFTraceW(AMF_UNICODE(__FILE__), __LINE__, level, scope, 0, message.c_str()) ); \
|
||||
AMFDebugBreak; \
|
||||
return return_result; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_BASE_ASSERT
|
||||
*
|
||||
* @brief
|
||||
* Base generic macro: checks expression for success, if failed: trace error, debug break
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMF_BASE_ASSERT(exp, exp_type, check_func, format_prefix, level, scope, return_result/*(could be exp_res)*/, /*optional message, optional message args*/ ...) \
|
||||
{ \
|
||||
exp_type exp_res = (exp_type)(exp); \
|
||||
if(!check_func(exp_res)) \
|
||||
{ \
|
||||
amf_wstring message = format_prefix(exp_res) + amf::__FormatMessage(COUNT_ARGS(__VA_ARGS__) - 2, __VA_ARGS__); \
|
||||
EXPAND(amf::AMFTraceW(AMF_UNICODE(__FILE__), __LINE__, level, scope, 0, message.c_str()) ); \
|
||||
AMFDebugBreak; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_BASE_CALL
|
||||
*
|
||||
* @brief
|
||||
* Macro supporting cascade call function returning AMF_RESULT from another
|
||||
*
|
||||
* return_result is a parameter to return to upper level, could be hard-coded or
|
||||
* specified exp_res what means pass inner level error
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMF_BASE_CALL(exp, exp_type, check_func, format_prefix, level, scope, return_result/*(could be exp_res)*/, /*optional message, optional message args*/ ...) \
|
||||
{ \
|
||||
amf_wstring function_name = amf::__FormatMessage(COUNT_ARGS(__VA_ARGS__) - 2, __VA_ARGS__); \
|
||||
amf::AMFTraceW(AMF_UNICODE(__FILE__), __LINE__, AMF_TRACE_DEBUG, scope, 0, function_name.c_str()); \
|
||||
amf::AMFTraceEnterScope(); \
|
||||
exp_type exp_res = (exp_type)(exp); \
|
||||
amf::AMFTraceExitScope(); \
|
||||
if(!check_func(exp_res)) \
|
||||
{ \
|
||||
amf_wstring message = format_prefix(exp_res) + function_name; \
|
||||
EXPAND(amf::AMFTraceW(AMF_UNICODE(__FILE__), __LINE__, level, scope, 0, message.c_str()) ); \
|
||||
AMFDebugBreak; \
|
||||
return return_result; \
|
||||
} \
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFCheckExpression
|
||||
*
|
||||
* @brief
|
||||
* Checks if result succeeds
|
||||
*******************************************************************************
|
||||
*/
|
||||
inline bool AMFCheckExpression(int result) { return result != 0; }
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFFormatAssert
|
||||
*
|
||||
* @brief
|
||||
* Returns default assertion message
|
||||
*******************************************************************************
|
||||
*/
|
||||
inline amf_wstring AMFFormatAssert(int result) { return result ? amf_wstring() : amf_wstring(L"Assertion failed:"); }
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFOpenCLSucceeded
|
||||
*
|
||||
* @brief
|
||||
* Checks cl_status for success
|
||||
*******************************************************************************
|
||||
*/
|
||||
inline bool AMFOpenCLSucceeded(int result) { return result == 0; }
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFFormatOpenCLError
|
||||
*
|
||||
* @brief
|
||||
* Formats open CL error
|
||||
*******************************************************************************
|
||||
*/
|
||||
inline amf_wstring AMFFormatOpenCLError(int result) { return amf::amf_string_format(L"OpenCL failed, error = %d:", result); }
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFResultIsOK
|
||||
*
|
||||
* @brief
|
||||
* Checks if AMF_RESULT is OK
|
||||
*******************************************************************************
|
||||
*/
|
||||
inline bool AMFResultIsOK(AMF_RESULT result) { return result == AMF_OK; }
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFSucceeded
|
||||
*
|
||||
* @brief
|
||||
* Checks if AMF_RESULT is succeeded
|
||||
*******************************************************************************
|
||||
*/
|
||||
inline bool AMFSucceeded(AMF_RESULT result) { return result == AMF_OK || result == AMF_REPEAT; }
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFFormatResult
|
||||
*
|
||||
* @brief
|
||||
* Formats AMF_RESULT into descriptive string
|
||||
*******************************************************************************
|
||||
*/
|
||||
amf_wstring AMF_CDECL_CALL AMFFormatResult(AMF_RESULT result);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFHResultSucceded
|
||||
*
|
||||
* @brief
|
||||
* Checks if HRESULT succeeded
|
||||
*******************************************************************************
|
||||
*/
|
||||
inline bool AMFHResultSucceded(HRESULT result) { return SUCCEEDED(result); }
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFFormatHResult
|
||||
*
|
||||
* @brief
|
||||
* Formats HRESULT into descriptive string
|
||||
*******************************************************************************
|
||||
*/
|
||||
inline amf_wstring AMFFormatHResult(HRESULT result) { return amf::amf_string_format(L"COM failed, HR = 0x%0X:", result); }
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFVkResultSucceeded
|
||||
*
|
||||
* @brief
|
||||
* Checks if VkResult succeeded
|
||||
*******************************************************************************
|
||||
*/
|
||||
inline bool AMFVkResultSucceeded(int result) { return result == 0; }
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFFormatVkResult
|
||||
*
|
||||
* @brief
|
||||
* Formats VkResult into descriptive string
|
||||
*******************************************************************************
|
||||
*/
|
||||
inline amf_wstring AMFFormatVkResult(int result) { return amf::amf_string_format(L"Vulkan failed, VkResult = %d:", result); }
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_CALL
|
||||
*
|
||||
* @brief
|
||||
* Macro to call AMF_RESULT returning function from AMF_RESULT returning function
|
||||
*
|
||||
* It does:
|
||||
* 1) Trace (level == debug) function name (or message if specified)
|
||||
* 2) Indent trace
|
||||
* 3) Call function
|
||||
* 4) Unindent trace
|
||||
* 5) Checks its result
|
||||
* 6) If not OK trace error, switch to debugger (if asserts enabled) and return that error code to upper level
|
||||
*
|
||||
* Use cases:
|
||||
* A) AMF_CALL(Init("Name")); // trace expression itself
|
||||
* B) AMF_CALL(Init("Name"), L"Initialize resources"); // trace desciptive message
|
||||
* C) AMF_CALL(Init(name), L"Initialize resources with %s", name); // trace descriptive message with aditional arguments from runtime
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMF_CALL(exp, ... /*optional format, args*/) AMF_BASE_CALL(exp, AMF_RESULT, amf::AMFResultIsOK, amf::AMFFormatResult, AMF_TRACE_ERROR, AMF_FACILITY, exp_res, L###exp, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_ASSERT_OK
|
||||
*
|
||||
* @brief
|
||||
* Checks expression == AMF_OK, otherwise trace error and debug break
|
||||
*
|
||||
* Could be used: A) with just expression B) with optinal descriptive message C) message + args for printf
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMF_ASSERT_OK(exp, ... /*optional format, args*/) AMF_BASE_ASSERT(exp, AMF_RESULT, amf::AMFResultIsOK, amf::AMFFormatResult, AMF_TRACE_ERROR, AMF_FACILITY, AMF_FAIL, L###exp, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_ASSERT
|
||||
*
|
||||
* @brief
|
||||
* Checks expression != 0, otherwise trace error and debug break
|
||||
*
|
||||
* Could be used: A) with just expression B) with optinal descriptive message C) message + args for printf
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMF_ASSERT(exp, ...) AMF_BASE_ASSERT(exp, int, amf::AMFCheckExpression, amf::AMFFormatAssert, AMF_TRACE_ERROR, AMF_FACILITY, AMF_FAIL, L###exp, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_RETURN_IF_FAILED
|
||||
*
|
||||
* @brief
|
||||
* Checks expression != 0, otherwise trace error, debug break and return that error to upper level
|
||||
*
|
||||
* Could be used: A) with just expression B) with optinal descriptive message C) message + args for printf
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMF_RETURN_IF_FAILED(exp, ...) AMF_BASE_RETURN(exp, AMF_RESULT, amf::AMFResultIsOK, amf::AMFFormatResult, AMF_TRACE_ERROR, AMF_FACILITY, exp_res, L###exp, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* ASSERT_RETURN_IF_CL_FAILED
|
||||
*
|
||||
* @brief
|
||||
* Checks cl error is ok, otherwise trace error, debug break and return that error to upper level
|
||||
*
|
||||
* Could be used: A) with just expression B) with optinal descriptive message C) message + args for printf
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define ASSERT_RETURN_IF_CL_FAILED(exp, /*optional format, args,*/...) AMF_BASE_RETURN(exp, int, amf::AMFOpenCLSucceeded, amf::AMFFormatOpenCLError, AMF_TRACE_ERROR, AMF_FACILITY, AMF_OPENCL_FAILED, L###exp, ##__VA_ARGS__)
|
||||
#define AMF_RETURN_IF_CL_FAILED(exp, /*optional format, args,*/...) AMF_BASE_RETURN(exp, int, amf::AMFOpenCLSucceeded, amf::AMFFormatOpenCLError, AMF_TRACE_ERROR, AMF_FACILITY, AMF_OPENCL_FAILED, L###exp, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* ASSERT_RETURN_IF_HR_FAILED
|
||||
*
|
||||
* @brief
|
||||
* Obsolete macro: Checks HRESULT if succeeded, otherwise trace error, debug break and return specified error to upper level
|
||||
*
|
||||
* Other macroses below are also obsolete
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define ASSERT_RETURN_IF_HR_FAILED(exp, reterr, /*optional format, args,*/...) AMF_BASE_RETURN(exp, HRESULT, amf::AMFHResultSucceded, amf::AMFFormatHResult, AMF_TRACE_ERROR, AMF_FACILITY, reterr, L###exp, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* ASSERT_RETURN_IF_VK_FAILED
|
||||
*
|
||||
* @brief
|
||||
* Checks VkResult if succeeded, otherwise trace error, debug break and return specified error to upper level
|
||||
*
|
||||
* Could be used: A) with just expression B) with optinal descriptive message C) message + args for printf
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define ASSERT_RETURN_IF_VK_FAILED(exp, reterr, /*optional format, args,*/...) AMF_BASE_RETURN(exp, int, amf::AMFVkResultSucceeded, amf::AMFFormatVkResult, AMF_TRACE_ERROR, AMF_FACILITY, reterr, L###exp, ##__VA_ARGS__)
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_RETURN_IF_FALSE
|
||||
*
|
||||
* @brief
|
||||
* Checks expression != 0, otherwise trace error, debug break and return that error to upper level
|
||||
*
|
||||
* Could be used: A) with just expression B) with optinal descriptive message C) message + args for printf
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMF_RETURN_IF_FALSE(exp, ret_value, /*optional message,*/ ...) AMF_BASE_RETURN(exp, int, amf::AMFCheckExpression, amf::AMFFormatAssert, AMF_TRACE_ERROR, AMF_FACILITY, ret_value, L###exp, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_RETURN_IF_INVALID_POINTER
|
||||
*
|
||||
* @brief
|
||||
* Checks ptr != NULL, otherwise trace error, debug break and return that error to upper level
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMF_RETURN_IF_INVALID_POINTER(ptr, /*optional message,*/ ...) AMF_BASE_RETURN(ptr != NULL, int, amf::AMFCheckExpression, amf::AMFFormatAssert, AMF_TRACE_ERROR, AMF_FACILITY, AMF_INVALID_POINTER, L"invalid pointer : " L###ptr, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTestEventObserver
|
||||
*
|
||||
* @brief
|
||||
* Interface to subscribe on test events
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceSetPath
|
||||
*
|
||||
* @brief
|
||||
* Set Trace path
|
||||
*
|
||||
* Returns AMF_OK if succeeded
|
||||
*******************************************************************************
|
||||
*/
|
||||
AMF_RESULT AMF_CDECL_CALL AMFTraceSetPath(const wchar_t* path);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceGetPath
|
||||
*
|
||||
* @brief
|
||||
* Get Trace path
|
||||
*
|
||||
* Returns AMF_OK if succeeded
|
||||
*******************************************************************************
|
||||
*/
|
||||
AMF_RESULT AMF_CDECL_CALL AMFTraceGetPath(
|
||||
wchar_t* path, ///< [out] buffer able to hold *pSize symbols; path is copied there, at least part fitting the buffer, always terminator is copied
|
||||
amf_size* pSize ///< [in, out] size of buffer, returned needed size of buffer including zero terminator
|
||||
);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceEnableWriter
|
||||
*
|
||||
* @brief
|
||||
* Disable trace to registered writer
|
||||
*
|
||||
* Returns previous state
|
||||
*******************************************************************************
|
||||
*/
|
||||
bool AMF_CDECL_CALL AMFTraceEnableWriter(const wchar_t* writerID, bool enable);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceWriterEnabled
|
||||
*
|
||||
* @brief
|
||||
* Return flag if writer enabled
|
||||
*******************************************************************************
|
||||
*/
|
||||
bool AMF_CDECL_CALL AMFTraceWriterEnabled(const wchar_t* writerID);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceSetGlobalLevel
|
||||
*
|
||||
* @brief
|
||||
* Sets trace level for writer and scope
|
||||
*
|
||||
* Returns previous setting
|
||||
*******************************************************************************
|
||||
*/
|
||||
amf_int32 AMF_CDECL_CALL AMFTraceSetGlobalLevel(amf_int32 level);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceGetGlobalLevel
|
||||
*
|
||||
* @brief
|
||||
* Returns global level
|
||||
*******************************************************************************
|
||||
*/
|
||||
amf_int32 AMF_CDECL_CALL AMFTraceGetGlobalLevel();
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceSetWriterLevel
|
||||
*
|
||||
* @brief
|
||||
* Sets trace level for writer
|
||||
*
|
||||
* Returns previous setting
|
||||
*******************************************************************************
|
||||
*/
|
||||
amf_int32 AMF_CDECL_CALL AMFTraceSetWriterLevel(const wchar_t* writerID, amf_int32 level);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceGetWriterLevel
|
||||
*
|
||||
* @brief
|
||||
* Gets trace level for writer
|
||||
*******************************************************************************
|
||||
*/
|
||||
amf_int32 AMF_CDECL_CALL AMFTraceGetWriterLevel(const wchar_t* writerID);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceSetWriterLevelForScope
|
||||
*
|
||||
* @brief
|
||||
* Sets trace level for writer and scope
|
||||
*
|
||||
* Returns previous setting
|
||||
*******************************************************************************
|
||||
*/
|
||||
amf_int32 AMF_CDECL_CALL AMFTraceSetWriterLevelForScope(const wchar_t* writerID, const wchar_t* scope, amf_int32 level);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceGetWriterLevelForScope
|
||||
*
|
||||
* @brief
|
||||
* Gets trace level for writer and scope
|
||||
*******************************************************************************
|
||||
*/
|
||||
amf_int32 AMF_CDECL_CALL AMFTraceGetWriterLevelForScope(const wchar_t* writerID, const wchar_t* scope);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceRegisterWriter
|
||||
*
|
||||
* @brief
|
||||
* Register custom trace writer
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
void AMF_CDECL_CALL AMFTraceRegisterWriter(const wchar_t* writerID, AMFTraceWriter* pWriter);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFTraceUnregisterWriter
|
||||
*
|
||||
* @brief
|
||||
* Register custom trace writer
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
void AMF_CDECL_CALL AMFTraceUnregisterWriter(const wchar_t* writerID);
|
||||
/*
|
||||
*******************************************************************************
|
||||
* AMFAssertsEnable
|
||||
*
|
||||
* @brief
|
||||
* Enable asserts in checks
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
void AMF_CDECL_CALL AMFAssertsEnable(bool enable);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMFAssertsEnabled
|
||||
*
|
||||
* @brief
|
||||
* Returns true if asserts in checks enabled
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
bool AMF_CDECL_CALL AMFAssertsEnabled();
|
||||
|
||||
const wchar_t* AMF_STD_CALL AMFGetResultText(AMF_RESULT res);
|
||||
const wchar_t* AMF_STD_CALL AMFSurfaceGetFormatName(const AMF_SURFACE_FORMAT eSurfaceFormat);
|
||||
AMF_SURFACE_FORMAT AMF_STD_CALL AMFSurfaceGetFormatByName(const wchar_t* pwName);
|
||||
const wchar_t* AMF_STD_CALL AMFGetMemoryTypeName(const AMF_MEMORY_TYPE memoryType);
|
||||
AMF_MEMORY_TYPE AMF_STD_CALL AMFGetMemoryTypeByName(const wchar_t* name);
|
||||
} //extern "C"
|
||||
} // namespace amf
|
||||
#endif // AMF_TraceAdapter_h
|
||||
230
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/VirtualMicrophoneAudioInput.cpp
vendored
Normal file
230
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/VirtualMicrophoneAudioInput.cpp
vendored
Normal file
@@ -0,0 +1,230 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "VirtualMicrophoneAudioInput.h"
|
||||
#include "public/common/TraceAdapter.h"
|
||||
#if defined(_WIN32)
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#define AMF_FACILITY L"VirtualMicrophoneAudioInput"
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
VirtualMicrophoneAudioInput::VirtualMicrophoneAudioInput():
|
||||
m_pAudioManager (nullptr),
|
||||
m_pVirtualAudioInput (nullptr)
|
||||
#ifdef WIN32
|
||||
, m_bCoInitializeSucceeded(false)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
VirtualMicrophoneAudioInput::~VirtualMicrophoneAudioInput()
|
||||
{
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::Init()
|
||||
{
|
||||
AMF_RESULT res = AMF_FAIL;
|
||||
|
||||
#ifdef WIN32
|
||||
HRESULT hr = CoInitialize(nullptr);
|
||||
m_bCoInitializeSucceeded = SUCCEEDED(hr);
|
||||
|
||||
AMFCreateVirtualAudioManager_Fn pAudioFun = (AMFCreateVirtualAudioManager_Fn)amf_get_proc_address(g_AMFFactory.GetAMFDLLHandle(), AMF_CREATE_VIRTUAL_AUDIO_MANAGER_FUNCTION_NAME);
|
||||
AMF_RETURN_IF_FALSE(pAudioFun != nullptr, AMF_FAIL, L"AMFCreateVirtualAudioManager() is not availalbe in AMF DLL");
|
||||
res = pAudioFun(AMF_FULL_VERSION, nullptr, &m_pAudioManager);
|
||||
AMF_RETURN_IF_FAILED(res, L"AMFCreateVirtualAudioManager() failed");
|
||||
#endif
|
||||
|
||||
if (res == AMF_OK)
|
||||
{
|
||||
res = CreateVirtualAudioInput();
|
||||
}
|
||||
if (res != AMF_OK)
|
||||
{
|
||||
Terminate();
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::CreateVirtualAudioInput()
|
||||
{
|
||||
AMF_RESULT res = AMF_OK;
|
||||
res = m_pAudioManager->CreateInput(&m_pVirtualAudioInput);
|
||||
AMF_RETURN_IF_FAILED(res, L"CreateInput() failed");
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::DestroyVirtualAudioInput()
|
||||
{
|
||||
AMF_RESULT res = AMF_OK;
|
||||
if (nullptr != m_pVirtualAudioInput)
|
||||
{
|
||||
m_pVirtualAudioInput.Release();
|
||||
}
|
||||
AMF_RETURN_IF_FAILED(res, L"CreateInput() failed");
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::Terminate()
|
||||
{
|
||||
DestroyVirtualAudioInput();
|
||||
|
||||
if (nullptr != m_pAudioManager)
|
||||
{
|
||||
m_pAudioManager.Release();
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
if (m_bCoInitializeSucceeded)
|
||||
{
|
||||
::CoUninitialize();
|
||||
m_bCoInitializeSucceeded = false;
|
||||
}
|
||||
#endif
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::EnableInput()
|
||||
{
|
||||
AMF_RESULT res = AMF_OK;
|
||||
res = m_pVirtualAudioInput->SetStatus(amf::AMF_VAS_CONNECTED);
|
||||
AMF_RETURN_IF_FAILED(res, L"SetStatus(amf::AMF_VAS_CONNECTED) failed");
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::CheckStatus()
|
||||
{
|
||||
amf::AMF_VIRTUAL_AUDIO_STATUS status = m_pVirtualAudioInput->GetStatus();
|
||||
switch (status)
|
||||
{
|
||||
case amf::AMF_VAS_UNKNOWN:
|
||||
AMFTraceInfo(AMF_FACILITY, L"Virtual Audio Input status: UNKNOWN");
|
||||
break;
|
||||
case amf::AMF_VAS_CONNECTED:
|
||||
AMFTraceInfo(AMF_FACILITY, L"Virtual Audio Input status: CONNECTED");
|
||||
break;
|
||||
case amf::AMF_VAS_DISCONNECTED:
|
||||
AMFTraceInfo(AMF_FACILITY, L"Virtual Audio Input status: DISCONNECTED");
|
||||
break;
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::CheckFormat()
|
||||
{
|
||||
AMF_RESULT res = AMF_OK;
|
||||
amf::AMFVirtualAudioFormat format = {};
|
||||
res = m_pVirtualAudioInput->GetFormat(&format);
|
||||
AMF_RETURN_IF_FAILED(res, L"GetFormat() failed");
|
||||
|
||||
AMFTraceInfo(AMF_FACILITY, L"Virtual Audio Input format: SampleRate=%d channels=%d sampleSize=%d", format.sampleRate, format.channelCount, format.sampleSize);
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::ChangeInputParameters(amf_int64 sampleRate, amf_int64 channelCount, amf_int64 audioFormat)
|
||||
{
|
||||
amf_int32 bytesInSample = 2;
|
||||
switch (audioFormat)
|
||||
{
|
||||
case AMFAF_U8: bytesInSample = 1; break;
|
||||
case AMFAF_S16: bytesInSample = 2; break;
|
||||
case AMFAF_S32: bytesInSample = 4; break;
|
||||
case AMFAF_FLT: bytesInSample = 4; break;
|
||||
case AMFAF_DBL: bytesInSample = 8; break;
|
||||
case AMFAF_U8P: bytesInSample = 1; break;
|
||||
case AMFAF_S16P: bytesInSample = 2; break;
|
||||
case AMFAF_S32P: bytesInSample = 4; break;
|
||||
case AMFAF_FLTP: bytesInSample = 4; break;
|
||||
case AMFAF_DBLP: bytesInSample = 8; break;
|
||||
}
|
||||
|
||||
amf::AMFVirtualAudioFormat audioformat = {
|
||||
static_cast<amf_int32>(sampleRate & 0xFFFFFFFF),
|
||||
static_cast<amf_int32>(channelCount & 0xFFFFFFFF),
|
||||
bytesInSample };
|
||||
|
||||
return ChangeInputParameters(&audioformat);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::ChangeInputParameters(amf::AMFVirtualAudioFormat* format)
|
||||
{
|
||||
AMF_RESULT res = AMF_OK;
|
||||
res = m_pVirtualAudioInput->SetFormat(format);
|
||||
AMF_RETURN_IF_FAILED(res, L"SetFormat() failed");
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::VerifyInputParameters(amf::AMFVirtualAudioFormat* formatVer)
|
||||
{
|
||||
AMF_RESULT res = AMF_OK;
|
||||
amf::AMFVirtualAudioFormat format = {};
|
||||
res = m_pVirtualAudioInput->GetFormat(&format);
|
||||
AMF_RETURN_IF_FAILED(res, L"GetFormat() failed");
|
||||
// AMF_RETURN_IF_FALSE(format.sampleRate == formatVer->sampleRate && format.channelCount == formatVer->channelCount && format.sampleSize == formatVer->sampleSize, AMF_FAIL, L"Formats dont match" );
|
||||
if (format.sampleRate == formatVer->sampleRate && format.channelCount == formatVer->channelCount && format.sampleSize == formatVer->sampleSize)
|
||||
{
|
||||
return AMF_OK;
|
||||
}
|
||||
AMFTraceError(AMF_FACILITY, L"Formats dont match");
|
||||
return AMF_FAIL;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::DisableInput()
|
||||
{
|
||||
AMF_RESULT res = AMF_OK;
|
||||
res = m_pVirtualAudioInput->SetStatus(amf::AMF_VAS_DISCONNECTED);
|
||||
AMF_RETURN_IF_FAILED(res, L"SetStatus(amf::AMF_VAS_DISCONNECTED) failed");
|
||||
return AMF_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::SubmitInput(amf::AMFAudioBufferPtr pAudioBuffer)
|
||||
{
|
||||
return SubmitData(pAudioBuffer->GetNative(), pAudioBuffer->GetSize());
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VirtualMicrophoneAudioInput::SubmitData(const void* data, amf_size sizeInBytes)
|
||||
{
|
||||
AMF_RESULT res = AMF_OK;
|
||||
if (nullptr != m_pVirtualAudioInput)
|
||||
{
|
||||
return m_pVirtualAudioInput->SubmitData(data, sizeInBytes);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
#endif // #if defined(_WIN32)
|
||||
87
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/VirtualMicrophoneAudioInput.h
vendored
Normal file
87
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/VirtualMicrophoneAudioInput.h
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <tchar.h>
|
||||
#if defined(WIN32)
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "public/include/core/Debug.h"
|
||||
#include "public/common/TraceAdapter.h"
|
||||
#include "public/common/AMFFactory.h"
|
||||
#include "public/common/AMFMath.h"
|
||||
#include "public/common/Thread.h"
|
||||
#include "protected/include/components/VirtualAudio.h"
|
||||
#include "public/common/ByteArray.h"
|
||||
|
||||
using namespace amf;
|
||||
|
||||
class VirtualMicrophoneAudioInput
|
||||
{
|
||||
public:
|
||||
VirtualMicrophoneAudioInput();
|
||||
~VirtualMicrophoneAudioInput();
|
||||
|
||||
AMF_RESULT Init();
|
||||
AMF_RESULT Terminate();
|
||||
|
||||
AMF_RESULT EnableInput();
|
||||
AMF_RESULT CheckStatus();
|
||||
AMF_RESULT CheckFormat();
|
||||
AMF_RESULT ChangeInputParameters(amf_int64 sampleRate,
|
||||
amf_int64 channelCount,
|
||||
amf_int64 audioFormat);
|
||||
AMF_RESULT ChangeInputParameters(amf::AMFVirtualAudioFormat* format);
|
||||
AMF_RESULT VerifyInputParameters(amf::AMFVirtualAudioFormat* format);
|
||||
AMF_RESULT DisableInput();
|
||||
AMF_RESULT SubmitInput(amf::AMFAudioBufferPtr pAudioBuffer);
|
||||
AMF_RESULT SubmitData(const void* data, amf_size sizeInBytes);
|
||||
|
||||
protected:
|
||||
amf::AMFVirtualAudioManagerPtr m_pAudioManager;
|
||||
amf::AMFVirtualAudioInputPtr m_pVirtualAudioInput;
|
||||
|
||||
AMF_RESULT CreateVirtualAudioInput();
|
||||
AMF_RESULT DestroyVirtualAudioInput();
|
||||
|
||||
#ifdef WIN32
|
||||
bool m_bCoInitializeSucceeded;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<VirtualMicrophoneAudioInput> VirtualMicrophoneAudioInputPtr;
|
||||
#endif
|
||||
451
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/VulkanImportTable.cpp
vendored
Normal file
451
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/VulkanImportTable.cpp
vendored
Normal file
@@ -0,0 +1,451 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
///-------------------------------------------------------------------------
|
||||
/// @file VulkanImportTable.cpp
|
||||
/// @brief Vulkan import table
|
||||
///-------------------------------------------------------------------------
|
||||
#include "VulkanImportTable.h"
|
||||
#include "public/common/TraceAdapter.h"
|
||||
#include "Thread.h"
|
||||
|
||||
using namespace amf;
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
#define GET_DLL_ENTRYPOINT(h, w) w = reinterpret_cast<PFN_##w>(amf_get_proc_address(h, #w)); if(w==nullptr) \
|
||||
{ AMFTraceError(L"VulkanImportTable", L"Failed to aquire entrypoint %S", #w); return AMF_FAIL; };
|
||||
#define GET_INSTANCE_ENTRYPOINT(i, w) w = reinterpret_cast<PFN_##w>(vkGetInstanceProcAddr(i, #w)); if(w==nullptr) \
|
||||
{ AMFTraceError(L"VulkanImportTable", L"Failed to aquire entrypoint %S", #w); return AMF_FAIL; };
|
||||
#define GET_INSTANCE_ENTRYPOINT_NORETURN(i, w) w = reinterpret_cast<PFN_##w>(vkGetInstanceProcAddr(i, #w));
|
||||
#define GET_DEVICE_ENTRYPOINT(i, w) w = reinterpret_cast<PFN_##w>(vkGetDeviceProcAddr(i, #w)); if(w==nullptr) \
|
||||
{ AMFTraceError(L"VulkanImportTable", L"Failed to aquire entrypoint %S", #w); return AMF_FAIL; };
|
||||
#define GET_DEVICE_ENTRYPOINT_NORETURN(i, w) w = reinterpret_cast<PFN_##w>(vkGetDeviceProcAddr(i, #w)); if(w==nullptr) \
|
||||
{ AMFTraceDebug(L"VulkanImportTable", L"Failed to aquire entrypoint %S", #w); };
|
||||
|
||||
VulkanImportTable::VulkanImportTable() :
|
||||
m_hVulkanDll(nullptr),
|
||||
vkCreateInstance(nullptr),
|
||||
vkDestroyInstance(nullptr),
|
||||
vkEnumeratePhysicalDevices(nullptr),
|
||||
vkGetPhysicalDeviceFeatures(nullptr),
|
||||
vkGetPhysicalDeviceFormatProperties(nullptr),
|
||||
vkGetPhysicalDeviceImageFormatProperties(nullptr),
|
||||
vkGetPhysicalDeviceProperties(nullptr),
|
||||
vkGetPhysicalDeviceExternalSemaphoreProperties(nullptr),
|
||||
vkGetPhysicalDeviceProperties2KHR(nullptr),
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(nullptr),
|
||||
vkGetPhysicalDeviceQueueFamilyProperties2(nullptr),
|
||||
vkGetPhysicalDeviceMemoryProperties(nullptr),
|
||||
vkGetInstanceProcAddr(nullptr),
|
||||
vkGetDeviceProcAddr(nullptr),
|
||||
vkCreateDevice(nullptr),
|
||||
vkDestroyDevice(nullptr),
|
||||
vkEnumerateInstanceExtensionProperties(nullptr),
|
||||
vkEnumerateDeviceExtensionProperties(nullptr),
|
||||
vkEnumerateInstanceLayerProperties(nullptr),
|
||||
vkEnumerateDeviceLayerProperties(nullptr),
|
||||
vkGetDeviceQueue(nullptr),
|
||||
vkQueueSubmit(nullptr),
|
||||
vkQueueWaitIdle(nullptr),
|
||||
vkDeviceWaitIdle(nullptr),
|
||||
vkAllocateMemory(nullptr),
|
||||
vkFreeMemory(nullptr),
|
||||
vkMapMemory(nullptr),
|
||||
vkUnmapMemory(nullptr),
|
||||
vkFlushMappedMemoryRanges(nullptr),
|
||||
vkInvalidateMappedMemoryRanges(nullptr),
|
||||
vkGetDeviceMemoryCommitment(nullptr),
|
||||
vkBindBufferMemory(nullptr),
|
||||
vkBindImageMemory(nullptr),
|
||||
vkGetBufferMemoryRequirements(nullptr),
|
||||
vkGetImageMemoryRequirements(nullptr),
|
||||
vkGetImageSparseMemoryRequirements(nullptr),
|
||||
vkGetPhysicalDeviceSparseImageFormatProperties(nullptr),
|
||||
vkQueueBindSparse(nullptr),
|
||||
vkCreateFence(nullptr),
|
||||
vkDestroyFence(nullptr),
|
||||
vkResetFences(nullptr),
|
||||
vkGetFenceStatus(nullptr),
|
||||
vkWaitForFences(nullptr),
|
||||
vkCreateSemaphore(nullptr),
|
||||
vkDestroySemaphore(nullptr),
|
||||
vkCreateEvent(nullptr),
|
||||
vkDestroyEvent(nullptr),
|
||||
vkGetEventStatus(nullptr),
|
||||
vkSetEvent(nullptr),
|
||||
vkResetEvent(nullptr),
|
||||
vkCreateQueryPool(nullptr),
|
||||
vkDestroyQueryPool(nullptr),
|
||||
vkGetQueryPoolResults(nullptr),
|
||||
vkCreateBuffer(nullptr),
|
||||
vkDestroyBuffer(nullptr),
|
||||
vkCreateBufferView(nullptr),
|
||||
vkDestroyBufferView(nullptr),
|
||||
vkCreateImage(nullptr),
|
||||
vkDestroyImage(nullptr),
|
||||
vkGetImageSubresourceLayout(nullptr),
|
||||
vkCreateImageView(nullptr),
|
||||
vkDestroyImageView(nullptr),
|
||||
vkCreateShaderModule(nullptr),
|
||||
vkDestroyShaderModule(nullptr),
|
||||
vkCreatePipelineCache(nullptr),
|
||||
vkDestroyPipelineCache(nullptr),
|
||||
vkGetPipelineCacheData(nullptr),
|
||||
vkMergePipelineCaches(nullptr),
|
||||
vkCreateGraphicsPipelines(nullptr),
|
||||
vkCreateComputePipelines(nullptr),
|
||||
vkDestroyPipeline(nullptr),
|
||||
vkCreatePipelineLayout(nullptr),
|
||||
vkDestroyPipelineLayout(nullptr),
|
||||
vkCreateSampler(nullptr),
|
||||
vkDestroySampler(nullptr),
|
||||
vkCreateDescriptorSetLayout(nullptr),
|
||||
vkDestroyDescriptorSetLayout(nullptr),
|
||||
vkCreateDescriptorPool(nullptr),
|
||||
vkDestroyDescriptorPool(nullptr),
|
||||
vkResetDescriptorPool(nullptr),
|
||||
vkAllocateDescriptorSets(nullptr),
|
||||
vkFreeDescriptorSets(nullptr),
|
||||
vkUpdateDescriptorSets(nullptr),
|
||||
vkCreateFramebuffer(nullptr),
|
||||
vkDestroyFramebuffer(nullptr),
|
||||
vkCreateRenderPass(nullptr),
|
||||
vkDestroyRenderPass(nullptr),
|
||||
vkGetRenderAreaGranularity(nullptr),
|
||||
vkCreateCommandPool(nullptr),
|
||||
vkDestroyCommandPool(nullptr),
|
||||
vkResetCommandPool(nullptr),
|
||||
vkAllocateCommandBuffers(nullptr),
|
||||
vkFreeCommandBuffers(nullptr),
|
||||
vkBeginCommandBuffer(nullptr),
|
||||
vkEndCommandBuffer(nullptr),
|
||||
vkResetCommandBuffer(nullptr),
|
||||
vkCmdBindPipeline(nullptr),
|
||||
vkCmdSetViewport(nullptr),
|
||||
vkCmdSetScissor(nullptr),
|
||||
vkCmdSetLineWidth(nullptr),
|
||||
vkCmdSetDepthBias(nullptr),
|
||||
vkCmdSetBlendConstants(nullptr),
|
||||
vkCmdSetDepthBounds(nullptr),
|
||||
vkCmdSetStencilCompareMask(nullptr),
|
||||
vkCmdSetStencilWriteMask(nullptr),
|
||||
vkCmdSetStencilReference(nullptr),
|
||||
vkCmdBindDescriptorSets(nullptr),
|
||||
vkCmdBindIndexBuffer(nullptr),
|
||||
vkCmdBindVertexBuffers(nullptr),
|
||||
vkCmdDraw(nullptr),
|
||||
vkCmdDrawIndexed(nullptr),
|
||||
vkCmdDrawIndirect(nullptr),
|
||||
vkCmdDrawIndexedIndirect(nullptr),
|
||||
vkCmdDispatch(nullptr),
|
||||
vkCmdDispatchIndirect(nullptr),
|
||||
vkCmdCopyBuffer(nullptr),
|
||||
vkCmdCopyImage(nullptr),
|
||||
vkCmdBlitImage(nullptr),
|
||||
vkCmdCopyBufferToImage(nullptr),
|
||||
vkCmdCopyImageToBuffer(nullptr),
|
||||
vkCmdUpdateBuffer(nullptr),
|
||||
vkCmdFillBuffer(nullptr),
|
||||
vkCmdClearColorImage(nullptr),
|
||||
vkCmdClearDepthStencilImage(nullptr),
|
||||
vkCmdClearAttachments(nullptr),
|
||||
vkCmdResolveImage(nullptr),
|
||||
vkCmdSetEvent(nullptr),
|
||||
vkCmdResetEvent(nullptr),
|
||||
vkCmdWaitEvents(nullptr),
|
||||
vkCmdPipelineBarrier(nullptr),
|
||||
vkCmdBeginQuery(nullptr),
|
||||
vkCmdEndQuery(nullptr),
|
||||
vkCmdResetQueryPool(nullptr),
|
||||
vkCmdWriteTimestamp(nullptr),
|
||||
vkCmdCopyQueryPoolResults(nullptr),
|
||||
vkCmdPushConstants(nullptr),
|
||||
vkCmdBeginRenderPass(nullptr),
|
||||
vkCmdNextSubpass(nullptr),
|
||||
vkCmdEndRenderPass(nullptr),
|
||||
vkCmdExecuteCommands(nullptr),
|
||||
vkGetPhysicalDeviceFeatures2(nullptr),
|
||||
vkDestroySurfaceKHR(nullptr),
|
||||
vkGetPhysicalDeviceSurfaceSupportKHR(nullptr),
|
||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(nullptr),
|
||||
vkGetPhysicalDeviceSurfaceFormatsKHR(nullptr),
|
||||
vkGetPhysicalDeviceSurfacePresentModesKHR(nullptr),
|
||||
vkCreateSwapchainKHR(nullptr),
|
||||
vkDestroySwapchainKHR(nullptr),
|
||||
vkGetSwapchainImagesKHR(nullptr),
|
||||
vkAcquireNextImageKHR(nullptr),
|
||||
vkQueuePresentKHR(nullptr),
|
||||
#if defined(__linux)
|
||||
vkGetMemoryFdKHR(nullptr),
|
||||
vkImportSemaphoreFdKHR(nullptr),
|
||||
vkGetSemaphoreFdKHR(nullptr),
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
vkCreateWin32SurfaceKHR(nullptr),
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
vkCreateXlibSurfaceKHR(nullptr),
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||
vkCreateAndroidSurfaceKHR(nullptr),
|
||||
#endif
|
||||
vkGetMemoryHostPointerPropertiesEXT(nullptr),
|
||||
vkCreateDebugReportCallbackEXT(nullptr),
|
||||
vkDebugReportMessageEXT(nullptr),
|
||||
vkDestroyDebugReportCallbackEXT(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
VulkanImportTable::~VulkanImportTable()
|
||||
{
|
||||
if (m_hVulkanDll != nullptr)
|
||||
{
|
||||
amf_free_library(m_hVulkanDll);
|
||||
}
|
||||
m_hVulkanDll = nullptr;
|
||||
}
|
||||
|
||||
AMF_RESULT VulkanImportTable::LoadFunctionsTable()
|
||||
{
|
||||
if (m_hVulkanDll != nullptr)
|
||||
{
|
||||
return AMF_OK;
|
||||
}
|
||||
#if defined(_WIN32)
|
||||
m_hVulkanDll = amf_load_library(L"vulkan-1.dll");
|
||||
#elif defined(__ANDROID__)
|
||||
m_hVulkanDll = amf_load_library1(L"libvulkan.so", true);
|
||||
#elif defined(__linux__)
|
||||
m_hVulkanDll = amf_load_library1(L"libvulkan.so.1", true);
|
||||
#endif
|
||||
|
||||
if (m_hVulkanDll == nullptr)
|
||||
{
|
||||
AMFTraceError(L"VulkanImportTable", L"amf_load_library() failed to load vulkan dll!");
|
||||
return AMF_FAIL;
|
||||
}
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateInstance);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateInstance);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyInstance);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkEnumeratePhysicalDevices);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceFeatures);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceFormatProperties);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceImageFormatProperties);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceProperties);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceExternalSemaphoreProperties);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceQueueFamilyProperties);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceQueueFamilyProperties2);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceMemoryProperties);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetInstanceProcAddr);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetDeviceProcAddr);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateDevice);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyDevice);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkEnumerateInstanceExtensionProperties);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkEnumerateDeviceExtensionProperties);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkEnumerateInstanceLayerProperties);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkEnumerateDeviceLayerProperties);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetDeviceQueue);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkQueueSubmit);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkQueueWaitIdle);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDeviceWaitIdle);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkAllocateMemory);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkFreeMemory);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkMapMemory);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkUnmapMemory);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkFlushMappedMemoryRanges);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkInvalidateMappedMemoryRanges);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetDeviceMemoryCommitment);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkBindBufferMemory);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkBindImageMemory);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetBufferMemoryRequirements);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetImageMemoryRequirements);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetImageSparseMemoryRequirements);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceSparseImageFormatProperties);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkQueueBindSparse);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateFence);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyFence);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkResetFences);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetFenceStatus);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkWaitForFences);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateSemaphore);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroySemaphore);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateEvent);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyEvent);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetEventStatus);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkSetEvent);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkResetEvent);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateQueryPool);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyQueryPool);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetQueryPoolResults);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateBuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyBuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateBufferView);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyBufferView);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateImage);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyImage);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetImageSubresourceLayout);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateImageView);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyImageView);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateShaderModule);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyShaderModule);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreatePipelineCache);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyPipelineCache);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPipelineCacheData);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkMergePipelineCaches);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateGraphicsPipelines);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateComputePipelines);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyPipeline);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreatePipelineLayout);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyPipelineLayout);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateSampler);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroySampler);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateDescriptorSetLayout);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyDescriptorSetLayout);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateDescriptorPool);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyDescriptorPool);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkResetDescriptorPool);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkAllocateDescriptorSets);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkFreeDescriptorSets);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkUpdateDescriptorSets);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateFramebuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyFramebuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateRenderPass);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyRenderPass);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetRenderAreaGranularity);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateCommandPool);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroyCommandPool);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkResetCommandPool);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkAllocateCommandBuffers);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkFreeCommandBuffers);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkBeginCommandBuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkEndCommandBuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkResetCommandBuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdBindPipeline);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdSetViewport);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdSetScissor);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdSetLineWidth);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdSetDepthBias);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdSetBlendConstants);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdSetDepthBounds);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdSetStencilCompareMask);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdSetStencilWriteMask);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdSetStencilReference);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdBindDescriptorSets);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdBindIndexBuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdBindVertexBuffers);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdDraw);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdDrawIndexed);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdDrawIndirect);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdDrawIndexedIndirect);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdDispatch);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdDispatchIndirect);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdCopyBuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdCopyImage);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdBlitImage);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdCopyBufferToImage);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdCopyImageToBuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdUpdateBuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdFillBuffer);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdClearColorImage);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdClearDepthStencilImage);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdClearAttachments);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdResolveImage);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdSetEvent);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdResetEvent);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdWaitEvents);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdPipelineBarrier);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdBeginQuery);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdEndQuery);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdResetQueryPool);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdWriteTimestamp);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdCopyQueryPoolResults);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdPushConstants);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdBeginRenderPass);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdNextSubpass);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdEndRenderPass);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCmdExecuteCommands);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceFeatures2);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceSurfaceSupportKHR);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceSurfaceCapabilitiesKHR);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceSurfaceFormatsKHR);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetPhysicalDeviceSurfacePresentModesKHR);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkDestroySurfaceKHR);
|
||||
|
||||
#if defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateXlibSurfaceKHR);
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateAndroidSurfaceKHR);
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkGetAndroidHardwareBufferPropertiesANDROID);
|
||||
#endif
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
AMF_RESULT VulkanImportTable::LoadInstanceFunctionsTableExt(VkInstance instance, bool bDebug)
|
||||
{
|
||||
GET_INSTANCE_ENTRYPOINT(instance, vkGetPhysicalDeviceProperties2KHR);
|
||||
|
||||
if(bDebug)
|
||||
{
|
||||
GET_INSTANCE_ENTRYPOINT(instance, vkCreateDebugReportCallbackEXT);
|
||||
GET_INSTANCE_ENTRYPOINT(instance, vkDebugReportMessageEXT);
|
||||
GET_INSTANCE_ENTRYPOINT(instance, vkDestroyDebugReportCallbackEXT);
|
||||
}
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
AMF_RESULT VulkanImportTable::LoadDeviceFunctionsTableExt(VkDevice device)
|
||||
{
|
||||
GET_DEVICE_ENTRYPOINT(device, vkCreateSwapchainKHR);
|
||||
GET_DEVICE_ENTRYPOINT(device, vkDestroySwapchainKHR);
|
||||
GET_DEVICE_ENTRYPOINT(device, vkGetSwapchainImagesKHR);
|
||||
GET_DEVICE_ENTRYPOINT(device, vkAcquireNextImageKHR);
|
||||
GET_DEVICE_ENTRYPOINT(device, vkQueuePresentKHR);
|
||||
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
GET_DLL_ENTRYPOINT(m_hVulkanDll, vkCreateWin32SurfaceKHR);
|
||||
#endif
|
||||
|
||||
#if defined(__linux)
|
||||
GET_DEVICE_ENTRYPOINT(device, vkGetMemoryFdKHR);
|
||||
GET_DEVICE_ENTRYPOINT(device, vkImportSemaphoreFdKHR);
|
||||
GET_DEVICE_ENTRYPOINT(device, vkGetSemaphoreFdKHR);
|
||||
#endif
|
||||
GET_DEVICE_ENTRYPOINT_NORETURN(device, vkGetMemoryHostPointerPropertiesEXT); //< requires VK_EXT_external_memory_host
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
#undef GET_DEVICE_ENTRYPOINT
|
||||
#undef GET_INSTANCE_ENTRYPOINT
|
||||
#undef GET_INSTANCE_ENTRYPOINT_NORETURN
|
||||
246
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/VulkanImportTable.h
vendored
Normal file
246
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/VulkanImportTable.h
vendored
Normal file
@@ -0,0 +1,246 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
///-------------------------------------------------------------------------
|
||||
/// @file VulkanImportTable.h
|
||||
/// @brief Vulkan import table
|
||||
///-------------------------------------------------------------------------
|
||||
#pragma once
|
||||
|
||||
#include "../include/core/Result.h"
|
||||
|
||||
#define VK_NO_PROTOTYPES
|
||||
#ifdef _WIN32
|
||||
#define VK_USE_PLATFORM_WIN32_KHR
|
||||
#elif defined(__ANDROID__)
|
||||
#define VK_USE_PLATFORM_ANDROID_KHR
|
||||
#elif defined(__linux)
|
||||
#if !defined(AMF_DISABLE_VK_USE_PLATFORM_XLIB_KHR)
|
||||
#define VK_USE_PLATFORM_XLIB_KHR
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "public/include/core/VulkanAMF.h"
|
||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||
#include "vulkan/vulkan_android.h"
|
||||
#endif
|
||||
|
||||
|
||||
//#define ENABLE_VALIDATION
|
||||
|
||||
struct VulkanImportTable
|
||||
{
|
||||
VulkanImportTable();
|
||||
~VulkanImportTable();
|
||||
|
||||
AMF_RESULT LoadFunctionsTable();
|
||||
AMF_RESULT LoadInstanceFunctionsTableExt(VkInstance instance, bool bDebug);
|
||||
AMF_RESULT LoadDeviceFunctionsTableExt(VkDevice device);
|
||||
// core Vulkan
|
||||
|
||||
PFN_vkCreateInstance vkCreateInstance;
|
||||
PFN_vkDestroyInstance vkDestroyInstance;
|
||||
PFN_vkEnumeratePhysicalDevices vkEnumeratePhysicalDevices;
|
||||
PFN_vkGetPhysicalDeviceFeatures vkGetPhysicalDeviceFeatures;
|
||||
PFN_vkGetPhysicalDeviceProperties2KHR vkGetPhysicalDeviceProperties2KHR;
|
||||
PFN_vkGetPhysicalDeviceFormatProperties vkGetPhysicalDeviceFormatProperties;
|
||||
PFN_vkGetPhysicalDeviceImageFormatProperties vkGetPhysicalDeviceImageFormatProperties;
|
||||
PFN_vkGetPhysicalDeviceProperties vkGetPhysicalDeviceProperties;
|
||||
PFN_vkGetPhysicalDeviceExternalSemaphoreProperties vkGetPhysicalDeviceExternalSemaphoreProperties;
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties vkGetPhysicalDeviceQueueFamilyProperties;
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties2 vkGetPhysicalDeviceQueueFamilyProperties2;
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties vkGetPhysicalDeviceMemoryProperties;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr;
|
||||
PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr;
|
||||
PFN_vkCreateDevice vkCreateDevice;
|
||||
PFN_vkDestroyDevice vkDestroyDevice;
|
||||
PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties;
|
||||
PFN_vkEnumerateDeviceExtensionProperties vkEnumerateDeviceExtensionProperties;
|
||||
PFN_vkEnumerateInstanceLayerProperties vkEnumerateInstanceLayerProperties;
|
||||
PFN_vkEnumerateDeviceLayerProperties vkEnumerateDeviceLayerProperties;
|
||||
PFN_vkGetDeviceQueue vkGetDeviceQueue;
|
||||
PFN_vkQueueSubmit vkQueueSubmit;
|
||||
PFN_vkQueueWaitIdle vkQueueWaitIdle;
|
||||
PFN_vkDeviceWaitIdle vkDeviceWaitIdle;
|
||||
PFN_vkAllocateMemory vkAllocateMemory;
|
||||
PFN_vkFreeMemory vkFreeMemory;
|
||||
PFN_vkMapMemory vkMapMemory;
|
||||
PFN_vkUnmapMemory vkUnmapMemory;
|
||||
PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges;
|
||||
PFN_vkInvalidateMappedMemoryRanges vkInvalidateMappedMemoryRanges;
|
||||
PFN_vkGetDeviceMemoryCommitment vkGetDeviceMemoryCommitment;
|
||||
PFN_vkBindBufferMemory vkBindBufferMemory;
|
||||
PFN_vkBindImageMemory vkBindImageMemory;
|
||||
PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements;
|
||||
PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements;
|
||||
PFN_vkGetImageSparseMemoryRequirements vkGetImageSparseMemoryRequirements;
|
||||
PFN_vkGetPhysicalDeviceSparseImageFormatProperties vkGetPhysicalDeviceSparseImageFormatProperties;
|
||||
PFN_vkQueueBindSparse vkQueueBindSparse;
|
||||
PFN_vkCreateFence vkCreateFence;
|
||||
PFN_vkDestroyFence vkDestroyFence;
|
||||
PFN_vkResetFences vkResetFences;
|
||||
PFN_vkGetFenceStatus vkGetFenceStatus;
|
||||
PFN_vkWaitForFences vkWaitForFences;
|
||||
PFN_vkCreateSemaphore vkCreateSemaphore;
|
||||
PFN_vkDestroySemaphore vkDestroySemaphore;
|
||||
PFN_vkCreateEvent vkCreateEvent;
|
||||
PFN_vkDestroyEvent vkDestroyEvent;
|
||||
PFN_vkGetEventStatus vkGetEventStatus;
|
||||
PFN_vkSetEvent vkSetEvent;
|
||||
PFN_vkResetEvent vkResetEvent;
|
||||
PFN_vkCreateQueryPool vkCreateQueryPool;
|
||||
PFN_vkDestroyQueryPool vkDestroyQueryPool;
|
||||
PFN_vkGetQueryPoolResults vkGetQueryPoolResults;
|
||||
PFN_vkCreateBuffer vkCreateBuffer;
|
||||
PFN_vkDestroyBuffer vkDestroyBuffer;
|
||||
PFN_vkCreateBufferView vkCreateBufferView;
|
||||
PFN_vkDestroyBufferView vkDestroyBufferView;
|
||||
PFN_vkCreateImage vkCreateImage;
|
||||
PFN_vkDestroyImage vkDestroyImage;
|
||||
PFN_vkGetImageSubresourceLayout vkGetImageSubresourceLayout;
|
||||
PFN_vkCreateImageView vkCreateImageView;
|
||||
PFN_vkDestroyImageView vkDestroyImageView;
|
||||
PFN_vkCreateShaderModule vkCreateShaderModule;
|
||||
PFN_vkDestroyShaderModule vkDestroyShaderModule;
|
||||
PFN_vkCreatePipelineCache vkCreatePipelineCache;
|
||||
PFN_vkDestroyPipelineCache vkDestroyPipelineCache;
|
||||
PFN_vkGetPipelineCacheData vkGetPipelineCacheData;
|
||||
PFN_vkMergePipelineCaches vkMergePipelineCaches;
|
||||
PFN_vkCreateGraphicsPipelines vkCreateGraphicsPipelines;
|
||||
PFN_vkCreateComputePipelines vkCreateComputePipelines;
|
||||
PFN_vkDestroyPipeline vkDestroyPipeline;
|
||||
PFN_vkCreatePipelineLayout vkCreatePipelineLayout;
|
||||
PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout;
|
||||
PFN_vkCreateSampler vkCreateSampler;
|
||||
PFN_vkDestroySampler vkDestroySampler;
|
||||
PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout;
|
||||
PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout;
|
||||
PFN_vkCreateDescriptorPool vkCreateDescriptorPool;
|
||||
PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool;
|
||||
PFN_vkResetDescriptorPool vkResetDescriptorPool;
|
||||
PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets;
|
||||
PFN_vkFreeDescriptorSets vkFreeDescriptorSets;
|
||||
PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets;
|
||||
PFN_vkCreateFramebuffer vkCreateFramebuffer;
|
||||
PFN_vkDestroyFramebuffer vkDestroyFramebuffer;
|
||||
PFN_vkCreateRenderPass vkCreateRenderPass;
|
||||
PFN_vkDestroyRenderPass vkDestroyRenderPass;
|
||||
PFN_vkGetRenderAreaGranularity vkGetRenderAreaGranularity;
|
||||
PFN_vkCreateCommandPool vkCreateCommandPool;
|
||||
PFN_vkDestroyCommandPool vkDestroyCommandPool;
|
||||
PFN_vkResetCommandPool vkResetCommandPool;
|
||||
PFN_vkAllocateCommandBuffers vkAllocateCommandBuffers;
|
||||
PFN_vkFreeCommandBuffers vkFreeCommandBuffers;
|
||||
PFN_vkBeginCommandBuffer vkBeginCommandBuffer;
|
||||
PFN_vkEndCommandBuffer vkEndCommandBuffer;
|
||||
PFN_vkResetCommandBuffer vkResetCommandBuffer;
|
||||
PFN_vkCmdBindPipeline vkCmdBindPipeline;
|
||||
PFN_vkCmdSetViewport vkCmdSetViewport;
|
||||
PFN_vkCmdSetScissor vkCmdSetScissor;
|
||||
PFN_vkCmdSetLineWidth vkCmdSetLineWidth;
|
||||
PFN_vkCmdSetDepthBias vkCmdSetDepthBias;
|
||||
PFN_vkCmdSetBlendConstants vkCmdSetBlendConstants;
|
||||
PFN_vkCmdSetDepthBounds vkCmdSetDepthBounds;
|
||||
PFN_vkCmdSetStencilCompareMask vkCmdSetStencilCompareMask;
|
||||
PFN_vkCmdSetStencilWriteMask vkCmdSetStencilWriteMask;
|
||||
PFN_vkCmdSetStencilReference vkCmdSetStencilReference;
|
||||
PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets;
|
||||
PFN_vkCmdBindIndexBuffer vkCmdBindIndexBuffer;
|
||||
PFN_vkCmdBindVertexBuffers vkCmdBindVertexBuffers;
|
||||
PFN_vkCmdDraw vkCmdDraw;
|
||||
PFN_vkCmdDrawIndexed vkCmdDrawIndexed;
|
||||
PFN_vkCmdDrawIndirect vkCmdDrawIndirect;
|
||||
PFN_vkCmdDrawIndexedIndirect vkCmdDrawIndexedIndirect;
|
||||
PFN_vkCmdDispatch vkCmdDispatch;
|
||||
PFN_vkCmdDispatchIndirect vkCmdDispatchIndirect;
|
||||
PFN_vkCmdCopyBuffer vkCmdCopyBuffer;
|
||||
PFN_vkCmdCopyImage vkCmdCopyImage;
|
||||
PFN_vkCmdBlitImage vkCmdBlitImage;
|
||||
PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage;
|
||||
PFN_vkCmdCopyImageToBuffer vkCmdCopyImageToBuffer;
|
||||
PFN_vkCmdUpdateBuffer vkCmdUpdateBuffer;
|
||||
PFN_vkCmdFillBuffer vkCmdFillBuffer;
|
||||
PFN_vkCmdClearColorImage vkCmdClearColorImage;
|
||||
PFN_vkCmdClearDepthStencilImage vkCmdClearDepthStencilImage;
|
||||
PFN_vkCmdClearAttachments vkCmdClearAttachments;
|
||||
PFN_vkCmdResolveImage vkCmdResolveImage;
|
||||
PFN_vkCmdSetEvent vkCmdSetEvent;
|
||||
PFN_vkCmdResetEvent vkCmdResetEvent;
|
||||
PFN_vkCmdWaitEvents vkCmdWaitEvents;
|
||||
PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier;
|
||||
PFN_vkCmdBeginQuery vkCmdBeginQuery;
|
||||
PFN_vkCmdEndQuery vkCmdEndQuery;
|
||||
PFN_vkCmdResetQueryPool vkCmdResetQueryPool;
|
||||
PFN_vkCmdWriteTimestamp vkCmdWriteTimestamp;
|
||||
PFN_vkCmdCopyQueryPoolResults vkCmdCopyQueryPoolResults;
|
||||
PFN_vkCmdPushConstants vkCmdPushConstants;
|
||||
PFN_vkCmdBeginRenderPass vkCmdBeginRenderPass;
|
||||
PFN_vkCmdNextSubpass vkCmdNextSubpass;
|
||||
PFN_vkCmdEndRenderPass vkCmdEndRenderPass;
|
||||
PFN_vkCmdExecuteCommands vkCmdExecuteCommands;
|
||||
PFN_vkGetPhysicalDeviceFeatures2 vkGetPhysicalDeviceFeatures2;
|
||||
|
||||
// public extensions
|
||||
PFN_vkDestroySurfaceKHR vkDestroySurfaceKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfaceSupportKHR vkGetPhysicalDeviceSurfaceSupportKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR vkGetPhysicalDeviceSurfaceCapabilitiesKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR vkGetPhysicalDeviceSurfaceFormatsKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR vkGetPhysicalDeviceSurfacePresentModesKHR;
|
||||
|
||||
PFN_vkCreateSwapchainKHR vkCreateSwapchainKHR;
|
||||
PFN_vkDestroySwapchainKHR vkDestroySwapchainKHR;
|
||||
PFN_vkGetSwapchainImagesKHR vkGetSwapchainImagesKHR;
|
||||
PFN_vkAcquireNextImageKHR vkAcquireNextImageKHR;
|
||||
PFN_vkQueuePresentKHR vkQueuePresentKHR;
|
||||
#ifdef __linux
|
||||
PFN_vkGetMemoryFdKHR vkGetMemoryFdKHR;
|
||||
PFN_vkImportSemaphoreFdKHR vkImportSemaphoreFdKHR;
|
||||
PFN_vkGetSemaphoreFdKHR vkGetSemaphoreFdKHR;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(VK_USE_PLATFORM_WIN32_KHR)
|
||||
PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR;
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_XLIB_KHR)
|
||||
PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR;
|
||||
#endif
|
||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||
PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR;
|
||||
PFN_vkGetAndroidHardwareBufferPropertiesANDROID vkGetAndroidHardwareBufferPropertiesANDROID;
|
||||
#endif
|
||||
PFN_vkGetMemoryHostPointerPropertiesEXT vkGetMemoryHostPointerPropertiesEXT;
|
||||
|
||||
PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT;
|
||||
PFN_vkDebugReportMessageEXT vkDebugReportMessageEXT;
|
||||
PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT;
|
||||
amf_handle m_hVulkanDll;
|
||||
};
|
||||
462
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Windows/ThreadWindows.cpp
vendored
Normal file
462
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Windows/ThreadWindows.cpp
vendored
Normal file
@@ -0,0 +1,462 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
|
||||
#include "../Thread.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <timeapi.h>
|
||||
#include <windows.h>
|
||||
#include <memory>
|
||||
//----------------------------------------------------------------------------------------
|
||||
// threading
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_long AMF_CDECL_CALL amf_atomic_inc(amf_long* X)
|
||||
{
|
||||
return InterlockedIncrement((long*)X);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_long AMF_CDECL_CALL amf_atomic_dec(amf_long* X)
|
||||
{
|
||||
return InterlockedDecrement((long*)X);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_handle AMF_CDECL_CALL amf_create_critical_section()
|
||||
{
|
||||
CRITICAL_SECTION* cs = new CRITICAL_SECTION;
|
||||
#if defined(METRO_APP)
|
||||
::InitializeCriticalSectionEx(cs, 0, CRITICAL_SECTION_NO_DEBUG_INFO);
|
||||
#else
|
||||
::InitializeCriticalSection(cs);
|
||||
#endif
|
||||
return (amf_handle)cs; // in Win32 - no errors
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_delete_critical_section(amf_handle cs)
|
||||
{
|
||||
if(cs == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
::DeleteCriticalSection((CRITICAL_SECTION*)cs);
|
||||
delete (CRITICAL_SECTION*)cs;
|
||||
return true; // in Win32 - no errors
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_enter_critical_section(amf_handle cs)
|
||||
{
|
||||
if(cs == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
::EnterCriticalSection((CRITICAL_SECTION*)cs);
|
||||
return true; // in Win32 - no errors
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_wait_critical_section(amf_handle cs, amf_ulong ulTimeout)
|
||||
{
|
||||
if(cs == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
while (true)
|
||||
{
|
||||
const BOOL success = ::TryEnterCriticalSection((CRITICAL_SECTION*)cs);
|
||||
if (success == TRUE)
|
||||
{
|
||||
return true; // in Win32 - no errors
|
||||
}
|
||||
if (ulTimeout == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
amf_sleep(1);
|
||||
ulTimeout--;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_leave_critical_section(amf_handle cs)
|
||||
{
|
||||
if(cs == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
::LeaveCriticalSection((CRITICAL_SECTION*)cs);
|
||||
return true; // in Win32 - no errors
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_handle AMF_CDECL_CALL amf_create_event(bool bInitiallyOwned, bool bManualReset, const wchar_t* pName)
|
||||
{
|
||||
#if defined(METRO_APP)
|
||||
DWORD flags = ((bManualReset) ? CREATE_EVENT_MANUAL_RESET : 0) |
|
||||
((bInitiallyOwned) ? CREATE_EVENT_INITIAL_SET : 0);
|
||||
|
||||
return ::CreateEventEx(NULL, pName, flags, STANDARD_RIGHTS_ALL | EVENT_MODIFY_STATE);
|
||||
|
||||
#else
|
||||
return ::CreateEventW(NULL, bManualReset == true, bInitiallyOwned == true, pName);
|
||||
|
||||
#endif
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_delete_event(amf_handle hevent)
|
||||
{
|
||||
if(hevent == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ::CloseHandle(hevent) != FALSE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_set_event(amf_handle hevent)
|
||||
{
|
||||
if(hevent == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ::SetEvent(hevent) != FALSE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_reset_event(amf_handle hevent)
|
||||
{
|
||||
if(hevent == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ::ResetEvent(hevent) != FALSE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_wait_for_event(amf_handle hevent, amf_ulong ulTimeout)
|
||||
{
|
||||
if(hevent == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#if defined(METRO_APP)
|
||||
return ::WaitForSingleObjectEx(hevent, ulTimeout, FALSE) == WAIT_OBJECT_0;
|
||||
|
||||
#else
|
||||
return ::WaitForSingleObject(hevent, ulTimeout) == WAIT_OBJECT_0;
|
||||
|
||||
#endif
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_wait_for_event_timeout(amf_handle hevent, amf_ulong ulTimeout)
|
||||
{
|
||||
if(hevent == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
DWORD ret;
|
||||
#if defined(METRO_APP)
|
||||
ret = ::WaitForSingleObjectEx(hevent, ulTimeout, FALSE);
|
||||
#else
|
||||
ret = ::WaitForSingleObject(hevent, ulTimeout);
|
||||
#endif
|
||||
return ret == WAIT_OBJECT_0 || ret == WAIT_TIMEOUT;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_handle AMF_CDECL_CALL amf_create_mutex(bool bInitiallyOwned, const wchar_t* pName)
|
||||
{
|
||||
#if defined(METRO_APP)
|
||||
DWORD flags = (bInitiallyOwned) ? CREATE_MUTEX_INITIAL_OWNER : 0;
|
||||
return ::CreateMutexEx(NULL, pName, flags, STANDARD_RIGHTS_ALL);
|
||||
|
||||
#else
|
||||
return ::CreateMutexW(NULL, bInitiallyOwned == true, pName);
|
||||
|
||||
#endif
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_handle AMF_CDECL_CALL amf_open_mutex(const wchar_t* pName)
|
||||
{
|
||||
return ::OpenMutexW(MUTEX_ALL_ACCESS, FALSE, pName);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_delete_mutex(amf_handle hmutex)
|
||||
{
|
||||
if(hmutex == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ::CloseHandle(hmutex) != FALSE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_wait_for_mutex(amf_handle hmutex, amf_ulong ulTimeout)
|
||||
{
|
||||
if(hmutex == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#if defined(METRO_APP)
|
||||
return ::WaitForSingleObjectEx(hmutex, ulTimeout, FALSE) == WAIT_OBJECT_0;
|
||||
|
||||
#else
|
||||
return ::WaitForSingleObject(hmutex, ulTimeout) == WAIT_OBJECT_0;
|
||||
|
||||
#endif
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_release_mutex(amf_handle hmutex)
|
||||
{
|
||||
if(hmutex == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ::ReleaseMutex(hmutex) != FALSE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_handle AMF_CDECL_CALL amf_create_semaphore(amf_long iInitCount, amf_long iMaxCount, const wchar_t* pName)
|
||||
{
|
||||
if(iMaxCount == NULL || iInitCount > iMaxCount)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#if defined(METRO_APP)
|
||||
return ::CreateSemaphoreEx(NULL, iInitCount, iMaxCount, pName, 0, STANDARD_RIGHTS_ALL | SEMAPHORE_MODIFY_STATE);
|
||||
|
||||
#else
|
||||
return ::CreateSemaphoreW(NULL, iInitCount, iMaxCount, pName);
|
||||
|
||||
#endif
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_delete_semaphore(amf_handle hsemaphore)
|
||||
{
|
||||
if(hsemaphore == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ::CloseHandle(hsemaphore) != FALSE;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_wait_for_semaphore(amf_handle hsemaphore, amf_ulong timeout)
|
||||
{
|
||||
if(hsemaphore == NULL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#if defined(METRO_APP)
|
||||
return ::WaitForSingleObjectEx(hsemaphore, timeout, false) == WAIT_OBJECT_0;
|
||||
|
||||
#else
|
||||
return ::WaitForSingleObject(hsemaphore, timeout) == WAIT_OBJECT_0;
|
||||
|
||||
#endif
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
bool AMF_CDECL_CALL amf_release_semaphore(amf_handle hsemaphore, amf_long iCount, amf_long* iOldCount)
|
||||
{
|
||||
if(hsemaphore == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ::ReleaseSemaphore(hsemaphore, iCount, iOldCount) != FALSE;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void AMF_CDECL_CALL amf_sleep(amf_ulong delay)
|
||||
{
|
||||
#if defined(METRO_APP)
|
||||
Concurrency::wait(delay);
|
||||
#else
|
||||
Sleep(delay);
|
||||
#endif
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_pts AMF_CDECL_CALL amf_high_precision_clock()
|
||||
{
|
||||
static int state = 0;
|
||||
static LARGE_INTEGER Frequency;
|
||||
static LARGE_INTEGER StartCount;
|
||||
static amf_pts offset = 0;
|
||||
|
||||
if(state == 0)
|
||||
{
|
||||
if(QueryPerformanceFrequency(&Frequency))
|
||||
{
|
||||
state = 1;
|
||||
QueryPerformanceCounter(&StartCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
state = 2;
|
||||
}
|
||||
}
|
||||
if(state == 1)
|
||||
{
|
||||
LARGE_INTEGER PerformanceCount;
|
||||
if(QueryPerformanceCounter(&PerformanceCount))
|
||||
{
|
||||
amf_pts elapsed = static_cast<amf_pts>((PerformanceCount.QuadPart - StartCount.QuadPart) * 10000000LL / Frequency.QuadPart);
|
||||
|
||||
// periodically reset StartCount in order to avoid overflow
|
||||
if (elapsed > (3600LL * AMF_SECOND))
|
||||
{
|
||||
offset += elapsed;
|
||||
StartCount = PerformanceCount;
|
||||
|
||||
return offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
return offset + elapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(METRO_APP)
|
||||
return GetTickCount64() * 10;
|
||||
|
||||
#else
|
||||
return GetTickCount() * 10;
|
||||
|
||||
#endif
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#pragma comment (lib, "Winmm.lib")
|
||||
static amf_uint32 timerPrecision = 1;
|
||||
|
||||
void AMF_CDECL_CALL amf_increase_timer_precision()
|
||||
{
|
||||
#if !defined(METRO_APP)
|
||||
while (timeBeginPeriod(timerPrecision) == TIMERR_NOCANDO)
|
||||
{
|
||||
++timerPrecision;
|
||||
}
|
||||
/*
|
||||
typedef NTSTATUS (CALLBACK * NTSETTIMERRESOLUTION)(IN ULONG DesiredTime,IN BOOLEAN SetResolution,OUT PULONG ActualTime);
|
||||
typedef NTSTATUS (CALLBACK * NTQUERYTIMERRESOLUTION)(OUT PULONG MaximumTime,OUT PULONG MinimumTime,OUT PULONG CurrentTime);
|
||||
|
||||
HINSTANCE hNtDll = LoadLibrary(L"NTDLL.dll");
|
||||
if(hNtDll != NULL)
|
||||
{
|
||||
ULONG MinimumResolution=0;
|
||||
ULONG MaximumResolution=0;
|
||||
ULONG ActualResolution=0;
|
||||
|
||||
NTQUERYTIMERRESOLUTION NtQueryTimerResolution = (NTQUERYTIMERRESOLUTION)GetProcAddress(hNtDll, "NtQueryTimerResolution");
|
||||
NTSETTIMERRESOLUTION NtSetTimerResolution = (NTSETTIMERRESOLUTION)GetProcAddress(hNtDll, "NtSetTimerResolution");
|
||||
|
||||
if(NtQueryTimerResolution != NULL && NtSetTimerResolution != NULL)
|
||||
{
|
||||
NtQueryTimerResolution (&MinimumResolution, &MaximumResolution, &ActualResolution);
|
||||
if(MaximumResolution != 0)
|
||||
{
|
||||
NtSetTimerResolution (MaximumResolution, TRUE, &ActualResolution);
|
||||
NtQueryTimerResolution (&MinimumResolution, &MaximumResolution, &ActualResolution);
|
||||
|
||||
// if call NtQueryTimerResolution() again it will return the same values but precision is actually increased
|
||||
}
|
||||
}
|
||||
FreeLibrary(hNtDll);
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
void AMF_CDECL_CALL amf_restore_timer_precision()
|
||||
{
|
||||
#if !defined(METRO_APP)
|
||||
timeEndPeriod(timerPrecision);
|
||||
#endif
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_handle AMF_CDECL_CALL amf_load_library1(const wchar_t* filename, bool /*bGlobal*/)
|
||||
{
|
||||
return amf_load_library(filename);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_handle AMF_CDECL_CALL amf_load_library(const wchar_t* filename)
|
||||
{
|
||||
#if defined(METRO_APP)
|
||||
return LoadPackagedLibrary(filename, 0);
|
||||
#else
|
||||
return ::LoadLibraryExW(filename, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32 | LOAD_LIBRARY_SEARCH_USER_DIRS);
|
||||
#endif
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void* AMF_CDECL_CALL amf_get_proc_address(amf_handle module, const char* procName)
|
||||
{
|
||||
return (void*)::GetProcAddress((HMODULE)module, procName);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
int AMF_CDECL_CALL amf_free_library(amf_handle module)
|
||||
{
|
||||
return ::FreeLibrary((HMODULE)module)==TRUE;
|
||||
}
|
||||
#if !defined(METRO_APP)
|
||||
//----------------------------------------------------------------------------------------
|
||||
// memory
|
||||
//----------------------------------------------------------------------------------------
|
||||
void* AMF_CDECL_CALL amf_virtual_alloc(size_t size)
|
||||
{
|
||||
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
void AMF_CDECL_CALL amf_virtual_free(void* ptr)
|
||||
{
|
||||
VirtualFree(ptr, NULL, MEM_RELEASE);
|
||||
}
|
||||
#endif //#if !defined(METRO_APP)
|
||||
//----------------------------------------------------------------------------------------
|
||||
// cpu
|
||||
//----------------------------------------------------------------------------------------
|
||||
amf_int32 AMF_STD_CALL amf_get_cpu_cores()
|
||||
{
|
||||
//query the number of CPU HW cores
|
||||
DWORD len = 0;
|
||||
GetLogicalProcessorInformation(NULL, &len);
|
||||
|
||||
amf_uint32 count = len / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
|
||||
std::unique_ptr<SYSTEM_LOGICAL_PROCESSOR_INFORMATION[]> pBuffer(new SYSTEM_LOGICAL_PROCESSOR_INFORMATION[count]);
|
||||
if (pBuffer)
|
||||
{
|
||||
GetLogicalProcessorInformation(pBuffer.get(), &len);
|
||||
count = len / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
|
||||
amf_int32 iCores = 0;
|
||||
for (amf_uint32 idx = 0; idx < count; idx++)
|
||||
{
|
||||
if (pBuffer[idx].Relationship == RelationProcessorCore)
|
||||
{
|
||||
iCores++;
|
||||
}
|
||||
}
|
||||
return iCores;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------------------
|
||||
#endif // _WIN32
|
||||
119
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Windows/UtilsWindows.cpp
vendored
Normal file
119
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Windows/UtilsWindows.cpp
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#include "UtilsWindows.h"
|
||||
#include <public/common/TraceAdapter.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#define AMF_FACILITY L"UtilWindows"
|
||||
|
||||
amf_bool OSIsVersionOrGreater(DWORD major, DWORD minor, DWORD build)
|
||||
{
|
||||
// This function is to replace "IsWindowsVersionOrGreater" since
|
||||
// it seems to be broken since windows 8
|
||||
|
||||
HMODULE hModule = GetModuleHandleW(L"ntdll");
|
||||
|
||||
if (hModule == nullptr)
|
||||
{
|
||||
AMFTraceError(AMF_FACILITY, L"OSIsVersionOrGreater() - Could not get ntdll handle");
|
||||
return false;
|
||||
}
|
||||
|
||||
NTSTATUS(WINAPI * RtlGetVersion)(LPOSVERSIONINFOEXW);
|
||||
*(FARPROC*)&RtlGetVersion = GetProcAddress(hModule, "RtlGetVersion");
|
||||
|
||||
if (RtlGetVersion == nullptr)
|
||||
{
|
||||
AMFTraceError(AMF_FACILITY, L"OSIsVersionOrGreater() - Could not get RtlGetVersion procedure handle from ntdll");
|
||||
return false;
|
||||
}
|
||||
|
||||
OSVERSIONINFOEXW osVersionInfo = {};
|
||||
NTSTATUS status = RtlGetVersion(&osVersionInfo);
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
AMFTraceError(AMF_FACILITY, L"OSIsVersionOrGreater() - RtlGetVersion failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
const DWORD versions[] = { osVersionInfo.dwMajorVersion, osVersionInfo.dwMinorVersion, osVersionInfo.dwBuildNumber };
|
||||
const DWORD checkVersions[] = { major, minor, build };
|
||||
constexpr amf_uint count = amf_countof(versions);
|
||||
|
||||
for (amf_uint i = 0; i < count; ++i)
|
||||
{
|
||||
if (versions[i] == checkVersions[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return versions[i] > checkVersions[i];
|
||||
}
|
||||
|
||||
return versions[count - 1] == checkVersions[count - 1];
|
||||
}
|
||||
|
||||
AMF_RESULT GetDisplayInfo(amf_handle hwnd, DisplayInfo& displayInfo)
|
||||
{
|
||||
AMF_RETURN_IF_FALSE(hwnd != nullptr, AMF_INVALID_ARG, L"GetDisplayInfoFromWindow() - hwnd is NULL");
|
||||
displayInfo = {};
|
||||
|
||||
// Get display information (specifically name)
|
||||
displayInfo.hMonitor = MonitorFromWindow((HWND)hwnd, MONITOR_DEFAULTTONEAREST);
|
||||
AMF_RETURN_IF_FALSE(displayInfo.hMonitor != nullptr, AMF_FAIL, L"GetDisplayInfoFromWindow() - MonitorFromWindow() returned NULL");
|
||||
|
||||
MONITORINFOEX monitorInfo = {};
|
||||
monitorInfo.cbSize = sizeof(monitorInfo);
|
||||
BOOL ret = GetMonitorInfoW(displayInfo.hMonitor, &monitorInfo);
|
||||
AMF_RETURN_IF_FALSE(ret != 0, AMF_FAIL, L"GetDisplayInfoFromWindow() - GetMonitorInfoW() failed, code=%d", ret);
|
||||
|
||||
// Save the windowed DEVMODE
|
||||
DEVMODEW devMode = {};
|
||||
devMode.dmSize = sizeof(devMode);
|
||||
ret = EnumDisplaySettingsW(monitorInfo.szDevice, ENUM_CURRENT_SETTINGS, &devMode);
|
||||
AMF_RETURN_IF_FALSE(ret != 0, AMF_FAIL, L"GetDisplayInfoFromWindow() - EnumDisplaySettingsW() failed to get Window Mode DEVMODE, code=%d", ret);
|
||||
|
||||
displayInfo.deviceName = monitorInfo.szDevice;
|
||||
displayInfo.primary = (monitorInfo.dwFlags & MONITORINFOF_PRIMARY) == MONITORINFOF_PRIMARY;
|
||||
displayInfo.workRect = AMFConstructRect(monitorInfo.rcWork.left, monitorInfo.rcWork.top, monitorInfo.rcWork.right, monitorInfo.rcWork.bottom);
|
||||
displayInfo.monitorRect = AMFConstructRect(monitorInfo.rcMonitor.left, monitorInfo.rcMonitor.top, monitorInfo.rcMonitor.right, monitorInfo.rcMonitor.bottom);
|
||||
displayInfo.deviceRect = AMFConstructRect(devMode.dmPosition.x, devMode.dmPosition.y, devMode.dmPosition.x + devMode.dmPelsWidth, devMode.dmPosition.y + devMode.dmPelsHeight);
|
||||
displayInfo.frequency = AMFConstructRate(devMode.dmDisplayFrequency, 1);
|
||||
displayInfo.bitsPerPixel = devMode.dmBitsPerPel;
|
||||
|
||||
return AMF_OK;
|
||||
}
|
||||
|
||||
#endif // _WIN32
|
||||
55
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Windows/UtilsWindows.h
vendored
Normal file
55
libs/hwcodec/externals/AMF_v1.4.35/amf/public/common/Windows/UtilsWindows.h
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include "public/include/core/Platform.h"
|
||||
#include "public/include/core/Result.h"
|
||||
#include "../AMFSTL.h"
|
||||
|
||||
amf_bool OSIsVersionOrGreater(DWORD major, DWORD minor, DWORD build);
|
||||
|
||||
struct DisplayInfo
|
||||
{
|
||||
HMONITOR hMonitor;
|
||||
amf_wstring deviceName;
|
||||
amf_bool primary;
|
||||
AMFRect monitorRect;
|
||||
AMFRect workRect;
|
||||
AMFRect deviceRect;
|
||||
AMFRate frequency;
|
||||
amf_uint bitsPerPixel;
|
||||
};
|
||||
|
||||
AMF_RESULT GetDisplayInfo(amf_handle hwnd, DisplayInfo& displayInfo);
|
||||
|
||||
#endif // _WIN32
|
||||
139
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/AMFXInput.h
vendored
Normal file
139
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/AMFXInput.h
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
#ifndef AMF_XInput_h
|
||||
#define AMF_XInput_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../../public/include/core/Interface.h"
|
||||
|
||||
// XInput injection API:
|
||||
// - XBox - like controller emulation
|
||||
// - event injection
|
||||
// - vibration notifications
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFXInput interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
typedef enum AMF_CONTROLLER_TYPE
|
||||
{
|
||||
AMF_CONTROLLER_XBOX360 = 1,
|
||||
} AMF_CONTROLLER_TYPE;
|
||||
|
||||
|
||||
typedef struct AMFXInputCreationDesc
|
||||
{
|
||||
AMF_CONTROLLER_TYPE eType;
|
||||
amf_uint32 reserved[100];
|
||||
} AMFXInputCreationDesc;
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// Constants for gamepad buttons - match Xinput.h
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#define AMF_XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||
#define AMF_XINPUT_GAMEPAD_DPAD_DOWN 0x0002
|
||||
#define AMF_XINPUT_GAMEPAD_DPAD_LEFT 0x0004
|
||||
#define AMF_XINPUT_GAMEPAD_DPAD_RIGHT 0x0008
|
||||
#define AMF_XINPUT_GAMEPAD_START 0x0010
|
||||
#define AMF_XINPUT_GAMEPAD_BACK 0x0020
|
||||
#define AMF_XINPUT_GAMEPAD_LEFT_THUMB 0x0040
|
||||
#define AMF_XINPUT_GAMEPAD_RIGHT_THUMB 0x0080
|
||||
#define AMF_XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100
|
||||
#define AMF_XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200
|
||||
#define AMF_XINPUT_GAMEPAD_A 0x1000
|
||||
#define AMF_XINPUT_GAMEPAD_B 0x2000
|
||||
#define AMF_XINPUT_GAMEPAD_X 0x4000
|
||||
#define AMF_XINPUT_GAMEPAD_Y 0x8000
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef struct AMFXInputState
|
||||
{
|
||||
amf_uint32 uiButtonStates; // bit-wize flags AMF_XINPUT_GAMEPAD_<> - the same as XINPUT_GAMEPAD_<> from Windows SDK XInput.h
|
||||
amf_float fLeftTrigger; // 0.0f , 1.0f
|
||||
amf_float fRightTrigger; // 0.0f , 1.0f
|
||||
amf_float fThumbLX; // -1.0f , 1.0f
|
||||
amf_float fThumbLY; // -1.0f , 1.0f
|
||||
amf_float fThumbRX; // -1.0f , 1.0f
|
||||
amf_float fThumbRY; // -1.0f , 1.0f
|
||||
} AMFXInputState;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef struct AMFXInputHaptic
|
||||
{
|
||||
amf_float fLeftMotor; // 0.0f , 1.0f - motor level
|
||||
amf_float fRightMotor; // 0.0f , 1.0f - motor level
|
||||
} AMFXInputHaptic;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMF_NO_VTABLE AMFXInputCallback
|
||||
{
|
||||
public:
|
||||
virtual void AMF_STD_CALL OnHaptic(amf_int32 id, const AMFXInputHaptic* pHaptic) = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMF_NO_VTABLE AMFXInputController : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xbcaaaf0e, 0x6766, 0x46ac, 0xb1, 0xf1, 0x31, 0x5d, 0xca, 0x71, 0xe3, 0x4d)
|
||||
|
||||
virtual amf_int32 AMF_STD_CALL GetControllerID() const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL SetCallback(AMFXInputCallback *pCallback) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL SetState(const AMFXInputState *pState) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetState(AMFXInputState *pState) const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Terminate() = 0;
|
||||
};
|
||||
typedef amf::AMFInterfacePtr_T<AMFXInputController> AMFXInputControllerPtr;
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
#define AMF_XINPUT_CREATE_CONTROLLER_FUNCTION_NAME "AMFXInputCreateController"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
typedef AMF_RESULT(AMF_CDECL_CALL *AMFXInputCreateController_Fn)(amf_uint64 version, amf::AMFXInputCreationDesc* params, amf::AMFXInputController **ppController);
|
||||
}
|
||||
#else
|
||||
typedef AMF_RESULT(AMF_CDECL_CALL *AMFXInputCreateController_Fn)(amf_uint64 version, AMFXInputCreationDesc* params, AMFXInputController **ppController);
|
||||
#endif
|
||||
|
||||
|
||||
#endif // AMF_XInput_h
|
||||
79
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/Ambisonic2SRenderer.h
vendored
Normal file
79
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/Ambisonic2SRenderer.h
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// interface declaration; Ambisonic to Stereo Renderer
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef AMF_Ambisonic2SRenderer_h
|
||||
#define AMF_Ambisonic2SRenderer_h
|
||||
#pragma once
|
||||
|
||||
#include "public/include/components/Component.h"
|
||||
|
||||
#define AMFAmbisonic2SRendererHW L"AMFAmbisonic2SRenderer"
|
||||
|
||||
enum AMF_AMBISONIC2SRENDERER_MODE_ENUM
|
||||
{
|
||||
AMF_AMBISONIC2SRENDERER_MODE_SIMPLE = 0,
|
||||
AMF_AMBISONIC2SRENDERER_MODE_HRTF_AMD0 = 1,
|
||||
AMF_AMBISONIC2SRENDERER_MODE_HRTF_MIT1 = 2,
|
||||
};
|
||||
|
||||
|
||||
// static properties
|
||||
#define AMF_AMBISONIC2SRENDERER_IN_AUDIO_SAMPLE_RATE L"InSampleRate" // amf_int64 (default = 0)
|
||||
#define AMF_AMBISONIC2SRENDERER_IN_AUDIO_CHANNELS L"InChannels" // amf_int64 (only = 4)
|
||||
#define AMF_AMBISONIC2SRENDERER_IN_AUDIO_SAMPLE_FORMAT L"InSampleFormat" // amf_int64(AMF_AUDIO_FORMAT) (default = AMFAF_FLTP)
|
||||
|
||||
#define AMF_AMBISONIC2SRENDERER_OUT_AUDIO_CHANNELS L"OutChannels" // amf_int64 (only = 2 - stereo)
|
||||
#define AMF_AMBISONIC2SRENDERER_OUT_AUDIO_SAMPLE_FORMAT L"OutSampleFormat" // amf_int64(AMF_AUDIO_FORMAT) (only = AMFAF_FLTP)
|
||||
#define AMF_AMBISONIC2SRENDERER_OUT_AUDIO_CHANNEL_LAYOUT L"OutChannelLayout" // amf_int64 (only = 3 - defalut stereo L R)
|
||||
|
||||
#define AMF_AMBISONIC2SRENDERER_MODE L"StereoMode" //TODO: AMF_AMBISONIC2SRENDERER_MODE_ENUM(default=AMF_AMBISONIC2SRENDERER_MODE_HRTF)
|
||||
|
||||
|
||||
// dynamic properties
|
||||
#define AMF_AMBISONIC2SRENDERER_W L"w" //amf_int64 (default=0)
|
||||
#define AMF_AMBISONIC2SRENDERER_X L"x" //amf_int64 (default=1)
|
||||
#define AMF_AMBISONIC2SRENDERER_Y L"y" //amf_int64 (default=2)
|
||||
#define AMF_AMBISONIC2SRENDERER_Z L"z" //amf_int64 (default=3)
|
||||
|
||||
#define AMF_AMBISONIC2SRENDERER_THETA L"Theta" //double (default=0.0)
|
||||
#define AMF_AMBISONIC2SRENDERER_PHI L"Phi" //double (default=0.0)
|
||||
#define AMF_AMBISONIC2SRENDERER_RHO L"Rho" //double (default=0.0)
|
||||
|
||||
extern "C"
|
||||
{
|
||||
AMF_RESULT AMF_CDECL_CALL AMFCreateComponentAmbisonic(amf::AMFContext* pContext, void* reserved, amf::AMFComponent** ppComponent);
|
||||
}
|
||||
#endif //#ifndef AMF_Ambisonic2SRenderer_h
|
||||
86
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/AudioCapture.h
vendored
Normal file
86
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/AudioCapture.h
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Audio session interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_AudioCapture_h
|
||||
#define AMF_AudioCapture_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Component.h"
|
||||
|
||||
// Set to capture from either a microphone or desktop
|
||||
#define AUDIOCAPTURE_SOURCE L"AudioCaptureSource" // amf_bool true for microphone, false for desktop;
|
||||
|
||||
// In the case of capturing a microphone, the AUDIOCAPTURE_DEVICE_ACTIVE property
|
||||
// can be set to -1 so that the active input devices are looked up. If the initialization
|
||||
// is successful then the AUDIOCAPTURE_DEVICE_NAME and AUDIOCAPTURE_DEVICE_COUNT
|
||||
// properties will be set.
|
||||
#define AUDIOCAPTURE_DEVICE_ACTIVE L"AudioCaptureDeviceActive" // amf_int64
|
||||
#define AUDIOCAPTURE_DEVICE_COUNT L"AudioCaptureDeviceCount" // amf_int64
|
||||
#define AUDIOCAPTURE_DEVICE_NAME L"AudioCaptureDeviceName" // String
|
||||
|
||||
// Codec used for audio capture
|
||||
#define AUDIOCAPTURE_CODEC L"AudioCaptureCodec" // amf_int64, AV_CODEC_ID_PCM_F32LE
|
||||
// Sample rate used for audio capture
|
||||
#define AUDIOCAPTURE_SAMPLERATE L"AudioCaptureSampleRate" // amf_int64, 44100 in samples
|
||||
// Sample count used for audio capture
|
||||
#define AUDIOCAPTURE_SAMPLES L"AudioCaptureSampleCount" // amf_int64, 1024
|
||||
// Bitrate used for audio capture
|
||||
#define AUDIOCAPTURE_BITRATE L"AudioCaptureBitRate" // amf_int64, in bits
|
||||
// Channel count used for audio capture
|
||||
#define AUDIOCAPTURE_CHANNELS L"AudioCaptureChannelCount" // amf_int64, 2
|
||||
// Channel layout used for audio capture
|
||||
#define AUDIOCAPTURE_CHANNEL_LAYOUT L"AudioCaptureChannelLayout" // amf_int64, AMF_AUDIO_CHANNEL_LAYOUT
|
||||
// Format used for audio capture
|
||||
#define AUDIOCAPTURE_FORMAT L"AudioCaptureFormat" // amf_int64, AMFAF_U8
|
||||
// Block alignment
|
||||
#define AUDIOCAPTURE_BLOCKALIGN L"AudioCaptureBlockAlign" // amf_int64, bytes
|
||||
// Audio frame size
|
||||
#define AUDIOCAPTURE_FRAMESIZE L"AudioCaptureFrameSize" // amf_int64, bytes
|
||||
// Audio low latency state
|
||||
#define AUDIOCAPTURE_LOWLATENCY L"AudioCaptureLowLatency" // amf_int64;
|
||||
|
||||
// Optional interface that provides current time
|
||||
#define AUDIOCAPTURE_CURRENT_TIME_INTERFACE L"CurrentTimeInterface" // interface to current time object
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// Component that allows the recording of inputs such as microphones or the audio that is being
|
||||
// rendered. The direction that is captured is controlled by the AUDIOCAPTURE_CAPTURE property
|
||||
//
|
||||
AMF_RESULT AMF_CDECL_CALL AMFCreateComponentAudioCapture(amf::AMFContext* pContext, amf::AMFComponent** ppComponent);
|
||||
}
|
||||
|
||||
#endif // #ifndef AMF_AudioCapture_h
|
||||
198
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/Capture.h
vendored
Normal file
198
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/Capture.h
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Capture interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef __Capture_h__
|
||||
#define __Capture_h__
|
||||
#pragma once
|
||||
|
||||
#include "../../../public/include/components/Component.h"
|
||||
|
||||
typedef enum AMF_CAPTURE_DEVICE_TYPE_ENUM
|
||||
{
|
||||
AMF_CAPTURE_DEVICE_UNKNOWN = 0,
|
||||
AMF_CAPTURE_DEVICE_MEDIAFOUNDATION = 1,
|
||||
AMF_CAPTURE_DEVICE_WASAPI = 2,
|
||||
AMF_CAPTURE_DEVICE_SDI = 3,
|
||||
AMF_CAPTURE_DEVICE_SCREEN_DUPLICATION = 4,
|
||||
} AMF_CAPTURE_DEVICE_TYPE_ENUM;
|
||||
|
||||
// device properties
|
||||
#define AMF_CAPTURE_DEVICE_TYPE L"DeviceType" // amf_int64( AMF_CAPTURE_DEVICE_TYPE_ENUM )
|
||||
#define AMF_CAPTURE_DEVICE_NAME L"DeviceName" // wchar_t* : name of the device
|
||||
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFCaptureDevice interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFCaptureDevice : public AMFComponentEx
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID (0x5bfd1b17, 0x9f2a, 0x43c4, 0x9c, 0xdd, 0x2c, 0x3, 0x88, 0x43, 0xb5, 0xf3)
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL Start() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Stop() = 0;
|
||||
|
||||
// TODO add callback interface for disconnected / lost / changed device notification
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFCaptureDevice> AMFCaptureDevicePtr;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFCaptureDevice, 0x5bfd1b17, 0x9f2a, 0x43c4, 0x9c, 0xdd, 0x2c, 0x3, 0x88, 0x43, 0xb5, 0xf3)
|
||||
|
||||
typedef struct AMFCaptureDeviceVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFCaptureDevice* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFCaptureDevice* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFCaptureDevice* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFCaptureDevice* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFCaptureDevice* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFCaptureDevice* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFCaptureDevice* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFCaptureDevice* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFCaptureDevice* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFCaptureDevice* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFCaptureDevice* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFCaptureDevice* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFCaptureDevice* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFPropertyStorageEx interface
|
||||
|
||||
amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFCaptureDevice* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFCaptureDevice* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFCaptureDevice* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFCaptureDevice* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated);
|
||||
|
||||
// AMFComponent interface
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *Init)(AMFCaptureDevice* pThis, AMF_SURFACE_FORMAT format,amf_int32 width,amf_int32 height);
|
||||
AMF_RESULT (AMF_STD_CALL *ReInit)(AMFCaptureDevice* pThis, amf_int32 width,amf_int32 height);
|
||||
AMF_RESULT (AMF_STD_CALL *Terminate)(AMFCaptureDevice* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *Drain)(AMFCaptureDevice* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *Flush)(AMFCaptureDevice* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *SubmitInput)(AMFCaptureDevice* pThis, AMFData* pData);
|
||||
AMF_RESULT (AMF_STD_CALL *QueryOutput)(AMFCaptureDevice* pThis, AMFData** ppData);
|
||||
AMFContext* (AMF_STD_CALL *GetContext)(AMFCaptureDevice* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *SetOutputDataAllocatorCB)(AMFCaptureDevice* pThis, AMFDataAllocatorCB* callback);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *GetCaps)(AMFCaptureDevice* pThis, AMFCaps** ppCaps);
|
||||
AMF_RESULT (AMF_STD_CALL *Optimize)(AMFCaptureDevice* pThis, AMFComponentOptimizationCallback* pCallback);
|
||||
|
||||
// AMFComponentEx interface
|
||||
|
||||
amf_int32 (AMF_STD_CALL *GetInputCount)(AMFCaptureDevice* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetOutputCount)(AMFCaptureDevice* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *GetInput)(AMFCaptureDevice* pThis, amf_int32 index, AMFInput** ppInput);
|
||||
AMF_RESULT (AMF_STD_CALL *GetOutput)(AMFCaptureDevice* pThis, amf_int32 index, AMFOutput** ppOutput);
|
||||
|
||||
// AMFCaptureDevice interface
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *Start)(AMFCaptureDevice* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *Stop)(AMFCaptureDevice* pThis);
|
||||
|
||||
} AMFCaptureVtbl;
|
||||
|
||||
struct AMFCapture
|
||||
{
|
||||
const AMFCaptureVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFCaptureManager interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFCaptureManager : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID ( 0xf64d2f0d, 0xad16, 0x4ce7, 0x80, 0x5f, 0xa1, 0xe7, 0x3b, 0x0, 0xf4, 0x28)
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL Update() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetDeviceCount() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetDevice(amf_int32 index,AMFCaptureDevice **pDevice) = 0;
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFCaptureManager> AMFCaptureManagerPtr;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFCaptureManager, 0xf64d2f0d, 0xad16, 0x4ce7, 0x80, 0x5f, 0xa1, 0xe7, 0x3b, 0x0, 0xf4, 0x28)
|
||||
|
||||
typedef struct AMFCaptureManagerVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFCaptureManager* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFCaptureManager* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFCaptureManager* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
|
||||
// AMFCaptureManager interface
|
||||
AMF_RESULT (AMF_STD_CALL *Update)((AMFCaptureManager* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetDeviceCount)(AMFCaptureManager* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetDevice)(AMFCaptureManager* pThis, amf_int32 index,AMFCaptureDevice **pDevice);
|
||||
|
||||
} AMFCaptureManagerVtbl;
|
||||
|
||||
struct AMFCaptureManager
|
||||
{
|
||||
const AMFCaptureManagerVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
#if defined(__cplusplus)
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
AMF_RESULT AMF_CDECL_CALL AMFCreateCaptureManager(amf::AMFContext* pContext, amf::AMFCaptureManager** ppManager);
|
||||
}
|
||||
|
||||
#endif // __Capture_h__
|
||||
76
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/ChromaKey.h
vendored
Normal file
76
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/ChromaKey.h
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
/**
|
||||
***************************************************************************************************
|
||||
* @file ChromaKey.h
|
||||
* @brief AMFChromaKey interface declaration
|
||||
***************************************************************************************************
|
||||
*/
|
||||
#ifndef __AMFChromaKey_h__
|
||||
#define __AMFChromaKey_h__
|
||||
#pragma once
|
||||
|
||||
#include "public/include/components/Component.h"
|
||||
|
||||
#define AMFChromaKey L"AMFChromaKey"
|
||||
|
||||
// static properties
|
||||
#define AMF_CHROMAKEY_COLOR L"ChromaKeyColor" // amf_uint64 (default=0x992A1E), YUV Green key Color
|
||||
#define AMF_CHROMAKEY_COLOR_EX L"ChromaKeyColorEX" // amf_uint64 (default=0), YUV Green key Color, secondary
|
||||
#define AMF_CHROMAKEY_RANGE_MIN L"ChromaKeyRangeMin" // amf_uint64 (default=20) color tolerance low, 0~255
|
||||
#define AMF_CHROMAKEY_RANGE_MAX L"ChromaKeyRangeMax" // amf_uint64 (default=22) color tolerance high, 0~255
|
||||
#define AMF_CHROMAKEY_RANGE_EXT L"ChromaKeyRangeExt" // amf_uint64 (default=40) color tolerance extended, 0~255
|
||||
#define AMF_CHROMAKEY_SPILL_MODE L"ChromaKeySpillMode" // amf_uint64 (default=0) spill suppression mode
|
||||
#define AMF_CHROMAKEY_RANGE_SPILL L"ChromaKeyRangeSpill" // amf_uint64 (default=5) spill suppression threshold
|
||||
#define AMF_CHROMAKEY_LUMA_LOW L"ChromaKeyLumaLow" // amf_uint64 (default=16) minimum luma value for processing
|
||||
#define AMF_CHROMAKEY_INPUT_COUNT L"InputCount" // amf_uint64 (default=2) number of inputs
|
||||
#define AMF_CHROMAKEY_COLOR_POS L"KeyColorPos" // amf_uint64 (default=0) key color position from the surface
|
||||
#define AMF_CHROMAKEY_OUT_FORMAT L"ChromaKeyOutFormat" // amf_uint64 (default=RGBA) output format
|
||||
#define AMF_CHROMAKEY_MEMORY_TYPE L"ChromaKeyMemoryType" // amf_uint64 (default=DX11) mmeory type
|
||||
#define AMF_CHROMAKEY_COLOR_ADJ L"ChromaKeyColorAdj" // amf_uint64 (default=0) endble color adjustment
|
||||
#define AMF_CHROMAKEY_COLOR_ADJ_THRE L"ChromaKeyColorAdjThre" // amf_uint64 (default=0) color adjustment threshold
|
||||
#define AMF_CHROMAKEY_COLOR_ADJ_THRE2 L"ChromaKeyColorAdjThre2" // amf_uint64 (default=0) color adjustment threshold
|
||||
#define AMF_CHROMAKEY_BYPASS L"ChromaKeyBypass" // amf_uint64 (default=0) disable chromakey
|
||||
#define AMF_CHROMAKEY_EDGE L"ChromaKeyEdge" // amf_uint64 (default=0) endble edge detection
|
||||
#define AMF_CHROMAKEY_BOKEH L"ChromaKeyBokeh" // amf_uint64 (default=0) endble background bokeh
|
||||
#define AMF_CHROMAKEY_BOKEH_RADIUS L"ChromaKeyBokehRadius" // amf_uint64 (default=7) background bokeh radius
|
||||
#define AMF_CHROMAKEY_DEBUG L"ChromaKeyDebug" // amf_uint64 (default=0) endble debug mode
|
||||
|
||||
#define AMF_CHROMAKEY_POSX L"ChromaKeyPosX" // amf_uint64 (default=0) positionX
|
||||
#define AMF_CHROMAKEY_POSY L"ChromaKeyPosY" // amf_uint64 (default=0) positionY
|
||||
|
||||
extern "C"
|
||||
{
|
||||
AMF_RESULT AMF_CDECL_CALL AMFCreateComponentChromaKey(amf::AMFContext* pContext, amf::AMFComponentEx** ppComponent);
|
||||
}
|
||||
#endif //#ifndef __AMFChromaKey_h__
|
||||
140
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/ColorSpace.h
vendored
Normal file
140
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/ColorSpace.h
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Color Spacedeclaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_ColorSpace_h
|
||||
#define AMF_ColorSpace_h
|
||||
#pragma once
|
||||
|
||||
#include "../core/Platform.h"
|
||||
|
||||
// YUV <--> RGB conversion matrix with range
|
||||
typedef enum AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM
|
||||
{
|
||||
AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN =-1,
|
||||
AMF_VIDEO_CONVERTER_COLOR_PROFILE_601 = 0, // studio range
|
||||
AMF_VIDEO_CONVERTER_COLOR_PROFILE_709 = 1, // studio range
|
||||
AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020 = 2, // studio range
|
||||
AMF_VIDEO_CONVERTER_COLOR_PROFILE_JPEG = 3, // full range 601
|
||||
// AMF_VIDEO_CONVERTER_COLOR_PROFILE_G22_BT709 = AMF_VIDEO_CONVERTER_COLOR_PROFILE_709,
|
||||
// AMF_VIDEO_CONVERTER_COLOR_PROFILE_G10_SCRGB = 4,
|
||||
// AMF_VIDEO_CONVERTER_COLOR_PROFILE_G10_BT709 = 5,
|
||||
// AMF_VIDEO_CONVERTER_COLOR_PROFILE_G10_BT2020 = AMF_VIDEO_CONVERTER_COLOR_PROFILE_2020,
|
||||
// AMF_VIDEO_CONVERTER_COLOR_PROFILE_G2084_BT2020 = 6,
|
||||
AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_601 = AMF_VIDEO_CONVERTER_COLOR_PROFILE_JPEG, // full range
|
||||
AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_709 = 7, // full range
|
||||
AMF_VIDEO_CONVERTER_COLOR_PROFILE_FULL_2020 = 8, // full range
|
||||
AMF_VIDEO_CONVERTER_COLOR_PROFILE_COUNT
|
||||
} AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM;
|
||||
|
||||
typedef enum AMF_COLOR_PRIMARIES_ENUM // as in VUI color_primaries AVC and HEVC
|
||||
{
|
||||
AMF_COLOR_PRIMARIES_UNDEFINED = 0,
|
||||
AMF_COLOR_PRIMARIES_BT709 = 1,
|
||||
AMF_COLOR_PRIMARIES_UNSPECIFIED = 2,
|
||||
AMF_COLOR_PRIMARIES_RESERVED = 3,
|
||||
AMF_COLOR_PRIMARIES_BT470M = 4,
|
||||
AMF_COLOR_PRIMARIES_BT470BG = 5,
|
||||
AMF_COLOR_PRIMARIES_SMPTE170M = 6,
|
||||
AMF_COLOR_PRIMARIES_SMPTE240M = 7,
|
||||
AMF_COLOR_PRIMARIES_FILM = 8,
|
||||
AMF_COLOR_PRIMARIES_BT2020 = 9,
|
||||
AMF_COLOR_PRIMARIES_SMPTE428 = 10,
|
||||
AMF_COLOR_PRIMARIES_SMPTE431 = 11,
|
||||
AMF_COLOR_PRIMARIES_SMPTE432 = 12,
|
||||
AMF_COLOR_PRIMARIES_JEDEC_P22 = 22,
|
||||
AMF_COLOR_PRIMARIES_CCCS = 1000, // Common Composition Color Space or scRGB
|
||||
} AMF_COLOR_PRIMARIES_ENUM;
|
||||
|
||||
typedef enum AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM // as in VUI transfer_characteristic AVC and HEVC
|
||||
{
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED = 0,
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_BT709 = 1, //BT709
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_UNSPECIFIED = 2,
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_RESERVED = 3,
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA22 = 4, //BT470_M
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_GAMMA28 = 5, //BT470
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE170M = 6, //BT601
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE240M = 7, //SMPTE 240M
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_LINEAR = 8,
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG = 9, //LOG10
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_LOG_SQRT = 10,//LOG10 SQRT
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_4 = 11,
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_BT1361_ECG = 12,
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_IEC61966_2_1 = 13,
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_10 = 14, //BT709
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_BT2020_12 = 15, //BT709
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE2084 = 16, //PQ
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_SMPTE428 = 17,
|
||||
AMF_COLOR_TRANSFER_CHARACTERISTIC_ARIB_STD_B67 = 18, //HLG
|
||||
} AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM;
|
||||
|
||||
typedef enum AMF_COLOR_BIT_DEPTH_ENUM
|
||||
{
|
||||
AMF_COLOR_BIT_DEPTH_UNDEFINED = 0,
|
||||
AMF_COLOR_BIT_DEPTH_8 = 8,
|
||||
AMF_COLOR_BIT_DEPTH_10 = 10,
|
||||
} AMF_COLOR_BIT_DEPTH_ENUM;
|
||||
|
||||
typedef struct AMFHDRMetadata
|
||||
{
|
||||
amf_uint16 redPrimary[2]; // normalized to 50000
|
||||
amf_uint16 greenPrimary[2]; // normalized to 50000
|
||||
amf_uint16 bluePrimary[2]; // normalized to 50000
|
||||
amf_uint16 whitePoint[2]; // normalized to 50000
|
||||
amf_uint32 maxMasteringLuminance; // normalized to 10000
|
||||
amf_uint32 minMasteringLuminance; // normalized to 10000
|
||||
amf_uint16 maxContentLightLevel; // nit value
|
||||
amf_uint16 maxFrameAverageLightLevel; // nit value
|
||||
} AMFHDRMetadata;
|
||||
|
||||
|
||||
typedef enum AMF_COLOR_RANGE_ENUM
|
||||
{
|
||||
AMF_COLOR_RANGE_UNDEFINED = 0,
|
||||
AMF_COLOR_RANGE_STUDIO = 1,
|
||||
AMF_COLOR_RANGE_FULL = 2,
|
||||
} AMF_COLOR_RANGE_ENUM;
|
||||
|
||||
|
||||
// these properties can be set on input or outout surface
|
||||
// IDs are the same as in decoder properties
|
||||
// can be used to dynamically pass color data between components:
|
||||
// Decoder, Capture, Encoder. Presenter etc.
|
||||
#define AMF_VIDEO_COLOR_TRANSFER_CHARACTERISTIC L"ColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 Section 7.2 See ColorSpace.h for enum
|
||||
#define AMF_VIDEO_COLOR_PRIMARIES L"ColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 Section 7.1 See ColorSpace.h for enum
|
||||
#define AMF_VIDEO_COLOR_RANGE L"ColorRange" // amf_int64(AMF_COLOR_RANGE_ENUM) default = AMF_COLOR_RANGE_UNDEFINED
|
||||
#define AMF_VIDEO_COLOR_HDR_METADATA L"HdrMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL
|
||||
|
||||
#endif //#ifndef AMF_ColorSpace_h
|
||||
444
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/Component.h
vendored
Normal file
444
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/Component.h
vendored
Normal file
@@ -0,0 +1,444 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
/**
|
||||
***************************************************************************************************
|
||||
* @file Component.h
|
||||
* @brief AMFComponent interface declaration
|
||||
***************************************************************************************************
|
||||
*/
|
||||
#ifndef AMF_Component_h
|
||||
#define AMF_Component_h
|
||||
#pragma once
|
||||
|
||||
#include "../core/Data.h"
|
||||
#include "../core/PropertyStorageEx.h"
|
||||
#include "../core/Surface.h"
|
||||
#include "../core/Context.h"
|
||||
#include "ComponentCaps.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFDataAllocatorCB interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFDataAllocatorCB : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x4bf46198, 0x8b7b, 0x49d0, 0xaa, 0x72, 0x48, 0xd4, 0x7, 0xce, 0x24, 0xc5 )
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL AllocBuffer(AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL AllocSurface(AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format,
|
||||
amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, AMFSurface** ppSurface) = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFDataAllocatorCB> AMFDataAllocatorCBPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFDataAllocatorCB, 0x4bf46198, 0x8b7b, 0x49d0, 0xaa, 0x72, 0x48, 0xd4, 0x7, 0xce, 0x24, 0xc5 )
|
||||
typedef struct AMFDataAllocatorCB AMFDataAllocatorCB;
|
||||
|
||||
typedef struct AMFDataAllocatorCBVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFDataAllocatorCB* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFDataAllocatorCB* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFDataAllocatorCB* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
// AMFDataAllocatorCB interface
|
||||
AMF_RESULT (AMF_STD_CALL *AllocBuffer)(AMFDataAllocatorCB* pThis, AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer);
|
||||
AMF_RESULT (AMF_STD_CALL *AllocSurface)(AMFDataAllocatorCB* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format,
|
||||
amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, AMFSurface** ppSurface);
|
||||
} AMFDataAllocatorCBVtbl;
|
||||
|
||||
struct AMFDataAllocatorCB
|
||||
{
|
||||
const AMFDataAllocatorCBVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFComponentOptimizationCallback
|
||||
{
|
||||
public:
|
||||
virtual AMF_RESULT AMF_STD_CALL OnComponentOptimizationProgress(amf_uint percent) = 0;
|
||||
};
|
||||
#else // #if defined(__cplusplus)
|
||||
typedef struct AMFComponentOptimizationCallback AMFComponentOptimizationCallback;
|
||||
typedef struct AMFComponentOptimizationCallbackVtbl
|
||||
{
|
||||
// AMFDataAllocatorCB interface
|
||||
AMF_RESULT (AMF_STD_CALL *OnComponentOptimizationProgress)(AMFComponentOptimizationCallback* pThis, amf_uint percent);
|
||||
} AMFComponentOptimizationCallbackVtbl;
|
||||
|
||||
struct AMFComponentOptimizationCallback
|
||||
{
|
||||
const AMFComponentOptimizationCallbackVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif //#if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFComponent interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFComponent : public AMFPropertyStorageEx
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x8b51e5e4, 0x455d, 0x4034, 0xa7, 0x46, 0xde, 0x1b, 0xed, 0xc3, 0xc4, 0x6)
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL Init(AMF_SURFACE_FORMAT format,amf_int32 width,amf_int32 height) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL ReInit(amf_int32 width,amf_int32 height) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Terminate() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Drain() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Flush() = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL SubmitInput(AMFData* pData) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL QueryOutput(AMFData** ppData) = 0;
|
||||
virtual AMFContext* AMF_STD_CALL GetContext() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL SetOutputDataAllocatorCB(AMFDataAllocatorCB* callback) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL GetCaps(AMFCaps** ppCaps) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Optimize(AMFComponentOptimizationCallback* pCallback) = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFComponent> AMFComponentPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFComponent, 0x8b51e5e4, 0x455d, 0x4034, 0xa7, 0x46, 0xde, 0x1b, 0xed, 0xc3, 0xc4, 0x6)
|
||||
typedef struct AMFComponent AMFComponent;
|
||||
|
||||
typedef struct AMFComponentVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFComponent* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFComponent* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComponent* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFComponent* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFComponent* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFComponent* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFComponent* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFComponent* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFComponent* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFComponent* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFComponent* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFComponent* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFComponent* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFPropertyStorageEx interface
|
||||
|
||||
amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFComponent* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFComponent* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFComponent* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFComponent* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated);
|
||||
|
||||
// AMFComponent interface
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *Init)(AMFComponent* pThis, AMF_SURFACE_FORMAT format,amf_int32 width,amf_int32 height);
|
||||
AMF_RESULT (AMF_STD_CALL *ReInit)(AMFComponent* pThis, amf_int32 width,amf_int32 height);
|
||||
AMF_RESULT (AMF_STD_CALL *Terminate)(AMFComponent* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *Drain)(AMFComponent* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *Flush)(AMFComponent* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *SubmitInput)(AMFComponent* pThis, AMFData* pData);
|
||||
AMF_RESULT (AMF_STD_CALL *QueryOutput)(AMFComponent* pThis, AMFData** ppData);
|
||||
AMFContext* (AMF_STD_CALL *GetContext)(AMFComponent* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *SetOutputDataAllocatorCB)(AMFComponent* pThis, AMFDataAllocatorCB* callback);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *GetCaps)(AMFComponent* pThis, AMFCaps** ppCaps);
|
||||
AMF_RESULT (AMF_STD_CALL *Optimize)(AMFComponent* pThis, AMFComponentOptimizationCallback* pCallback);
|
||||
} AMFComponentVtbl;
|
||||
|
||||
struct AMFComponent
|
||||
{
|
||||
const AMFComponentVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFInput interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFInput : public AMFPropertyStorageEx
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x1181eee7, 0x95f2, 0x434a, 0x9b, 0x96, 0xea, 0x55, 0xa, 0xa7, 0x84, 0x89)
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL SubmitInput(AMFData* pData) = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFInput> AMFInputPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFInput, 0x1181eee7, 0x95f2, 0x434a, 0x9b, 0x96, 0xea, 0x55, 0xa, 0xa7, 0x84, 0x89)
|
||||
typedef struct AMFInput AMFInput;
|
||||
|
||||
typedef struct AMFInputVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFInput* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFInput* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFInput* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFInput* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFInput* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFInput* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFInput* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFInput* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFInput* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFInput* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFInput* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFInput* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFInput* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFPropertyStorageEx interface
|
||||
|
||||
amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFInput* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFInput* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFInput* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFInput* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated);
|
||||
|
||||
// AMFInput interface
|
||||
AMF_RESULT (AMF_STD_CALL *SubmitInput)(AMFInput* pThis, AMFData* pData);
|
||||
|
||||
} AMFInputVtbl;
|
||||
|
||||
struct AMFInput
|
||||
{
|
||||
const AMFInputVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFOutput interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFOutput : public AMFPropertyStorageEx
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x86a8a037, 0x912c, 0x4698, 0xb0, 0x46, 0x7, 0x5a, 0x1f, 0xac, 0x6b, 0x97)
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL QueryOutput(AMFData** ppData) = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFOutput> AMFOutputPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFOutput, 0x86a8a037, 0x912c, 0x4698, 0xb0, 0x46, 0x7, 0x5a, 0x1f, 0xac, 0x6b, 0x97)
|
||||
typedef struct AMFOutput AMFOutput;
|
||||
|
||||
typedef struct AMFOutputVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFOutput* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFOutput* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFOutput* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFOutput* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFOutput* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFOutput* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFOutput* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFOutput* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFOutput* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFOutput* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFOutput* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFOutput* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFOutput* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFPropertyStorageEx interface
|
||||
|
||||
amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFOutput* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFOutput* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFOutput* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFOutput* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated);
|
||||
|
||||
// AMFOutput interface
|
||||
AMF_RESULT (AMF_STD_CALL *QueryOutput)(AMFOutput* pThis, AMFData** ppData);
|
||||
|
||||
} AMFOutputVtbl;
|
||||
|
||||
struct AMFOutput
|
||||
{
|
||||
const AMFOutputVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFComponent interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFComponentEx : public AMFComponent
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xfda792af, 0x8712, 0x44df, 0x8e, 0xa0, 0xdf, 0xfa, 0xad, 0x2c, 0x80, 0x93)
|
||||
|
||||
virtual amf_int32 AMF_STD_CALL GetInputCount() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetOutputCount() = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL GetInput(amf_int32 index, AMFInput** ppInput) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetOutput(amf_int32 index, AMFOutput** ppOutput) = 0;
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFComponentEx> AMFComponentExPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFComponentEx, 0xfda792af, 0x8712, 0x44df, 0x8e, 0xa0, 0xdf, 0xfa, 0xad, 0x2c, 0x80, 0x93)
|
||||
typedef struct AMFComponentEx AMFComponentEx;
|
||||
|
||||
typedef struct AMFComponentExVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFComponentEx* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFComponentEx* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComponentEx* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFComponentEx* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFComponentEx* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFComponentEx* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFComponentEx* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFComponentEx* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFComponentEx* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFComponentEx* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFComponentEx* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFComponentEx* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFComponentEx* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFPropertyStorageEx interface
|
||||
|
||||
amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFComponentEx* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFComponentEx* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFComponentEx* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFComponentEx* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated);
|
||||
|
||||
// AMFComponent interface
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *Init)(AMFComponentEx* pThis, AMF_SURFACE_FORMAT format,amf_int32 width,amf_int32 height);
|
||||
AMF_RESULT (AMF_STD_CALL *ReInit)(AMFComponentEx* pThis, amf_int32 width,amf_int32 height);
|
||||
AMF_RESULT (AMF_STD_CALL *Terminate)(AMFComponentEx* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *Drain)(AMFComponentEx* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *Flush)(AMFComponentEx* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *SubmitInput)(AMFComponentEx* pThis, AMFData* pData);
|
||||
AMF_RESULT (AMF_STD_CALL *QueryOutput)(AMFComponentEx* pThis, AMFData** ppData);
|
||||
AMFContext* (AMF_STD_CALL *GetContext)(AMFComponentEx* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *SetOutputDataAllocatorCB)(AMFComponentEx* pThis, AMFDataAllocatorCB* callback);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *GetCaps)(AMFComponentEx* pThis, AMFCaps** ppCaps);
|
||||
AMF_RESULT (AMF_STD_CALL *Optimize)(AMFComponentEx* pThis, AMFComponentOptimizationCallback* pCallback);
|
||||
|
||||
// AMFComponentEx interface
|
||||
|
||||
amf_int32 (AMF_STD_CALL *GetInputCount)(AMFComponentEx* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetOutputCount)(AMFComponentEx* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *GetInput)(AMFComponentEx* pThis, amf_int32 index, AMFInput** ppInput);
|
||||
AMF_RESULT (AMF_STD_CALL *GetOutput)(AMFComponentEx* pThis, amf_int32 index, AMFOutput** ppOutput);
|
||||
|
||||
|
||||
} AMFComponentExVtbl;
|
||||
|
||||
struct AMFComponentEx
|
||||
{
|
||||
const AMFComponentExVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
typedef enum AMF_STREAM_TYPE_ENUM
|
||||
{
|
||||
AMF_STREAM_UNKNOWN = 0,
|
||||
AMF_STREAM_VIDEO = 1,
|
||||
AMF_STREAM_AUDIO = 2,
|
||||
AMF_STREAM_DATA = 3,
|
||||
} AMF_STREAM_TYPE_ENUM;
|
||||
|
||||
typedef enum AMF_STREAM_CODEC_ID_ENUM // matched codecs from VideoDecoxcderUVD.h
|
||||
{
|
||||
AMF_STREAM_CODEC_ID_UNKNOWN = 0,
|
||||
AMF_STREAM_CODEC_ID_MPEG2 = 1, // AMFVideoDecoderUVD_MPEG2
|
||||
AMF_STREAM_CODEC_ID_MPEG4 = 2, // AMFVideoDecoderUVD_MPEG4
|
||||
AMF_STREAM_CODEC_ID_WMV3 = 3, // AMFVideoDecoderUVD_WMV3
|
||||
AMF_STREAM_CODEC_ID_VC1 = 4, // AMFVideoDecoderUVD_VC1
|
||||
AMF_STREAM_CODEC_ID_H264_AVC = 5, // AMFVideoDecoderUVD_H264_AVC
|
||||
AMF_STREAM_CODEC_ID_H264_MVC = 6, // AMFVideoDecoderUVD_H264_MVC
|
||||
AMF_STREAM_CODEC_ID_H264_SVC = 7, // AMFVideoDecoderUVD_H264_SVC
|
||||
AMF_STREAM_CODEC_ID_MJPEG = 8, // AMFVideoDecoderUVD_MJPEG
|
||||
AMF_STREAM_CODEC_ID_H265_HEVC = 9, // AMFVideoDecoderHW_H265_HEVC
|
||||
AMF_STREAM_CODEC_ID_H265_MAIN10 = 10, // AMFVideoDecoderHW_H265_MAIN10
|
||||
AMF_STREAM_CODEC_ID_VP9 = 11, // AMFVideoDecoderHW_VP9
|
||||
AMF_STREAM_CODEC_ID_VP9_10BIT = 12, // AMFVideoDecoderHW_VP9_10BIT
|
||||
AMF_STREAM_CODEC_ID_AV1 = 13, // AMFVideoDecoderHW_AV1
|
||||
AMF_STREAM_CODEC_ID_AV1_12BIT = 14, // AMFVideoDecoderHW_AV1_12BIT
|
||||
} AMF_STREAM_CODEC_ID_ENUM;
|
||||
|
||||
// common stream properties
|
||||
#define AMF_STREAM_TYPE L"StreamType" // amf_int64( AMF_STREAM_TYPE_ENUM )
|
||||
#define AMF_STREAM_ENABLED L"Enabled" // bool( default = false )
|
||||
#define AMF_STREAM_CODEC_ID L"CodecID" // amf_int64(Video: AMF_STREAM_CODEC_ID_ENUM, Audio: AVCodecID) (default = 0 - uncompressed)
|
||||
#define AMF_STREAM_BIT_RATE L"BitRate" // amf_int64 (default = codec->bit_rate)
|
||||
#define AMF_STREAM_EXTRA_DATA L"ExtraData" // interface to AMFBuffer - as is from FFMPEG
|
||||
|
||||
// video stream properties
|
||||
#define AMF_STREAM_VIDEO_MEMORY_TYPE L"VideoMemoryType" // amf_int64(AMF_MEMORY_TYPE); default = AMF_MEMORY_DX11
|
||||
#define AMF_STREAM_VIDEO_FORMAT L"VideoFormat" // amf_int64(AMF_SURFACE_FORMAT); default = AMF_SURFACE_NV12 (used if AMF_STREAM_CODEC_ID == 0)
|
||||
#define AMF_STREAM_VIDEO_FRAME_RATE L"VideoFrameRate" // AMFRate; default = (30,1) - video frame rate
|
||||
#define AMF_STREAM_VIDEO_FRAME_SIZE L"VideoFrameSize" // AMFSize; default = (1920,1080) - video frame rate
|
||||
#define AMF_STREAM_VIDEO_SURFACE_POOL L"VideoSurfacePool" // amf_int64; default = 5, number of allocated output surfaces
|
||||
//TODO support interlaced frames
|
||||
|
||||
// audio stream properties
|
||||
#define AMF_STREAM_AUDIO_FORMAT L"AudioFormat" // amf_int64(AMF_AUDIO_FORMAT); default = AMFAF_S16
|
||||
#define AMF_STREAM_AUDIO_SAMPLE_RATE L"AudioSampleRate" // amf_int64; default = 48000
|
||||
#define AMF_STREAM_AUDIO_CHANNELS L"AudioChannels" // amf_int64; default = 2
|
||||
#define AMF_STREAM_AUDIO_CHANNEL_LAYOUT L"AudioChannelLayout" // amf_int64 (default = codec->channel_layout)
|
||||
#define AMF_STREAM_AUDIO_BLOCK_ALIGN L"AudioBlockAlign" // amf_int64 (default = codec->block_align)
|
||||
#define AMF_STREAM_AUDIO_FRAME_SIZE L"AudioFrameSize" // amf_int64 (default = codec->frame_size)
|
||||
|
||||
|
||||
#endif //#ifndef AMF_Component_h
|
||||
172
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/ComponentCaps.h
vendored
Normal file
172
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/ComponentCaps.h
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_ComponentCaps_h
|
||||
#define AMF_ComponentCaps_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../core/Interface.h"
|
||||
#include "../core/PropertyStorage.h"
|
||||
#include "../core/Surface.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
typedef enum AMF_ACCELERATION_TYPE
|
||||
{
|
||||
AMF_ACCEL_NOT_SUPPORTED = -1,
|
||||
AMF_ACCEL_HARDWARE,
|
||||
AMF_ACCEL_GPU,
|
||||
AMF_ACCEL_SOFTWARE
|
||||
} AMF_ACCELERATION_TYPE;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFIOCaps interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFIOCaps : public AMFInterface
|
||||
{
|
||||
public:
|
||||
// Get supported resolution ranges in pixels/lines:
|
||||
virtual void AMF_STD_CALL GetWidthRange(amf_int32* minWidth, amf_int32* maxWidth) const = 0;
|
||||
virtual void AMF_STD_CALL GetHeightRange(amf_int32* minHeight, amf_int32* maxHeight) const = 0;
|
||||
|
||||
// Get memory alignment in lines: Vertical aligmnent should be multiples of this number
|
||||
virtual amf_int32 AMF_STD_CALL GetVertAlign() const = 0;
|
||||
|
||||
// Enumerate supported surface pixel formats
|
||||
virtual amf_int32 AMF_STD_CALL GetNumOfFormats() const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetFormatAt(amf_int32 index, AMF_SURFACE_FORMAT* format, amf_bool* native) const = 0;
|
||||
|
||||
// Enumerate supported memory types
|
||||
virtual amf_int32 AMF_STD_CALL GetNumOfMemoryTypes() const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetMemoryTypeAt(amf_int32 index, AMF_MEMORY_TYPE* memType, amf_bool* native) const = 0;
|
||||
|
||||
virtual amf_bool AMF_STD_CALL IsInterlacedSupported() const = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFIOCaps> AMFIOCapsPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
typedef struct AMFIOCaps AMFIOCaps;
|
||||
|
||||
typedef struct AMFIOCapsVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFIOCaps* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFIOCaps* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFIOCaps* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFIOCaps interface
|
||||
// Get supported resolution ranges in pixels/lines:
|
||||
void (AMF_STD_CALL *GetWidthRange)(AMFIOCaps* pThis, amf_int32* minWidth, amf_int32* maxWidth);
|
||||
void (AMF_STD_CALL *GetHeightRange)(AMFIOCaps* pThis, amf_int32* minHeight, amf_int32* maxHeight);
|
||||
|
||||
// Get memory alignment in lines: Vertical aligmnent should be multiples of this number
|
||||
amf_int32 (AMF_STD_CALL *GetVertAlign)(AMFIOCaps* pThis);
|
||||
|
||||
// Enumerate supported surface pixel formats
|
||||
amf_int32 (AMF_STD_CALL *GetNumOfFormats)(AMFIOCaps* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetFormatAt)(AMFIOCaps* pThis, amf_int32 index, AMF_SURFACE_FORMAT* format, amf_bool* native);
|
||||
|
||||
// Enumerate supported memory types
|
||||
amf_int32 (AMF_STD_CALL *GetNumOfMemoryTypes)(AMFIOCaps* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetMemoryTypeAt)(AMFIOCaps* pThis, amf_int32 index, AMF_MEMORY_TYPE* memType, amf_bool* native);
|
||||
|
||||
amf_bool (AMF_STD_CALL *IsInterlacedSupported)(AMFIOCaps* pThis);
|
||||
} AMFIOCapsVtbl;
|
||||
|
||||
struct AMFIOCaps
|
||||
{
|
||||
const AMFIOCapsVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFCaps interface - base interface for every h/w module supported by Capability Manager
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFCaps : public AMFPropertyStorage
|
||||
{
|
||||
public:
|
||||
virtual AMF_ACCELERATION_TYPE AMF_STD_CALL GetAccelerationType() const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetInputCaps(AMFIOCaps** input) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetOutputCaps(AMFIOCaps** output) = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFCaps> AMFCapsPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
typedef struct AMFCaps AMFCaps;
|
||||
|
||||
typedef struct AMFCapsVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFCaps* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFCaps* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFCaps* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFCaps* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFCaps* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFCaps* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFCaps* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFCaps* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFCaps* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFCaps* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFCaps* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFCaps* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFCaps* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFCaps interface
|
||||
|
||||
AMF_ACCELERATION_TYPE (AMF_STD_CALL *GetAccelerationType)(AMFCaps* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetInputCaps)(AMFCaps* pThis, AMFIOCaps** input);
|
||||
AMF_RESULT (AMF_STD_CALL *GetOutputCaps)(AMFCaps* pThis, AMFIOCaps** output);
|
||||
} AMFCapsVtbl;
|
||||
|
||||
struct AMFCaps
|
||||
{
|
||||
const AMFCapsVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //#ifndef AMF_ComponentCaps_h
|
||||
54
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/CursorCapture.h
vendored
Normal file
54
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/CursorCapture.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Cursor capture interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef AMF_CursorCapture_h
|
||||
#define AMF_CursorCapture_h
|
||||
#pragma once
|
||||
|
||||
namespace amf
|
||||
{
|
||||
class AMFCursorCapture : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x166efa1a, 0x19b8, 0x42f2, 0x86, 0x0f, 0x56, 0x69, 0xca, 0x7a, 0x85, 0x4c)
|
||||
virtual AMF_RESULT AMF_STD_CALL AcquireCursor(amf::AMFSurface** pSurface) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Reset() = 0;
|
||||
};
|
||||
|
||||
typedef AMFInterfacePtr_T<AMFCursorCapture> AMFCursorCapturePtr;
|
||||
}
|
||||
|
||||
#endif // #ifndef AMF_CursorCapture_h
|
||||
83
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/DisplayCapture.h
vendored
Normal file
83
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/DisplayCapture.h
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// Desktop duplication interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef AMF_DisplayCapture_h
|
||||
#define AMF_DisplayCapture_h
|
||||
#pragma once
|
||||
|
||||
#include "Component.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// To create capture component with Desktop Duplication API use this function
|
||||
AMF_RESULT AMF_CDECL_CALL AMFCreateComponentDisplayCapture(amf::AMFContext* pContext, void* reserved, amf::AMFComponent** ppComponent);
|
||||
}
|
||||
|
||||
// To create AMD Direct Capture component use this component ID with AMFFactory::CreateComponent()
|
||||
#define AMFDisplayCapture L"AMFDisplayCapture"
|
||||
|
||||
// Static properties
|
||||
//
|
||||
typedef enum AMF_DISPLAYCAPTURE_MODE_ENUM
|
||||
{
|
||||
AMF_DISPLAYCAPTURE_MODE_KEEP_FRAMERATE = 0, // capture component maintains the frame rate and returns current visible surface
|
||||
AMF_DISPLAYCAPTURE_MODE_WAIT_FOR_PRESENT = 1, // capture component waits for flip (present) event
|
||||
AMF_DISPLAYCAPTURE_MODE_GET_CURRENT_SURFACE = 2, // returns current visible surface immediately
|
||||
} AMF_DISPLAYCAPTURE_MODE_ENUM;
|
||||
|
||||
|
||||
#define AMF_DISPLAYCAPTURE_MONITOR_INDEX L"MonitorIndex" // amf_int64, default = 0, Index of the display monitor; is determined by using EnumAdapters() in DXGI.
|
||||
#define AMF_DISPLAYCAPTURE_MODE L"CaptureMode" // amf_int64(AMF_DISPLAYCAPTURE_MODE_ENUM), default = AMF_DISPLAYCAPTURE_MODE_FRAMERATE, controls wait logic
|
||||
#define AMF_DISPLAYCAPTURE_FRAMERATE L"FrameRate" // AMFRate, default = (0, 1) Capture framerate, if 0 - capture rate will be driven by flip event from fullscreen app or DWM
|
||||
#define AMF_DISPLAYCAPTURE_CURRENT_TIME_INTERFACE L"CurrentTimeInterface" // AMFInterface(AMFCurrentTime) Optional interface object for providing timestamps.
|
||||
#define AMF_DISPLAYCAPTURE_FORMAT L"CurrentFormat" // amf_int64(AMF_SURFACE_FORMAT) Capture format - read-only
|
||||
#define AMF_DISPLAYCAPTURE_RESOLUTION L"Resolution" // AMFSize - screen resolution - read-only
|
||||
#define AMF_DISPLAYCAPTURE_DUPLICATEOUTPUT L"DuplicateOutput" // amf_bool, default = false, output AMF surface is a copy of captured
|
||||
#define AMF_DISPLAYCAPTURE_DESKTOP_RECT L"DesktopRect" // AMFRect - rect of the capture desktop - read-only
|
||||
#define AMF_DISPLAYCAPTURE_ENABLE_DIRTY_RECTS L"EnableDirtyRects" // amf_bool, default = false, enable dirty rectangles attached to output as AMF_DISPLAYCAPTURE_DIRTY_RECTS
|
||||
#define AMF_DISPLAYCAPTURE_DRAW_DIRTY_RECTS L"DrawDirtyRects" // amf_bool, default = false, copies capture output and draws dirty rectangles with red - for debugging only
|
||||
#define AMF_DISPLAYCAPTURE_ROTATION L"Rotation" // amf_int64(AMF_ROTATION_ENUM); default = AMF_ROTATION_NONE, monitor rotation state
|
||||
|
||||
// Properties that can be set on output AMFSurface
|
||||
#define AMF_DISPLAYCAPTURE_DIRTY_RECTS L"DirtyRects" // AMFInterface*(AMFBuffer*) - array of AMFRect(s)
|
||||
#define AMF_DISPLAYCAPTURE_FRAME_INDEX L"FrameIndex" // amf_int64; default = 0, index of presented frame since capture started
|
||||
#define AMF_DISPLAYCAPTURE_FRAME_FLIP_TIMESTAMP L"FlipTimesamp" // amf_int64; default = 0, flip timestmap of presented frame
|
||||
#define AMF_DISPLAY_CAPTURE_DCC L"DisplayCaptureDCC" // bool, default false, DCC is enabled on the surface when set to true
|
||||
|
||||
// see Surface.h
|
||||
//#define AMF_SURFACE_ROTATION L"Rotation" // amf_int64(AMF_ROTATION_ENUM); default = AMF_ROTATION_NONE, can be set on surfaces - the same value as AMF_DISPLAYCAPTURE_ROTATION
|
||||
|
||||
#endif // #ifndef AMF_DisplayCapture_h
|
||||
62
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGAudioConverter.h
vendored
Normal file
62
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGAudioConverter.h
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// AMFFAudioConverterFFMPEG interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef AMF_AudioConverterFFMPEG_h
|
||||
#define AMF_AudioConverterFFMPEG_h
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#define FFMPEG_AUDIO_CONVERTER L"AudioConverterFFMPEG"
|
||||
|
||||
|
||||
#define AUDIO_CONVERTER_IN_AUDIO_BIT_RATE L"In_BitRate" // amf_int64 (default = 128000)
|
||||
#define AUDIO_CONVERTER_IN_AUDIO_SAMPLE_RATE L"In_SampleRate" // amf_int64 (default = 0)
|
||||
#define AUDIO_CONVERTER_IN_AUDIO_CHANNELS L"In_Channels" // amf_int64 (default = 2)
|
||||
#define AUDIO_CONVERTER_IN_AUDIO_SAMPLE_FORMAT L"In_SampleFormat" // amf_int64 (default = AMFAF_UNKNOWN) (AMF_AUDIO_FORMAT)
|
||||
#define AUDIO_CONVERTER_IN_AUDIO_CHANNEL_LAYOUT L"In_ChannelLayout" // amf_int64 (default = 0)
|
||||
#define AUDIO_CONVERTER_IN_AUDIO_BLOCK_ALIGN L"In_BlockAlign" // amf_int64 (default = 0)
|
||||
|
||||
#define AUDIO_CONVERTER_OUT_AUDIO_BIT_RATE L"Out_BitRate" // amf_int64 (default = 128000)
|
||||
#define AUDIO_CONVERTER_OUT_AUDIO_SAMPLE_RATE L"Out_SampleRate" // amf_int64 (default = 0)
|
||||
#define AUDIO_CONVERTER_OUT_AUDIO_CHANNELS L"Out_Channels" // amf_int64 (default = 2)
|
||||
#define AUDIO_CONVERTER_OUT_AUDIO_SAMPLE_FORMAT L"Out_SampleFormat" // amf_int64 (default = AMFAF_UNKNOWN) (AMF_AUDIO_FORMAT)
|
||||
#define AUDIO_CONVERTER_OUT_AUDIO_CHANNEL_LAYOUT L"Out_ChannelLayout" // amf_int64 (default = 0)
|
||||
#define AUDIO_CONVERTER_OUT_AUDIO_BLOCK_ALIGN L"Out_BlockAlign" // amf_int64 (default = 0)
|
||||
|
||||
|
||||
|
||||
#endif //#ifndef AMF_AudioConverterFFMPEG_h
|
||||
68
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGAudioDecoder.h
vendored
Normal file
68
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGAudioDecoder.h
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// AudioDecoderFFMPEG interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_AudioDecoderFFMPEG_h
|
||||
#define AMF_AudioDecoderFFMPEG_h
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#define FFMPEG_AUDIO_DECODER L"AudioDecoderFFMPEG"
|
||||
|
||||
|
||||
#define AUDIO_DECODER_ENABLE_DEBUGGING L"EnableDebug" // bool (default = false) - trace some debug information if set to true
|
||||
#define AUDIO_DECODER_ENABLE_DECODING L"EnableDecoding" // bool (default = true) - if false, component will not decode anything
|
||||
|
||||
#define AUDIO_DECODER_IN_AUDIO_CODEC_ID L"In_CodecID" // amf_int64 (default = AV_CODEC_ID_NONE) - FFMPEG codec ID
|
||||
#define AUDIO_DECODER_IN_AUDIO_BIT_RATE L"In_BitRate" // amf_int64 (default = 128000)
|
||||
#define AUDIO_DECODER_IN_AUDIO_EXTRA_DATA L"In_ExtraData" // interface to AMFBuffer
|
||||
#define AUDIO_DECODER_IN_AUDIO_SAMPLE_RATE L"In_SampleRate" // amf_int64 (default = 0)
|
||||
#define AUDIO_DECODER_IN_AUDIO_CHANNELS L"In_Channels" // amf_int64 (default = 2)
|
||||
#define AUDIO_DECODER_IN_AUDIO_SAMPLE_FORMAT L"In_SampleFormat" // amf_int64 (default = AMFAF_UNKNOWN) (AMF_AUDIO_FORMAT)
|
||||
#define AUDIO_DECODER_IN_AUDIO_CHANNEL_LAYOUT L"In_ChannelLayout" // amf_int64 (default = 0)
|
||||
#define AUDIO_DECODER_IN_AUDIO_BLOCK_ALIGN L"In_BlockAlign" // amf_int64 (default = 0)
|
||||
#define AUDIO_DECODER_IN_AUDIO_FRAME_SIZE L"In_FrameSize" // amf_int64 (default = 0)
|
||||
#define AUDIO_DECODER_IN_AUDIO_SEEK_POSITION L"In_SeekPosition" // amf_int64 (default = 0)
|
||||
|
||||
#define AUDIO_DECODER_OUT_AUDIO_BIT_RATE L"Out_BitRate" // amf_int64 (default = 128000)
|
||||
#define AUDIO_DECODER_OUT_AUDIO_SAMPLE_RATE L"Out_SampleRate" // amf_int64 (default = 0)
|
||||
#define AUDIO_DECODER_OUT_AUDIO_CHANNELS L"Out_Channels" // amf_int64 (default = 2)
|
||||
#define AUDIO_DECODER_OUT_AUDIO_SAMPLE_FORMAT L"Out_SampleFormat" // amf_int64 (default = AMFAF_UNKNOWN) (AMF_AUDIO_FORMAT)
|
||||
#define AUDIO_DECODER_OUT_AUDIO_CHANNEL_LAYOUT L"Out_ChannelLayout" // amf_int64 (default = 0)
|
||||
#define AUDIO_DECODER_OUT_AUDIO_BLOCK_ALIGN L"Out_BlockAlign" // amf_int64 (default = 0)
|
||||
|
||||
|
||||
|
||||
#endif //#ifndef AMF_AudioDecoderFFMPEG_h
|
||||
66
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGAudioEncoder.h
vendored
Normal file
66
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGAudioEncoder.h
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// AudioEncoderFFMPEG interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_AudioEncoderFFMPEG_h
|
||||
#define AMF_AudioEncoderFFMPEG_h
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#define FFMPEG_AUDIO_ENCODER L"AudioEncoderFFMPEG"
|
||||
|
||||
|
||||
#define AUDIO_ENCODER_ENABLE_DEBUGGING L"EnableDebug" // bool (default = false) - trace some debug information if set to true
|
||||
#define AUDIO_ENCODER_ENABLE_ENCODING L"EnableEncoding" // bool (default = true) - if false, component will not encode anything
|
||||
#define AUDIO_ENCODER_AUDIO_CODEC_ID L"CodecID" // amf_int64 (default = AV_CODEC_ID_NONE) - FFMPEG codec ID
|
||||
|
||||
#define AUDIO_ENCODER_IN_AUDIO_SAMPLE_RATE L"In_SampleRate" // amf_int64 (default = 44100)
|
||||
#define AUDIO_ENCODER_IN_AUDIO_CHANNELS L"In_Channels" // amf_int64 (default = 2)
|
||||
#define AUDIO_ENCODER_IN_AUDIO_SAMPLE_FORMAT L"In_SampleFormat" // amf_int64 (default = AMFAF_S16) (AMF_AUDIO_FORMAT)
|
||||
#define AUDIO_ENCODER_IN_AUDIO_CHANNEL_LAYOUT L"In_ChannelLayout" // amf_int64 (default = 3)
|
||||
#define AUDIO_ENCODER_IN_AUDIO_BLOCK_ALIGN L"In_BlockAlign" // amf_int64 (default = 0)
|
||||
|
||||
#define AUDIO_ENCODER_OUT_AUDIO_BIT_RATE L"Out_BitRate" // amf_int64 (default = 128000)
|
||||
#define AUDIO_ENCODER_OUT_AUDIO_EXTRA_DATA L"Out_ExtraData" // interface to AMFBuffer
|
||||
#define AUDIO_ENCODER_OUT_AUDIO_SAMPLE_RATE L"Out_SampleRate" // amf_int64 (default = 44100)
|
||||
#define AUDIO_ENCODER_OUT_AUDIO_CHANNELS L"Out_Channels" // amf_int64 (default = 2)
|
||||
#define AUDIO_ENCODER_OUT_AUDIO_SAMPLE_FORMAT L"Out_SampleFormat" // amf_int64 (default = AMFAF_S16) (AMF_AUDIO_FORMAT)
|
||||
#define AUDIO_ENCODER_OUT_AUDIO_CHANNEL_LAYOUT L"Out_ChannelLayout" // amf_int64 (default = 0)
|
||||
#define AUDIO_ENCODER_OUT_AUDIO_BLOCK_ALIGN L"Out_BlockAlign" // amf_int64 (default = 0)
|
||||
#define AUDIO_ENCODER_OUT_AUDIO_FRAME_SIZE L"Out_FrameSize" // amf_int64 (default = 0)
|
||||
|
||||
|
||||
|
||||
#endif //#ifndef AMF_AudioEncoderFFMPEG_h
|
||||
54
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGComponents.h
vendored
Normal file
54
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGComponents.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// FFMPEG components definitions
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef AMF_ComponentsFFMPEG_h
|
||||
#define AMF_ComponentsFFMPEG_h
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_M_AMD64)
|
||||
#define FFMPEG_DLL_NAME L"amf-component-ffmpeg64.dll"
|
||||
#else
|
||||
#define FFMPEG_DLL_NAME L"amf-component-ffmpeg32.dll"
|
||||
#endif
|
||||
#elif defined(__linux)
|
||||
#define FFMPEG_DLL_NAME L"amf-component-ffmpeg.so"
|
||||
#endif
|
||||
|
||||
|
||||
#endif //#ifndef AMF_ComponentsFFMPEG_h
|
||||
44
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGEncoderAV1.h
vendored
Normal file
44
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGEncoderAV1.h
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// HEVCEncoderFFMPEG interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_AV1EncoderFFMPEG_h
|
||||
#define AMF_AV1EncoderFFMPEG_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define FFMPEG_ENCODER_AV1 L"AV1EncoderFFMPEG"
|
||||
|
||||
|
||||
#endif //#ifndef AMF_HEVCEncoderFFMPEG_h
|
||||
44
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGEncoderH264.h
vendored
Normal file
44
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGEncoderH264.h
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; H264/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// H264EncoderFFMPEG interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_H264EncoderFFMPEG_h
|
||||
#define AMF_H264EncoderFFMPEG_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define FFMPEG_ENCODER_H264 L"H264EncoderFFMPEG"
|
||||
|
||||
|
||||
#endif //#ifndef AMF_H264EncoderFFMPEG_h
|
||||
44
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGEncoderHEVC.h
vendored
Normal file
44
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGEncoderHEVC.h
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// HEVCEncoderFFMPEG interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_HEVCEncoderFFMPEG_h
|
||||
#define AMF_HEVCEncoderFFMPEG_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define FFMPEG_ENCODER_HEVC L"HEVCEncoderFFMPEG"
|
||||
|
||||
|
||||
#endif //#ifndef AMF_HEVCEncoderFFMPEG_h
|
||||
66
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGFileDemuxer.h
vendored
Normal file
66
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGFileDemuxer.h
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// DemuxerFFMPEG interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_FileDemuxerFFMPEG_h
|
||||
#define AMF_FileDemuxerFFMPEG_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define FFMPEG_DEMUXER L"DemuxerFFMPEG"
|
||||
|
||||
|
||||
// component properties
|
||||
#define FFMPEG_DEMUXER_PATH L"Path" // string - the file to open
|
||||
#define FFMPEG_DEMUXER_URL L"Url" // string - the stream url to open
|
||||
#define FFMPEG_DEMUXER_START_FRAME L"StartFrame" // amf_int64 (default = 0)
|
||||
#define FFMPEG_DEMUXER_FRAME_COUNT L"FramesNumber" // amf_int64 (default = 0)
|
||||
#define FFMPEG_DEMUXER_DURATION L"Duration" // amf_int64 (default = 0)
|
||||
#define FFMPEG_DEMUXER_CHECK_MVC L"CheckMVC" // bool (default = true)
|
||||
//#define FFMPEG_DEMUXER_SYNC_AV L"SyncAV" // bool (default = false)
|
||||
#define FFMPEG_DEMUXER_INDIVIDUAL_STREAM_MODE L"StreamMode" // bool (default = true)
|
||||
#define FFMPEG_DEMUXER_LISTEN L"Listen" // bool (default = false)
|
||||
|
||||
// for common, video and audio properties see Component.h
|
||||
|
||||
|
||||
// video stream properties
|
||||
#define FFMPEG_DEMUXER_VIDEO_PIXEL_ASPECT_RATIO L"PixelAspectRatio" // double (default = calculated)
|
||||
#define FFMPEG_DEMUXER_VIDEO_CODEC L"FFmpegCodec" // enum (from source)
|
||||
|
||||
|
||||
// buffer properties
|
||||
#define FFMPEG_DEMUXER_BUFFER_TYPE L"BufferType" // amf_int64 ( AMF_STREAM_TYPE_ENUM )
|
||||
#define FFMPEG_DEMUXER_BUFFER_STREAM_INDEX L"BufferStreamIndexType" // amf_int64 ( stream index )
|
||||
#endif //#ifndef AMF_FileDemuxerFFMPEG_h
|
||||
54
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGFileMuxer.h
vendored
Normal file
54
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGFileMuxer.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// MuxerFFMPEG interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_FileMuxerFFMPEG_h
|
||||
#define AMF_FileMuxerFFMPEG_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define FFMPEG_MUXER L"MuxerFFMPEG"
|
||||
|
||||
|
||||
// component properties
|
||||
#define FFMPEG_MUXER_PATH L"Path" // string - the file to open
|
||||
#define FFMPEG_MUXER_URL L"Url" // string - the stream url to open
|
||||
#define FFMPEG_MUXER_LISTEN L"Listen" // bool (default = false)
|
||||
#define FFMPEG_MUXER_ENABLE_VIDEO L"EnableVideo" // bool (default = true)
|
||||
#define FFMPEG_MUXER_ENABLE_AUDIO L"EnableAudio" // bool (default = false)
|
||||
#define FFMPEG_MUXER_CURRENT_TIME_INTERFACE L"CurrentTimeInterface"
|
||||
#define FFMPEG_MUXER_VIDEO_ROTATION L"VideoRotation" // amf_int64 (0, 90, 180, 270, default = 0)
|
||||
#define FFMPEG_MUXER_USAGE_IS_TRIM L"UsageIsTrim" // bool (default = false)
|
||||
|
||||
#endif //#ifndef AMF_FileMuxerFFMPEG_h
|
||||
53
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGVideoDecoder.h
vendored
Normal file
53
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FFMPEGVideoDecoder.h
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// VideoDecoderFFMPEG interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_VideoDecoderFFMPEG_h
|
||||
#define AMF_VideoDecoderFFMPEG_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define FFMPEG_VIDEO_DECODER L"VideoDecoderFFMPEG"
|
||||
|
||||
#define VIDEO_DECODER_ENABLE_DECODING L"EnableDecoding" // bool (default = true) - if false, component will not decode anything
|
||||
#define VIDEO_DECODER_CODEC_ID L"CodecID" // amf_int64 (AMF_STREAM_CODEC_ID_ENUM) codec ID
|
||||
#define VIDEO_DECODER_EXTRA_DATA L"ExtraData" // interface to AMFBuffer
|
||||
#define VIDEO_DECODER_RESOLUTION L"Resolution" // AMFSize
|
||||
#define VIDEO_DECODER_BITRATE L"BitRate" // amf_int64 (default = 0)
|
||||
#define VIDEO_DECODER_FRAMERATE L"FrameRate" // AMFRate
|
||||
#define VIDEO_DECODER_SEEK_POSITION L"SeekPosition" // amf_int64 (default = 0)
|
||||
|
||||
#define VIDEO_DECODER_COLOR_TRANSFER_CHARACTERISTIC L"ColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2
|
||||
|
||||
#endif //#ifndef AMF_VideoDecoderFFMPEG_h
|
||||
90
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FRC.h
vendored
Normal file
90
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/FRC.h
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMFFRC_h
|
||||
#define AMFFRC_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define AMFFRC L"AMFFRC"
|
||||
|
||||
// Select rendering API for FRC
|
||||
enum AMF_FRC_ENGINE
|
||||
{
|
||||
FRC_ENGINE_OFF = 0,
|
||||
FRC_ENGINE_DX12 = 1,
|
||||
FRC_ENGINE_OPENCL = 2,
|
||||
FRC_ENGINE_DX11 = 3,
|
||||
};
|
||||
|
||||
// Select present mode for FRC
|
||||
enum AMF_FRC_MODE_TYPE
|
||||
{
|
||||
FRC_OFF = 0,
|
||||
FRC_ON = 1,
|
||||
FRC_ONLY_INTERPOLATED = 2,
|
||||
FRC_x2_PRESENT = 3,
|
||||
TOTAL_FRC_MODES
|
||||
};
|
||||
|
||||
enum AMF_FRC_SNAPSHOT_MODE_TYPE {
|
||||
FRC_SNAPSHOT_OFF = 0,
|
||||
FRC_SNAPSHOT_LOAD = 1,
|
||||
FRC_SNAPSHOT_STORE = 2,
|
||||
FRC_SNAPSHOT_REGRESSION_TEST= 3,
|
||||
FRC_SNAPSHOT_STORE_NO_PADDING= 4,
|
||||
TOTAL_FRC_SNAPSHOT_MODES
|
||||
};
|
||||
|
||||
enum AMF_FRC_PROFILE_TYPE {
|
||||
FRC_PROFILE_LOW = 0,
|
||||
FRC_PROFILE_HIGH = 1,
|
||||
FRC_PROFILE_SUPER = 2,
|
||||
TOTAL_FRC_PROFILES
|
||||
};
|
||||
|
||||
enum AMF_FRC_MV_SEARCH_MODE_TYPE {
|
||||
FRC_MV_SEARCH_NATIVE = 0,
|
||||
FRC_MV_SEARCH_PERFORMANCE = 1,
|
||||
TOTAL_FRC_MV_SEARCH_MODES
|
||||
};
|
||||
|
||||
#define AMF_FRC_ENGINE_TYPE L"FRCEngineType" // amf_int64(AMF_FRC_ENGINE); default = DX12; determines how the object is initialized and what kernels to use
|
||||
#define AMF_FRC_OUTPUT_SIZE L"FRCSOutputSize" // AMFSize - output scaling width/height
|
||||
#define AMF_FRC_MODE L"FRCMode" // amf_int64(AMF_FRC_MODE_TYPE); default = FRC_ONLY_INTERPOLATED; FRC mode
|
||||
#define AMF_FRC_ENABLE_FALLBACK L"FRCEnableFallback" // bool; default = true; FRC enable fallback mode
|
||||
#define AMF_FRC_INDICATOR L"FRCIndicator" // bool; default : false; draw indicator in the corner
|
||||
#define AMF_FRC_PROFILE L"FRCProfile" // amf_int64(AMF_FRC_PROFILE_TYPE); default=FRC_PROFILE_HIGH; FRC profile
|
||||
#define AMF_FRC_MV_SEARCH_MODE L"FRCMVSEARCHMODE" // amf_int64(AMF_FRC_MV_SEARCH_MODE_TYPE); defaut = FRC_MV_SEARCH_NATIVE; FRC MV search mode
|
||||
#define AMF_FRC_USE_FUTURE_FRAME L"FRCUseFutureFrame" // bool; default = true; Enable dependency on future frame, improves quality for the cost of latency
|
||||
|
||||
#endif //#ifndef AMFFRC_h
|
||||
69
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/HQScaler.h
vendored
Normal file
69
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/HQScaler.h
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMFHQScaler_h
|
||||
#define AMFHQScaler_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define AMFHQScaler L"AMFHQScaler"
|
||||
|
||||
|
||||
// various types of algorithms supported by the high-quality scaler
|
||||
enum AMF_HQ_SCALER_ALGORITHM_ENUM
|
||||
{
|
||||
AMF_HQ_SCALER_ALGORITHM_BILINEAR = 0,
|
||||
AMF_HQ_SCALER_ALGORITHM_BICUBIC = 1,
|
||||
AMF_HQ_SCALER_ALGORITHM_FSR = 2, // deprecated
|
||||
AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_0 = 2,
|
||||
AMF_HQ_SCALER_ALGORITHM_POINT = 3,
|
||||
AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_1 = 4,
|
||||
|
||||
};
|
||||
|
||||
|
||||
// PA object properties
|
||||
#define AMF_HQ_SCALER_ALGORITHM L"HQScalerAlgorithm" // amf_int64(AMF_HQ_SCALER_ALGORITHM_ENUM) (Bi-linear, Bi-cubic, RCAS, Auto)" - determines which scaling algorithm will be used
|
||||
// auto will chose best option between algorithms available
|
||||
#define AMF_HQ_SCALER_ENGINE_TYPE L"HQScalerEngineType" // AMF_MEMORY_TYPE (DX11, DX12, OPENCL, VULKAN default : DX11)" - determines how the object is initialized and what kernels to use
|
||||
|
||||
#define AMF_HQ_SCALER_OUTPUT_SIZE L"HQSOutputSize" // AMFSize - output scaling width/hieight
|
||||
|
||||
#define AMF_HQ_SCALER_KEEP_ASPECT_RATIO L"KeepAspectRatio" // bool (default=false) Keep aspect ratio if scaling.
|
||||
#define AMF_HQ_SCALER_FILL L"Fill" // bool (default=false) fill area out of ROI.
|
||||
#define AMF_HQ_SCALER_FILL_COLOR L"FillColor" // AMFColor
|
||||
#define AMF_HQ_SCALER_FROM_SRGB L"FromSRGB" // bool (default=true) Convert to SRGB.
|
||||
|
||||
#define AMF_HQ_SCALER_SHARPNESS L"HQScalerSharpness" // Float in the range of [0.0, 2.0]
|
||||
#define AMF_HQ_SCALER_FRAME_RATE L"HQScalerFrameRate" // Frame rate (off, 15, 30, 60)
|
||||
|
||||
#endif //#ifndef AMFHQScaler_h
|
||||
79
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/MediaSource.h
vendored
Normal file
79
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/MediaSource.h
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_MediaSource_h
|
||||
#define AMF_MediaSource_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "public/include/core/Interface.h"
|
||||
|
||||
namespace amf
|
||||
{
|
||||
enum AMF_SEEK_TYPE
|
||||
{
|
||||
AMF_SEEK_PREV = 0, // nearest packet before pts
|
||||
AMF_SEEK_NEXT = 1, // nearest packet after pts
|
||||
AMF_SEEK_PREV_KEYFRAME = 2, // nearest keyframe packet before pts
|
||||
AMF_SEEK_NEXT_KEYFRAME = 3, // nearest keyframe packet after pts
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// media source interface.
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMFMediaSource : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xb367695a, 0xdbd0, 0x4430, 0x95, 0x3b, 0xbc, 0x7d, 0xbd, 0x2a, 0xa7, 0x66)
|
||||
|
||||
// interface
|
||||
virtual AMF_RESULT AMF_STD_CALL Seek(amf_pts pos, AMF_SEEK_TYPE seekType, amf_int32 whichStream) = 0;
|
||||
virtual amf_pts AMF_STD_CALL GetPosition() = 0;
|
||||
virtual amf_pts AMF_STD_CALL GetDuration() = 0;
|
||||
|
||||
virtual void AMF_STD_CALL SetMinPosition(amf_pts pts) = 0;
|
||||
virtual amf_pts AMF_STD_CALL GetMinPosition() = 0;
|
||||
virtual void AMF_STD_CALL SetMaxPosition(amf_pts pts) = 0;
|
||||
virtual amf_pts AMF_STD_CALL GetMaxPosition() = 0;
|
||||
|
||||
virtual amf_uint64 AMF_STD_CALL GetFrameFromPts(amf_pts pts) = 0;
|
||||
virtual amf_pts AMF_STD_CALL GetPtsFromFrame(amf_uint64 frame) = 0;
|
||||
|
||||
virtual bool AMF_STD_CALL SupportFramesAccess() = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFMediaSource> AMFMediaSourcePtr;
|
||||
} //namespace amf
|
||||
|
||||
#endif //#ifndef AMF_MediaSource_h
|
||||
133
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/PreAnalysis.h
vendored
Normal file
133
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/PreAnalysis.h
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMFPreAnalysis_h
|
||||
#define AMFPreAnalysis_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define AMFPreAnalysis L"AMFPreAnalysis"
|
||||
|
||||
|
||||
|
||||
enum AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_ENUM
|
||||
{
|
||||
AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_LOW = 0,
|
||||
AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_MEDIUM = 1,
|
||||
AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_HIGH = 2
|
||||
};
|
||||
|
||||
|
||||
enum AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_ENUM
|
||||
{
|
||||
AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_LOW = 0,
|
||||
AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_MEDIUM = 1,
|
||||
AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_HIGH = 2
|
||||
};
|
||||
|
||||
|
||||
enum AMF_PA_ACTIVITY_TYPE_ENUM
|
||||
{
|
||||
AMF_PA_ACTIVITY_Y = 0,
|
||||
AMF_PA_ACTIVITY_YUV = 1
|
||||
};
|
||||
|
||||
|
||||
enum AMF_PA_CAQ_STRENGTH_ENUM
|
||||
{
|
||||
AMF_PA_CAQ_STRENGTH_LOW = 0,
|
||||
AMF_PA_CAQ_STRENGTH_MEDIUM = 1,
|
||||
AMF_PA_CAQ_STRENGTH_HIGH = 2
|
||||
};
|
||||
|
||||
// Perceptual adaptive quantization mode
|
||||
enum AMF_PA_PAQ_MODE_ENUM
|
||||
{
|
||||
AMF_PA_PAQ_MODE_NONE = 0,
|
||||
AMF_PA_PAQ_MODE_CAQ = 1
|
||||
};
|
||||
|
||||
// Temporal adaptive quantization mode
|
||||
enum AMF_PA_TAQ_MODE_ENUM
|
||||
{
|
||||
AMF_PA_TAQ_MODE_NONE = 0,
|
||||
AMF_PA_TAQ_MODE_1 = 1,
|
||||
AMF_PA_TAQ_MODE_2 = 2
|
||||
};
|
||||
|
||||
enum AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_ENUM
|
||||
{
|
||||
AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_NONE = 0, //default
|
||||
AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_AUTO = 1
|
||||
};
|
||||
|
||||
|
||||
// PA object properties
|
||||
#define AMF_PA_ENGINE_TYPE L"PAEngineType" // AMF_MEMORY_TYPE (Host, DX11, OpenCL, Vulkan, DX12, Auto default : UNKNOWN (Auto))" - determines how the object is initialized and what kernels to use
|
||||
// by default it is Auto (DX11, OpenCL and Vulkan are currently available)
|
||||
|
||||
#define AMF_PA_SCENE_CHANGE_DETECTION_ENABLE L"PASceneChangeDetectionEnable" // bool (default : True) - Enable Scene Change Detection GPU algorithm
|
||||
#define AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY L"PASceneChangeDetectionSensitivity" // AMF_PA_SCENE_CHANGE_DETECTION_SENSITIVITY_ENUM (default : Medium) - Scene Change Detection Sensitivity
|
||||
#define AMF_PA_STATIC_SCENE_DETECTION_ENABLE L"PAStaticSceneDetectionEnable" // bool (default : False) - Enable Skip Detection GPU algorithm
|
||||
#define AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY L"PAStaticSceneDetectionSensitivity" // AMF_PA_STATIC_SCENE_DETECTION_SENSITIVITY_ENUM (default : High) - Allowable absolute difference between pixels (sample counts)
|
||||
#define AMF_PA_FRAME_SAD_ENABLE L"PAFrameSadEnable" // bool (default : True) - Enable Frame SAD algorithm
|
||||
#define AMF_PA_ACTIVITY_TYPE L"PAActivityType" // AMF_PA_ACTIVITY_TYPE_ENUM (default : Calculate on Y) - Block activity calculation mode
|
||||
#define AMF_PA_LTR_ENABLE L"PALongTermReferenceEnable" // bool (default : False) - Enable Automatic Long Term Reference frame management
|
||||
#define AMF_PA_LOOKAHEAD_BUFFER_DEPTH L"PALookAheadBufferDepth" // amf_uint64 (default : 0) Values: [0, MAX_LOOKAHEAD_DEPTH] - PA lookahead buffer size
|
||||
#define AMF_PA_PAQ_MODE L"PAPerceptualAQMode" // AMF_PA_PAQ_MODE_ENUM (default : AMF_PA_PAQ_MODE_NONE) - Perceptual AQ mode
|
||||
#define AMF_PA_TAQ_MODE L"PATemporalAQMode" // AMF_PA_TAQ_MODE_ENUM (default: AMF_PA_TAQ_MODE_NONE) - Temporal AQ mode
|
||||
#define AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE L"PAHighMotionQualityBoostMode" // AMF_PA_HIGH_MOTION_QUALITY_BOOST_MODE_ENUM (default: None) - High motion quality boost mode
|
||||
|
||||
///////////////////////////////////////////
|
||||
// the following properties are available
|
||||
// only through the Encoder - trying to
|
||||
// access/set them when PA is standalone
|
||||
// will fail
|
||||
|
||||
|
||||
#define AMF_PA_INITIAL_QP_AFTER_SCENE_CHANGE L"PAInitialQPAfterSceneChange" // amf_uint64 (default : 0) Values: [0, 51] - Base QP to be used immediately after scene change. If this value is not set, PA will choose a proper QP value
|
||||
#define AMF_PA_MAX_QP_BEFORE_FORCE_SKIP L"PAMaxQPBeforeForceSkip" // amf_uint64 (default : 35) Values: [0, 51] - When a static scene is detected, a skip frame is inserted only if the previous encoded frame average QP <= this value
|
||||
|
||||
|
||||
#define AMF_PA_CAQ_STRENGTH L"PACAQStrength" // AMF_PA_CAQ_STRENGTH_ENUM (default : Medium) - Content Adaptive Quantization (CAQ) strength
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// properties set by PA on output buffer interface in standalone mode
|
||||
#define AMF_PA_ACTIVITY_MAP L"PAActivityMap" // AMFInterface* -> AMFSurface*; Values: int32 - When PA is standalone, there will be a 2D Activity map generated for each frame
|
||||
#define AMF_PA_SCENE_CHANGE_DETECT L"PASceneChangeDetect" // bool - True/False - available if AMF_PA_SCENE_CHANGE_DETECTION_ENABLE was set to True when PA is standalone
|
||||
#define AMF_PA_STATIC_SCENE_DETECT L"PAStaticSceneDetect" // bool - True/False - available if AMF_PA_STATIC_SCENE_DETECTION_ENABLE was set to True when PA is standalone
|
||||
|
||||
|
||||
#endif //#ifndef AMFPreAnalysis_h
|
||||
59
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/PreProcessing.h
vendored
Normal file
59
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/PreProcessing.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMFPreProcessing_h
|
||||
#define AMFPreProcessing_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define AMFPreProcessing L"AMFPreProcessing"
|
||||
|
||||
|
||||
// Pre-processing object properties
|
||||
#define AMF_PP_ENGINE_TYPE L"PPEngineType" // AMF_MEMORY_TYPE (Host, DX11, OPENCL, Auto default : OPENCL) - determines how the object is initialized and what kernels to use
|
||||
// by default it is OpenCL (Host, DX11 and OpenCL are currently available)
|
||||
// add a property that will determine the output format
|
||||
// by default we output in the same format as input
|
||||
// but in some cases we might need to change the output
|
||||
// format to be different than input
|
||||
#define AMF_PP_OUTPUT_MEMORY_TYPE L"PPOutputFormat" // AMF_MEMORY_TYPE (Host, DX11, OPENCL default : Unknown) - determines format of frame going out
|
||||
|
||||
|
||||
#define AMF_PP_ADAPTIVE_FILTER_STRENGTH L"PPAdaptiveFilterStrength" // int (default : 4) - strength: 0 - 10: the higher the value, the stronger the filtering
|
||||
#define AMF_PP_ADAPTIVE_FILTER_SENSITIVITY L"PPAdaptiveFilterSensitivity" // int (default : 4) - sensitivity: 0 - 10: the lower the value, the more sensitive to edge (preserve more details)
|
||||
|
||||
// Encoder parameters used for adaptive filtering
|
||||
#define AMF_PP_TARGET_BITRATE L"PPTargetBitrate" // int64 (default: 2000000) - target bit rate
|
||||
#define AMF_PP_FRAME_RATE L"PPFrameRate" // AMFRate (default: 30, 1) - frame rate
|
||||
#define AMF_PP_ADAPTIVE_FILTER_ENABLE L"PPAdaptiveFilterEnable" // bool (default: false) - turn on/off adaptive filtering
|
||||
|
||||
#endif //#ifndef AMFPreProcessing_h
|
||||
61
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/SupportedCodecs.h
vendored
Normal file
61
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/SupportedCodecs.h
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// An interface available on some components to provide information on supported input and output codecs
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_SupportedCodecs_h
|
||||
#define AMF_SupportedCodecs_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "public/include/core/Interface.h"
|
||||
|
||||
//properties on the returned AMFPropertyStorage
|
||||
#define SUPPORTEDCODEC_ID L"CodecId" //amf_int64
|
||||
#define SUPPORTEDCODEC_SAMPLERATE L"SampleRate" //amf_int32
|
||||
|
||||
namespace amf
|
||||
{
|
||||
class AMFSupportedCodecs : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xc1003a83, 0x7934, 0x408a, 0x95, 0x5b, 0xc4, 0xdd, 0x85, 0x9d, 0xf5, 0x61)
|
||||
|
||||
//call with increasing values until it returns AMF_OUT_OF_RANGE
|
||||
virtual AMF_RESULT AMF_STD_CALL GetInputCodecAt(amf_size index, AMFPropertyStorage** codec) const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetOutputCodecAt(amf_size index, AMFPropertyStorage** codec) const = 0;
|
||||
};
|
||||
typedef AMFInterfacePtr_T<AMFSupportedCodecs> AMFSupportedCodecsPtr;
|
||||
}
|
||||
|
||||
#endif
|
||||
48
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VQEnhancer.h
vendored
Normal file
48
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VQEnhancer.h
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMFVQEnhancer_h
|
||||
#define AMFVQEnhancer_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define VE_FCR_DEFAULT_ATTENUATION 0.1
|
||||
|
||||
#define AMFVQEnhancer L"AMFVQEnhancer"
|
||||
|
||||
#define AMF_VIDEO_ENHANCER_ENGINE_TYPE L"AMF_VIDEI_ENHANCER_ENGINE_TYPE" // AMF_MEMORY_TYPE (DX11, DX12, OPENCL, VULKAN default : DX11)" - determines how the object is initialized and what kernels to use
|
||||
#define AMF_VIDEO_ENHANCER_OUTPUT_SIZE L"AMF_VIDEO_ENHANCER_OUTPUT_SIZE" // AMFSize
|
||||
#define AMF_VE_FCR_ATTENUATION L"AMF_VE_FCR_ATTENUATION" // Float in the range of [0.02, 0.4], default : 0.1
|
||||
#define AMF_VE_FCR_RADIUS L"AMF_VE_FCR_RADIUS" // int in the range of [1, 4]
|
||||
#define AMF_VE_FCR_SPLIT_VIEW L"AMF_VE_FCR_SPLIT_VIEW" // FCR View split window
|
||||
|
||||
#endif //#ifndef AMFVQEnhancer_h
|
||||
52
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoCapture.h
vendored
Normal file
52
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoCapture.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// ZCamLive interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_VideoCapture_h
|
||||
#define AMF_VideoCapture_h
|
||||
|
||||
#pragma once
|
||||
|
||||
#define VIDEOCAP_DEVICE_COUNT L"VideoCapDeviceCount" // amf_int64, (default=2), number of video capture devices
|
||||
#define VIDEOCAP_DEVICE_NAME L"VideoCapDeviceName" // WString, (default=""), name of the video capture device
|
||||
#define VIDEOCAP_DEVICE_ACTIVE L"VideoCapDeviceActive" // WString, (default=""), name of the selected video capture device
|
||||
|
||||
#define VIDEOCAP_CODEC L"CodecID" // WString (default = "AMFVideoDecoderUVD_H264_AVC"), UVD codec ID
|
||||
#define VIDEOCAP_FRAMESIZE L"FrameSize" // AMFSize, (default=AMFConstructSize(1920, 1080)), frame size in pixels
|
||||
|
||||
extern "C"
|
||||
{
|
||||
AMF_RESULT AMF_CDECL_CALL AMFCreateComponentVideoCapture(amf::AMFContext* pContext, amf::AMFComponentEx** ppComponent);
|
||||
}
|
||||
#endif // AMF_VideoCapture_h
|
||||
121
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoConverter.h
vendored
Normal file
121
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoConverter.h
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// AMFFVideoConverter interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_VideoConverter_h
|
||||
#define AMF_VideoConverter_h
|
||||
#pragma once
|
||||
|
||||
#include "Component.h"
|
||||
#include "ColorSpace.h"
|
||||
|
||||
#define AMFVideoConverter L"AMFVideoConverter"
|
||||
|
||||
enum AMF_VIDEO_CONVERTER_SCALE_ENUM
|
||||
{
|
||||
AMF_VIDEO_CONVERTER_SCALE_INVALID = -1,
|
||||
AMF_VIDEO_CONVERTER_SCALE_BILINEAR = 0,
|
||||
AMF_VIDEO_CONVERTER_SCALE_BICUBIC = 1
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_CONVERTER_TONEMAPPING_ENUM
|
||||
{
|
||||
AMF_VIDEO_CONVERTER_TONEMAPPING_COPY = 0,
|
||||
AMF_VIDEO_CONVERTER_TONEMAPPING_AMD = 1,
|
||||
AMF_VIDEO_CONVERTER_TONEMAPPING_LINEAR = 2,
|
||||
AMF_VIDEO_CONVERTER_TONEMAPPING_GAMMA = 3,
|
||||
AMF_VIDEO_CONVERTER_TONEMAPPING_REINHARD = 4,
|
||||
AMF_VIDEO_CONVERTER_TONEMAPPING_2390 = 5,
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define AMF_VIDEO_CONVERTER_OUTPUT_FORMAT L"OutputFormat" // Values : AMF_SURFACE_NV12 or AMF_SURFACE_BGRA or AMF_SURFACE_YUV420P
|
||||
#define AMF_VIDEO_CONVERTER_MEMORY_TYPE L"MemoryType" // Values : AMF_MEMORY_DX11 or AMF_MEMORY_DX9 or AMF_MEMORY_UNKNOWN (get from input type)
|
||||
#define AMF_VIDEO_CONVERTER_COMPUTE_DEVICE L"ComputeDevice" // Values : AMF_MEMORY_COMPUTE_FOR_DX9 enumeration
|
||||
|
||||
#define AMF_VIDEO_CONVERTER_OUTPUT_SIZE L"OutputSize" // AMFSize (default=0,0) width in pixels. default means no scaling
|
||||
#define AMF_VIDEO_CONVERTER_OUTPUT_RECT L"OutputRect" // AMFRect (default=0, 0, 0, 0) rectangle in pixels. default means no rect
|
||||
#define AMF_VIDEO_CONVERTER_SCALE L"ScaleType" // amf_int64(AMF_VIDEO_CONVERTER_SCALE_ENUM); default = AMF_VIDEO_CONVERTER_SCALE_BILINEAR
|
||||
#define AMF_VIDEO_CONVERTER_FORCE_OUTPUT_SURFACE_SIZE L"ForceOutputSurfaceSize" // bool (default=false) Force output size from output surface
|
||||
|
||||
#define AMF_VIDEO_CONVERTER_KEEP_ASPECT_RATIO L"KeepAspectRatio" // bool (default=false) Keep aspect ratio if scaling.
|
||||
#define AMF_VIDEO_CONVERTER_FILL L"Fill" // bool (default=false) fill area out of ROI.
|
||||
#define AMF_VIDEO_CONVERTER_FILL_COLOR L"FillColor" // AMFColor
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// SDR color conversion
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#define AMF_VIDEO_CONVERTER_COLOR_PROFILE L"ColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO
|
||||
#define AMF_VIDEO_CONVERTER_LINEAR_RGB L"LinearRGB" // bool (default=false) Convert to/from linear RGB instead of sRGB using AMF_VIDEO_DECODER_COLOR_TRANSFER_CHARACTERISTIC or by default AMF_VIDEO_CONVERTER_TRANSFER_CHARACTERISTIC
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// HDR color conversion
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// AMF_VIDEO_CONVERTER_COLOR_PROFILE is used to define color space conversion
|
||||
|
||||
// HDR data - can be set on converter or respectively on input and output surfaces (output surface via custom allocator)
|
||||
// if present, HDR_METADATA primary color overwrites COLOR_PRIMARIES
|
||||
|
||||
// these properties can be set on converter component to configure input and output
|
||||
// these properties overwrite properties set on surface - see below
|
||||
#define AMF_VIDEO_CONVERTER_INPUT_TRANSFER_CHARACTERISTIC L"InputTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2 See ColorSpace.h for enum
|
||||
#define AMF_VIDEO_CONVERTER_INPUT_COLOR_PRIMARIES L"InputColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 7.1 See ColorSpace.h for enum
|
||||
#define AMF_VIDEO_CONVERTER_INPUT_COLOR_RANGE L"InputColorRange" // amf_int64(AMF_COLOR_RANGE_ENUM) default = AMF_COLOR_RANGE_UNDEFINED
|
||||
#define AMF_VIDEO_CONVERTER_INPUT_HDR_METADATA L"InputHdrMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL
|
||||
#define AMF_VIDEO_CONVERTER_INPUT_TONEMAPPING L"InputTonemapping" // amf_int64(AMF_VIDEO_CONVERTER_TONEMAPPING_ENUM) default = AMF_VIDEO_CONVERTER_TONEMAPPING_LINEAR
|
||||
|
||||
#define AMF_VIDEO_CONVERTER_OUTPUT_TRANSFER_CHARACTERISTIC L"OutputTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2 See ColorSpace.h for enum
|
||||
#define AMF_VIDEO_CONVERTER_OUTPUT_COLOR_PRIMARIES L"OutputColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 7.1 See ColorSpace.h for enum
|
||||
#define AMF_VIDEO_CONVERTER_OUTPUT_COLOR_RANGE L"OutputColorRange" // amf_int64(AMF_COLOR_RANGE_ENUM) default = AMF_COLOR_RANGE_UNDEFINED
|
||||
#define AMF_VIDEO_CONVERTER_OUTPUT_HDR_METADATA L"OutputHdrMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL
|
||||
#define AMF_VIDEO_CONVERTER_OUTPUT_TONEMAPPING L"OutputTonemapping" // amf_int64(AMF_VIDEO_CONVERTER_TONEMAPPING_ENUM) default = AMF_VIDEO_CONVERTER_TONEMAPPING_AMD
|
||||
|
||||
// these properties can be set on input or outout surface See ColorSpace.h
|
||||
// the same as decoder properties set on input surface - see below
|
||||
//#define AMF_VIDEO_COLOR_TRANSFER_CHARACTERISTIC L"ColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2 See ColorSpace.h for enum
|
||||
//#define AMF_VIDEO_COLOR_PRIMARIES L"ColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 7.1 See ColorSpace.h for enum
|
||||
//#define AMF_VIDEO_COLOR_RANGE L"ColorRange" // amf_int64(AMF_COLOR_RANGE_ENUM) default = AMF_COLOR_RANGE_UNDEFINED
|
||||
//#define AMF_VIDEO_COLOR_HDR_METADATA L"HdrMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL
|
||||
|
||||
// If decoder properties can be set on input see VideoDecoder.h
|
||||
// AMF_VIDEO_DECODER_COLOR_TRANSFER_CHARACTERISTIC
|
||||
// AMF_VIDEO_DECODER_COLOR_PRIMARIES
|
||||
// AMF_VIDEO_DECODER_COLOR_RANGE
|
||||
// AMF_VIDEO_DECODER_HDR_METADATA
|
||||
|
||||
#define AMF_VIDEO_CONVERTER_USE_DECODER_HDR_METADATA L"UseDecoderHDRMetadata" // bool (default=true) enables use of decoder / surface input color properties above
|
||||
|
||||
|
||||
#endif //#ifndef AMF_VideoConverter_h
|
||||
135
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoDecoderUVD.h
vendored
Normal file
135
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoDecoderUVD.h
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// VideoDecoderUVD interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_VideoDecoderUVD_h
|
||||
#define AMF_VideoDecoderUVD_h
|
||||
#pragma once
|
||||
|
||||
#include "Component.h"
|
||||
#include "ColorSpace.h"
|
||||
|
||||
#define AMFVideoDecoderUVD_MPEG2 L"AMFVideoDecoderUVD_MPEG2"
|
||||
#define AMFVideoDecoderUVD_MPEG4 L"AMFVideoDecoderUVD_MPEG4"
|
||||
#define AMFVideoDecoderUVD_WMV3 L"AMFVideoDecoderUVD_WMV3"
|
||||
#define AMFVideoDecoderUVD_VC1 L"AMFVideoDecoderUVD_VC1"
|
||||
#define AMFVideoDecoderUVD_H264_AVC L"AMFVideoDecoderUVD_H264_AVC"
|
||||
#define AMFVideoDecoderUVD_H264_MVC L"AMFVideoDecoderUVD_H264_MVC"
|
||||
#define AMFVideoDecoderUVD_H264_SVC L"AMFVideoDecoderUVD_H264_SVC"
|
||||
#define AMFVideoDecoderUVD_MJPEG L"AMFVideoDecoderUVD_MJPEG"
|
||||
#define AMFVideoDecoderHW_H265_HEVC L"AMFVideoDecoderHW_H265_HEVC"
|
||||
#define AMFVideoDecoderHW_H265_MAIN10 L"AMFVideoDecoderHW_H265_MAIN10" // deprecated, AMFVideoDecoderHW_H265_HEVC can be used
|
||||
#define AMFVideoDecoderHW_VP9 L"AMFVideoDecoderHW_VP9"
|
||||
#define AMFVideoDecoderHW_VP9_10BIT L"AMFVideoDecoderHW_VP9_10BIT" // deprecated, AMFVideoDecoderHW_VP9 can be used
|
||||
#define AMFVideoDecoderHW_AV1 L"AMFVideoDecoderHW_AV1"
|
||||
#define AMFVideoDecoderHW_AV1_12BIT L"AMFVideoDecoderHW_AV1_12BIT" // deprecated, AMFVideoDecoderHW_AV1 can be used
|
||||
|
||||
enum AMF_VIDEO_DECODER_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_DECODER_MODE_REGULAR = 0, // DPB delay is based on number of reference frames + 1 (from SPS)
|
||||
AMF_VIDEO_DECODER_MODE_COMPLIANT, // DPB delay is based on profile - up to 16
|
||||
AMF_VIDEO_DECODER_MODE_LOW_LATENCY, // DPB delay is 0. Expect stream with no reordering in P-Frames or B-Frames. B-frames can be present as long as they do not introduce any frame re-ordering
|
||||
};
|
||||
enum AMF_TIMESTAMP_MODE_ENUM
|
||||
{
|
||||
AMF_TS_PRESENTATION = 0, // default. decoder will preserve timestamps from input to output
|
||||
AMF_TS_SORT, // decoder will resort PTS list
|
||||
AMF_TS_DECODE // timestamps reflect decode order - decoder will reuse them
|
||||
};
|
||||
|
||||
#define AMF_VIDEO_DECODER_SURFACE_COPY L"SurfaceCopy" // amf_bool; default = false; return output surfaces as a copy
|
||||
#define AMF_VIDEO_DECODER_EXTRADATA L"ExtraData" // AMFInterface* -> AMFBuffer* - AVCC - size length + SPS/PPS; or as Annex B. Optional if stream is Annex B
|
||||
#define AMF_VIDEO_DECODER_FRAME_RATE L"FrameRate" // amf_double; default = 0.0, optional property to restore duration in the output if needed
|
||||
#define AMF_TIMESTAMP_MODE L"TimestampMode" // amf_int64(AMF_TIMESTAMP_MODE_ENUM) - default AMF_TS_PRESENTATION - how input timestamps are treated
|
||||
|
||||
// dynamic/adaptive resolution change
|
||||
#define AMF_VIDEO_DECODER_ADAPTIVE_RESOLUTION_CHANGE L"AdaptiveResolutionChange" // amf_bool; default = false; reuse allocated surfaces if new resolution is smaller
|
||||
#define AMF_VIDEO_DECODER_ALLOC_SIZE L"AllocSize" // AMFSize; default (1920,1088); size of allocated surface if AdaptiveResolutionChange is true
|
||||
#define AMF_VIDEO_DECODER_CURRENT_SIZE L"CurrentSize" // AMFSize; default = (0,0); current size of the video
|
||||
|
||||
// reference frame management
|
||||
#define AMF_VIDEO_DECODER_REORDER_MODE L"ReorderMode" // amf_int64(AMF_VIDEO_DECODER_MODE_ENUM); default = AMF_VIDEO_DECODER_MODE_REGULAR; defines number of surfaces in DPB list.
|
||||
#define AMF_VIDEO_DECODER_SURFACE_POOL_SIZE L"SurfacePoolSize" // amf_int64; number of surfaces in the decode pool = DPB list size + number of surfaces for presentation
|
||||
#define AMF_VIDEO_DECODER_DPB_SIZE L"DPBSize" // amf_int64; minimum number of surfaces for reordering
|
||||
|
||||
#define AMF_VIDEO_DECODER_DEFAULT_SURFACES_FOR_TRANSIT 5 // if AMF_VIDEO_DECODER_SURFACE_POOL_SIZE is 0 , AMF_VIDEO_DECODER_SURFACE_POOL_SIZE=AMF_VIDEO_DECODER_DEFAULT_SURFACES_FOR_TRANSIT+AMF_VIDEO_DECODER_DPB_SIZE
|
||||
|
||||
// Decoder capabilities - exposed in AMFCaps interface
|
||||
#define AMF_VIDEO_DECODER_CAP_NUM_OF_STREAMS L"NumOfStreams" // amf_int64; maximum number of decode streams supported
|
||||
|
||||
|
||||
// metadata information: can be set on output surface
|
||||
|
||||
// Properties could be set on surface based on HDR SEI or VUI header
|
||||
#define AMF_VIDEO_DECODER_COLOR_TRANSFER_CHARACTERISTIC L"ColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2
|
||||
#define AMF_VIDEO_DECODER_COLOR_PRIMARIES L"ColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 7.1
|
||||
#define AMF_VIDEO_DECODER_HDR_METADATA L"HdrMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL
|
||||
|
||||
/////// AMF_VIDEO_DECODER_FULL_RANGE_COLOR deprecated, use AMF_VIDEO_DECODER_COLOR_RANGE
|
||||
#define AMF_VIDEO_DECODER_FULL_RANGE_COLOR L"FullRangeColor" // bool; default = false; false = studio range, true = full range
|
||||
///////
|
||||
#define AMF_VIDEO_DECODER_COLOR_RANGE L"ColorRange" // amf_int64(AMF_COLOR_RANGE_ENUM) default = AMF_COLOR_RANGE_UNDEFINED
|
||||
|
||||
// can be set on output surface if YUV outout or on component to overwrite VUI
|
||||
#define AMF_VIDEO_DECODER_COLOR_PROFILE L"ColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO
|
||||
|
||||
// properties to be set on decoder if internal converter is used
|
||||
#define AMF_VIDEO_DECODER_OUTPUT_TRANSFER_CHARACTERISTIC L"OutColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 7.2 See VideoDecoderUVD.h for enum
|
||||
#define AMF_VIDEO_DECODER_OUTPUT_COLOR_PRIMARIES L"OutputColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 7.1 See ColorSpace.h for enum
|
||||
#define AMF_VIDEO_DECODER_OUTPUT_HDR_METADATA L"OutHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL
|
||||
|
||||
#define AMF_VIDEO_DECODER_LOW_LATENCY L"LowLatencyDecode" // amf_bool; default = false; true = low latency decode, false = regular decode
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#define AMF_VIDEO_DECODER_NATIVEWINDOW L"AndroidNativeWindow" // amf_int64; default = 0; pointer to native window
|
||||
#endif //__ANDROID__
|
||||
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#define AMF_VIDEO_DECODER_NATIVEWINDOW L"AppleNativeWindow" // amf_int64; default = 0; pointer to native window
|
||||
#endif //__APPLE__
|
||||
|
||||
#define AMF_VIDEO_DECODER_ENABLE_SMART_ACCESS_VIDEO L"EnableDecoderSmartAccessVideo" // amf_bool; default = false; true = enables smart access video feature
|
||||
#define AMF_VIDEO_DECODER_SKIP_TRANSFER_SMART_ACCESS_VIDEO L"SkipTransferSmartAccessVideo" // amf_bool; default = false; true = keeps output on GPU where it ran
|
||||
#define AMF_VIDEO_DECODER_OUTPUT_FORMAT L"OutputDecodeFormat" // amf_int64 (AMF_SURFACE_FORMAT) detected output format
|
||||
|
||||
#define AMF_VIDEO_DECODER_CAP_SUPPORT_SMART_ACCESS_VIDEO L"SupportSmartAccessVideo" // amf_bool; returns true if system supports SmartAccess Video
|
||||
|
||||
#define AMF_VIDEO_DECODER_SURFACE_CPU L"SurfaceCpu" // amf_bool. default = false, true = hint to decoder that output will be consumed on cpu
|
||||
|
||||
#define AMF_VIDEO_DECODER_INSTANCE_INDEX L"DecoderInstance" // amf_int64; selected HW instance idx
|
||||
#define AMF_VIDEO_DECODER_CAP_NUM_OF_HW_INSTANCES L"NumOfHwDecoderInstances" // amf_int64 number of HW decoder instances
|
||||
|
||||
|
||||
#endif //#ifndef AMF_VideoDecoderUVD_h
|
||||
366
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoEncoderAV1.h
vendored
Normal file
366
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoEncoderAV1.h
vendored
Normal file
@@ -0,0 +1,366 @@
|
||||
//
|
||||
// Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// VideoEncoderHW_AV1 interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef AMF_VideoEncoderAV1_h
|
||||
#define AMF_VideoEncoderAV1_h
|
||||
#pragma once
|
||||
|
||||
#include "Component.h"
|
||||
#include "ColorSpace.h"
|
||||
#include "PreAnalysis.h"
|
||||
|
||||
#define AMFVideoEncoder_AV1 L"AMFVideoEncoderHW_AV1"
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_NONE = 0, // No encoding latency requirement. Encoder will balance encoding time and power consumption.
|
||||
AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_POWER_SAVING_REAL_TIME = 1, // Try the best to finish encoding a frame within 1/framerate sec. This mode may cause more power consumption
|
||||
AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_REAL_TIME = 2, // Try the best to finish encoding a frame within 1/(2 x framerate) sec. This mode will cause more power consumption than POWER_SAVING_REAL_TIME
|
||||
AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_LOWEST_LATENCY = 3 // Encoding as fast as possible. This mode causes highest power consumption.
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_USAGE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_USAGE_TRANSCODING = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_USAGE_ULTRA_LOW_LATENCY = 2,
|
||||
AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY = 1,
|
||||
AMF_VIDEO_ENCODER_AV1_USAGE_WEBCAM = 3,
|
||||
AMF_VIDEO_ENCODER_AV1_USAGE_HIGH_QUALITY = 4,
|
||||
AMF_VIDEO_ENCODER_AV1_USAGE_LOW_LATENCY_HIGH_QUALITY = 5
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_PROFILE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_PROFILE_MAIN = 1
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_LEVEL_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_2_0 = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_2_1 = 1,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_2_2 = 2,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_2_3 = 3,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_3_0 = 4,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_3_1 = 5,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_3_2 = 6,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_3_3 = 7,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_4_0 = 8,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_4_1 = 9,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_4_2 = 10,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_4_3 = 11,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_5_0 = 12,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_5_1 = 13,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_5_2 = 14,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_5_3 = 15,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_6_0 = 16,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_6_1 = 17,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_6_2 = 18,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_6_3 = 19,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_7_0 = 20,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_7_1 = 21,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_7_2 = 22,
|
||||
AMF_VIDEO_ENCODER_AV1_LEVEL_7_3 = 23
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_UNKNOWN = -1,
|
||||
AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CONSTANT_QP = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR = 1,
|
||||
AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR = 2,
|
||||
AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CBR = 3,
|
||||
AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_QUALITY_VBR = 4,
|
||||
AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_HIGH_QUALITY_VBR = 5,
|
||||
AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_HIGH_QUALITY_CBR = 6
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_64X16_ONLY = 1,
|
||||
AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_64X16_1080P_CODED_1082 = 2,
|
||||
AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_NO_RESTRICTIONS = 3
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_NONE = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_KEY = 1,
|
||||
AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_INTRA_ONLY = 2,
|
||||
AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_SWITCH = 3,
|
||||
AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_SHOW_EXISTING = 4
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_KEY = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_INTRA_ONLY = 1,
|
||||
AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_INTER = 2,
|
||||
AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_SWITCH = 3,
|
||||
AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_SHOW_EXISTING = 4
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_HIGH_QUALITY = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_QUALITY = 30,
|
||||
AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_BALANCED = 70,
|
||||
AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_SPEED = 100
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_NONE = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_GOP_ALIGNED = 1,
|
||||
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_KEY_FRAME_ALIGNED = 2,
|
||||
AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_SUPPRESSED = 3
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE_NONE = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE_FIXED_INTERVAL = 1
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_CDEF_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_CDEF_DISABLE = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_CDEF_ENABLE_DEFAULT = 1
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_CDF_FRAME_END_UPDATE_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_CDF_FRAME_END_UPDATE_MODE_DISABLE = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_CDF_FRAME_END_UPDATE_MODE_ENABLE_DEFAULT = 1
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_AQ_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_AQ_MODE_NONE = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_AQ_MODE_CAQ = 1 // Content adaptive quantization mode
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE__DISABLED = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE__GOP_ALIGNED = 1,
|
||||
AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE__CONTINUOUS = 2
|
||||
};
|
||||
enum AMF_VIDEO_ENCODER_AV1_LTR_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_LTR_MODE_RESET_UNUSED = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_LTR_MODE_KEEP_UNUSED = 1
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_OUTPUT_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_OUTPUT_MODE_FRAME = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_OUTPUT_MODE_TILE = 1
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_AV1_OUTPUT_BUFFER_TYPE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_AV1_OUTPUT_BUFFER_TYPE_FRAME = 0,
|
||||
AMF_VIDEO_ENCODER_AV1_OUTPUT_BUFFER_TYPE_TILE = 1,
|
||||
AMF_VIDEO_ENCODER_AV1_OUTPUT_BUFFER_TYPE_TILE_LAST = 2
|
||||
};
|
||||
// *** Static properties - can be set only before Init() ***
|
||||
|
||||
// Encoder Engine Settings
|
||||
#define AMF_VIDEO_ENCODER_AV1_ENCODER_INSTANCE_INDEX L"Av1EncoderInstanceIndex" // amf_int64; default = 0; selected HW instance idx. The number of instances is queried by using AMF_VIDEO_ENCODER_AV1_CAP_NUM_OF_HW_INSTANCES
|
||||
#define AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE L"Av1EncodingLatencyMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_ENUM); default = depends on USAGE; The encoding latency mode.
|
||||
#define AMF_VIDEO_ENCODER_AV1_QUERY_TIMEOUT L"Av1QueryTimeout" // amf_int64; default = 0 (no wait); timeout for QueryOutput call in ms.
|
||||
|
||||
// Usage Settings
|
||||
#define AMF_VIDEO_ENCODER_AV1_USAGE L"Av1Usage" // amf_int64(AMF_VIDEO_ENCODER_AV1_USAGE_ENUM); default = N/A; Encoder usage. fully configures parameter set.
|
||||
|
||||
// Session Configuration
|
||||
#define AMF_VIDEO_ENCODER_AV1_FRAMESIZE L"Av1FrameSize" // AMFSize; default = 0,0; Frame size
|
||||
#define AMF_VIDEO_ENCODER_AV1_COLOR_BIT_DEPTH L"Av1ColorBitDepth" // amf_int64(AMF_COLOR_BIT_DEPTH_ENUM); default = AMF_COLOR_BIT_DEPTH_8
|
||||
#define AMF_VIDEO_ENCODER_AV1_PROFILE L"Av1Profile" // amf_int64(AMF_VIDEO_ENCODER_AV1_PROFILE_ENUM) ; default = depends on USAGE; the codec profile of the coded bitstream
|
||||
#define AMF_VIDEO_ENCODER_AV1_LEVEL L"Av1Level" // amf_int64 (AMF_VIDEO_ENCODER_AV1_LEVEL_ENUM); default = depends on USAGE; the codec level of the coded bitstream
|
||||
#define AMF_VIDEO_ENCODER_AV1_TILES_PER_FRAME L"Av1NumTilesPerFrame" // amf_int64; default = 1; Number of tiles Per Frame. This is treated as suggestion. The actual number of tiles might be different due to compliance or encoder limitation.
|
||||
#define AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET L"Av1QualityPreset" // amf_int64(AMF_VIDEO_ENCODER_AV1_QUALITY_PRESET_ENUM); default = depends on USAGE; Quality Preset
|
||||
|
||||
// Codec Configuration
|
||||
#define AMF_VIDEO_ENCODER_AV1_SCREEN_CONTENT_TOOLS L"Av1ScreenContentTools" // bool; default = true; If true, allow enabling screen content tools by AMF_VIDEO_ENCODER_AV1_PALETTE_MODE and AMF_VIDEO_ENCODER_AV1_FORCE_INTEGER_MV; if false, all screen content tools are disabled.
|
||||
#define AMF_VIDEO_ENCODER_AV1_ORDER_HINT L"Av1OrderHint" // bool; default = depends on USAGE; If true, code order hint; if false, don't code order hint
|
||||
#define AMF_VIDEO_ENCODER_AV1_FRAME_ID L"Av1FrameId" // bool; default = depends on USAGE; If true, code frame id; if false, don't code frame id
|
||||
#define AMF_VIDEO_ENCODER_AV1_TILE_GROUP_OBU L"Av1TileGroupObu" // bool; default = depends on USAGE; If true, code FrameHeaderObu + TileGroupObu and each TileGroupObu contains one tile; if false, code FrameObu.
|
||||
#define AMF_VIDEO_ENCODER_AV1_CDEF_MODE L"Av1CdefMode" // amd_int64(AMF_VIDEO_ENCODER_AV1_CDEF_MODE_ENUM); default = depends on USAGE; Cdef mode
|
||||
#define AMF_VIDEO_ENCODER_AV1_ERROR_RESILIENT_MODE L"Av1ErrorResilientMode" // bool; default = depends on USAGE; If true, enable error resilient mode; if false, disable error resilient mode
|
||||
|
||||
// Rate Control and Quality Enhancement
|
||||
#define AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD L"Av1RateControlMethod" // amf_int64(AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_ENUM); default = depends on USAGE; Rate Control Method
|
||||
#define AMF_VIDEO_ENCODER_AV1_QVBR_QUALITY_LEVEL L"Av1QvbrQualityLevel" // amf_int64; default = 23; QVBR quality level; range = 1-51
|
||||
#define AMF_VIDEO_ENCODER_AV1_INITIAL_VBV_BUFFER_FULLNESS L"Av1InitialVBVBufferFullness" // amf_int64; default = depends on USAGE; Initial VBV Buffer Fullness 0=0% 64=100%
|
||||
|
||||
// Alignment Mode Configuration
|
||||
#define AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE L"Av1AlignmentMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_ENUM); default = AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_64X16_ONLY; Alignment Mode.
|
||||
|
||||
#define AMF_VIDEO_ENCODER_AV1_PRE_ANALYSIS_ENABLE L"Av1EnablePreAnalysis" // bool; default = depends on USAGE; If true, enables the pre-analysis module. Refer to AMF Video PreAnalysis API reference for more details. If false, disable the pre-analysis module.
|
||||
#define AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_PREENCODE L"Av1RateControlPreEncode" // bool; default = depends on USAGE; If true, enables pre-encode assist in rate control; if false, disables pre-encode assist in rate control.
|
||||
#define AMF_VIDEO_ENCODER_AV1_HIGH_MOTION_QUALITY_BOOST L"Av1HighMotionQualityBoost" // bool; default = depends on USAGE; If true, enable high motion quality boost mode; if false, disable high motion quality boost mode.
|
||||
#define AMF_VIDEO_ENCODER_AV1_AQ_MODE L"Av1AQMode" // amd_int64(AMF_VIDEO_ENCODER_AV1_AQ_MODE_ENUM); default = depends on USAGE; AQ mode
|
||||
|
||||
// Picture Management Configuration
|
||||
#define AMF_VIDEO_ENCODER_AV1_MAX_NUM_TEMPORAL_LAYERS L"Av1MaxNumOfTemporalLayers" // amf_int64; default = depends on USAGE; Max number of temporal layers might be enabled. The maximum value can be queried from AMF_VIDEO_ENCODER_AV1_CAP_MAX_NUM_TEMPORAL_LAYERS
|
||||
#define AMF_VIDEO_ENCODER_AV1_MAX_LTR_FRAMES L"Av1MaxNumLTRFrames" // amf_int64; default = depends on USAGE; Max number of LTR frames. The maximum value can be queried from AMF_VIDEO_ENCODER_AV1_CAP_MAX_NUM_LTR_FRAMES
|
||||
#define AMF_VIDEO_ENCODER_AV1_LTR_MODE L"Av1LTRMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_LTR_MODE_ENUM); default = AMF_VIDEO_ENCODER_AV1_LTR_MODE_RESET_UNUSED; remove/keep unused LTRs (not specified in property AMF_VIDEO_ENCODER_AV1_FORCE_LTR_REFERENCE_BITFIELD)
|
||||
#define AMF_VIDEO_ENCODER_AV1_MAX_NUM_REFRAMES L"Av1MaxNumRefFrames" // amf_int64; default = 1; Maximum number of reference frames
|
||||
|
||||
// color conversion
|
||||
#define AMF_VIDEO_ENCODER_AV1_INPUT_HDR_METADATA L"Av1InHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL
|
||||
|
||||
// Miscellaneous
|
||||
#define AMF_VIDEO_ENCODER_AV1_EXTRA_DATA L"Av1ExtraData" // AMFInterface* - > AMFBuffer*; buffer to retrieve coded sequence header
|
||||
#define AMF_VIDEO_ENCODER_AV1_ENABLE_SMART_ACCESS_VIDEO L"Av1EnableEncoderSmartAccessVideo" // amf_bool; default = false; true = enables smart access video feature
|
||||
#define AMF_VIDEO_ENCODER_AV1_INPUT_QUEUE_SIZE L"Av1InputQueueSize" // amf_int64; default 16; Set amf input queue size
|
||||
|
||||
// Tile Output
|
||||
#define AMF_VIDEO_ENCODER_AV1_OUTPUT_MODE L"AV1OutputMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_OUTPUT_MODE_ENUM); default = AMF_VIDEO_ENCODER_AV1_OUTPUT_MODE_FRAME - defines encoder output mode
|
||||
|
||||
// *** Dynamic properties - can be set anytime ***
|
||||
|
||||
// Codec Configuration
|
||||
#define AMF_VIDEO_ENCODER_AV1_PALETTE_MODE L"Av1PaletteMode" // bool; default = true; If true, enable palette mode; if false, disable palette mode. Valid only when AMF_VIDEO_ENCODER_AV1_SCREEN_CONTENT_TOOLS is true.
|
||||
#define AMF_VIDEO_ENCODER_AV1_FORCE_INTEGER_MV L"Av1ForceIntegerMv" // bool; default = false; If true, enable force integer MV; if false, disable force integer MV. Valid only when AMF_VIDEO_ENCODER_AV1_SCREEN_CONTENT_TOOLS is true.
|
||||
#define AMF_VIDEO_ENCODER_AV1_CDF_UPDATE L"Av1CdfUpdate" // bool; default = depends on USAGE; If true, enable CDF update; if false, disable CDF update.
|
||||
#define AMF_VIDEO_ENCODER_AV1_CDF_FRAME_END_UPDATE_MODE L"Av1CdfFrameEndUpdateMode" // amd_int64(AMF_VIDEO_ENCODER_AV1_CDF_FRAME_END_UPDATE_MODE_ENUM); default = depends on USAGE; CDF frame end update mode
|
||||
|
||||
|
||||
// Rate Control and Quality Enhancement
|
||||
#define AMF_VIDEO_ENCODER_AV1_VBV_BUFFER_SIZE L"Av1VBVBufferSize" // amf_int64; default = depends on USAGE; VBV Buffer Size in bits
|
||||
#define AMF_VIDEO_ENCODER_AV1_FRAMERATE L"Av1FrameRate" // AMFRate; default = depends on usage; Frame Rate
|
||||
#define AMF_VIDEO_ENCODER_AV1_ENFORCE_HRD L"Av1EnforceHRD" // bool; default = depends on USAGE; If true, enforce HRD; if false, HRD is not enforced.
|
||||
#define AMF_VIDEO_ENCODER_AV1_FILLER_DATA L"Av1FillerData" // bool; default = depends on USAGE; If true, code filler data when needed; if false, don't code filler data.
|
||||
#define AMF_VIDEO_ENCODER_AV1_TARGET_BITRATE L"Av1TargetBitrate" // amf_int64; default = depends on USAGE; Target bit rate in bits
|
||||
#define AMF_VIDEO_ENCODER_AV1_PEAK_BITRATE L"Av1PeakBitrate" // amf_int64; default = depends on USAGE; Peak bit rate in bits
|
||||
|
||||
#define AMF_VIDEO_ENCODER_AV1_MAX_COMPRESSED_FRAME_SIZE L"Av1MaxCompressedFrameSize" // amf_int64; default = 0; Max compressed frame Size in bits. 0 - no limit
|
||||
#define AMF_VIDEO_ENCODER_AV1_MIN_Q_INDEX_INTRA L"Av1MinQIndex_Intra" // amf_int64; default = depends on USAGE; Min QIndex for intra frames; range = 1-255
|
||||
#define AMF_VIDEO_ENCODER_AV1_MAX_Q_INDEX_INTRA L"Av1MaxQIndex_Intra" // amf_int64; default = depends on USAGE; Max QIndex for intra frames; range = 1-255
|
||||
#define AMF_VIDEO_ENCODER_AV1_MIN_Q_INDEX_INTER L"Av1MinQIndex_Inter" // amf_int64; default = depends on USAGE; Min QIndex for inter frames; range = 1-255
|
||||
#define AMF_VIDEO_ENCODER_AV1_MAX_Q_INDEX_INTER L"Av1MaxQIndex_Inter" // amf_int64; default = depends on USAGE; Max QIndex for inter frames; range = 1-255
|
||||
|
||||
#define AMF_VIDEO_ENCODER_AV1_Q_INDEX_INTRA L"Av1QIndex_Intra" // amf_int64; default = depends on USAGE; intra-frame QIndex; range = 1-255
|
||||
#define AMF_VIDEO_ENCODER_AV1_Q_INDEX_INTER L"Av1QIndex_Inter" // amf_int64; default = depends on USAGE; inter-frame QIndex; range = 1-255
|
||||
|
||||
#define AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_SKIP_FRAME L"Av1RateControlSkipFrameEnable" // bool; default = depends on USAGE; If true, rate control may code skip frame when needed; if false, rate control will not code skip frame.
|
||||
|
||||
|
||||
// Picture Management Configuration
|
||||
#define AMF_VIDEO_ENCODER_AV1_GOP_SIZE L"Av1GOPSize" // amf_int64; default = depends on USAGE; GOP Size (distance between automatically inserted key frames). If 0, key frame will be inserted at first frame only. Note that GOP may be interrupted by AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE.
|
||||
#define AMF_VIDEO_ENCODER_AV1_INTRA_PERIOD L"Av1IntraPeriod" // amf_int64; default = 0; Intra period in frames.
|
||||
#define AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE L"Av1HeaderInsertionMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_HEADER_INSERTION_MODE_ENUM); default = depends on USAGE; sequence header insertion mode
|
||||
#define AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE L"Av1SwitchFrameInsertionMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE_ENUM); default = depends on USAGE; switch frame insertin mode
|
||||
#define AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INTERVAL L"Av1SwitchFrameInterval" // amf_int64; default = depends on USAGE; the interval between two inserted switch frames. Valid only when AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE is AMF_VIDEO_ENCODER_AV1_SWITCH_FRAME_INSERTION_MODE_FIXED_INTERVAL.
|
||||
#define AMF_VIDEO_ENCODER_AV1_NUM_TEMPORAL_LAYERS L"Av1NumTemporalLayers" // amf_int64; default = depends on USAGE; Number of temporal layers. Can be changed at any time but the change is only applied when encoding next base layer frame.
|
||||
|
||||
#define AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE L"Av1IntraRefreshMode" // amf_int64(AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE_ENUM); default AMF_VIDEO_ENCODER_AV1_INTRA_REFRESH_MODE__DISABLED
|
||||
#define AMF_VIDEO_ENCODER_AV1_INTRAREFRESH_STRIPES L"Av1IntraRefreshNumOfStripes" // amf_int64; default = N/A; Valid only when intra refresh is enabled.
|
||||
|
||||
// color conversion
|
||||
#define AMF_VIDEO_ENCODER_AV1_INPUT_COLOR_PROFILE L"Av1InputColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size
|
||||
#define AMF_VIDEO_ENCODER_AV1_INPUT_TRANSFER_CHARACTERISTIC L"Av1InputColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 section 7.2 See VideoDecoderUVD.h for enum
|
||||
#define AMF_VIDEO_ENCODER_AV1_INPUT_COLOR_PRIMARIES L"Av1InputColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 section 7.1 See ColorSpace.h for enum
|
||||
|
||||
#define AMF_VIDEO_ENCODER_AV1_OUTPUT_COLOR_PROFILE L"Av1OutputColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size
|
||||
#define AMF_VIDEO_ENCODER_AV1_OUTPUT_TRANSFER_CHARACTERISTIC L"Av1OutputColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 ?7.2 See VideoDecoderUVD.h for enum
|
||||
#define AMF_VIDEO_ENCODER_AV1_OUTPUT_COLOR_PRIMARIES L"Av1OutputColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 section 7.1 See ColorSpace.h for enum
|
||||
|
||||
|
||||
// Frame encode parameters
|
||||
#define AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE L"Av1ForceFrameType" // amf_int64(AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_ENUM); default = AMF_VIDEO_ENCODER_AV1_FORCE_FRAME_TYPE_NONE; generate particular frame type
|
||||
#define AMF_VIDEO_ENCODER_AV1_FORCE_INSERT_SEQUENCE_HEADER L"Av1ForceInsertSequenceHeader" // bool; default = false; If true, force insert sequence header with current frame;
|
||||
#define AMF_VIDEO_ENCODER_AV1_MARK_CURRENT_WITH_LTR_INDEX L"Av1MarkCurrentWithLTRIndex" // amf_int64; default = N/A; Mark current frame with LTR index
|
||||
#define AMF_VIDEO_ENCODER_AV1_FORCE_LTR_REFERENCE_BITFIELD L"Av1ForceLTRReferenceBitfield" // amf_int64; default = 0; force LTR bit-field
|
||||
#define AMF_VIDEO_ENCODER_AV1_ROI_DATA L"Av1ROIData" // 2D AMFSurface, surface format: AMF_SURFACE_GRAY32; Importance value for each 64x64 block ranges from `0` (least important) to `10` (most important), stored in 32bit unsigned format
|
||||
#define AMF_VIDEO_ENCODER_AV1_PSNR_FEEDBACK L"Av1PSNRFeedback" // amf_bool; default = false; Signal encoder to calculate PSNR score
|
||||
#define AMF_VIDEO_ENCODER_AV1_SSIM_FEEDBACK L"Av1SSIMFeedback" // amf_bool; default = false; Signal encoder to calculate SSIM score
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTICS_FEEDBACK L"Av1StatisticsFeedback" // amf_bool; default = false; Signal encoder to collect and feedback encoder statistics
|
||||
#define AMF_VIDEO_ENCODER_AV1_BLOCK_Q_INDEX_FEEDBACK L"Av1BlockQIndexFeedback" // amf_bool; default = false; Signal encoder to collect and feedback block level QIndex values
|
||||
|
||||
// Encode output parameters
|
||||
#define AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE L"Av1OutputFrameType" // amf_int64(AMF_VIDEO_ENCODER_AV1_OUTPUT_FRAME_TYPE_ENUM); default = N/A
|
||||
#define AMF_VIDEO_ENCODER_AV1_OUTPUT_MARKED_LTR_INDEX L"Av1MarkedLTRIndex" // amf_int64; default = N/A; Marked LTR index
|
||||
#define AMF_VIDEO_ENCODER_AV1_OUTPUT_REFERENCED_LTR_INDEX_BITFIELD L"Av1ReferencedLTRIndexBitfield" // amf_int64; default = N/A; referenced LTR bit-field
|
||||
#define AMF_VIDEO_ENCODER_AV1_OUTPUT_BUFFER_TYPE L"AV1OutputBufferType" // amf_int64(AMF_VIDEO_ENCODER_AV1_OUTPUT_BUFFER_TYPE_ENUM); encoder output buffer type
|
||||
#define AMF_VIDEO_ENCODER_AV1_RECONSTRUCTED_PICTURE L"Av1ReconstructedPicture" // AMFInterface(AMFSurface); returns reconstructed picture as an AMFSurface attached to the output buffer as property AMF_VIDEO_ENCODER_RECONSTRUCTED_PICTURE of AMFInterface type
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_PSNR_Y L"Av1PSNRY" // double; PSNR Y
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_PSNR_U L"Av1PSNRU" // double; PSNR U
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_PSNR_V L"Av1PSNRV" // double; PSNR V
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_PSNR_ALL L"Av1PSNRALL" // double; PSNR All
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_SSIM_Y L"Av1SSIMY" // double; SSIM Y
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_SSIM_U L"Av1SSIMU" // double; SSIM U
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_SSIM_V L"Av1SSIMV" // double; SSIM V
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_SSIM_ALL L"Av1SSIMALL" // double; SSIM ALL
|
||||
// Encoder statistics feedback
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_FRAME_Q_INDEX L"Av1StatisticsFeedbackFrameQIndex" // amf_int64; Rate control base frame/initial QIndex
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_AVERAGE_Q_INDEX L"Av1StatisticsFeedbackAvgQIndex" // amf_int64; Average QIndex of all encoded SBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped SBs.
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_MAX_Q_INDEX L"Av1StatisticsFeedbackMaxQIndex" // amf_int64; Max QIndex among all encoded SBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped SBs.
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_MIN_Q_INDEX L"Av1StatisticsFeedbackMinQIndex" // amf_int64; Min QIndex among all encoded SBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped SBs.
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_PIX_NUM_INTRA L"Av1StatisticsFeedbackPixNumIntra" // amf_int64; Number of the intra encoded pixels
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_PIX_NUM_INTER L"Av1StatisticsFeedbackPixNumInter" // amf_int64; Number of the inter encoded pixels
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_PIX_NUM_SKIP L"Av1StatisticsFeedbackPixNumSkip" // amf_int64; Number of the skip mode pixels
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_BITCOUNT_RESIDUAL L"Av1StatisticsFeedbackBitcountResidual" // amf_int64; The bit count that corresponds to residual data
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_BITCOUNT_MOTION L"Av1StatisticsFeedbackBitcountMotion" // amf_int64; The bit count that corresponds to motion vectors
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_BITCOUNT_INTER L"Av1StatisticsFeedbackBitcountInter" // amf_int64; The bit count that are assigned to inter SBs
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_BITCOUNT_INTRA L"Av1StatisticsFeedbackBitcountIntra" // amf_int64; The bit count that are assigned to intra SBs
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_BITCOUNT_ALL_MINUS_HEADER L"Av1StatisticsFeedbackBitcountAllMinusHeader" // amf_int64; The bit count of the bitstream excluding header
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_MV_X L"Av1StatisticsFeedbackMvX" // amf_int64; Accumulated absolute values of horizontal MV's
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_MV_Y L"Av1StatisticsFeedbackMvY" // amf_int64; Accumulated absolute values of vertical MV's
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_RD_COST_FINAL L"Av1StatisticsFeedbackRdCostFinal" // amf_int64; Frame level final RD cost for full encoding
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_RD_COST_INTRA L"Av1StatisticsFeedbackRdCostIntra" // amf_int64; Frame level intra RD cost for full encoding
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_RD_COST_INTER L"Av1StatisticsFeedbackRdCostInter" // amf_int64; Frame level inter RD cost for full encoding
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_SAD_FINAL L"Av1StatisticsFeedbackSadFinal" // amf_int64; Frame level final SAD for full encoding
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_SAD_INTRA L"Av1StatisticsFeedbackSadIntra" // amf_int64; Frame level intra SAD for full encoding
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_SAD_INTER L"Av1StatisticsFeedbackSadInter" // amf_int64; Frame level inter SAD for full encoding
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_SSE L"Av1StatisticsFeedbackSSE" // amf_int64; Frame level SSE (only calculated for AV1)
|
||||
#define AMF_VIDEO_ENCODER_AV1_STATISTIC_VARIANCE L"Av1StatisticsFeedbackVariance" // amf_int64; Frame level variance for full encoding
|
||||
|
||||
// Encoder block level feedback
|
||||
#define AMF_VIDEO_ENCODER_AV1_BLOCK_Q_INDEX_MAP L"Av1BlockQIndexMap" // AMFInterface(AMFSurface); AMFSurface of format AMF_SURFACE_GRAY32 containing block level QIndex values
|
||||
|
||||
// AV1 Encoder capabilities - exposed in AMFCaps interface
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_NUM_OF_HW_INSTANCES L"Av1CapNumOfHwInstances" // amf_int64; default = N/A; number of HW encoder instances
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_MAX_THROUGHPUT L"Av1CapMaxThroughput" // amf_int64; default = N/A; MAX throughput for AV1 encoder in MB (16 x 16 pixel)
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_REQUESTED_THROUGHPUT L"Av1CapRequestedThroughput" // amf_int64; default = N/A; Currently total requested throughput for AV1 encode in MB (16 x 16 pixel)
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_COLOR_CONVERSION L"Av1CapColorConversion" // amf_int64(AMF_ACCELERATION_TYPE); default = N/A; type of supported color conversion.
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_PRE_ANALYSIS L"Av1PreAnalysis" // amf_bool - pre analysis module is available.
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_MAX_BITRATE L"Av1MaxBitrate" // amf_int64; default = N/A; Maximum bit rate in bits
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_MAX_PROFILE L"Av1MaxProfile" // amf_int64(AMF_VIDEO_ENCODER_AV1_PROFILE_ENUM); default = N/A; max value of code profile
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_MAX_LEVEL L"Av1MaxLevel" // amf_int64(AMF_VIDEO_ENCODER_AV1_LEVEL_ENUM); default = N/A; max value of codec level
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_MAX_NUM_TEMPORAL_LAYERS L"Av1CapMaxNumTemporalLayers" // amf_int64; default = N/A; The cap of maximum number of temporal layers
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_MAX_NUM_LTR_FRAMES L"Av1CapMaxNumLTRFrames" // amf_int64; default = N/A; The cap of maximum number of LTR frames. This value is calculated based on current value of AMF_VIDEO_ENCODER_AV1_MAX_NUM_TEMPORAL_LAYERS.
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_SUPPORT_TILE_OUTPUT L"AV1SupportTileOutput" // amf_bool; if tile output is supported
|
||||
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_SUPPORT_SMART_ACCESS_VIDEO L"Av1EncoderSupportSmartAccessVideo" // amf_bool; returns true if system supports SmartAccess Video
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_WIDTH_ALIGNMENT_FACTOR L"Av1WidthAlignmentFactor" // amf_int64; default = 1; The encoder capability for width alignment
|
||||
#define AMF_VIDEO_ENCODER_AV1_CAP_HEIGHT_ALIGNMENT_FACTOR L"Av1HeightAlignmentFactor" // amf_int64; default = 1; The encoder capability for height alignment
|
||||
|
||||
#define AMF_VIDEO_ENCODER_AV1_MULTI_HW_INSTANCE_ENCODE L"Av1MultiHwInstanceEncode" // amf_bool; flag to enable AV1 multi VCN encode.
|
||||
|
||||
#endif //#ifndef AMF_VideoEncoderAV1_h
|
||||
330
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoEncoderHEVC.h
vendored
Normal file
330
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoEncoderHEVC.h
vendored
Normal file
@@ -0,0 +1,330 @@
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// VideoEncoderHW_HEVC interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef AMF_VideoEncoderHEVC_h
|
||||
#define AMF_VideoEncoderHEVC_h
|
||||
#pragma once
|
||||
|
||||
#include "Component.h"
|
||||
#include "ColorSpace.h"
|
||||
#include "PreAnalysis.h"
|
||||
|
||||
#define AMFVideoEncoder_HEVC L"AMFVideoEncoderHW_HEVC"
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_USAGE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCONDING = 0, // kept for backwards compatability
|
||||
AMF_VIDEO_ENCODER_HEVC_USAGE_TRANSCODING = 0, // fixed typo
|
||||
AMF_VIDEO_ENCODER_HEVC_USAGE_ULTRA_LOW_LATENCY,
|
||||
AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY,
|
||||
AMF_VIDEO_ENCODER_HEVC_USAGE_WEBCAM,
|
||||
AMF_VIDEO_ENCODER_HEVC_USAGE_HIGH_QUALITY,
|
||||
AMF_VIDEO_ENCODER_HEVC_USAGE_LOW_LATENCY_HIGH_QUALITY
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_PROFILE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN = 1,
|
||||
AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN_10 = 2
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_TIER_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_TIER_MAIN = 0,
|
||||
AMF_VIDEO_ENCODER_HEVC_TIER_HIGH = 1
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_LEVEL_ENUM
|
||||
{
|
||||
AMF_LEVEL_1 = 30,
|
||||
AMF_LEVEL_2 = 60,
|
||||
AMF_LEVEL_2_1 = 63,
|
||||
AMF_LEVEL_3 = 90,
|
||||
AMF_LEVEL_3_1 = 93,
|
||||
AMF_LEVEL_4 = 120,
|
||||
AMF_LEVEL_4_1 = 123,
|
||||
AMF_LEVEL_5 = 150,
|
||||
AMF_LEVEL_5_1 = 153,
|
||||
AMF_LEVEL_5_2 = 156,
|
||||
AMF_LEVEL_6 = 180,
|
||||
AMF_LEVEL_6_1 = 183,
|
||||
AMF_LEVEL_6_2 = 186
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_UNKNOWN = -1,
|
||||
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP = 0,
|
||||
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR,
|
||||
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR,
|
||||
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CBR,
|
||||
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_QUALITY_VBR,
|
||||
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_HIGH_QUALITY_VBR,
|
||||
AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_HIGH_QUALITY_CBR
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_NONE = 0,
|
||||
AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_SKIP,
|
||||
AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_IDR,
|
||||
AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_I,
|
||||
AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_P
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_IDR,
|
||||
AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_I,
|
||||
AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_P
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_QUALITY = 0,
|
||||
AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_BALANCED = 5,
|
||||
AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_SPEED = 10
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_NONE = 0,
|
||||
AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_GOP_ALIGNED,
|
||||
AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_IDR_ALIGNED,
|
||||
AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_SUPPRESSED
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_OFF = 0,
|
||||
AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_ON
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE_STUDIO = 0,
|
||||
AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE_FULL = 1
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_LTR_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_LTR_MODE_RESET_UNUSED = 0,
|
||||
AMF_VIDEO_ENCODER_HEVC_LTR_MODE_KEEP_UNUSED
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_OUTPUT_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_OUTPUT_MODE_FRAME = 0,
|
||||
AMF_VIDEO_ENCODER_HEVC_OUTPUT_MODE_SLICE = 1
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_HEVC_OUTPUT_BUFFER_TYPE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_HEVC_OUTPUT_BUFFER_TYPE_FRAME = 0,
|
||||
AMF_VIDEO_ENCODER_HEVC_OUTPUT_BUFFER_TYPE_SLICE = 1,
|
||||
AMF_VIDEO_ENCODER_HEVC_OUTPUT_BUFFER_TYPE_SLICE_LAST = 2
|
||||
};
|
||||
|
||||
// Static properties - can be set before Init()
|
||||
#define AMF_VIDEO_ENCODER_HEVC_INSTANCE_INDEX L"HevcEncoderInstance" // amf_int64; selected instance idx
|
||||
#define AMF_VIDEO_ENCODER_HEVC_FRAMESIZE L"HevcFrameSize" // AMFSize; default = 0,0; Frame size
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_USAGE L"HevcUsage" // amf_int64(AMF_VIDEO_ENCODER_HEVC_USAGE_ENUM); default = N/A; Encoder usage type. fully configures parameter set.
|
||||
#define AMF_VIDEO_ENCODER_HEVC_PROFILE L"HevcProfile" // amf_int64(AMF_VIDEO_ENCODER_HEVC_PROFILE_ENUM) ; default = AMF_VIDEO_ENCODER_HEVC_PROFILE_MAIN;
|
||||
#define AMF_VIDEO_ENCODER_HEVC_TIER L"HevcTier" // amf_int64(AMF_VIDEO_ENCODER_HEVC_TIER_ENUM) ; default = AMF_VIDEO_ENCODER_HEVC_TIER_MAIN;
|
||||
#define AMF_VIDEO_ENCODER_HEVC_PROFILE_LEVEL L"HevcProfileLevel" // amf_int64 (AMF_VIDEO_ENCODER_LEVEL_ENUM, default depends on HW capabilities);
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MAX_LTR_FRAMES L"HevcMaxOfLTRFrames" // amf_int64; default = 0; Max number of LTR frames
|
||||
#define AMF_VIDEO_ENCODER_HEVC_LTR_MODE L"HevcLTRMode" // amf_int64(AMF_VIDEO_ENCODER_HEVC_LTR_MODE_ENUM); default = AMF_VIDEO_ENCODER_HEVC_LTR_MODE_RESET_UNUSED; remove/keep unused LTRs (not specified in property AMF_VIDEO_ENCODER_HEVC_FORCE_LTR_REFERENCE_BITFIELD)
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MAX_NUM_REFRAMES L"HevcMaxNumRefFrames" // amf_int64; default = 1; Maximum number of reference frames
|
||||
#define AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET L"HevcQualityPreset" // amf_int64(AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_ENUM); default = depends on USAGE; Quality Preset
|
||||
#define AMF_VIDEO_ENCODER_HEVC_EXTRADATA L"HevcExtraData" // AMFInterface* - > AMFBuffer*; SPS/PPS buffer - read-only
|
||||
#define AMF_VIDEO_ENCODER_HEVC_ASPECT_RATIO L"HevcAspectRatio" // AMFRatio; default = 1, 1
|
||||
#define AMF_VIDEO_ENCODER_HEVC_LOWLATENCY_MODE L"LowLatencyInternal" // bool; default = false, enables low latency mode
|
||||
#define AMF_VIDEO_ENCODER_HEVC_PRE_ANALYSIS_ENABLE L"HevcEnablePreAnalysis" // bool; default = false; enables the pre-analysis module. Currently only works in AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR mode. Refer to AMF Video PreAnalysis API reference for more details.
|
||||
#define AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE L"HevcNominalRange" // amf_int64(AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE); default = amf_int64(AMF_VIDEO_ENCODER_HEVC_NOMINAL_RANGE_STUDIO); property is bool but amf_int64 also works for backward compatibility.
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MAX_NUM_TEMPORAL_LAYERS L"HevcMaxNumOfTemporalLayers" // amf_int64; default = 1; Max number of temporal layers.
|
||||
|
||||
// Picture control properties
|
||||
#define AMF_VIDEO_ENCODER_HEVC_NUM_GOPS_PER_IDR L"HevcGOPSPerIDR" // amf_int64; default = 1; The frequency to insert IDR as start of a GOP. 0 means no IDR will be inserted.
|
||||
#define AMF_VIDEO_ENCODER_HEVC_GOP_SIZE L"HevcGOPSize" // amf_int64; default = 60; GOP Size, in frames
|
||||
#define AMF_VIDEO_ENCODER_HEVC_DE_BLOCKING_FILTER_DISABLE L"HevcDeBlockingFilter" // bool; default = depends on USAGE; De-blocking Filter
|
||||
#define AMF_VIDEO_ENCODER_HEVC_SLICES_PER_FRAME L"HevcSlicesPerFrame" // amf_int64; default = 1; Number of slices Per Frame
|
||||
#define AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE L"HevcHeaderInsertionMode" // amf_int64(AMF_VIDEO_ENCODER_HEVC_HEADER_INSERTION_MODE_ENUM); default = NONE
|
||||
#define AMF_VIDEO_ENCODER_HEVC_INTRA_REFRESH_NUM_CTBS_PER_SLOT L"HevcIntraRefreshCTBsNumberPerSlot" // amf_int64; default = depends on USAGE; Intra Refresh CTBs Number Per Slot in 64x64 CTB
|
||||
|
||||
// Rate control properties
|
||||
#define AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD L"HevcRateControlMethod" // amf_int64(AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_ENUM); default = depends on USAGE; Rate Control Method
|
||||
#define AMF_VIDEO_ENCODER_HEVC_QVBR_QUALITY_LEVEL L"HevcQvbrQualityLevel" // amf_int64; default = 23; QVBR quality level; range = 1-51
|
||||
#define AMF_VIDEO_ENCODER_HEVC_VBV_BUFFER_SIZE L"HevcVBVBufferSize" // amf_int64; default = depends on USAGE; VBV Buffer Size in bits
|
||||
#define AMF_VIDEO_ENCODER_HEVC_INITIAL_VBV_BUFFER_FULLNESS L"HevcInitialVBVBufferFullness" // amf_int64; default = 64; Initial VBV Buffer Fullness 0=0% 64=100%
|
||||
#define AMF_VIDEO_ENCODER_HEVC_ENABLE_VBAQ L"HevcEnableVBAQ" // // bool; default = depends on USAGE; Enable auto VBAQ
|
||||
#define AMF_VIDEO_ENCODER_HEVC_HIGH_MOTION_QUALITY_BOOST_ENABLE L"HevcHighMotionQualityBoostEnable"// bool; default = depends on USAGE; Enable High motion quality boost mode
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_PREENCODE_ENABLE L"HevcRateControlPreAnalysisEnable" // bool; default = depends on USAGE; enables pre-encode assisted rate control
|
||||
#define AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_PREANALYSIS_ENABLE L"HevcRateControlPreAnalysisEnable" // bool; default = depends on USAGE; enables pre-encode assisted rate control. Deprecated, please use AMF_VIDEO_ENCODER_HEVC_PREENCODE_ENABLE instead.
|
||||
#ifdef _MSC_VER
|
||||
#ifndef __clang__
|
||||
#pragma deprecated("AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_PREANALYSIS_ENABLE")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Motion estimation
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MOTION_HALF_PIXEL L"HevcHalfPixel" // bool; default= true; Half Pixel
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MOTION_QUARTERPIXEL L"HevcQuarterPixel" // bool; default= true; Quarter Pixel
|
||||
|
||||
// color conversion
|
||||
#define AMF_VIDEO_ENCODER_HEVC_COLOR_BIT_DEPTH L"HevcColorBitDepth" // amf_int64(AMF_COLOR_BIT_DEPTH_ENUM); default = AMF_COLOR_BIT_DEPTH_8
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_INPUT_COLOR_PROFILE L"HevcInColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size
|
||||
#define AMF_VIDEO_ENCODER_HEVC_INPUT_TRANSFER_CHARACTERISTIC L"HevcInColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 section 7.2 See VideoDecoderUVD.h for enum
|
||||
#define AMF_VIDEO_ENCODER_HEVC_INPUT_COLOR_PRIMARIES L"HevcInColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 section 7.1 See ColorSpace.h for enum
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PROFILE L"HevcOutColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size
|
||||
#define AMF_VIDEO_ENCODER_HEVC_OUTPUT_TRANSFER_CHARACTERISTIC L"HevcOutColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 ?7.2 See VideoDecoderUVD.h for enum
|
||||
#define AMF_VIDEO_ENCODER_HEVC_OUTPUT_COLOR_PRIMARIES L"HevcOutColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 section 7.1 See ColorSpace.h for enum
|
||||
|
||||
// Slice output
|
||||
#define AMF_VIDEO_ENCODER_HEVC_OUTPUT_MODE L"HevcOutputMode" // amf_int64(AMF_VIDEO_ENCODER_HEVC_OUTPUT_MODE_ENUM); default = AMF_VIDEO_ENCODER_HEVC_OUTPUT_MODE_FRAME - defines encoder output mode
|
||||
|
||||
// Dynamic properties - can be set at any time
|
||||
|
||||
// Rate control properties
|
||||
#define AMF_VIDEO_ENCODER_HEVC_FRAMERATE L"HevcFrameRate" // AMFRate; default = depends on usage; Frame Rate
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_ENFORCE_HRD L"HevcEnforceHRD" // bool; default = depends on USAGE; Enforce HRD
|
||||
#define AMF_VIDEO_ENCODER_HEVC_FILLER_DATA_ENABLE L"HevcFillerDataEnable" // bool; default = depends on USAGE; Enforce HRD
|
||||
#define AMF_VIDEO_ENCODER_HEVC_TARGET_BITRATE L"HevcTargetBitrate" // amf_int64; default = depends on USAGE; Target bit rate in bits
|
||||
#define AMF_VIDEO_ENCODER_HEVC_PEAK_BITRATE L"HevcPeakBitrate" // amf_int64; default = depends on USAGE; Peak bit rate in bits
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MAX_AU_SIZE L"HevcMaxAUSize" // amf_int64; default = 60; Max AU Size in bits
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MIN_QP_I L"HevcMinQP_I" // amf_int64; default = depends on USAGE; Min QP; range =
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MAX_QP_I L"HevcMaxQP_I" // amf_int64; default = depends on USAGE; Max QP; range =
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MIN_QP_P L"HevcMinQP_P" // amf_int64; default = depends on USAGE; Min QP; range =
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MAX_QP_P L"HevcMaxQP_P" // amf_int64; default = depends on USAGE; Max QP; range =
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_QP_I L"HevcQP_I" // amf_int64; default = 26; P-frame QP; range = 0-51
|
||||
#define AMF_VIDEO_ENCODER_HEVC_QP_P L"HevcQP_P" // amf_int64; default = 26; P-frame QP; range = 0-51
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_SKIP_FRAME_ENABLE L"HevcRateControlSkipFrameEnable" // bool; default = depends on USAGE; Rate Control Based Frame Skip
|
||||
|
||||
// color conversion
|
||||
#define AMF_VIDEO_ENCODER_HEVC_INPUT_HDR_METADATA L"HevcInHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL
|
||||
//#define AMF_VIDEO_ENCODER_HEVC_OUTPUT_HDR_METADATA L"HevcOutHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL
|
||||
|
||||
// SVC
|
||||
#define AMF_VIDEO_ENCODER_HEVC_NUM_TEMPORAL_LAYERS L"HevcNumOfTemporalLayers" // amf_int64; default = 1; Number of temporal layers. Can be changed at any time but the change is only applied when encoding next base layer frame.
|
||||
|
||||
// DPB management
|
||||
#define AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE L"HevcPicTransferMode" // amf_int64(AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_ENUM); default = AMF_VIDEO_ENCODER_HEVC_PICTURE_TRANSFER_MODE_OFF - whether to exchange reference/reconstructed pic between encoder and application
|
||||
|
||||
// misc
|
||||
#define AMF_VIDEO_ENCODER_HEVC_QUERY_TIMEOUT L"HevcQueryTimeout" // amf_int64; default = 0 (no wait); timeout for QueryOutput call in ms.
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MEMORY_TYPE L"HevcEncoderMemoryType" // amf_int64(AMF_MEMORY_TYPE) , default is AMF_MEMORY_UNKNOWN, Values : AMF_MEMORY_DX11, AMF_MEMORY_DX9, AMF_MEMORY_UNKNOWN (auto)
|
||||
#define AMF_VIDEO_ENCODER_HEVC_ENABLE_SMART_ACCESS_VIDEO L"HevcEnableEncoderSmartAccessVideo" // amf_bool; default = false; true = enables smart access video feature
|
||||
#define AMF_VIDEO_ENCODER_HEVC_INPUT_QUEUE_SIZE L"HevcInputQueueSize" // amf_int64; default 16; Set amf input queue size
|
||||
|
||||
// Per-submission properties - can be set on input surface interface
|
||||
#define AMF_VIDEO_ENCODER_HEVC_END_OF_SEQUENCE L"HevcEndOfSequence" // bool; default = false; generate end of sequence
|
||||
#define AMF_VIDEO_ENCODER_HEVC_FORCE_PICTURE_TYPE L"HevcForcePictureType" // amf_int64(AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_ENUM); default = AMF_VIDEO_ENCODER_HEVC_PICTURE_TYPE_NONE; generate particular picture type
|
||||
#define AMF_VIDEO_ENCODER_HEVC_INSERT_AUD L"HevcInsertAUD" // bool; default = false; insert AUD
|
||||
#define AMF_VIDEO_ENCODER_HEVC_INSERT_HEADER L"HevcInsertHeader" // bool; default = false; insert header(SPS, PPS, VPS)
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MARK_CURRENT_WITH_LTR_INDEX L"HevcMarkCurrentWithLTRIndex" // amf_int64; default = N/A; Mark current frame with LTR index
|
||||
#define AMF_VIDEO_ENCODER_HEVC_FORCE_LTR_REFERENCE_BITFIELD L"HevcForceLTRReferenceBitfield"// amf_int64; default = 0; force LTR bit-field
|
||||
#define AMF_VIDEO_ENCODER_HEVC_ROI_DATA L"HevcROIData" // 2D AMFSurface, surface format: AMF_SURFACE_GRAY32; Importance value for each 64x64 block ranges from `0` (least important) to `10` (most important), stored in 32bit unsigned format.
|
||||
#define AMF_VIDEO_ENCODER_HEVC_REFERENCE_PICTURE L"HevcReferencePicture" // AMFInterface(AMFSurface); surface used for frame injection
|
||||
#define AMF_VIDEO_ENCODER_HEVC_PSNR_FEEDBACK L"HevcPSNRFeedback" // amf_bool; default = false; Signal encoder to calculate PSNR score
|
||||
#define AMF_VIDEO_ENCODER_HEVC_SSIM_FEEDBACK L"HevcSSIMFeedback" // amf_bool; default = false; Signal encoder to calculate SSIM score
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTICS_FEEDBACK L"HevcStatisticsFeedback" // amf_bool; default = false; Signal encoder to collect and feedback encoder statistics
|
||||
#define AMF_VIDEO_ENCODER_HEVC_BLOCK_QP_FEEDBACK L"HevcBlockQpFeedback" // amf_bool; default = false; Signal encoder to collect and feedback block level QP values
|
||||
|
||||
// Properties set by encoder on output buffer interface
|
||||
#define AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE L"HevcOutputDataType" // amf_int64(AMF_VIDEO_ENCODER_HEVC_OUTPUT_DATA_TYPE_ENUM); default = N/A
|
||||
#define AMF_VIDEO_ENCODER_HEVC_OUTPUT_MARKED_LTR_INDEX L"HevcMarkedLTRIndex" // amf_int64; default = -1; Marked LTR index
|
||||
#define AMF_VIDEO_ENCODER_HEVC_OUTPUT_REFERENCED_LTR_INDEX_BITFIELD L"HevcReferencedLTRIndexBitfield"// amf_int64; default = 0; referenced LTR bit-field
|
||||
#define AMF_VIDEO_ENCODER_HEVC_OUTPUT_TEMPORAL_LAYER L"HevcOutputTemporalLayer" // amf_int64; Temporal layer
|
||||
#define AMF_VIDEO_ENCODER_HEVC_OUTPUT_BUFFER_TYPE L"HevcOutputBufferType" // amf_int64(AMF_VIDEO_ENCODER_HEVC_OUTPUT_BUFFER_TYPE_ENUM); encoder output buffer type
|
||||
#define AMF_VIDEO_ENCODER_HEVC_RECONSTRUCTED_PICTURE L"HevcReconstructedPicture" // AMFInterface(AMFSurface); returns reconstructed picture as an AMFSurface attached to the output buffer as property AMF_VIDEO_ENCODER_RECONSTRUCTED_PICTURE of AMFInterface type
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PSNR_Y L"PSNRY" // double; PSNR Y
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PSNR_U L"PSNRU" // double; PSNR U
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PSNR_V L"PSNRV" // double; PSNR V
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PSNR_ALL L"PSNRALL" // double; PSNR All
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SSIM_Y L"SSIMY" // double; SSIM Y
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SSIM_U L"SSIMU" // double; SSIM U
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SSIM_V L"SSIMV" // double; SSIM V
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SSIM_ALL L"SSIMALL" // double; SSIM ALL
|
||||
|
||||
// Encoder statistics feedback
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_FRAME_QP L"HevcStatisticsFeedbackFrameQP" // amf_int64; Rate control base frame/initial QP
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_AVERAGE_QP L"HevcStatisticsFeedbackAvgQP" // amf_int64; Average QP of all encoded CTBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped CTBs.
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_MAX_QP L"HevcStatisticsFeedbackMaxQP" // amf_int64; Max QP among all encoded CTBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped CTBs.
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_MIN_QP L"HevcStatisticsFeedbackMinQP" // amf_int64; Min QP among all encoded CTBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped CTBs.
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PIX_NUM_INTRA L"HevcStatisticsFeedbackPixNumIntra" // amf_int64; Number of the intra encoded pixels
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PIX_NUM_INTER L"HevcStatisticsFeedbackPixNumInter" // amf_int64; Number of the inter encoded pixels
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_PIX_NUM_SKIP L"HevcStatisticsFeedbackPixNumSkip" // amf_int64; Number of the skip mode pixels
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_BITCOUNT_RESIDUAL L"HevcStatisticsFeedbackBitcountResidual" // amf_int64; The bit count that corresponds to residual data
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_BITCOUNT_MOTION L"HevcStatisticsFeedbackBitcountMotion" // amf_int64; The bit count that corresponds to motion vectors
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_BITCOUNT_INTER L"HevcStatisticsFeedbackBitcountInter" // amf_int64; The bit count that are assigned to inter CTBs
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_BITCOUNT_INTRA L"HevcStatisticsFeedbackBitcountIntra" // amf_int64; The bit count that are assigned to intra CTBs
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_BITCOUNT_ALL_MINUS_HEADER L"HevcStatisticsFeedbackBitcountAllMinusHeader" // amf_int64; The bit count of the bitstream excluding header
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_MV_X L"HevcStatisticsFeedbackMvX" // amf_int64; Accumulated absolute values of horizontal MV's
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_MV_Y L"HevcStatisticsFeedbackMvY" // amf_int64; Accumulated absolute values of vertical MV's
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_RD_COST_FINAL L"HevcStatisticsFeedbackRdCostFinal" // amf_int64; Frame level final RD cost for full encoding
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_RD_COST_INTRA L"HevcStatisticsFeedbackRdCostIntra" // amf_int64; Frame level intra RD cost for full encoding
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_RD_COST_INTER L"HevcStatisticsFeedbackRdCostInter" // amf_int64; Frame level inter RD cost for full encoding
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SAD_FINAL L"HevcStatisticsFeedbackSadFinal" // amf_int64; Frame level final SAD for full encoding
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SAD_INTRA L"HevcStatisticsFeedbackSadIntra" // amf_int64; Frame level intra SAD for full encoding
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_SAD_INTER L"HevcStatisticsFeedbackSadInter" // amf_int64; Frame level inter SAD for full encoding
|
||||
#define AMF_VIDEO_ENCODER_HEVC_STATISTIC_VARIANCE L"HevcStatisticsFeedbackVariance" // amf_int64; Frame level variance for full encoding
|
||||
|
||||
// Encoder block level feedback
|
||||
#define AMF_VIDEO_ENCODER_HEVC_BLOCK_QP_MAP L"HevcBlockQpMap" // AMFInterface(AMFSurface); AMFSurface of format AMF_SURFACE_GRAY32 containing block level QP values
|
||||
|
||||
// HEVC Encoder capabilities - exposed in AMFCaps interface
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_BITRATE L"HevcMaxBitrate" // amf_int64; Maximum bit rate in bits
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_NUM_OF_STREAMS L"HevcNumOfStreams" // amf_int64; maximum number of encode streams supported
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_PROFILE L"HevcMaxProfile" // amf_int64(AMF_VIDEO_ENCODER_HEVC_PROFILE_ENUM)
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_TIER L"HevcMaxTier" // amf_int64(AMF_VIDEO_ENCODER_HEVC_TIER_ENUM) maximum profile tier
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_LEVEL L"HevcMaxLevel" // amf_int64 maximum profile level
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_MIN_REFERENCE_FRAMES L"HevcMinReferenceFrames" // amf_int64 minimum number of reference frames
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_REFERENCE_FRAMES L"HevcMaxReferenceFrames" // amf_int64 maximum number of reference frames
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_TEMPORAL_LAYERS L"HevcMaxTemporalLayers" // amf_int64 maximum number of temporal layers
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_NUM_OF_HW_INSTANCES L"HevcNumOfHwInstances" // amf_int64 number of HW encoder instances
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_COLOR_CONVERSION L"HevcColorConversion" // amf_int64(AMF_ACCELERATION_TYPE) - type of supported color conversion. default AMF_ACCEL_GPU
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_PRE_ANALYSIS L"HevcPreAnalysis" // amf_bool - pre analysis module is available.
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_ROI L"HevcROIMap" // amf_bool - ROI map support is available.
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_MAX_THROUGHPUT L"HevcMaxThroughput" // amf_int64 - MAX throughput for HEVC encoder in MB (16 x 16 pixel)
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_REQUESTED_THROUGHPUT L"HevcRequestedThroughput" // amf_int64 - Currently total requested throughput for HEVC encode in MB (16 x 16 pixel)
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_QUERY_TIMEOUT_SUPPORT L"HevcQueryTimeoutSupport" // amf_bool - Timeout supported for QueryOutput call
|
||||
#define AMF_VIDEO_ENCODER_CAPS_HEVC_QUERY_TIMEOUT_SUPPORT L"HevcQueryTimeoutSupport" // amf_bool - Timeout supported for QueryOutput call (Deprecated, please use AMF_VIDEO_ENCODER_HEVC_CAP_QUERY_TIMEOUT_SUPPORT instead)
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_SUPPORT_SLICE_OUTPUT L"HevcSupportSliceOutput" // amf_bool - if slice output is supported
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_CAP_SUPPORT_SMART_ACCESS_VIDEO L"HevcEncoderSupportSmartAccessVideo" // amf_bool; returns true if system supports SmartAccess Video
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HEVC_MULTI_HW_INSTANCE_ENCODE L"HevcMultiHwInstanceEncode" // amf_bool; flag to enable multi VCN encode.
|
||||
|
||||
#endif //#ifndef AMF_VideoEncoderHEVC_h
|
||||
375
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoEncoderVCE.h
vendored
Normal file
375
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoEncoderVCE.h
vendored
Normal file
@@ -0,0 +1,375 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// AMFVideoEncoderHW_AVC interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
#ifndef AMF_VideoEncoderVCE_h
|
||||
#define AMF_VideoEncoderVCE_h
|
||||
#pragma once
|
||||
|
||||
#include "Component.h"
|
||||
#include "ColorSpace.h"
|
||||
#include "PreAnalysis.h"
|
||||
|
||||
#define AMFVideoEncoderVCE_AVC L"AMFVideoEncoderVCE_AVC"
|
||||
#define AMFVideoEncoderVCE_SVC L"AMFVideoEncoderVCE_SVC"
|
||||
|
||||
enum AMF_VIDEO_ENCODER_USAGE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_USAGE_TRANSCONDING = 0, // kept for backwards compatability
|
||||
AMF_VIDEO_ENCODER_USAGE_TRANSCODING = 0, // fixed typo
|
||||
AMF_VIDEO_ENCODER_USAGE_ULTRA_LOW_LATENCY,
|
||||
AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY,
|
||||
AMF_VIDEO_ENCODER_USAGE_WEBCAM,
|
||||
AMF_VIDEO_ENCODER_USAGE_HIGH_QUALITY,
|
||||
AMF_VIDEO_ENCODER_USAGE_LOW_LATENCY_HIGH_QUALITY
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_PROFILE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_PROFILE_UNKNOWN = 0,
|
||||
AMF_VIDEO_ENCODER_PROFILE_BASELINE = 66,
|
||||
AMF_VIDEO_ENCODER_PROFILE_MAIN = 77,
|
||||
AMF_VIDEO_ENCODER_PROFILE_HIGH = 100,
|
||||
AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_BASELINE = 256,
|
||||
AMF_VIDEO_ENCODER_PROFILE_CONSTRAINED_HIGH = 257
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_H264_LEVEL_ENUM
|
||||
{
|
||||
AMF_H264_LEVEL__1 = 10,
|
||||
AMF_H264_LEVEL__1_1 = 11,
|
||||
AMF_H264_LEVEL__1_2 = 12,
|
||||
AMF_H264_LEVEL__1_3 = 13,
|
||||
AMF_H264_LEVEL__2 = 20,
|
||||
AMF_H264_LEVEL__2_1 = 21,
|
||||
AMF_H264_LEVEL__2_2 = 22,
|
||||
AMF_H264_LEVEL__3 = 30,
|
||||
AMF_H264_LEVEL__3_1 = 31,
|
||||
AMF_H264_LEVEL__3_2 = 32,
|
||||
AMF_H264_LEVEL__4 = 40,
|
||||
AMF_H264_LEVEL__4_1 = 41,
|
||||
AMF_H264_LEVEL__4_2 = 42,
|
||||
AMF_H264_LEVEL__5 = 50,
|
||||
AMF_H264_LEVEL__5_1 = 51,
|
||||
AMF_H264_LEVEL__5_2 = 52,
|
||||
AMF_H264_LEVEL__6 = 60,
|
||||
AMF_H264_LEVEL__6_1 = 61,
|
||||
AMF_H264_LEVEL__6_2 = 62
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_SCANTYPE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_SCANTYPE_PROGRESSIVE = 0,
|
||||
AMF_VIDEO_ENCODER_SCANTYPE_INTERLACED
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_UNKNOWN = -1,
|
||||
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CONSTANT_QP = 0,
|
||||
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_CBR,
|
||||
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR,
|
||||
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_LATENCY_CONSTRAINED_VBR,
|
||||
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_QUALITY_VBR,
|
||||
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_HIGH_QUALITY_VBR,
|
||||
AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_HIGH_QUALITY_CBR
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_QUALITY_PRESET_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_QUALITY_PRESET_BALANCED = 0,
|
||||
AMF_VIDEO_ENCODER_QUALITY_PRESET_SPEED,
|
||||
AMF_VIDEO_ENCODER_QUALITY_PRESET_QUALITY
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_NONE = 0,
|
||||
AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_FRAME,
|
||||
AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_TOP_FIELD,
|
||||
AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_BOTTOM_FIELD
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_PICTURE_TYPE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_PICTURE_TYPE_NONE = 0,
|
||||
AMF_VIDEO_ENCODER_PICTURE_TYPE_SKIP,
|
||||
AMF_VIDEO_ENCODER_PICTURE_TYPE_IDR,
|
||||
AMF_VIDEO_ENCODER_PICTURE_TYPE_I,
|
||||
AMF_VIDEO_ENCODER_PICTURE_TYPE_P,
|
||||
AMF_VIDEO_ENCODER_PICTURE_TYPE_B
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_IDR,
|
||||
AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_I,
|
||||
AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_P,
|
||||
AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_B
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_PREENCODE_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_PREENCODE_DISABLED = 0,
|
||||
AMF_VIDEO_ENCODER_PREENCODE_ENABLED = 1,
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_CODING_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_UNDEFINED = 0, // BASELINE = CALV; MAIN, HIGH = CABAC
|
||||
AMF_VIDEO_ENCODER_CABAC,
|
||||
AMF_VIDEO_ENCODER_CALV,
|
||||
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_OFF = 0,
|
||||
AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_ON
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_LTR_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_LTR_MODE_RESET_UNUSED = 0,
|
||||
AMF_VIDEO_ENCODER_LTR_MODE_KEEP_UNUSED
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_OUTPUT_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_OUTPUT_MODE_FRAME = 0,
|
||||
AMF_VIDEO_ENCODER_OUTPUT_MODE_SLICE = 1
|
||||
};
|
||||
|
||||
enum AMF_VIDEO_ENCODER_OUTPUT_BUFFER_TYPE_ENUM
|
||||
{
|
||||
AMF_VIDEO_ENCODER_OUTPUT_BUFFER_TYPE_FRAME = 0,
|
||||
AMF_VIDEO_ENCODER_OUTPUT_BUFFER_TYPE_SLICE = 1,
|
||||
AMF_VIDEO_ENCODER_OUTPUT_BUFFER_TYPE_SLICE_LAST = 2
|
||||
};
|
||||
|
||||
// Static properties - can be set before Init()
|
||||
#define AMF_VIDEO_ENCODER_INSTANCE_INDEX L"EncoderInstance" // amf_int64; selected HW instance idx
|
||||
#define AMF_VIDEO_ENCODER_FRAMESIZE L"FrameSize" // AMFSize; default = 0,0; Frame size
|
||||
|
||||
#define AMF_VIDEO_ENCODER_EXTRADATA L"ExtraData" // AMFInterface* - > AMFBuffer*; SPS/PPS buffer in Annex B format - read-only
|
||||
#define AMF_VIDEO_ENCODER_USAGE L"Usage" // amf_int64(AMF_VIDEO_ENCODER_USAGE_ENUM); default = N/A; Encoder usage type. fully configures parameter set.
|
||||
#define AMF_VIDEO_ENCODER_PROFILE L"Profile" // amf_int64(AMF_VIDEO_ENCODER_PROFILE_ENUM) ; default = AMF_VIDEO_ENCODER_PROFILE_MAIN; H264 profile
|
||||
#define AMF_VIDEO_ENCODER_PROFILE_LEVEL L"ProfileLevel" // amf_int64(AMF_VIDEO_ENCODER_H264_LEVEL_ENUM); default = AMF_H264_LEVEL__4_2; H264 level
|
||||
#define AMF_VIDEO_ENCODER_MAX_LTR_FRAMES L"MaxOfLTRFrames" // amf_int64; default = 0; Max number of LTR frames
|
||||
#define AMF_VIDEO_ENCODER_LTR_MODE L"LTRMode" // amf_int64(AMF_VIDEO_ENCODER_LTR_MODE_ENUM); default = AMF_VIDEO_ENCODER_LTR_MODE_RESET_UNUSED; remove/keep unused LTRs (not specified in property AMF_VIDEO_ENCODER_FORCE_LTR_REFERENCE_BITFIELD)
|
||||
#define AMF_VIDEO_ENCODER_SCANTYPE L"ScanType" // amf_int64(AMF_VIDEO_ENCODER_SCANTYPE_ENUM); default = AMF_VIDEO_ENCODER_SCANTYPE_PROGRESSIVE; indicates input stream type
|
||||
#define AMF_VIDEO_ENCODER_MAX_NUM_REFRAMES L"MaxNumRefFrames" // amf_int64; Maximum number of reference frames
|
||||
#define AMF_VIDEO_ENCODER_MAX_CONSECUTIVE_BPICTURES L"MaxConsecutiveBPictures" // amf_int64; Maximum number of consecutive B Pictures
|
||||
#define AMF_VIDEO_ENCODER_ADAPTIVE_MINIGOP L"AdaptiveMiniGOP" // bool; default = false; Disable/Enable Adaptive MiniGOP
|
||||
#define AMF_VIDEO_ENCODER_ASPECT_RATIO L"AspectRatio" // AMFRatio; default = 1, 1
|
||||
#define AMF_VIDEO_ENCODER_FULL_RANGE_COLOR L"FullRangeColor" // bool; default = false; inidicates that YUV input is (0,255)
|
||||
#define AMF_VIDEO_ENCODER_LOWLATENCY_MODE L"LowLatencyInternal" // bool; default = false, enables low latency mode and POC mode 2 in the encoder
|
||||
#define AMF_VIDEO_ENCODER_PRE_ANALYSIS_ENABLE L"EnablePreAnalysis" // bool; default = false; enables the pre-analysis module. Currently only works in AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_PEAK_CONSTRAINED_VBR mode. Refer to AMF Video PreAnalysis API reference for more details.
|
||||
#define AMF_VIDEO_ENCODER_PREENCODE_ENABLE L"RateControlPreanalysisEnable" // amf_int64(AMF_VIDEO_ENCODER_PREENCODE_MODE_ENUM); default = AMF_VIDEO_ENCODER_PREENCODE_DISABLED; enables pre-encode assisted rate control
|
||||
#define AMF_VIDEO_ENCODER_RATE_CONTROL_PREANALYSIS_ENABLE L"RateControlPreanalysisEnable" // amf_int64(AMF_VIDEO_ENCODER_PREENCODE_MODE_ENUM); default = AMF_VIDEO_ENCODER_PREENCODE_DISABLED; enables pre-encode assisted rate control. Deprecated, please use AMF_VIDEO_ENCODER_PREENCODE_ENABLE instead.
|
||||
#define AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD L"RateControlMethod" // amf_int64(AMF_VIDEO_ENCODER_RATE_CONTROL_METHOD_ENUM); default = depends on USAGE; Rate Control Method
|
||||
#define AMF_VIDEO_ENCODER_QVBR_QUALITY_LEVEL L"QvbrQualityLevel" // amf_int64; default = 23; QVBR quality level; range = 1-51
|
||||
#define AMF_VIDEO_ENCODER_MAX_NUM_TEMPORAL_LAYERS L"MaxNumOfTemporalLayers" // amf_int64; default = 1; Max number of temporal layers.
|
||||
#if !defined(__GNUC__) && !defined(__clang__)
|
||||
#pragma deprecated("AMF_VIDEO_ENCODER_RATE_CONTROL_PREANALYSIS_ENABLE")
|
||||
#endif
|
||||
|
||||
|
||||
// Quality preset property
|
||||
#define AMF_VIDEO_ENCODER_QUALITY_PRESET L"QualityPreset" // amf_int64(AMF_VIDEO_ENCODER_QUALITY_PRESET_ENUM); default = depends on USAGE; Quality Preset
|
||||
|
||||
// color conversion
|
||||
#define AMF_VIDEO_ENCODER_COLOR_BIT_DEPTH L"ColorBitDepth" // amf_int64(AMF_COLOR_BIT_DEPTH_ENUM); default = AMF_COLOR_BIT_DEPTH_8
|
||||
|
||||
#define AMF_VIDEO_ENCODER_INPUT_COLOR_PROFILE L"InColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size
|
||||
#define AMF_VIDEO_ENCODER_INPUT_TRANSFER_CHARACTERISTIC L"InColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 ?7.2 See VideoDecoderUVD.h for enum
|
||||
#define AMF_VIDEO_ENCODER_INPUT_COLOR_PRIMARIES L"InColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 Section 7.1 See ColorSpace.h for enum
|
||||
#define AMF_VIDEO_ENCODER_INPUT_HDR_METADATA L"InHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL
|
||||
|
||||
#define AMF_VIDEO_ENCODER_OUTPUT_COLOR_PROFILE L"OutColorProfile" // amf_int64(AMF_VIDEO_CONVERTER_COLOR_PROFILE_ENUM); default = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN - mean AUTO by size
|
||||
#define AMF_VIDEO_ENCODER_OUTPUT_TRANSFER_CHARACTERISTIC L"OutColorTransferChar" // amf_int64(AMF_COLOR_TRANSFER_CHARACTERISTIC_ENUM); default = AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED, ISO/IEC 23001-8_2013 Section 7.2 See VideoDecoderUVD.h for enum
|
||||
#define AMF_VIDEO_ENCODER_OUTPUT_COLOR_PRIMARIES L"OutColorPrimaries" // amf_int64(AMF_COLOR_PRIMARIES_ENUM); default = AMF_COLOR_PRIMARIES_UNDEFINED, ISO/IEC 23001-8_2013 Section 7.1 See ColorSpace.h for enum
|
||||
#define AMF_VIDEO_ENCODER_OUTPUT_HDR_METADATA L"OutHDRMetadata" // AMFBuffer containing AMFHDRMetadata; default NULL
|
||||
|
||||
// Slice output
|
||||
#define AMF_VIDEO_ENCODER_OUTPUT_MODE L"OutputMode" // amf_int64(AMF_VIDEO_ENCODER_OUTPUT_MODE_ENUM); default = AMF_VIDEO_ENCODER_OUTPUT_MODE_FRAME - defines encoder output mode
|
||||
|
||||
|
||||
// Dynamic properties - can be set at any time
|
||||
// Rate control properties
|
||||
#define AMF_VIDEO_ENCODER_FRAMERATE L"FrameRate" // AMFRate; default = depends on usage; Frame Rate
|
||||
#define AMF_VIDEO_ENCODER_B_PIC_DELTA_QP L"BPicturesDeltaQP" // amf_int64; default = depends on USAGE; B-picture Delta
|
||||
#define AMF_VIDEO_ENCODER_REF_B_PIC_DELTA_QP L"ReferenceBPicturesDeltaQP"// amf_int64; default = depends on USAGE; Reference B-picture Delta
|
||||
|
||||
#define AMF_VIDEO_ENCODER_ENFORCE_HRD L"EnforceHRD" // bool; default = depends on USAGE; Enforce HRD
|
||||
#define AMF_VIDEO_ENCODER_FILLER_DATA_ENABLE L"FillerDataEnable" // bool; default = false; Filler Data Enable
|
||||
#define AMF_VIDEO_ENCODER_ENABLE_VBAQ L"EnableVBAQ" // bool; default = depends on USAGE; Enable VBAQ
|
||||
#define AMF_VIDEO_ENCODER_HIGH_MOTION_QUALITY_BOOST_ENABLE L"HighMotionQualityBoostEnable"// bool; default = depends on USAGE; Enable High motion quality boost mode
|
||||
|
||||
|
||||
#define AMF_VIDEO_ENCODER_VBV_BUFFER_SIZE L"VBVBufferSize" // amf_int64; default = depends on USAGE; VBV Buffer Size in bits
|
||||
#define AMF_VIDEO_ENCODER_INITIAL_VBV_BUFFER_FULLNESS L"InitialVBVBufferFullness" // amf_int64; default = 64; Initial VBV Buffer Fullness 0=0% 64=100%
|
||||
|
||||
#define AMF_VIDEO_ENCODER_MAX_AU_SIZE L"MaxAUSize" // amf_int64; default = 0; Max AU Size in bits
|
||||
|
||||
#define AMF_VIDEO_ENCODER_MIN_QP L"MinQP" // amf_int64; default = depends on USAGE; Min QP; range = 0-51
|
||||
#define AMF_VIDEO_ENCODER_MAX_QP L"MaxQP" // amf_int64; default = depends on USAGE; Max QP; range = 0-51
|
||||
#define AMF_VIDEO_ENCODER_QP_I L"QPI" // amf_int64; default = 22; I-frame QP; range = 0-51
|
||||
#define AMF_VIDEO_ENCODER_QP_P L"QPP" // amf_int64; default = 22; P-frame QP; range = 0-51
|
||||
#define AMF_VIDEO_ENCODER_QP_B L"QPB" // amf_int64; default = 22; B-frame QP; range = 0-51
|
||||
#define AMF_VIDEO_ENCODER_TARGET_BITRATE L"TargetBitrate" // amf_int64; default = depends on USAGE; Target bit rate in bits
|
||||
#define AMF_VIDEO_ENCODER_PEAK_BITRATE L"PeakBitrate" // amf_int64; default = depends on USAGE; Peak bit rate in bits
|
||||
#define AMF_VIDEO_ENCODER_RATE_CONTROL_SKIP_FRAME_ENABLE L"RateControlSkipFrameEnable" // bool; default = depends on USAGE; Rate Control Based Frame Skip
|
||||
|
||||
// Picture control properties
|
||||
#define AMF_VIDEO_ENCODER_HEADER_INSERTION_SPACING L"HeaderInsertionSpacing" // amf_int64; default = depends on USAGE; Header Insertion Spacing; range 0-1000
|
||||
#define AMF_VIDEO_ENCODER_B_PIC_PATTERN L"BPicturesPattern" // amf_int64; default = 0; B-picture Pattern (number of B-Frames)
|
||||
#define AMF_VIDEO_ENCODER_DE_BLOCKING_FILTER L"DeBlockingFilter" // bool; default = depends on USAGE; De-blocking Filter
|
||||
#define AMF_VIDEO_ENCODER_B_REFERENCE_ENABLE L"BReferenceEnable" // bool; default = true; Enable Refrence to B-frames
|
||||
#define AMF_VIDEO_ENCODER_IDR_PERIOD L"IDRPeriod" // amf_int64; default = depends on USAGE; IDR Period in frames
|
||||
#define AMF_VIDEO_ENCODER_INTRA_PERIOD L"IntraPeriod" // amf_int64; default = 0; Intra period in frames
|
||||
#define AMF_VIDEO_ENCODER_INTRA_REFRESH_NUM_MBS_PER_SLOT L"IntraRefreshMBsNumberPerSlot" // amf_int64; default = depends on USAGE; Intra Refresh MBs Number Per Slot in Macroblocks
|
||||
#define AMF_VIDEO_ENCODER_SLICES_PER_FRAME L"SlicesPerFrame" // amf_int64; default = 1; Number of slices Per Frame
|
||||
#define AMF_VIDEO_ENCODER_CABAC_ENABLE L"CABACEnable" // amf_int64(AMF_VIDEO_ENCODER_CODING_ENUM) default = AMF_VIDEO_ENCODER_UNDEFINED
|
||||
|
||||
// Motion estimation
|
||||
#define AMF_VIDEO_ENCODER_MOTION_HALF_PIXEL L"HalfPixel" // bool; default= true; Half Pixel
|
||||
#define AMF_VIDEO_ENCODER_MOTION_QUARTERPIXEL L"QuarterPixel" // bool; default= true; Quarter Pixel
|
||||
|
||||
// SVC
|
||||
#define AMF_VIDEO_ENCODER_NUM_TEMPORAL_ENHANCMENT_LAYERS L"NumOfTemporalEnhancmentLayers" // amf_int64; default = 1; range = 1-MaxTemporalLayers; Number of temporal Layers (SVC)
|
||||
|
||||
|
||||
// DPB management
|
||||
#define AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE L"PicTransferMode" // amf_int64(AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_ENUM); default = AMF_VIDEO_ENCODER_PICTURE_TRANSFER_MODE_OFF - whether to exchange reference/reconstructed pic between encoder and application
|
||||
// misc
|
||||
#define AMF_VIDEO_ENCODER_QUERY_TIMEOUT L"QueryTimeout" // amf_int64; default = 0 (no wait); timeout for QueryOutput call in ms.
|
||||
#define AMF_VIDEO_ENCODER_MEMORY_TYPE L"EncoderMemoryType" // amf_int64(AMF_MEMORY_TYPE) , default is AMF_MEMORY_UNKNOWN, Values : AMF_MEMORY_DX11, AMF_MEMORY_DX9, AMF_MEMORY_VULKAN or AMF_MEMORY_UNKNOWN (auto)
|
||||
#define AMF_VIDEO_ENCODER_ENABLE_SMART_ACCESS_VIDEO L"EnableEncoderSmartAccessVideo" // amf_bool; default = false; true = enables smart access video feature
|
||||
#define AMF_VIDEO_ENCODER_INPUT_QUEUE_SIZE L"InputQueueSize" // amf_int64; default 16; Set amf input queue size
|
||||
|
||||
// Per-submission properties - can be set on input surface interface
|
||||
#define AMF_VIDEO_ENCODER_END_OF_SEQUENCE L"EndOfSequence" // bool; default = false; generate end of sequence
|
||||
#define AMF_VIDEO_ENCODER_END_OF_STREAM L"EndOfStream" // bool; default = false; generate end of stream
|
||||
#define AMF_VIDEO_ENCODER_FORCE_PICTURE_TYPE L"ForcePictureType" // amf_int64(AMF_VIDEO_ENCODER_PICTURE_TYPE_ENUM); default = AMF_VIDEO_ENCODER_PICTURE_TYPE_NONE; generate particular picture type
|
||||
#define AMF_VIDEO_ENCODER_INSERT_AUD L"InsertAUD" // bool; default = false; insert AUD
|
||||
#define AMF_VIDEO_ENCODER_INSERT_SPS L"InsertSPS" // bool; default = false; insert SPS
|
||||
#define AMF_VIDEO_ENCODER_INSERT_PPS L"InsertPPS" // bool; default = false; insert PPS
|
||||
#define AMF_VIDEO_ENCODER_PICTURE_STRUCTURE L"PictureStructure" // amf_int64(AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_ENUM); default = AMF_VIDEO_ENCODER_PICTURE_STRUCTURE_FRAME; indicate picture type
|
||||
#define AMF_VIDEO_ENCODER_MARK_CURRENT_WITH_LTR_INDEX L"MarkCurrentWithLTRIndex" // //amf_int64; default = N/A; Mark current frame with LTR index
|
||||
#define AMF_VIDEO_ENCODER_FORCE_LTR_REFERENCE_BITFIELD L"ForceLTRReferenceBitfield"// amf_int64; default = 0; force LTR bit-field
|
||||
#define AMF_VIDEO_ENCODER_ROI_DATA L"ROIData" // 2D AMFSurface, surface format: AMF_SURFACE_GRAY32; Importance value for each 16x16 macro block ranges from `0` (least important) to `10` (most important), stored in 32bit unsigned format.
|
||||
#define AMF_VIDEO_ENCODER_REFERENCE_PICTURE L"ReferencePicture" // AMFInterface(AMFSurface); surface used for frame injection
|
||||
#define AMF_VIDEO_ENCODER_PSNR_FEEDBACK L"PSNRFeedback" // amf_bool; default = false; Signal encoder to calculate PSNR score
|
||||
#define AMF_VIDEO_ENCODER_SSIM_FEEDBACK L"SSIMFeedback" // amf_bool; default = false; Signal encoder to calculate SSIM score
|
||||
#define AMF_VIDEO_ENCODER_STATISTICS_FEEDBACK L"StatisticsFeedback" // amf_bool; default = false; Signal encoder to collect and feedback statistics
|
||||
#define AMF_VIDEO_ENCODER_BLOCK_QP_FEEDBACK L"BlockQpFeedback" // amf_bool; default = false; Signal encoder to collect and feedback block level QP values
|
||||
|
||||
|
||||
// properties set by encoder on output buffer interface
|
||||
#define AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE L"OutputDataType" // amf_int64(AMF_VIDEO_ENCODER_OUTPUT_DATA_TYPE_ENUM); default = N/A
|
||||
#define AMF_VIDEO_ENCODER_OUTPUT_MARKED_LTR_INDEX L"MarkedLTRIndex" //amf_int64; default = -1; Marked LTR index
|
||||
#define AMF_VIDEO_ENCODER_OUTPUT_REFERENCED_LTR_INDEX_BITFIELD L"ReferencedLTRIndexBitfield" // amf_int64; default = 0; referenced LTR bit-field
|
||||
#define AMF_VIDEO_ENCODER_OUTPUT_TEMPORAL_LAYER L"OutputTemporalLayer" // amf_int64; Temporal layer
|
||||
#define AMF_VIDEO_ENCODER_OUTPUT_BUFFER_TYPE L"OutputBufferType" // amf_int64(AMF_VIDEO_ENCODER_OUTPUT_BUFFER_TYPE_ENUM); encoder output buffer type
|
||||
#define AMF_VIDEO_ENCODER_PRESENTATION_TIME_STAMP L"PresentationTimeStamp" // amf_int64; Presentation time stamp (PTS)
|
||||
#define AMF_VIDEO_ENCODER_RECONSTRUCTED_PICTURE L"ReconstructedPicture" // AMFInterface(AMFSurface); returns reconstructed picture as an AMFSurface attached to the output buffer as property AMF_VIDEO_ENCODER_RECONSTRUCTED_PICTURE of AMFInterface type
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_PSNR_Y L"PSNRY" // double; PSNR Y
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_PSNR_U L"PSNRU" // double; PSNR U
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_PSNR_V L"PSNRV" // double; PSNR V
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_PSNR_ALL L"PSNRALL" // double; PSNR All
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_SSIM_Y L"SSIMY" // double; SSIM Y
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_SSIM_U L"SSIMU" // double; SSIM U
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_SSIM_V L"SSIMV" // double; SSIM V
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_SSIM_ALL L"SSIMALL" // double; SSIM ALL
|
||||
|
||||
// Encoder statistics feedback
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_FRAME_QP L"StatisticsFeedbackFrameQP" // amf_int64; Rate control base frame/initial QP
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_AVERAGE_QP L"StatisticsFeedbackAvgQP" // amf_int64; Average calculated QP of all encoded MBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped MBs.
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_MAX_QP L"StatisticsFeedbackMaxQP" // amf_int64; Max calculated QP among all encoded MBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped MBs.
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_MIN_QP L"StatisticsFeedbackMinQP" // amf_int64; Min calculated QP among all encoded MBs in a picture. Value may be different from the one reported by bitstream analyzer when there are skipped MBs.
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_PIX_NUM_INTRA L"StatisticsFeedbackPixNumIntra" // amf_int64; Number of the intra encoded pixels
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_PIX_NUM_INTER L"StatisticsFeedbackPixNumInter" // amf_int64; Number of the inter encoded pixels
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_PIX_NUM_SKIP L"StatisticsFeedbackPixNumSkip" // amf_int64; Number of the skip mode pixels
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_RESIDUAL L"StatisticsFeedbackBitcountResidual" // amf_int64; The bit count that corresponds to residual data
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_MOTION L"StatisticsFeedbackBitcountMotion" // amf_int64; The bit count that corresponds to motion vectors
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_INTER L"StatisticsFeedbackBitcountInter" // amf_int64; The bit count that are assigned to inter MBs
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_INTRA L"StatisticsFeedbackBitcountIntra" // amf_int64; The bit count that are assigned to intra MBs
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_BITCOUNT_ALL_MINUS_HEADER L"StatisticsFeedbackBitcountAllMinusHeader" // amf_int64; The bit count of the bitstream excluding header
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_MV_X L"StatisticsFeedbackMvX" // amf_int64; Accumulated absolute values of horizontal MV's
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_MV_Y L"StatisticsFeedbackMvY" // amf_int64; Accumulated absolute values of vertical MV's
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_RD_COST_FINAL L"StatisticsFeedbackRdCostFinal" // amf_int64; Frame level final RD cost for full encoding
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_RD_COST_INTRA L"StatisticsFeedbackRdCostIntra" // amf_int64; Frame level intra RD cost for full encoding
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_RD_COST_INTER L"StatisticsFeedbackRdCostInter" // amf_int64; Frame level inter RD cost for full encoding
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_SATD_FINAL L"StatisticsFeedbackSatdFinal" // amf_int64; Frame level final SATD for full encoding
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_SATD_INTRA L"StatisticsFeedbackSatdIntra" // amf_int64; Frame level intra SATD for full encoding
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_SATD_INTER L"StatisticsFeedbackSatdInter" // amf_int64; Frame level inter SATD for full encoding
|
||||
#define AMF_VIDEO_ENCODER_STATISTIC_VARIANCE L"StatisticsFeedbackVariance" // amf_int64; Frame level variance for full encoding
|
||||
|
||||
// Encoder block level feedback
|
||||
#define AMF_VIDEO_ENCODER_BLOCK_QP_MAP L"BlockQpMap" // AMFInterface(AMFSurface); AMFSurface of format AMF_SURFACE_GRAY32 containing block level QP values
|
||||
|
||||
#define AMF_VIDEO_ENCODER_HDCP_COUNTER L"HDCPCounter" // const void*
|
||||
|
||||
// Properties for multi-instance cloud gaming
|
||||
#define AMF_VIDEO_ENCODER_MAX_INSTANCES L"EncoderMaxInstances" // deprecated. amf_int64; default = 1; max number of encoder instances
|
||||
#define AMF_VIDEO_ENCODER_MULTI_INSTANCE_MODE L"MultiInstanceMode" // deprecated. bool; default = false;
|
||||
#define AMF_VIDEO_ENCODER_CURRENT_QUEUE L"MultiInstanceCurrentQueue"// deprecated. amf_int64; default = 0;
|
||||
|
||||
|
||||
// VCE Encoder capabilities - exposed in AMFCaps interface
|
||||
#define AMF_VIDEO_ENCODER_CAP_MAX_BITRATE L"MaxBitrate" // amf_int64; Maximum bit rate in bits
|
||||
#define AMF_VIDEO_ENCODER_CAP_NUM_OF_STREAMS L"NumOfStreams" // amf_int64; maximum number of encode streams supported
|
||||
#define AMF_VIDEO_ENCODER_CAP_MAX_PROFILE L"MaxProfile" // AMF_VIDEO_ENCODER_PROFILE_ENUM
|
||||
#define AMF_VIDEO_ENCODER_CAP_MAX_LEVEL L"MaxLevel" // amf_int64 maximum profile level
|
||||
#define AMF_VIDEO_ENCODER_CAP_BFRAMES L"BFrames" // bool is B-Frames supported
|
||||
#define AMF_VIDEO_ENCODER_CAP_MIN_REFERENCE_FRAMES L"MinReferenceFrames" // amf_int64 minimum number of reference frames
|
||||
#define AMF_VIDEO_ENCODER_CAP_MAX_REFERENCE_FRAMES L"MaxReferenceFrames" // amf_int64 maximum number of reference frames
|
||||
#define AMF_VIDEO_ENCODER_CAP_MAX_TEMPORAL_LAYERS L"MaxTemporalLayers" // amf_int64 maximum number of temporal layers
|
||||
#define AMF_VIDEO_ENCODER_CAP_FIXED_SLICE_MODE L"FixedSliceMode" // bool is fixed slice mode supported
|
||||
#define AMF_VIDEO_ENCODER_CAP_NUM_OF_HW_INSTANCES L"NumOfHwInstances" // amf_int64 number of HW encoder instances
|
||||
#define AMF_VIDEO_ENCODER_CAP_COLOR_CONVERSION L"ColorConversion" // amf_int64(AMF_ACCELERATION_TYPE) - type of supported color conversion. default AMF_ACCEL_GPU
|
||||
#define AMF_VIDEO_ENCODER_CAP_PRE_ANALYSIS L"PreAnalysis" // amf_bool - pre analysis module is available.
|
||||
#define AMF_VIDEO_ENCODER_CAP_ROI L"ROIMap" // amf_bool - ROI map support is available.
|
||||
#define AMF_VIDEO_ENCODER_CAP_MAX_THROUGHPUT L"MaxThroughput" // amf_int64 - MAX throughput for H264 encoder in MB (16 x 16 pixel)
|
||||
#define AMF_VIDEO_ENCODER_CAP_REQUESTED_THROUGHPUT L"RequestedThroughput" // amf_int64 - Currently total requested throughput for H264 encoder in MB (16 x 16 pixel)
|
||||
#define AMF_VIDEO_ENCODER_CAPS_QUERY_TIMEOUT_SUPPORT L"QueryTimeoutSupport" // amf_bool - Timeout supported for QueryOutput call (Deprecated, please use AMF_VIDEO_ENCODER_CAP_QUERY_TIMEOUT_SUPPORT )
|
||||
#define AMF_VIDEO_ENCODER_CAP_QUERY_TIMEOUT_SUPPORT L"QueryTimeoutSupport" // amf_bool - Timeout supported for QueryOutput call
|
||||
|
||||
#define AMF_VIDEO_ENCODER_CAP_SUPPORT_SLICE_OUTPUT L"SupportSliceOutput" // amf_bool - if slice output is supported
|
||||
|
||||
#define AMF_VIDEO_ENCODER_CAP_SUPPORT_SMART_ACCESS_VIDEO L"EncoderSupportSmartAccessVideo" // amf_bool; returns true if system supports SmartAccess Video
|
||||
|
||||
#endif //#ifndef AMF_VideoEncoderVCE_h
|
||||
124
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoStitch.h
vendored
Normal file
124
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/VideoStitch.h
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
//
|
||||
// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
/**
|
||||
***************************************************************************************************
|
||||
* @file VideoStitch.h
|
||||
* @brief AMFVideoStitch interface declaration
|
||||
***************************************************************************************************
|
||||
*/
|
||||
#ifndef AMF_VideoStitch_h
|
||||
#define AMF_VideoStitch_h
|
||||
#pragma once
|
||||
|
||||
#include "public/include/components/Component.h"
|
||||
|
||||
#define AMFVideoStitch L"AMFVideoStitch" //Component name
|
||||
|
||||
// static properties
|
||||
#define AMF_VIDEO_STITCH_OUTPUT_FORMAT L"OutputFormat" // Values, AMF_SURFACE_BGRA or AMF_SURFACE_RGBA
|
||||
#define AMF_VIDEO_STITCH_MEMORY_TYPE L"MemoryType" // Values, only AMF_MEMORY_DX11 is supported for now.
|
||||
#define AMF_VIDEO_STITCH_OUTPUT_SIZE L"OutputSize" // AMFSize, (width, height) in pixels. default= (0,0), will be the same size as input.
|
||||
#define AMF_VIDEO_STITCH_INPUTCOUNT L"InputCount" // amf_uint64, number of camera inputs.
|
||||
|
||||
// individual camera direction and location
|
||||
#define AMF_VIDEO_CAMERA_ANGLE_PITCH L"CameraPitch" // double, in radians, default = 0, camera pitch orientation
|
||||
#define AMF_VIDEO_CAMERA_ANGLE_YAW L"CameraYaw" // double, in radians, default = 0, camera yaw orientation
|
||||
#define AMF_VIDEO_CAMERA_ANGLE_ROLL L"CameraRoll" // double, in radians, default = 0, camera roll orientation
|
||||
|
||||
#define AMF_VIDEO_CAMERA_OFFSET_X L"CameraOffsetX" // double, in pixels, default = 0, X offset of camera center of the lens from the center of the rig.
|
||||
#define AMF_VIDEO_CAMERA_OFFSET_Y L"CameraOffsetY" // double, in pixels, default = 0, Y offset of camera center of the lens from the center of the rig.
|
||||
#define AMF_VIDEO_CAMERA_OFFSET_Z L"CameraOffsetZ" // double, in pixels, default = 0, Z offset of camera center of the lens from the center of the rig.
|
||||
#define AMF_VIDEO_CAMERA_HFOV L"CameraHFOV" // double, in radians, default = PI, - horizontal field of view
|
||||
#define AMF_VIDEO_CAMERA_SCALE L"CameraScale" // double, default = 1, scale coeff
|
||||
|
||||
// lens correction parameters
|
||||
#define AMF_VIDEO_STITCH_LENS_CORR_K1 L"LensK1" // double, default = 0.
|
||||
#define AMF_VIDEO_STITCH_LENS_CORR_K2 L"LensK2" // double, default = 0.
|
||||
#define AMF_VIDEO_STITCH_LENS_CORR_K3 L"LensK3" // double, default = 0.
|
||||
#define AMF_VIDEO_STITCH_LENS_CORR_OFFX L"LensOffX" // double, default = 0.
|
||||
#define AMF_VIDEO_STITCH_LENS_CORR_OFFY L"LensOffY" // double, default = 0.
|
||||
#define AMF_VIDEO_STITCH_CROP L"Crop" //AMFRect, in pixels default = (0,0,0,0).
|
||||
|
||||
#define AMF_VIDEO_STITCH_LENS_MODE L"LensMode" // Values, AMF_VIDEO_STITCH_LENS_CORR_MODE_ENUM, (default = AMF_VIDEO_STITCH_LENS_CORR_MODE_RADIAL)
|
||||
|
||||
#define AMF_VIDEO_STITCH_OUTPUT_MODE L"OutputMode" // AMF_VIDEO_STITCH_OUTPUT_MODE_ENUM (default=AMF_VIDEO_STITCH_OUTPUT_MODE_PREVIEW)
|
||||
#define AMF_VIDEO_STITCH_COMBINED_SOURCE L"CombinedSource" // bool, (default=false) video sources are combined in one stream
|
||||
|
||||
#define AMF_VIDEO_STITCH_COMPUTE_DEVICE L"ComputeDevice" // amf_int64(AMF_MEMORY_TYPE) Values, AMF_MEMORY_DX11, AMF_MEMORY_COMPUTE_FOR_DX11, AMF_MEMORY_OPENCL
|
||||
|
||||
//for debug
|
||||
#define AMF_VIDEO_STITCH_WIRE_RENDER L"Wire" // bool (default=false) reder wireframe
|
||||
|
||||
//view angle
|
||||
#define AMF_VIDEO_STITCH_VIEW_ROTATE_X L"AngleX" // double, in radians, default = 0 - delta from current position / automatilcally reset to 0 inside SetProperty() call
|
||||
#define AMF_VIDEO_STITCH_VIEW_ROTATE_Y L"AngleY" // double, in radians, default = 0 - delta from current position / automatilcally reset to 0 inside SetProperty() call
|
||||
#define AMF_VIDEO_STITCH_VIEW_ROTATE_Z L"AngleZ" // double, in radians, default = 0 - delta from current position / automatilcally reset to 0 inside SetProperty() call
|
||||
|
||||
#define AMF_VIDEO_STITCH_COLOR_BALANCE L"ColorBalance" // bool (default=true) enables color balance
|
||||
|
||||
//lens mode
|
||||
enum AMF_VIDEO_STITCH_LENS_ENUM
|
||||
{
|
||||
AMF_VIDEO_STITCH_LENS_RECTILINEAR = 0, //rect linear lens
|
||||
AMF_VIDEO_STITCH_LENS_FISHEYE_FULLFRAME = 1, //fisheye full frame
|
||||
AMF_VIDEO_STITCH_LENS_FISHEYE_CIRCULAR = 2, //fisheye, circular
|
||||
};
|
||||
|
||||
//Output Mode
|
||||
enum AMF_VIDEO_STITCH_OUTPUT_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_STITCH_OUTPUT_MODE_PREVIEW = 0, //preview mode
|
||||
AMF_VIDEO_STITCH_OUTPUT_MODE_EQUIRECTANGULAR = 1, //equirectangular mode
|
||||
AMF_VIDEO_STITCH_OUTPUT_MODE_CUBEMAP = 2, //cubemap mode
|
||||
AMF_VIDEO_STITCH_OUTPUT_MODE_LAST = AMF_VIDEO_STITCH_OUTPUT_MODE_CUBEMAP,
|
||||
};
|
||||
|
||||
//audio mode
|
||||
enum AMF_VIDEO_STITCH_AUDIO_MODE_ENUM
|
||||
{
|
||||
AMF_VIDEO_STITCH_AUDIO_MODE_NONE = 0, //no audio
|
||||
AMF_VIDEO_STITCH_AUDIO_MODE_VIDEO = 1, //using audio from video stream
|
||||
AMF_VIDEO_STITCH_AUDIO_MODE_FILE = 2, //using audio from file
|
||||
AMF_VIDEO_STITCH_AUDIO_MODE_CAPTURE = 3, //using audio from capture device
|
||||
AMF_VIDEO_STITCH_AUDIO_MODE_INVALID = -1, //invalid
|
||||
};
|
||||
|
||||
|
||||
#if defined(_M_AMD64)
|
||||
#define STITCH_DLL_NAME L"amf-stitch-64.dll"
|
||||
#else
|
||||
#define STITCH_DLL_NAME L"amf-stitch-32.dll"
|
||||
#endif
|
||||
|
||||
#endif //#ifndef AMF_VideoStitch_h
|
||||
83
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/ZCamLiveStream.h
vendored
Normal file
83
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/components/ZCamLiveStream.h
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// ZCamLive interface declaration
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
#ifndef AMF_ZCamLiveStream_h
|
||||
#define AMF_ZCamLiveStream_h
|
||||
|
||||
#pragma once
|
||||
#define ZCAMLIVE_STREAMCOUNT L"StreamCount" // amf_int64 (default = 4), number of streams
|
||||
#define ZCAMLIVE_VIDEO_FRAMESIZE L"FrameSize" // AMFSize (default = AMFConstructSize(2704, 1520)), frame size
|
||||
#define ZCAMLIVE_VIDEO_FRAMERATE L"FrameRate" // AMFRate (default = 30.0), video frame rate
|
||||
#define ZCAMLIVE_VIDEO_BIT_RATE L"BitRate" // amf_int64 (default = 3000000), video bitrate
|
||||
#define ZCAMLIVE_STREAM_ACTIVE_CAMERA L"ActiveCamera" // amf_int64 (default = -1, all the cameras), the index of the camera to capture
|
||||
#define ZCAMLIVE_STREAM_FRAMECOUNT L"FrameCount" // amf_int64 (default = 0), number of frames captured
|
||||
#define ZCAMLIVE_CODEC_ID L"CodecID" // WString (default = "AMFVideoDecoderUVD_H264_AVC"), UVD codec ID
|
||||
#define ZCAMLIVE_VIDEO_MODE L"VideoMode" // Enum (default = 0, 2K7P30), ZCam mode
|
||||
#define ZCAMLIVE_AUDIO_MODE L"AudioMode" // Enum (default = 0, Silent) - Audio mode
|
||||
#define ZCAMLIVE_LOWLATENCY L"LowLatency" // amf_int64 (default = 1, LowLatency), low latency flag
|
||||
#define ZCAMLIVE_IP_0 L"ZCamIP_00" // WString, IP address of the #1 stream, default "10.98.32.1"
|
||||
#define ZCAMLIVE_IP_1 L"ZCamIP_01" // WString, IP address of the #2 stream, default "10.98.32.2"
|
||||
#define ZCAMLIVE_IP_2 L"ZCamIP_02" // WString, IP address of the #3 stream, default "10.98.32.3"
|
||||
#define ZCAMLIVE_IP_3 L"ZCamIP_03" // WString, IP address of the #4 stream, default "10.98.32.4"
|
||||
|
||||
//Camera live capture Mode
|
||||
enum CAMLIVE_MODE_ENUM
|
||||
{
|
||||
CAMLIVE_MODE_ZCAM_1080P24 = 0, //1920x1080, 24FPS
|
||||
CAMLIVE_MODE_ZCAM_1080P30, //1920x1080, 30FPS
|
||||
CAMLIVE_MODE_ZCAM_1080P60, //1920x1080, 60FPS
|
||||
CAMLIVE_MODE_ZCAM_2K7P24, //2704x1520, 24FPS
|
||||
CAMLIVE_MODE_ZCAM_2K7P30, //2704x1520, 24FPS
|
||||
CAMLIVE_MODE_ZCAM_2K7P60, //2704x1520, 24FPS
|
||||
CAMLIVE_MODE_ZCAM_2544P24, //3392x2544, 24FPS
|
||||
CAMLIVE_MODE_ZCAM_2544P30, //3392x2544, 24FPS
|
||||
CAMLIVE_MODE_ZCAM_2544P60, //3392x2544, 24FPS
|
||||
CAMLIVE_MODE_THETAS, //Ricoh TheataS
|
||||
CAMLIVE_MODE_THETAV, //Ricoh TheataV
|
||||
CAMLIVE_MODE_INVALID = -1,
|
||||
};
|
||||
|
||||
enum CAM_AUDIO_MODE_ENUM
|
||||
{
|
||||
CAM_AUDIO_MODE_NONE = 0, //None
|
||||
CAM_AUDIO_MODE_SILENT, //Silent audio
|
||||
CAM_AUDIO_MODE_CAMERA //Capture from camera, not supported yet
|
||||
};
|
||||
|
||||
extern "C"
|
||||
{
|
||||
AMF_RESULT AMF_CDECL_CALL AMFCreateComponentZCamLiveStream(amf::AMFContext* pContext, amf::AMFComponentEx** ppComponent);
|
||||
}
|
||||
#endif // AMF_ZCamLiveStream_h
|
||||
241
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/AudioBuffer.h
vendored
Normal file
241
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/AudioBuffer.h
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_AudioBuffer_h
|
||||
#define AMF_AudioBuffer_h
|
||||
#pragma once
|
||||
|
||||
#include "Data.h"
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( push )
|
||||
#pragma warning(disable : 4263)
|
||||
#pragma warning(disable : 4264)
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
typedef enum AMF_AUDIO_FORMAT
|
||||
{
|
||||
AMFAF_UNKNOWN =-1,
|
||||
AMFAF_U8 = 0, // amf_uint8
|
||||
AMFAF_S16 = 1, // amf_int16
|
||||
AMFAF_S32 = 2, // amf_int32
|
||||
AMFAF_FLT = 3, // amf_float
|
||||
AMFAF_DBL = 4, // amf_double
|
||||
|
||||
AMFAF_U8P = 5, // amf_uint8
|
||||
AMFAF_S16P = 6, // amf_int16
|
||||
AMFAF_S32P = 7, // amf_int32
|
||||
AMFAF_FLTP = 8, // amf_float
|
||||
AMFAF_DBLP = 9, // amf_double
|
||||
AMFAF_FIRST = AMFAF_U8,
|
||||
AMFAF_LAST = AMFAF_DBLP,
|
||||
} AMF_AUDIO_FORMAT;
|
||||
|
||||
typedef enum AMF_AUDIO_CHANNEL_LAYOUT
|
||||
{
|
||||
AMFACL_SPEAKER_FRONT_LEFT = 0x1,
|
||||
AMFACL_SPEAKER_FRONT_RIGHT = 0x2,
|
||||
AMFACL_SPEAKER_FRONT_CENTER = 0x4,
|
||||
AMFACL_SPEAKER_LOW_FREQUENCY = 0x8,
|
||||
AMFACL_SPEAKER_BACK_LEFT = 0x10,
|
||||
AMFACL_SPEAKER_BACK_RIGHT = 0x20,
|
||||
AMFACL_SPEAKER_FRONT_LEFT_OF_CENTER = 0x40,
|
||||
AMFACL_SPEAKER_FRONT_RIGHT_OF_CENTER = 0x80,
|
||||
AMFACL_SPEAKER_BACK_CENTER = 0x100,
|
||||
AMFACL_SPEAKER_SIDE_LEFT = 0x200,
|
||||
AMFACL_SPEAKER_SIDE_RIGHT = 0x400,
|
||||
AMFACL_SPEAKER_TOP_CENTER = 0x800,
|
||||
AMFACL_SPEAKER_TOP_FRONT_LEFT = 0x1000,
|
||||
AMFACL_SPEAKER_TOP_FRONT_CENTER = 0x2000,
|
||||
AMFACL_SPEAKER_TOP_FRONT_RIGHT = 0x4000,
|
||||
AMFACL_SPEAKER_TOP_BACK_LEFT = 0x8000,
|
||||
AMFACL_SPEAKER_TOP_BACK_CENTER = 0x10000,
|
||||
AMFACL_SPEAKER_TOP_BACK_RIGHT = 0x20000
|
||||
} AMF_AUDIO_CHANNEL_LAYOUT;
|
||||
|
||||
// get the most common layout for a given number of speakers
|
||||
inline int GetDefaultChannelLayout(int channels)
|
||||
{
|
||||
switch (channels)
|
||||
{
|
||||
case 1:
|
||||
return (AMFACL_SPEAKER_FRONT_CENTER);
|
||||
case 2:
|
||||
return (AMFACL_SPEAKER_FRONT_LEFT | AMFACL_SPEAKER_FRONT_RIGHT);
|
||||
case 4:
|
||||
return (AMFACL_SPEAKER_FRONT_LEFT | AMFACL_SPEAKER_FRONT_RIGHT | AMFACL_SPEAKER_BACK_LEFT | AMFACL_SPEAKER_BACK_RIGHT);
|
||||
case 6:
|
||||
return (AMFACL_SPEAKER_FRONT_LEFT | AMFACL_SPEAKER_FRONT_RIGHT | AMFACL_SPEAKER_FRONT_CENTER | AMFACL_SPEAKER_LOW_FREQUENCY | AMFACL_SPEAKER_BACK_LEFT | AMFACL_SPEAKER_BACK_RIGHT);
|
||||
case 8:
|
||||
return (AMFACL_SPEAKER_FRONT_LEFT | AMFACL_SPEAKER_FRONT_RIGHT | AMFACL_SPEAKER_FRONT_CENTER | AMFACL_SPEAKER_LOW_FREQUENCY | AMFACL_SPEAKER_BACK_LEFT | AMFACL_SPEAKER_BACK_RIGHT | AMFACL_SPEAKER_FRONT_LEFT_OF_CENTER | AMFACL_SPEAKER_FRONT_RIGHT_OF_CENTER);
|
||||
}
|
||||
|
||||
return AMFACL_SPEAKER_FRONT_LEFT | AMFACL_SPEAKER_FRONT_RIGHT;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFAudioBufferObserver interface - callback
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMFAudioBuffer;
|
||||
class AMF_NO_VTABLE AMFAudioBufferObserver
|
||||
{
|
||||
public:
|
||||
virtual void AMF_STD_CALL OnBufferDataRelease(AMFAudioBuffer* pBuffer) = 0;
|
||||
};
|
||||
#else // #if defined(__cplusplus)
|
||||
typedef struct AMFAudioBuffer AMFAudioBuffer;
|
||||
typedef struct AMFAudioBufferObserver AMFAudioBufferObserver;
|
||||
typedef struct AMFAudioBufferObserverVtbl
|
||||
{
|
||||
void (AMF_STD_CALL *OnBufferDataRelease)(AMFAudioBufferObserver* pThis, AMFAudioBuffer* pBuffer);
|
||||
} AMFAudioBufferObserverVtbl;
|
||||
|
||||
struct AMFAudioBufferObserver
|
||||
{
|
||||
const AMFAudioBufferObserverVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AudioBuffer interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFAudioBuffer : public AMFData
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x2212ff8, 0x6107, 0x430b, 0xb6, 0x3c, 0xc7, 0xe5, 0x40, 0xe5, 0xf8, 0xeb)
|
||||
|
||||
virtual amf_int32 AMF_STD_CALL GetSampleCount() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetSampleRate() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetChannelCount() = 0;
|
||||
virtual AMF_AUDIO_FORMAT AMF_STD_CALL GetSampleFormat() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetSampleSize() = 0;
|
||||
virtual amf_uint32 AMF_STD_CALL GetChannelLayout() = 0;
|
||||
virtual void* AMF_STD_CALL GetNative() = 0;
|
||||
virtual amf_size AMF_STD_CALL GetSize() = 0;
|
||||
|
||||
// Observer management
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Woverloaded-virtual"
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
|
||||
#endif
|
||||
virtual void AMF_STD_CALL AddObserver(AMFAudioBufferObserver* pObserver) = 0;
|
||||
virtual void AMF_STD_CALL RemoveObserver(AMFAudioBufferObserver* pObserver) = 0;
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFAudioBuffer> AMFAudioBufferPtr;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFAudioBuffer, 0x2212ff8, 0x6107, 0x430b, 0xb6, 0x3c, 0xc7, 0xe5, 0x40, 0xe5, 0xf8, 0xeb)
|
||||
|
||||
typedef struct AMFAudioBufferVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFAudioBuffer* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFAudioBuffer* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFAudioBuffer* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFAudioBuffer* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFAudioBuffer* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFAudioBuffer* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFAudioBuffer* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFAudioBuffer* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFAudioBuffer* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFAudioBuffer* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFAudioBuffer* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFAudioBuffer* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFAudioBuffer* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFData interface
|
||||
|
||||
AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryType)(AMFAudioBuffer* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *Duplicate)(AMFAudioBuffer* pThis, AMF_MEMORY_TYPE type, AMFData** ppData);
|
||||
AMF_RESULT (AMF_STD_CALL *Convert)(AMFAudioBuffer* pThis, AMF_MEMORY_TYPE type); // optimal interop if possilble. Copy through host memory if needed
|
||||
AMF_RESULT (AMF_STD_CALL *Interop)(AMFAudioBuffer* pThis, AMF_MEMORY_TYPE type); // only optimal interop if possilble. No copy through host memory for GPU objects
|
||||
|
||||
AMF_DATA_TYPE (AMF_STD_CALL *GetDataType)(AMFAudioBuffer* pThis);
|
||||
|
||||
amf_bool (AMF_STD_CALL *IsReusable)(AMFAudioBuffer* pThis);
|
||||
|
||||
void (AMF_STD_CALL *SetPts)(AMFAudioBuffer* pThis, amf_pts pts);
|
||||
amf_pts (AMF_STD_CALL *GetPts)(AMFAudioBuffer* pThis);
|
||||
void (AMF_STD_CALL *SetDuration)(AMFAudioBuffer* pThis, amf_pts duration);
|
||||
amf_pts (AMF_STD_CALL *GetDuration)(AMFAudioBuffer* pThis);
|
||||
|
||||
// AMFAudioBuffer interface
|
||||
|
||||
amf_int32 (AMF_STD_CALL *GetSampleCount)(AMFAudioBuffer* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetSampleRate)(AMFAudioBuffer* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetChannelCount)(AMFAudioBuffer* pThis);
|
||||
AMF_AUDIO_FORMAT (AMF_STD_CALL *GetSampleFormat)(AMFAudioBuffer* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetSampleSize)(AMFAudioBuffer* pThis);
|
||||
amf_uint32 (AMF_STD_CALL *GetChannelLayout)(AMFAudioBuffer* pThis);
|
||||
void* (AMF_STD_CALL *GetNative)(AMFAudioBuffer* pThis);
|
||||
amf_size (AMF_STD_CALL *GetSize)(AMFAudioBuffer* pThis);
|
||||
|
||||
// Observer management
|
||||
void (AMF_STD_CALL *AddObserver_AudioBuffer)(AMFAudioBuffer* pThis, AMFAudioBufferObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver_AudioBuffer)(AMFAudioBuffer* pThis, AMFAudioBufferObserver* pObserver);
|
||||
|
||||
} AMFAudioBufferVtbl;
|
||||
|
||||
struct AMFAudioBuffer
|
||||
{
|
||||
const AMFAudioBufferVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
#if defined(__cplusplus)
|
||||
} // namespace
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
#endif //#ifndef AMF_AudioBuffer_h
|
||||
197
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Buffer.h
vendored
Normal file
197
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Buffer.h
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Buffer_h
|
||||
#define AMF_Buffer_h
|
||||
#pragma once
|
||||
|
||||
#include "Data.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( push )
|
||||
#pragma warning(disable : 4263)
|
||||
#pragma warning(disable : 4264)
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMF_BUFFER_USAGE translates to D3D11_BIND_FLAG or VkBufferUsageFlagBits
|
||||
// bit mask
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_BUFFER_USAGE_BITS
|
||||
{ // D3D11 D3D12 Vulkan
|
||||
AMF_BUFFER_USAGE_DEFAULT = 0x80000000, // D3D11_USAGE_STAGING, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT
|
||||
AMF_BUFFER_USAGE_NONE = 0x00000000, // 0 , D3D12_RESOURCE_FLAG_NONE, 0
|
||||
AMF_BUFFER_USAGE_CONSTANT = 0x00000001, // D3D11_BIND_CONSTANT_BUFFER, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT
|
||||
AMF_BUFFER_USAGE_SHADER_RESOURCE = 0x00000002, // D3D11_BIND_SHADER_RESOURCE, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT
|
||||
AMF_BUFFER_USAGE_UNORDERED_ACCESS = 0x00000004, // D3D11_BIND_UNORDERED_ACCESS, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT
|
||||
AMF_BUFFER_USAGE_TRANSFER_SRC = 0x00000008, // VK_BUFFER_USAGE_TRANSFER_SRC_BIT
|
||||
AMF_BUFFER_USAGE_TRANSFER_DST = 0x00000010, // VK_BUFFER_USAGE_TRANSFER_DST_BIT
|
||||
AMF_BUFFER_USAGE_NOSYNC = 0x00000020, // no fence (AMFFenceGUID) created no semaphore (AMFVulkanSync::hSemaphore) created
|
||||
AMF_BUFFER_USAGE_DECODER_SRC = 0x00000040, // VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR
|
||||
} AMF_BUFFER_USAGE_BITS;
|
||||
typedef amf_flags AMF_BUFFER_USAGE;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFBufferObserver interface - callback
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMFBuffer;
|
||||
class AMF_NO_VTABLE AMFBufferObserver
|
||||
{
|
||||
public:
|
||||
virtual void AMF_STD_CALL OnBufferDataRelease(AMFBuffer* pBuffer) = 0;
|
||||
};
|
||||
#else // #if defined(__cplusplus)
|
||||
typedef struct AMFBuffer AMFBuffer;
|
||||
typedef struct AMFBufferObserver AMFBufferObserver;
|
||||
|
||||
typedef struct AMFBufferObserverVtbl
|
||||
{
|
||||
void (AMF_STD_CALL *OnBufferDataRelease)(AMFBufferObserver* pThis, AMFBuffer* pBuffer);
|
||||
} AMFBufferObserverVtbl;
|
||||
|
||||
struct AMFBufferObserver
|
||||
{
|
||||
const AMFBufferObserverVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFBuffer interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFBuffer : public AMFData
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xb04b7248, 0xb6f0, 0x4321, 0xb6, 0x91, 0xba, 0xa4, 0x74, 0xf, 0x9f, 0xcb)
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL SetSize(amf_size newSize) = 0;
|
||||
virtual amf_size AMF_STD_CALL GetSize() = 0;
|
||||
virtual void* AMF_STD_CALL GetNative() = 0;
|
||||
|
||||
// Observer management
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Woverloaded-virtual"
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
|
||||
#endif
|
||||
|
||||
virtual void AMF_STD_CALL AddObserver(AMFBufferObserver* pObserver) = 0;
|
||||
virtual void AMF_STD_CALL RemoveObserver(AMFBufferObserver* pObserver) = 0;
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFBuffer> AMFBufferPtr;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFBuffer, 0xb04b7248, 0xb6f0, 0x4321, 0xb6, 0x91, 0xba, 0xa4, 0x74, 0xf, 0x9f, 0xcb)
|
||||
|
||||
typedef struct AMFBufferVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFBuffer* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFBuffer* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFBuffer* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFBuffer* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFBuffer* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFBuffer* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFBuffer* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFBuffer* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFBuffer* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFBuffer* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFBuffer* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFBuffer* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFBuffer* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFData interface
|
||||
|
||||
AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryType)(AMFBuffer* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *Duplicate)(AMFBuffer* pThis, AMF_MEMORY_TYPE type, AMFData** ppData);
|
||||
AMF_RESULT (AMF_STD_CALL *Convert)(AMFBuffer* pThis, AMF_MEMORY_TYPE type); // optimal interop if possilble. Copy through host memory if needed
|
||||
AMF_RESULT (AMF_STD_CALL *Interop)(AMFBuffer* pThis, AMF_MEMORY_TYPE type); // only optimal interop if possilble. No copy through host memory for GPU objects
|
||||
|
||||
AMF_DATA_TYPE (AMF_STD_CALL *GetDataType)(AMFBuffer* pThis);
|
||||
|
||||
amf_bool (AMF_STD_CALL *IsReusable)(AMFBuffer* pThis);
|
||||
|
||||
void (AMF_STD_CALL *SetPts)(AMFBuffer* pThis, amf_pts pts);
|
||||
amf_pts (AMF_STD_CALL *GetPts)(AMFBuffer* pThis);
|
||||
void (AMF_STD_CALL *SetDuration)(AMFBuffer* pThis, amf_pts duration);
|
||||
amf_pts (AMF_STD_CALL *GetDuration)(AMFBuffer* pThis);
|
||||
|
||||
// AMFBuffer interface
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *SetSize)(AMFBuffer* pThis, amf_size newSize);
|
||||
amf_size (AMF_STD_CALL *GetSize)(AMFBuffer* pThis);
|
||||
void* (AMF_STD_CALL *GetNative)(AMFBuffer* pThis);
|
||||
|
||||
// Observer management
|
||||
void (AMF_STD_CALL *AddObserver_Buffer)(AMFBuffer* pThis, AMFBufferObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver_Buffer)(AMFBuffer* pThis, AMFBufferObserver* pObserver);
|
||||
|
||||
} AMFBufferVtbl;
|
||||
|
||||
struct AMFBuffer
|
||||
{
|
||||
const AMFBufferVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#if defined(__cplusplus)
|
||||
} // namespace
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
#endif //#ifndef AMF_Buffer_h
|
||||
302
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Compute.h
vendored
Normal file
302
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Compute.h
vendored
Normal file
@@ -0,0 +1,302 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
/**
|
||||
***************************************************************************************************
|
||||
* @file Compute.h
|
||||
* @brief AMFCompute interface declaration
|
||||
***************************************************************************************************
|
||||
*/
|
||||
#ifndef AMF_Compute_h
|
||||
#define AMF_Compute_h
|
||||
#pragma once
|
||||
|
||||
#include "Buffer.h"
|
||||
#include "Surface.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
typedef amf_uint64 AMF_KERNEL_ID;
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// enumerations for plane conversion
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_CHANNEL_ORDER
|
||||
{
|
||||
AMF_CHANNEL_ORDER_INVALID = 0,
|
||||
AMF_CHANNEL_ORDER_R = 1,
|
||||
AMF_CHANNEL_ORDER_RG = 2,
|
||||
AMF_CHANNEL_ORDER_BGRA = 3,
|
||||
AMF_CHANNEL_ORDER_RGBA = 4,
|
||||
AMF_CHANNEL_ORDER_ARGB = 5,
|
||||
AMF_CHANNEL_ORDER_YUY2 = 6,
|
||||
} AMF_CHANNEL_ORDER;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_CHANNEL_TYPE
|
||||
{
|
||||
AMF_CHANNEL_INVALID = 0,
|
||||
AMF_CHANNEL_UNSIGNED_INT8 = 1,
|
||||
AMF_CHANNEL_UNSIGNED_INT32 = 2,
|
||||
AMF_CHANNEL_UNORM_INT8 = 3,
|
||||
AMF_CHANNEL_UNORM_INT16 = 4,
|
||||
AMF_CHANNEL_SNORM_INT16 = 5,
|
||||
AMF_CHANNEL_FLOAT = 6,
|
||||
AMF_CHANNEL_FLOAT16 = 7,
|
||||
AMF_CHANNEL_UNSIGNED_INT16 = 8,
|
||||
AMF_CHANNEL_UNORM_INT_101010 = 9,
|
||||
} AMF_CHANNEL_TYPE;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#define AMF_STRUCTURED_BUFFER_FORMAT L"StructuredBufferFormat" // amf_int64(AMF_CHANNEL_TYPE), default - AMF_CHANNEL_UNSIGNED_INT32; to be set on AMFBuffer objects
|
||||
#if defined(_WIN32)
|
||||
AMF_WEAK GUID AMFStructuredBufferFormatGUID = { 0x90c5d674, 0xe90, 0x4181, {0xbd, 0xef, 0x26, 0x13, 0xc1, 0xdf, 0xa3, 0xbd} }; // UINT(DXGI_FORMAT), default - DXGI_FORMAT_R32_UINT; to be set on ID3D11Buffer or ID3D11Texture2D objects when used natively
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// enumeration argument type
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_ARGUMENT_ACCESS_TYPE
|
||||
{
|
||||
AMF_ARGUMENT_ACCESS_READ = 0,
|
||||
AMF_ARGUMENT_ACCESS_WRITE = 1,
|
||||
AMF_ARGUMENT_ACCESS_READWRITE = 2,
|
||||
AMF_ARGUMENT_ACCESS_READWRITE_MASK = 0xFFFF,
|
||||
//Sampler parameters
|
||||
AMF_ARGUMENT_SAMPLER_LINEAR = 0x10000000,
|
||||
AMF_ARGUMENT_SAMPLER_NORM_COORD = 0x20000000,
|
||||
AMF_ARGUMENT_SAMPLER_POINT = 0x40000000,
|
||||
AMF_ARGUMENT_SAMPLER_MASK = 0xFFFF0000,
|
||||
} AMF_ARGUMENT_ACCESS_TYPE;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFComputeKernel interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFComputeKernel : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x94815701, 0x6c84, 0x4ba6, 0xa9, 0xfe, 0xe9, 0xad, 0x40, 0xf8, 0x8, 0x8)
|
||||
|
||||
virtual void* AMF_STD_CALL GetNative() = 0;
|
||||
virtual const wchar_t* AMF_STD_CALL GetIDName() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL SetArgPlaneNative(amf_size index, void* pPlane, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL SetArgBufferNative(amf_size index, void* pBuffer, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL SetArgPlane(amf_size index, AMFPlane* pPlane, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL SetArgBuffer(amf_size index, AMFBuffer* pBuffer, AMF_ARGUMENT_ACCESS_TYPE eAccess) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL SetArgInt32(amf_size index, amf_int32 data) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL SetArgInt64(amf_size index, amf_int64 data) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL SetArgFloat(amf_size index, amf_float data) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL SetArgBlob(amf_size index, amf_size dataSize, const void* pData) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL GetCompileWorkgroupSize(amf_size workgroupSize[3]) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL Enqueue(amf_size dimension, amf_size globalOffset[3], amf_size globalSize[3], amf_size localSize[3]) = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFComputeKernel> AMFComputeKernelPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFComputeKernel, 0x94815701, 0x6c84, 0x4ba6, 0xa9, 0xfe, 0xe9, 0xad, 0x40, 0xf8, 0x8, 0x8)
|
||||
typedef struct AMFComputeKernel AMFComputeKernel;
|
||||
|
||||
typedef struct AMFComputeKernelVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFComputeKernel* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFComputeKernel* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComputeKernel* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFComputeKernel interface
|
||||
|
||||
} AMFComputeKernelVtbl;
|
||||
|
||||
struct AMFComputeKernel
|
||||
{
|
||||
const AMFComputeKernelVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif //#if defined(__cplusplus)
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFComputeSyncPoint interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFComputeSyncPoint : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x66f33fe6, 0xaae, 0x4e65, 0xba, 0x3, 0xea, 0x8b, 0xa3, 0x60, 0x11, 0x2)
|
||||
|
||||
virtual amf_bool AMF_STD_CALL IsCompleted() = 0;
|
||||
virtual void AMF_STD_CALL Wait() = 0;
|
||||
};
|
||||
typedef AMFInterfacePtr_T<AMFComputeSyncPoint> AMFComputeSyncPointPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFComputeSyncPoint, 0x66f33fe6, 0xaae, 0x4e65, 0xba, 0x3, 0xea, 0x8b, 0xa3, 0x60, 0x11, 0x2)
|
||||
typedef struct AMFComputeSyncPoint AMFComputeSyncPoint;
|
||||
|
||||
typedef struct AMFComputeSyncPointVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFComputeSyncPoint* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFComputeSyncPoint* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComputeSyncPoint* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFComputeSyncPoint interface
|
||||
amf_bool (AMF_STD_CALL *IsCompleted)(AMFComputeSyncPoint* pThis);
|
||||
void (AMF_STD_CALL *Wait)(AMFComputeSyncPoint* pThis);
|
||||
|
||||
} AMFComputeSyncPointVtbl;
|
||||
|
||||
struct AMFComputeSyncPoint
|
||||
{
|
||||
const AMFComputeSyncPointVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFCompute interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFCompute : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x3846233a, 0x3f43, 0x443f, 0x8a, 0x45, 0x75, 0x22, 0x11, 0xa9, 0xfb, 0xd5)
|
||||
|
||||
virtual AMF_MEMORY_TYPE AMF_STD_CALL GetMemoryType() = 0;
|
||||
|
||||
virtual void* AMF_STD_CALL GetNativeContext() = 0;
|
||||
virtual void* AMF_STD_CALL GetNativeDeviceID() = 0;
|
||||
virtual void* AMF_STD_CALL GetNativeCommandQueue() = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL GetKernel(AMF_KERNEL_ID kernelID, AMFComputeKernel** kernel) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL PutSyncPoint(AMFComputeSyncPoint** ppSyncPoint) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL FinishQueue() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL FlushQueue() = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL FillPlane(AMFPlane *pPlane, const amf_size origin[3], const amf_size region[3], const void* pColor) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL FillBuffer(AMFBuffer* pBuffer, amf_size dstOffset, amf_size dstSize, const void* pSourcePattern, amf_size patternSize) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL ConvertPlaneToBuffer(AMFPlane *pSrcPlane, AMFBuffer** ppDstBuffer) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL CopyBuffer(AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffset) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CopyPlane(AMFPlane *pSrcPlane, const amf_size srcOrigin[3], const amf_size region[3], AMFPlane *pDstPlane, const amf_size dstOrigin[3]) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL CopyBufferToHost(AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, void* pDest, amf_bool blocking) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CopyBufferFromHost(const void* pSource, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffsetInBytes, amf_bool blocking) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL CopyPlaneToHost(AMFPlane *pSrcPlane, const amf_size origin[3], const amf_size region[3], void* pDest, amf_size dstPitch, amf_bool blocking) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CopyPlaneFromHost(void* pSource, const amf_size origin[3], const amf_size region[3], amf_size srcPitch, AMFPlane *pDstPlane, amf_bool blocking) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL ConvertPlaneToPlane(AMFPlane* pSrcPlane, AMFPlane** ppDstPlane, AMF_CHANNEL_ORDER order, AMF_CHANNEL_TYPE type) = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFCompute> AMFComputePtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFCompute, 0x3846233a, 0x3f43, 0x443f, 0x8a, 0x45, 0x75, 0x22, 0x11, 0xa9, 0xfb, 0xd5)
|
||||
typedef struct AMFCompute AMFCompute;
|
||||
|
||||
typedef struct AMFComputeVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFCompute* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFCompute* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFCompute* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFCompute interface
|
||||
AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryType)(AMFCompute* pThis);
|
||||
void* (AMF_STD_CALL *GetNativeContext)(AMFCompute* pThis);
|
||||
void* (AMF_STD_CALL *GetNativeDeviceID)(AMFCompute* pThis);
|
||||
void* (AMF_STD_CALL *GetNativeCommandQueue)(AMFCompute* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetKernel)(AMFCompute* pThis, AMF_KERNEL_ID kernelID, AMFComputeKernel** kernel);
|
||||
AMF_RESULT (AMF_STD_CALL *PutSyncPoint)(AMFCompute* pThis, AMFComputeSyncPoint** ppSyncPoint);
|
||||
AMF_RESULT (AMF_STD_CALL *FinishQueue)(AMFCompute* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *FlushQueue)(AMFCompute* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *FillPlane)(AMFCompute* pThis, AMFPlane *pPlane, const amf_size origin[3], const amf_size region[3], const void* pColor);
|
||||
AMF_RESULT (AMF_STD_CALL *FillBuffer)(AMFCompute* pThis, AMFBuffer* pBuffer, amf_size dstOffset, amf_size dstSize, const void* pSourcePattern, amf_size patternSize);
|
||||
AMF_RESULT (AMF_STD_CALL *ConvertPlaneToBuffer)(AMFCompute* pThis, AMFPlane *pSrcPlane, AMFBuffer** ppDstBuffer);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyBuffer)(AMFCompute* pThis, AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffset);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyPlane)(AMFCompute* pThis, AMFPlane *pSrcPlane, const amf_size srcOrigin[3], const amf_size region[3], AMFPlane *pDstPlane, const amf_size dstOrigin[3]);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyBufferToHost)(AMFCompute* pThis, AMFBuffer* pSrcBuffer, amf_size srcOffset, amf_size size, void* pDest, amf_bool blocking);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyBufferFromHost)(AMFCompute* pThis, const void* pSource, amf_size size, AMFBuffer* pDstBuffer, amf_size dstOffsetInBytes, amf_bool blocking);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyPlaneToHost)(AMFCompute* pThis, AMFPlane *pSrcPlane, const amf_size origin[3], const amf_size region[3], void* pDest, amf_size dstPitch, amf_bool blocking);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyPlaneFromHost)(AMFCompute* pThis, void* pSource, const amf_size origin[3], const amf_size region[3], amf_size srcPitch, AMFPlane *pDstPlane, amf_bool blocking);
|
||||
AMF_RESULT (AMF_STD_CALL *ConvertPlaneToPlane)(AMFCompute* pThis, AMFPlane* pSrcPlane, AMFPlane** ppDstPlane, AMF_CHANNEL_ORDER order, AMF_CHANNEL_TYPE type);
|
||||
} AMFComputeVtbl;
|
||||
|
||||
struct AMFCompute
|
||||
{
|
||||
const AMFComputeVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFPrograms interface - singleton
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFPrograms
|
||||
{
|
||||
public:
|
||||
virtual AMF_RESULT AMF_STD_CALL RegisterKernelSourceFile(AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, const wchar_t* filepath, const char* options) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL RegisterKernelSource(AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL RegisterKernelBinary(AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL RegisterKernelSource1(AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL RegisterKernelBinary1(AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options) = 0;
|
||||
};
|
||||
#else // #if defined(__cplusplus)
|
||||
typedef struct AMFPrograms AMFPrograms;
|
||||
typedef struct AMFProgramsVtbl
|
||||
{
|
||||
AMF_RESULT (AMF_STD_CALL *RegisterKernelSourceFile)(AMFPrograms* pThis, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, const wchar_t* filepath, const char* options);
|
||||
AMF_RESULT (AMF_STD_CALL *RegisterKernelSource)(AMFPrograms* pThis, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options);
|
||||
AMF_RESULT (AMF_STD_CALL *RegisterKernelBinary)(AMFPrograms* pThis, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options);
|
||||
AMF_RESULT (AMF_STD_CALL *RegisterKernelSource1)(AMFPrograms* pThis, AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options);
|
||||
AMF_RESULT (AMF_STD_CALL *RegisterKernelBinary1)(AMFPrograms* pThis, AMF_MEMORY_TYPE eMemoryType, AMF_KERNEL_ID* pKernelID, const wchar_t* kernelid_name, const char* kernelName, amf_size dataSize, const amf_uint8* data, const char* options);
|
||||
} AMFProgramsVtbl;
|
||||
|
||||
struct AMFPrograms
|
||||
{
|
||||
const AMFProgramsVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // namespace amf
|
||||
#endif
|
||||
|
||||
#endif // AMF_Compute_h
|
||||
147
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/ComputeFactory.h
vendored
Normal file
147
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/ComputeFactory.h
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_ComputeFactory_h
|
||||
#define AMF_ComputeFactory_h
|
||||
#pragma once
|
||||
|
||||
#include "Compute.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
// compute device audio capabilities accessed via GetProperties() from AMFComputeDevice
|
||||
#define AMF_DEVICE_NAME L"DeviceName" // char*, string, device name
|
||||
#define AMF_DRIVER_VERSION_NAME L"DriverVersion" // char*, string, driver version
|
||||
#define AMF_AUDIO_CONVOLUTION_MAX_STREAMS L"ConvolutionMaxStreams" // amf_int64, maximum number of audio streams supported in realtime
|
||||
#define AMF_AUDIO_CONVOLUTION_LENGTH L"ConvolutionLength" // amf_int64, length of convolution in samples
|
||||
#define AMF_AUDIO_CONVOLUTION_BUFFER_SIZE L"ConvolutionBufferSize" // amf_int64, buffer size in samples
|
||||
#define AMF_AUDIO_CONVOLUTION_SAMPLE_RATE L"ConvolutionSampleRate" // amf_int64, sample rate
|
||||
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFComputeDevice : public AMFPropertyStorage
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xb79d7cf6, 0x2c5c, 0x4deb, 0xb8, 0x96, 0xa2, 0x9e, 0xbe, 0xa6, 0xe3, 0x97)
|
||||
|
||||
virtual void* AMF_STD_CALL GetNativePlatform() = 0;
|
||||
virtual void* AMF_STD_CALL GetNativeDeviceID() = 0;
|
||||
virtual void* AMF_STD_CALL GetNativeContext() = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateCompute(void *reserved, AMFCompute **ppCompute) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateComputeEx(void* pCommandQueue, AMFCompute **ppCompute) = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFComputeDevice> AMFComputeDevicePtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFComputeDevice, 0xb79d7cf6, 0x2c5c, 0x4deb, 0xb8, 0x96, 0xa2, 0x9e, 0xbe, 0xa6, 0xe3, 0x97)
|
||||
typedef struct AMFComputeDevice AMFComputeDevice;
|
||||
|
||||
typedef struct AMFComputeDeviceVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFComputeDevice* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFComputeDevice* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComputeDevice* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFComputeDevice* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFComputeDevice* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFComputeDevice* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFComputeDevice* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFComputeDevice* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFComputeDevice* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFComputeDevice* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFComputeDevice* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFComputeDevice* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFComputeDevice* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFComputeDevice interface
|
||||
void* (AMF_STD_CALL *GetNativePlatform)(AMFComputeDevice* pThis);
|
||||
void* (AMF_STD_CALL *GetNativeDeviceID)(AMFComputeDevice* pThis);
|
||||
void* (AMF_STD_CALL *GetNativeContext)(AMFComputeDevice* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *CreateCompute)(AMFComputeDevice* pThis, void *reserved, AMFCompute **ppCompute);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateComputeEx)(AMFComputeDevice* pThis, void* pCommandQueue, AMFCompute **ppCompute);
|
||||
|
||||
} AMFComputeDeviceVtbl;
|
||||
|
||||
struct AMFComputeDevice
|
||||
{
|
||||
const AMFComputeDeviceVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFComputeFactory : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xe3c24bd7, 0x2d83, 0x416c, 0x8c, 0x4e, 0xfd, 0x13, 0xca, 0x86, 0xf4, 0xd0)
|
||||
|
||||
virtual amf_int32 AMF_STD_CALL GetDeviceCount() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetDeviceAt(amf_int32 index, AMFComputeDevice **ppDevice) = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFComputeFactory> AMFComputeFactoryPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFComputeFactory, 0xe3c24bd7, 0x2d83, 0x416c, 0x8c, 0x4e, 0xfd, 0x13, 0xca, 0x86, 0xf4, 0xd0)
|
||||
typedef struct AMFComputeFactory AMFComputeFactory;
|
||||
|
||||
typedef struct AMFComputeFactoryVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFComputeFactory* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFComputeFactory* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFComputeFactory* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFComputeFactory interface
|
||||
amf_int32 (AMF_STD_CALL *GetDeviceCount)(AMFComputeFactory* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetDeviceAt)(AMFComputeFactory* pThis, amf_int32 index, AMFComputeDevice **ppDevice);
|
||||
} AMFComputeFactoryVtbl;
|
||||
|
||||
struct AMFComputeFactory
|
||||
{
|
||||
const AMFComputeFactoryVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
} // namespace amf
|
||||
#endif
|
||||
|
||||
#endif // AMF_ComputeFactory_h
|
||||
786
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Context.h
vendored
Normal file
786
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Context.h
vendored
Normal file
@@ -0,0 +1,786 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Context_h
|
||||
#define AMF_Context_h
|
||||
#pragma once
|
||||
|
||||
#include "Buffer.h"
|
||||
#include "AudioBuffer.h"
|
||||
#include "Surface.h"
|
||||
#include "Compute.h"
|
||||
#include "ComputeFactory.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFContext interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFContext : public AMFPropertyStorage
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xa76a13f0, 0xd80e, 0x4fcc, 0xb5, 0x8, 0x65, 0xd0, 0xb5, 0x2e, 0xd9, 0xee)
|
||||
|
||||
// Cleanup
|
||||
virtual AMF_RESULT AMF_STD_CALL Terminate() = 0;
|
||||
|
||||
// DX9
|
||||
virtual AMF_RESULT AMF_STD_CALL InitDX9(void* pDX9Device) = 0;
|
||||
virtual void* AMF_STD_CALL GetDX9Device(AMF_DX_VERSION dxVersionRequired = AMF_DX9) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL LockDX9() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL UnlockDX9() = 0;
|
||||
class AMFDX9Locker;
|
||||
|
||||
// DX11
|
||||
virtual AMF_RESULT AMF_STD_CALL InitDX11(void* pDX11Device, AMF_DX_VERSION dxVersionRequired = AMF_DX11_0) = 0;
|
||||
virtual void* AMF_STD_CALL GetDX11Device(AMF_DX_VERSION dxVersionRequired = AMF_DX11_0) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL LockDX11() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL UnlockDX11() = 0;
|
||||
class AMFDX11Locker;
|
||||
|
||||
// OpenCL
|
||||
virtual AMF_RESULT AMF_STD_CALL InitOpenCL(void* pCommandQueue = NULL) = 0;
|
||||
virtual void* AMF_STD_CALL GetOpenCLContext() = 0;
|
||||
virtual void* AMF_STD_CALL GetOpenCLCommandQueue() = 0;
|
||||
virtual void* AMF_STD_CALL GetOpenCLDeviceID() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetOpenCLComputeFactory(AMFComputeFactory **ppFactory) = 0; // advanced compute - multiple queries
|
||||
virtual AMF_RESULT AMF_STD_CALL InitOpenCLEx(AMFComputeDevice *pDevice) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL LockOpenCL() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL UnlockOpenCL() = 0;
|
||||
class AMFOpenCLLocker;
|
||||
|
||||
// OpenGL
|
||||
virtual AMF_RESULT AMF_STD_CALL InitOpenGL(amf_handle hOpenGLContext, amf_handle hWindow, amf_handle hDC) = 0;
|
||||
virtual amf_handle AMF_STD_CALL GetOpenGLContext() = 0;
|
||||
virtual amf_handle AMF_STD_CALL GetOpenGLDrawable() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL LockOpenGL() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL UnlockOpenGL() = 0;
|
||||
class AMFOpenGLLocker;
|
||||
|
||||
// XV - Linux
|
||||
virtual AMF_RESULT AMF_STD_CALL InitXV(void* pXVDevice) = 0;
|
||||
virtual void* AMF_STD_CALL GetXVDevice() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL LockXV() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL UnlockXV() = 0;
|
||||
class AMFXVLocker;
|
||||
|
||||
// Gralloc - Android
|
||||
virtual AMF_RESULT AMF_STD_CALL InitGralloc(void* pGrallocDevice) = 0;
|
||||
virtual void* AMF_STD_CALL GetGrallocDevice() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL LockGralloc() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL UnlockGralloc() = 0;
|
||||
class AMFGrallocLocker;
|
||||
|
||||
// Allocation
|
||||
virtual AMF_RESULT AMF_STD_CALL AllocBuffer(AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL AllocSurface(AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMFSurface** ppSurface) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL AllocAudioBuffer(AMF_MEMORY_TYPE type, AMF_AUDIO_FORMAT format, amf_int32 samples, amf_int32 sampleRate, amf_int32 channels,
|
||||
AMFAudioBuffer** ppAudioBuffer) = 0;
|
||||
|
||||
// Wrap existing objects
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateBufferFromHostNative(void* pHostBuffer, amf_size size, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromHostNative(AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, void* pData,
|
||||
AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromDX9Native(void* pDX9Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromDX11Native(void* pDX11Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromOpenGLNative(AMF_SURFACE_FORMAT format, amf_handle hGLTextureID, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromGrallocNative(amf_handle hGrallocSurface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromOpenCLNative(AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, void** pClPlanes,
|
||||
AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateBufferFromOpenCLNative(void* pCLBuffer, amf_size size, AMFBuffer** ppBuffer) = 0;
|
||||
|
||||
// Access to AMFCompute interface - AMF_MEMORY_OPENCL, AMF_MEMORY_COMPUTE_FOR_DX9, AMF_MEMORY_COMPUTE_FOR_DX11 are currently supported
|
||||
virtual AMF_RESULT AMF_STD_CALL GetCompute(AMF_MEMORY_TYPE eMemType, AMFCompute** ppCompute) = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFContext> AMFContextPtr;
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFContext1 interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
class AMF_NO_VTABLE AMFContext1 : public AMFContext
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xd9e9f868, 0x6220, 0x44c6, 0xa2, 0x2f, 0x7c, 0xd6, 0xda, 0xc6, 0x86, 0x46)
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateBufferFromDX11Native(void* pHostBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL AllocBufferEx(AMF_MEMORY_TYPE type, amf_size size, AMF_BUFFER_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFBuffer** ppBuffer) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL AllocSurfaceEx(AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMF_SURFACE_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFSurface** ppSurface) = 0;
|
||||
|
||||
// Vulkan - Windows, Linux
|
||||
virtual AMF_RESULT AMF_STD_CALL InitVulkan(void* pVulkanDevice) = 0;
|
||||
virtual void* AMF_STD_CALL GetVulkanDevice() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL LockVulkan() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL UnlockVulkan() = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromVulkanNative(void* pVulkanImage, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateBufferFromVulkanNative(void* pVulkanBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetVulkanDeviceExtensions(amf_size *pCount, const char **ppExtensions) = 0;
|
||||
|
||||
|
||||
class AMFVulkanLocker;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFContext1> AMFContext1Ptr;
|
||||
|
||||
class AMF_NO_VTABLE AMFContext2 : public AMFContext1
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x726241d3, 0xbd46, 0x4e90, 0x99, 0x68, 0x93, 0xe0, 0x7e, 0xa2, 0x98, 0x4d)
|
||||
|
||||
// DX12
|
||||
virtual AMF_RESULT AMF_STD_CALL InitDX12(void* pDX11Device, AMF_DX_VERSION dxVersionRequired = AMF_DX12) = 0;
|
||||
virtual void* AMF_STD_CALL GetDX12Device(AMF_DX_VERSION dxVersionRequired = AMF_DX12) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL LockDX12() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL UnlockDX12() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateSurfaceFromDX12Native(void* pResourceTexture, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateBufferFromDX12Native(void* pResourceBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver) = 0;
|
||||
|
||||
class AMFDX12Locker;
|
||||
};
|
||||
typedef AMFInterfacePtr_T<AMFContext2> AMFContext2Ptr;
|
||||
#else
|
||||
typedef struct AMFContext AMFContext;
|
||||
AMF_DECLARE_IID(AMFContext, 0xa76a13f0, 0xd80e, 0x4fcc, 0xb5, 0x8, 0x65, 0xd0, 0xb5, 0x2e, 0xd9, 0xee)
|
||||
|
||||
typedef struct AMFContextVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFContext* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFContext* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFContext* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFInterface AMFPropertyStorage
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFContext* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFContext* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFContext* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFContext* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFContext* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFContext* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFContext* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFContext* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFContext interface
|
||||
|
||||
// Cleanup
|
||||
AMF_RESULT (AMF_STD_CALL *Terminate)(AMFContext* pThis);
|
||||
|
||||
// DX9
|
||||
AMF_RESULT (AMF_STD_CALL *InitDX9)(AMFContext* pThis, void* pDX9Device);
|
||||
void* (AMF_STD_CALL *GetDX9Device)(AMFContext* pThis, AMF_DX_VERSION dxVersionRequired);
|
||||
AMF_RESULT (AMF_STD_CALL *LockDX9)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockDX9)(AMFContext* pThis);
|
||||
// DX11
|
||||
AMF_RESULT (AMF_STD_CALL *InitDX11)(AMFContext* pThis, void* pDX11Device, AMF_DX_VERSION dxVersionRequired);
|
||||
void* (AMF_STD_CALL *GetDX11Device)(AMFContext* pThis, AMF_DX_VERSION dxVersionRequired);
|
||||
AMF_RESULT (AMF_STD_CALL *LockDX11)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockDX11)(AMFContext* pThis);
|
||||
|
||||
// OpenCL
|
||||
AMF_RESULT (AMF_STD_CALL *InitOpenCL)(AMFContext* pThis, void* pCommandQueue);
|
||||
void* (AMF_STD_CALL *GetOpenCLContext)(AMFContext* pThis);
|
||||
void* (AMF_STD_CALL *GetOpenCLCommandQueue)(AMFContext* pThis);
|
||||
void* (AMF_STD_CALL *GetOpenCLDeviceID)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetOpenCLComputeFactory)(AMFContext* pThis, AMFComputeFactory **ppFactory); // advanced compute - multiple queries
|
||||
AMF_RESULT (AMF_STD_CALL *InitOpenCLEx)(AMFContext* pThis, AMFComputeDevice *pDevice);
|
||||
AMF_RESULT (AMF_STD_CALL *LockOpenCL)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockOpenCL)(AMFContext* pThis);
|
||||
|
||||
// OpenGL
|
||||
AMF_RESULT (AMF_STD_CALL *InitOpenGL)(AMFContext* pThis, amf_handle hOpenGLContext, amf_handle hWindow, amf_handle hDC);
|
||||
amf_handle (AMF_STD_CALL *GetOpenGLContext)(AMFContext* pThis);
|
||||
amf_handle (AMF_STD_CALL *GetOpenGLDrawable)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *LockOpenGL)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockOpenGL)(AMFContext* pThis);
|
||||
// XV - Linux
|
||||
AMF_RESULT (AMF_STD_CALL *InitXV)(AMFContext* pThis, void* pXVDevice);
|
||||
void* (AMF_STD_CALL *GetXVDevice)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *LockXV)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockXV)(AMFContext* pThis);
|
||||
|
||||
// Gralloc - Android
|
||||
AMF_RESULT (AMF_STD_CALL *InitGralloc)(AMFContext* pThis, void* pGrallocDevice);
|
||||
void* (AMF_STD_CALL *GetGrallocDevice)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *LockGralloc)(AMFContext* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockGralloc)(AMFContext* pThis);
|
||||
// Allocation
|
||||
AMF_RESULT (AMF_STD_CALL *AllocBuffer)(AMFContext* pThis, AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer);
|
||||
AMF_RESULT (AMF_STD_CALL *AllocSurface)(AMFContext* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMFSurface** ppSurface);
|
||||
AMF_RESULT (AMF_STD_CALL *AllocAudioBuffer)(AMFContext* pThis, AMF_MEMORY_TYPE type, AMF_AUDIO_FORMAT format, amf_int32 samples, amf_int32 sampleRate, amf_int32 channels,
|
||||
AMFAudioBuffer** ppAudioBuffer);
|
||||
|
||||
// Wrap existing objects
|
||||
AMF_RESULT (AMF_STD_CALL *CreateBufferFromHostNative)(AMFContext* pThis, void* pHostBuffer, amf_size size, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromHostNative)(AMFContext* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, void* pData,
|
||||
AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX9Native)(AMFContext* pThis, void* pDX9Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX11Native)(AMFContext* pThis, void* pDX11Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenGLNative)(AMFContext* pThis, AMF_SURFACE_FORMAT format, amf_handle hGLTextureID, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromGrallocNative)(AMFContext* pThis, amf_handle hGrallocSurface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenCLNative)(AMFContext* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, void** pClPlanes,
|
||||
AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateBufferFromOpenCLNative)(AMFContext* pThis, void* pCLBuffer, amf_size size, AMFBuffer** ppBuffer);
|
||||
|
||||
// Access to AMFCompute interface - AMF_MEMORY_OPENCL, AMF_MEMORY_COMPUTE_FOR_DX9, AMF_MEMORY_COMPUTE_FOR_DX11 are currently supported
|
||||
AMF_RESULT (AMF_STD_CALL *GetCompute)(AMFContext* pThis, AMF_MEMORY_TYPE eMemType, AMFCompute** ppCompute);
|
||||
|
||||
} AMFContextVtbl;
|
||||
|
||||
struct AMFContext
|
||||
{
|
||||
const AMFContextVtbl *pVtbl;
|
||||
};
|
||||
|
||||
|
||||
typedef struct AMFContext1 AMFContext1;
|
||||
AMF_DECLARE_IID(AMFContext1, 0xd9e9f868, 0x6220, 0x44c6, 0xa2, 0x2f, 0x7c, 0xd6, 0xda, 0xc6, 0x86, 0x46)
|
||||
|
||||
typedef struct AMFContext1Vtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFContext1* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFContext1* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFContext1* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFInterface AMFPropertyStorage
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFContext1* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFContext1* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFContext1* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFContext1* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFContext1* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFContext1* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFContext1* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFContext1* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFContext interface
|
||||
|
||||
// Cleanup
|
||||
AMF_RESULT (AMF_STD_CALL *Terminate)(AMFContext1* pThis);
|
||||
|
||||
// DX9
|
||||
AMF_RESULT (AMF_STD_CALL *InitDX9)(AMFContext1* pThis, void* pDX9Device);
|
||||
void* (AMF_STD_CALL *GetDX9Device)(AMFContext1* pThis, AMF_DX_VERSION dxVersionRequired);
|
||||
AMF_RESULT (AMF_STD_CALL *LockDX9)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockDX9)(AMFContext1* pThis);
|
||||
// DX11
|
||||
AMF_RESULT (AMF_STD_CALL *InitDX11)(AMFContext1* pThis, void* pDX11Device, AMF_DX_VERSION dxVersionRequired);
|
||||
void* (AMF_STD_CALL *GetDX11Device)(AMFContext1* pThis, AMF_DX_VERSION dxVersionRequired);
|
||||
AMF_RESULT (AMF_STD_CALL *LockDX11)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockDX11)(AMFContext1* pThis);
|
||||
|
||||
// OpenCL
|
||||
AMF_RESULT (AMF_STD_CALL *InitOpenCL)(AMFContext1* pThis, void* pCommandQueue);
|
||||
void* (AMF_STD_CALL *GetOpenCLContext)(AMFContext1* pThis);
|
||||
void* (AMF_STD_CALL *GetOpenCLCommandQueue)(AMFContext1* pThis);
|
||||
void* (AMF_STD_CALL *GetOpenCLDeviceID)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetOpenCLComputeFactory)(AMFContext1* pThis, AMFComputeFactory **ppFactory); // advanced compute - multiple queries
|
||||
AMF_RESULT (AMF_STD_CALL *InitOpenCLEx)(AMFContext1* pThis, AMFComputeDevice *pDevice);
|
||||
AMF_RESULT (AMF_STD_CALL *LockOpenCL)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockOpenCL)(AMFContext1* pThis);
|
||||
|
||||
// OpenGL
|
||||
AMF_RESULT (AMF_STD_CALL *InitOpenGL)(AMFContext1* pThis, amf_handle hOpenGLContext, amf_handle hWindow, amf_handle hDC);
|
||||
amf_handle (AMF_STD_CALL *GetOpenGLContext)(AMFContext1* pThis);
|
||||
amf_handle (AMF_STD_CALL *GetOpenGLDrawable)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *LockOpenGL)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockOpenGL)(AMFContext1* pThis);
|
||||
// XV - Linux
|
||||
AMF_RESULT (AMF_STD_CALL *InitXV)(AMFContext1* pThis, void* pXVDevice);
|
||||
void* (AMF_STD_CALL *GetXVDevice)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *LockXV)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockXV)(AMFContext1* pThis);
|
||||
|
||||
// Gralloc - Android
|
||||
AMF_RESULT (AMF_STD_CALL *InitGralloc)(AMFContext1* pThis, void* pGrallocDevice);
|
||||
void* (AMF_STD_CALL *GetGrallocDevice)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *LockGralloc)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockGralloc)(AMFContext1* pThis);
|
||||
// Allocation
|
||||
AMF_RESULT (AMF_STD_CALL *AllocBuffer)(AMFContext1* pThis, AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer);
|
||||
AMF_RESULT (AMF_STD_CALL *AllocSurface)(AMFContext1* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMFSurface** ppSurface);
|
||||
AMF_RESULT (AMF_STD_CALL *AllocAudioBuffer)(AMFContext1* pThis, AMF_MEMORY_TYPE type, AMF_AUDIO_FORMAT format, amf_int32 samples, amf_int32 sampleRate, amf_int32 channels,
|
||||
AMFAudioBuffer** ppAudioBuffer);
|
||||
|
||||
// Wrap existing objects
|
||||
AMF_RESULT (AMF_STD_CALL *CreateBufferFromHostNative)(AMFContext1* pThis, void* pHostBuffer, amf_size size, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromHostNative)(AMFContext1* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, void* pData,
|
||||
AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX9Native)(AMFContext1* pThis, void* pDX9Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX11Native)(AMFContext1* pThis, void* pDX11Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenGLNative)(AMFContext1* pThis, AMF_SURFACE_FORMAT format, amf_handle hGLTextureID, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromGrallocNative)(AMFContext1* pThis, amf_handle hGrallocSurface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenCLNative)(AMFContext1* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, void** pClPlanes,
|
||||
AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateBufferFromOpenCLNative)(AMFContext1* pThis, void* pCLBuffer, amf_size size, AMFBuffer** ppBuffer);
|
||||
|
||||
// Access to AMFCompute interface - AMF_MEMORY_OPENCL, AMF_MEMORY_COMPUTE_FOR_DX9, AMF_MEMORY_COMPUTE_FOR_DX11 are currently supported
|
||||
AMF_RESULT (AMF_STD_CALL *GetCompute)(AMFContext1* pThis, AMF_MEMORY_TYPE eMemType, AMFCompute** ppCompute);
|
||||
|
||||
// AMFContext1 interface
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *CreateBufferFromDX11Native)(AMFContext1* pThis, void* pHostBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *AllocBufferEx)(AMFContext1* pThis, AMF_MEMORY_TYPE type, amf_size size, AMF_BUFFER_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFBuffer** ppBuffer);
|
||||
AMF_RESULT (AMF_STD_CALL *AllocSurfaceEx)(AMFContext1* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMF_SURFACE_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFSurface** ppSurface);
|
||||
|
||||
// Vulkan - Windows, Linux
|
||||
AMF_RESULT (AMF_STD_CALL *InitVulkan)(AMFContext1* pThis, void* pVulkanDevice);
|
||||
void* (AMF_STD_CALL *GetVulkanDevice)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *LockVulkan)(AMFContext1* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockVulkan)(AMFContext1* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromVulkanNative)(AMFContext1* pThis, void* pVulkanImage, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateBufferFromVulkanNative)(AMFContext1* pThis, void* pVulkanBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *GetVulkanDeviceExtensions)(AMFContext1* pThis, amf_size *pCount, const char **ppExtensions);
|
||||
|
||||
} AMFContext1Vtbl;
|
||||
|
||||
struct AMFContext1
|
||||
{
|
||||
const AMFContext1Vtbl *pVtbl;
|
||||
};
|
||||
|
||||
typedef struct AMFContext2 AMFContext2;
|
||||
AMF_DECLARE_IID(AMFContext2, 0xd9e9f868, 0x6220, 0x44c6, 0xa2, 0x2f, 0x7c, 0xd6, 0xda, 0xc6, 0x86, 0x46)
|
||||
|
||||
typedef struct AMFContext2Vtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFContext2* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFContext2* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFContext2* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFInterface AMFPropertyStorage
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFContext2* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFContext2* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFContext2* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFContext2* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFContext2* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFContext2* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFContext2* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFContext2* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFContext interface
|
||||
|
||||
// Cleanup
|
||||
AMF_RESULT (AMF_STD_CALL *Terminate)(AMFContext2* pThis);
|
||||
|
||||
// DX9
|
||||
AMF_RESULT (AMF_STD_CALL *InitDX9)(AMFContext2* pThis, void* pDX9Device);
|
||||
void* (AMF_STD_CALL *GetDX9Device)(AMFContext2* pThis, AMF_DX_VERSION dxVersionRequired);
|
||||
AMF_RESULT (AMF_STD_CALL *LockDX9)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockDX9)(AMFContext2* pThis);
|
||||
// DX11
|
||||
AMF_RESULT (AMF_STD_CALL *InitDX11)(AMFContext2* pThis, void* pDX11Device, AMF_DX_VERSION dxVersionRequired);
|
||||
void* (AMF_STD_CALL *GetDX11Device)(AMFContext2* pThis, AMF_DX_VERSION dxVersionRequired);
|
||||
AMF_RESULT (AMF_STD_CALL *LockDX11)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockDX11)(AMFContext2* pThis);
|
||||
|
||||
// OpenCL
|
||||
AMF_RESULT (AMF_STD_CALL *InitOpenCL)(AMFContext2* pThis, void* pCommandQueue);
|
||||
void* (AMF_STD_CALL *GetOpenCLContext)(AMFContext2* pThis);
|
||||
void* (AMF_STD_CALL *GetOpenCLCommandQueue)(AMFContext2* pThis);
|
||||
void* (AMF_STD_CALL *GetOpenCLDeviceID)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetOpenCLComputeFactory)(AMFContext2* pThis, AMFComputeFactory **ppFactory); // advanced compute - multiple queries
|
||||
AMF_RESULT (AMF_STD_CALL *InitOpenCLEx)(AMFContext2* pThis, AMFComputeDevice *pDevice);
|
||||
AMF_RESULT (AMF_STD_CALL *LockOpenCL)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockOpenCL)(AMFContext2* pThis);
|
||||
|
||||
// OpenGL
|
||||
AMF_RESULT (AMF_STD_CALL *InitOpenGL)(AMFContext2* pThis, amf_handle hOpenGLContext, amf_handle hWindow, amf_handle hDC);
|
||||
amf_handle (AMF_STD_CALL *GetOpenGLContext)(AMFContext2* pThis);
|
||||
amf_handle (AMF_STD_CALL *GetOpenGLDrawable)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *LockOpenGL)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockOpenGL)(AMFContext2* pThis);
|
||||
// XV - Linux
|
||||
AMF_RESULT (AMF_STD_CALL *InitXV)(AMFContext2* pThis, void* pXVDevice);
|
||||
void* (AMF_STD_CALL *GetXVDevice)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *LockXV)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockXV)(AMFContext2* pThis);
|
||||
|
||||
// Gralloc - Android
|
||||
AMF_RESULT (AMF_STD_CALL *InitGralloc)(AMFContext2* pThis, void* pGrallocDevice);
|
||||
void* (AMF_STD_CALL *GetGrallocDevice)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *LockGralloc)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockGralloc)(AMFContext2* pThis);
|
||||
// Allocation
|
||||
AMF_RESULT (AMF_STD_CALL *AllocBuffer)(AMFContext2* pThis, AMF_MEMORY_TYPE type, amf_size size, AMFBuffer** ppBuffer);
|
||||
AMF_RESULT (AMF_STD_CALL *AllocSurface)(AMFContext2* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMFSurface** ppSurface);
|
||||
AMF_RESULT (AMF_STD_CALL *AllocAudioBuffer)(AMFContext2* pThis, AMF_MEMORY_TYPE type, AMF_AUDIO_FORMAT format, amf_int32 samples, amf_int32 sampleRate, amf_int32 channels, AMFAudioBuffer** ppAudioBuffer);
|
||||
|
||||
// Wrap existing objects
|
||||
AMF_RESULT (AMF_STD_CALL *CreateBufferFromHostNative)(AMFContext2* pThis, void* pHostBuffer, amf_size size, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromHostNative)(AMFContext2* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, amf_int32 hPitch, amf_int32 vPitch, void* pData,AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX9Native)(AMFContext2* pThis, void* pDX9Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX11Native)(AMFContext2* pThis, void* pDX11Surface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenGLNative)(AMFContext2* pThis, AMF_SURFACE_FORMAT format, amf_handle hGLTextureID, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromGrallocNative)(AMFContext2* pThis, amf_handle hGrallocSurface, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromOpenCLNative)(AMFContext2* pThis, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, void** pClPlanes, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateBufferFromOpenCLNative)(AMFContext2* pThis, void* pCLBuffer, amf_size size, AMFBuffer** ppBuffer);
|
||||
|
||||
// Access to AMFCompute interface - AMF_MEMORY_OPENCL, AMF_MEMORY_COMPUTE_FOR_DX9, AMF_MEMORY_COMPUTE_FOR_DX11 are currently supported
|
||||
AMF_RESULT (AMF_STD_CALL *GetCompute)(AMFContext2* pThis, AMF_MEMORY_TYPE eMemType, AMFCompute** ppCompute);
|
||||
|
||||
// AMFContext1 interface
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *CreateBufferFromDX11Native)(AMFContext2* pThis, void* pHostBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *AllocBufferEx)(AMFContext2* pThis, AMF_MEMORY_TYPE type, amf_size size, AMF_BUFFER_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFBuffer** ppBuffer);
|
||||
AMF_RESULT (AMF_STD_CALL *AllocSurfaceEx)(AMFContext2* pThis, AMF_MEMORY_TYPE type, AMF_SURFACE_FORMAT format, amf_int32 width, amf_int32 height, AMF_SURFACE_USAGE usage, AMF_MEMORY_CPU_ACCESS access, AMFSurface** ppSurface);
|
||||
|
||||
// Vulkan - Windows, Linux
|
||||
AMF_RESULT (AMF_STD_CALL *InitVulkan)(AMFContext2* pThis, void* pVulkanDevice);
|
||||
void* (AMF_STD_CALL *GetVulkanDevice)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *LockVulkan)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockVulkan)(AMFContext2* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromVulkanNative)(AMFContext2* pThis, void* pVulkanImage, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateBufferFromVulkanNative)(AMFContext2* pThis, void* pVulkanBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *GetVulkanDeviceExtensions)(AMFContext2* pThis, amf_size *pCount, const char **ppExtensions);
|
||||
|
||||
// AMFContext2 interface
|
||||
AMF_RESULT (AMF_STD_CALL *InitDX12)(AMFContext2* pThis, void* pDX11Device, AMF_DX_VERSION dxVersionRequired);
|
||||
void* (AMF_STD_CALL *GetDX12Device)(AMFContext2* pThis, AMF_DX_VERSION dxVersionRequired);
|
||||
AMF_RESULT (AMF_STD_CALL *LockDX12)(AMFContext2* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *UnlockDX12)(AMFContext2* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *CreateSurfaceFromDX12Native)(AMFContext2* pThis, void* pResourceTexture, AMFSurface** ppSurface, AMFSurfaceObserver* pObserver);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateBufferFromDX12Native)(AMFContext2* pThis, void* pResourceBuffer, AMFBuffer** ppBuffer, AMFBufferObserver* pObserver);
|
||||
|
||||
|
||||
} AMFContext2Vtbl;
|
||||
|
||||
struct AMFContext2
|
||||
{
|
||||
const AMFContext2Vtbl *pVtbl;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// Lockers
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMFContext::AMFDX9Locker
|
||||
{
|
||||
public:
|
||||
AMFDX9Locker() : m_Context(NULL)
|
||||
{}
|
||||
AMFDX9Locker(AMFContext* resources) : m_Context(NULL)
|
||||
{
|
||||
Lock(resources);
|
||||
}
|
||||
~AMFDX9Locker()
|
||||
{
|
||||
if(m_Context != NULL)
|
||||
{
|
||||
m_Context->UnlockDX9();
|
||||
}
|
||||
}
|
||||
void Lock(AMFContext* resources)
|
||||
{
|
||||
if(m_Context != NULL)
|
||||
{
|
||||
m_Context->UnlockDX9();
|
||||
}
|
||||
m_Context = resources;
|
||||
if(m_Context != NULL)
|
||||
{
|
||||
m_Context->LockDX9();
|
||||
}
|
||||
}
|
||||
protected:
|
||||
AMFContext* m_Context;
|
||||
|
||||
private:
|
||||
AMFDX9Locker(const AMFDX9Locker&);
|
||||
AMFDX9Locker& operator=(const AMFDX9Locker&);
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMFContext::AMFDX11Locker
|
||||
{
|
||||
public:
|
||||
AMFDX11Locker() : m_Context(NULL)
|
||||
{}
|
||||
AMFDX11Locker(AMFContext* resources) : m_Context(NULL)
|
||||
{
|
||||
Lock(resources);
|
||||
}
|
||||
~AMFDX11Locker()
|
||||
{
|
||||
if(m_Context != NULL)
|
||||
{
|
||||
m_Context->UnlockDX11();
|
||||
}
|
||||
}
|
||||
void Lock(AMFContext* resources)
|
||||
{
|
||||
if(m_Context != NULL)
|
||||
{
|
||||
m_Context->UnlockDX11();
|
||||
}
|
||||
m_Context = resources;
|
||||
if(m_Context != NULL)
|
||||
{
|
||||
m_Context->LockDX11();
|
||||
}
|
||||
}
|
||||
protected:
|
||||
AMFContext* m_Context;
|
||||
|
||||
private:
|
||||
AMFDX11Locker(const AMFDX11Locker&);
|
||||
AMFDX11Locker& operator=(const AMFDX11Locker&);
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMFContext::AMFOpenCLLocker
|
||||
{
|
||||
public:
|
||||
AMFOpenCLLocker() : m_Context(NULL)
|
||||
{}
|
||||
AMFOpenCLLocker(AMFContext* resources) : m_Context(NULL)
|
||||
{
|
||||
Lock(resources);
|
||||
}
|
||||
~AMFOpenCLLocker()
|
||||
{
|
||||
if(m_Context != NULL)
|
||||
{
|
||||
m_Context->UnlockOpenCL();
|
||||
}
|
||||
}
|
||||
void Lock(AMFContext* resources)
|
||||
{
|
||||
if(m_Context != NULL)
|
||||
{
|
||||
m_Context->UnlockOpenCL();
|
||||
}
|
||||
m_Context = resources;
|
||||
if(m_Context != NULL)
|
||||
{
|
||||
m_Context->LockOpenCL();
|
||||
}
|
||||
}
|
||||
protected:
|
||||
AMFContext* m_Context;
|
||||
private:
|
||||
AMFOpenCLLocker(const AMFOpenCLLocker&);
|
||||
AMFOpenCLLocker& operator=(const AMFOpenCLLocker&);
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMFContext::AMFOpenGLLocker
|
||||
{
|
||||
public:
|
||||
AMFOpenGLLocker(AMFContext* pContext) : m_pContext(pContext),
|
||||
m_GLLocked(false)
|
||||
{
|
||||
if(m_pContext != NULL)
|
||||
{
|
||||
if(m_pContext->LockOpenGL() == AMF_OK)
|
||||
{
|
||||
m_GLLocked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
~AMFOpenGLLocker()
|
||||
{
|
||||
if(m_GLLocked)
|
||||
{
|
||||
m_pContext->UnlockOpenGL();
|
||||
}
|
||||
}
|
||||
private:
|
||||
AMFContext* m_pContext;
|
||||
amf_bool m_GLLocked; ///< AMFOpenGLLocker can be called when OpenGL is not initialized yet
|
||||
///< in this case don't call UnlockOpenGL
|
||||
AMFOpenGLLocker(const AMFOpenGLLocker&);
|
||||
AMFOpenGLLocker& operator=(const AMFOpenGLLocker&);
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMFContext::AMFXVLocker
|
||||
{
|
||||
public:
|
||||
AMFXVLocker() : m_pContext(NULL)
|
||||
{}
|
||||
AMFXVLocker(AMFContext* pContext) : m_pContext(NULL)
|
||||
{
|
||||
Lock(pContext);
|
||||
}
|
||||
~AMFXVLocker()
|
||||
{
|
||||
if(m_pContext != NULL)
|
||||
{
|
||||
m_pContext->UnlockXV();
|
||||
}
|
||||
}
|
||||
void Lock(AMFContext* pContext)
|
||||
{
|
||||
if((pContext != NULL) && (pContext->GetXVDevice() != NULL))
|
||||
{
|
||||
m_pContext = pContext;
|
||||
m_pContext->LockXV();
|
||||
}
|
||||
}
|
||||
protected:
|
||||
AMFContext* m_pContext;
|
||||
private:
|
||||
AMFXVLocker(const AMFXVLocker&);
|
||||
AMFXVLocker& operator=(const AMFXVLocker&);
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMFContext::AMFGrallocLocker
|
||||
{
|
||||
public:
|
||||
AMFGrallocLocker() : m_pContext(NULL)
|
||||
{}
|
||||
AMFGrallocLocker(AMFContext* pContext) : m_pContext(NULL)
|
||||
{
|
||||
Lock(pContext);
|
||||
}
|
||||
~AMFGrallocLocker()
|
||||
{
|
||||
if(m_pContext != NULL)
|
||||
{
|
||||
m_pContext->UnlockGralloc();
|
||||
}
|
||||
}
|
||||
void Lock(AMFContext* pContext)
|
||||
{
|
||||
if((pContext != NULL) && (pContext->GetGrallocDevice() != NULL))
|
||||
{
|
||||
m_pContext = pContext;
|
||||
m_pContext->LockGralloc();
|
||||
}
|
||||
}
|
||||
protected:
|
||||
AMFContext* m_pContext;
|
||||
private:
|
||||
AMFGrallocLocker(const AMFGrallocLocker&);
|
||||
AMFGrallocLocker& operator=(const AMFGrallocLocker&);
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMFContext1::AMFVulkanLocker
|
||||
{
|
||||
public:
|
||||
AMFVulkanLocker() : m_pContext(NULL)
|
||||
{}
|
||||
AMFVulkanLocker(AMFContext1* pContext) : m_pContext(NULL)
|
||||
{
|
||||
Lock(pContext);
|
||||
}
|
||||
~AMFVulkanLocker()
|
||||
{
|
||||
if(m_pContext != NULL)
|
||||
{
|
||||
m_pContext->UnlockVulkan();
|
||||
}
|
||||
}
|
||||
void Lock(AMFContext1* pContext)
|
||||
{
|
||||
if((pContext != NULL) && (pContext->GetVulkanDevice() != NULL))
|
||||
{
|
||||
m_pContext = pContext;
|
||||
m_pContext->LockVulkan();
|
||||
}
|
||||
}
|
||||
protected:
|
||||
AMFContext1* m_pContext;
|
||||
private:
|
||||
AMFVulkanLocker(const AMFVulkanLocker&);
|
||||
AMFVulkanLocker& operator=(const AMFVulkanLocker&);
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMFContext2::AMFDX12Locker
|
||||
{
|
||||
public:
|
||||
AMFDX12Locker() : m_Context(NULL)
|
||||
{}
|
||||
AMFDX12Locker(AMFContext2* resources) : m_Context(NULL)
|
||||
{
|
||||
Lock(resources);
|
||||
}
|
||||
~AMFDX12Locker()
|
||||
{
|
||||
if (m_Context != NULL)
|
||||
{
|
||||
m_Context->UnlockDX12();
|
||||
}
|
||||
}
|
||||
void Lock(AMFContext2* resources)
|
||||
{
|
||||
if (m_Context != NULL)
|
||||
{
|
||||
m_Context->UnlockDX12();
|
||||
}
|
||||
m_Context = resources;
|
||||
if (m_Context != NULL)
|
||||
{
|
||||
m_Context->LockDX12();
|
||||
}
|
||||
}
|
||||
protected:
|
||||
AMFContext2* m_Context;
|
||||
|
||||
private:
|
||||
AMFDX12Locker(const AMFDX12Locker&);
|
||||
AMFDX12Locker& operator=(const AMFDX12Locker&);
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------------------------
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
enum AMF_CONTEXT_DEVICETYPE_ENUM
|
||||
{
|
||||
AMF_CONTEXT_DEVICE_TYPE_GPU = 0,
|
||||
AMF_CONTEXT_DEVICE_TYPE_CPU
|
||||
};
|
||||
#define AMF_CONTEXT_DEVICE_TYPE L"AMF_Context_DeviceType" //Value type: amf_int64; Values : AMF_CONTEXT_DEVICE_TYPE_GPU for GPU (default) , AMF_CONTEXT_DEVICE_TYPE_CPU for CPU.
|
||||
#endif //#ifndef AMF_Context_h
|
||||
53
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/CurrentTime.h
vendored
Normal file
53
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/CurrentTime.h
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_CurrentTime_h
|
||||
#define AMF_CurrentTime_h
|
||||
|
||||
#include "Platform.h"
|
||||
#include "Interface.h"
|
||||
|
||||
namespace amf
|
||||
{
|
||||
// Current time interface class. This interface object can be passed
|
||||
// as a property to components requiring synchronized timing. The
|
||||
// implementation is:
|
||||
// - first call to Get() starts time and returns 0
|
||||
// - subsequent calls to Get() returns values relative to 0
|
||||
// - Reset() puts time back at 0 at next Get() call
|
||||
//
|
||||
class AMF_NO_VTABLE AMFCurrentTime : public AMFInterface
|
||||
{
|
||||
public:
|
||||
|
||||
virtual amf_pts AMF_STD_CALL Get() = 0;
|
||||
|
||||
virtual void AMF_STD_CALL Reset() = 0;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFCurrentTime> AMFCurrentTimePtr;
|
||||
//----------------------------------------------------------------------------------------------}
|
||||
}
|
||||
#endif // AMF_CurrentTime_h
|
||||
54
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/D3D12AMF.h
vendored
Normal file
54
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/D3D12AMF.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef __D3D12AMF_h__
|
||||
#define __D3D12AMF_h__
|
||||
#pragma once
|
||||
#include "Platform.h"
|
||||
#if defined(_WIN32)||(defined(__linux) && defined(AMF_WSL))
|
||||
|
||||
#define AMFDX12_NUMBER_OF_DESCRYPTOR_HEAPS L"NumberOfDescryptorHeaps" // amf_int64, default is 4, to be set on AMFContext
|
||||
// syncronization properties set via SetPrivateData()
|
||||
AMF_WEAK GUID AMFResourceStateGUID = { 0x452da9bf, 0x4ad7, 0x47a5, { 0xa6, 0x9b, 0x96, 0xd3, 0x23, 0x76, 0xf2, 0xf3 } }; // Current resource state value (D3D12_RESOURCE_STATES ), sizeof(UINT), set on ID3D12Resource
|
||||
AMF_WEAK GUID AMFFenceGUID = { 0x910a7928, 0x57bd, 0x4b04, { 0x91, 0xa3, 0xe7, 0xb8, 0x04, 0x12, 0xcd, 0xa5 } }; // IUnknown (ID3D12Fence), set on ID3D12Resource syncronization fence for this resource
|
||||
AMF_WEAK GUID AMFFenceValueGUID = { 0x62a693d3, 0xbb4a, 0x46c9, { 0xa5, 0x04, 0x9a, 0x8e, 0x97, 0xbf, 0xf0, 0x56 } }; // The last value to wait on the fence from AMFFenceGUID; sizeof(UINT64), set on ID3D12Fence
|
||||
AMF_WEAK GUID AMFResourceDecodeGUID= { 0x56bd5bde, 0x7c89, 0x45ff, {0xba, 0x5c, 0xc2, 0xd5, 0xea, 0x55, 0x8d, 0x1a } }; // UINT indicator that the surface is decode and surface state needs to be restored after change
|
||||
|
||||
// deprecated - not used vlaues
|
||||
AMF_WEAK GUID AMFFenceD3D11GUID = { 0xdffdf6e0, 0x85e0, 0x4645, { 0x9d, 0x7, 0xe6, 0x4a, 0x19, 0x6b, 0xc9, 0xbf } }; // IUnknown (ID3D11Fence) OpenSharedFence for interop
|
||||
AMF_WEAK GUID AMFFenceValueD3D11GUID = { 0x86581b71, 0x699f, 0x484b, { 0xb8, 0x75, 0x24, 0xda, 0x49, 0x8a, 0x74, 0xcf } }; // last value to wait on in d3d11
|
||||
AMF_WEAK GUID AMFSharedHandleFenceGUID = { 0xca60dcc8, 0x76d1, 0x4088, 0xad, 0xd, 0x97, 0x71, 0xe7, 0xb0, 0x92, 0x49 }; // ID3D12Fence shared handle for D3D11 interop
|
||||
// end of deprecated
|
||||
|
||||
#endif
|
||||
|
||||
#endif // __D3D12AMF_h__
|
||||
178
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Data.h
vendored
Normal file
178
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Data.h
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Data_h
|
||||
#define AMF_Data_h
|
||||
#pragma once
|
||||
|
||||
#include "PropertyStorage.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_DATA_TYPE
|
||||
{
|
||||
AMF_DATA_BUFFER = 0,
|
||||
AMF_DATA_SURFACE = 1,
|
||||
AMF_DATA_AUDIO_BUFFER = 2,
|
||||
AMF_DATA_USER = 1000,
|
||||
// all extensions will be AMF_DATA_USER+i
|
||||
} AMF_DATA_TYPE;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_MEMORY_TYPE
|
||||
{
|
||||
AMF_MEMORY_UNKNOWN = 0,
|
||||
AMF_MEMORY_HOST = 1,
|
||||
AMF_MEMORY_DX9 = 2,
|
||||
AMF_MEMORY_DX11 = 3,
|
||||
AMF_MEMORY_OPENCL = 4,
|
||||
AMF_MEMORY_OPENGL = 5,
|
||||
AMF_MEMORY_XV = 6,
|
||||
AMF_MEMORY_GRALLOC = 7,
|
||||
AMF_MEMORY_COMPUTE_FOR_DX9 = 8, // deprecated, the same as AMF_MEMORY_OPENCL
|
||||
AMF_MEMORY_COMPUTE_FOR_DX11 = 9, // deprecated, the same as AMF_MEMORY_OPENCL
|
||||
AMF_MEMORY_VULKAN = 10,
|
||||
AMF_MEMORY_DX12 = 11,
|
||||
AMF_MEMORY_LAST
|
||||
} AMF_MEMORY_TYPE;
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_DX_VERSION
|
||||
{
|
||||
AMF_DX9 = 90,
|
||||
AMF_DX9_EX = 91,
|
||||
AMF_DX11_0 = 110,
|
||||
AMF_DX11_1 = 111,
|
||||
AMF_DX12 = 120,
|
||||
} AMF_DX_VERSION;
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMF_MEMORY_CPU_ACCESS translates to D3D11_CPU_ACCESS_FLAG or VkImageUsageFlags
|
||||
// bit mask
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_MEMORY_CPU_ACCESS_BITS
|
||||
{ // D3D11 D3D12 Vulkan
|
||||
AMF_MEMORY_CPU_DEFAULT = 0x80000000, // 0 , D3D12_HEAP_TYPE_DEFAULT , VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
|
||||
AMF_MEMORY_CPU_NONE = 0x00000000, // 0 , D3D12_HEAP_TYPE_DEFAULT ,
|
||||
AMF_MEMORY_CPU_READ = 0x00000001, // D3D11_CPU_ACCESS_READ , D3D12_HEAP_TYPE_READBACK, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
|
||||
AMF_MEMORY_CPU_WRITE = 0x00000002, // D3D11_CPU_ACCESS_WRITE, D3D12_HEAP_TYPE_UPLOAD , VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
|
||||
AMF_MEMORY_CPU_LOCAL = 0x00000004, // , D3D12_HEAP_TYPE_DEFAULT , VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
|
||||
AMF_MEMORY_CPU_PINNED = 0x00000008, // , , VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR
|
||||
} AMF_MEMORY_CPU_ACCESS_BITS;
|
||||
typedef amf_flags AMF_MEMORY_CPU_ACCESS;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFData interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFData : public AMFPropertyStorage
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xa1159bf6, 0x9104, 0x4107, 0x8e, 0xaa, 0xc5, 0x3d, 0x5d, 0xba, 0xc5, 0x11)
|
||||
|
||||
virtual AMF_MEMORY_TYPE AMF_STD_CALL GetMemoryType() = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL Duplicate(AMF_MEMORY_TYPE type, AMFData** ppData) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL Convert(AMF_MEMORY_TYPE type) = 0; // optimal interop if possilble. Copy through host memory if needed
|
||||
virtual AMF_RESULT AMF_STD_CALL Interop(AMF_MEMORY_TYPE type) = 0; // only optimal interop if possilble. No copy through host memory for GPU objects
|
||||
|
||||
virtual AMF_DATA_TYPE AMF_STD_CALL GetDataType() = 0;
|
||||
|
||||
virtual amf_bool AMF_STD_CALL IsReusable() = 0;
|
||||
|
||||
virtual void AMF_STD_CALL SetPts(amf_pts pts) = 0;
|
||||
virtual amf_pts AMF_STD_CALL GetPts() = 0;
|
||||
virtual void AMF_STD_CALL SetDuration(amf_pts duration) = 0;
|
||||
virtual amf_pts AMF_STD_CALL GetDuration() = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFData> AMFDataPtr;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
#else // #if defined(__cplusplus)
|
||||
typedef struct AMFData AMFData;
|
||||
AMF_DECLARE_IID(AMFData, 0xa1159bf6, 0x9104, 0x4107, 0x8e, 0xaa, 0xc5, 0x3d, 0x5d, 0xba, 0xc5, 0x11)
|
||||
|
||||
typedef struct AMFDataVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFData* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFData* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFData* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFData* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFData* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFData* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFData* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFData* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFData* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFData* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFData* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFData* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFData* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFData interface
|
||||
|
||||
AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryType)(AMFData* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *Duplicate)(AMFData* pThis, AMF_MEMORY_TYPE type, AMFData** ppData);
|
||||
AMF_RESULT (AMF_STD_CALL *Convert)(AMFData* pThis, AMF_MEMORY_TYPE type); // optimal interop if possilble. Copy through host memory if needed
|
||||
AMF_RESULT (AMF_STD_CALL *Interop)(AMFData* pThis, AMF_MEMORY_TYPE type); // only optimal interop if possilble. No copy through host memory for GPU objects
|
||||
|
||||
AMF_DATA_TYPE (AMF_STD_CALL *GetDataType)(AMFData* pThis);
|
||||
|
||||
amf_bool (AMF_STD_CALL *IsReusable)(AMFData* pThis);
|
||||
|
||||
void (AMF_STD_CALL *SetPts)(AMFData* pThis, amf_pts pts);
|
||||
amf_pts (AMF_STD_CALL *GetPts)(AMFData* pThis);
|
||||
void (AMF_STD_CALL *SetDuration)(AMFData* pThis, amf_pts duration);
|
||||
amf_pts (AMF_STD_CALL *GetDuration)(AMFData* pThis);
|
||||
|
||||
} AMFDataVtbl;
|
||||
|
||||
struct AMFData
|
||||
{
|
||||
const AMFDataVtbl *pVtbl;
|
||||
};
|
||||
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif //#ifndef AMF_Data_h
|
||||
78
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Debug.h
vendored
Normal file
78
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Debug.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Debug_h
|
||||
#define AMF_Debug_h
|
||||
#pragma once
|
||||
|
||||
#include "Platform.h"
|
||||
#include "Result.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFDebug interface - singleton
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFDebug
|
||||
{
|
||||
public:
|
||||
virtual void AMF_STD_CALL EnablePerformanceMonitor(amf_bool enable) = 0;
|
||||
virtual amf_bool AMF_STD_CALL PerformanceMonitorEnabled() = 0;
|
||||
virtual void AMF_STD_CALL AssertsEnable(amf_bool enable) = 0;
|
||||
virtual amf_bool AMF_STD_CALL AssertsEnabled() = 0;
|
||||
};
|
||||
#else // #if defined(__cplusplus)
|
||||
typedef struct AMFDebug AMFDebug;
|
||||
typedef struct AMFDebugVtbl
|
||||
{
|
||||
// AMFDebug interface
|
||||
void (AMF_STD_CALL *EnablePerformanceMonitor)(AMFDebug* pThis, amf_bool enable);
|
||||
amf_bool (AMF_STD_CALL *PerformanceMonitorEnabled)(AMFDebug* pThis);
|
||||
void (AMF_STD_CALL *AssertsEnable)(AMFDebug* pThis, amf_bool enable);
|
||||
amf_bool (AMF_STD_CALL *AssertsEnabled)(AMFDebug* pThis);
|
||||
} AMFDebugVtbl;
|
||||
|
||||
struct AMFDebug
|
||||
{
|
||||
const AMFDebugVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // AMF_Debug_h
|
||||
112
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Dump.h
vendored
Normal file
112
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Dump.h
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Dump_h
|
||||
#define AMF_Dump_h
|
||||
#pragma once
|
||||
|
||||
#include "Platform.h"
|
||||
#include "Result.h"
|
||||
#include "Interface.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFDump : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x75366ad4, 0x504c, 0x430b, 0xbb, 0xe2, 0xad, 0x21, 0x82, 0x8, 0xf, 0x72);
|
||||
|
||||
|
||||
virtual const wchar_t* AMF_STD_CALL GetDumpBasePath() const = 0; // Get application dump base path
|
||||
virtual AMF_RESULT AMF_STD_CALL SetDumpBasePath(const wchar_t* path) = 0; // Set application dump base path
|
||||
|
||||
// Enable/disable input and/or output stream dumps
|
||||
virtual bool AMF_STD_CALL IsInputDumpEnabled() const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL EnableInputDump(bool enabled) = 0;
|
||||
virtual const wchar_t* AMF_STD_CALL GetInputDumpFullName() const = 0; // Get full name of dump file
|
||||
|
||||
// Enable/disable input and/or output stream dumps
|
||||
virtual bool AMF_STD_CALL IsOutputDumpEnabled() const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL EnableOutputDump(bool enabled) = 0;
|
||||
virtual const wchar_t* AMF_STD_CALL GetOutputDumpFullName() const = 0; // Get full name of dump file
|
||||
|
||||
// When enabled, each new application session will create a subfolder with a time stamp in the base path tree (disabled by default)
|
||||
virtual bool AMF_STD_CALL IsPerSessionDumpEnabled() const = 0;
|
||||
virtual void AMF_STD_CALL EnablePerSessionDump(bool enabled) = 0;
|
||||
};
|
||||
typedef AMFInterfacePtr_T<AMFDump> AMFDumpPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFDump, 0x75366ad4, 0x504c, 0x430b, 0xbb, 0xe2, 0xad, 0x21, 0x82, 0x8, 0xf, 0x72);
|
||||
typedef struct AMFDump AMFDump;
|
||||
|
||||
typedef struct AMFDumpVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFDump* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFDump* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFDump* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFDump interface
|
||||
const wchar_t* (AMF_STD_CALL *GetDumpBasePath)(AMFDump* pThis) const; // Get application dump base path
|
||||
AMF_RESULT (AMF_STD_CALL *SetDumpBasePath)(AMFDump* pThis, const wchar_t* path); // Set application dump base path
|
||||
|
||||
// Enable/disable input and/or output stream dumps
|
||||
bool (AMF_STD_CALL *IsInputDumpEnabled)(AMFDump* pThis) const;
|
||||
AMF_RESULT (AMF_STD_CALL *EnableInputDump)(AMFDump* pThis, bool enabled);
|
||||
const wchar_t* (AMF_STD_CALL *GetInputDumpFullName)(AMFDump* pThis) const; // Get full name of dump file
|
||||
|
||||
// Enable/disable input and/or output stream dumps
|
||||
bool (AMF_STD_CALL *IsOutputDumpEnabled)(AMFDump* pThis) const;
|
||||
AMF_RESULT (AMF_STD_CALL *EnableOutputDump)(AMFDump* pThis, bool enabled);
|
||||
const wchar_t* (AMF_STD_CALL *GetOutputDumpFullName)(AMFDump* pThis) const; // Get full name of dump file
|
||||
|
||||
// When enabled, each new application session will create a subfolder with a time stamp in the base path tree (disabled by default)
|
||||
bool (AMF_STD_CALL *IsPerSessionDumpEnabled)(AMFDump* pThis) const;
|
||||
void (AMF_STD_CALL *EnablePerSessionDump)(AMFDump* pThis, bool enabled);
|
||||
|
||||
} AMFDumpVtbl;
|
||||
|
||||
struct AMFDump
|
||||
{
|
||||
const AMFDumpVtbl *pVtbl;
|
||||
};
|
||||
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#if defined(__cplusplus)
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#endif //AMF_Dump_h
|
||||
133
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Factory.h
vendored
Normal file
133
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Factory.h
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Factory_h
|
||||
#define AMF_Factory_h
|
||||
#pragma once
|
||||
|
||||
#include "Platform.h"
|
||||
#include "Version.h"
|
||||
#include "Result.h"
|
||||
#include "Context.h"
|
||||
#include "Debug.h"
|
||||
#include "Trace.h"
|
||||
#include "Compute.h"
|
||||
|
||||
#include "../components/Component.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFFactory interface - singleton
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFFactory
|
||||
{
|
||||
public:
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateContext(AMFContext** ppContext) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CreateComponent(AMFContext* pContext, const wchar_t* id, AMFComponent** ppComponent) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL SetCacheFolder(const wchar_t* path) = 0;
|
||||
virtual const wchar_t* AMF_STD_CALL GetCacheFolder() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetDebug(AMFDebug** ppDebug) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetTrace(AMFTrace** ppTrace) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetPrograms(AMFPrograms** ppPrograms) = 0;
|
||||
};
|
||||
#else
|
||||
typedef struct AMFFactory AMFFactory;
|
||||
|
||||
typedef struct AMFFactoryVtbl
|
||||
{
|
||||
AMF_RESULT (AMF_STD_CALL *CreateContext)(AMFFactory* pThis, AMFContext** ppContext);
|
||||
AMF_RESULT (AMF_STD_CALL *CreateComponent)(AMFFactory* pThis, AMFContext* pContext, const wchar_t* id, AMFComponent** ppComponent);
|
||||
AMF_RESULT (AMF_STD_CALL *SetCacheFolder)(AMFFactory* pThis, const wchar_t* path);
|
||||
const wchar_t* (AMF_STD_CALL *GetCacheFolder)(AMFFactory* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetDebug)(AMFFactory* pThis, AMFDebug** ppDebug);
|
||||
AMF_RESULT (AMF_STD_CALL *GetTrace)(AMFFactory* pThis, AMFTrace** ppTrace);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPrograms)(AMFFactory* pThis, AMFPrograms** ppPrograms);
|
||||
} AMFFactoryVtbl;
|
||||
|
||||
struct AMFFactory
|
||||
{
|
||||
const AMFFactoryVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// DLL entry points
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
#define AMF_INIT_FUNCTION_NAME "AMFInit"
|
||||
#define AMF_QUERY_VERSION_FUNCTION_NAME "AMFQueryVersion"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
typedef AMF_RESULT (AMF_CDECL_CALL *AMFInit_Fn)(amf_uint64 version, amf::AMFFactory **ppFactory);
|
||||
typedef AMF_RESULT (AMF_CDECL_CALL *AMFQueryVersion_Fn)(amf_uint64 *pVersion);
|
||||
}
|
||||
#else
|
||||
typedef AMF_RESULT (AMF_CDECL_CALL *AMFInit_Fn)(amf_uint64 version, AMFFactory **ppFactory);
|
||||
typedef AMF_RESULT (AMF_CDECL_CALL *AMFQueryVersion_Fn)(amf_uint64 *pVersion);
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_M_AMD64)
|
||||
#define AMF_DLL_NAME L"amfrt64.dll"
|
||||
#define AMF_DLL_NAMEA "amfrt64.dll"
|
||||
#else
|
||||
#define AMF_DLL_NAME L"amfrt32.dll"
|
||||
#define AMF_DLL_NAMEA "amfrt32.dll"
|
||||
#endif
|
||||
#elif defined(__ANDROID__) && !defined(AMF_ANDROID_ENCODER)
|
||||
#define AMF_DLL_NAME L"libamf.so"
|
||||
#define AMF_DLL_NAMEA "libamf.so"
|
||||
#elif defined(__APPLE__)
|
||||
#define AMF_DLL_NAME L"libamfrt.framework/libamfrt"
|
||||
#define AMF_DLL_NAMEA "libamfrt.framework/libamfrt"
|
||||
#elif defined(__linux__)
|
||||
#if defined(__x86_64__) || defined(__aarch64__)
|
||||
#define AMF_DLL_NAME L"libamfrt64.so.1"
|
||||
#define AMF_DLL_NAMEA "libamfrt64.so.1"
|
||||
#else
|
||||
#define AMF_DLL_NAME L"libamfrt32.so.1"
|
||||
#define AMF_DLL_NAMEA "libamfrt32.so.1"
|
||||
#endif
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#endif // AMF_Factory_h
|
||||
258
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Interface.h
vendored
Normal file
258
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Interface.h
vendored
Normal file
@@ -0,0 +1,258 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Interface_h
|
||||
#define AMF_Interface_h
|
||||
#pragma once
|
||||
|
||||
#include "Result.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
#define AMF_DECLARE_IID(_data1, _data2, _data3, _data41, _data42, _data43, _data44, _data45, _data46, _data47, _data48) \
|
||||
static AMF_INLINE const amf::AMFGuid IID() \
|
||||
{ \
|
||||
amf::AMFGuid uid = {_data1, _data2, _data3, _data41, _data42, _data43, _data44, _data45, _data46, _data47, _data48}; \
|
||||
return uid; \
|
||||
}
|
||||
#else
|
||||
#define AMF_DECLARE_IID(name, _data1, _data2, _data3, _data41, _data42, _data43, _data44, _data45, _data46, _data47, _data48) \
|
||||
AMF_INLINE static AMFGuid IID_##name(void) \
|
||||
{ \
|
||||
AMFGuid uid = {_data1, _data2, _data3, _data41, _data42, _data43, _data44, _data45, _data46, _data47, _data48}; \
|
||||
return uid; \
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// AMFInterface interface - base class for all AMF interfaces
|
||||
//------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x9d872f34, 0x90dc, 0x4b93, 0xb6, 0xb2, 0x6c, 0xa3, 0x7c, 0x85, 0x25, 0xdb)
|
||||
|
||||
virtual amf_long AMF_STD_CALL Acquire() = 0;
|
||||
virtual amf_long AMF_STD_CALL Release() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL QueryInterface(const AMFGuid& interfaceID, void** ppInterface) = 0;
|
||||
};
|
||||
#else
|
||||
AMF_DECLARE_IID(AMFInterface, 0x9d872f34, 0x90dc, 0x4b93, 0xb6, 0xb2, 0x6c, 0xa3, 0x7c, 0x85, 0x25, 0xdb)
|
||||
typedef struct AMFInterface AMFInterface;
|
||||
|
||||
typedef struct AMFInterfaceVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFInterface* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFInterface* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFInterface* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
} AMFInterfaceVtbl;
|
||||
|
||||
struct AMFInterface
|
||||
{
|
||||
const AMFInterfaceVtbl *pVtbl;
|
||||
};
|
||||
#endif
|
||||
//------------------------------------------------------------------------
|
||||
// template for AMF smart pointer
|
||||
//------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
template<class _Interf>
|
||||
class AMFInterfacePtr_T
|
||||
{
|
||||
private:
|
||||
_Interf* m_pInterf;
|
||||
|
||||
void InternalAcquire()
|
||||
{
|
||||
if(m_pInterf != NULL)
|
||||
{
|
||||
m_pInterf->Acquire();
|
||||
}
|
||||
}
|
||||
void InternalRelease()
|
||||
{
|
||||
if(m_pInterf != NULL)
|
||||
{
|
||||
m_pInterf->Release();
|
||||
}
|
||||
}
|
||||
public:
|
||||
AMFInterfacePtr_T() : m_pInterf(NULL)
|
||||
{}
|
||||
|
||||
AMFInterfacePtr_T(const AMFInterfacePtr_T<_Interf>& p) : m_pInterf(p.m_pInterf)
|
||||
{
|
||||
InternalAcquire();
|
||||
}
|
||||
|
||||
AMFInterfacePtr_T(_Interf* pInterface) : m_pInterf(pInterface)
|
||||
{
|
||||
InternalAcquire();
|
||||
}
|
||||
|
||||
template<class _OtherInterf>
|
||||
explicit AMFInterfacePtr_T(const AMFInterfacePtr_T<_OtherInterf>& cp) : m_pInterf(NULL)
|
||||
{
|
||||
void* pInterf = NULL;
|
||||
if((cp == NULL) || (cp->QueryInterface(_Interf::IID(), &pInterf) != AMF_OK))
|
||||
{
|
||||
pInterf = NULL;
|
||||
}
|
||||
m_pInterf = static_cast<_Interf*>(pInterf);
|
||||
}
|
||||
|
||||
template<class _OtherInterf>
|
||||
explicit AMFInterfacePtr_T(_OtherInterf* cp) : m_pInterf(NULL)
|
||||
{
|
||||
void* pInterf = NULL;
|
||||
if((cp == NULL) || (cp->QueryInterface(_Interf::IID(), &pInterf) != AMF_OK))
|
||||
{
|
||||
pInterf = NULL;
|
||||
}
|
||||
m_pInterf = static_cast<_Interf*>(pInterf);
|
||||
}
|
||||
|
||||
~AMFInterfacePtr_T()
|
||||
{
|
||||
InternalRelease();
|
||||
}
|
||||
|
||||
AMFInterfacePtr_T& operator=(_Interf* pInterface)
|
||||
{
|
||||
if(m_pInterf != pInterface)
|
||||
{
|
||||
_Interf* pOldInterface = m_pInterf;
|
||||
m_pInterf = pInterface;
|
||||
InternalAcquire();
|
||||
if(pOldInterface != NULL)
|
||||
{
|
||||
pOldInterface->Release();
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
AMFInterfacePtr_T& operator=(const AMFInterfacePtr_T<_Interf>& cp)
|
||||
{
|
||||
return operator=(cp.m_pInterf);
|
||||
}
|
||||
|
||||
void Attach(_Interf* pInterface)
|
||||
{
|
||||
InternalRelease();
|
||||
m_pInterf = pInterface;
|
||||
}
|
||||
|
||||
_Interf* Detach()
|
||||
{
|
||||
_Interf* const pOld = m_pInterf;
|
||||
m_pInterf = NULL;
|
||||
return pOld;
|
||||
}
|
||||
void Release()
|
||||
{
|
||||
InternalRelease();
|
||||
m_pInterf = NULL;
|
||||
}
|
||||
|
||||
operator _Interf*() const
|
||||
{
|
||||
return m_pInterf;
|
||||
}
|
||||
|
||||
_Interf& operator*() const
|
||||
{
|
||||
return *m_pInterf;
|
||||
}
|
||||
|
||||
// Returns the address of the interface pointer contained in this
|
||||
// class. This is required for initializing from C-style factory function to
|
||||
// avoid getting an incorrect ref count at the beginning.
|
||||
|
||||
_Interf** operator&()
|
||||
{
|
||||
InternalRelease();
|
||||
m_pInterf = 0;
|
||||
return &m_pInterf;
|
||||
}
|
||||
|
||||
_Interf* operator->() const
|
||||
{
|
||||
return m_pInterf;
|
||||
}
|
||||
|
||||
bool operator==(const AMFInterfacePtr_T<_Interf>& p)
|
||||
{
|
||||
return (m_pInterf == p.m_pInterf);
|
||||
}
|
||||
|
||||
bool operator==(_Interf* p)
|
||||
{
|
||||
return (m_pInterf == p);
|
||||
}
|
||||
|
||||
bool operator!=(const AMFInterfacePtr_T<_Interf>& p)
|
||||
{
|
||||
return !(operator==(p));
|
||||
}
|
||||
bool operator!=(_Interf* p)
|
||||
{
|
||||
return !(operator==(p));
|
||||
}
|
||||
|
||||
_Interf* GetPtr()
|
||||
{
|
||||
return m_pInterf;
|
||||
}
|
||||
|
||||
const _Interf* GetPtr() const
|
||||
{
|
||||
return m_pInterf;
|
||||
}
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFInterface> AMFInterfacePtr;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //#ifndef AMF_Interface_h
|
||||
112
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Plane.h
vendored
Normal file
112
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Plane.h
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Plane_h
|
||||
#define AMF_Plane_h
|
||||
#pragma once
|
||||
|
||||
#include "Interface.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
//---------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_PLANE_TYPE
|
||||
{
|
||||
AMF_PLANE_UNKNOWN = 0,
|
||||
AMF_PLANE_PACKED = 1, // for all packed formats: BGRA, YUY2, etc
|
||||
AMF_PLANE_Y = 2,
|
||||
AMF_PLANE_UV = 3,
|
||||
AMF_PLANE_U = 4,
|
||||
AMF_PLANE_V = 5,
|
||||
} AMF_PLANE_TYPE;
|
||||
//---------------------------------------------------------------------------------------------
|
||||
// AMFPlane interface
|
||||
//---------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFPlane : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xbede1aa6, 0xd8fa, 0x4625, 0x94, 0x65, 0x6c, 0x82, 0xc4, 0x37, 0x71, 0x2e)
|
||||
|
||||
virtual AMF_PLANE_TYPE AMF_STD_CALL GetType() = 0;
|
||||
virtual void* AMF_STD_CALL GetNative() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetPixelSizeInBytes() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetOffsetX() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetOffsetY() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetWidth() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetHeight() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetHPitch() = 0;
|
||||
virtual amf_int32 AMF_STD_CALL GetVPitch() = 0;
|
||||
virtual bool AMF_STD_CALL IsTiled() = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFPlane> AMFPlanePtr;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFPlane, 0xbede1aa6, 0xd8fa, 0x4625, 0x94, 0x65, 0x6c, 0x82, 0xc4, 0x37, 0x71, 0x2e)
|
||||
typedef struct AMFPlane AMFPlane;
|
||||
typedef struct AMFPlaneVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFPlane* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFPlane* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFPlane* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPlane interface
|
||||
AMF_PLANE_TYPE (AMF_STD_CALL *GetType)(AMFPlane* pThis);
|
||||
void* (AMF_STD_CALL *GetNative)(AMFPlane* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetPixelSizeInBytes)(AMFPlane* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetOffsetX)(AMFPlane* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetOffsetY)(AMFPlane* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetWidth)(AMFPlane* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetHeight)(AMFPlane* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetHPitch)(AMFPlane* pThis);
|
||||
amf_int32 (AMF_STD_CALL *GetVPitch)(AMFPlane* pThis);
|
||||
amf_bool (AMF_STD_CALL *IsTiled)(AMFPlane* pThis);
|
||||
|
||||
} AMFPlaneVtbl;
|
||||
|
||||
struct AMFPlane
|
||||
{
|
||||
const AMFPlaneVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // namespace amf
|
||||
#endif
|
||||
|
||||
#endif //#ifndef AMF_Plane_h
|
||||
573
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Platform.h
vendored
Normal file
573
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Platform.h
vendored
Normal file
@@ -0,0 +1,573 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Platform_h
|
||||
#define AMF_Platform_h
|
||||
#pragma once
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// export declaration
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(_WIN32)
|
||||
#if defined(AMF_CORE_STATIC)
|
||||
#define AMF_CORE_LINK
|
||||
#else
|
||||
#if defined(AMF_CORE_EXPORTS)
|
||||
#define AMF_CORE_LINK __declspec(dllexport)
|
||||
#else
|
||||
#define AMF_CORE_LINK __declspec(dllimport)
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(__linux)
|
||||
#if defined(AMF_CORE_EXPORTS)
|
||||
#define AMF_CORE_LINK __attribute__((visibility("default")))
|
||||
#else
|
||||
#define AMF_CORE_LINK
|
||||
#endif
|
||||
#else
|
||||
#define AMF_CORE_LINK
|
||||
#endif // #ifdef _WIN32
|
||||
|
||||
#if defined(_DEBUG) && !defined(DEBUG) // prevents other headers to #define DEBUG without assigned value what causes failure in PAL build
|
||||
#define DEBUG 1
|
||||
#endif
|
||||
|
||||
#define AMF_MACRO_STRING2(x) #x
|
||||
#define AMF_MACRO_STRING(x) AMF_MACRO_STRING2(x)
|
||||
|
||||
#define AMF_TODO(_todo) (__FILE__ "(" AMF_MACRO_STRING(__LINE__) "): TODO: "_todo)
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* AMF_UNICODE
|
||||
*
|
||||
* @brief
|
||||
* Macro to convert string constant into wide char string constant
|
||||
*
|
||||
* Auxilary AMF_UNICODE_ macro is needed as otherwise it is not possible to use AMF_UNICODE(__FILE__)
|
||||
* Microsoft macro _T also uses 2 passes to accomplish that
|
||||
*******************************************************************************
|
||||
*/
|
||||
#define AMF_UNICODE(s) AMF_UNICODE_(s)
|
||||
#define AMF_UNICODE_(s) L ## s
|
||||
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define AMF_ALIGN(n) __attribute__((aligned(n)))
|
||||
#elif defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
||||
#define AMF_ALIGN(n) __declspec(align(n))
|
||||
#else
|
||||
#define AMF_ALIGN(n)
|
||||
// #error Need to define AMF_ALIGN
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
typedef signed int HRESULT;
|
||||
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
|
||||
#define FAILED(hr) (((HRESULT)(hr)) < 0)
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define AMF_NO_VTABLE __declspec(novtable)
|
||||
#else
|
||||
#define AMF_NO_VTABLE
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#define AMF_STD_CALL __stdcall
|
||||
#define AMF_CDECL_CALL __cdecl
|
||||
#define AMF_FAST_CALL __fastcall
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define AMF_INLINE inline
|
||||
#define AMF_FORCEINLINE inline
|
||||
#else
|
||||
#define AMF_INLINE __inline
|
||||
#define AMF_FORCEINLINE __forceinline
|
||||
#endif
|
||||
|
||||
#else // !WIN32 - Linux and Mac
|
||||
|
||||
#define AMF_STD_CALL
|
||||
#define AMF_CDECL_CALL
|
||||
#define AMF_FAST_CALL
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define AMF_INLINE inline
|
||||
#define AMF_FORCEINLINE inline
|
||||
#else
|
||||
#define AMF_INLINE __inline__
|
||||
#define AMF_FORCEINLINE __inline__
|
||||
#endif
|
||||
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201103L)
|
||||
#include <cinttypes>
|
||||
#define AMFPRId64 PRId64
|
||||
#define AMFPRIud64 PRIu64
|
||||
#define AMFPRIx64 PRIx64
|
||||
#else
|
||||
#if defined(_MSC_VER)
|
||||
#define AMFPRId64 "I64d"
|
||||
#define AMFPRIud64 "Iu64d"
|
||||
#define AMFPRIx64 "I64x"
|
||||
#else
|
||||
#if !defined(AMFPRId64)
|
||||
#define AMFPRId64 "lld"
|
||||
#define AMFPRIud64 "ulld"
|
||||
#define AMFPRIx64 "llx"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define LPRId64 AMF_UNICODE(AMFPRId64)
|
||||
#define LPRIud64 AMF_UNICODE(AMFPRIud64)
|
||||
#define LPRIx64 AMF_UNICODE(AMFPRIx64)
|
||||
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define AMF_WEAK __declspec( selectany )
|
||||
#elif defined (__GNUC__) || defined (__GCC__) || defined(__clang__)//GCC or CLANG
|
||||
#define AMF_WEAK __attribute__((weak))
|
||||
#endif
|
||||
|
||||
#define amf_countof(x) (sizeof(x) / sizeof(x[0]))
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
// basic data types
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
typedef int64_t amf_int64;
|
||||
typedef int32_t amf_int32;
|
||||
typedef int16_t amf_int16;
|
||||
typedef int8_t amf_int8;
|
||||
|
||||
typedef uint64_t amf_uint64;
|
||||
typedef uint32_t amf_uint32;
|
||||
typedef uint16_t amf_uint16;
|
||||
typedef uint8_t amf_uint8;
|
||||
typedef size_t amf_size;
|
||||
|
||||
typedef void* amf_handle;
|
||||
typedef double amf_double;
|
||||
typedef float amf_float;
|
||||
|
||||
typedef void amf_void;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
typedef bool amf_bool;
|
||||
#else
|
||||
typedef amf_uint8 amf_bool;
|
||||
#define true 1
|
||||
#define false 0
|
||||
#endif
|
||||
|
||||
typedef long amf_long;
|
||||
typedef int amf_int;
|
||||
typedef unsigned long amf_ulong;
|
||||
typedef unsigned int amf_uint;
|
||||
|
||||
typedef amf_int64 amf_pts; // in 100 nanosecs
|
||||
|
||||
typedef amf_uint32 amf_flags;
|
||||
|
||||
#define AMF_SECOND 10000000L // 1 second in 100 nanoseconds
|
||||
#define AMF_MILLISECOND (AMF_SECOND / 1000)
|
||||
#define AMF_MICROSECOND (AMF_MILLISECOND / 1000)
|
||||
|
||||
#define AMF_MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define AMF_MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define AMF_CLAMP(x, a, b) (AMF_MIN(AMF_MAX(x, a), b))
|
||||
|
||||
#define AMF_BITS_PER_BYTE 8
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define PATH_SEPARATOR_WSTR L"\\"
|
||||
#define PATH_SEPARATOR_WCHAR L'\\'
|
||||
#elif defined(__linux) || defined(__APPLE__) // Linux & Apple
|
||||
#define PATH_SEPARATOR_WSTR L"/"
|
||||
#define PATH_SEPARATOR_WCHAR L'/'
|
||||
#endif
|
||||
|
||||
typedef struct AMFRect
|
||||
{
|
||||
amf_int32 left;
|
||||
amf_int32 top;
|
||||
amf_int32 right;
|
||||
amf_int32 bottom;
|
||||
#if defined(__cplusplus)
|
||||
bool operator==(const AMFRect& other) const
|
||||
{
|
||||
return left == other.left && top == other.top && right == other.right && bottom == other.bottom;
|
||||
}
|
||||
AMF_INLINE bool operator!=(const AMFRect& other) const { return !operator==(other); }
|
||||
amf_int32 Width() const { return right - left; }
|
||||
amf_int32 Height() const { return bottom - top; }
|
||||
#endif
|
||||
} AMFRect;
|
||||
|
||||
static AMF_INLINE struct AMFRect AMFConstructRect(amf_int32 left, amf_int32 top, amf_int32 right, amf_int32 bottom)
|
||||
{
|
||||
struct AMFRect object = {left, top, right, bottom};
|
||||
return object;
|
||||
}
|
||||
|
||||
typedef struct AMFSize
|
||||
{
|
||||
amf_int32 width;
|
||||
amf_int32 height;
|
||||
#if defined(__cplusplus)
|
||||
bool operator==(const AMFSize& other) const
|
||||
{
|
||||
return width == other.width && height == other.height;
|
||||
}
|
||||
AMF_INLINE bool operator!=(const AMFSize& other) const { return !operator==(other); }
|
||||
#endif
|
||||
} AMFSize;
|
||||
|
||||
static AMF_INLINE struct AMFSize AMFConstructSize(amf_int32 width, amf_int32 height)
|
||||
{
|
||||
struct AMFSize object = {width, height};
|
||||
return object;
|
||||
}
|
||||
|
||||
typedef struct AMFPoint
|
||||
{
|
||||
amf_int32 x;
|
||||
amf_int32 y;
|
||||
#if defined(__cplusplus)
|
||||
bool operator==(const AMFPoint& other) const
|
||||
{
|
||||
return x == other.x && y == other.y;
|
||||
}
|
||||
AMF_INLINE bool operator!=(const AMFPoint& other) const { return !operator==(other); }
|
||||
#endif
|
||||
} AMFPoint;
|
||||
|
||||
static AMF_INLINE struct AMFPoint AMFConstructPoint(amf_int32 x, amf_int32 y)
|
||||
{
|
||||
struct AMFPoint object = { x, y };
|
||||
return object;
|
||||
}
|
||||
|
||||
typedef struct AMFFloatPoint2D
|
||||
{
|
||||
amf_float x;
|
||||
amf_float y;
|
||||
#if defined(__cplusplus)
|
||||
bool operator==(const AMFFloatPoint2D& other) const
|
||||
{
|
||||
return x == other.x && y == other.y;
|
||||
}
|
||||
AMF_INLINE bool operator!=(const AMFFloatPoint2D& other) const { return !operator==(other); }
|
||||
#endif
|
||||
} AMFFloatPoint2D;
|
||||
|
||||
static AMF_INLINE struct AMFFloatPoint2D AMFConstructFloatPoint2D(amf_float x, amf_float y)
|
||||
{
|
||||
struct AMFFloatPoint2D object = {x, y};
|
||||
return object;
|
||||
}
|
||||
typedef struct AMFFloatSize
|
||||
{
|
||||
amf_float width;
|
||||
amf_float height;
|
||||
#if defined(__cplusplus)
|
||||
bool operator==(const AMFFloatSize& other) const
|
||||
{
|
||||
return width == other.width && height == other.height;
|
||||
}
|
||||
AMF_INLINE bool operator!=(const AMFFloatSize& other) const { return !operator==(other); }
|
||||
#endif
|
||||
} AMFFloatSize;
|
||||
|
||||
static AMF_INLINE struct AMFFloatSize AMFConstructFloatSize(amf_float w, amf_float h)
|
||||
{
|
||||
struct AMFFloatSize object = { w, h };
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
typedef struct AMFFloatPoint3D
|
||||
{
|
||||
amf_float x;
|
||||
amf_float y;
|
||||
amf_float z;
|
||||
#if defined(__cplusplus)
|
||||
bool operator==(const AMFFloatPoint3D& other) const
|
||||
{
|
||||
return x == other.x && y == other.y && z == other.z;
|
||||
}
|
||||
AMF_INLINE bool operator!=(const AMFFloatPoint3D& other) const { return !operator==(other); }
|
||||
#endif
|
||||
} AMFFloatPoint3D;
|
||||
|
||||
static AMF_INLINE struct AMFFloatPoint3D AMFConstructFloatPoint3D(amf_float x, amf_float y, amf_float z)
|
||||
{
|
||||
struct AMFFloatPoint3D object = { x, y, z };
|
||||
return object;
|
||||
}
|
||||
|
||||
typedef struct AMFFloatVector4D
|
||||
{
|
||||
amf_float x;
|
||||
amf_float y;
|
||||
amf_float z;
|
||||
amf_float w;
|
||||
#if defined(__cplusplus)
|
||||
bool operator==(const AMFFloatVector4D& other) const
|
||||
{
|
||||
return x == other.x && y == other.y && z == other.z && w == other.w;
|
||||
}
|
||||
AMF_INLINE bool operator!=(const AMFFloatVector4D& other) const { return !operator==(other); }
|
||||
#endif
|
||||
} AMFFloatVector4D;
|
||||
|
||||
static AMF_INLINE struct AMFFloatVector4D AMFConstructFloatVector4D(amf_float x, amf_float y, amf_float z, amf_float w)
|
||||
{
|
||||
struct AMFFloatVector4D object = { x, y, z, w };
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
typedef struct AMFRate
|
||||
{
|
||||
amf_uint32 num;
|
||||
amf_uint32 den;
|
||||
#if defined(__cplusplus)
|
||||
bool operator==(const AMFRate& other) const
|
||||
{
|
||||
return num == other.num && den == other.den;
|
||||
}
|
||||
AMF_INLINE bool operator!=(const AMFRate& other) const { return !operator==(other); }
|
||||
#endif
|
||||
} AMFRate;
|
||||
|
||||
static AMF_INLINE struct AMFRate AMFConstructRate(amf_uint32 num, amf_uint32 den)
|
||||
{
|
||||
struct AMFRate object = {num, den};
|
||||
return object;
|
||||
}
|
||||
|
||||
typedef struct AMFRatio
|
||||
{
|
||||
amf_uint32 num;
|
||||
amf_uint32 den;
|
||||
#if defined(__cplusplus)
|
||||
bool operator==(const AMFRatio& other) const
|
||||
{
|
||||
return num == other.num && den == other.den;
|
||||
}
|
||||
AMF_INLINE bool operator!=(const AMFRatio& other) const { return !operator==(other); }
|
||||
#endif
|
||||
} AMFRatio;
|
||||
|
||||
static AMF_INLINE struct AMFRatio AMFConstructRatio(amf_uint32 num, amf_uint32 den)
|
||||
{
|
||||
struct AMFRatio object = {num, den};
|
||||
return object;
|
||||
}
|
||||
|
||||
#pragma pack(push, 1)
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( push )
|
||||
#pragma warning(disable : 4200)
|
||||
#pragma warning(disable : 4201)
|
||||
#endif
|
||||
|
||||
typedef struct AMFColor
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
amf_uint8 r;
|
||||
amf_uint8 g;
|
||||
amf_uint8 b;
|
||||
amf_uint8 a;
|
||||
};
|
||||
amf_uint32 rgba;
|
||||
};
|
||||
#if defined(__cplusplus)
|
||||
bool operator==(const AMFColor& other) const
|
||||
{
|
||||
return r == other.r && g == other.g && b == other.b && a == other.a;
|
||||
}
|
||||
AMF_INLINE bool operator!=(const AMFColor& other) const { return !operator==(other); }
|
||||
#endif
|
||||
} AMFColor;
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
static AMF_INLINE struct AMFColor AMFConstructColor(amf_uint8 r, amf_uint8 g, amf_uint8 b, amf_uint8 a)
|
||||
{
|
||||
struct AMFColor object;
|
||||
object.r = r;
|
||||
object.g = g;
|
||||
object.b = b;
|
||||
object.a = a;
|
||||
return object;
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <combaseapi.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
// allocator
|
||||
static AMF_INLINE void* AMF_CDECL_CALL amf_variant_alloc(amf_size count)
|
||||
{
|
||||
return CoTaskMemAlloc(count);
|
||||
}
|
||||
static AMF_INLINE void AMF_CDECL_CALL amf_variant_free(void* ptr)
|
||||
{
|
||||
CoTaskMemFree(ptr);
|
||||
}
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#else // defined(_WIN32)
|
||||
#include <stdlib.h>
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
// allocator
|
||||
static AMF_INLINE void* AMF_CDECL_CALL amf_variant_alloc(amf_size count)
|
||||
{
|
||||
return malloc(count);
|
||||
}
|
||||
static AMF_INLINE void AMF_CDECL_CALL amf_variant_free(void* ptr)
|
||||
{
|
||||
free(ptr);
|
||||
}
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
typedef struct AMFGuid
|
||||
{
|
||||
amf_uint32 data1;
|
||||
amf_uint16 data2;
|
||||
amf_uint16 data3;
|
||||
amf_uint8 data41;
|
||||
amf_uint8 data42;
|
||||
amf_uint8 data43;
|
||||
amf_uint8 data44;
|
||||
amf_uint8 data45;
|
||||
amf_uint8 data46;
|
||||
amf_uint8 data47;
|
||||
amf_uint8 data48;
|
||||
#if defined(__cplusplus)
|
||||
AMFGuid(amf_uint32 _data1, amf_uint16 _data2, amf_uint16 _data3,
|
||||
amf_uint8 _data41, amf_uint8 _data42, amf_uint8 _data43, amf_uint8 _data44,
|
||||
amf_uint8 _data45, amf_uint8 _data46, amf_uint8 _data47, amf_uint8 _data48)
|
||||
: data1 (_data1),
|
||||
data2 (_data2),
|
||||
data3 (_data3),
|
||||
data41(_data41),
|
||||
data42(_data42),
|
||||
data43(_data43),
|
||||
data44(_data44),
|
||||
data45(_data45),
|
||||
data46(_data46),
|
||||
data47(_data47),
|
||||
data48(_data48)
|
||||
{}
|
||||
|
||||
bool operator==(const AMFGuid& other) const
|
||||
{
|
||||
return
|
||||
data1 == other.data1 &&
|
||||
data2 == other.data2 &&
|
||||
data3 == other.data3 &&
|
||||
data41 == other.data41 &&
|
||||
data42 == other.data42 &&
|
||||
data43 == other.data43 &&
|
||||
data44 == other.data44 &&
|
||||
data45 == other.data45 &&
|
||||
data46 == other.data46 &&
|
||||
data47 == other.data47 &&
|
||||
data48 == other.data48;
|
||||
}
|
||||
AMF_INLINE bool operator!=(const AMFGuid& other) const { return !operator==(other); }
|
||||
#endif
|
||||
} AMFGuid;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
static AMF_INLINE bool AMFCompareGUIDs(const AMFGuid& guid1, const AMFGuid& guid2)
|
||||
{
|
||||
return guid1 == guid2;
|
||||
}
|
||||
#else
|
||||
static AMF_INLINE amf_bool AMFCompareGUIDs(const struct AMFGuid guid1, const struct AMFGuid guid2)
|
||||
{
|
||||
return memcmp(&guid1, &guid2, sizeof(guid1)) == 0;
|
||||
}
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
//#include <MacTypes.h>
|
||||
|
||||
#define media_status_t int
|
||||
#define ANativeWindow void
|
||||
#define JNIEnv void
|
||||
#define jobject int
|
||||
#define JavaVM void
|
||||
|
||||
#endif
|
||||
|
||||
#endif //#ifndef AMF_Platform_h
|
||||
275
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/PropertyStorage.h
vendored
Normal file
275
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/PropertyStorage.h
vendored
Normal file
@@ -0,0 +1,275 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_PropertyStorage_h
|
||||
#define AMF_PropertyStorage_h
|
||||
#pragma once
|
||||
|
||||
#include "Variant.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFPropertyStorageObserver interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
|
||||
class AMF_NO_VTABLE AMFPropertyStorageObserver
|
||||
{
|
||||
public:
|
||||
virtual void AMF_STD_CALL OnPropertyChanged(const wchar_t* name) = 0;
|
||||
};
|
||||
#else //#if defined(__cplusplus)
|
||||
typedef struct AMFPropertyStorageObserver AMFPropertyStorageObserver;
|
||||
typedef struct AMFPropertyStorageObserverVtbl
|
||||
{
|
||||
void (AMF_STD_CALL *OnPropertyChanged)(AMFPropertyStorageObserver *pThis, const wchar_t* name);
|
||||
} AMFPropertyStorageObserverVtbl;
|
||||
|
||||
struct AMFPropertyStorageObserver
|
||||
{
|
||||
const AMFPropertyStorageObserverVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFPropertyStorage interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class AMF_NO_VTABLE AMFPropertyStorage : public AMFInterface
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0xc7cec05b, 0xcfb9, 0x48af, 0xac, 0xe3, 0xf6, 0x8d, 0xf8, 0x39, 0x5f, 0xe3)
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL SetProperty(const wchar_t* name, AMFVariantStruct value) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetProperty(const wchar_t* name, AMFVariantStruct* pValue) const = 0;
|
||||
|
||||
virtual amf_bool AMF_STD_CALL HasProperty(const wchar_t* name) const = 0;
|
||||
virtual amf_size AMF_STD_CALL GetPropertyCount() const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetPropertyAt(amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue) const = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL Clear() = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL AddTo(AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep) const= 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CopyTo(AMFPropertyStorage* pDest, amf_bool deep) const = 0;
|
||||
|
||||
virtual void AMF_STD_CALL AddObserver(AMFPropertyStorageObserver* pObserver) = 0;
|
||||
virtual void AMF_STD_CALL RemoveObserver(AMFPropertyStorageObserver* pObserver) = 0;
|
||||
|
||||
template<typename _T>
|
||||
AMF_RESULT AMF_STD_CALL SetProperty(const wchar_t* name, const _T& value);
|
||||
template<typename _T>
|
||||
AMF_RESULT AMF_STD_CALL GetProperty(const wchar_t* name, _T* pValue) const;
|
||||
template<typename _T>
|
||||
AMF_RESULT AMF_STD_CALL GetPropertyString(const wchar_t* name, _T* pValue) const;
|
||||
template<typename _T>
|
||||
AMF_RESULT AMF_STD_CALL GetPropertyWString(const wchar_t* name, _T* pValue) const;
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFPropertyStorage> AMFPropertyStoragePtr;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
#else // #if defined(__cplusplus)
|
||||
typedef struct AMFPropertyStorage AMFPropertyStorage;
|
||||
AMF_DECLARE_IID(AMFPropertyStorage, 0xc7cec05b, 0xcfb9, 0x48af, 0xac, 0xe3, 0xf6, 0x8d, 0xf8, 0x39, 0x5f, 0xe3)
|
||||
|
||||
typedef struct AMFPropertyStorageVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFPropertyStorage* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFPropertyStorage* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFPropertyStorage* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFPropertyStorage* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFPropertyStorage* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFPropertyStorage* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFPropertyStorage* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFPropertyStorage* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFPropertyStorage* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFPropertyStorage* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFPropertyStorage* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFPropertyStorage* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFPropertyStorage* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
} AMFPropertyStorageVtbl;
|
||||
|
||||
struct AMFPropertyStorage
|
||||
{
|
||||
const AMFPropertyStorageVtbl *pVtbl;
|
||||
};
|
||||
|
||||
#define AMF_ASSIGN_PROPERTY_DATA(res, varType, pThis, name, val ) \
|
||||
{ \
|
||||
AMFVariantStruct var = {0}; \
|
||||
AMFVariantAssign##varType(&var, val); \
|
||||
res = pThis->pVtbl->SetProperty(pThis, name, var ); \
|
||||
}
|
||||
|
||||
#define AMF_QUERY_INTERFACE(res, from, InterfaceTypeTo, to) \
|
||||
{ \
|
||||
AMFGuid guid_##InterfaceTypeTo = IID_##InterfaceTypeTo(); \
|
||||
res = from->pVtbl->QueryInterface(from, &guid_##InterfaceTypeTo, (void**)&to); \
|
||||
}
|
||||
|
||||
#define AMF_ASSIGN_PROPERTY_INTERFACE(res, pThis, name, val) \
|
||||
{ \
|
||||
AMFInterface *amf_interface; \
|
||||
AMFVariantStruct var; \
|
||||
res = AMFVariantInit(&var); \
|
||||
if (res == AMF_OK) \
|
||||
{ \
|
||||
AMF_QUERY_INTERFACE(res, val, AMFInterface, amf_interface)\
|
||||
if (res == AMF_OK) \
|
||||
{ \
|
||||
res = AMFVariantAssignInterface(&var, amf_interface); \
|
||||
amf_interface->pVtbl->Release(amf_interface); \
|
||||
if (res == AMF_OK) \
|
||||
{ \
|
||||
res = pThis->pVtbl->SetProperty(pThis, name, var); \
|
||||
} \
|
||||
} \
|
||||
AMFVariantClear(&var); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define AMF_GET_PROPERTY_INTERFACE(res, pThis, name, TargetType, val) \
|
||||
{ \
|
||||
AMFVariantStruct var; \
|
||||
res = AMFVariantInit(&var); \
|
||||
if (res != AMF_OK) \
|
||||
{ \
|
||||
res = pThis->pVtbl->GetProperty(pThis, name, &var); \
|
||||
if (res == AMF_OK) \
|
||||
{ \
|
||||
if (var.type == AMF_VARIANT_INTERFACE && AMFVariantInterface(&var)) \
|
||||
{ \
|
||||
AMF_QUERY_INTERFACE(res, AMFVariantInterface(&var), TargetType, val); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
res = AMF_INVALID_DATA_TYPE; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
AMFVariantClear(&var); \
|
||||
}
|
||||
|
||||
#define AMF_ASSIGN_PROPERTY_TYPE(res, varType, dataType , pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, varType, pThis, name, (dataType)val)
|
||||
|
||||
#define AMF_ASSIGN_PROPERTY_INT64(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_TYPE(res, Int64, amf_int64, pThis, name, val)
|
||||
#define AMF_ASSIGN_PROPERTY_DOUBLE(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_TYPE(res, Double, amf_double, pThis, name, val)
|
||||
#define AMF_ASSIGN_PROPERTY_BOOL(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_TYPE(res, Bool, amf_bool, pThis, name, val)
|
||||
#define AMF_ASSIGN_PROPERTY_RECT(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Rect, pThis, name, &val)
|
||||
#define AMF_ASSIGN_PROPERTY_SIZE(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Size, pThis, name, &val)
|
||||
#define AMF_ASSIGN_PROPERTY_POINT(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Point, pThis, name, &val)
|
||||
#define AMF_ASSIGN_PROPERTY_RATE(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Rate, pThis, name, &val)
|
||||
#define AMF_ASSIGN_PROPERTY_RATIO(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Ratio, pThis, name, &val)
|
||||
#define AMF_ASSIGN_PROPERTY_COLOR(res, pThis, name, val ) AMF_ASSIGN_PROPERTY_DATA(res, Color, pThis, name, &val)
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// template methods implementations
|
||||
//----------------------------------------------------------------------------------------------
|
||||
template<typename _T> inline
|
||||
AMF_RESULT AMF_STD_CALL AMFPropertyStorage::SetProperty(const wchar_t* name, const _T& value)
|
||||
{
|
||||
AMF_RESULT err = SetProperty(name, static_cast<const AMFVariantStruct&>(AMFVariant(value)));
|
||||
return err;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
template<typename _T> inline
|
||||
AMF_RESULT AMF_STD_CALL AMFPropertyStorage::GetProperty(const wchar_t* name, _T* pValue) const
|
||||
{
|
||||
AMFVariant var;
|
||||
AMF_RESULT err = GetProperty(name, static_cast<AMFVariantStruct*>(&var));
|
||||
if(err == AMF_OK)
|
||||
{
|
||||
*pValue = static_cast<_T>(var);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
template<typename _T> inline
|
||||
AMF_RESULT AMF_STD_CALL AMFPropertyStorage::GetPropertyString(const wchar_t* name, _T* pValue) const
|
||||
{
|
||||
AMFVariant var;
|
||||
AMF_RESULT err = GetProperty(name, static_cast<AMFVariantStruct*>(&var));
|
||||
if(err == AMF_OK)
|
||||
{
|
||||
*pValue = var.ToString().c_str();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
template<typename _T> inline
|
||||
AMF_RESULT AMF_STD_CALL AMFPropertyStorage::GetPropertyWString(const wchar_t* name, _T* pValue) const
|
||||
{
|
||||
AMFVariant var;
|
||||
AMF_RESULT err = GetProperty(name, static_cast<AMFVariantStruct*>(&var));
|
||||
if(err == AMF_OK)
|
||||
{
|
||||
*pValue = var.ToWString().c_str();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------
|
||||
template<> inline
|
||||
AMF_RESULT AMF_STD_CALL AMFPropertyStorage::GetProperty(const wchar_t* name,
|
||||
AMFInterface** ppValue) const
|
||||
{
|
||||
AMFVariant var;
|
||||
AMF_RESULT err = GetProperty(name, static_cast<AMFVariantStruct*>(&var));
|
||||
if(err == AMF_OK)
|
||||
{
|
||||
*ppValue = static_cast<AMFInterface*>(var);
|
||||
}
|
||||
if(*ppValue)
|
||||
{
|
||||
(*ppValue)->Acquire();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} //namespace amf
|
||||
#endif
|
||||
|
||||
#endif // #ifndef AMF_PropertyStorage_h
|
||||
207
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/PropertyStorageEx.h
vendored
Normal file
207
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/PropertyStorageEx.h
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_PropertyStorageEx_h
|
||||
#define AMF_PropertyStorageEx_h
|
||||
#pragma once
|
||||
|
||||
#include "PropertyStorage.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_PROPERTY_CONTENT_ENUM
|
||||
{
|
||||
AMF_PROPERTY_CONTENT_DEFAULT = 0,
|
||||
AMF_PROPERTY_CONTENT_XML, // m_eType is AMF_VARIANT_STRING
|
||||
|
||||
AMF_PROPERTY_CONTENT_FILE_OPEN_PATH, // m_eType AMF_VARIANT_WSTRING
|
||||
AMF_PROPERTY_CONTENT_FILE_SAVE_PATH, // m_eType AMF_VARIANT_WSTRING
|
||||
|
||||
AMF_PROPERTY_CONTENT_INTEGER_ARRAY, // m_eType AMF_VARIANT_INTERFACE
|
||||
AMF_PROPERTY_CONTENT_FLOAT_ARRAY // m_eType AMF_VARIANT_INTERFACE
|
||||
} AMF_PROPERTY_CONTENT_ENUM;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_PROPERTY_ACCESS_TYPE
|
||||
{
|
||||
AMF_PROPERTY_ACCESS_PRIVATE = 0,
|
||||
AMF_PROPERTY_ACCESS_READ = 0x1,
|
||||
AMF_PROPERTY_ACCESS_WRITE = 0x2,
|
||||
AMF_PROPERTY_ACCESS_READ_WRITE = (AMF_PROPERTY_ACCESS_READ | AMF_PROPERTY_ACCESS_WRITE),
|
||||
AMF_PROPERTY_ACCESS_WRITE_RUNTIME = 0x4,
|
||||
AMF_PROPERTY_ACCESS_FULL = 0xFF,
|
||||
AMF_PROPERTY_ACCESS_NON_PERSISTANT = 0x4000,
|
||||
AMF_PROPERTY_ACCESS_NON_PERSISTANT_READ = (AMF_PROPERTY_ACCESS_NON_PERSISTANT | AMF_PROPERTY_ACCESS_READ),
|
||||
AMF_PROPERTY_ACCESS_NON_PERSISTANT_READ_WRITE = (AMF_PROPERTY_ACCESS_NON_PERSISTANT | AMF_PROPERTY_ACCESS_READ_WRITE),
|
||||
AMF_PROPERTY_ACCESS_NON_PERSISTANT_FULL = (AMF_PROPERTY_ACCESS_NON_PERSISTANT | AMF_PROPERTY_ACCESS_FULL),
|
||||
AMF_PROPERTY_ACCESS_INVALID = 0x8000
|
||||
} AMF_PROPERTY_ACCESS_TYPE;
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef struct AMFEnumDescriptionEntry
|
||||
{
|
||||
amf_int value;
|
||||
const wchar_t* name;
|
||||
} AMFEnumDescriptionEntry;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef amf_uint32 AMF_PROPERTY_CONTENT_TYPE;
|
||||
|
||||
typedef struct AMFPropertyInfo
|
||||
{
|
||||
const wchar_t* name;
|
||||
const wchar_t* desc;
|
||||
AMF_VARIANT_TYPE type;
|
||||
AMF_PROPERTY_CONTENT_TYPE contentType;
|
||||
|
||||
AMFVariantStruct defaultValue;
|
||||
AMFVariantStruct minValue;
|
||||
AMFVariantStruct maxValue;
|
||||
AMF_PROPERTY_ACCESS_TYPE accessType;
|
||||
const AMFEnumDescriptionEntry* pEnumDescription;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
AMFPropertyInfo() :
|
||||
name(NULL),
|
||||
desc(NULL),
|
||||
type(),
|
||||
contentType(),
|
||||
defaultValue(),
|
||||
minValue(),
|
||||
maxValue(),
|
||||
accessType(AMF_PROPERTY_ACCESS_FULL),
|
||||
pEnumDescription(NULL)
|
||||
{}
|
||||
AMFPropertyInfo(const AMFPropertyInfo& propery) : name(propery.name),
|
||||
desc(propery.desc),
|
||||
type(propery.type),
|
||||
contentType(propery.contentType),
|
||||
defaultValue(propery.defaultValue),
|
||||
minValue(propery.minValue),
|
||||
maxValue(propery.maxValue),
|
||||
accessType(propery.accessType),
|
||||
pEnumDescription(propery.pEnumDescription)
|
||||
{}
|
||||
virtual ~AMFPropertyInfo(){}
|
||||
|
||||
amf_bool AMF_STD_CALL AllowedRead() const
|
||||
{
|
||||
return (accessType & AMF_PROPERTY_ACCESS_READ) != 0;
|
||||
}
|
||||
amf_bool AMF_STD_CALL AllowedWrite() const
|
||||
{
|
||||
return (accessType & AMF_PROPERTY_ACCESS_WRITE) != 0;
|
||||
}
|
||||
amf_bool AMF_STD_CALL AllowedChangeInRuntime() const
|
||||
{
|
||||
return (accessType & AMF_PROPERTY_ACCESS_WRITE_RUNTIME) != 0;
|
||||
}
|
||||
|
||||
AMFPropertyInfo& operator=(const AMFPropertyInfo& propery)
|
||||
{
|
||||
name = propery.name;
|
||||
desc = propery.desc;
|
||||
type = propery.type;
|
||||
contentType = propery.contentType;
|
||||
defaultValue = propery.defaultValue;
|
||||
minValue = propery.minValue;
|
||||
maxValue = propery.maxValue;
|
||||
accessType = propery.accessType;
|
||||
pEnumDescription = propery.pEnumDescription;
|
||||
|
||||
return *this;
|
||||
}
|
||||
#endif // #if defined(__cplusplus)
|
||||
} AMFPropertyInfo;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFPropertyStorageEx interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFPropertyStorageEx : public AMFPropertyStorage
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x16b8958d, 0xe943, 0x4a33, 0xa3, 0x5a, 0x88, 0x5a, 0xd8, 0x28, 0xf2, 0x67)
|
||||
|
||||
virtual amf_size AMF_STD_CALL GetPropertiesInfoCount() const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetPropertyInfo(amf_size index, const AMFPropertyInfo** ppInfo) const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL GetPropertyInfo(const wchar_t* name, const AMFPropertyInfo** ppInfo) const = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL ValidateProperty(const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated) const = 0;
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFPropertyStorageEx> AMFPropertyStorageExPtr;
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFPropertyStorageEx, 0x16b8958d, 0xe943, 0x4a33, 0xa3, 0x5a, 0x88, 0x5a, 0xd8, 0x28, 0xf2, 0x67)
|
||||
typedef struct AMFPropertyStorageEx AMFPropertyStorageEx;
|
||||
|
||||
typedef struct AMFPropertyStorageExVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFPropertyStorageEx* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFPropertyStorageEx* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFPropertyStorageEx* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFPropertyStorageEx* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFPropertyStorageEx* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFPropertyStorageEx* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFPropertyStorageEx* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFPropertyStorageEx* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFPropertyStorageEx* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFPropertyStorageEx* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFPropertyStorageEx interface
|
||||
|
||||
amf_size (AMF_STD_CALL *GetPropertiesInfoCount)(AMFPropertyStorageEx* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfoAt)(AMFPropertyStorageEx* pThis, amf_size index, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyInfo)(AMFPropertyStorageEx* pThis, const wchar_t* name, const AMFPropertyInfo** ppInfo);
|
||||
AMF_RESULT (AMF_STD_CALL *ValidateProperty)(AMFPropertyStorageEx* pThis, const wchar_t* name, AMFVariantStruct value, AMFVariantStruct* pOutValidated);
|
||||
|
||||
} AMFPropertyStorageExVtbl;
|
||||
|
||||
struct AMFPropertyStorageEx
|
||||
{
|
||||
const AMFPropertyStorageExVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
} //namespace amf
|
||||
#endif
|
||||
|
||||
|
||||
#endif //#ifndef AMF_PropertyStorageEx_h
|
||||
130
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Result.h
vendored
Normal file
130
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Result.h
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Result_h
|
||||
#define AMF_Result_h
|
||||
#pragma once
|
||||
|
||||
#include "Platform.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// result codes
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
typedef enum AMF_RESULT
|
||||
{
|
||||
AMF_OK = 0,
|
||||
AMF_FAIL ,
|
||||
|
||||
// common errors
|
||||
AMF_UNEXPECTED ,
|
||||
|
||||
AMF_ACCESS_DENIED ,
|
||||
AMF_INVALID_ARG ,
|
||||
AMF_OUT_OF_RANGE ,
|
||||
|
||||
AMF_OUT_OF_MEMORY ,
|
||||
AMF_INVALID_POINTER ,
|
||||
|
||||
AMF_NO_INTERFACE ,
|
||||
AMF_NOT_IMPLEMENTED ,
|
||||
AMF_NOT_SUPPORTED ,
|
||||
AMF_NOT_FOUND ,
|
||||
|
||||
AMF_ALREADY_INITIALIZED ,
|
||||
AMF_NOT_INITIALIZED ,
|
||||
|
||||
AMF_INVALID_FORMAT ,// invalid data format
|
||||
|
||||
AMF_WRONG_STATE ,
|
||||
AMF_FILE_NOT_OPEN ,// cannot open file
|
||||
|
||||
// device common codes
|
||||
AMF_NO_DEVICE ,
|
||||
|
||||
// device directx
|
||||
AMF_DIRECTX_FAILED ,
|
||||
// device opencl
|
||||
AMF_OPENCL_FAILED ,
|
||||
// device opengl
|
||||
AMF_GLX_FAILED ,//failed to use GLX
|
||||
// device XV
|
||||
AMF_XV_FAILED , //failed to use Xv extension
|
||||
// device alsa
|
||||
AMF_ALSA_FAILED ,//failed to use ALSA
|
||||
|
||||
// component common codes
|
||||
|
||||
//result codes
|
||||
AMF_EOF ,
|
||||
AMF_REPEAT ,
|
||||
AMF_INPUT_FULL ,//returned by AMFComponent::SubmitInput if input queue is full
|
||||
AMF_RESOLUTION_CHANGED ,//resolution changed client needs to Drain/Terminate/Init
|
||||
AMF_RESOLUTION_UPDATED ,//resolution changed in adaptive mode. New ROI will be set on output on newly decoded frames
|
||||
|
||||
//error codes
|
||||
AMF_INVALID_DATA_TYPE ,//invalid data type
|
||||
AMF_INVALID_RESOLUTION ,//invalid resolution (width or height)
|
||||
AMF_CODEC_NOT_SUPPORTED ,//codec not supported
|
||||
AMF_SURFACE_FORMAT_NOT_SUPPORTED ,//surface format not supported
|
||||
AMF_SURFACE_MUST_BE_SHARED ,//surface should be shared (DX11: (MiscFlags & D3D11_RESOURCE_MISC_SHARED) == 0, DX9: No shared handle found)
|
||||
|
||||
// component video decoder
|
||||
AMF_DECODER_NOT_PRESENT ,//failed to create the decoder
|
||||
AMF_DECODER_SURFACE_ALLOCATION_FAILED ,//failed to create the surface for decoding
|
||||
AMF_DECODER_NO_FREE_SURFACES ,
|
||||
|
||||
// component video encoder
|
||||
AMF_ENCODER_NOT_PRESENT ,//failed to create the encoder
|
||||
|
||||
// component video processor
|
||||
|
||||
// component video conveter
|
||||
|
||||
// component dem
|
||||
AMF_DEM_ERROR ,
|
||||
AMF_DEM_PROPERTY_READONLY ,
|
||||
AMF_DEM_REMOTE_DISPLAY_CREATE_FAILED ,
|
||||
AMF_DEM_START_ENCODING_FAILED ,
|
||||
AMF_DEM_QUERY_OUTPUT_FAILED ,
|
||||
|
||||
// component TAN
|
||||
AMF_TAN_CLIPPING_WAS_REQUIRED , // Resulting data was truncated to meet output type's value limits.
|
||||
AMF_TAN_UNSUPPORTED_VERSION , // Not supported version requested, solely for TANCreateContext().
|
||||
|
||||
AMF_NEED_MORE_INPUT ,//returned by AMFComponent::SubmitInput did not produce a buffer because more input submissions are required.
|
||||
|
||||
// device vulkan
|
||||
AMF_VULKAN_FAILED ,
|
||||
} AMF_RESULT;
|
||||
|
||||
#endif //#ifndef AMF_Result_h
|
||||
292
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Surface.h
vendored
Normal file
292
libs/hwcodec/externals/AMF_v1.4.35/amf/public/include/core/Surface.h
vendored
Normal file
@@ -0,0 +1,292 @@
|
||||
//
|
||||
// Notice Regarding Standards. AMD does not provide a license or sublicense to
|
||||
// any Intellectual Property Rights relating to any standards, including but not
|
||||
// limited to any audio and/or video codec technologies such as MPEG-2, MPEG-4;
|
||||
// AVC/H.264; HEVC/H.265; AAC decode/FFMPEG; AAC encode/FFMPEG; VC-1; and MP3
|
||||
// (collectively, the "Media Technologies"). For clarity, you will pay any
|
||||
// royalties due for such third party technologies, which may include the Media
|
||||
// Technologies that are owed as a result of AMD providing the Software to you.
|
||||
//
|
||||
// MIT license
|
||||
//
|
||||
// Copyright (c) 2018 Advanced Micro Devices, Inc. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
#ifndef AMF_Surface_h
|
||||
#define AMF_Surface_h
|
||||
#pragma once
|
||||
|
||||
#include "Data.h"
|
||||
#include "Plane.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( push )
|
||||
#pragma warning(disable : 4263)
|
||||
#pragma warning(disable : 4264)
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
namespace amf
|
||||
{
|
||||
#endif
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_SURFACE_FORMAT
|
||||
{
|
||||
AMF_SURFACE_UNKNOWN = 0,
|
||||
AMF_SURFACE_NV12, ///< 1 - planar 4:2:0 Y width x height + packed UV width/2 x height/2 - 8 bit per component
|
||||
AMF_SURFACE_YV12, ///< 2 - planar 4:2:0 Y width x height + V width/2 x height/2 + U width/2 x height/2 - 8 bit per component
|
||||
AMF_SURFACE_BGRA, ///< 3 - packed 4:4:4 - 8 bit per component
|
||||
AMF_SURFACE_ARGB, ///< 4 - packed 4:4:4 - 8 bit per component
|
||||
AMF_SURFACE_RGBA, ///< 5 - packed 4:4:4 - 8 bit per component
|
||||
AMF_SURFACE_GRAY8, ///< 6 - single component - 8 bit
|
||||
AMF_SURFACE_YUV420P, ///< 7 - planar 4:2:0 Y width x height + U width/2 x height/2 + V width/2 x height/2 - 8 bit per component
|
||||
AMF_SURFACE_U8V8, ///< 8 - packed double component - 8 bit per component
|
||||
AMF_SURFACE_YUY2, ///< 9 - packed 4:2:2 Byte 0=8-bit Y'0; Byte 1=8-bit Cb; Byte 2=8-bit Y'1; Byte 3=8-bit Cr
|
||||
AMF_SURFACE_P010, ///< 10 - planar 4:2:0 Y width x height + packed UV width/2 x height/2 - 10 bit per component (16 allocated, upper 10 bits are used)
|
||||
AMF_SURFACE_RGBA_F16, ///< 11 - packed 4:4:4 - 16 bit per component float
|
||||
AMF_SURFACE_UYVY, ///< 12 - packed 4:2:2 the similar to YUY2 but Y and UV swapped: Byte 0=8-bit Cb; Byte 1=8-bit Y'0; Byte 2=8-bit Cr Byte 3=8-bit Y'1; (used the same DX/CL/Vulkan storage as YUY2)
|
||||
AMF_SURFACE_R10G10B10A2, ///< 13 - packed 4:4:4 to 4 bytes, 10 bit per RGB component, 2 bits per A
|
||||
AMF_SURFACE_Y210, ///< 14 - packed 4:2:2 - Word 0=10-bit Y'0; Word 1=10-bit Cb; Word 2=10-bit Y'1; Word 3=10-bit Cr
|
||||
AMF_SURFACE_AYUV, ///< 15 - packed 4:4:4 - 8 bit per component YUVA
|
||||
AMF_SURFACE_Y410, ///< 16 - packed 4:4:4 - 10 bit per YUV component, 2 bits per A, AVYU
|
||||
AMF_SURFACE_Y416, ///< 17 - packed 4:4:4 - 16 bit per component 4 bytes, AVYU
|
||||
AMF_SURFACE_GRAY32, ///< 18 - single component - 32 bit
|
||||
AMF_SURFACE_P012, ///< 19 - planar 4:2:0 Y width x height + packed UV width/2 x height/2 - 12 bit per component (16 allocated, upper 12 bits are used)
|
||||
AMF_SURFACE_P016, ///< 20 - planar 4:2:0 Y width x height + packed UV width/2 x height/2 - 16 bit per component (16 allocated, all bits are used)
|
||||
|
||||
AMF_SURFACE_FIRST = AMF_SURFACE_NV12,
|
||||
AMF_SURFACE_LAST = AMF_SURFACE_P016
|
||||
} AMF_SURFACE_FORMAT;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMF_SURFACE_USAGE translates to D3D11_BIND_FLAG or VkImageUsageFlags
|
||||
// bit mask
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_SURFACE_USAGE_BITS
|
||||
{ // D3D11 D3D12 Vulkan
|
||||
AMF_SURFACE_USAGE_DEFAULT = 0x80000000, // will apply default D3D12_RESOURCE_FLAG_NONE VK_IMAGE_USAGE_TRANSFER_SRC_BIT| VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
|
||||
AMF_SURFACE_USAGE_NONE = 0x00000000, // 0, D3D12_RESOURCE_FLAG_NONE, 0
|
||||
AMF_SURFACE_USAGE_SHADER_RESOURCE = 0x00000001, // D3D11_BIND_SHADER_RESOURCE, D3D12_RESOURCE_FLAG_NONE VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
|
||||
AMF_SURFACE_USAGE_RENDER_TARGET = 0x00000002, // D3D11_BIND_RENDER_TARGET, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
|
||||
AMF_SURFACE_USAGE_UNORDERED_ACCESS = 0x00000004, // D3D11_BIND_UNORDERED_ACCESS, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT
|
||||
AMF_SURFACE_USAGE_TRANSFER_SRC = 0x00000008, // D3D12_RESOURCE_FLAG_NONE VK_IMAGE_USAGE_TRANSFER_SRC_BIT
|
||||
AMF_SURFACE_USAGE_TRANSFER_DST = 0x00000010, // D3D12_RESOURCE_FLAG_NONE VK_IMAGE_USAGE_TRANSFER_DST_BIT
|
||||
AMF_SURFACE_USAGE_LINEAR = 0x00000020, //
|
||||
AMF_SURFACE_USAGE_NOSYNC = 0x00000040, // no fence (AMFFenceGUID) created no semaphore (AMFVulkanSync::hSemaphore) created
|
||||
AMF_SURFACE_USAGE_DECODER_DST = 0x00000080, // AMFResourceDecodeGUID is set to 1 VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR
|
||||
AMF_SURFACE_USAGE_DECODER_DPB = 0x00000100, // VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR
|
||||
AMF_SURFACE_USAGE_NO_TRANSITION = 0x00000200, // no layout transition
|
||||
} AMF_SURFACE_USAGE_BITS;
|
||||
typedef amf_flags AMF_SURFACE_USAGE;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
||||
#if defined(_WIN32)
|
||||
AMF_WEAK GUID AMFFormatGUID = { 0x8cd592d0, 0x8063, 0x4af8, {0xa7, 0xd0, 0x32, 0x5b, 0xc5, 0xf7, 0x48, 0xab}}; // UINT(AMF_SURFACE_FORMAT), default - AMF_SURFACE_UNKNOWN; to be set on ID3D11Texture2D objects when used natively (i.e. force UYVY on DXGI_FORMAT_YUY2 texture)
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// frame type
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef enum AMF_FRAME_TYPE
|
||||
{
|
||||
// flags
|
||||
AMF_FRAME_STEREO_FLAG = 0x10000000,
|
||||
AMF_FRAME_LEFT_FLAG = AMF_FRAME_STEREO_FLAG | 0x20000000,
|
||||
AMF_FRAME_RIGHT_FLAG = AMF_FRAME_STEREO_FLAG | 0x40000000,
|
||||
AMF_FRAME_BOTH_FLAG = AMF_FRAME_LEFT_FLAG | AMF_FRAME_RIGHT_FLAG,
|
||||
AMF_FRAME_INTERLEAVED_FLAG = 0x01000000,
|
||||
AMF_FRAME_FIELD_FLAG = 0x02000000,
|
||||
AMF_FRAME_EVEN_FLAG = 0x04000000,
|
||||
AMF_FRAME_ODD_FLAG = 0x08000000,
|
||||
|
||||
// values
|
||||
AMF_FRAME_UNKNOWN =-1,
|
||||
AMF_FRAME_PROGRESSIVE = 0,
|
||||
|
||||
AMF_FRAME_INTERLEAVED_EVEN_FIRST = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_EVEN_FLAG,
|
||||
AMF_FRAME_INTERLEAVED_ODD_FIRST = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_ODD_FLAG,
|
||||
AMF_FRAME_FIELD_SINGLE_EVEN = AMF_FRAME_FIELD_FLAG | AMF_FRAME_EVEN_FLAG,
|
||||
AMF_FRAME_FIELD_SINGLE_ODD = AMF_FRAME_FIELD_FLAG | AMF_FRAME_ODD_FLAG,
|
||||
|
||||
AMF_FRAME_STEREO_LEFT = AMF_FRAME_LEFT_FLAG,
|
||||
AMF_FRAME_STEREO_RIGHT = AMF_FRAME_RIGHT_FLAG,
|
||||
AMF_FRAME_STEREO_BOTH = AMF_FRAME_BOTH_FLAG,
|
||||
|
||||
AMF_FRAME_INTERLEAVED_EVEN_FIRST_STEREO_LEFT = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_EVEN_FLAG | AMF_FRAME_LEFT_FLAG,
|
||||
AMF_FRAME_INTERLEAVED_EVEN_FIRST_STEREO_RIGHT = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_EVEN_FLAG | AMF_FRAME_RIGHT_FLAG,
|
||||
AMF_FRAME_INTERLEAVED_EVEN_FIRST_STEREO_BOTH = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_EVEN_FLAG | AMF_FRAME_BOTH_FLAG,
|
||||
|
||||
AMF_FRAME_INTERLEAVED_ODD_FIRST_STEREO_LEFT = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_ODD_FLAG | AMF_FRAME_LEFT_FLAG,
|
||||
AMF_FRAME_INTERLEAVED_ODD_FIRST_STEREO_RIGHT = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_ODD_FLAG | AMF_FRAME_RIGHT_FLAG,
|
||||
AMF_FRAME_INTERLEAVED_ODD_FIRST_STEREO_BOTH = AMF_FRAME_INTERLEAVED_FLAG | AMF_FRAME_ODD_FLAG | AMF_FRAME_BOTH_FLAG,
|
||||
} AMF_FRAME_TYPE;
|
||||
|
||||
typedef enum AMF_ROTATION_ENUM
|
||||
{
|
||||
AMF_ROTATION_NONE = 0,
|
||||
AMF_ROTATION_90 = 1,
|
||||
AMF_ROTATION_180 = 2,
|
||||
AMF_ROTATION_270 = 3,
|
||||
} AMF_ROTATION_ENUM;
|
||||
|
||||
#define AMF_SURFACE_ROTATION L"Rotation" // amf_int64(AMF_ROTATION_ENUM); default = AMF_ROTATION_NONE, can be set on surfaces
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFSurfaceObserver interface - callback; is called before internal release resources.
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMFSurface;
|
||||
class AMF_NO_VTABLE AMFSurfaceObserver
|
||||
{
|
||||
public:
|
||||
virtual void AMF_STD_CALL OnSurfaceDataRelease(AMFSurface* pSurface) = 0;
|
||||
};
|
||||
#else // #if defined(__cplusplus)
|
||||
typedef struct AMFSurface AMFSurface;
|
||||
typedef struct AMFSurfaceObserver AMFSurfaceObserver;
|
||||
|
||||
typedef struct AMFSurfaceObserverVtbl
|
||||
{
|
||||
void (AMF_STD_CALL *OnSurfaceDataRelease)(AMFSurfaceObserver* pThis, AMFSurface* pSurface);
|
||||
} AMFSurfaceObserverVtbl;
|
||||
|
||||
struct AMFSurfaceObserver
|
||||
{
|
||||
const AMFSurfaceObserverVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// AMFSurface interface
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#if defined(__cplusplus)
|
||||
class AMF_NO_VTABLE AMFSurface : public AMFData
|
||||
{
|
||||
public:
|
||||
AMF_DECLARE_IID(0x3075dbe3, 0x8718, 0x4cfa, 0x86, 0xfb, 0x21, 0x14, 0xc0, 0xa5, 0xa4, 0x51)
|
||||
|
||||
virtual AMF_SURFACE_FORMAT AMF_STD_CALL GetFormat() = 0;
|
||||
|
||||
// do not store planes outside. should be used together with Surface
|
||||
virtual amf_size AMF_STD_CALL GetPlanesCount() = 0;
|
||||
virtual AMFPlane* AMF_STD_CALL GetPlaneAt(amf_size index) = 0;
|
||||
virtual AMFPlane* AMF_STD_CALL GetPlane(AMF_PLANE_TYPE type) = 0;
|
||||
|
||||
virtual AMF_FRAME_TYPE AMF_STD_CALL GetFrameType() = 0;
|
||||
virtual void AMF_STD_CALL SetFrameType(AMF_FRAME_TYPE type) = 0;
|
||||
|
||||
virtual AMF_RESULT AMF_STD_CALL SetCrop(amf_int32 x,amf_int32 y, amf_int32 width, amf_int32 height) = 0;
|
||||
virtual AMF_RESULT AMF_STD_CALL CopySurfaceRegion(AMFSurface* pDest, amf_int32 dstX, amf_int32 dstY, amf_int32 srcX, amf_int32 srcY, amf_int32 width, amf_int32 height) = 0;
|
||||
|
||||
// Observer management
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Woverloaded-virtual"
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
|
||||
#endif
|
||||
virtual void AMF_STD_CALL AddObserver(AMFSurfaceObserver* pObserver) = 0;
|
||||
virtual void AMF_STD_CALL RemoveObserver(AMFSurfaceObserver* pObserver) = 0;
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------------------------------
|
||||
// smart pointer
|
||||
//----------------------------------------------------------------------------------------------
|
||||
typedef AMFInterfacePtr_T<AMFSurface> AMFSurfacePtr;
|
||||
//----------------------------------------------------------------------------------------------
|
||||
#else // #if defined(__cplusplus)
|
||||
AMF_DECLARE_IID(AMFSurface, 0x3075dbe3, 0x8718, 0x4cfa, 0x86, 0xfb, 0x21, 0x14, 0xc0, 0xa5, 0xa4, 0x51)
|
||||
typedef struct AMFSurfaceVtbl
|
||||
{
|
||||
// AMFInterface interface
|
||||
amf_long (AMF_STD_CALL *Acquire)(AMFSurface* pThis);
|
||||
amf_long (AMF_STD_CALL *Release)(AMFSurface* pThis);
|
||||
enum AMF_RESULT (AMF_STD_CALL *QueryInterface)(AMFSurface* pThis, const struct AMFGuid *interfaceID, void** ppInterface);
|
||||
|
||||
// AMFPropertyStorage interface
|
||||
AMF_RESULT (AMF_STD_CALL *SetProperty)(AMFSurface* pThis, const wchar_t* name, AMFVariantStruct value);
|
||||
AMF_RESULT (AMF_STD_CALL *GetProperty)(AMFSurface* pThis, const wchar_t* name, AMFVariantStruct* pValue);
|
||||
amf_bool (AMF_STD_CALL *HasProperty)(AMFSurface* pThis, const wchar_t* name);
|
||||
amf_size (AMF_STD_CALL *GetPropertyCount)(AMFSurface* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *GetPropertyAt)(AMFSurface* pThis, amf_size index, wchar_t* name, amf_size nameSize, AMFVariantStruct* pValue);
|
||||
AMF_RESULT (AMF_STD_CALL *Clear)(AMFSurface* pThis);
|
||||
AMF_RESULT (AMF_STD_CALL *AddTo)(AMFSurface* pThis, AMFPropertyStorage* pDest, amf_bool overwrite, amf_bool deep);
|
||||
AMF_RESULT (AMF_STD_CALL *CopyTo)(AMFSurface* pThis, AMFPropertyStorage* pDest, amf_bool deep);
|
||||
void (AMF_STD_CALL *AddObserver)(AMFSurface* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver)(AMFSurface* pThis, AMFPropertyStorageObserver* pObserver);
|
||||
|
||||
// AMFData interface
|
||||
|
||||
AMF_MEMORY_TYPE (AMF_STD_CALL *GetMemoryType)(AMFSurface* pThis);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *Duplicate)(AMFSurface* pThis, AMF_MEMORY_TYPE type, AMFData** ppData);
|
||||
AMF_RESULT (AMF_STD_CALL *Convert)(AMFSurface* pThis, AMF_MEMORY_TYPE type); // optimal interop if possilble. Copy through host memory if needed
|
||||
AMF_RESULT (AMF_STD_CALL *Interop)(AMFSurface* pThis, AMF_MEMORY_TYPE type); // only optimal interop if possilble. No copy through host memory for GPU objects
|
||||
|
||||
AMF_DATA_TYPE (AMF_STD_CALL *GetDataType)(AMFSurface* pThis);
|
||||
|
||||
amf_bool (AMF_STD_CALL *IsReusable)(AMFSurface* pThis);
|
||||
|
||||
void (AMF_STD_CALL *SetPts)(AMFSurface* pThis, amf_pts pts);
|
||||
amf_pts (AMF_STD_CALL *GetPts)(AMFSurface* pThis);
|
||||
void (AMF_STD_CALL *SetDuration)(AMFSurface* pThis, amf_pts duration);
|
||||
amf_pts (AMF_STD_CALL *GetDuration)(AMFSurface* pThis);
|
||||
|
||||
// AMFSurface interface
|
||||
|
||||
AMF_SURFACE_FORMAT (AMF_STD_CALL *GetFormat)(AMFSurface* pThis);
|
||||
|
||||
// do not store planes outside. should be used together with Surface
|
||||
amf_size (AMF_STD_CALL *GetPlanesCount)(AMFSurface* pThis);
|
||||
AMFPlane* (AMF_STD_CALL *GetPlaneAt)(AMFSurface* pThis, amf_size index);
|
||||
AMFPlane* (AMF_STD_CALL *GetPlane)(AMFSurface* pThis, AMF_PLANE_TYPE type);
|
||||
|
||||
AMF_FRAME_TYPE (AMF_STD_CALL *GetFrameType)(AMFSurface* pThis);
|
||||
void (AMF_STD_CALL *SetFrameType)(AMFSurface* pThis, AMF_FRAME_TYPE type);
|
||||
|
||||
AMF_RESULT (AMF_STD_CALL *SetCrop)(AMFSurface* pThis, amf_int32 x,amf_int32 y, amf_int32 width, amf_int32 height);
|
||||
AMF_RESULT (AMF_STD_CALL *CopySurfaceRegion)(AMFSurface* pThis, AMFSurface* pDest, amf_int32 dstX, amf_int32 dstY, amf_int32 srcX, amf_int32 srcY, amf_int32 width, amf_int32 height);
|
||||
|
||||
|
||||
// Observer management
|
||||
void (AMF_STD_CALL *AddObserver_Surface)(AMFSurface* pThis, AMFSurfaceObserver* pObserver);
|
||||
void (AMF_STD_CALL *RemoveObserver_Surface)(AMFSurface* pThis, AMFSurfaceObserver* pObserver);
|
||||
|
||||
} AMFSurfaceVtbl;
|
||||
|
||||
struct AMFSurface
|
||||
{
|
||||
const AMFSurfaceVtbl *pVtbl;
|
||||
};
|
||||
#endif // #if defined(__cplusplus)
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
#endif //#ifndef AMF_Surface_h
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user