diff --git a/plugins/obs-qsv11/libmfx/.clang-format b/plugins/obs-qsv11/libmfx/.clang-format deleted file mode 100644 index 6420a4688..000000000 --- a/plugins/obs-qsv11/libmfx/.clang-format +++ /dev/null @@ -1,3 +0,0 @@ -Language: Cpp -SortIncludes: false -DisableFormat: true diff --git a/plugins/obs-qsv11/libmfx/include/mfx_critical_section.h b/plugins/obs-qsv11/libmfx/include/mfx_critical_section.h deleted file mode 100644 index e2e39c4b1..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_critical_section.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2012-2019 Intel Corporation -// -// 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(__MFX_CRITICAL_SECTION_H) -#define __MFX_CRITICAL_SECTION_H - -#include - -namespace MFX -{ - -// Just set "critical section" instance to zero for initialization. -typedef volatile mfxL32 mfxCriticalSection; - -// Enter the global critical section. -void mfxEnterCriticalSection(mfxCriticalSection *pCSection); - -// Leave the global critical section. -void mfxLeaveCriticalSection(mfxCriticalSection *pCSection); - -class MFXAutomaticCriticalSection -{ -public: - // Constructor - explicit MFXAutomaticCriticalSection(mfxCriticalSection *pCSection) - { - m_pCSection = pCSection; - mfxEnterCriticalSection(m_pCSection); - } - - // Destructor - ~MFXAutomaticCriticalSection() - { - mfxLeaveCriticalSection(m_pCSection); - } - -protected: - // Pointer to a critical section - mfxCriticalSection *m_pCSection; - -private: - // unimplemented by intent to make this class non-copyable - MFXAutomaticCriticalSection(const MFXAutomaticCriticalSection &); - void operator=(const MFXAutomaticCriticalSection &); -}; - -} // namespace MFX - -#endif // __MFX_CRITICAL_SECTION_H diff --git a/plugins/obs-qsv11/libmfx/include/mfx_dispatcher.h b/plugins/obs-qsv11/libmfx/include/mfx_dispatcher.h deleted file mode 100644 index 41ceb54f8..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_dispatcher.h +++ /dev/null @@ -1,232 +0,0 @@ -// Copyright (c) 2012-2020 Intel Corporation -// -// 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(__MFX_DISPATCHER_H) -#define __MFX_DISPATCHER_H - -#include -#include -#include -#include -#include "mfx_dispatcher_defs.h" -#include "mfx_load_plugin.h" -#include "mfxenc.h" -#include "mfxpak.h" - -#define INTEL_VENDOR_ID 0x8086 - -mfxStatus MFXQueryVersion(mfxSession session, mfxVersion *version); - - - -enum -{ - // to avoid code changing versions are just inherited - // from the API header file. - DEFAULT_API_VERSION_MAJOR = MFX_VERSION_MAJOR, - DEFAULT_API_VERSION_MINOR = MFX_VERSION_MINOR -}; - -// -// declare functions' integer identifiers. -// - -#undef FUNCTION -#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \ - e##func_name, - -enum eFunc -{ - eMFXInit, - eMFXClose, - eMFXQueryIMPL, - eMFXQueryVersion, - eMFXJoinSession, - eMFXDisjoinSession, - eMFXCloneSession, - eMFXSetPriority, - eMFXGetPriority, - eMFXInitEx, -#include "mfx_exposed_functions_list.h" - eVideoFuncTotal -}; - -enum ePluginFunc -{ - eMFXVideoUSER_Load, - eMFXVideoUSER_LoadByPath, - eMFXVideoUSER_UnLoad, - eMFXAudioUSER_Load, - eMFXAudioUSER_UnLoad, - ePluginFuncTotal -}; - -enum eAudioFunc -{ - eFakeAudioEnum = eMFXGetPriority, -#include "mfxaudio_exposed_functions_list.h" - eAudioFuncTotal -}; - -// declare max buffer length for regsitry key name -enum -{ - MFX_MAX_REGISTRY_KEY_NAME = 256 -}; - -// declare the maximum DLL path -enum -{ - MFX_MAX_DLL_PATH = 1024 -}; - -// declare library's implementation types -enum eMfxImplType -{ - MFX_LIB_HARDWARE = 0, - MFX_LIB_SOFTWARE = 1, - MFX_LIB_PSEUDO = 2, - - MFX_LIB_IMPL_TYPES -}; - -// declare dispatcher's version -enum -{ - MFX_DISPATCHER_VERSION_MAJOR = 1, - MFX_DISPATCHER_VERSION_MINOR = 3 -}; - -struct _mfxSession -{ - // A real handle from MFX engine passed to a called function - mfxSession session; - - mfxFunctionPointer callTable[eVideoFuncTotal]; - mfxFunctionPointer callPlugInsTable[ePluginFuncTotal]; - mfxFunctionPointer callAudioTable[eAudioFuncTotal]; - - // Current library's implementation (exact implementation) - mfxIMPL impl; -}; - -// declare a dispatcher's handle -struct MFX_DISP_HANDLE : public _mfxSession -{ - // Default constructor - MFX_DISP_HANDLE(const mfxVersion requiredVersion); - // Destructor - ~MFX_DISP_HANDLE(void); - - // Load the library's module - mfxStatus LoadSelectedDLL(const wchar_t *pPath, eMfxImplType implType, mfxIMPL impl, mfxIMPL implInterface, mfxInitParam &par); - // Unload the library's module - mfxStatus UnLoadSelectedDLL(void); - - // Close the handle - mfxStatus Close(void); - - // NOTE: changing order of struct's members can make different version of - // dispatchers incompatible. Think of different modules (e.g. MFT filters) - // within a single application. - - // Library's implementation type (hardware or software) - eMfxImplType implType; - // Current library's VIA interface - mfxIMPL implInterface; - // Dispatcher's version. If version is 1.1 or lower, then old dispatcher's - // architecture is used. Otherwise it means current dispatcher's version. - mfxVersion dispVersion; - // Required API version of session initialized - const mfxVersion apiVersion; - // Actual library API version - mfxVersion actualApiVersion; - // Status of loaded dll - mfxStatus loadStatus; - // Resgistry subkey name for windows version - wchar_t subkeyName[MFX_MAX_REGISTRY_KEY_NAME]; - // Storage ID for windows version - int storageID; - - // Library's module handle - mfxModuleHandle hModule; - - MFX::MFXPluginStorage pluginHive; - MFX::MFXPluginFactory pluginFactory; - -private: - // Declare assignment operator and copy constructor to prevent occasional assignment - MFX_DISP_HANDLE(const MFX_DISP_HANDLE &); - MFX_DISP_HANDLE & operator = (const MFX_DISP_HANDLE &); - -}; - -// This struct extends MFX_DISP_HANDLE, we cannot extend MFX_DISP_HANDLE itself due to possible compatibility issues -// This struct was added in dispatcher version 1.3 -// Check dispatcher handle's version when you cast session struct which came from outside of MSDK API function to this -struct MFX_DISP_HANDLE_EX : public MFX_DISP_HANDLE -{ - MFX_DISP_HANDLE_EX(const mfxVersion requiredVersion); - - mfxU16 mediaAdapterType; - mfxU16 reserved[10]; -}; - -// declare comparison operator -inline -bool operator == (const mfxVersion &one, const mfxVersion &two) -{ - return (one.Version == two.Version); - -} - -inline -bool operator < (const mfxVersion &one, const mfxVersion &two) -{ - return (one.Major < two.Major) || ((one.Major == two.Major) && (one.Minor < two.Minor)); - -} - -inline -bool operator <= (const mfxVersion &one, const mfxVersion &two) -{ - return (one == two) || (one < two); -} - - -// -// declare a table with functions descriptions -// - -typedef -struct FUNCTION_DESCRIPTION -{ - // Literal function's name - const char *pName; - // API version when function appeared first time - mfxVersion apiVersion; -} FUNCTION_DESCRIPTION; - -extern const -FUNCTION_DESCRIPTION APIFunc[eVideoFuncTotal]; - -extern const -FUNCTION_DESCRIPTION APIAudioFunc[eAudioFuncTotal]; -#endif // __MFX_DISPATCHER_H diff --git a/plugins/obs-qsv11/libmfx/include/mfx_dispatcher_defs.h b/plugins/obs-qsv11/libmfx/include/mfx_dispatcher_defs.h deleted file mode 100644 index 290553faf..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_dispatcher_defs.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2013-2020 Intel Corporation -// -// 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 "mfxdefs.h" -#include -#include - -#if defined(MFX_DISPATCHER_LOG) -#include -#include -#endif - -#define MAX_PLUGIN_PATH 4096 -#define MAX_PLUGIN_NAME 4096 - -#if _MSC_VER < 1400 -#define wcscpy_s(to,to_size, from) wcscpy(to, from) -#define wcscat_s(to,to_size, from) wcscat(to, from) -#endif - -// declare library module's handle -typedef void * mfxModuleHandle; - -typedef void (MFX_CDECL * mfxFunctionPointer)(void); - -// Tracer uses lib loading from Program Files logic (via Dispatch reg key) to make dispatcher load tracer dll. -// With DriverStore loading put at 1st place, dispatcher loads real lib before it finds tracer dll. -// This workaround explicitly checks tracer presence in Dispatch reg key and loads tracer dll before the search for lib in all other places. -#define MFX_TRACER_WA_FOR_DS 1 diff --git a/plugins/obs-qsv11/libmfx/include/mfx_dispatcher_log.h b/plugins/obs-qsv11/libmfx/include/mfx_dispatcher_log.h deleted file mode 100644 index a95897295..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_dispatcher_log.h +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright (c) 2012-2020 Intel Corporation -// -// 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(__MFX_DISPATCHER_LOG_H) -#define __MFX_DISPATCHER_LOG_H - -////////////////////////////////////////////////////////////////////////// -//dispatcher log (DL) level -#define DL_INFO 1 -#define DL_WRN 2 -#define DL_ERROR 4 -#define DL_LOADED_LIBRARY 8 -////////////////////////////////////////////////////////////////////////// -//opcodes used only in events -enum -{ - DL_EVENT_START = 1, - DL_EVENT_STOP, - DL_EVENT_MSG -}; -////////////////////////////////////////////////////////////////////////// -#define DL_SINK_NULL 0 -#define DL_SINK_PRINTF 1 -#define DL_SINK_IMsgHandler 2 - -#define MFXFOURCCTYPE() "%c%c%c%c" -#define ZERO_OR_SPACE(value) ((0==(value)) ? '0' : (value)) -#define MFXU32TOFOURCC(mfxu32)\ - ZERO_OR_SPACE((char)(mfxu32 & 0xFF)), \ - ZERO_OR_SPACE((char)((mfxu32 >> 8) & 0xFF)),\ - ZERO_OR_SPACE((char)((mfxu32 >> 16) & 0xFF)),\ - ZERO_OR_SPACE((char)((mfxu32 >> 24) & 0xFF)) - -#define MFXGUIDTYPE() "%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X" - -#define MFXGUIDTOHEX(guid)\ - (guid)->Data[0],\ - (guid)->Data[1],\ - (guid)->Data[2],\ - (guid)->Data[3],\ - (guid)->Data[4],\ - (guid)->Data[5],\ - (guid)->Data[6],\ - (guid)->Data[7],\ - (guid)->Data[8],\ - (guid)->Data[9],\ - (guid)->Data[10],\ - (guid)->Data[11],\ - (guid)->Data[12],\ - (guid)->Data[13],\ - (guid)->Data[14],\ - (guid)->Data[15] - -#if defined(MFX_DISPATCHER_LOG) - -//---------------------------setup section------------------------ -//using of formating instead of variadic macro with NULL end, -//leads to more flexibility in format, however constructing string -//with vsprintf_s is a time wasting -#define DISPATCHER_LOG_USE_FORMATING 1 - -//creates unique object, event guid registration, factories on heap -//heap reduce stack allocation and reduce reservation time at startup -//is a vital if mediasdk wont use -#define DISPATCHER_LOG_HEAP_SINGLETONES - -// guid for all dispatcher events -#define DISPATCHER_LOG_EVENT_GUID L"{EB0538CC-4FEE-484d-ACEE-1182E9F37A57}" - -//puts a sink into listeners list -//#define DISPATCHER_LOG_REGISTER_EVENT_PROVIDER - -//puts a sink into listeners list -//#define DISPATCHER_LOG_REGISTER_FILE_WRITER -#define DISPACTHER_LOG_FW_PATH "c:\\dispatcher.log" - -#include -#include - -//callback interface for intercept logging messages -class IMsgHandler -{ -public: - virtual ~IMsgHandler(){} - virtual void Write(int level, int opcode, const char * msg, va_list argptr) = 0; -}; - -#if DISPATCHER_LOG_USE_FORMATING - - #define DISPATCHER_LOG(lvl, opcode, str)\ - {\ - DispatcherLogBracketsHelper wrt(lvl,opcode);\ - wrt.Write str;\ - } -#else - #define DISPATCHER_LOG_VA_ARGS(...) wrt.Write(__VA_ARGS__, NULL) - //WARNING: don't use types that occupy more that 4 bytes in memory - //WARNING: don't use %s in format specifier - #define DISPATCHER_LOG(lvl, opcode, str) \ - {\ - DispatcherLogBracketsHelper wrt(lvl, opcode);\ - DISPATCHER_LOG_VA_ARGS str;\ - } -#endif//DISPATCHER_LOG_USE_FORMATING - -#define DISPATCHER_LOG_OPERATION(operation) operation - -#define __name_from_line( name, line ) name ## line -#define _name_from_line( name , line) __name_from_line( name, line ) -#define name_from_line( name ) _name_from_line( name, __LINE__) - - -#define DISPATCHER_LOG_AUTO(lvl, msg)\ - DispatchLogBlockHelper name_from_line(__auto_log_)(lvl); name_from_line(__auto_log_).Write msg; - -#include -#include -#include -#include - -template -class DSSingleTone -{ -public: - template - inline static T & get(TParam1 par1) - { - T * pstored; - if (NULL == (pstored = store_or_load())) - { - return *store_or_load(new T(par1)); - } - return *pstored; - } - - inline static T & get() - { - T * pstored; - if (NULL == (pstored = store_or_load())) - { - return *store_or_load(new T()); - } - return *pstored; - } -private: - //if obj == NULL, then it load - //if obj != NULL then it store obj - inline static T * store_or_load(T * obj = NULL) - { - static std::unique_ptr instance; - if (NULL != obj) - { - instance.reset(obj); - } - return instance.get(); - } -}; - -class DispatchLog - : public DSSingleTone -{ - friend class DSSingleTone; - std::listm_Recepients; - int m_DispatcherLogSink; - -public: - //sets current sink - void SetSink(int nsink, IMsgHandler *pHandler); - void AttachSink(int nsink, IMsgHandler *pHandler); - void DetachSink(int nsink, IMsgHandler *pHandler); - void ExchangeSink(int nsink, IMsgHandler *pOld, IMsgHandler *pNew); - void DetachAllSinks(); - void Write(int level, int opcode, const char * msg, va_list argptr); - -protected: - DispatchLog(); -}; - -//allows to push arguments on the stack without declaring them as function parameters -struct DispatcherLogBracketsHelper -{ - int m_level; - int m_opcode; - DispatcherLogBracketsHelper(int level, int opcode) - :m_level(level) - ,m_opcode(opcode) - { - } - void Write(const char * str, ...); -} ; - -//auto log on ctor dtor -struct DispatchLogBlockHelper -{ - int m_level; - void Write(const char * str, ...); - DispatchLogBlockHelper (int level) - : m_level(level) - { - } - ~DispatchLogBlockHelper(); -}; - -//----utility sinks----- -#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER) -class ETWHandlerFactory - : public DSSingleTone -{ - friend class DSSingleTone; - typedef std::map _storage_type; - _storage_type m_storage; - -public: - ~ETWHandlerFactory(); - IMsgHandler *GetSink(const wchar_t* sguid = DISPATCHER_LOG_EVENT_GUID); - -protected: - ETWHandlerFactory(){} -}; -#endif - -#if defined(DISPATCHER_LOG_REGISTER_FILE_WRITER) -class FileSink - : public DSSingleTone - , public IMsgHandler -{ - friend class DSSingleTone; -public: - virtual void Write(int level, int opcode, const char * msg, va_list argptr); - FileSink() - : m_hdl(NULL) - { - } - ~FileSink() - { - if (NULL != m_hdl) - fclose(m_hdl); - } -private: - FILE * m_hdl; - FileSink(const std::string & log_file) - { - fopen_s(&m_hdl, log_file.c_str(), "a"); - } - -}; -#endif - -//-----utility functions -//since they are not called outside of macro we can define them here -std::string DispatcherLog_GetMFXImplString(int impl); -const char *DispatcherLog_GetMFXStatusString(int sts); - -#else // !defined(MFX_DISPATCHER_LOG) - - #define DISPATCHER_LOG(level, opcode, message) - #define DISPATCHER_LOG_AUTO(level, message) - #define DISPATCHER_LOG_OPERATION(operation) - -#endif// !defined(MFX_DISPATCHER_LOG) - - -#define DISPATCHER_LOG_INFO(msg) DISPATCHER_LOG(DL_INFO, DL_EVENT_MSG, msg) -#define DISPATCHER_LOG_WRN(msg) DISPATCHER_LOG(DL_WRN, DL_EVENT_MSG, msg) -#define DISPATCHER_LOG_ERROR(msg) DISPATCHER_LOG(DL_ERROR, DL_EVENT_MSG, msg) -#define DISPATCHER_LOG_LIBRARY(msg) DISPATCHER_LOG(DL_LOADED_LIBRARY, DL_EVENT_MSG, msg) -#define DISPATCHER_LOG_BLOCK(msg) DISPATCHER_LOG_AUTO(DL_INFO, msg) - -#endif // !defined(__MFX_DISPATCHER_LOG_H) diff --git a/plugins/obs-qsv11/libmfx/include/mfx_driver_store_loader.h b/plugins/obs-qsv11/libmfx/include/mfx_driver_store_loader.h deleted file mode 100644 index 87eb1be85..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_driver_store_loader.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2019-2020 Intel Corporation -// -// 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(__MFX_DRIVER_STORE_LOADER_H) -#define __MFX_DRIVER_STORE_LOADER_H - -#include -#include -#include - -#include "mfx_dispatcher_defs.h" - -namespace MFX -{ - -typedef CONFIGRET(WINAPI *Func_CM_Get_Device_ID_List_SizeW)(PULONG pulLen, PCWSTR pszFilter, ULONG ulFlags); -typedef CONFIGRET(WINAPI *Func_CM_Get_Device_ID_ListW)(PCWSTR pszFilter, PZZWSTR Buffer, ULONG BufferLen, ULONG ulFlags); -typedef CONFIGRET(WINAPI *Func_CM_Locate_DevNodeW)(PDEVINST pdnDevInst, DEVINSTID_W pDeviceID, ULONG ulFlags); -typedef CONFIGRET(WINAPI *Func_CM_Open_DevNode_Key)(DEVINST dnDevNode, REGSAM samDesired, ULONG ulHardwareProfile, REGDISPOSITION Disposition, PHKEY phkDevice, ULONG ulFlags); - -class DriverStoreLoader -{ -public: - DriverStoreLoader(void); - ~DriverStoreLoader(void); - - bool GetDriverStorePath(wchar_t *path, DWORD dwPathSize, mfxU32 deviceID); - -protected: - bool LoadCfgMgr(); - bool LoadCmFuncs(); - - mfxModuleHandle m_moduleCfgMgr; - Func_CM_Get_Device_ID_List_SizeW m_pCM_Get_Device_ID_List_Size; - Func_CM_Get_Device_ID_ListW m_pCM_Get_Device_ID_List; - Func_CM_Locate_DevNodeW m_pCM_Locate_DevNode; - Func_CM_Open_DevNode_Key m_pCM_Open_DevNode_Key; - -private: - // unimplemented by intent to make this class non-copyable - DriverStoreLoader(const DriverStoreLoader &); - void operator=(const DriverStoreLoader &); - -}; - -} // namespace MFX - -#endif // __MFX_DRIVER_STORE_LOADER_H diff --git a/plugins/obs-qsv11/libmfx/include/mfx_dxva2_device.h b/plugins/obs-qsv11/libmfx/include/mfx_dxva2_device.h deleted file mode 100644 index eadef56c9..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_dxva2_device.h +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) 2012-2019 Intel Corporation -// -// 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(__MFX_DXVA2_DEVICE_H) -#define __MFX_DXVA2_DEVICE_H - -#include - -#define TOSTRING(L) #L -#define STRINGIFY(L) TOSTRING(L) - -#if defined(MEDIASDK_UWP_DISPATCHER) - #if defined(MFX_D3D9_ENABLED) && !defined(MFX_FORCE_D3D9_ENABLED) - #undef MFX_D3D9_ENABLED - #pragma message("\n\nATTENTION:\nin file\n\t" __FILE__ " (" STRINGIFY(__LINE__) "):\nUsing of D3D9 disabled for UWP!\n\n") - #endif - #if defined(MFX_FORCE_D3D9_ENABLED) - #define MFX_D3D9_ENABLED - #endif -#else - #define MFX_D3D9_ENABLED - #pragma message("\n\nATTENTION:\nin file\n\t" __FILE__ " (" STRINGIFY(__LINE__) "):\nUsing of D3D9 enabled!\n\n") -#endif - -#include - -#ifdef DXVA2DEVICE_LOG -#include -#define DXVA2DEVICE_TRACE(expr) printf expr; -#define DXVA2DEVICE_TRACE_OPERATION(expr) expr; -#else -#define DXVA2DEVICE_TRACE(expr) -#define DXVA2DEVICE_TRACE_OPERATION(expr) -#endif - -namespace MFX -{ - -class DXDevice -{ -public: - // Default constructor - DXDevice(void); - // Destructor - virtual - ~DXDevice(void) = 0; - - // Initialize device using DXGI 1.1 or VAAPI interface - virtual - bool Init(const mfxU32 adapterNum) = 0; - - // Obtain graphic card's parameter - mfxU32 GetVendorID(void) const; - mfxU32 GetDeviceID(void) const; - mfxU64 GetDriverVersion(void) const; - mfxU64 GetLUID(void) const; - - // Provide the number of available adapters - mfxU32 GetAdapterCount(void) const; - - // Close the object - virtual - void Close(void); - - // Load the required DLL module - void LoadDLLModule(const wchar_t *pModuleName); - -protected: - - // Free DLL module - void UnloadDLLModule(void); - - // Handle to the DLL library - HMODULE m_hModule; - - // Number of adapters available - mfxU32 m_numAdapters; - - // Vendor ID - mfxU32 m_vendorID; - // Device ID - mfxU32 m_deviceID; - // x.x.x.x each x of two bytes - mfxU64 m_driverVersion; - // LUID - mfxU64 m_luid; - -private: - // unimplemented by intent to make this class and its descendants non-copyable - DXDevice(const DXDevice &); - void operator=(const DXDevice &); -}; - -#ifdef MFX_D3D9_ENABLED -class D3D9Device : public DXDevice -{ -public: - // Default constructor - D3D9Device(void); - // Destructor - virtual - ~D3D9Device(void); - - // Initialize device using D3D v9 interface - virtual - bool Init(const mfxU32 adapterNum); - - // Close the object - virtual - void Close(void); - -protected: - - // Pointer to the D3D v9 interface - void *m_pD3D9; - // Pointer to the D3D v9 extended interface - void *m_pD3D9Ex; - -}; -#endif // MFX_D3D9_ENABLED - -class DXGI1Device : public DXDevice -{ -public: - // Default constructor - DXGI1Device(void); - // Destructor - virtual - ~DXGI1Device(void); - - // Initialize device - virtual - bool Init(const mfxU32 adapterNum); - - // Close the object - virtual - void Close(void); - -protected: - - // Pointer to the DXGI1 factory - void *m_pDXGIFactory1; - // Pointer to the current DXGI1 adapter - void *m_pDXGIAdapter1; - -}; - -class DXVA2Device -{ -public: - // Default constructor - DXVA2Device(void); - // Destructor - ~DXVA2Device(void); - - // Initialize device using D3D v9 interface - bool InitD3D9(const mfxU32 adapterNum); - - // Initialize device using DXGI 1.1 interface - bool InitDXGI1(const mfxU32 adapterNum); - - // Obtain graphic card's parameter - mfxU32 GetVendorID(void) const; - mfxU32 GetDeviceID(void) const; - mfxU64 GetDriverVersion(void) const; - - // Provide the number of available adapters - mfxU32 GetAdapterCount(void) const; - - void Close(void); - -protected: - -#ifdef MFX_D3D9_ENABLED - // Get vendor & device IDs by alternative way (D3D9 in Remote Desktop sessions) - void UseAlternativeWay(const D3D9Device *pD3D9Device); -#endif // MFX_D3D9_ENABLED - // Number of adapters available - mfxU32 m_numAdapters; - - // Vendor ID - mfxU32 m_vendorID; - // Device ID - mfxU32 m_deviceID; - //x.x.x.x - mfxU64 m_driverVersion; - -private: - // unimplemented by intent to make this class non-copyable - DXVA2Device(const DXVA2Device &); - void operator=(const DXVA2Device &); -}; - -} // namespace MFX - -#endif // __MFX_DXVA2_DEVICE_H diff --git a/plugins/obs-qsv11/libmfx/include/mfx_exposed_functions_list.h b/plugins/obs-qsv11/libmfx/include/mfx_exposed_functions_list.h deleted file mode 100644 index 18934ee2c..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_exposed_functions_list.h +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) 2012-2019 Intel Corporation -// -// 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. - -// -// WARNING: -// this file doesn't contain an include guard by intension. -// The file may be included into a source file many times. -// That is why this header doesn't contain any include directive. -// Please, do no try to fix it. -// - - - -// Use define API_VERSION to set the API of functions listed further -// When new functions are added new section with functions declarations must be started with updated define - -// -// API version 1.0 functions -// - -// API version where a function is added. Minor value should precedes the major value -#define API_VERSION {{0, 1}} - -// CORE interface functions -FUNCTION(mfxStatus, MFXVideoCORE_SetBufferAllocator, (mfxSession session, mfxBufferAllocator *allocator), (session, allocator)) -FUNCTION(mfxStatus, MFXVideoCORE_SetFrameAllocator, (mfxSession session, mfxFrameAllocator *allocator), (session, allocator)) -FUNCTION(mfxStatus, MFXVideoCORE_SetHandle, (mfxSession session, mfxHandleType type, mfxHDL hdl), (session, type, hdl)) -FUNCTION(mfxStatus, MFXVideoCORE_GetHandle, (mfxSession session, mfxHandleType type, mfxHDL *hdl), (session, type, hdl)) - -FUNCTION(mfxStatus, MFXVideoCORE_SyncOperation, (mfxSession session, mfxSyncPoint syncp, mfxU32 wait), (session, syncp, wait)) - -// ENCODE interface functions -FUNCTION(mfxStatus, MFXVideoENCODE_Query, (mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session, in, out)) -FUNCTION(mfxStatus, MFXVideoENCODE_QueryIOSurf, (mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session, par, request)) -FUNCTION(mfxStatus, MFXVideoENCODE_Init, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoENCODE_Reset, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoENCODE_Close, (mfxSession session), (session)) - -FUNCTION(mfxStatus, MFXVideoENCODE_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoENCODE_GetEncodeStat, (mfxSession session, mfxEncodeStat *stat), (session, stat)) -FUNCTION(mfxStatus, MFXVideoENCODE_EncodeFrameAsync, (mfxSession session, mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxSyncPoint *syncp), (session, ctrl, surface, bs, syncp)) - -// DECODE interface functions -FUNCTION(mfxStatus, MFXVideoDECODE_Query, (mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session, in, out)) -FUNCTION(mfxStatus, MFXVideoDECODE_DecodeHeader, (mfxSession session, mfxBitstream *bs, mfxVideoParam *par), (session, bs, par)) -FUNCTION(mfxStatus, MFXVideoDECODE_QueryIOSurf, (mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session, par, request)) -FUNCTION(mfxStatus, MFXVideoDECODE_Init, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoDECODE_Reset, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoDECODE_Close, (mfxSession session), (session)) - -FUNCTION(mfxStatus, MFXVideoDECODE_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoDECODE_GetDecodeStat, (mfxSession session, mfxDecodeStat *stat), (session, stat)) -FUNCTION(mfxStatus, MFXVideoDECODE_SetSkipMode, (mfxSession session, mfxSkipMode mode), (session, mode)) -FUNCTION(mfxStatus, MFXVideoDECODE_GetPayload, (mfxSession session, mfxU64 *ts, mfxPayload *payload), (session, ts, payload)) -FUNCTION(mfxStatus, MFXVideoDECODE_DecodeFrameAsync, (mfxSession session, mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxSyncPoint *syncp), (session, bs, surface_work, surface_out, syncp)) - -// VPP interface functions -FUNCTION(mfxStatus, MFXVideoVPP_Query, (mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session, in, out)) -FUNCTION(mfxStatus, MFXVideoVPP_QueryIOSurf, (mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session, par, request)) -FUNCTION(mfxStatus, MFXVideoVPP_Init, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoVPP_Reset, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoVPP_Close, (mfxSession session), (session)) - -FUNCTION(mfxStatus, MFXVideoVPP_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoVPP_GetVPPStat, (mfxSession session, mfxVPPStat *stat), (session, stat)) -FUNCTION(mfxStatus, MFXVideoVPP_RunFrameVPPAsync, (mfxSession session, mfxFrameSurface1 *in, mfxFrameSurface1 *out, mfxExtVppAuxData *aux, mfxSyncPoint *syncp), (session, in, out, aux, syncp)) - -#undef API_VERSION - -// -// API version 1.1 functions -// - -#define API_VERSION {{1, 1}} - -FUNCTION(mfxStatus, MFXVideoUSER_Register, (mfxSession session, mfxU32 type, const mfxPlugin *par), (session, type, par)) -FUNCTION(mfxStatus, MFXVideoUSER_Unregister, (mfxSession session, mfxU32 type), (session, type)) -FUNCTION(mfxStatus, MFXVideoUSER_ProcessFrameAsync, (mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp), (session, in, in_num, out, out_num, syncp)) - -#undef API_VERSION - -// -// API version 1.10 functions -// - -#define API_VERSION {{10, 1}} - -FUNCTION(mfxStatus, MFXVideoENC_Query,(mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session,in,out)) -FUNCTION(mfxStatus, MFXVideoENC_QueryIOSurf,(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session,par,request)) -FUNCTION(mfxStatus, MFXVideoENC_Init,(mfxSession session, mfxVideoParam *par), (session,par)) -FUNCTION(mfxStatus, MFXVideoENC_Reset,(mfxSession session, mfxVideoParam *par), (session,par)) -FUNCTION(mfxStatus, MFXVideoENC_Close,(mfxSession session),(session)) -FUNCTION(mfxStatus, MFXVideoENC_ProcessFrameAsync,(mfxSession session, mfxENCInput *in, mfxENCOutput *out, mfxSyncPoint *syncp),(session,in,out,syncp)) - -FUNCTION(mfxStatus, MFXVideoVPP_RunFrameVPPAsyncEx, (mfxSession session, mfxFrameSurface1 *in, mfxFrameSurface1 *work, mfxFrameSurface1 **out, mfxSyncPoint *syncp), (session, in, work, out, syncp)) - -#undef API_VERSION - -#define API_VERSION {{13, 1}} - -FUNCTION(mfxStatus, MFXVideoPAK_Query, (mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session, in, out)) -FUNCTION(mfxStatus, MFXVideoPAK_QueryIOSurf, (mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session, par, request)) -FUNCTION(mfxStatus, MFXVideoPAK_Init, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoPAK_Reset, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoPAK_Close, (mfxSession session), (session)) -FUNCTION(mfxStatus, MFXVideoPAK_ProcessFrameAsync, (mfxSession session, mfxPAKInput *in, mfxPAKOutput *out, mfxSyncPoint *syncp), (session, in, out, syncp)) - -#undef API_VERSION - -#define API_VERSION {{14, 1}} - -// FUNCTION(mfxStatus, MFXInitEx, (mfxInitParam par, mfxSession session), (par, session)) -FUNCTION(mfxStatus, MFXDoWork, (mfxSession session), (session)) - -#undef API_VERSION - -#define API_VERSION {{19, 1}} - -FUNCTION(mfxStatus, MFXVideoENC_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoPAK_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par)) -FUNCTION(mfxStatus, MFXVideoCORE_QueryPlatform, (mfxSession session, mfxPlatform* platform), (session, platform)) -FUNCTION(mfxStatus, MFXVideoUSER_GetPlugin, (mfxSession session, mfxU32 type, mfxPlugin *par), (session, type, par)) - -#undef API_VERSION \ No newline at end of file diff --git a/plugins/obs-qsv11/libmfx/include/mfx_library_iterator.h b/plugins/obs-qsv11/libmfx/include/mfx_library_iterator.h deleted file mode 100644 index 21210965e..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_library_iterator.h +++ /dev/null @@ -1,134 +0,0 @@ -// Copyright (c) 2012-2020 Intel Corporation -// -// 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(__MFX_LIBRARY_ITERATOR_H) -#define __MFX_LIBRARY_ITERATOR_H - - -#include - -#if !defined(MEDIASDK_UWP_DISPATCHER) -#include "mfx_win_reg_key.h" -#endif - -#include "mfx_driver_store_loader.h" - -#include "mfx_dispatcher.h" - -namespace MFX -{ - -// declare desired storage ID -enum -{ -#if defined (MFX_TRACER_WA_FOR_DS) - MFX_UNKNOWN_KEY = -1, - MFX_TRACER = 0, - MFX_DRIVER_STORE = 1, - MFX_CURRENT_USER_KEY = 2, - MFX_LOCAL_MACHINE_KEY = 3, - MFX_APP_FOLDER = 4, - MFX_PATH_MSDK_FOLDER = 5, - MFX_STORAGE_ID_FIRST = MFX_TRACER, - MFX_STORAGE_ID_LAST = MFX_PATH_MSDK_FOLDER -#else - MFX_UNKNOWN_KEY = -1, - MFX_DRIVER_STORE = 0, - MFX_CURRENT_USER_KEY = 1, - MFX_LOCAL_MACHINE_KEY = 2, - MFX_APP_FOLDER = 3, - MFX_PATH_MSDK_FOLDER = 4, - MFX_STORAGE_ID_FIRST = MFX_DRIVER_STORE, - MFX_STORAGE_ID_LAST = MFX_PATH_MSDK_FOLDER -#endif -}; - -// Try to initialize using given implementation type. Select appropriate type automatically in case of MFX_IMPL_VIA_ANY. -// Params: adapterNum - in, pImplInterface - in/out, pVendorID - out, pDeviceID - out -mfxStatus SelectImplementationType(const mfxU32 adapterNum, mfxIMPL *pImplInterface, mfxU32 *pVendorID, mfxU32 *pDeviceID); - -const mfxU32 msdk_disp_path_len = 1024; - -class MFXLibraryIterator -{ -public: - // Default constructor - MFXLibraryIterator(void); - // Destructor - ~MFXLibraryIterator(void); - - // Initialize the iterator - mfxStatus Init(eMfxImplType implType, mfxIMPL implInterface, const mfxU32 adapterNum, int storageID); - - // Get the next library path - mfxStatus SelectDLLVersion(wchar_t *pPath, size_t pathSize, - eMfxImplType *pImplType, mfxVersion minVersion); - - // Return interface type on which Intel adapter was found (if any): D3D9 or D3D11 - mfxIMPL GetImplementationType(); - - // Retrun registry subkey name on which dll was selected after sucesfull call to selectDllVesion - bool GetSubKeyName(wchar_t *subKeyName, size_t length) const; - - int GetStorageID() const { return m_StorageID; } -protected: - - // Release the iterator - void Release(void); - - // Initialize the registry iterator - mfxStatus InitRegistry(int storageID); -#if defined(MFX_TRACER_WA_FOR_DS) - // Initialize the registry iterator for searching for tracer - mfxStatus InitRegistryTracer(); -#endif - // Initialize the app/module folder iterator - mfxStatus InitFolder(eMfxImplType implType, const wchar_t * path, const int storageID); - - - eMfxImplType m_implType; // Required library implementation - mfxIMPL m_implInterface; // Required interface (D3D9, D3D11) - - mfxU32 m_vendorID; // (mfxU32) property of used graphic card - mfxU32 m_deviceID; // (mfxU32) property of used graphic card - bool m_bIsSubKeyValid; - wchar_t m_SubKeyName[MFX_MAX_REGISTRY_KEY_NAME]; // registry subkey for selected module loaded - int m_StorageID; - -#if !defined(MEDIASDK_UWP_DISPATCHER) - WinRegKey m_baseRegKey; // (WinRegKey) main registry key -#endif - - mfxU32 m_lastLibIndex; // (mfxU32) index of previously returned library - mfxU32 m_lastLibMerit; // (mfxU32) merit of previously returned library - - wchar_t m_path[msdk_disp_path_len]; - - DriverStoreLoader m_driverStoreLoader; // for loading MediaSDK from DriverStore - -private: - // unimplemented by intent to make this class non-copyable - MFXLibraryIterator(const MFXLibraryIterator &); - void operator=(const MFXLibraryIterator &); -}; - -} // namespace MFX - -#endif // __MFX_LIBRARY_ITERATOR_H diff --git a/plugins/obs-qsv11/libmfx/include/mfx_load_dll.h b/plugins/obs-qsv11/libmfx/include/mfx_load_dll.h deleted file mode 100644 index 7348af71a..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_load_dll.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2012-2019 Intel Corporation -// -// 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(__MFX_LOAD_DLL_H) -#define __MFX_LOAD_DLL_H - -#include "mfx_dispatcher.h" - -namespace MFX -{ - - - // - // declare DLL loading routines - // - - mfxStatus mfx_get_rt_dll_name(wchar_t *pPath, size_t pathSize); - mfxStatus mfx_get_default_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType); - mfxStatus mfx_get_default_plugin_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType); -#if defined(MEDIASDK_UWP_DISPATCHER) - mfxStatus mfx_get_default_intel_gfx_api_dll_name(wchar_t *pPath, size_t pathSize); -#endif - - mfxStatus mfx_get_default_audio_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType); - - - mfxModuleHandle mfx_dll_load(const wchar_t *file_name); - //increments reference counter - mfxModuleHandle mfx_get_dll_handle(const wchar_t *file_name); - mfxFunctionPointer mfx_dll_get_addr(mfxModuleHandle handle, const char *func_name); - bool mfx_dll_free(mfxModuleHandle handle); - -} // namespace MFX - -#endif // __MFX_LOAD_DLL_H diff --git a/plugins/obs-qsv11/libmfx/include/mfx_load_plugin.h b/plugins/obs-qsv11/libmfx/include/mfx_load_plugin.h deleted file mode 100644 index e36ac7f49..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_load_plugin.h +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) 2013-2019 Intel Corporation -// -// 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 "mfxplugin.h" -#include "mfx_dispatcher_defs.h" -#include "mfx_plugin_hive.h" - -namespace MFX -{ - typedef mfxStatus (MFX_CDECL *CreatePluginPtr_t)(mfxPluginUID uid, mfxPlugin* plugin); - - class PluginModule - { - mfxModuleHandle mHmodule; - CreatePluginPtr_t mCreatePluginPtr; - wchar_t mPath[MAX_PLUGIN_PATH]; - - public: - PluginModule(); - PluginModule(const wchar_t * path); - PluginModule(const PluginModule & that) ; - PluginModule & operator = (const PluginModule & that); - bool Create(mfxPluginUID guid, mfxPlugin&); - ~PluginModule(void); - - private: - void Tidy(); - }; - - class MFXPluginFactory { - struct FactoryRecord { - mfxPluginParam plgParams; - PluginModule module; - mfxPlugin plugin; - FactoryRecord () - : plgParams(), plugin() - {} - FactoryRecord(const mfxPluginParam &plgParams, - PluginModule &module, - mfxPlugin plugin) - : plgParams(plgParams) - , module(module) - , plugin(plugin) { - } - }; - MFXVector mPlugins; - mfxU32 nPlugins; - mfxSession mSession; - public: - MFXPluginFactory(mfxSession session); - void Close(); - mfxStatus Create(const PluginDescriptionRecord &); - bool Destroy(const mfxPluginUID &); - - ~MFXPluginFactory(); - protected: - void DestroyPlugin( FactoryRecord & ); - static bool RunVerification( const mfxPlugin & plg, const PluginDescriptionRecord &dsc, mfxPluginParam &pluginParams ); - static bool VerifyEncoder( const mfxVideoCodecPlugin &videoCodec ); - static bool VerifyAudioEncoder( const mfxAudioCodecPlugin &audioCodec ); - static bool VerifyEnc( const mfxVideoCodecPlugin &videoEnc ); - static bool VerifyVpp( const mfxVideoCodecPlugin &videoCodec ); - static bool VerifyDecoder( const mfxVideoCodecPlugin &videoCodec ); - static bool VerifyAudioDecoder( const mfxAudioCodecPlugin &audioCodec ); - static bool VerifyCodecCommon( const mfxVideoCodecPlugin & Video ); - }; -} diff --git a/plugins/obs-qsv11/libmfx/include/mfx_plugin_hive.h b/plugins/obs-qsv11/libmfx/include/mfx_plugin_hive.h deleted file mode 100644 index 9a304c9e1..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_plugin_hive.h +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2013-2019 Intel Corporation -// -// 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 "mfx_dispatcher_defs.h" -#include "mfxplugin.h" -#include "mfx_win_reg_key.h" -#include "mfx_vector.h" -#include -#include -#include - -struct MFX_DISP_HANDLE; - -namespace MFX { - - inline bool operator == (const mfxPluginUID &lhs, const mfxPluginUID & rhs) - { - return !memcmp(lhs.Data, rhs.Data, sizeof(mfxPluginUID)); - } - - inline bool operator != (const mfxPluginUID &lhs, const mfxPluginUID & rhs) - { - return !(lhs == rhs); - } -#ifdef _WIN32 - //warning C4351: new behavior: elements of array 'MFX::PluginDescriptionRecord::sName' will be default initialized - #pragma warning (disable: 4351) -#endif - class PluginDescriptionRecord : public mfxPluginParam - { - public: - wchar_t sPath[MAX_PLUGIN_PATH]; - char sName[MAX_PLUGIN_NAME]; - //used for FS plugins that has poor description - bool onlyVersionRegistered; - bool Default; - PluginDescriptionRecord() - : mfxPluginParam() - , sPath() - , sName() - , onlyVersionRegistered() - , Default() - { - } - }; - - typedef MFXVector MFXPluginStorage; - - class MFXPluginStorageBase : public MFXPluginStorage - { - protected: - mfxVersion mCurrentAPIVersion; - protected: - MFXPluginStorageBase(mfxVersion currentAPIVersion) - : mCurrentAPIVersion(currentAPIVersion) - { - } - void ConvertAPIVersion( mfxU32 APIVersion, PluginDescriptionRecord &descriptionRecord) const - { - descriptionRecord.APIVersion.Minor = static_cast (APIVersion & 0x0ff); - descriptionRecord.APIVersion.Major = static_cast (APIVersion >> 8); - } - }; - -#if !defined(MEDIASDK_UWP_DISPATCHER) - - //populated from registry - class MFXPluginsInHive : public MFXPluginStorageBase - { - public: - MFXPluginsInHive(int mfxStorageID, const wchar_t *msdkLibSubKey, mfxVersion currentAPIVersion); - }; - - //plugins are loaded from FS close to executable - class MFXPluginsInFS : public MFXPluginStorageBase - { - bool mIsVersionParsed; - bool mIsAPIVersionParsed; - public: - MFXPluginsInFS(mfxVersion currentAPIVersion); - private: - bool ParseFile(FILE * f, PluginDescriptionRecord & des); - bool ParseKVPair( wchar_t *key, wchar_t * value, PluginDescriptionRecord & des); - }; - -#endif //#if !defined(MEDIASDK_UWP_DISPATCHER) - - //plugins are loaded from FS close to Runtime library - class MFXDefaultPlugins : public MFXPluginStorageBase - { - public: - MFXDefaultPlugins(mfxVersion currentAPIVersion, MFX_DISP_HANDLE * hdl, int implType); - private: - }; - -} diff --git a/plugins/obs-qsv11/libmfx/include/mfx_vector.h b/plugins/obs-qsv11/libmfx/include/mfx_vector.h deleted file mode 100644 index dbe984486..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfx_vector.h +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) 2013-2019 Intel Corporation -// -// 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 "mfxstructures.h" -#include - -namespace MFX -{ - template - class iterator_tmpl - { - template friend class MFXVector; - mfxU32 mIndex; - T* mRecords; - iterator_tmpl(mfxU32 index , T * records) - : mIndex (index) - , mRecords(records) - {} - public: - iterator_tmpl() - : mIndex () - , mRecords() - {} - bool operator ==(const iterator_tmpl & that )const - { - return mIndex == that.mIndex; - } - bool operator !=(const iterator_tmpl & that )const - { - return mIndex != that.mIndex; - } - mfxU32 operator - (const iterator_tmpl &that) const - { - return mIndex - that.mIndex; - } - iterator_tmpl & operator ++() - { - mIndex++; - return * this; - } - iterator_tmpl & operator ++(int) - { - mIndex++; - return * this; - } - T & operator *() - { - return mRecords[mIndex]; - } - T * operator ->() - { - return mRecords + mIndex; - } - }; - - class MFXVectorRangeError : public std::exception - { - }; - - template - class MFXVector - { - T* mRecords; - mfxU32 mNrecords; - public: - MFXVector() - : mRecords() - , mNrecords() - {} - MFXVector(const MFXVector & rhs) - : mRecords() - , mNrecords() - { - insert(end(), rhs.begin(), rhs.end()); - } - MFXVector & operator = (const MFXVector & rhs) - { - if (this != &rhs) - { - clear(); - insert(end(), rhs.begin(), rhs.end()); - } - return *this; - } - virtual ~MFXVector () - { - clear(); - } - typedef iterator_tmpl iterator; - - iterator begin() const - { - return iterator(0u, mRecords); - } - iterator end() const - { - return iterator(mNrecords, mRecords); - } - void insert(iterator where, iterator beg_iter, iterator end_iter) - { - mfxU32 elementsToInsert = (end_iter - beg_iter); - if (!elementsToInsert) - { - return; - } - if (where.mIndex > mNrecords) - { - throw MFXVectorRangeError(); - } - - T *newRecords = new T[mNrecords + elementsToInsert](); - mfxU32 i = 0; - - // save left - for (; i < where.mIndex; i++) - { - newRecords[i] = mRecords[i]; - } - // insert - for (; beg_iter != end_iter; beg_iter++, i++) - { - newRecords[i] = *beg_iter; - } - - //save right - for (; i < mNrecords + elementsToInsert; i++) - { - newRecords[i] = mRecords[i - elementsToInsert]; - } - - delete [] mRecords; - - mRecords = newRecords; - mNrecords = i; - } - T& operator [] (mfxU32 idx) - { - return mRecords[idx]; - } - void push_back(const T& obj) - { - T *newRecords = new T[mNrecords + 1](); - mfxU32 i = 0; - for (; i = mNrecords) - { - throw MFXVectorRangeError(); - } - mNrecords--; - mfxU32 i = at.mIndex; - for (; i != mNrecords; i++) - { - mRecords[i] = mRecords[i+1]; - } - //destroy last element - mRecords[i] = T(); - } - void resize(mfxU32 nSize) - { - T * newRecords = new T[nSize](); - for (mfxU32 i = 0; i -#include "mfxplugin.h" -#include "mfx_dispatcher_log.h" - -#if !defined(MEDIASDK_UWP_DISPATCHER) -namespace MFX { - -template struct RegKey{}; -template<> struct RegKey{enum {type = REG_DWORD};}; -template<> struct RegKey{enum {type = REG_DWORD};}; -template<> struct RegKey{enum {type = REG_BINARY};}; -template<> struct RegKey{enum {type = REG_DWORD};}; -template<> struct RegKey{enum {type = REG_SZ};}; -template<> struct RegKey{enum {type = REG_SZ};}; - - -class WinRegKey -{ -public: - // Default constructor - WinRegKey(void); - // Destructor - ~WinRegKey(void); - - // Open a registry key - bool Open(HKEY hRootKey, const wchar_t *pSubKey, REGSAM samDesired); - bool Open(WinRegKey &rootKey, const wchar_t *pSubKey, REGSAM samDesired); - - // Query value - bool QueryInfo(LPDWORD lpcSubkeys); - - bool QueryValueSize(const wchar_t *pValueName, DWORD type, LPDWORD pcbData); - bool Query(const wchar_t *pValueName, DWORD type, LPBYTE pData, LPDWORD pcbData); - - bool Query(const wchar_t *pValueName, wchar_t *pData, mfxU32 &nData) { - DWORD dw = (DWORD)nData; - if (!Query(pValueName, RegKey::type, (LPBYTE)pData, &dw)){ - return false; - } - nData = dw; - return true; - } - - // Enumerate value names - bool EnumValue(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName, LPDWORD pType); - bool EnumKey(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName); - -protected: - - // Release the object - void Release(void); - - HKEY m_hKey; // (HKEY) handle to the opened key - -private: - // unimplemented by intent to make this class non-copyable - WinRegKey(const WinRegKey &); - void operator=(const WinRegKey &); - -}; - - -template -inline bool QueryKey(WinRegKey & key, const wchar_t *pValueName, T &data ) { - DWORD size = sizeof(data); - return key.Query(pValueName, RegKey::type, (LPBYTE) &data, &size); -} - -template<> -inline bool QueryKey(WinRegKey & key, const wchar_t *pValueName, bool &data ) { - mfxU32 value = 0; - bool bRes = QueryKey(key, pValueName, value); - data = (1 == value); - return bRes; -} - - -} // namespace MFX -#endif // #if !defined(MEDIASDK_UWP_DISPATCHER) - -#endif // __MFX_WIN_REG_KEY_H diff --git a/plugins/obs-qsv11/libmfx/include/mfxaudio_exposed_functions_list.h b/plugins/obs-qsv11/libmfx/include/mfxaudio_exposed_functions_list.h deleted file mode 100644 index 44a046be2..000000000 --- a/plugins/obs-qsv11/libmfx/include/mfxaudio_exposed_functions_list.h +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2013-2019 Intel Corporation -// -// 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. - -// -// WARNING: -// this file doesn't contain an include guard by intension. -// The file may be included into a source file many times. -// That is why this header doesn't contain any include directive. -// Please, do no try to fix it. -// - -// -// API version 1.8 functions -// - -// Minor value should precedes the major value -#define API_VERSION {{8, 1}} - -// CORE interface functions -FUNCTION(mfxStatus, MFXAudioCORE_SyncOperation, (mfxSession session, mfxSyncPoint syncp, mfxU32 wait), (session, syncp, wait)) - -// ENCODE interface functions -FUNCTION(mfxStatus, MFXAudioENCODE_Query, (mfxSession session, mfxAudioParam *in, mfxAudioParam *out), (session, in, out)) -FUNCTION(mfxStatus, MFXAudioENCODE_QueryIOSize, (mfxSession session, mfxAudioParam *par, mfxAudioAllocRequest *request), (session, par, request)) -FUNCTION(mfxStatus, MFXAudioENCODE_Init, (mfxSession session, mfxAudioParam *par), (session, par)) -FUNCTION(mfxStatus, MFXAudioENCODE_Reset, (mfxSession session, mfxAudioParam *par), (session, par)) -FUNCTION(mfxStatus, MFXAudioENCODE_Close, (mfxSession session), (session)) -FUNCTION(mfxStatus, MFXAudioENCODE_GetAudioParam, (mfxSession session, mfxAudioParam *par), (session, par)) -FUNCTION(mfxStatus, MFXAudioENCODE_EncodeFrameAsync, (mfxSession session, mfxAudioFrame *frame, mfxBitstream *buffer_out, mfxSyncPoint *syncp), (session, frame, buffer_out, syncp)) - -// DECODE interface functions -FUNCTION(mfxStatus, MFXAudioDECODE_Query, (mfxSession session, mfxAudioParam *in, mfxAudioParam *out), (session, in, out)) -FUNCTION(mfxStatus, MFXAudioDECODE_DecodeHeader, (mfxSession session, mfxBitstream *bs, mfxAudioParam *par), (session, bs, par)) -FUNCTION(mfxStatus, MFXAudioDECODE_Init, (mfxSession session, mfxAudioParam *par), (session, par)) -FUNCTION(mfxStatus, MFXAudioDECODE_Reset, (mfxSession session, mfxAudioParam *par), (session, par)) -FUNCTION(mfxStatus, MFXAudioDECODE_Close, (mfxSession session), (session)) -FUNCTION(mfxStatus, MFXAudioDECODE_QueryIOSize, (mfxSession session, mfxAudioParam *par, mfxAudioAllocRequest *request), (session, par, request)) -FUNCTION(mfxStatus, MFXAudioDECODE_GetAudioParam, (mfxSession session, mfxAudioParam *par), (session, par)) -FUNCTION(mfxStatus, MFXAudioDECODE_DecodeFrameAsync, (mfxSession session, mfxBitstream *bs, mfxAudioFrame *frame_out, mfxSyncPoint *syncp), (session, bs, frame_out, syncp)) - -#undef API_VERSION - -// -// API version 1.9 functions -// - -#define API_VERSION {{9, 1}} - -FUNCTION(mfxStatus, MFXAudioUSER_Register, (mfxSession session, mfxU32 type, const mfxPlugin *par), (session, type, par)) -FUNCTION(mfxStatus, MFXAudioUSER_Unregister, (mfxSession session, mfxU32 type), (session, type)) -FUNCTION(mfxStatus, MFXAudioUSER_ProcessFrameAsync, (mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp), (session, in, in_num, out, out_num, syncp)) - - -#undef API_VERSION diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxadapter.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxadapter.h deleted file mode 100644 index 30c4fb379..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxadapter.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2019-2020 Intel Corporation -// -// 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 "mfxdefs.h" -#if (MFX_VERSION >= 1031) -#ifndef __MFXADAPTER_H__ -#define __MFXADAPTER_H__ - -#include "mfxstructures.h" - -#ifdef __cplusplus -extern "C" -{ -#endif -mfxStatus MFX_CDECL MFXQueryAdapters(mfxComponentInfo* input_info, mfxAdaptersInfo* adapters); -mfxStatus MFX_CDECL MFXQueryAdaptersDecode(mfxBitstream* bitstream, mfxU32 codec_id, mfxAdaptersInfo* adapters); -mfxStatus MFX_CDECL MFXQueryAdaptersNumber(mfxU32* num_adapters); -#ifdef __cplusplus -} // extern "C" -#endif - -#endif // __MFXADAPTER_H__ -#endif \ No newline at end of file diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxastructures.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxastructures.h deleted file mode 100644 index 679132fc2..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxastructures.h +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) 2017-2019 Intel Corporation -// -// 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 __MFXASTRUCTURES_H__ -#define __MFXASTRUCTURES_H__ -#include "mfxcommon.h" - -#if !defined (__GNUC__) -#pragma warning(disable: 4201) -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* CodecId */ -enum { - MFX_CODEC_AAC =MFX_MAKEFOURCC('A','A','C',' '), - MFX_CODEC_MP3 =MFX_MAKEFOURCC('M','P','3',' ') -}; - -enum { - /* AAC Profiles & Levels */ - MFX_PROFILE_AAC_LC =2, - MFX_PROFILE_AAC_LTP =4, - MFX_PROFILE_AAC_MAIN =1, - MFX_PROFILE_AAC_SSR =3, - MFX_PROFILE_AAC_HE =5, - MFX_PROFILE_AAC_ALS =0x20, - MFX_PROFILE_AAC_BSAC =22, - MFX_PROFILE_AAC_PS =29, - - /*MPEG AUDIO*/ - MFX_AUDIO_MPEG1_LAYER1 =0x00000110, - MFX_AUDIO_MPEG1_LAYER2 =0x00000120, - MFX_AUDIO_MPEG1_LAYER3 =0x00000140, - MFX_AUDIO_MPEG2_LAYER1 =0x00000210, - MFX_AUDIO_MPEG2_LAYER2 =0x00000220, - MFX_AUDIO_MPEG2_LAYER3 =0x00000240 -}; - -/*AAC HE decoder down sampling*/ -enum { - MFX_AUDIO_AAC_HE_DWNSMPL_OFF=0, - MFX_AUDIO_AAC_HE_DWNSMPL_ON= 1 -}; - -/* AAC decoder support of PS */ -enum { - MFX_AUDIO_AAC_PS_DISABLE= 0, - MFX_AUDIO_AAC_PS_PARSER= 1, - MFX_AUDIO_AAC_PS_ENABLE_BL= 111, - MFX_AUDIO_AAC_PS_ENABLE_UR= 411 -}; - -/*AAC decoder SBR support*/ -enum { - MFX_AUDIO_AAC_SBR_DISABLE = 0, - MFX_AUDIO_AAC_SBR_ENABLE= 1, - MFX_AUDIO_AAC_SBR_UNDEF= 2 -}; - -/*AAC header type*/ -enum{ - MFX_AUDIO_AAC_ADTS= 1, - MFX_AUDIO_AAC_ADIF= 2, - MFX_AUDIO_AAC_RAW= 3, -}; - -/*AAC encoder stereo mode*/ -enum -{ - MFX_AUDIO_AAC_MONO= 0, - MFX_AUDIO_AAC_LR_STEREO= 1, - MFX_AUDIO_AAC_MS_STEREO= 2, - MFX_AUDIO_AAC_JOINT_STEREO= 3 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU32 CodecId; - mfxU16 CodecProfile; - mfxU16 CodecLevel; - - mfxU32 Bitrate; - mfxU32 SampleFrequency; - mfxU16 NumChannel; - mfxU16 BitPerSample; - - mfxU16 reserved1[22]; - - union { - struct { /* AAC Decoding Options */ - mfxU16 FlagPSSupportLev; - mfxU16 Layer; - mfxU16 AACHeaderDataSize; - mfxU8 AACHeaderData[64]; - }; - struct { /* AAC Encoding Options */ - mfxU16 OutputFormat; - mfxU16 StereoMode; - mfxU16 reserved2[61]; - }; - }; -} mfxAudioInfoMFX; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxU16 AsyncDepth; - mfxU16 Protected; - mfxU16 reserved[14]; - - mfxAudioInfoMFX mfx; - mfxExtBuffer** ExtParam; - mfxU16 NumExtParam; -} mfxAudioParam; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU32 SuggestedInputSize; - mfxU32 SuggestedOutputSize; - mfxU32 reserved[6]; -} mfxAudioAllocRequest; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - mfxU64 TimeStamp; /* 1/90KHz */ - mfxU16 Locked; - mfxU16 NumChannels; - mfxU32 SampleFrequency; - mfxU16 BitPerSample; - mfxU16 reserved1[7]; - - mfxU8* Data; - mfxU32 reserved2; - mfxU32 DataLength; - mfxU32 MaxLength; - - mfxU32 NumExtParam; - mfxExtBuffer **ExtParam; -} mfxAudioFrame; -MFX_PACK_END() - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - - diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxaudio++.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxaudio++.h deleted file mode 100644 index 1abbf1182..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxaudio++.h +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) 2017 Intel Corporation -// -// 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 __MFXAUDIOPLUSPLUS_H -#define __MFXAUDIOPLUSPLUS_H - -#include "mfxaudio.h" - -class MFXAudioSession -{ -public: - MFXAudioSession(void) { m_session = (mfxSession) 0; } - virtual ~MFXAudioSession(void) { Close(); } - - virtual mfxStatus Init(mfxIMPL impl, mfxVersion *ver) { return MFXInit(impl, ver, &m_session); } - virtual mfxStatus Close(void) - { - mfxStatus mfxRes; - mfxRes = MFXClose(m_session); m_session = (mfxSession) 0; - return mfxRes; - } - - virtual mfxStatus QueryIMPL(mfxIMPL *impl) { return MFXQueryIMPL(m_session, impl); } - virtual mfxStatus QueryVersion(mfxVersion *version) { return MFXQueryVersion(m_session, version); } - - virtual mfxStatus JoinSession(mfxSession child_session) { return MFXJoinSession(m_session, child_session);} - virtual mfxStatus DisjoinSession( ) { return MFXDisjoinSession(m_session);} - virtual mfxStatus CloneSession( mfxSession *clone) { return MFXCloneSession(m_session, clone);} - virtual mfxStatus SetPriority( mfxPriority priority) { return MFXSetPriority(m_session, priority);} - virtual mfxStatus GetPriority( mfxPriority *priority) { return MFXGetPriority(m_session, priority);} - - virtual mfxStatus SyncOperation(mfxSyncPoint syncp, mfxU32 wait) { return MFXAudioCORE_SyncOperation(m_session, syncp, wait); } - - virtual operator mfxSession (void) { return m_session; } - -protected: - - mfxSession m_session; // (mfxSession) handle to the owning session -}; - - -class MFXAudioDECODE -{ -public: - - MFXAudioDECODE(mfxSession session) { m_session = session; } - virtual ~MFXAudioDECODE(void) { Close(); } - - virtual mfxStatus Query(mfxAudioParam *in, mfxAudioParam *out) { return MFXAudioDECODE_Query(m_session, in, out); } - virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxAudioParam *par) { return MFXAudioDECODE_DecodeHeader(m_session, bs, par); } - virtual mfxStatus QueryIOSize(mfxAudioParam *par, mfxAudioAllocRequest *request) { return MFXAudioDECODE_QueryIOSize(m_session, par, request); } - virtual mfxStatus Init(mfxAudioParam *par) { return MFXAudioDECODE_Init(m_session, par); } - virtual mfxStatus Reset(mfxAudioParam *par) { return MFXAudioDECODE_Reset(m_session, par); } - virtual mfxStatus Close(void) { return MFXAudioDECODE_Close(m_session); } - virtual mfxStatus GetAudioParam(mfxAudioParam *par) { return MFXAudioDECODE_GetAudioParam(m_session, par); } - virtual mfxStatus DecodeFrameAsync(mfxBitstream *bs, mfxAudioFrame *frame, mfxSyncPoint *syncp) { return MFXAudioDECODE_DecodeFrameAsync(m_session, bs, frame, syncp); } - - -protected: - - mfxSession m_session; // (mfxSession) handle to the owning session -}; - - -class MFXAudioENCODE -{ -public: - - MFXAudioENCODE(mfxSession session) { m_session = session; } - virtual ~MFXAudioENCODE(void) { Close(); } - - virtual mfxStatus Query(mfxAudioParam *in, mfxAudioParam *out) { return MFXAudioENCODE_Query(m_session, in, out); } - virtual mfxStatus QueryIOSize(mfxAudioParam *par, mfxAudioAllocRequest *request) { return MFXAudioENCODE_QueryIOSize(m_session, par, request); } - virtual mfxStatus Init(mfxAudioParam *par) { return MFXAudioENCODE_Init(m_session, par); } - virtual mfxStatus Reset(mfxAudioParam *par) { return MFXAudioENCODE_Reset(m_session, par); } - virtual mfxStatus Close(void) { return MFXAudioENCODE_Close(m_session); } - virtual mfxStatus GetAudioParam(mfxAudioParam *par) { return MFXAudioENCODE_GetAudioParam(m_session, par); } - virtual mfxStatus EncodeFrameAsync(mfxAudioFrame *frame, mfxBitstream *buffer_out, mfxSyncPoint *syncp) { return MFXAudioENCODE_EncodeFrameAsync(m_session, frame, buffer_out, syncp); } - -protected: - - mfxSession m_session; // (mfxSession) handle to the owning session -}; - -#endif \ No newline at end of file diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxaudio.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxaudio.h deleted file mode 100644 index 032fb010c..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxaudio.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2017 Intel Corporation -// -// 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 __MFXAUDIO_H__ -#define __MFXAUDIO_H__ -#include "mfxsession.h" -#include "mfxastructures.h" - -#define MFX_AUDIO_VERSION_MAJOR 1 -#define MFX_AUDIO_VERSION_MINOR 15 - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* AudioCORE */ -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioCORE_SyncOperation(mfxSession session, mfxSyncPoint syncp, mfxU32 wait); - -/* AudioENCODE */ -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_Query(mfxSession session, mfxAudioParam *in, mfxAudioParam *out); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_QueryIOSize(mfxSession session, mfxAudioParam *par, mfxAudioAllocRequest *request); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_Init(mfxSession session, mfxAudioParam *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_Reset(mfxSession session, mfxAudioParam *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_Close(mfxSession session); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_GetAudioParam(mfxSession session, mfxAudioParam *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_EncodeFrameAsync(mfxSession session, mfxAudioFrame *frame, mfxBitstream *bs, mfxSyncPoint *syncp); - -/* AudioDECODE */ -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_Query(mfxSession session, mfxAudioParam *in, mfxAudioParam *out); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_DecodeHeader(mfxSession session, mfxBitstream *bs, mfxAudioParam* par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_Init(mfxSession session, mfxAudioParam *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_Reset(mfxSession session, mfxAudioParam *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_Close(mfxSession session); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_QueryIOSize(mfxSession session, mfxAudioParam *par, mfxAudioAllocRequest *request); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_GetAudioParam(mfxSession session, mfxAudioParam *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_DecodeFrameAsync(mfxSession session, mfxBitstream *bs, mfxAudioFrame *frame, mfxSyncPoint *syncp); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxcommon.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxcommon.h deleted file mode 100644 index 0171d6d52..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxcommon.h +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) 2018-2020 Intel Corporation -// -// 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 __MFXCOMMON_H__ -#define __MFXCOMMON_H__ -#include "mfxdefs.h" - -#if !defined (__GNUC__) -#pragma warning(disable: 4201) -#endif - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#define MFX_MAKEFOURCC(A,B,C,D) ((((int)A))+(((int)B)<<8)+(((int)C)<<16)+(((int)D)<<24)) - -/* Extended Configuration Header Structure */ -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU32 BufferId; - mfxU32 BufferSz; -} mfxExtBuffer; -MFX_PACK_END() - -/* Library initialization and deinitialization */ -typedef mfxI32 mfxIMPL; -#define MFX_IMPL_BASETYPE(x) (0x00ff & (x)) - -enum { - MFX_IMPL_AUTO = 0x0000, /* Auto Selection/In or Not Supported/Out */ - MFX_IMPL_SOFTWARE = 0x0001, /* Pure Software Implementation */ - MFX_IMPL_HARDWARE = 0x0002, /* Hardware Accelerated Implementation (default device) */ - MFX_IMPL_AUTO_ANY = 0x0003, /* Auto selection of any hardware/software implementation */ - MFX_IMPL_HARDWARE_ANY = 0x0004, /* Auto selection of any hardware implementation */ - MFX_IMPL_HARDWARE2 = 0x0005, /* Hardware accelerated implementation (2nd device) */ - MFX_IMPL_HARDWARE3 = 0x0006, /* Hardware accelerated implementation (3rd device) */ - MFX_IMPL_HARDWARE4 = 0x0007, /* Hardware accelerated implementation (4th device) */ - MFX_IMPL_RUNTIME = 0x0008, -#if (MFX_VERSION >= MFX_VERSION_NEXT) - MFX_IMPL_SINGLE_THREAD= 0x0009, -#endif - MFX_IMPL_VIA_ANY = 0x0100, - MFX_IMPL_VIA_D3D9 = 0x0200, - MFX_IMPL_VIA_D3D11 = 0x0300, - MFX_IMPL_VIA_VAAPI = 0x0400, - - MFX_IMPL_AUDIO = 0x8000, -#if (MFX_VERSION >= MFX_VERSION_NEXT) - MFX_IMPL_EXTERNAL_THREADING = 0x10000, -#endif - - MFX_IMPL_UNSUPPORTED = 0x0000 /* One of the MFXQueryIMPL returns */ -}; - -/* Version Info */ -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef union { - struct { - mfxU16 Minor; - mfxU16 Major; - }; - mfxU32 Version; -} mfxVersion; -MFX_PACK_END() - -/* session priority */ -typedef enum -{ - MFX_PRIORITY_LOW = 0, - MFX_PRIORITY_NORMAL = 1, - MFX_PRIORITY_HIGH = 2 - -} mfxPriority; - -typedef struct _mfxEncryptedData mfxEncryptedData; -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - union { - struct { - mfxEncryptedData* EncryptedData; - mfxExtBuffer **ExtParam; - mfxU16 NumExtParam; - }; - mfxU32 reserved[6]; - }; - mfxI64 DecodeTimeStamp; - mfxU64 TimeStamp; - mfxU8* Data; - mfxU32 DataOffset; - mfxU32 DataLength; - mfxU32 MaxLength; - - mfxU16 PicStruct; - mfxU16 FrameType; - mfxU16 DataFlag; - mfxU16 reserved2; -} mfxBitstream; -MFX_PACK_END() - -typedef struct _mfxSyncPoint *mfxSyncPoint; - -/* GPUCopy */ -enum { - MFX_GPUCOPY_DEFAULT = 0, - MFX_GPUCOPY_ON = 1, - MFX_GPUCOPY_OFF = 2 -}; - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxIMPL Implementation; - mfxVersion Version; - mfxU16 ExternalThreads; - union { - struct { - mfxExtBuffer **ExtParam; - mfxU16 NumExtParam; - }; - mfxU16 reserved2[5]; - }; - mfxU16 GPUCopy; - mfxU16 reserved[21]; -} mfxInitParam; -MFX_PACK_END() - -enum { - MFX_EXTBUFF_THREADS_PARAM = MFX_MAKEFOURCC('T','H','D','P') -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 NumThread; - mfxI32 SchedulingType; - mfxI32 Priority; - mfxU16 reserved[55]; -} mfxExtThreadsParam; -MFX_PACK_END() - -/* PlatformCodeName */ -enum { - MFX_PLATFORM_UNKNOWN = 0, - MFX_PLATFORM_SANDYBRIDGE = 1, - MFX_PLATFORM_IVYBRIDGE = 2, - MFX_PLATFORM_HASWELL = 3, - MFX_PLATFORM_BAYTRAIL = 4, - MFX_PLATFORM_BROADWELL = 5, - MFX_PLATFORM_CHERRYTRAIL = 6, - MFX_PLATFORM_SKYLAKE = 7, - MFX_PLATFORM_APOLLOLAKE = 8, - MFX_PLATFORM_KABYLAKE = 9, -#if (MFX_VERSION >= 1025) - MFX_PLATFORM_GEMINILAKE = 10, - MFX_PLATFORM_COFFEELAKE = 11, - MFX_PLATFORM_CANNONLAKE = 20, -#endif -#if (MFX_VERSION >= 1027) - MFX_PLATFORM_ICELAKE = 30, -#endif - MFX_PLATFORM_JASPERLAKE = 32, - MFX_PLATFORM_ELKHARTLAKE = 33, - MFX_PLATFORM_TIGERLAKE = 40, - MFX_PLATFORM_ROCKETLAKE = 42, - MFX_PLATFORM_ALDERLAKE_S = 43, - MFX_PLATFORM_KEEMBAY = 50, -}; - -#if (MFX_VERSION >= 1031) -typedef enum -{ - MFX_MEDIA_UNKNOWN = 0xffff, - MFX_MEDIA_INTEGRATED = 0, - MFX_MEDIA_DISCRETE = 1 -} mfxMediaAdapterType; -#endif - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU16 CodeName; - mfxU16 DeviceId; -#if (MFX_VERSION >= 1031) - mfxU16 MediaAdapterType; - mfxU16 reserved[13]; -#else - mfxU16 reserved[14]; -#endif -} mfxPlatform; -MFX_PACK_END() - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxdefs.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxdefs.h deleted file mode 100644 index 2c288c7f8..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxdefs.h +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright (c) 2019-2020 Intel Corporation -// -// 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 __MFXDEFS_H__ -#define __MFXDEFS_H__ - -#define MFX_VERSION_MAJOR 1 -#define MFX_VERSION_MINOR 35 - -// MFX_VERSION_NEXT is always +1 from last public release -// may be enforced by MFX_VERSION_USE_LATEST define -// if MFX_VERSION_USE_LATEST is defined MFX_VERSION is ignored - -#define MFX_VERSION_NEXT (MFX_VERSION_MAJOR * 1000 + MFX_VERSION_MINOR + 1) - -// MFX_VERSION - version of API that 'assumed' by build may be provided externally -// if it omitted then latest stable API derived from Major.Minor is assumed - - -#if !defined(MFX_VERSION) - #if defined(MFX_VERSION_USE_LATEST) - #define MFX_VERSION MFX_VERSION_NEXT - #else - #define MFX_VERSION (MFX_VERSION_MAJOR * 1000 + MFX_VERSION_MINOR) - #endif -#else - #undef MFX_VERSION_MINOR - #define MFX_VERSION_MINOR ((MFX_VERSION) % 1000) -#endif - - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* In preprocessor syntax # symbol has stringize meaning, - so to expand some macro to preprocessor pragma we need to use - special compiler dependent construction */ - -#if defined(_MSC_VER) - #define MFX_PRAGMA_IMPL(x) __pragma(x) -#else - #define MFX_PRAGMA_IMPL(x) _Pragma(#x) -#endif - -#define MFX_PACK_BEGIN_X(x) MFX_PRAGMA_IMPL(pack(push, x)) -#define MFX_PACK_END() MFX_PRAGMA_IMPL(pack(pop)) - -/* The general rule for alignment is following: - - structures with pointers have 4/8 bytes alignment on 32/64 bit systems - - structures with fields of type mfxU64/mfxF64 (unsigned long long / double) - have alignment 8 bytes on 64 bit and 32 bit Windows, on Linux alignment is 4 bytes - - all the rest structures are 4 bytes aligned - - there are several exceptions: some structs which had 4-byte alignment were extended - with pointer / long type fields; such structs have 4-byte alignment to keep binary - compatibility with previously release API */ - -#define MFX_PACK_BEGIN_USUAL_STRUCT() MFX_PACK_BEGIN_X(4) - -/* 64-bit LP64 data model */ -#if defined(_WIN64) || defined(__LP64__) - #define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(8) - #define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(8) -/* 32-bit ILP32 data model Windows (Intel architecture) */ -#elif defined(_WIN32) || defined(_M_IX86) && !defined(__linux__) - #define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(4) - #define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(8) -/* 32-bit ILP32 data model Linux */ -#elif defined(__ILP32__) - #define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(4) - #define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(4) -#else - #error Unknown packing -#endif - - #define __INT64 long long - #define __UINT64 unsigned long long - -#ifdef _WIN32 - #define MFX_CDECL __cdecl - #define MFX_STDCALL __stdcall -#else - #define MFX_CDECL - #define MFX_STDCALL -#endif /* _WIN32 */ - -#define MFX_INFINITE 0xFFFFFFFF - -#if !defined(MFX_DEPRECATED_OFF) && (MFX_VERSION >= 1034) -#define MFX_DEPRECATED_OFF -#endif - -#ifndef MFX_DEPRECATED_OFF - #if defined(__cplusplus) && __cplusplus >= 201402L - #define MFX_DEPRECATED [[deprecated]] - #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg [[deprecated]] - #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) - #elif defined(__clang__) - #define MFX_DEPRECATED __attribute__((deprecated)) - #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated)) - #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) - #elif defined(__INTEL_COMPILER) - #if (defined(_WIN32) || defined(_WIN64)) - #define MFX_DEPRECATED __declspec(deprecated) - #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg - #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg)) - #elif defined(__linux__) - #define MFX_DEPRECATED __attribute__((deprecated)) - #if defined(__cplusplus) - #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated)) - #else - #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg - #endif - #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) - #endif - #elif defined(_MSC_VER) && _MSC_VER > 1200 // VS 6 doesn't support deprecation - #define MFX_DEPRECATED __declspec(deprecated) - #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg - #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg)) - #elif defined(__GNUC__) - #define MFX_DEPRECATED __attribute__((deprecated)) - #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated)) - #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) - #else - #define MFX_DEPRECATED - #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg - #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) - #endif -#else - #define MFX_DEPRECATED - #define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg - #define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) -#endif - -typedef unsigned char mfxU8; -typedef char mfxI8; -typedef short mfxI16; -typedef unsigned short mfxU16; -typedef unsigned int mfxU32; -typedef int mfxI32; -#if defined( _WIN32 ) || defined ( _WIN64 ) -typedef unsigned long mfxUL32; -typedef long mfxL32; -#else -typedef unsigned int mfxUL32; -typedef int mfxL32; -#endif -typedef float mfxF32; -typedef double mfxF64; -typedef __UINT64 mfxU64; -typedef __INT64 mfxI64; -typedef void* mfxHDL; -typedef mfxHDL mfxMemId; -typedef void* mfxThreadTask; -typedef char mfxChar; - -typedef struct { - mfxI16 x; - mfxI16 y; -} mfxI16Pair; - -typedef struct { - mfxHDL first; - mfxHDL second; -} mfxHDLPair; - - -/*********************************************************************************\ -Error message -\*********************************************************************************/ -typedef enum -{ - /* no error */ - MFX_ERR_NONE = 0, /* no error */ - - /* reserved for unexpected errors */ - MFX_ERR_UNKNOWN = -1, /* unknown error. */ - - /* error codes <0 */ - MFX_ERR_NULL_PTR = -2, /* null pointer */ - MFX_ERR_UNSUPPORTED = -3, /* undeveloped feature */ - MFX_ERR_MEMORY_ALLOC = -4, /* failed to allocate memory */ - MFX_ERR_NOT_ENOUGH_BUFFER = -5, /* insufficient buffer at input/output */ - MFX_ERR_INVALID_HANDLE = -6, /* invalid handle */ - MFX_ERR_LOCK_MEMORY = -7, /* failed to lock the memory block */ - MFX_ERR_NOT_INITIALIZED = -8, /* member function called before initialization */ - MFX_ERR_NOT_FOUND = -9, /* the specified object is not found */ - MFX_ERR_MORE_DATA = -10, /* expect more data at input */ - MFX_ERR_MORE_SURFACE = -11, /* expect more surface at output */ - MFX_ERR_ABORTED = -12, /* operation aborted */ - MFX_ERR_DEVICE_LOST = -13, /* lose the HW acceleration device */ - MFX_ERR_INCOMPATIBLE_VIDEO_PARAM = -14, /* incompatible video parameters */ - MFX_ERR_INVALID_VIDEO_PARAM = -15, /* invalid video parameters */ - MFX_ERR_UNDEFINED_BEHAVIOR = -16, /* undefined behavior */ - MFX_ERR_DEVICE_FAILED = -17, /* device operation failure */ - MFX_ERR_MORE_BITSTREAM = -18, /* expect more bitstream buffers at output */ - MFX_ERR_INCOMPATIBLE_AUDIO_PARAM = -19, /* incompatible audio parameters */ - MFX_ERR_INVALID_AUDIO_PARAM = -20, /* invalid audio parameters */ - MFX_ERR_GPU_HANG = -21, /* device operation failure caused by GPU hang */ - MFX_ERR_REALLOC_SURFACE = -22, /* bigger output surface required */ - - /* warnings >0 */ - MFX_WRN_IN_EXECUTION = 1, /* the previous asynchronous operation is in execution */ - MFX_WRN_DEVICE_BUSY = 2, /* the HW acceleration device is busy */ - MFX_WRN_VIDEO_PARAM_CHANGED = 3, /* the video parameters are changed during decoding */ - MFX_WRN_PARTIAL_ACCELERATION = 4, /* SW is used */ - MFX_WRN_INCOMPATIBLE_VIDEO_PARAM = 5, /* incompatible video parameters */ - MFX_WRN_VALUE_NOT_CHANGED = 6, /* the value is saturated based on its valid range */ - MFX_WRN_OUT_OF_RANGE = 7, /* the value is out of valid range */ - MFX_WRN_FILTER_SKIPPED = 10, /* one of requested filters has been skipped */ - MFX_WRN_INCOMPATIBLE_AUDIO_PARAM = 11, /* incompatible audio parameters */ - -#if MFX_VERSION >= 1031 - /* low-delay partial output */ - MFX_ERR_NONE_PARTIAL_OUTPUT = 12, /* frame is not ready, but bitstream contains partial output */ -#endif - - /* threading statuses */ - MFX_TASK_DONE = MFX_ERR_NONE, /* task has been completed */ - MFX_TASK_WORKING = 8, /* there is some more work to do */ - MFX_TASK_BUSY = 9, /* task is waiting for resources */ - - /* plug-in statuses */ - MFX_ERR_MORE_DATA_SUBMIT_TASK = -10000, /* return MFX_ERR_MORE_DATA but submit internal asynchronous task */ - -} mfxStatus; - - -// Application -#if defined(MFX_DISPATCHER_EXPOSED_PREFIX) - -#include "mfxdispatcherprefixedfunctions.h" - -#endif // MFX_DISPATCHER_EXPOSED_PREFIX - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __MFXDEFS_H__ */ diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxenc.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxenc.h deleted file mode 100644 index 2ad307251..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxenc.h +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2017-2019 Intel Corporation -// -// 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 __MFXENC_H__ -#define __MFXENC_H__ -#include "mfxdefs.h" -#include "mfxvstructures.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -MFX_PACK_BEGIN_STRUCT_W_PTR() -MFX_DEPRECATED typedef struct _mfxENCInput{ - mfxU32 reserved[32]; - - mfxFrameSurface1 *InSurface; - - mfxU16 NumFrameL0; - mfxFrameSurface1 **L0Surface; - mfxU16 NumFrameL1; - mfxFrameSurface1 **L1Surface; - - mfxU16 NumExtParam; - mfxExtBuffer **ExtParam; -} mfxENCInput; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -MFX_DEPRECATED typedef struct _mfxENCOutput{ - mfxU32 reserved[32]; - - mfxFrameSurface1 *OutSurface; - - mfxU16 NumExtParam; - mfxExtBuffer **ExtParam; -} mfxENCOutput; -MFX_PACK_END() - - -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_Init(mfxSession session, mfxVideoParam *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_Reset(mfxSession session, mfxVideoParam *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_Close(mfxSession session); - -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_ProcessFrameAsync(mfxSession session, mfxENCInput *in, mfxENCOutput *out, mfxSyncPoint *syncp); - -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_GetVideoParam(mfxSession session, mfxVideoParam *par); - -#ifdef __cplusplus -} // extern "C" -#endif /* __cplusplus */ - - -#endif - diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxjpeg.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxjpeg.h deleted file mode 100644 index 7f00b67e3..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxjpeg.h +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2017-2019 Intel Corporation -// -// 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 __MFX_JPEG_H__ -#define __MFX_JPEG_H__ - -#include "mfxdefs.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* CodecId */ -enum { - MFX_CODEC_JPEG = MFX_MAKEFOURCC('J','P','E','G') -}; - -/* CodecProfile, CodecLevel */ -enum -{ - MFX_PROFILE_JPEG_BASELINE = 1 -}; - -enum -{ - MFX_ROTATION_0 = 0, - MFX_ROTATION_90 = 1, - MFX_ROTATION_180 = 2, - MFX_ROTATION_270 = 3 -}; - -enum { - MFX_EXTBUFF_JPEG_QT = MFX_MAKEFOURCC('J','P','G','Q'), - MFX_EXTBUFF_JPEG_HUFFMAN = MFX_MAKEFOURCC('J','P','G','H') -}; - -enum { - MFX_JPEG_COLORFORMAT_UNKNOWN = 0, - MFX_JPEG_COLORFORMAT_YCbCr = 1, - MFX_JPEG_COLORFORMAT_RGB = 2 -}; - -enum { - MFX_SCANTYPE_UNKNOWN = 0, - MFX_SCANTYPE_INTERLEAVED = 1, - MFX_SCANTYPE_NONINTERLEAVED = 2 -}; - -enum { - MFX_CHROMAFORMAT_JPEG_SAMPLING = 6 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 reserved[7]; - mfxU16 NumTable; - - mfxU16 Qm[4][64]; -} mfxExtJPEGQuantTables; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 reserved[2]; - mfxU16 NumDCTable; - mfxU16 NumACTable; - - struct { - mfxU8 Bits[16]; - mfxU8 Values[12]; - } DCTables[4]; - - struct { - mfxU8 Bits[16]; - mfxU8 Values[162]; - } ACTables[4]; -} mfxExtJPEGHuffmanTables; -MFX_PACK_END() - -#ifdef __cplusplus -} // extern "C" -#endif /* __cplusplus */ - -#endif // __MFX_JPEG_H__ diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxmvc.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxmvc.h deleted file mode 100644 index 4ec71dc13..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxmvc.h +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) 2017-2019 Intel Corporation -// -// 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 __MFXMVC_H__ -#define __MFXMVC_H__ - -#include "mfxdefs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* CodecProfile, CodecLevel */ -enum { - /* MVC profiles */ - MFX_PROFILE_AVC_MULTIVIEW_HIGH =118, - MFX_PROFILE_AVC_STEREO_HIGH =128 -}; - -/* Extended Buffer Ids */ -enum { - MFX_EXTBUFF_MVC_SEQ_DESC = MFX_MAKEFOURCC('M','V','C','D'), - MFX_EXTBUFF_MVC_TARGET_VIEWS = MFX_MAKEFOURCC('M','V','C','T') -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU16 ViewId; - - mfxU16 NumAnchorRefsL0; - mfxU16 NumAnchorRefsL1; - mfxU16 AnchorRefL0[16]; - mfxU16 AnchorRefL1[16]; - - mfxU16 NumNonAnchorRefsL0; - mfxU16 NumNonAnchorRefsL1; - mfxU16 NonAnchorRefL0[16]; - mfxU16 NonAnchorRefL1[16]; -} mfxMVCViewDependency; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxU16 TemporalId; - mfxU16 LevelIdc; - - mfxU16 NumViews; - mfxU16 NumTargetViews; - mfxU16 *TargetViewId; -} mfxMVCOperationPoint; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxExtBuffer Header; - - mfxU32 NumView; - mfxU32 NumViewAlloc; - mfxMVCViewDependency *View; - - mfxU32 NumViewId; - mfxU32 NumViewIdAlloc; - mfxU16 *ViewId; - - mfxU32 NumOP; - mfxU32 NumOPAlloc; - mfxMVCOperationPoint *OP; - - mfxU16 NumRefsTotal; - mfxU32 Reserved[16]; - -} mfxExtMVCSeqDesc; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 TemporalId; - mfxU32 NumView; - mfxU16 ViewId[1024]; -} mfxExtMVCTargetViews ; -MFX_PACK_END() - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif - diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxpak.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxpak.h deleted file mode 100644 index d2bdf5886..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxpak.h +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2017-2019 Intel Corporation -// -// 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 __MFXPAK_H__ -#define __MFXPAK_H__ -#include "mfxdefs.h" -#include "mfxvstructures.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -MFX_PACK_BEGIN_STRUCT_W_PTR() -MFX_DEPRECATED typedef struct { - mfxU16 reserved[32]; - - mfxFrameSurface1 *InSurface; - - mfxU16 NumFrameL0; - mfxFrameSurface1 **L0Surface; - mfxU16 NumFrameL1; - mfxFrameSurface1 **L1Surface; - - mfxU16 NumExtParam; - mfxExtBuffer **ExtParam; - - mfxU16 NumPayload; - mfxPayload **Payload; -} mfxPAKInput; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -MFX_DEPRECATED typedef struct { - mfxU16 reserved[32]; - - mfxBitstream *Bs; - - mfxFrameSurface1 *OutSurface; - - mfxU16 NumExtParam; - mfxExtBuffer **ExtParam; -} mfxPAKOutput; -MFX_PACK_END() - -typedef struct _mfxSession *mfxSession; -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest request[2]); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_Init(mfxSession session, mfxVideoParam *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_Reset(mfxSession session, mfxVideoParam *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_Close(mfxSession session); - -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_ProcessFrameAsync(mfxSession session, mfxPAKInput *in, mfxPAKOutput *out, mfxSyncPoint *syncp); - -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_GetVideoParam(mfxSession session, mfxVideoParam *par); - -#ifdef __cplusplus -} // extern "C" -#endif /* __cplusplus */ - - -#endif diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxplugin++.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxplugin++.h deleted file mode 100644 index 9fe7ce5f8..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxplugin++.h +++ /dev/null @@ -1,717 +0,0 @@ -// Copyright (c) 2017-2020 Intel Corporation -// -// 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 __MFXPLUGINPLUSPLUS_H -#define __MFXPLUGINPLUSPLUS_H - -#include "mfxplugin.h" - -// base class for MFXVideoUSER/MFXAudioUSER API - -class MFXBaseUSER { -public: - explicit MFXBaseUSER(mfxSession session = NULL) - : m_session(session){} - - virtual ~MFXBaseUSER() {} - - virtual mfxStatus Register(mfxU32 type, const mfxPlugin *par) = 0; - virtual mfxStatus Unregister(mfxU32 type) = 0; - virtual mfxStatus ProcessFrameAsync(const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp) = 0; - -protected: - mfxSession m_session; -}; - -//c++ wrapper over only 3 exposed functions from MFXVideoUSER module -class MFXVideoUSER: public MFXBaseUSER { -public: - explicit MFXVideoUSER(mfxSession session = NULL) - : MFXBaseUSER(session){} - - virtual mfxStatus Register(mfxU32 type, const mfxPlugin *par) { - return MFXVideoUSER_Register(m_session, type, par); - } - virtual mfxStatus Unregister(mfxU32 type) { - return MFXVideoUSER_Unregister(m_session, type); - } - virtual mfxStatus ProcessFrameAsync(const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp) { - return MFXVideoUSER_ProcessFrameAsync(m_session, in, in_num, out, out_num, syncp); - } -}; - -//c++ wrapper over only 3 exposed functions from MFXAudioUSER module -class MFXAudioUSER: public MFXBaseUSER { -public: - explicit MFXAudioUSER(mfxSession session = NULL) - : MFXBaseUSER(session){} - - virtual mfxStatus Register(mfxU32 type, const mfxPlugin *par) { - return MFXAudioUSER_Register(m_session, type, par); - } - virtual mfxStatus Unregister(mfxU32 type) { - return MFXAudioUSER_Unregister(m_session, type); - } - virtual mfxStatus ProcessFrameAsync(const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp) { - return MFXAudioUSER_ProcessFrameAsync(m_session, in, in_num, out, out_num, syncp); - } -}; - - -//initialize mfxPlugin struct -class MFXPluginParam { - mfxPluginParam m_param; - -public: - MFXPluginParam(mfxU32 CodecId, mfxU32 Type, mfxPluginUID uid, mfxThreadPolicy ThreadPolicy = MFX_THREADPOLICY_SERIAL, mfxU32 MaxThreadNum = 1) - : m_param() { - m_param.PluginUID = uid; - m_param.Type = Type; - m_param.CodecId = CodecId; - m_param.MaxThreadNum = MaxThreadNum; - m_param.ThreadPolicy = ThreadPolicy; - } - operator const mfxPluginParam& () const { - return m_param; - } - operator mfxPluginParam& () { - return m_param; - } -}; - -//common interface part for every plugin: decoder/encoder and generic -struct MFXPlugin -{ - virtual ~MFXPlugin() {}; - //init function always required for any transform or codec plugins, for codec plugins it maps to callback from MediaSDK - //for generic plugin application should call it - //MediaSDK mfxPlugin API mapping - virtual mfxStatus PluginInit(mfxCoreInterface *core) = 0; - //release CoreInterface, and destroy plugin state, not destroy plugin instance - virtual mfxStatus PluginClose() = 0; - virtual mfxStatus GetPluginParam(mfxPluginParam *par) = 0; - virtual mfxStatus Execute(mfxThreadTask task, mfxU32 uid_p, mfxU32 uid_a) = 0; - virtual mfxStatus FreeResources(mfxThreadTask task, mfxStatus sts) = 0; - //destroy plugin due to shared module distribution model plugin wont support virtual destructor - virtual void Release() = 0; - //release resources associated with current instance of plugin, but do not release CoreInterface related resource set in pluginInit - virtual mfxStatus Close() = 0; - //communication protocol between particular version of plugin and application - virtual mfxStatus SetAuxParams(void* auxParam, int auxParamSize) = 0; -}; - -//common extension interface that codec plugins should expose additionally to MFXPlugin -struct MFXCodecPlugin : MFXPlugin -{ - virtual mfxStatus Init(mfxVideoParam *par) = 0; - virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *in, mfxFrameAllocRequest *out) = 0; - virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) =0; - virtual mfxStatus Reset(mfxVideoParam *par) = 0; - virtual mfxStatus GetVideoParam(mfxVideoParam *par) = 0; -}; - -//common extension interface that audio codec plugins should expose additionally to MFXPlugin -struct MFXAudioCodecPlugin : MFXPlugin -{ - virtual mfxStatus Init(mfxAudioParam *par) = 0; - virtual mfxStatus Query(mfxAudioParam *in, mfxAudioParam *out) =0; - virtual mfxStatus QueryIOSize(mfxAudioParam *par, mfxAudioAllocRequest *request) = 0; - virtual mfxStatus Reset(mfxAudioParam *par) = 0; - virtual mfxStatus GetAudioParam(mfxAudioParam *par) = 0; -}; - -//general purpose transform plugin interface, not a codec plugin -struct MFXGenericPlugin : MFXPlugin -{ - virtual mfxStatus Init(mfxVideoParam *par) = 0; - virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *in, mfxFrameAllocRequest *out) = 0; - virtual mfxStatus Submit(const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxThreadTask *task) = 0; -}; - -//decoder plugins may only support this interface -struct MFXDecoderPlugin : MFXCodecPlugin -{ - virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxVideoParam *par) = 0; - virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) = 0; - virtual mfxStatus DecodeFrameSubmit(mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task) = 0; -}; - -//audio decoder plugins may only support this interface -struct MFXAudioDecoderPlugin : MFXAudioCodecPlugin -{ - virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxAudioParam *par) = 0; -// virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) = 0; - virtual mfxStatus DecodeFrameSubmit(mfxBitstream *in, mfxAudioFrame *out, mfxThreadTask *task) = 0; -}; - -//encoder plugins may only support this interface -struct MFXEncoderPlugin : MFXCodecPlugin -{ - virtual mfxStatus EncodeFrameSubmit(mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxThreadTask *task) = 0; -}; - -//audio encoder plugins may only support this interface -struct MFXAudioEncoderPlugin : MFXAudioCodecPlugin -{ - virtual mfxStatus EncodeFrameSubmit(mfxAudioFrame *aFrame, mfxBitstream *out, mfxThreadTask *task) = 0; -}; - -//vpp plugins may only support this interface -struct MFXVPPPlugin : MFXCodecPlugin -{ - virtual mfxStatus VPPFrameSubmit(mfxFrameSurface1 *surface_in, mfxFrameSurface1 *surface_out, mfxExtVppAuxData *aux, mfxThreadTask *task) = 0; - virtual mfxStatus VPPFrameSubmitEx(mfxFrameSurface1 *in, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task) = 0; -}; - -struct MFXEncPlugin : MFXCodecPlugin -{ - virtual mfxStatus EncFrameSubmit(mfxENCInput *in, mfxENCOutput *out, mfxThreadTask *task) = 0; -}; - - - - -class MFXCoreInterface -{ -protected: - mfxCoreInterface m_core; -public: - - MFXCoreInterface() - : m_core() { - } - MFXCoreInterface(const mfxCoreInterface & pCore) - : m_core(pCore) { - } - - MFXCoreInterface(const MFXCoreInterface & that) - : m_core(that.m_core) { - } - MFXCoreInterface &operator = (const MFXCoreInterface & that) - { - m_core = that.m_core; - return *this; - } - bool IsCoreSet() { - return m_core.pthis != 0; - } - mfxStatus GetCoreParam(mfxCoreParam *par) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.GetCoreParam(m_core.pthis, par); - } - mfxStatus GetHandle (mfxHandleType type, mfxHDL *handle) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.GetHandle(m_core.pthis, type, handle); - } - mfxStatus IncreaseReference (mfxFrameData *fd) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.IncreaseReference(m_core.pthis, fd); - } - mfxStatus DecreaseReference (mfxFrameData *fd) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.DecreaseReference(m_core.pthis, fd); - } - mfxStatus CopyFrame (mfxFrameSurface1 *dst, mfxFrameSurface1 *src) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.CopyFrame(m_core.pthis, dst, src); - } - mfxStatus CopyBuffer(mfxU8 *dst, mfxU32 size, mfxFrameSurface1 *src) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.CopyBuffer(m_core.pthis, dst, size, src); - } - mfxStatus MapOpaqueSurface(mfxU32 num, mfxU32 type, mfxFrameSurface1 **op_surf) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.MapOpaqueSurface(m_core.pthis, num, type, op_surf); - } - mfxStatus UnmapOpaqueSurface(mfxU32 num, mfxU32 type, mfxFrameSurface1 **op_surf) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.UnmapOpaqueSurface(m_core.pthis, num, type, op_surf); - } - mfxStatus GetRealSurface(mfxFrameSurface1 *op_surf, mfxFrameSurface1 **surf) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.GetRealSurface(m_core.pthis, op_surf, surf); - } - mfxStatus GetOpaqueSurface(mfxFrameSurface1 *surf, mfxFrameSurface1 **op_surf) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.GetOpaqueSurface(m_core.pthis, surf, op_surf); - } - mfxStatus CreateAccelerationDevice(mfxHandleType type, mfxHDL *handle) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.CreateAccelerationDevice(m_core.pthis, type, handle); - } - mfxFrameAllocator & FrameAllocator() { - return m_core.FrameAllocator; - } - mfxStatus GetFrameHandle(mfxFrameData *fd, mfxHDL *handle) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.GetFrameHandle(m_core.pthis, fd, handle); - } - mfxStatus QueryPlatform(mfxPlatform *platform) { - if (!IsCoreSet()) { - return MFX_ERR_NULL_PTR; - } - return m_core.QueryPlatform(m_core.pthis, platform); - } -} ; - -/* Class adapter between "C" structure mfxPlugin and C++ interface MFXPlugin */ - -namespace detail -{ - template - class MFXPluginAdapterBase - { - protected: - mfxPlugin m_mfxAPI; - public: - MFXPluginAdapterBase( T *plugin, mfxVideoCodecPlugin *pCodec = NULL) - : m_mfxAPI() - { - SetupCallbacks(plugin, pCodec); - } - - MFXPluginAdapterBase( T *plugin, mfxAudioCodecPlugin *pCodec) - : m_mfxAPI() - { - SetupCallbacks(plugin, pCodec); - } - - operator mfxPlugin () const { - return m_mfxAPI; - } - void SetupCallbacks(T *plugin) { - m_mfxAPI.pthis = plugin; - m_mfxAPI.PluginInit = _PluginInit; - m_mfxAPI.PluginClose = _PluginClose; - m_mfxAPI.GetPluginParam = _GetPluginParam; - m_mfxAPI.Submit = 0; - m_mfxAPI.Execute = _Execute; - m_mfxAPI.FreeResources = _FreeResources; - } - - void SetupCallbacks( T *plugin, mfxVideoCodecPlugin *pCodec) { - SetupCallbacks(plugin); - m_mfxAPI.Video = pCodec; - } - - void SetupCallbacks( T *plugin, mfxAudioCodecPlugin *pCodec) { - SetupCallbacks(plugin); - m_mfxAPI.Audio = pCodec; - } - private: - - static mfxStatus _PluginInit(mfxHDL pthis, mfxCoreInterface *core) { - return reinterpret_cast(pthis)->PluginInit(core); - } - static mfxStatus _PluginClose(mfxHDL pthis) { - return reinterpret_cast(pthis)->PluginClose(); - } - static mfxStatus _GetPluginParam(mfxHDL pthis, mfxPluginParam *par) { - return reinterpret_cast(pthis)->GetPluginParam(par); - } - static mfxStatus _Execute(mfxHDL pthis, mfxThreadTask task, mfxU32 thread_id, mfxU32 call_count) { - return reinterpret_cast(pthis)->Execute(task, thread_id, call_count); - } - static mfxStatus _FreeResources(mfxHDL pthis, mfxThreadTask task, mfxStatus sts) { - return reinterpret_cast(pthis)->FreeResources(task, sts); - } - }; - - template - class MFXCodecPluginAdapterBase : public MFXPluginAdapterBase - { - protected: - //stub to feed mediasdk plugin API - mfxVideoCodecPlugin m_codecPlg; - public: - MFXCodecPluginAdapterBase(T * pCodecPlg) - : MFXPluginAdapterBase(pCodecPlg, &m_codecPlg) - , m_codecPlg() - { - m_codecPlg.Query = _Query; - m_codecPlg.QueryIOSurf = _QueryIOSurf ; - m_codecPlg.Init = _Init; - m_codecPlg.Reset = _Reset; - m_codecPlg.Close = _Close; - m_codecPlg.GetVideoParam = _GetVideoParam; - } - MFXCodecPluginAdapterBase(const MFXCodecPluginAdapterBase & that) - : MFXPluginAdapterBase(reinterpret_cast(that.m_mfxAPI.pthis), &m_codecPlg) - , m_codecPlg() { - SetupCallbacks(); - } - MFXCodecPluginAdapterBase& operator = (const MFXCodecPluginAdapterBase & that) { - MFXPluginAdapterBase :: SetupCallbacks(reinterpret_cast(that.m_mfxAPI.pthis), &m_codecPlg); - SetupCallbacks(); - return *this; - } - - private: - void SetupCallbacks() { - m_codecPlg.Query = _Query; - m_codecPlg.QueryIOSurf = _QueryIOSurf ; - m_codecPlg.Init = _Init; - m_codecPlg.Reset = _Reset; - m_codecPlg.Close = _Close; - m_codecPlg.GetVideoParam = _GetVideoParam; - } - static mfxStatus _Query(mfxHDL pthis, mfxVideoParam *in, mfxVideoParam *out) { - return reinterpret_cast(pthis)->Query(in, out); - } - static mfxStatus _QueryIOSurf(mfxHDL pthis, mfxVideoParam *par, mfxFrameAllocRequest *in, mfxFrameAllocRequest *out){ - return reinterpret_cast(pthis)->QueryIOSurf(par, in, out); - } - static mfxStatus _Init(mfxHDL pthis, mfxVideoParam *par){ - return reinterpret_cast(pthis)->Init(par); - } - static mfxStatus _Reset(mfxHDL pthis, mfxVideoParam *par){ - return reinterpret_cast(pthis)->Reset(par); - } - static mfxStatus _Close(mfxHDL pthis) { - return reinterpret_cast(pthis)->Close(); - } - static mfxStatus _GetVideoParam(mfxHDL pthis, mfxVideoParam *par) { - return reinterpret_cast(pthis)->GetVideoParam(par); - } - }; - - template - class MFXAudioCodecPluginAdapterBase : public MFXPluginAdapterBase - { - protected: - //stub to feed mediasdk plugin API - mfxAudioCodecPlugin m_codecPlg; - public: - MFXAudioCodecPluginAdapterBase(T * pCodecPlg) - : MFXPluginAdapterBase(pCodecPlg, &m_codecPlg) - , m_codecPlg() - { - m_codecPlg.Query = _Query; - m_codecPlg.QueryIOSize = _QueryIOSize ; - m_codecPlg.Init = _Init; - m_codecPlg.Reset = _Reset; - m_codecPlg.Close = _Close; - m_codecPlg.GetAudioParam = _GetAudioParam; - } - MFXAudioCodecPluginAdapterBase(const MFXCodecPluginAdapterBase & that) - : MFXPluginAdapterBase(reinterpret_cast(that.m_mfxAPI.pthis), &m_codecPlg) - , m_codecPlg() { - SetupCallbacks(); - } - MFXAudioCodecPluginAdapterBase& operator = (const MFXAudioCodecPluginAdapterBase & that) { - MFXPluginAdapterBase :: SetupCallbacks(reinterpret_cast(that.m_mfxAPI.pthis), &m_codecPlg); - SetupCallbacks(); - return *this; - } - - private: - void SetupCallbacks() { - m_codecPlg.Query = _Query; - m_codecPlg.QueryIOSize = _QueryIOSize; - m_codecPlg.Init = _Init; - m_codecPlg.Reset = _Reset; - m_codecPlg.Close = _Close; - m_codecPlg.GetAudioParam = _GetAudioParam; - } - static mfxStatus _Query(mfxHDL pthis, mfxAudioParam *in, mfxAudioParam *out) { - return reinterpret_cast(pthis)->Query(in, out); - } - static mfxStatus _QueryIOSize(mfxHDL pthis, mfxAudioParam *par, mfxAudioAllocRequest *request){ - return reinterpret_cast(pthis)->QueryIOSize(par, request); - } - static mfxStatus _Init(mfxHDL pthis, mfxAudioParam *par){ - return reinterpret_cast(pthis)->Init(par); - } - static mfxStatus _Reset(mfxHDL pthis, mfxAudioParam *par){ - return reinterpret_cast(pthis)->Reset(par); - } - static mfxStatus _Close(mfxHDL pthis) { - return reinterpret_cast(pthis)->Close(); - } - static mfxStatus _GetAudioParam(mfxHDL pthis, mfxAudioParam *par) { - return reinterpret_cast(pthis)->GetAudioParam(par); - } - }; - - template - struct MFXPluginAdapterInternal{}; - template<> - class MFXPluginAdapterInternal : public MFXPluginAdapterBase - { - public: - MFXPluginAdapterInternal(MFXGenericPlugin *pPlugin) - : MFXPluginAdapterBase(pPlugin) - { - m_mfxAPI.Submit = _Submit; - } - MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that ) - : MFXPluginAdapterBase(that) { - m_mfxAPI.Submit = that._Submit; - } - MFXPluginAdapterInternal& operator = (const MFXPluginAdapterInternal & that) { - MFXPluginAdapterBase::operator=(that); - m_mfxAPI.Submit = that._Submit; - return *this; - } - - private: - static mfxStatus _Submit(mfxHDL pthis, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxThreadTask *task) { - return reinterpret_cast(pthis)->Submit(in, in_num, out, out_num, task); - } - }; - - template<> - class MFXPluginAdapterInternal : public MFXCodecPluginAdapterBase - { - public: - MFXPluginAdapterInternal(MFXDecoderPlugin *pPlugin) - : MFXCodecPluginAdapterBase(pPlugin) - { - SetupCallbacks(); - } - - MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that) - : MFXCodecPluginAdapterBase(that) { - SetupCallbacks(); - } - - MFXPluginAdapterInternal& operator = (const MFXPluginAdapterInternal & that) { - MFXCodecPluginAdapterBase::operator=(that); - SetupCallbacks(); - return *this; - } - - private: - void SetupCallbacks() { - m_codecPlg.DecodeHeader = _DecodeHeader; - m_codecPlg.GetPayload = _GetPayload; - m_codecPlg.DecodeFrameSubmit = _DecodeFrameSubmit; - } - static mfxStatus _DecodeHeader(mfxHDL pthis, mfxBitstream *bs, mfxVideoParam *par) { - return reinterpret_cast(pthis)->DecodeHeader(bs, par); - } - static mfxStatus _GetPayload(mfxHDL pthis, mfxU64 *ts, mfxPayload *payload) { - return reinterpret_cast(pthis)->GetPayload(ts, payload); - } - static mfxStatus _DecodeFrameSubmit(mfxHDL pthis, mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task) { - return reinterpret_cast(pthis)->DecodeFrameSubmit(bs, surface_work, surface_out, task); - } - }; - - template<> - class MFXPluginAdapterInternal : public MFXAudioCodecPluginAdapterBase - { - public: - MFXPluginAdapterInternal(MFXAudioDecoderPlugin *pPlugin) - : MFXAudioCodecPluginAdapterBase(pPlugin) - { - SetupCallbacks(); - } - - MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that) - : MFXAudioCodecPluginAdapterBase(that) { - SetupCallbacks(); - } - - MFXPluginAdapterInternal& operator = (const MFXPluginAdapterInternal & that) { - MFXAudioCodecPluginAdapterBase::operator=(that); - SetupCallbacks(); - return *this; - } - - private: - void SetupCallbacks() { - m_codecPlg.DecodeHeader = _DecodeHeader; - m_codecPlg.DecodeFrameSubmit = _DecodeFrameSubmit; - } - static mfxStatus _DecodeHeader(mfxHDL pthis, mfxBitstream *bs, mfxAudioParam *par) { - return reinterpret_cast(pthis)->DecodeHeader(bs, par); - } - static mfxStatus _DecodeFrameSubmit(mfxHDL pthis, mfxBitstream *in, mfxAudioFrame *out, mfxThreadTask *task) { - return reinterpret_cast(pthis)->DecodeFrameSubmit(in, out, task); - } - }; - - template<> - class MFXPluginAdapterInternal : public MFXCodecPluginAdapterBase - { - public: - MFXPluginAdapterInternal(MFXEncoderPlugin *pPlugin) - : MFXCodecPluginAdapterBase(pPlugin) - { - m_codecPlg.EncodeFrameSubmit = _EncodeFrameSubmit; - } - MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that) - : MFXCodecPluginAdapterBase(that) { - m_codecPlg.EncodeFrameSubmit = _EncodeFrameSubmit; - } - - MFXPluginAdapterInternal& operator = (const MFXPluginAdapterInternal & that) { - MFXCodecPluginAdapterBase::operator = (that); - m_codecPlg.EncodeFrameSubmit = _EncodeFrameSubmit; - return *this; - } - - private: - static mfxStatus _EncodeFrameSubmit(mfxHDL pthis, mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxThreadTask *task) { - return reinterpret_cast(pthis)->EncodeFrameSubmit(ctrl, surface, bs, task); - } - }; - - template<> - class MFXPluginAdapterInternal : public MFXAudioCodecPluginAdapterBase - { - public: - MFXPluginAdapterInternal(MFXAudioEncoderPlugin *pPlugin) - : MFXAudioCodecPluginAdapterBase(pPlugin) - { - SetupCallbacks(); - } - - MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that) - : MFXAudioCodecPluginAdapterBase(that) { - SetupCallbacks(); - } - - MFXPluginAdapterInternal& operator = (const MFXPluginAdapterInternal & that) { - MFXAudioCodecPluginAdapterBase::operator=(that); - SetupCallbacks(); - return *this; - } - - private: - void SetupCallbacks() { - m_codecPlg.EncodeFrameSubmit = _EncodeFrameSubmit; - } - static mfxStatus _EncodeFrameSubmit(mfxHDL pthis, mfxAudioFrame *aFrame, mfxBitstream *out, mfxThreadTask *task) { - return reinterpret_cast(pthis)->EncodeFrameSubmit(aFrame, out, task); - } - }; - - template<> - class MFXPluginAdapterInternal : public MFXCodecPluginAdapterBase - { - public: - MFXPluginAdapterInternal(MFXEncPlugin *pPlugin) - : MFXCodecPluginAdapterBase(pPlugin) - { - m_codecPlg.ENCFrameSubmit = _ENCFrameSubmit; - } - MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that) - : MFXCodecPluginAdapterBase(that) { - m_codecPlg.ENCFrameSubmit = _ENCFrameSubmit; - } - - MFXPluginAdapterInternal& operator = (const MFXPluginAdapterInternal & that) { - MFXCodecPluginAdapterBase::operator = (that); - m_codecPlg.ENCFrameSubmit = _ENCFrameSubmit; - return *this; - } - - private: - static mfxStatus _ENCFrameSubmit(mfxHDL pthis,mfxENCInput *in, mfxENCOutput *out, mfxThreadTask *task) { - return reinterpret_cast(pthis)->EncFrameSubmit(in, out, task); - } - }; - - - template<> - class MFXPluginAdapterInternal : public MFXCodecPluginAdapterBase - { - public: - MFXPluginAdapterInternal(MFXVPPPlugin *pPlugin) - : MFXCodecPluginAdapterBase(pPlugin) - { - SetupCallbacks(); - } - MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that) - : MFXCodecPluginAdapterBase(that) { - SetupCallbacks(); - } - - MFXPluginAdapterInternal& operator = (const MFXPluginAdapterInternal & that) { - MFXCodecPluginAdapterBase::operator = (that); - SetupCallbacks(); - return *this; - } - - private: - void SetupCallbacks() { - m_codecPlg.VPPFrameSubmit = _VPPFrameSubmit; - m_codecPlg.VPPFrameSubmitEx = _VPPFrameSubmitEx; - } - static mfxStatus _VPPFrameSubmit(mfxHDL pthis, mfxFrameSurface1 *surface_in, mfxFrameSurface1 *surface_out, mfxExtVppAuxData *aux, mfxThreadTask *task) { - return reinterpret_cast(pthis)->VPPFrameSubmit(surface_in, surface_out, aux, task); - } - static mfxStatus _VPPFrameSubmitEx(mfxHDL pthis, mfxFrameSurface1 *surface_in, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task) { - return reinterpret_cast(pthis)->VPPFrameSubmitEx(surface_in, surface_work, surface_out, task); - } - }; -} - -/* adapter for particular plugin type*/ -template -class MFXPluginAdapter -{ -public: - detail::MFXPluginAdapterInternal m_Adapter; - - operator mfxPlugin () const { - return m_Adapter.operator mfxPlugin(); - } - - MFXPluginAdapter(T* pPlugin = NULL) - : m_Adapter(pPlugin) - { - } -}; - -template -inline MFXPluginAdapter make_mfx_plugin_adapter(T* pPlugin) { - - MFXPluginAdapter adapt(pPlugin); - return adapt; -} - -#endif // __MFXPLUGINPLUSPLUS_H diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxplugin.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxplugin.h deleted file mode 100644 index 01b3d5c2a..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxplugin.h +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) 2018-2019 Intel Corporation -// -// 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 __MFXPLUGIN_H__ -#define __MFXPLUGIN_H__ -#include "mfxvideo.h" -#include "mfxaudio.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU8 Data[16]; -} mfxPluginUID; -MFX_PACK_END() - -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCD_SW = {{0x15, 0xdd, 0x93, 0x68, 0x25, 0xad, 0x47, 0x5e, 0xa3, 0x4e, 0x35, 0xf3, 0xf5, 0x42, 0x17, 0xa6}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCD_HW = {{0x33, 0xa6, 0x1c, 0x0b, 0x4c, 0x27, 0x45, 0x4c, 0xa8, 0xd8, 0x5d, 0xde, 0x75, 0x7c, 0x6f, 0x8e}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCE_SW = {{0x2f, 0xca, 0x99, 0x74, 0x9f, 0xdb, 0x49, 0xae, 0xb1, 0x21, 0xa5, 0xb6, 0x3e, 0xf5, 0x68, 0xf7}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCE_GACC = {{0xe5, 0x40, 0x0a, 0x06, 0xc7, 0x4d, 0x41, 0xf5, 0xb1, 0x2d, 0x43, 0x0b, 0xba, 0xa2, 0x3d, 0x0b}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCE_DP_GACC = {{0x2b, 0xad, 0x6f, 0x9d, 0x77, 0x54, 0x41, 0x2d, 0xbf, 0x63, 0x03, 0xed, 0x4b, 0xb5, 0x09, 0x68}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCE_HW = {{0x6f, 0xad, 0xc7, 0x91, 0xa0, 0xc2, 0xeb, 0x47, 0x9a, 0xb6, 0xdc, 0xd5, 0xea, 0x9d, 0xa3, 0x47}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_VP8D_HW = {{0xf6, 0x22, 0x39, 0x4d, 0x8d, 0x87, 0x45, 0x2f, 0x87, 0x8c, 0x51, 0xf2, 0xfc, 0x9b, 0x41, 0x31}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_VP8E_HW = {{0xbf, 0xfc, 0x51, 0x8c, 0xde, 0x13, 0x4d, 0xf9, 0x8a, 0x96, 0xf4, 0xcf, 0x81, 0x6c, 0x0f, 0xac}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_VP9E_HW = {{0xce, 0x44, 0xef, 0x6f, 0x1a, 0x6d, 0x22, 0x46, 0xb4, 0x12, 0xbb, 0x38, 0xd6, 0xe4, 0x51, 0x82}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_VP9D_HW = {{0xa9, 0x22, 0x39, 0x4d, 0x8d, 0x87, 0x45, 0x2f, 0x87, 0x8c, 0x51, 0xf2, 0xfc, 0x9b, 0x41, 0x31}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_CAMERA_HW = {{0x54, 0x54, 0x26, 0x16, 0x24, 0x33, 0x41, 0xe6, 0x93, 0xae, 0x89, 0x99, 0x42, 0xce, 0x73, 0x55}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_CAPTURE_HW = {{0x22, 0xd6, 0x2c, 0x07, 0xe6, 0x72, 0x40, 0x8f, 0xbb, 0x4c, 0xc2, 0x0e, 0xd7, 0xa0, 0x53, 0xe4}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_ITELECINE_HW = {{0xe7, 0x44, 0x75, 0x3a, 0xcd, 0x74, 0x40, 0x2e, 0x89, 0xa2, 0xee, 0x06, 0x35, 0x49, 0x61, 0x79}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_H264LA_HW = {{0x58, 0x8f, 0x11, 0x85, 0xd4, 0x7b, 0x42, 0x96, 0x8d, 0xea, 0x37, 0x7b, 0xb5, 0xd0, 0xdc, 0xb4}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_AACD = {{0xe9, 0x34, 0x67, 0x25, 0xac, 0x2f, 0x4c, 0x93, 0xaa, 0x58, 0x5c, 0x11, 0xc7, 0x08, 0x7c, 0xf4}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_AACE = {{0xb2, 0xa2, 0xa0, 0x5a, 0x4e, 0xac, 0x46, 0xbf, 0xa9, 0xde, 0x7e, 0x80, 0xc9, 0x8d, 0x2e, 0x18}}; -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCE_FEI_HW = {{0x87, 0xe0, 0xe8, 0x02, 0x07, 0x37, 0x52, 0x40, 0x85, 0x25, 0x15, 0xcf, 0x4a, 0x5e, 0xdd, 0xe6}}; -#if (MFX_VERSION >= 1027) -MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVC_FEI_ENCODE = {{0x54, 0x18, 0xa7, 0x06, 0x66, 0xf9, 0x4d, 0x5c, 0xb4, 0xf7, 0xb1, 0xca, 0xee, 0x86, 0x33, 0x9b}}; -#endif - - -typedef enum { - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_VIDEO_GENERAL) = 0, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_VIDEO_DECODE) = 1, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_VIDEO_ENCODE) = 2, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_VIDEO_VPP) = 3, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_VIDEO_ENC) = 4, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_AUDIO_DECODE) = 5, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_AUDIO_ENCODE) = 6 -} mfxPluginType; - -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_VIDEO_GENERAL); -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_VIDEO_DECODE); -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_VIDEO_ENCODE); -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_VIDEO_VPP); -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_VIDEO_ENC); -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_AUDIO_DECODE); -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_AUDIO_ENCODE); - -typedef enum { - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_THREADPOLICY_SERIAL) = 0, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_THREADPOLICY_PARALLEL) = 1 -} mfxThreadPolicy; - -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_THREADPOLICY_SERIAL); -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_THREADPOLICY_PARALLEL); - -MFX_PACK_BEGIN_USUAL_STRUCT() -MFX_DEPRECATED typedef struct mfxPluginParam { - mfxU32 reserved[6]; - mfxU16 reserved1; - mfxU16 PluginVersion; - mfxVersion APIVersion; - mfxPluginUID PluginUID; - mfxU32 Type; - mfxU32 CodecId; - mfxThreadPolicy ThreadPolicy; - mfxU32 MaxThreadNum; -} mfxPluginParam; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -MFX_DEPRECATED typedef struct mfxCoreParam{ - mfxU32 reserved[13]; - mfxIMPL Impl; - mfxVersion Version; - mfxU32 NumWorkingThread; -} mfxCoreParam; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -MFX_DEPRECATED typedef struct mfxCoreInterface { - mfxHDL pthis; - - mfxHDL reserved1[2]; - mfxFrameAllocator FrameAllocator; - mfxBufferAllocator reserved3; - - mfxStatus (MFX_CDECL *GetCoreParam)(mfxHDL pthis, mfxCoreParam *par); - mfxStatus (MFX_CDECL *GetHandle) (mfxHDL pthis, mfxHandleType type, mfxHDL *handle); - mfxStatus (MFX_CDECL *IncreaseReference) (mfxHDL pthis, mfxFrameData *fd); - mfxStatus (MFX_CDECL *DecreaseReference) (mfxHDL pthis, mfxFrameData *fd); - mfxStatus (MFX_CDECL *CopyFrame) (mfxHDL pthis, mfxFrameSurface1 *dst, mfxFrameSurface1 *src); - mfxStatus (MFX_CDECL *CopyBuffer)(mfxHDL pthis, mfxU8 *dst, mfxU32 size, mfxFrameSurface1 *src); - - mfxStatus (MFX_CDECL *MapOpaqueSurface)(mfxHDL pthis, mfxU32 num, mfxU32 type, mfxFrameSurface1 **op_surf); - mfxStatus (MFX_CDECL *UnmapOpaqueSurface)(mfxHDL pthis, mfxU32 num, mfxU32 type, mfxFrameSurface1 **op_surf); - - mfxStatus (MFX_CDECL *GetRealSurface)(mfxHDL pthis, mfxFrameSurface1 *op_surf, mfxFrameSurface1 **surf); - mfxStatus (MFX_CDECL *GetOpaqueSurface)(mfxHDL pthis, mfxFrameSurface1 *surf, mfxFrameSurface1 **op_surf); - - mfxStatus (MFX_CDECL *CreateAccelerationDevice)(mfxHDL pthis, mfxHandleType type, mfxHDL *handle); - mfxStatus (MFX_CDECL *GetFrameHandle) (mfxHDL pthis, mfxFrameData *fd, mfxHDL *handle); - mfxStatus (MFX_CDECL *QueryPlatform) (mfxHDL pthis, mfxPlatform *platform); - - mfxHDL reserved4[1]; -} mfxCoreInterface; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -/* video codec plugin extension */ -MFX_DEPRECATED typedef struct _mfxENCInput mfxENCInput; -MFX_DEPRECATED typedef struct _mfxENCOutput mfxENCOutput; -MFX_DEPRECATED typedef struct mfxVideoCodecPlugin{ - mfxStatus (MFX_CDECL *Query)(mfxHDL pthis, mfxVideoParam *in, mfxVideoParam *out); - mfxStatus (MFX_CDECL *QueryIOSurf)(mfxHDL pthis, mfxVideoParam *par, mfxFrameAllocRequest *in, mfxFrameAllocRequest *out); - mfxStatus (MFX_CDECL *Init)(mfxHDL pthis, mfxVideoParam *par); - mfxStatus (MFX_CDECL *Reset)(mfxHDL pthis, mfxVideoParam *par); - mfxStatus (MFX_CDECL *Close)(mfxHDL pthis); - mfxStatus (MFX_CDECL *GetVideoParam)(mfxHDL pthis, mfxVideoParam *par); - - mfxStatus (MFX_CDECL *EncodeFrameSubmit)(mfxHDL pthis, mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxThreadTask *task); - - mfxStatus (MFX_CDECL *DecodeHeader)(mfxHDL pthis, mfxBitstream *bs, mfxVideoParam *par); - mfxStatus (MFX_CDECL *GetPayload)(mfxHDL pthis, mfxU64 *ts, mfxPayload *payload); - mfxStatus (MFX_CDECL *DecodeFrameSubmit)(mfxHDL pthis, mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task); - - mfxStatus (MFX_CDECL *VPPFrameSubmit)(mfxHDL pthis, mfxFrameSurface1 *in, mfxFrameSurface1 *out, mfxExtVppAuxData *aux, mfxThreadTask *task); - mfxStatus (MFX_CDECL *VPPFrameSubmitEx)(mfxHDL pthis, mfxFrameSurface1 *in, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task); - - mfxStatus (MFX_CDECL *ENCFrameSubmit)(mfxHDL pthis, mfxENCInput *in, mfxENCOutput *out, mfxThreadTask *task); - - mfxHDL reserved1[3]; - mfxU32 reserved2[8]; -} mfxVideoCodecPlugin; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -MFX_DEPRECATED typedef struct mfxAudioCodecPlugin{ - mfxStatus (MFX_CDECL *Query)(mfxHDL pthis, mfxAudioParam *in, mfxAudioParam *out); - mfxStatus (MFX_CDECL *QueryIOSize)(mfxHDL pthis, mfxAudioParam *par, mfxAudioAllocRequest *request); - mfxStatus (MFX_CDECL *Init)(mfxHDL pthis, mfxAudioParam *par); - mfxStatus (MFX_CDECL *Reset)(mfxHDL pthis, mfxAudioParam *par); - mfxStatus (MFX_CDECL *Close)(mfxHDL pthis); - mfxStatus (MFX_CDECL *GetAudioParam)(mfxHDL pthis, mfxAudioParam *par); - - mfxStatus (MFX_CDECL *EncodeFrameSubmit)(mfxHDL pthis, mfxAudioFrame *aFrame, mfxBitstream *out, mfxThreadTask *task); - - mfxStatus (MFX_CDECL *DecodeHeader)(mfxHDL pthis, mfxBitstream *bs, mfxAudioParam *par); -// mfxStatus (MFX_CDECL *GetPayload)(mfxHDL pthis, mfxU64 *ts, mfxPayload *payload); - mfxStatus (MFX_CDECL *DecodeFrameSubmit)(mfxHDL pthis, mfxBitstream *in, mfxAudioFrame *out, mfxThreadTask *task); - - mfxHDL reserved1[6]; - mfxU32 reserved2[8]; -} mfxAudioCodecPlugin; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -MFX_DEPRECATED typedef struct mfxPlugin{ - mfxHDL pthis; - - mfxStatus (MFX_CDECL *PluginInit) (mfxHDL pthis, mfxCoreInterface *core); - mfxStatus (MFX_CDECL *PluginClose) (mfxHDL pthis); - - mfxStatus (MFX_CDECL *GetPluginParam)(mfxHDL pthis, mfxPluginParam *par); - - mfxStatus (MFX_CDECL *Submit)(mfxHDL pthis, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxThreadTask *task); - mfxStatus (MFX_CDECL *Execute)(mfxHDL pthis, mfxThreadTask task, mfxU32 uid_p, mfxU32 uid_a); - mfxStatus (MFX_CDECL *FreeResources)(mfxHDL pthis, mfxThreadTask task, mfxStatus sts); - - union { - mfxVideoCodecPlugin *Video; - mfxAudioCodecPlugin *Audio; - }; - - mfxHDL reserved[8]; -} mfxPlugin; -MFX_PACK_END() - - -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_Register(mfxSession session, mfxU32 type, const mfxPlugin *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_Unregister(mfxSession session, mfxU32 type); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_GetPlugin(mfxSession session, mfxU32 type, mfxPlugin *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_ProcessFrameAsync(mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp); - -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_LoadByPath(mfxSession session, const mfxPluginUID *uid, mfxU32 version, const mfxChar *path, mfxU32 len); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_UnLoad(mfxSession session, const mfxPluginUID *uid); - -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioUSER_Register(mfxSession session, mfxU32 type, const mfxPlugin *par); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioUSER_Unregister(mfxSession session, mfxU32 type); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioUSER_ProcessFrameAsync(mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp); - -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioUSER_UnLoad(mfxSession session, const mfxPluginUID *uid); - -#ifdef __cplusplus -} // extern "C" -#endif /* __cplusplus */ - -#endif /* __MFXPLUGIN_H__ */ diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxsession.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxsession.h deleted file mode 100644 index 2d7330426..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxsession.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) 2017 Intel Corporation -// -// 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 __MFXSESSION_H__ -#define __MFXSESSION_H__ -#include "mfxcommon.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* Global Functions */ -typedef struct _mfxSession *mfxSession; -mfxStatus MFX_CDECL MFXInit(mfxIMPL impl, mfxVersion *ver, mfxSession *session); -mfxStatus MFX_CDECL MFXInitEx(mfxInitParam par, mfxSession *session); -mfxStatus MFX_CDECL MFXClose(mfxSession session); - -mfxStatus MFX_CDECL MFXQueryIMPL(mfxSession session, mfxIMPL *impl); -mfxStatus MFX_CDECL MFXQueryVersion(mfxSession session, mfxVersion *version); - -mfxStatus MFX_CDECL MFXJoinSession(mfxSession session, mfxSession child); -mfxStatus MFX_CDECL MFXDisjoinSession(mfxSession session); -mfxStatus MFX_CDECL MFXCloneSession(mfxSession session, mfxSession *clone); -mfxStatus MFX_CDECL MFXSetPriority(mfxSession session, mfxPriority priority); -mfxStatus MFX_CDECL MFXGetPriority(mfxSession session, mfxPriority *priority); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXDoWork(mfxSession session); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif - diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxstructures.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxstructures.h deleted file mode 100644 index d4b8b96bf..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxstructures.h +++ /dev/null @@ -1,2521 +0,0 @@ -// Copyright (c) 2018-2020 Intel Corporation -// -// 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 __MFXSTRUCTURES_H__ -#define __MFXSTRUCTURES_H__ -#include "mfxcommon.h" - -#if !defined (__GNUC__) -#pragma warning(disable: 4201) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Frame ID for SVC and MVC */ -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU16 TemporalId; - mfxU16 PriorityId; - union { - struct { - mfxU16 DependencyId; - mfxU16 QualityId; - }; - struct { - mfxU16 ViewId; - }; - }; -} mfxFrameId; -MFX_PACK_END() - -/* This struct has 4-byte alignment for binary compatibility with previously released versions of API */ -MFX_PACK_BEGIN_USUAL_STRUCT() -/* Frame Info */ -typedef struct { - mfxU32 reserved[4]; - mfxU16 reserved4; - mfxU16 BitDepthLuma; - mfxU16 BitDepthChroma; - mfxU16 Shift; - - mfxFrameId FrameId; - - mfxU32 FourCC; - union { - struct { /* Frame parameters */ - mfxU16 Width; - mfxU16 Height; - - mfxU16 CropX; - mfxU16 CropY; - mfxU16 CropW; - mfxU16 CropH; - }; - struct { /* Buffer parameters (for plain formats like P8) */ - mfxU64 BufferSize; - mfxU32 reserved5; - }; - }; - - mfxU32 FrameRateExtN; - mfxU32 FrameRateExtD; - mfxU16 reserved3; - - mfxU16 AspectRatioW; - mfxU16 AspectRatioH; - - mfxU16 PicStruct; - mfxU16 ChromaFormat; - mfxU16 reserved2; -} mfxFrameInfo; -MFX_PACK_END() - -/* FourCC */ -enum { - MFX_FOURCC_NV12 = MFX_MAKEFOURCC('N','V','1','2'), /* Native Format */ - MFX_FOURCC_YV12 = MFX_MAKEFOURCC('Y','V','1','2'), - MFX_FOURCC_NV16 = MFX_MAKEFOURCC('N','V','1','6'), - MFX_FOURCC_YUY2 = MFX_MAKEFOURCC('Y','U','Y','2'), -#if (MFX_VERSION >= 1028) - MFX_FOURCC_RGB565 = MFX_MAKEFOURCC('R','G','B','2'), /* 2 bytes per pixel, uint16 in little-endian format, where 0-4 bits are blue, bits 5-10 are green and bits 11-15 are red */ - MFX_FOURCC_RGBP = MFX_MAKEFOURCC('R','G','B','P'), -#endif - MFX_FOURCC_RGB3 = MFX_MAKEFOURCC('R','G','B','3'), /* deprecated */ - MFX_FOURCC_RGB4 = MFX_MAKEFOURCC('R','G','B','4'), /* ARGB in that order, A channel is 8 MSBs */ - MFX_FOURCC_P8 = 41, /* D3DFMT_P8 */ - MFX_FOURCC_P8_TEXTURE = MFX_MAKEFOURCC('P','8','M','B'), - MFX_FOURCC_P010 = MFX_MAKEFOURCC('P','0','1','0'), -#if (MFX_VERSION >= 1031) - MFX_FOURCC_P016 = MFX_MAKEFOURCC('P','0','1','6'), -#endif - MFX_FOURCC_P210 = MFX_MAKEFOURCC('P','2','1','0'), - MFX_FOURCC_BGR4 = MFX_MAKEFOURCC('B','G','R','4'), /* ABGR in that order, A channel is 8 MSBs */ - MFX_FOURCC_A2RGB10 = MFX_MAKEFOURCC('R','G','1','0'), /* ARGB in that order, A channel is two MSBs */ - MFX_FOURCC_ARGB16 = MFX_MAKEFOURCC('R','G','1','6'), /* ARGB in that order, 64 bits, A channel is 16 MSBs */ - MFX_FOURCC_ABGR16 = MFX_MAKEFOURCC('B','G','1','6'), /* ABGR in that order, 64 bits, A channel is 16 MSBs */ - MFX_FOURCC_R16 = MFX_MAKEFOURCC('R','1','6','U'), - MFX_FOURCC_AYUV = MFX_MAKEFOURCC('A','Y','U','V'), /* YUV 4:4:4, AYUV in that order, A channel is 8 MSBs */ - MFX_FOURCC_AYUV_RGB4 = MFX_MAKEFOURCC('A','V','U','Y'), /* ARGB in that order, A channel is 8 MSBs stored in AYUV surface*/ - MFX_FOURCC_UYVY = MFX_MAKEFOURCC('U','Y','V','Y'), -#if (MFX_VERSION >= 1027) - MFX_FOURCC_Y210 = MFX_MAKEFOURCC('Y','2','1','0'), - MFX_FOURCC_Y410 = MFX_MAKEFOURCC('Y','4','1','0'), -#endif -#if (MFX_VERSION >= 1031) - MFX_FOURCC_Y216 = MFX_MAKEFOURCC('Y','2','1','6'), - MFX_FOURCC_Y416 = MFX_MAKEFOURCC('Y','4','1','6'), -#endif - MFX_FOURCC_NV21 = MFX_MAKEFOURCC('N', 'V', '2', '1'), /* Same as NV12 but with weaved V and U values. */ - MFX_FOURCC_IYUV = MFX_MAKEFOURCC('I', 'Y', 'U', 'V'), /* Same as YV12 except that the U and V plane order is reversed. */ - MFX_FOURCC_I010 = MFX_MAKEFOURCC('I', '0', '1', '0'), /* 10-bit YUV 4:2:0, each component has its own plane. */ -}; - -/* PicStruct */ -enum { - MFX_PICSTRUCT_UNKNOWN =0x00, - MFX_PICSTRUCT_PROGRESSIVE =0x01, - MFX_PICSTRUCT_FIELD_TFF =0x02, - MFX_PICSTRUCT_FIELD_BFF =0x04, - - MFX_PICSTRUCT_FIELD_REPEATED=0x10, /* first field repeated, pic_struct=5 or 6 in H.264 */ - MFX_PICSTRUCT_FRAME_DOUBLING=0x20, /* pic_struct=7 in H.264 */ - MFX_PICSTRUCT_FRAME_TRIPLING=0x40, /* pic_struct=8 in H.264 */ - - MFX_PICSTRUCT_FIELD_SINGLE =0x100, - MFX_PICSTRUCT_FIELD_TOP =MFX_PICSTRUCT_FIELD_SINGLE | MFX_PICSTRUCT_FIELD_TFF, - MFX_PICSTRUCT_FIELD_BOTTOM =MFX_PICSTRUCT_FIELD_SINGLE | MFX_PICSTRUCT_FIELD_BFF, - MFX_PICSTRUCT_FIELD_PAIRED_PREV =0x200, - MFX_PICSTRUCT_FIELD_PAIRED_NEXT =0x400, -}; - -/* ColorFormat */ -enum { - MFX_CHROMAFORMAT_MONOCHROME =0, - MFX_CHROMAFORMAT_YUV420 =1, - MFX_CHROMAFORMAT_YUV422 =2, - MFX_CHROMAFORMAT_YUV444 =3, - MFX_CHROMAFORMAT_YUV400 = MFX_CHROMAFORMAT_MONOCHROME, - MFX_CHROMAFORMAT_YUV411 = 4, - MFX_CHROMAFORMAT_YUV422H = MFX_CHROMAFORMAT_YUV422, - MFX_CHROMAFORMAT_YUV422V = 5, - MFX_CHROMAFORMAT_RESERVED1 = 6 -}; - -enum { - MFX_TIMESTAMP_UNKNOWN = -1 -}; - -enum { - MFX_FRAMEORDER_UNKNOWN = -1 -}; - -/* DataFlag in mfxFrameData */ -enum { - MFX_FRAMEDATA_ORIGINAL_TIMESTAMP = 0x0001 -}; - -/* Corrupted in mfxFrameData */ -enum { - MFX_CORRUPTION_MINOR = 0x0001, - MFX_CORRUPTION_MAJOR = 0x0002, - MFX_CORRUPTION_ABSENT_TOP_FIELD = 0x0004, - MFX_CORRUPTION_ABSENT_BOTTOM_FIELD = 0x0008, - MFX_CORRUPTION_REFERENCE_FRAME = 0x0010, - MFX_CORRUPTION_REFERENCE_LIST = 0x0020 -}; - -#if (MFX_VERSION >= 1027) -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct -{ - mfxU32 U : 10; - mfxU32 Y : 10; - mfxU32 V : 10; - mfxU32 A : 2; -} mfxY410; -MFX_PACK_END() -#endif - -#if (MFX_VERSION >= 1025) -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct -{ - mfxU32 B : 10; - mfxU32 G : 10; - mfxU32 R : 10; - mfxU32 A : 2; -} mfxA2RGB10; -MFX_PACK_END() -#endif - -/* Frame Data Info */ -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - union { - mfxExtBuffer **ExtParam; - mfxU64 reserved2; - }; - mfxU16 NumExtParam; - - mfxU16 reserved[9]; - mfxU16 MemType; - mfxU16 PitchHigh; - - mfxU64 TimeStamp; - mfxU32 FrameOrder; - mfxU16 Locked; - union{ - mfxU16 Pitch; - mfxU16 PitchLow; - }; - - /* color planes */ - union { - mfxU8 *Y; - mfxU16 *Y16; - mfxU8 *R; - }; - union { - mfxU8 *UV; /* for UV merged formats */ - mfxU8 *VU; /* for VU merged formats */ - mfxU8 *CbCr; /* for CbCr merged formats */ - mfxU8 *CrCb; /* for CrCb merged formats */ - mfxU8 *Cb; - mfxU8 *U; - mfxU16 *U16; - mfxU8 *G; -#if (MFX_VERSION >= 1027) - mfxY410 *Y410; /* for Y410 format (merged AVYU) */ -#endif - }; - union { - mfxU8 *Cr; - mfxU8 *V; - mfxU16 *V16; - mfxU8 *B; -#if (MFX_VERSION >= 1025) - mfxA2RGB10 *A2RGB10; /* for A2RGB10 format (merged ARGB) */ -#endif - }; - mfxU8 *A; - mfxMemId MemId; - - /* Additional Flags */ - mfxU16 Corrupted; - mfxU16 DataFlag; -} mfxFrameData; -MFX_PACK_END() - -/* Frame Surface */ -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - mfxU32 reserved[4]; - mfxFrameInfo Info; - mfxFrameData Data; -} mfxFrameSurface1; -MFX_PACK_END() - -enum { - MFX_TIMESTAMPCALC_UNKNOWN = 0, - MFX_TIMESTAMPCALC_TELECINE = 1, -}; - -/* Transcoding Info */ -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU32 reserved[7]; - - mfxU16 LowPower; - mfxU16 BRCParamMultiplier; - - mfxFrameInfo FrameInfo; - mfxU32 CodecId; - mfxU16 CodecProfile; - mfxU16 CodecLevel; - mfxU16 NumThread; - - union { - struct { /* Encoding Options */ - mfxU16 TargetUsage; - - mfxU16 GopPicSize; - mfxU16 GopRefDist; - mfxU16 GopOptFlag; - mfxU16 IdrInterval; - - mfxU16 RateControlMethod; - union { - mfxU16 InitialDelayInKB; - mfxU16 QPI; - mfxU16 Accuracy; - }; - mfxU16 BufferSizeInKB; - union { - mfxU16 TargetKbps; - mfxU16 QPP; - mfxU16 ICQQuality; - }; - union { - mfxU16 MaxKbps; - mfxU16 QPB; - mfxU16 Convergence; - }; - - mfxU16 NumSlice; - mfxU16 NumRefFrame; - mfxU16 EncodedOrder; - }; - struct { /* Decoding Options */ - mfxU16 DecodedOrder; - mfxU16 ExtendedPicStruct; - mfxU16 TimeStampCalc; - mfxU16 SliceGroupsPresent; - mfxU16 MaxDecFrameBuffering; - mfxU16 EnableReallocRequest; -#if (MFX_VERSION >= 1034) - mfxU16 FilmGrain; - mfxU16 IgnoreLevelConstrain; - mfxU16 reserved2[5]; -#else - mfxU16 reserved2[7]; -#endif - }; - struct { /* JPEG Decoding Options */ - mfxU16 JPEGChromaFormat; - mfxU16 Rotation; - mfxU16 JPEGColorFormat; - mfxU16 InterleavedDec; - mfxU8 SamplingFactorH[4]; - mfxU8 SamplingFactorV[4]; - mfxU16 reserved3[5]; - }; - struct { /* JPEG Encoding Options */ - mfxU16 Interleaved; - mfxU16 Quality; - mfxU16 RestartInterval; - mfxU16 reserved5[10]; - }; - }; -} mfxInfoMFX; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU32 reserved[8]; - mfxFrameInfo In; - mfxFrameInfo Out; -} mfxInfoVPP; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxU32 AllocId; - mfxU32 reserved[2]; - mfxU16 reserved3; - mfxU16 AsyncDepth; - - union { - mfxInfoMFX mfx; - mfxInfoVPP vpp; - }; - mfxU16 Protected; - mfxU16 IOPattern; - mfxExtBuffer** ExtParam; - mfxU16 NumExtParam; - mfxU16 reserved2; -} mfxVideoParam; -MFX_PACK_END() - -/* IOPattern */ -enum { - MFX_IOPATTERN_IN_VIDEO_MEMORY = 0x01, - MFX_IOPATTERN_IN_SYSTEM_MEMORY = 0x02, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_IOPATTERN_IN_OPAQUE_MEMORY) = 0x04, - MFX_IOPATTERN_OUT_VIDEO_MEMORY = 0x10, - MFX_IOPATTERN_OUT_SYSTEM_MEMORY = 0x20, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_IOPATTERN_OUT_OPAQUE_MEMORY) = 0x40 -}; - -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_IOPATTERN_IN_OPAQUE_MEMORY); -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_IOPATTERN_OUT_OPAQUE_MEMORY); - -/* CodecId */ -enum { - MFX_CODEC_AVC =MFX_MAKEFOURCC('A','V','C',' '), - MFX_CODEC_HEVC =MFX_MAKEFOURCC('H','E','V','C'), - MFX_CODEC_MPEG2 =MFX_MAKEFOURCC('M','P','G','2'), - MFX_CODEC_VC1 =MFX_MAKEFOURCC('V','C','1',' '), - MFX_CODEC_CAPTURE =MFX_MAKEFOURCC('C','A','P','T'), - MFX_CODEC_VP9 =MFX_MAKEFOURCC('V','P','9',' '), - MFX_CODEC_AV1 =MFX_MAKEFOURCC('A','V','1',' ') -}; - -/* CodecProfile, CodecLevel */ -enum { - MFX_PROFILE_UNKNOWN =0, - MFX_LEVEL_UNKNOWN =0, - - /* AVC Profiles & Levels */ - MFX_PROFILE_AVC_CONSTRAINT_SET0 = (0x100 << 0), - MFX_PROFILE_AVC_CONSTRAINT_SET1 = (0x100 << 1), - MFX_PROFILE_AVC_CONSTRAINT_SET2 = (0x100 << 2), - MFX_PROFILE_AVC_CONSTRAINT_SET3 = (0x100 << 3), - MFX_PROFILE_AVC_CONSTRAINT_SET4 = (0x100 << 4), - MFX_PROFILE_AVC_CONSTRAINT_SET5 = (0x100 << 5), - - MFX_PROFILE_AVC_BASELINE =66, - MFX_PROFILE_AVC_MAIN =77, - MFX_PROFILE_AVC_EXTENDED =88, - MFX_PROFILE_AVC_HIGH =100, - MFX_PROFILE_AVC_HIGH10 =110, - MFX_PROFILE_AVC_HIGH_422 =122, - MFX_PROFILE_AVC_CONSTRAINED_BASELINE =MFX_PROFILE_AVC_BASELINE + MFX_PROFILE_AVC_CONSTRAINT_SET1, - MFX_PROFILE_AVC_CONSTRAINED_HIGH =MFX_PROFILE_AVC_HIGH + MFX_PROFILE_AVC_CONSTRAINT_SET4 - + MFX_PROFILE_AVC_CONSTRAINT_SET5, - MFX_PROFILE_AVC_PROGRESSIVE_HIGH =MFX_PROFILE_AVC_HIGH + MFX_PROFILE_AVC_CONSTRAINT_SET4, - - MFX_LEVEL_AVC_1 =10, - MFX_LEVEL_AVC_1b =9, - MFX_LEVEL_AVC_11 =11, - MFX_LEVEL_AVC_12 =12, - MFX_LEVEL_AVC_13 =13, - MFX_LEVEL_AVC_2 =20, - MFX_LEVEL_AVC_21 =21, - MFX_LEVEL_AVC_22 =22, - MFX_LEVEL_AVC_3 =30, - MFX_LEVEL_AVC_31 =31, - MFX_LEVEL_AVC_32 =32, - MFX_LEVEL_AVC_4 =40, - MFX_LEVEL_AVC_41 =41, - MFX_LEVEL_AVC_42 =42, - MFX_LEVEL_AVC_5 =50, - MFX_LEVEL_AVC_51 =51, - MFX_LEVEL_AVC_52 =52, -#if (MFX_VERSION >= 1035) - MFX_LEVEL_AVC_6 =60, - MFX_LEVEL_AVC_61 =61, - MFX_LEVEL_AVC_62 =62, -#endif - - /* MPEG-2 Profiles & Levels */ - MFX_PROFILE_MPEG2_SIMPLE =0x50, - MFX_PROFILE_MPEG2_MAIN =0x40, - MFX_PROFILE_MPEG2_HIGH =0x10, - - MFX_LEVEL_MPEG2_LOW =0xA, - MFX_LEVEL_MPEG2_MAIN =0x8, - MFX_LEVEL_MPEG2_HIGH =0x4, - MFX_LEVEL_MPEG2_HIGH1440 =0x6, - - /* VC1 Profiles & Levels */ - MFX_PROFILE_VC1_SIMPLE =(0+1), - MFX_PROFILE_VC1_MAIN =(4+1), - MFX_PROFILE_VC1_ADVANCED =(12+1), - - /* VC1 levels for simple & main profiles */ - MFX_LEVEL_VC1_LOW =(0+1), - MFX_LEVEL_VC1_MEDIAN =(2+1), - MFX_LEVEL_VC1_HIGH =(4+1), - - /* VC1 levels for the advanced profile */ - MFX_LEVEL_VC1_0 =(0x00+1), - MFX_LEVEL_VC1_1 =(0x01+1), - MFX_LEVEL_VC1_2 =(0x02+1), - MFX_LEVEL_VC1_3 =(0x03+1), - MFX_LEVEL_VC1_4 =(0x04+1), - - /* HEVC Profiles & Levels & Tiers */ - MFX_PROFILE_HEVC_MAIN =1, - MFX_PROFILE_HEVC_MAIN10 =2, - MFX_PROFILE_HEVC_MAINSP =3, - MFX_PROFILE_HEVC_REXT =4, -#if (MFX_VERSION >= 1032) - MFX_PROFILE_HEVC_SCC =9, -#endif - - MFX_LEVEL_HEVC_1 = 10, - MFX_LEVEL_HEVC_2 = 20, - MFX_LEVEL_HEVC_21 = 21, - MFX_LEVEL_HEVC_3 = 30, - MFX_LEVEL_HEVC_31 = 31, - MFX_LEVEL_HEVC_4 = 40, - MFX_LEVEL_HEVC_41 = 41, - MFX_LEVEL_HEVC_5 = 50, - MFX_LEVEL_HEVC_51 = 51, - MFX_LEVEL_HEVC_52 = 52, - MFX_LEVEL_HEVC_6 = 60, - MFX_LEVEL_HEVC_61 = 61, - MFX_LEVEL_HEVC_62 = 62, - - MFX_TIER_HEVC_MAIN = 0, - MFX_TIER_HEVC_HIGH = 0x100, - - /* VP9 Profiles */ - MFX_PROFILE_VP9_0 = 1, - MFX_PROFILE_VP9_1 = 2, - MFX_PROFILE_VP9_2 = 3, - MFX_PROFILE_VP9_3 = 4, - -#if (MFX_VERSION >= 1034) - /* AV1 Profiles */ - MFX_PROFILE_AV1_MAIN = 1, - MFX_PROFILE_AV1_HIGH = 2, - MFX_PROFILE_AV1_PRO = 3, - - MFX_LEVEL_AV1_2 = 20, - MFX_LEVEL_AV1_21 = 21, - MFX_LEVEL_AV1_22 = 22, - MFX_LEVEL_AV1_23 = 23, - MFX_LEVEL_AV1_3 = 30, - MFX_LEVEL_AV1_31 = 31, - MFX_LEVEL_AV1_32 = 32, - MFX_LEVEL_AV1_33 = 33, - MFX_LEVEL_AV1_4 = 40, - MFX_LEVEL_AV1_41 = 41, - MFX_LEVEL_AV1_42 = 42, - MFX_LEVEL_AV1_43 = 43, - MFX_LEVEL_AV1_5 = 50, - MFX_LEVEL_AV1_51 = 51, - MFX_LEVEL_AV1_52 = 52, - MFX_LEVEL_AV1_53 = 53, - MFX_LEVEL_AV1_6 = 60, - MFX_LEVEL_AV1_61 = 61, - MFX_LEVEL_AV1_62 = 62, - MFX_LEVEL_AV1_63 = 63, -#endif -}; - -/* GopOptFlag */ -enum { - MFX_GOP_CLOSED =1, - MFX_GOP_STRICT =2 -}; - -/* TargetUsages: from 1 to 7 inclusive */ -enum { - MFX_TARGETUSAGE_1 =1, - MFX_TARGETUSAGE_2 =2, - MFX_TARGETUSAGE_3 =3, - MFX_TARGETUSAGE_4 =4, - MFX_TARGETUSAGE_5 =5, - MFX_TARGETUSAGE_6 =6, - MFX_TARGETUSAGE_7 =7, - - MFX_TARGETUSAGE_UNKNOWN =0, - MFX_TARGETUSAGE_BEST_QUALITY =MFX_TARGETUSAGE_1, - MFX_TARGETUSAGE_BALANCED =MFX_TARGETUSAGE_4, - MFX_TARGETUSAGE_BEST_SPEED =MFX_TARGETUSAGE_7 -}; - -/* RateControlMethod */ -enum { - MFX_RATECONTROL_CBR =1, - MFX_RATECONTROL_VBR =2, - MFX_RATECONTROL_CQP =3, - MFX_RATECONTROL_AVBR =4, - MFX_RATECONTROL_RESERVED1 =5, - MFX_RATECONTROL_RESERVED2 =6, - MFX_RATECONTROL_RESERVED3 =100, - MFX_RATECONTROL_RESERVED4 =7, - MFX_RATECONTROL_LA =8, - MFX_RATECONTROL_ICQ =9, - MFX_RATECONTROL_VCM =10, - MFX_RATECONTROL_LA_ICQ =11, - MFX_RATECONTROL_LA_EXT =12, - MFX_RATECONTROL_LA_HRD =13, - MFX_RATECONTROL_QVBR =14, -}; - -/* Trellis control*/ -enum { - MFX_TRELLIS_UNKNOWN =0, - MFX_TRELLIS_OFF =0x01, - MFX_TRELLIS_I =0x02, - MFX_TRELLIS_P =0x04, - MFX_TRELLIS_B =0x08 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 reserved1; - mfxU16 RateDistortionOpt; /* tri-state option */ - mfxU16 MECostType; - mfxU16 MESearchType; - mfxI16Pair MVSearchWindow; - mfxU16 EndOfSequence; /* tri-state option */ - mfxU16 FramePicture; /* tri-state option */ - - mfxU16 CAVLC; /* tri-state option */ - mfxU16 reserved2[2]; - mfxU16 RecoveryPointSEI; /* tri-state option */ - mfxU16 ViewOutput; /* tri-state option */ - mfxU16 NalHrdConformance; /* tri-state option */ - mfxU16 SingleSeiNalUnit; /* tri-state option */ - mfxU16 VuiVclHrdParameters; /* tri-state option */ - - mfxU16 RefPicListReordering; /* tri-state option */ - mfxU16 ResetRefList; /* tri-state option */ - mfxU16 RefPicMarkRep; /* tri-state option */ - mfxU16 FieldOutput; /* tri-state option */ - - mfxU16 IntraPredBlockSize; - mfxU16 InterPredBlockSize; - mfxU16 MVPrecision; - mfxU16 MaxDecFrameBuffering; - - mfxU16 AUDelimiter; /* tri-state option */ - mfxU16 EndOfStream; /* tri-state option */ - mfxU16 PicTimingSEI; /* tri-state option */ - mfxU16 VuiNalHrdParameters; /* tri-state option */ -} mfxExtCodingOption; -MFX_PACK_END() - -enum { - MFX_B_REF_UNKNOWN = 0, - MFX_B_REF_OFF = 1, - MFX_B_REF_PYRAMID = 2 -}; - -enum { - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_LOOKAHEAD_DS_UNKNOWN) = 0, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_LOOKAHEAD_DS_OFF) = 1, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_LOOKAHEAD_DS_2x) = 2, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_LOOKAHEAD_DS_4x) = 3 -}; - -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_LOOKAHEAD_DS_UNKNOWN); -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_LOOKAHEAD_DS_OFF); -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_LOOKAHEAD_DS_2x); -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_LOOKAHEAD_DS_4x); - -enum { - MFX_BPSEI_DEFAULT = 0x00, - MFX_BPSEI_IFRAME = 0x01 -}; - -enum { - MFX_SKIPFRAME_NO_SKIP = 0, - MFX_SKIPFRAME_INSERT_DUMMY = 1, - MFX_SKIPFRAME_INSERT_NOTHING = 2, - MFX_SKIPFRAME_BRC_ONLY = 3, -}; - -/* Intra refresh types */ -enum { - MFX_REFRESH_NO = 0, - MFX_REFRESH_VERTICAL = 1, - MFX_REFRESH_HORIZONTAL = 2, - MFX_REFRESH_SLICE = 3 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 IntRefType; - mfxU16 IntRefCycleSize; - mfxI16 IntRefQPDelta; - - mfxU32 MaxFrameSize; - mfxU32 MaxSliceSize; - - mfxU16 BitrateLimit; /* tri-state option */ - mfxU16 MBBRC; /* tri-state option */ - mfxU16 ExtBRC; /* tri-state option */ - mfxU16 LookAheadDepth; - mfxU16 Trellis; - mfxU16 RepeatPPS; /* tri-state option */ - mfxU16 BRefType; - mfxU16 AdaptiveI; /* tri-state option */ - mfxU16 AdaptiveB; /* tri-state option */ - mfxU16 LookAheadDS; - mfxU16 NumMbPerSlice; - mfxU16 SkipFrame; - mfxU8 MinQPI; /* 1..51, 0 = default */ - mfxU8 MaxQPI; /* 1..51, 0 = default */ - mfxU8 MinQPP; /* 1..51, 0 = default */ - mfxU8 MaxQPP; /* 1..51, 0 = default */ - mfxU8 MinQPB; /* 1..51, 0 = default */ - mfxU8 MaxQPB; /* 1..51, 0 = default */ - mfxU16 FixedFrameRate; /* tri-state option */ - mfxU16 DisableDeblockingIdc; - mfxU16 DisableVUI; - mfxU16 BufferingPeriodSEI; - mfxU16 EnableMAD; /* tri-state option */ - mfxU16 UseRawRef; /* tri-state option */ -} mfxExtCodingOption2; -MFX_PACK_END() - -/* WeightedPred */ -enum { - MFX_WEIGHTED_PRED_UNKNOWN = 0, - MFX_WEIGHTED_PRED_DEFAULT = 1, - MFX_WEIGHTED_PRED_EXPLICIT = 2, - MFX_WEIGHTED_PRED_IMPLICIT = 3 -}; - -/* ScenarioInfo */ -enum { - MFX_SCENARIO_UNKNOWN = 0, - MFX_SCENARIO_DISPLAY_REMOTING = 1, - MFX_SCENARIO_VIDEO_CONFERENCE = 2, - MFX_SCENARIO_ARCHIVE = 3, - MFX_SCENARIO_LIVE_STREAMING = 4, - MFX_SCENARIO_CAMERA_CAPTURE = 5, - MFX_SCENARIO_VIDEO_SURVEILLANCE = 6, - MFX_SCENARIO_GAME_STREAMING = 7, - MFX_SCENARIO_REMOTE_GAMING = 8 -}; - -/* ContentInfo */ -enum { - MFX_CONTENT_UNKNOWN = 0, - MFX_CONTENT_FULL_SCREEN_VIDEO = 1, - MFX_CONTENT_NON_VIDEO_SCREEN = 2 -}; - -/* PRefType */ -enum { - MFX_P_REF_DEFAULT = 0, - MFX_P_REF_SIMPLE = 1, - MFX_P_REF_PYRAMID = 2 -}; - -#if (MFX_VERSION >= MFX_VERSION_NEXT) - -/* QuantScaleType */ -enum { - MFX_MPEG2_QUANT_SCALE_TYPE_DEFAULT = 0, - MFX_MPEG2_QUANT_SCALE_TYPE_LINEAR = 1, /* q_scale_type = 0 */ - MFX_MPEG2_QUANT_SCALE_TYPE_NONLINEAR = 2 /* q_scale_type = 1 */ -}; - -/* IntraVLCFormat */ -enum { - MFX_MPEG2_INTRA_VLC_FORMAT_DEFAULT = 0, - MFX_MPEG2_INTRA_VLC_FORMAT_B14 = 1, /* use table B.14 */ - MFX_MPEG2_INTRA_VLC_FORMAT_B15 = 2 /* use table B.15 */ -}; - -/* ScanType */ -enum { - MFX_MPEG2_SCAN_TYPE_DEFAULT = 0, - MFX_MPEG2_SCAN_TYPE_ZIGZAG = 1, /* alternate_scan = 0 */ - MFX_MPEG2_SCAN_TYPE_ALTERNATE = 2 /* alternate_scan = 1 */ -}; - -#endif - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 NumSliceI; - mfxU16 NumSliceP; - mfxU16 NumSliceB; - - mfxU16 WinBRCMaxAvgKbps; - mfxU16 WinBRCSize; - - mfxU16 QVBRQuality; - mfxU16 EnableMBQP; - mfxU16 IntRefCycleDist; - mfxU16 DirectBiasAdjustment; /* tri-state option */ - mfxU16 GlobalMotionBiasAdjustment; /* tri-state option */ - mfxU16 MVCostScalingFactor; - mfxU16 MBDisableSkipMap; /* tri-state option */ - - mfxU16 WeightedPred; - mfxU16 WeightedBiPred; - - mfxU16 AspectRatioInfoPresent; /* tri-state option */ - mfxU16 OverscanInfoPresent; /* tri-state option */ - mfxU16 OverscanAppropriate; /* tri-state option */ - mfxU16 TimingInfoPresent; /* tri-state option */ - mfxU16 BitstreamRestriction; /* tri-state option */ - mfxU16 LowDelayHrd; /* tri-state option */ - mfxU16 MotionVectorsOverPicBoundaries; /* tri-state option */ -#if (MFX_VERSION >= MFX_VERSION_NEXT) - mfxU16 Log2MaxMvLengthHorizontal; /* 0..16 */ - mfxU16 Log2MaxMvLengthVertical; /* 0..16 */ -#else - mfxU16 reserved1[2]; -#endif - - mfxU16 ScenarioInfo; - mfxU16 ContentInfo; - - mfxU16 PRefType; - mfxU16 FadeDetection; /* tri-state option */ -#if (MFX_VERSION >= MFX_VERSION_NEXT) - mfxI16 DeblockingAlphaTcOffset; /* -12..12 (slice_alpha_c0_offset_div2 << 1) */ - mfxI16 DeblockingBetaOffset; /* -12..12 (slice_beta_offset_div2 << 1) */ -#else - mfxU16 reserved2[2]; -#endif - mfxU16 GPB; /* tri-state option */ - - mfxU32 MaxFrameSizeI; - mfxU32 MaxFrameSizeP; - mfxU32 reserved3[3]; - - mfxU16 EnableQPOffset; /* tri-state option */ - mfxI16 QPOffset[8]; /* FrameQP = QPX + QPOffset[pyramid_layer]; QPX = QPB for B-pyramid, QPP for P-pyramid */ - - mfxU16 NumRefActiveP[8]; - mfxU16 NumRefActiveBL0[8]; - mfxU16 NumRefActiveBL1[8]; - -#if (MFX_VERSION >= MFX_VERSION_NEXT) - mfxU16 ConstrainedIntraPredFlag; /* tri-state option */ -#else - mfxU16 reserved6; -#endif -#if (MFX_VERSION >= 1026) - mfxU16 TransformSkip; /* tri-state option; HEVC transform_skip_enabled_flag */ -#else - mfxU16 reserved7; -#endif -#if (MFX_VERSION >= 1027) - mfxU16 TargetChromaFormatPlus1; /* Minus 1 specifies target encoding chroma format (see ColorFormat enum). May differ from input one. */ - mfxU16 TargetBitDepthLuma; /* Target encoding bit depth for luma samples. May differ from input one. */ - mfxU16 TargetBitDepthChroma; /* Target encoding bit depth for chroma samples. May differ from input one. */ -#else - mfxU16 reserved4[3]; -#endif - mfxU16 BRCPanicMode; /* tri-state option */ - - mfxU16 LowDelayBRC; /* tri-state option */ - mfxU16 EnableMBForceIntra; /* tri-state option */ - mfxU16 AdaptiveMaxFrameSize; /* tri-state option */ - - mfxU16 RepartitionCheckEnable; /* tri-state option */ -#if (MFX_VERSION >= MFX_VERSION_NEXT) - mfxU16 QuantScaleType; /* For MPEG2 specifies mapping between quantiser_scale_code and quantiser_scale (see QuantScaleType enum) */ - mfxU16 IntraVLCFormat; /* For MPEG2 specifies which table shall be used for coding of DCT coefficients of intra macroblocks (see IntraVLCFormat enum) */ - mfxU16 ScanType; /* For MPEG2 specifies transform coefficients scan pattern (see ScanType enum) */ -#else - mfxU16 reserved5[3]; -#endif -#if (MFX_VERSION >= 1025) - mfxU16 EncodedUnitsInfo; /* tri-state option */ - mfxU16 EnableNalUnitType; /* tri-state option */ -#else - mfxU16 reserved8[2]; -#endif -#if (MFX_VERSION >= 1026) - mfxU16 ExtBrcAdaptiveLTR; /* tri-state option for ExtBRC */ -#else - mfxU16 reserved9; -#endif - mfxU16 reserved[163]; -} mfxExtCodingOption3; -MFX_PACK_END() - -/* IntraPredBlockSize/InterPredBlockSize */ -enum { - MFX_BLOCKSIZE_UNKNOWN = 0, - MFX_BLOCKSIZE_MIN_16X16 = 1, /* 16x16 */ - MFX_BLOCKSIZE_MIN_8X8 = 2, /* 16x16, 8x8 */ - MFX_BLOCKSIZE_MIN_4X4 = 3 /* 16x16, 8x8, 4x4 */ -}; - -/* MVPrecision */ -enum { - MFX_MVPRECISION_UNKNOWN = 0, - MFX_MVPRECISION_INTEGER = (1 << 0), - MFX_MVPRECISION_HALFPEL = (1 << 1), - MFX_MVPRECISION_QUARTERPEL = (1 << 2) -}; - -enum { - MFX_CODINGOPTION_UNKNOWN =0, - MFX_CODINGOPTION_ON =0x10, - MFX_CODINGOPTION_OFF =0x20, - MFX_CODINGOPTION_ADAPTIVE =0x30 -}; - -/* Data Flag for mfxBitstream*/ -enum { - MFX_BITSTREAM_COMPLETE_FRAME = 0x0001, /* the bitstream contains a complete frame or field pair of data */ - MFX_BITSTREAM_EOS = 0x0002 -}; -/* Extended Buffer Ids */ -enum { - MFX_EXTBUFF_CODING_OPTION = MFX_MAKEFOURCC('C','D','O','P'), - MFX_EXTBUFF_CODING_OPTION_SPSPPS = MFX_MAKEFOURCC('C','O','S','P'), - MFX_EXTBUFF_VPP_DONOTUSE = MFX_MAKEFOURCC('N','U','S','E'), - MFX_EXTBUFF_VPP_AUXDATA = MFX_MAKEFOURCC('A','U','X','D'), - MFX_EXTBUFF_VPP_DENOISE = MFX_MAKEFOURCC('D','N','I','S'), - MFX_EXTBUFF_VPP_SCENE_ANALYSIS = MFX_MAKEFOURCC('S','C','L','Y'), - MFX_EXTBUFF_VPP_SCENE_CHANGE = MFX_EXTBUFF_VPP_SCENE_ANALYSIS, - MFX_EXTBUFF_VPP_PROCAMP = MFX_MAKEFOURCC('P','A','M','P'), - MFX_EXTBUFF_VPP_DETAIL = MFX_MAKEFOURCC('D','E','T',' '), - MFX_EXTBUFF_VIDEO_SIGNAL_INFO = MFX_MAKEFOURCC('V','S','I','N'), - MFX_EXTBUFF_VPP_DOUSE = MFX_MAKEFOURCC('D','U','S','E'), - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION) = MFX_MAKEFOURCC('O','P','Q','S'), - MFX_EXTBUFF_AVC_REFLIST_CTRL = MFX_MAKEFOURCC('R','L','S','T'), - MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION = MFX_MAKEFOURCC('F','R','C',' '), - MFX_EXTBUFF_PICTURE_TIMING_SEI = MFX_MAKEFOURCC('P','T','S','E'), - MFX_EXTBUFF_AVC_TEMPORAL_LAYERS = MFX_MAKEFOURCC('A','T','M','L'), - MFX_EXTBUFF_CODING_OPTION2 = MFX_MAKEFOURCC('C','D','O','2'), - MFX_EXTBUFF_VPP_IMAGE_STABILIZATION = MFX_MAKEFOURCC('I','S','T','B'), - MFX_EXTBUFF_VPP_PICSTRUCT_DETECTION = MFX_MAKEFOURCC('I','D','E','T'), - MFX_EXTBUFF_ENCODER_CAPABILITY = MFX_MAKEFOURCC('E','N','C','P'), - MFX_EXTBUFF_ENCODER_RESET_OPTION = MFX_MAKEFOURCC('E','N','R','O'), - MFX_EXTBUFF_ENCODED_FRAME_INFO = MFX_MAKEFOURCC('E','N','F','I'), - MFX_EXTBUFF_VPP_COMPOSITE = MFX_MAKEFOURCC('V','C','M','P'), - MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO = MFX_MAKEFOURCC('V','V','S','I'), - MFX_EXTBUFF_ENCODER_ROI = MFX_MAKEFOURCC('E','R','O','I'), - MFX_EXTBUFF_VPP_DEINTERLACING = MFX_MAKEFOURCC('V','P','D','I'), - MFX_EXTBUFF_AVC_REFLISTS = MFX_MAKEFOURCC('R','L','T','S'), - MFX_EXTBUFF_DEC_VIDEO_PROCESSING = MFX_MAKEFOURCC('D','E','C','V'), - MFX_EXTBUFF_VPP_FIELD_PROCESSING = MFX_MAKEFOURCC('F','P','R','O'), - MFX_EXTBUFF_CODING_OPTION3 = MFX_MAKEFOURCC('C','D','O','3'), - MFX_EXTBUFF_CHROMA_LOC_INFO = MFX_MAKEFOURCC('C','L','I','N'), - MFX_EXTBUFF_MBQP = MFX_MAKEFOURCC('M','B','Q','P'), - MFX_EXTBUFF_MB_FORCE_INTRA = MFX_MAKEFOURCC('M','B','F','I'), - MFX_EXTBUFF_HEVC_TILES = MFX_MAKEFOURCC('2','6','5','T'), - MFX_EXTBUFF_MB_DISABLE_SKIP_MAP = MFX_MAKEFOURCC('M','D','S','M'), - MFX_EXTBUFF_HEVC_PARAM = MFX_MAKEFOURCC('2','6','5','P'), - MFX_EXTBUFF_DECODED_FRAME_INFO = MFX_MAKEFOURCC('D','E','F','I'), - MFX_EXTBUFF_TIME_CODE = MFX_MAKEFOURCC('T','M','C','D'), - MFX_EXTBUFF_HEVC_REGION = MFX_MAKEFOURCC('2','6','5','R'), - MFX_EXTBUFF_PRED_WEIGHT_TABLE = MFX_MAKEFOURCC('E','P','W','T'), - MFX_EXTBUFF_DIRTY_RECTANGLES = MFX_MAKEFOURCC('D','R','O','I'), - MFX_EXTBUFF_MOVING_RECTANGLES = MFX_MAKEFOURCC('M','R','O','I'), - MFX_EXTBUFF_CODING_OPTION_VPS = MFX_MAKEFOURCC('C','O','V','P'), - MFX_EXTBUFF_VPP_ROTATION = MFX_MAKEFOURCC('R','O','T',' '), - MFX_EXTBUFF_ENCODED_SLICES_INFO = MFX_MAKEFOURCC('E','N','S','I'), - MFX_EXTBUFF_VPP_SCALING = MFX_MAKEFOURCC('V','S','C','L'), - MFX_EXTBUFF_HEVC_REFLIST_CTRL = MFX_EXTBUFF_AVC_REFLIST_CTRL, - MFX_EXTBUFF_HEVC_REFLISTS = MFX_EXTBUFF_AVC_REFLISTS, - MFX_EXTBUFF_HEVC_TEMPORAL_LAYERS = MFX_EXTBUFF_AVC_TEMPORAL_LAYERS, - MFX_EXTBUFF_VPP_MIRRORING = MFX_MAKEFOURCC('M','I','R','R'), - MFX_EXTBUFF_MV_OVER_PIC_BOUNDARIES = MFX_MAKEFOURCC('M','V','P','B'), - MFX_EXTBUFF_VPP_COLORFILL = MFX_MAKEFOURCC('V','C','L','F'), -#if (MFX_VERSION >= 1025) - MFX_EXTBUFF_DECODE_ERROR_REPORT = MFX_MAKEFOURCC('D', 'E', 'R', 'R'), - MFX_EXTBUFF_VPP_COLOR_CONVERSION = MFX_MAKEFOURCC('V', 'C', 'S', 'C'), - MFX_EXTBUFF_CONTENT_LIGHT_LEVEL_INFO = MFX_MAKEFOURCC('L', 'L', 'I', 'S'), - MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME = MFX_MAKEFOURCC('D', 'C', 'V', 'S'), - MFX_EXTBUFF_MULTI_FRAME_PARAM = MFX_MAKEFOURCC('M', 'F', 'R', 'P'), - MFX_EXTBUFF_MULTI_FRAME_CONTROL = MFX_MAKEFOURCC('M', 'F', 'R', 'C'), - MFX_EXTBUFF_ENCODED_UNITS_INFO = MFX_MAKEFOURCC('E', 'N', 'U', 'I'), -#endif -#if (MFX_VERSION >= 1026) - MFX_EXTBUFF_VPP_MCTF = MFX_MAKEFOURCC('M', 'C', 'T', 'F'), - MFX_EXTBUFF_VP9_SEGMENTATION = MFX_MAKEFOURCC('9', 'S', 'E', 'G'), - MFX_EXTBUFF_VP9_TEMPORAL_LAYERS = MFX_MAKEFOURCC('9', 'T', 'M', 'L'), - MFX_EXTBUFF_VP9_PARAM = MFX_MAKEFOURCC('9', 'P', 'A', 'R'), -#endif -#if (MFX_VERSION >= 1027) - MFX_EXTBUFF_AVC_ROUNDING_OFFSET = MFX_MAKEFOURCC('R','N','D','O'), -#endif -#if (MFX_VERSION >= MFX_VERSION_NEXT) - MFX_EXTBUFF_DPB = MFX_MAKEFOURCC('E','D','P','B'), - MFX_EXTBUFF_TEMPORAL_LAYERS = MFX_MAKEFOURCC('T','M','P','L'), - MFX_EXTBUFF_AVC_SCALING_MATRIX = MFX_MAKEFOURCC('A','V','S','M'), - MFX_EXTBUFF_MPEG2_QUANT_MATRIX = MFX_MAKEFOURCC('M','2','Q','M'), - MFX_EXTBUFF_TASK_DEPENDENCY = MFX_MAKEFOURCC('S','Y','N','C'), -#endif -#if (MFX_VERSION >= 1031) - MFX_EXTBUFF_PARTIAL_BITSTREAM_PARAM = MFX_MAKEFOURCC('P','B','O','P'), -#endif - MFX_EXTBUFF_ENCODER_IPCM_AREA = MFX_MAKEFOURCC('P', 'C', 'M', 'R'), - MFX_EXTBUFF_INSERT_HEADERS = MFX_MAKEFOURCC('S', 'P', 'R', 'E'), -#if (MFX_VERSION >= 1034) - MFX_EXTBUFF_AV1_FILM_GRAIN_PARAM = MFX_MAKEFOURCC('A','1','F','G'), - MFX_EXTBUFF_AV1_LST_PARAM = MFX_MAKEFOURCC('A', '1', 'L', 'S'), - MFX_EXTBUFF_AV1_SEGMENTATION = MFX_MAKEFOURCC('1', 'S', 'E', 'G'), - MFX_EXTBUFF_AV1_PARAM = MFX_MAKEFOURCC('1', 'P', 'A', 'R'), - MFX_EXTBUFF_AV1_AUXDATA = MFX_MAKEFOURCC('1', 'A', 'U', 'X'), - MFX_EXTBUFF_AV1_TEMPORAL_LAYERS = MFX_MAKEFOURCC('1', 'T', 'M', 'L') -#endif -}; - -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION); - -/* VPP Conf: Do not use certain algorithms */ -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxExtBuffer Header; - mfxU32 NumAlg; - mfxU32* AlgList; -} mfxExtVPPDoNotUse; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 DenoiseFactor; -} mfxExtVPPDenoise; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 DetailFactor; -} mfxExtVPPDetail; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - mfxExtBuffer Header; - mfxF64 Brightness; - mfxF64 Contrast; - mfxF64 Hue; - mfxF64 Saturation; -} mfxExtVPPProcAmp; -MFX_PACK_END() - -/* statistics collected for decode, encode and vpp */ -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - mfxU32 reserved[16]; - mfxU32 NumFrame; - mfxU64 NumBit; - mfxU32 NumCachedFrame; -} mfxEncodeStat; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU32 reserved[16]; - mfxU32 NumFrame; - mfxU32 NumSkippedFrame; - mfxU32 NumError; - mfxU32 NumCachedFrame; -} mfxDecodeStat; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU32 reserved[16]; - mfxU32 NumFrame; - mfxU32 NumCachedFrame; -} mfxVPPStat; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - union{ - struct{ - mfxU32 SpatialComplexity; - mfxU32 TemporalComplexity; - }; - struct{ - mfxU16 PicStruct; - mfxU16 reserved[3]; - }; - }; - mfxU16 SceneChangeRate; - mfxU16 RepeatedFrame; -} mfxExtVppAuxData; -MFX_PACK_END() - -/* CtrlFlags */ -enum { - MFX_PAYLOAD_CTRL_SUFFIX = 0x00000001 /* HEVC suffix SEI */ -}; - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxU32 CtrlFlags; - mfxU32 reserved[3]; - mfxU8 *Data; /* buffer pointer */ - mfxU32 NumBit; /* number of bits */ - mfxU16 Type; /* SEI message type in H.264 or user data start_code in MPEG-2 */ - mfxU16 BufSize; /* payload buffer size in bytes */ -} mfxPayload; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxExtBuffer Header; -#if (MFX_VERSION >= 1025) - mfxU32 reserved[4]; - mfxU16 reserved1; - mfxU16 MfxNalUnitType; -#else - mfxU32 reserved[5]; -#endif - mfxU16 SkipFrame; - - mfxU16 QP; /* per frame QP */ - - mfxU16 FrameType; - mfxU16 NumExtParam; - mfxU16 NumPayload; /* MPEG-2 user data or H.264 SEI message(s) */ - mfxU16 reserved2; - - mfxExtBuffer **ExtParam; - mfxPayload **Payload; /* for field pair, first field uses even payloads and second field uses odd payloads */ -} mfxEncodeCtrl; -MFX_PACK_END() - -/* Buffer Memory Types */ -enum { - /* Buffer types */ - MFX_MEMTYPE_PERSISTENT_MEMORY =0x0002 -}; - -/* Frame Memory Types */ -#define MFX_MEMTYPE_BASE(x) (0x90ff & (x)) - -enum { - MFX_MEMTYPE_DXVA2_DECODER_TARGET =0x0010, - MFX_MEMTYPE_DXVA2_PROCESSOR_TARGET =0x0020, - MFX_MEMTYPE_VIDEO_MEMORY_DECODER_TARGET = MFX_MEMTYPE_DXVA2_DECODER_TARGET, - MFX_MEMTYPE_VIDEO_MEMORY_PROCESSOR_TARGET = MFX_MEMTYPE_DXVA2_PROCESSOR_TARGET, - MFX_MEMTYPE_SYSTEM_MEMORY =0x0040, - MFX_MEMTYPE_RESERVED1 =0x0080, - - MFX_MEMTYPE_FROM_ENCODE = 0x0100, - MFX_MEMTYPE_FROM_DECODE = 0x0200, - MFX_MEMTYPE_FROM_VPPIN = 0x0400, - MFX_MEMTYPE_FROM_VPPOUT = 0x0800, - MFX_MEMTYPE_FROM_ENC = 0x2000, - MFX_MEMTYPE_FROM_PAK = 0x4000, //reserved - - MFX_MEMTYPE_INTERNAL_FRAME = 0x0001, - MFX_MEMTYPE_EXTERNAL_FRAME = 0x0002, - MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_MEMTYPE_OPAQUE_FRAME) = 0x0004, - MFX_MEMTYPE_EXPORT_FRAME = 0x0008, - MFX_MEMTYPE_SHARED_RESOURCE = MFX_MEMTYPE_EXPORT_FRAME, -#if (MFX_VERSION >= 1025) - MFX_MEMTYPE_VIDEO_MEMORY_ENCODER_TARGET = 0x1000 -#else - MFX_MEMTYPE_RESERVED2 = 0x1000 -#endif -}; - -MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_MEMTYPE_OPAQUE_FRAME); - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - union { - mfxU32 AllocId; - mfxU32 reserved[1]; - }; - mfxU32 reserved3[3]; - mfxFrameInfo Info; - mfxU16 Type; /* decoder or processor render targets */ - mfxU16 NumFrameMin; - mfxU16 NumFrameSuggested; - mfxU16 reserved2; -} mfxFrameAllocRequest; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxU32 AllocId; - mfxU32 reserved[3]; - mfxMemId *mids; /* the array allocated by application */ - mfxU16 NumFrameActual; -#if (MFX_VERSION >= MFX_VERSION_NEXT) - mfxU16 MemType; -#else - mfxU16 reserved2; -#endif -} mfxFrameAllocResponse; -MFX_PACK_END() - -/* FrameType */ -enum { - MFX_FRAMETYPE_UNKNOWN =0x0000, - - MFX_FRAMETYPE_I =0x0001, - MFX_FRAMETYPE_P =0x0002, - MFX_FRAMETYPE_B =0x0004, - MFX_FRAMETYPE_S =0x0008, - - MFX_FRAMETYPE_REF =0x0040, - MFX_FRAMETYPE_IDR =0x0080, - - MFX_FRAMETYPE_xI =0x0100, - MFX_FRAMETYPE_xP =0x0200, - MFX_FRAMETYPE_xB =0x0400, - MFX_FRAMETYPE_xS =0x0800, - - MFX_FRAMETYPE_xREF =0x4000, - MFX_FRAMETYPE_xIDR =0x8000 -}; - -#if (MFX_VERSION >= 1025) -enum { - MFX_HEVC_NALU_TYPE_UNKNOWN = 0, - MFX_HEVC_NALU_TYPE_TRAIL_N = ( 0+1), - MFX_HEVC_NALU_TYPE_TRAIL_R = ( 1+1), - MFX_HEVC_NALU_TYPE_RADL_N = ( 6+1), - MFX_HEVC_NALU_TYPE_RADL_R = ( 7+1), - MFX_HEVC_NALU_TYPE_RASL_N = ( 8+1), - MFX_HEVC_NALU_TYPE_RASL_R = ( 9+1), - MFX_HEVC_NALU_TYPE_IDR_W_RADL = (19+1), - MFX_HEVC_NALU_TYPE_IDR_N_LP = (20+1), - MFX_HEVC_NALU_TYPE_CRA_NUT = (21+1) -}; -#endif - -typedef enum { - MFX_HANDLE_DIRECT3D_DEVICE_MANAGER9 =1, /* IDirect3DDeviceManager9 */ - MFX_HANDLE_D3D9_DEVICE_MANAGER = MFX_HANDLE_DIRECT3D_DEVICE_MANAGER9, - MFX_HANDLE_RESERVED1 = 2, - MFX_HANDLE_D3D11_DEVICE = 3, - MFX_HANDLE_VA_DISPLAY = 4, - MFX_HANDLE_RESERVED3 = 5, -#if (MFX_VERSION >= 1030) - MFX_HANDLE_VA_CONFIG_ID = 6, - MFX_HANDLE_VA_CONTEXT_ID = 7, -#endif -#if (MFX_VERSION >= MFX_VERSION_NEXT) - MFX_HANDLE_CM_DEVICE = 8 -#endif -} mfxHandleType; - -typedef enum { - MFX_SKIPMODE_NOSKIP=0, - MFX_SKIPMODE_MORE=1, - MFX_SKIPMODE_LESS=2 -} mfxSkipMode; - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxExtBuffer Header; - mfxU8 *SPSBuffer; - mfxU8 *PPSBuffer; - mfxU16 SPSBufSize; - mfxU16 PPSBufSize; - mfxU16 SPSId; - mfxU16 PPSId; -} mfxExtCodingOptionSPSPPS; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - mfxExtBuffer Header; - - union { - mfxU8 *VPSBuffer; - mfxU64 reserved1; - }; - mfxU16 VPSBufSize; - mfxU16 VPSId; - - mfxU16 reserved[6]; -} mfxExtCodingOptionVPS; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 VideoFormat; - mfxU16 VideoFullRange; - mfxU16 ColourDescriptionPresent; - mfxU16 ColourPrimaries; - mfxU16 TransferCharacteristics; - mfxU16 MatrixCoefficients; -} mfxExtVideoSignalInfo; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxExtBuffer Header; - mfxU32 NumAlg; - mfxU32 *AlgList; -} mfxExtVPPDoUse; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -MFX_DEPRECATED typedef struct { - mfxExtBuffer Header; - mfxU32 reserved1[2]; - struct { - mfxFrameSurface1 **Surfaces; - mfxU32 reserved2[5]; - mfxU16 Type; - mfxU16 NumSurface; - } In, Out; -} mfxExtOpaqueSurfaceAlloc; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 NumRefIdxL0Active; - mfxU16 NumRefIdxL1Active; - - struct { - mfxU32 FrameOrder; - mfxU16 PicStruct; - mfxU16 ViewId; - mfxU16 LongTermIdx; - mfxU16 reserved[3]; - } PreferredRefList[32], RejectedRefList[16], LongTermRefList[16]; - - mfxU16 ApplyLongTermIdx; - mfxU16 reserved[15]; -} mfxExtAVCRefListCtrl; -MFX_PACK_END() - -enum { - MFX_FRCALGM_PRESERVE_TIMESTAMP = 0x0001, - MFX_FRCALGM_DISTRIBUTED_TIMESTAMP = 0x0002, - MFX_FRCALGM_FRAME_INTERPOLATION = 0x0004 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 Algorithm; - mfxU16 reserved; - mfxU32 reserved2[15]; -} mfxExtVPPFrameRateConversion; -MFX_PACK_END() - -enum { - MFX_IMAGESTAB_MODE_UPSCALE = 0x0001, - MFX_IMAGESTAB_MODE_BOXING = 0x0002 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 Mode; - mfxU16 reserved[11]; -} mfxExtVPPImageStab; -MFX_PACK_END() - -#if (MFX_VERSION >= 1025) - -enum { - MFX_PAYLOAD_OFF = 0, - MFX_PAYLOAD_IDR = 1 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 reserved[15]; - - mfxU16 InsertPayloadToggle; - mfxU16 DisplayPrimariesX[3]; - mfxU16 DisplayPrimariesY[3]; - mfxU16 WhitePointX; - mfxU16 WhitePointY; - mfxU32 MaxDisplayMasteringLuminance; - mfxU32 MinDisplayMasteringLuminance; -} mfxExtMasteringDisplayColourVolume; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 reserved[9]; - - mfxU16 InsertPayloadToggle; - mfxU16 MaxContentLightLevel; - mfxU16 MaxPicAverageLightLevel; -} mfxExtContentLightLevelInfo; -MFX_PACK_END() -#endif - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU32 reserved[14]; - - struct { - mfxU16 ClockTimestampFlag; - mfxU16 CtType; - mfxU16 NuitFieldBasedFlag; - mfxU16 CountingType; - mfxU16 FullTimestampFlag; - mfxU16 DiscontinuityFlag; - mfxU16 CntDroppedFlag; - mfxU16 NFrames; - mfxU16 SecondsFlag; - mfxU16 MinutesFlag; - mfxU16 HoursFlag; - mfxU16 SecondsValue; - mfxU16 MinutesValue; - mfxU16 HoursValue; - mfxU32 TimeOffset; - } TimeStamp[3]; -} mfxExtPictureTimingSEI; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU32 reserved1[4]; - mfxU16 reserved2; - mfxU16 BaseLayerPID; - - struct { - mfxU16 Scale; - mfxU16 reserved[3]; - }Layer[8]; -} mfxExtAvcTemporalLayers; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU32 MBPerSec; - mfxU16 reserved[58]; -} mfxExtEncoderCapability; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 StartNewSequence; - mfxU16 reserved[11]; -} mfxExtEncoderResetOption; -MFX_PACK_END() - -/*LongTermIdx*/ -enum { - MFX_LONGTERM_IDX_NO_IDX = 0xFFFF -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU32 FrameOrder; - mfxU16 PicStruct; - mfxU16 LongTermIdx; - mfxU32 MAD; - mfxU16 BRCPanicMode; - mfxU16 QP; - mfxU32 SecondFieldOffset; - mfxU16 reserved[2]; - - struct { - mfxU32 FrameOrder; - mfxU16 PicStruct; - mfxU16 LongTermIdx; - mfxU16 reserved[4]; - } UsedRefListL0[32], UsedRefListL1[32]; -} mfxExtAVCEncodedFrameInfo; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct mfxVPPCompInputStream { - mfxU32 DstX; - mfxU32 DstY; - mfxU32 DstW; - mfxU32 DstH; - - mfxU16 LumaKeyEnable; - mfxU16 LumaKeyMin; - mfxU16 LumaKeyMax; - - mfxU16 GlobalAlphaEnable; - mfxU16 GlobalAlpha; - mfxU16 PixelAlphaEnable; - - mfxU16 TileId; - - mfxU16 reserved2[17]; -} mfxVPPCompInputStream; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxExtBuffer Header; - - /* background color*/ - union { - mfxU16 Y; - mfxU16 R; - }; - union { - mfxU16 U; - mfxU16 G; - }; - union { - mfxU16 V; - mfxU16 B; - }; - mfxU16 NumTiles; - mfxU16 reserved1[23]; - - mfxU16 NumInputStream; - mfxVPPCompInputStream *InputStream; -} mfxExtVPPComposite; -MFX_PACK_END() - -/* TransferMatrix */ -enum { - MFX_TRANSFERMATRIX_UNKNOWN = 0, - MFX_TRANSFERMATRIX_BT709 = 1, - MFX_TRANSFERMATRIX_BT601 = 2 -}; - -/* NominalRange */ -enum { - MFX_NOMINALRANGE_UNKNOWN = 0, - MFX_NOMINALRANGE_0_255 = 1, - MFX_NOMINALRANGE_16_235 = 2 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 reserved1[4]; - - union { - struct { // Init - struct { - mfxU16 TransferMatrix; - mfxU16 NominalRange; - mfxU16 reserved2[6]; - } In, Out; - }; - struct { // Runtime - mfxU16 TransferMatrix; - mfxU16 NominalRange; - mfxU16 reserved3[14]; - }; - }; -} mfxExtVPPVideoSignalInfo; -MFX_PACK_END() - -/* ROI encoding mode */ -enum { - MFX_ROI_MODE_PRIORITY = 0, - MFX_ROI_MODE_QP_DELTA = 1, - MFX_ROI_MODE_QP_VALUE = 2 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 NumROI; - mfxU16 ROIMode; - mfxU16 reserved1[10]; - - struct { - mfxU32 Left; - mfxU32 Top; - mfxU32 Right; - mfxU32 Bottom; - union { - mfxI16 Priority; - mfxI16 DeltaQP; - }; - mfxU16 reserved2[7]; - } ROI[256]; -} mfxExtEncoderROI; -MFX_PACK_END() - -/*Deinterlacing Mode*/ -enum { - MFX_DEINTERLACING_BOB = 1, - MFX_DEINTERLACING_ADVANCED = 2, - MFX_DEINTERLACING_AUTO_DOUBLE = 3, - MFX_DEINTERLACING_AUTO_SINGLE = 4, - MFX_DEINTERLACING_FULL_FR_OUT = 5, - MFX_DEINTERLACING_HALF_FR_OUT = 6, - MFX_DEINTERLACING_24FPS_OUT = 7, - MFX_DEINTERLACING_FIXED_TELECINE_PATTERN = 8, - MFX_DEINTERLACING_30FPS_OUT = 9, - MFX_DEINTERLACING_DETECT_INTERLACE = 10, - MFX_DEINTERLACING_ADVANCED_NOREF = 11, - MFX_DEINTERLACING_ADVANCED_SCD = 12, - MFX_DEINTERLACING_FIELD_WEAVING = 13 -}; - -/*TelecinePattern*/ -enum { - MFX_TELECINE_PATTERN_32 = 0, - MFX_TELECINE_PATTERN_2332 = 1, - MFX_TELECINE_PATTERN_FRAME_REPEAT = 2, - MFX_TELECINE_PATTERN_41 = 3, - MFX_TELECINE_POSITION_PROVIDED = 4 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 Mode; - mfxU16 TelecinePattern; - mfxU16 TelecineLocation; - mfxU16 reserved[9]; -} mfxExtVPPDeinterlacing; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 NumRefIdxL0Active; - mfxU16 NumRefIdxL1Active; - mfxU16 reserved[2]; - - struct mfxRefPic{ - mfxU32 FrameOrder; - mfxU16 PicStruct; - mfxU16 reserved[5]; - } RefPicList0[32], RefPicList1[32]; - -}mfxExtAVCRefLists; -MFX_PACK_END() - -enum { - MFX_VPP_COPY_FRAME =0x01, - MFX_VPP_COPY_FIELD =0x02, - MFX_VPP_SWAP_FIELDS =0x03 -}; - -/*PicType*/ -enum { - MFX_PICTYPE_UNKNOWN =0x00, - MFX_PICTYPE_FRAME =0x01, - MFX_PICTYPE_TOPFIELD =0x02, - MFX_PICTYPE_BOTTOMFIELD =0x04 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 Mode; - mfxU16 InField; - mfxU16 OutField; - mfxU16 reserved[25]; -} mfxExtVPPFieldProcessing; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - struct mfxIn{ - mfxU16 CropX; - mfxU16 CropY; - mfxU16 CropW; - mfxU16 CropH; - mfxU16 reserved[12]; - }In; - - struct mfxOut{ - mfxU32 FourCC; - mfxU16 ChromaFormat; - mfxU16 reserved1; - - mfxU16 Width; - mfxU16 Height; - - mfxU16 CropX; - mfxU16 CropY; - mfxU16 CropW; - mfxU16 CropH; - mfxU16 reserved[22]; - }Out; - - mfxU16 reserved[13]; -} mfxExtDecVideoProcessing; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 ChromaLocInfoPresentFlag; - mfxU16 ChromaSampleLocTypeTopField; - mfxU16 ChromaSampleLocTypeBottomField; - mfxU16 reserved[9]; -} mfxExtChromaLocInfo; -MFX_PACK_END() - -/* MBQPMode */ -enum { - MFX_MBQP_MODE_QP_VALUE = 0, // supported in CQP mode only - MFX_MBQP_MODE_QP_DELTA = 1, - MFX_MBQP_MODE_QP_ADAPTIVE = 2 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct{ - union { - mfxU8 QP; - mfxI8 DeltaQP; - }; - mfxU16 Mode; -} mfxQPandMode; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - mfxExtBuffer Header; - - mfxU32 reserved[10]; - mfxU16 Mode; // see MBQPMode enum - mfxU16 BlockSize; // QP block size, valid for HEVC only during Init and Runtime - mfxU32 NumQPAlloc; // Size of allocated by application QP or DeltaQP array - union { - mfxU8 *QP; // Block QP value. Valid when Mode = MFX_MBQP_MODE_QP_VALUE - mfxI8 *DeltaQP; // For block i: QP[i] = BrcQP[i] + DeltaQP[i]. Valid when Mode = MFX_MBQP_MODE_QP_DELTA -#if (MFX_VERSION >= 1034) - mfxQPandMode *QPmode; // Block-granularity modes when MFX_MBQP_MODE_QP_ADAPTIVE is set -#endif - mfxU64 reserved2; - }; -} mfxExtMBQP; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; /* Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_INSERT_HEADERS. */ - mfxU16 SPS; /* tri-state option to insert SPS */ - mfxU16 PPS; /* tri-state option to insert PPS */ - mfxU16 reserved[8]; -} mfxExtInsertHeaders; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxExtBuffer Header; /* Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_ENCODER_IPCM_AREA. */ - mfxU16 reserve1[10]; - - mfxU16 NumArea; /* Number of Area's */ - struct area { - mfxU32 Left; /* Left Area's coordinate. */ - mfxU32 Top; /* Top Area's coordinate. */ - mfxU32 Right; /* Right Area's coordinate. */ - mfxU32 Bottom; /* Bottom Area's coordinate. */ - - mfxU16 reserved2[8]; - } * Areas; /* Array of areas. */ -} mfxExtEncoderIPCMArea; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - mfxExtBuffer Header; - - mfxU32 reserved[11]; - mfxU32 MapSize; - union { - mfxU8 *Map; - mfxU64 reserved2; - }; -} mfxExtMBForceIntra; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 NumTileRows; - mfxU16 NumTileColumns; - mfxU16 reserved[74]; -}mfxExtHEVCTiles; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - mfxExtBuffer Header; - - mfxU32 reserved[11]; - mfxU32 MapSize; - union { - mfxU8 *Map; - mfxU64 reserved2; - }; -} mfxExtMBDisableSkipMap; -MFX_PACK_END() - -#if (MFX_VERSION >= MFX_VERSION_NEXT) -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 DPBSize; - mfxU16 reserved[11]; - - struct { - mfxU32 FrameOrder; - mfxU16 PicType; - mfxU16 LongTermIdx; - mfxU16 reserved[4]; - } DPB[32]; -} mfxExtDPB; -MFX_PACK_END() - -#endif - -/*GeneralConstraintFlags*/ -enum { - /* REXT Profile constraint flags*/ - MFX_HEVC_CONSTR_REXT_MAX_12BIT = (1 << 0), - MFX_HEVC_CONSTR_REXT_MAX_10BIT = (1 << 1), - MFX_HEVC_CONSTR_REXT_MAX_8BIT = (1 << 2), - MFX_HEVC_CONSTR_REXT_MAX_422CHROMA = (1 << 3), - MFX_HEVC_CONSTR_REXT_MAX_420CHROMA = (1 << 4), - MFX_HEVC_CONSTR_REXT_MAX_MONOCHROME = (1 << 5), - MFX_HEVC_CONSTR_REXT_INTRA = (1 << 6), - MFX_HEVC_CONSTR_REXT_ONE_PICTURE_ONLY = (1 << 7), - MFX_HEVC_CONSTR_REXT_LOWER_BIT_RATE = (1 << 8) -}; - -#if (MFX_VERSION >= 1026) - -/* SampleAdaptiveOffset */ -enum { - MFX_SAO_UNKNOWN = 0x00, - MFX_SAO_DISABLE = 0x01, - MFX_SAO_ENABLE_LUMA = 0x02, - MFX_SAO_ENABLE_CHROMA = 0x04 -}; - -#endif - -/* This struct has 4-byte alignment for binary compatibility with previously released versions of API */ -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 PicWidthInLumaSamples; - mfxU16 PicHeightInLumaSamples; - mfxU64 GeneralConstraintFlags; -#if (MFX_VERSION >= 1026) - mfxU16 SampleAdaptiveOffset; /* see enum SampleAdaptiveOffset, valid during Init and Runtime */ - mfxU16 LCUSize; - mfxU16 reserved[116]; -#else - mfxU16 reserved[118]; -#endif -} mfxExtHEVCParam; -MFX_PACK_END() - -#if (MFX_VERSION >= 1025) -/*ErrorTypes in mfxExtDecodeErrorReport*/ -enum { - MFX_ERROR_PPS = (1 << 0), - MFX_ERROR_SPS = (1 << 1), - MFX_ERROR_SLICEHEADER = (1 << 2), - MFX_ERROR_SLICEDATA = (1 << 3), - MFX_ERROR_FRAME_GAP = (1 << 4), -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU32 ErrorTypes; - mfxU16 reserved[10]; -} mfxExtDecodeErrorReport; -MFX_PACK_END() - -#endif - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 FrameType; - mfxU16 reserved[59]; -} mfxExtDecodedFrameInfo; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 DropFrameFlag; - mfxU16 TimeCodeHours; - mfxU16 TimeCodeMinutes; - mfxU16 TimeCodeSeconds; - mfxU16 TimeCodePictures; - mfxU16 reserved[7]; -} mfxExtTimeCode; -MFX_PACK_END() - -/*RegionType*/ -enum { - MFX_HEVC_REGION_SLICE = 0 -}; - -/*RegionEncoding*/ -enum { - MFX_HEVC_REGION_ENCODING_ON = 0, - MFX_HEVC_REGION_ENCODING_OFF = 1 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU32 RegionId; - mfxU16 RegionType; - mfxU16 RegionEncoding; - mfxU16 reserved[24]; -} mfxExtHEVCRegion; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 LumaLog2WeightDenom; // 0..7 - mfxU16 ChromaLog2WeightDenom; // 0..7 - mfxU16 LumaWeightFlag[2][32]; // [list] 0,1 - mfxU16 ChromaWeightFlag[2][32]; // [list] 0,1 - mfxI16 Weights[2][32][3][2]; // [list][list entry][Y, Cb, Cr][weight, offset] - mfxU16 reserved[58]; -} mfxExtPredWeightTable; -MFX_PACK_END() - -#if (MFX_VERSION >= 1027) -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 EnableRoundingIntra; // tri-state option - mfxU16 RoundingOffsetIntra; // valid value [0,7] - mfxU16 EnableRoundingInter; // tri-state option - mfxU16 RoundingOffsetInter; // valid value [0,7] - - mfxU16 reserved[24]; -} mfxExtAVCRoundingOffset; -MFX_PACK_END() -#endif - -#if (MFX_VERSION >= MFX_VERSION_NEXT) -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 reserved[12]; - - struct { - mfxU16 Scale; - mfxU16 QPI; - mfxU16 QPP; - mfxU16 QPB; - mfxU32 TargetKbps; - mfxU32 MaxKbps; - mfxU32 BufferSizeInKB; - mfxU32 InitialDelayInKB; - mfxU16 reserved1[20]; - } Layer[8]; -} mfxExtTemporalLayers; -MFX_PACK_END() - -#endif - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 NumRect; - mfxU16 reserved1[11]; - - struct { - mfxU32 Left; - mfxU32 Top; - mfxU32 Right; - mfxU32 Bottom; - - mfxU16 reserved2[8]; - } Rect[256]; -} mfxExtDirtyRect; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 NumRect; - mfxU16 reserved1[11]; - - struct { - mfxU32 DestLeft; - mfxU32 DestTop; - mfxU32 DestRight; - mfxU32 DestBottom; - - mfxU32 SourceLeft; - mfxU32 SourceTop; - mfxU16 reserved2[4]; - } Rect[256]; -} mfxExtMoveRect; -MFX_PACK_END() - -#if (MFX_VERSION >= MFX_VERSION_NEXT) - -/* ScalingMatrixType */ -enum { - MFX_SCALING_MATRIX_SPS = 1, - MFX_SCALING_MATRIX_PPS = 2 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 Type; - mfxU16 reserved[5]; - - /* [4x4_Intra_Y, 4x4_Intra_Cb, 4x4_Intra_Cr, - 4x4_Inter_Y, 4x4_Inter_Cb, 4x4_Inter_Cr, - 8x8_Intra_Y, 8x8_Inter_Y, 8x8_Intra_Cb, - 8x8_Inter_Cb, 8x8_Intra_Cr, 8x8_Inter_Cr] */ - mfxU8 ScalingListPresent[12]; - - /* [Intra_Y, Intra_Cb, Intra_Cr, - Inter_Y, Inter_Cb, Inter_Cr] */ - mfxU8 ScalingList4x4[6][16]; - - /* [Intra_Y, Inter_Y, Intra_Cb, - Inter_Cb, Intra_Cr, Inter_Cr] */ - mfxU8 ScalingList8x8[6][64]; -} mfxExtAVCScalingMatrix; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 reserved[28]; - - mfxU8 LoadMatrix[4]; // [LumaIntra, LumaInter, ChromaIntra, ChromaInter] - mfxU8 Matrix[4][64]; // [LumaIntra, LumaInter, ChromaIntra, ChromaInter] -} mfxExtMPEG2QuantMatrix; -MFX_PACK_END() - -#endif - -/* Angle */ -enum { - MFX_ANGLE_0 = 0, - MFX_ANGLE_90 = 90, - MFX_ANGLE_180 = 180, - MFX_ANGLE_270 = 270 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 Angle; - mfxU16 reserved[11]; -} mfxExtVPPRotation; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - mfxExtBuffer Header; - - mfxU16 SliceSizeOverflow; - mfxU16 NumSliceNonCopliant; - mfxU16 NumEncodedSlice; - mfxU16 NumSliceSizeAlloc; - union { - mfxU16 *SliceSize; - mfxU64 reserved1; - }; - - mfxU16 reserved[20]; -} mfxExtEncodedSlicesInfo; -MFX_PACK_END() - -/* ScalingMode */ -enum { - MFX_SCALING_MODE_DEFAULT = 0, - MFX_SCALING_MODE_LOWPOWER = 1, - MFX_SCALING_MODE_QUALITY = 2 -}; - -#if (MFX_VERSION >= 1033) -/* Interpolation Method */ -enum { - MFX_INTERPOLATION_DEFAULT = 0, - MFX_INTERPOLATION_NEAREST_NEIGHBOR = 1, - MFX_INTERPOLATION_BILINEAR = 2, - MFX_INTERPOLATION_ADVANCED = 3 -}; -#endif - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 ScalingMode; -#if (MFX_VERSION >= 1033) - mfxU16 InterpolationMethod; - mfxU16 reserved[10]; -#else - mfxU16 reserved[11]; -#endif -} mfxExtVPPScaling; -MFX_PACK_END() - -#if (MFX_VERSION >= MFX_VERSION_NEXT) - -/* SceneChangeType */ -enum { - MFX_SCENE_NO_CHANGE = 0, - MFX_SCENE_START = 1, - MFX_SCENE_END = 2 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 Type; - mfxU16 reserved[11]; -} mfxExtSceneChange; -MFX_PACK_END() - -#endif - -typedef mfxExtAVCRefListCtrl mfxExtHEVCRefListCtrl; -typedef mfxExtAVCRefLists mfxExtHEVCRefLists; -typedef mfxExtAvcTemporalLayers mfxExtHEVCTemporalLayers; - -/* MirroringType */ -enum -{ - MFX_MIRRORING_DISABLED = 0, - MFX_MIRRORING_HORIZONTAL = 1, - MFX_MIRRORING_VERTICAL = 2 -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 Type; - mfxU16 reserved[11]; -} mfxExtVPPMirroring; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 StickTop; /* tri-state option */ - mfxU16 StickBottom; /* tri-state option */ - mfxU16 StickLeft; /* tri-state option */ - mfxU16 StickRight; /* tri-state option */ - mfxU16 reserved[8]; -} mfxExtMVOverPicBoundaries; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 Enable; /* tri-state option */ - mfxU16 reserved[11]; -} mfxExtVPPColorFill; -MFX_PACK_END() - -#if (MFX_VERSION >= 1025) - -/* ChromaSiting */ -enum { - MFX_CHROMA_SITING_UNKNOWN = 0x0000, - MFX_CHROMA_SITING_VERTICAL_TOP = 0x0001, /* Chroma samples are co-sited vertically on the top with the luma samples. */ - MFX_CHROMA_SITING_VERTICAL_CENTER = 0x0002, /* Chroma samples are not co-sited vertically with the luma samples. */ - MFX_CHROMA_SITING_VERTICAL_BOTTOM = 0x0004, /* Chroma samples are co-sited vertically on the bottom with the luma samples. */ - MFX_CHROMA_SITING_HORIZONTAL_LEFT = 0x0010, /* Chroma samples are co-sited horizontally on the left with the luma samples. */ - MFX_CHROMA_SITING_HORIZONTAL_CENTER = 0x0020 /* Chroma samples are not co-sited horizontally with the luma samples. */ -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 ChromaSiting; - mfxU16 reserved[27]; -} mfxExtColorConversion; -MFX_PACK_END() - -#endif - -#if (MFX_VERSION >= 1026) -/* VP9ReferenceFrame */ -enum { - MFX_VP9_REF_INTRA = 0, - MFX_VP9_REF_LAST = 1, - MFX_VP9_REF_GOLDEN = 2, - MFX_VP9_REF_ALTREF = 3 -}; - -/* SegmentIdBlockSize */ -enum { - MFX_VP9_SEGMENT_ID_BLOCK_SIZE_UNKNOWN = 0, - MFX_VP9_SEGMENT_ID_BLOCK_SIZE_8x8 = 8, - MFX_VP9_SEGMENT_ID_BLOCK_SIZE_16x16 = 16, - MFX_VP9_SEGMENT_ID_BLOCK_SIZE_32x32 = 32, - MFX_VP9_SEGMENT_ID_BLOCK_SIZE_64x64 = 64, -}; - -/* SegmentFeature */ -enum { - MFX_VP9_SEGMENT_FEATURE_QINDEX = 0x0001, - MFX_VP9_SEGMENT_FEATURE_LOOP_FILTER = 0x0002, - MFX_VP9_SEGMENT_FEATURE_REFERENCE = 0x0004, - MFX_VP9_SEGMENT_FEATURE_SKIP = 0x0008 /* (0,0) MV, no residual */ -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU16 FeatureEnabled; /* see enum SegmentFeature */ - mfxI16 QIndexDelta; - mfxI16 LoopFilterLevelDelta; - mfxU16 ReferenceFrame; /* see enum VP9ReferenceFrame */ - mfxU16 reserved[12]; -} mfxVP9SegmentParam; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - mfxExtBuffer Header; - mfxU16 NumSegments; /* 0..8 */ - mfxVP9SegmentParam Segment[8]; - mfxU16 SegmentIdBlockSize; /* see enum SegmentIdBlockSize */ - mfxU32 NumSegmentIdAlloc; /* >= (Ceil(Width / SegmentIdBlockSize) * Ceil(Height / SegmentIdBlockSize)) */ - union { - mfxU8 *SegmentId; /*[NumSegmentIdAlloc] = 0..7, index in Segment array, blocks of SegmentIdBlockSize map */ - mfxU64 reserved1; - }; - mfxU16 reserved[52]; -} mfxExtVP9Segmentation; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU16 FrameRateScale; /* Layer[n].FrameRateScale = Layer[n - 1].FrameRateScale * (uint)m */ - mfxU16 TargetKbps; /* affected by BRCParamMultiplier, Layer[n].TargetKbps > Layer[n - 1].TargetKbps */ - mfxU16 reserved[14]; -} mfxVP9TemporalLayer; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxVP9TemporalLayer Layer[8]; - mfxU16 reserved[60]; -} mfxExtVP9TemporalLayers; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 FrameWidth; - mfxU16 FrameHeight; - - mfxU16 WriteIVFHeaders; /* tri-state option */ - -#if (MFX_VERSION >= MFX_VERSION_NEXT) - mfxI16 LoopFilterRefDelta[4]; - mfxI16 LoopFilterModeDelta[2]; -#else // API 1.26 - mfxI16 reserved1[6]; -#endif - mfxI16 QIndexDeltaLumaDC; - mfxI16 QIndexDeltaChromaAC; - mfxI16 QIndexDeltaChromaDC; -#if (MFX_VERSION >= 1029) - mfxU16 NumTileRows; - mfxU16 NumTileColumns; - mfxU16 reserved[110]; -#else - mfxU16 reserved[112]; -#endif -} mfxExtVP9Param; -MFX_PACK_END() - -#endif // #if (MFX_VERSION >= 1026) - -#if (MFX_VERSION >= 1025) -/* Multi-Frame Mode */ -enum { - MFX_MF_DEFAULT = 0, - MFX_MF_DISABLED = 1, - MFX_MF_AUTO = 2, - MFX_MF_MANUAL = 3 -}; - -/* Multi-Frame Initialization parameters */ -MFX_PACK_BEGIN_USUAL_STRUCT() -MFX_DEPRECATED typedef struct { - mfxExtBuffer Header; - - mfxU16 MFMode; - mfxU16 MaxNumFrames; - - mfxU16 reserved[58]; -} mfxExtMultiFrameParam; -MFX_PACK_END() - -/* Multi-Frame Run-time controls */ -MFX_PACK_BEGIN_USUAL_STRUCT() -MFX_DEPRECATED typedef struct { - mfxExtBuffer Header; - - mfxU32 Timeout; /* timeout in millisecond */ - mfxU16 Flush; /* Flush internal frame buffer, e.g. submit all collected frames. */ - - mfxU16 reserved[57]; -} mfxExtMultiFrameControl; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU16 Type; - mfxU16 reserved1; - mfxU32 Offset; - mfxU32 Size; - mfxU32 reserved[5]; -} mfxEncodedUnitInfo; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_L_TYPE() -typedef struct { - mfxExtBuffer Header; - - union { - mfxEncodedUnitInfo *UnitInfo; - mfxU64 reserved1; - }; - mfxU16 NumUnitsAlloc; - mfxU16 NumUnitsEncoded; - - mfxU16 reserved[22]; -} mfxExtEncodedUnitsInfo; -MFX_PACK_END() - -#endif - -#if (MFX_VERSION >= 1026) -#if (MFX_VERSION >= MFX_VERSION_NEXT) -/* MCTFTemporalMode */ -enum { - MFX_MCTF_TEMPORAL_MODE_UNKNOWN = 0, - MFX_MCTF_TEMPORAL_MODE_SPATIAL = 1, - MFX_MCTF_TEMPORAL_MODE_1REF = 2, - MFX_MCTF_TEMPORAL_MODE_2REF = 3, - MFX_MCTF_TEMPORAL_MODE_4REF = 4 -}; -#endif - -/* MCTF initialization & runtime */ -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU16 FilterStrength; -#if (MFX_VERSION >= MFX_VERSION_NEXT) - mfxU16 Overlap; /* tri-state option */ - mfxU32 BitsPerPixelx100k; - mfxU16 Deblocking; /* tri-state option */ - mfxU16 TemporalMode; - mfxU16 MVPrecision; - mfxU16 reserved[21]; -#else - mfxU16 reserved[27]; -#endif -} mfxExtVppMctf; -MFX_PACK_END() - -#endif - -#if (MFX_VERSION >= 1031) -/* Multi-adapters Querying structs */ -typedef enum -{ - MFX_COMPONENT_ENCODE = 1, - MFX_COMPONENT_DECODE = 2, - MFX_COMPONENT_VPP = 3 -} mfxComponentType; - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct -{ - mfxComponentType Type; - mfxVideoParam Requirements; - - mfxU16 reserved[4]; -} mfxComponentInfo; -MFX_PACK_END() - -/* Adapter description */ -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct -{ - mfxPlatform Platform; - mfxU32 Number; - - mfxU16 reserved[14]; -} mfxAdapterInfo; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct -{ - mfxAdapterInfo * Adapters; - mfxU32 NumAlloc; - mfxU32 NumActual; - - mfxU16 reserved[4]; -} mfxAdaptersInfo; -MFX_PACK_END() - -#endif - -#if (MFX_VERSION >= 1034) -/* FilmGrainFlags */ -enum { - MFX_FILM_GRAIN_APPLY = (1 << 0), - MFX_FILM_GRAIN_UPDATE = (1 << 1), - MFX_FILM_GRAIN_CHROMA_SCALING_FROM_LUMA = (1 << 2), - MFX_FILM_GRAIN_OVERLAP = (1 << 3), - MFX_FILM_GRAIN_CLIP_TO_RESTRICTED_RANGE = (1 << 4) -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxU8 Value; - mfxU8 Scaling; -} mfxAV1FilmGrainPoint; -MFX_PACK_END() - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - - mfxU16 FilmGrainFlags; /* FilmGrainFlags */ - mfxU16 GrainSeed; /* 0..65535 */ - - mfxU8 RefIdx; /* 0..6 */ - mfxU8 NumYPoints; /* 0..14 */ - mfxU8 NumCbPoints; /* 0..10 */ - mfxU8 NumCrPoints; /* 0..10 */ - - mfxAV1FilmGrainPoint PointY[14]; - mfxAV1FilmGrainPoint PointCb[10]; - mfxAV1FilmGrainPoint PointCr[10]; - - mfxU8 GrainScalingMinus8; /* 0..3 */ - mfxU8 ArCoeffLag; /* 0..3 */ - - mfxU8 ArCoeffsYPlus128[24]; /* 0..255 */ - mfxU8 ArCoeffsCbPlus128[25]; /* 0..255 */ - mfxU8 ArCoeffsCrPlus128[25]; /* 0..255 */ - - mfxU8 ArCoeffShiftMinus6; /* 0..3 */ - mfxU8 GrainScaleShift; /* 0..3 */ - - mfxU8 CbMult; /* 0..255 */ - mfxU8 CbLumaMult; /* 0..255 */ - mfxU16 CbOffset; /* 0..511 */ - - mfxU8 CrMult; /* 0..255 */ - mfxU8 CrLumaMult; /* 0..255 */ - mfxU16 CrOffset; /* 0..511 */ - - mfxU16 reserved[43]; -} mfxExtAV1FilmGrainParam; -MFX_PACK_END() - -#endif - -#if (MFX_VERSION >= 1031) -/* PartialBitstreamOutput */ -enum { - MFX_PARTIAL_BITSTREAM_NONE = 0, /* Don't use partial output */ - MFX_PARTIAL_BITSTREAM_SLICE = 1, /* Partial bitstream output will be aligned to slice granularity */ - MFX_PARTIAL_BITSTREAM_BLOCK = 2, /* Partial bitstream output will be aligned to user-defined block size granularity */ - MFX_PARTIAL_BITSTREAM_ANY = 3 /* Partial bitstream output will be return any coded data avilable at the end of SyncOperation timeout */ -}; - -MFX_PACK_BEGIN_USUAL_STRUCT() -typedef struct { - mfxExtBuffer Header; - mfxU32 BlockSize; /* output block granulatiry for Granularity = MFX_PARTIAL_BITSTREAM_BLOCK */ - mfxU16 Granularity; /* granulatiry of the partial bitstream: slice/block/any */ - mfxU16 reserved[8]; -} mfxExtPartialBitstreamParam; -MFX_PACK_END() -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxvideo++.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxvideo++.h deleted file mode 100644 index 41c18e9f1..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxvideo++.h +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright (c) 2017 Intel Corporation -// -// 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 __MFXVIDEOPLUSPLUS_H -#define __MFXVIDEOPLUSPLUS_H - -#include "mfxvideo.h" -#include "mfxenc.h" -#include "mfxpak.h" - -class MFXVideoSession -{ -public: - MFXVideoSession(void) { m_session = (mfxSession) 0; } - virtual ~MFXVideoSession(void) { Close(); } - - virtual mfxStatus Init(mfxIMPL impl, mfxVersion *ver) { return MFXInit(impl, ver, &m_session); } - virtual mfxStatus InitEx(mfxInitParam par) { return MFXInitEx(par, &m_session); } - virtual mfxStatus Close(void) - { - mfxStatus mfxRes; - mfxRes = MFXClose(m_session); m_session = (mfxSession) 0; - return mfxRes; - } - - virtual mfxStatus QueryIMPL(mfxIMPL *impl) { return MFXQueryIMPL(m_session, impl); } - virtual mfxStatus QueryVersion(mfxVersion *version) { return MFXQueryVersion(m_session, version); } - - virtual mfxStatus JoinSession(mfxSession child_session) { return MFXJoinSession(m_session, child_session);} - virtual mfxStatus DisjoinSession( ) { return MFXDisjoinSession(m_session);} - virtual mfxStatus CloneSession( mfxSession *clone) { return MFXCloneSession(m_session, clone);} - virtual mfxStatus SetPriority( mfxPriority priority) { return MFXSetPriority(m_session, priority);} - virtual mfxStatus GetPriority( mfxPriority *priority) { return MFXGetPriority(m_session, priority);} - - MFX_DEPRECATED virtual mfxStatus SetBufferAllocator(mfxBufferAllocator *allocator) { return MFXVideoCORE_SetBufferAllocator(m_session, allocator); } - virtual mfxStatus SetFrameAllocator(mfxFrameAllocator *allocator) { return MFXVideoCORE_SetFrameAllocator(m_session, allocator); } - virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl) { return MFXVideoCORE_SetHandle(m_session, type, hdl); } - virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *hdl) { return MFXVideoCORE_GetHandle(m_session, type, hdl); } - virtual mfxStatus QueryPlatform(mfxPlatform* platform) { return MFXVideoCORE_QueryPlatform(m_session, platform); } - - virtual mfxStatus SyncOperation(mfxSyncPoint syncp, mfxU32 wait) { return MFXVideoCORE_SyncOperation(m_session, syncp, wait); } - - virtual mfxStatus DoWork() { return MFXDoWork(m_session); } - - virtual operator mfxSession (void) { return m_session; } - -protected: - - mfxSession m_session; // (mfxSession) handle to the owning session -private: - MFXVideoSession(const MFXVideoSession &); - void operator=(MFXVideoSession &); -}; - -class MFXVideoENCODE -{ -public: - - MFXVideoENCODE(mfxSession session) { m_session = session; } - virtual ~MFXVideoENCODE(void) { Close(); } - - virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { return MFXVideoENCODE_Query(m_session, in, out); } - virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) { return MFXVideoENCODE_QueryIOSurf(m_session, par, request); } - virtual mfxStatus Init(mfxVideoParam *par) { return MFXVideoENCODE_Init(m_session, par); } - virtual mfxStatus Reset(mfxVideoParam *par) { return MFXVideoENCODE_Reset(m_session, par); } - virtual mfxStatus Close(void) { return MFXVideoENCODE_Close(m_session); } - - virtual mfxStatus GetVideoParam(mfxVideoParam *par) { return MFXVideoENCODE_GetVideoParam(m_session, par); } - virtual mfxStatus GetEncodeStat(mfxEncodeStat *stat) { return MFXVideoENCODE_GetEncodeStat(m_session, stat); } - - virtual mfxStatus EncodeFrameAsync(mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxSyncPoint *syncp) { return MFXVideoENCODE_EncodeFrameAsync(m_session, ctrl, surface, bs, syncp); } - -protected: - - mfxSession m_session; // (mfxSession) handle to the owning session -}; - -class MFXVideoDECODE -{ -public: - - MFXVideoDECODE(mfxSession session) { m_session = session; } - virtual ~MFXVideoDECODE(void) { Close(); } - - virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { return MFXVideoDECODE_Query(m_session, in, out); } - virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxVideoParam *par) { return MFXVideoDECODE_DecodeHeader(m_session, bs, par); } - virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) { return MFXVideoDECODE_QueryIOSurf(m_session, par, request); } - virtual mfxStatus Init(mfxVideoParam *par) { return MFXVideoDECODE_Init(m_session, par); } - virtual mfxStatus Reset(mfxVideoParam *par) { return MFXVideoDECODE_Reset(m_session, par); } - virtual mfxStatus Close(void) { return MFXVideoDECODE_Close(m_session); } - - virtual mfxStatus GetVideoParam(mfxVideoParam *par) { return MFXVideoDECODE_GetVideoParam(m_session, par); } - - virtual mfxStatus GetDecodeStat(mfxDecodeStat *stat) { return MFXVideoDECODE_GetDecodeStat(m_session, stat); } - virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) {return MFXVideoDECODE_GetPayload(m_session, ts, payload); } - virtual mfxStatus SetSkipMode(mfxSkipMode mode) { return MFXVideoDECODE_SetSkipMode(m_session, mode); } - virtual mfxStatus DecodeFrameAsync(mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxSyncPoint *syncp) { return MFXVideoDECODE_DecodeFrameAsync(m_session, bs, surface_work, surface_out, syncp); } - -protected: - - mfxSession m_session; // (mfxSession) handle to the owning session -}; - -class MFXVideoVPP -{ -public: - - MFXVideoVPP(mfxSession session) { m_session = session; } - virtual ~MFXVideoVPP(void) { Close(); } - - virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { return MFXVideoVPP_Query(m_session, in, out); } - virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest request[2]) { return MFXVideoVPP_QueryIOSurf(m_session, par, request); } - virtual mfxStatus Init(mfxVideoParam *par) { return MFXVideoVPP_Init(m_session, par); } - virtual mfxStatus Reset(mfxVideoParam *par) { return MFXVideoVPP_Reset(m_session, par); } - virtual mfxStatus Close(void) { return MFXVideoVPP_Close(m_session); } - - virtual mfxStatus GetVideoParam(mfxVideoParam *par) { return MFXVideoVPP_GetVideoParam(m_session, par); } - virtual mfxStatus GetVPPStat(mfxVPPStat *stat) { return MFXVideoVPP_GetVPPStat(m_session, stat); } - virtual mfxStatus RunFrameVPPAsync(mfxFrameSurface1 *in, mfxFrameSurface1 *out, mfxExtVppAuxData *aux, mfxSyncPoint *syncp) { return MFXVideoVPP_RunFrameVPPAsync(m_session, in, out, aux, syncp); } - virtual mfxStatus RunFrameVPPAsyncEx(mfxFrameSurface1 *in, mfxFrameSurface1 *work, mfxFrameSurface1 **out, mfxSyncPoint *syncp) {return MFXVideoVPP_RunFrameVPPAsyncEx(m_session, in, work, out, syncp); } - -protected: - - mfxSession m_session; // (mfxSession) handle to the owning session -}; - -class MFXVideoENC -{ -public: - - MFXVideoENC(mfxSession session) { m_session = session; } - virtual ~MFXVideoENC(void) { Close(); } - - virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { return MFXVideoENC_Query(m_session, in, out); } - virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) { return MFXVideoENC_QueryIOSurf(m_session, par, request); } - virtual mfxStatus Init(mfxVideoParam *par) { return MFXVideoENC_Init(m_session, par); } - virtual mfxStatus Reset(mfxVideoParam *par) { return MFXVideoENC_Reset(m_session, par); } - virtual mfxStatus Close(void) { return MFXVideoENC_Close(m_session); } - - virtual mfxStatus GetVideoParam(mfxVideoParam *par) { return MFXVideoENC_GetVideoParam(m_session, par); } - virtual mfxStatus ProcessFrameAsync(mfxENCInput *in, mfxENCOutput *out, mfxSyncPoint *syncp) { return MFXVideoENC_ProcessFrameAsync(m_session, in, out, syncp); } - -protected: - - mfxSession m_session; // (mfxSession) handle to the owning session -}; - -class MFXVideoPAK -{ -public: - - MFXVideoPAK(mfxSession session) { m_session = session; } - virtual ~MFXVideoPAK(void) { Close(); } - - virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { return MFXVideoPAK_Query(m_session, in, out); } - virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) { return MFXVideoPAK_QueryIOSurf(m_session, par, request); } - virtual mfxStatus Init(mfxVideoParam *par) { return MFXVideoPAK_Init(m_session, par); } - virtual mfxStatus Reset(mfxVideoParam *par) { return MFXVideoPAK_Reset(m_session, par); } - virtual mfxStatus Close(void) { return MFXVideoPAK_Close(m_session); } - - virtual mfxStatus GetVideoParam(mfxVideoParam *par) { return MFXVideoPAK_GetVideoParam(m_session, par); } - //virtual mfxStatus GetEncodeStat(mfxEncodeStat *stat) { return MFXVideoENCODE_GetEncodeStat(m_session, stat); } - - virtual mfxStatus ProcessFrameAsync(mfxPAKInput *in, mfxPAKOutput *out, mfxSyncPoint *syncp) { return MFXVideoPAK_ProcessFrameAsync(m_session, in, out, syncp); } - -protected: - - mfxSession m_session; // (mfxSession) handle to the owning session -}; - -#endif // __MFXVIDEOPLUSPLUS_H diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxvideo.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxvideo.h deleted file mode 100644 index aee387a72..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxvideo.h +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) 2017-2019 Intel Corporation -// -// 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 __MFXVIDEO_H__ -#define __MFXVIDEO_H__ -#include "mfxsession.h" -#include "mfxvstructures.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* MFXVideoCORE */ -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxU32 reserved[4]; - mfxHDL pthis; - mfxStatus (MFX_CDECL *Alloc) (mfxHDL pthis, mfxU32 nbytes, mfxU16 type, mfxMemId *mid); - mfxStatus (MFX_CDECL *Lock) (mfxHDL pthis, mfxMemId mid, mfxU8 **ptr); - mfxStatus (MFX_CDECL *Unlock) (mfxHDL pthis, mfxMemId mid); - mfxStatus (MFX_CDECL *Free) (mfxHDL pthis, mfxMemId mid); -} mfxBufferAllocator; -MFX_PACK_END() - -MFX_PACK_BEGIN_STRUCT_W_PTR() -typedef struct { - mfxU32 reserved[4]; - mfxHDL pthis; - - mfxStatus (MFX_CDECL *Alloc) (mfxHDL pthis, mfxFrameAllocRequest *request, mfxFrameAllocResponse *response); - mfxStatus (MFX_CDECL *Lock) (mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr); - mfxStatus (MFX_CDECL *Unlock) (mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr); - mfxStatus (MFX_CDECL *GetHDL) (mfxHDL pthis, mfxMemId mid, mfxHDL *handle); - mfxStatus (MFX_CDECL *Free) (mfxHDL pthis, mfxFrameAllocResponse *response); -} mfxFrameAllocator; -MFX_PACK_END() - -/* VideoCORE */ -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoCORE_SetBufferAllocator(mfxSession session, mfxBufferAllocator *allocator); -mfxStatus MFX_CDECL MFXVideoCORE_SetFrameAllocator(mfxSession session, mfxFrameAllocator *allocator); -mfxStatus MFX_CDECL MFXVideoCORE_SetHandle(mfxSession session, mfxHandleType type, mfxHDL hdl); -mfxStatus MFX_CDECL MFXVideoCORE_GetHandle(mfxSession session, mfxHandleType type, mfxHDL *hdl); -mfxStatus MFX_CDECL MFXVideoCORE_QueryPlatform(mfxSession session, mfxPlatform* platform); -mfxStatus MFX_CDECL MFXVideoCORE_SyncOperation(mfxSession session, mfxSyncPoint syncp, mfxU32 wait); - -/* VideoENCODE */ -mfxStatus MFX_CDECL MFXVideoENCODE_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out); -mfxStatus MFX_CDECL MFXVideoENCODE_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request); -mfxStatus MFX_CDECL MFXVideoENCODE_Init(mfxSession session, mfxVideoParam *par); -mfxStatus MFX_CDECL MFXVideoENCODE_Reset(mfxSession session, mfxVideoParam *par); -mfxStatus MFX_CDECL MFXVideoENCODE_Close(mfxSession session); - -mfxStatus MFX_CDECL MFXVideoENCODE_GetVideoParam(mfxSession session, mfxVideoParam *par); -mfxStatus MFX_CDECL MFXVideoENCODE_GetEncodeStat(mfxSession session, mfxEncodeStat *stat); -mfxStatus MFX_CDECL MFXVideoENCODE_EncodeFrameAsync(mfxSession session, mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxSyncPoint *syncp); - -/* VideoDECODE */ -mfxStatus MFX_CDECL MFXVideoDECODE_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out); -mfxStatus MFX_CDECL MFXVideoDECODE_DecodeHeader(mfxSession session, mfxBitstream *bs, mfxVideoParam *par); -mfxStatus MFX_CDECL MFXVideoDECODE_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request); -mfxStatus MFX_CDECL MFXVideoDECODE_Init(mfxSession session, mfxVideoParam *par); -mfxStatus MFX_CDECL MFXVideoDECODE_Reset(mfxSession session, mfxVideoParam *par); -mfxStatus MFX_CDECL MFXVideoDECODE_Close(mfxSession session); - -mfxStatus MFX_CDECL MFXVideoDECODE_GetVideoParam(mfxSession session, mfxVideoParam *par); -mfxStatus MFX_CDECL MFXVideoDECODE_GetDecodeStat(mfxSession session, mfxDecodeStat *stat); -mfxStatus MFX_CDECL MFXVideoDECODE_SetSkipMode(mfxSession session, mfxSkipMode mode); -mfxStatus MFX_CDECL MFXVideoDECODE_GetPayload(mfxSession session, mfxU64 *ts, mfxPayload *payload); -mfxStatus MFX_CDECL MFXVideoDECODE_DecodeFrameAsync(mfxSession session, mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxSyncPoint *syncp); - -/* VideoVPP */ -mfxStatus MFX_CDECL MFXVideoVPP_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out); -mfxStatus MFX_CDECL MFXVideoVPP_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest request[2]); -mfxStatus MFX_CDECL MFXVideoVPP_Init(mfxSession session, mfxVideoParam *par); -mfxStatus MFX_CDECL MFXVideoVPP_Reset(mfxSession session, mfxVideoParam *par); -mfxStatus MFX_CDECL MFXVideoVPP_Close(mfxSession session); - -mfxStatus MFX_CDECL MFXVideoVPP_GetVideoParam(mfxSession session, mfxVideoParam *par); -mfxStatus MFX_CDECL MFXVideoVPP_GetVPPStat(mfxSession session, mfxVPPStat *stat); -mfxStatus MFX_CDECL MFXVideoVPP_RunFrameVPPAsync(mfxSession session, mfxFrameSurface1 *in, mfxFrameSurface1 *out, mfxExtVppAuxData *aux, mfxSyncPoint *syncp); -MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoVPP_RunFrameVPPAsyncEx(mfxSession session, mfxFrameSurface1 *in, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxSyncPoint *syncp); - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif diff --git a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxvstructures.h b/plugins/obs-qsv11/libmfx/include/msdk/include/mfxvstructures.h deleted file mode 100644 index 5fbefece7..000000000 --- a/plugins/obs-qsv11/libmfx/include/msdk/include/mfxvstructures.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2017 Intel Corporation -// -// 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 "mfxstructures.h" - - diff --git a/plugins/obs-qsv11/libmfx/src/main.cpp b/plugins/obs-qsv11/libmfx/src/main.cpp deleted file mode 100644 index 7b8a10736..000000000 --- a/plugins/obs-qsv11/libmfx/src/main.cpp +++ /dev/null @@ -1,1166 +0,0 @@ -// Copyright (c) 2012-2020 Intel Corporation -// -// 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 - -#include -#include - -#include "mfx_dispatcher.h" -#include "mfx_load_dll.h" -#include "mfx_dispatcher_log.h" -#include "mfx_library_iterator.h" -#include "mfx_critical_section.h" - -#if defined(MEDIASDK_UWP_DISPATCHER) -#include "mfx_dispatcher_uwp.h" -#endif - -#include /* for memset on Linux */ - -#include /* for qsort on Linux */ -#include "mfx_load_plugin.h" -#include "mfx_plugin_hive.h" - -// module-local definitions -namespace -{ - - const - struct - { - // instance implementation type - eMfxImplType implType; - // real implementation - mfxIMPL impl; - // adapter numbers - mfxU32 adapterID; - - } implTypes[] = - { - // MFX_IMPL_AUTO case - {MFX_LIB_HARDWARE, MFX_IMPL_HARDWARE, 0}, - {MFX_LIB_SOFTWARE, MFX_IMPL_SOFTWARE, 0}, - - // MFX_IMPL_ANY case - {MFX_LIB_HARDWARE, MFX_IMPL_HARDWARE, 0}, - {MFX_LIB_HARDWARE, MFX_IMPL_HARDWARE2, 1}, - {MFX_LIB_HARDWARE, MFX_IMPL_HARDWARE3, 2}, - {MFX_LIB_HARDWARE, MFX_IMPL_HARDWARE4, 3}, - {MFX_LIB_SOFTWARE, MFX_IMPL_SOFTWARE, 0}, - {MFX_LIB_SOFTWARE, MFX_IMPL_SOFTWARE | MFX_IMPL_AUDIO, 0}, -#if (MFX_VERSION >= MFX_VERSION_NEXT) - //MFX_SINGLE_THREAD case - {MFX_LIB_HARDWARE, MFX_IMPL_HARDWARE | MFX_IMPL_EXTERNAL_THREADING, 0}, - {MFX_LIB_HARDWARE, MFX_IMPL_HARDWARE2 | MFX_IMPL_EXTERNAL_THREADING, 1}, - {MFX_LIB_HARDWARE, MFX_IMPL_HARDWARE3 | MFX_IMPL_EXTERNAL_THREADING, 2}, - {MFX_LIB_HARDWARE, MFX_IMPL_HARDWARE4 | MFX_IMPL_EXTERNAL_THREADING, 3}, -#endif - }; - - const - struct - { - // start index in implTypes table for specified implementation - mfxU32 minIndex; - // last index in implTypes table for specified implementation - mfxU32 maxIndex; - - } implTypesRange[] = - { - {0, 1}, // MFX_IMPL_AUTO - {1, 1}, // MFX_IMPL_SOFTWARE - {0, 0}, // MFX_IMPL_HARDWARE - {2, 6}, // MFX_IMPL_AUTO_ANY - {2, 5}, // MFX_IMPL_HARDWARE_ANY - {3, 3}, // MFX_IMPL_HARDWARE2 - {4, 4}, // MFX_IMPL_HARDWARE3 - {5, 5}, // MFX_IMPL_HARDWARE4 - {2, 6}, // MFX_IMPL_RUNTIME, same as MFX_IMPL_HARDWARE_ANY -#if (MFX_VERSION >= MFX_VERSION_NEXT) - {8, 11}, // MFX_SINGLE_THREAD, -#endif - {7, 7} // MFX_IMPL_AUDIO - }; - - MFX::mfxCriticalSection dispGuard = 0; - -} // namespace - -using namespace MFX; - -#if !defined(MEDIASDK_UWP_DISPATCHER) - -// -// Implement DLL exposed functions. MFXInit and MFXClose have to do -// slightly more than other. They require to be implemented explicitly. -// All other functions are implemented implicitly. -// - -typedef MFXVector HandleVector; -typedef MFXVector StatusVector; - -struct VectorHandleGuard -{ - VectorHandleGuard(HandleVector& aVector): m_vector(aVector) {} - ~VectorHandleGuard() - { - HandleVector::iterator it = m_vector.begin(), - et = m_vector.end(); - for ( ; it != et; ++it) - { - delete *it; - } - } - - HandleVector& m_vector; -private: - void operator=(const VectorHandleGuard&); -}; - - -static int HandleSort (const void * plhs, const void * prhs) -{ - const MFX_DISP_HANDLE_EX * lhs = *(const MFX_DISP_HANDLE_EX **)plhs; - const MFX_DISP_HANDLE_EX * rhs = *(const MFX_DISP_HANDLE_EX **)prhs; - - // prefer HW implementation - if (lhs->implType != MFX_LIB_HARDWARE && rhs->implType == MFX_LIB_HARDWARE) - { - return 1; - } - if (lhs->implType == MFX_LIB_HARDWARE && rhs->implType != MFX_LIB_HARDWARE) - { - return -1; - } - - // prefer integrated GPU - if (lhs->mediaAdapterType != MFX_MEDIA_INTEGRATED && rhs->mediaAdapterType == MFX_MEDIA_INTEGRATED) - { - return 1; - } - if (lhs->mediaAdapterType == MFX_MEDIA_INTEGRATED && rhs->mediaAdapterType != MFX_MEDIA_INTEGRATED) - { - return -1; - } - - // prefer dll with lower API version - if (lhs->actualApiVersion < rhs->actualApiVersion) - { - return -1; - } - if (rhs->actualApiVersion < lhs->actualApiVersion) - { - return 1; - } - - // if versions are equal prefer library with HW - if (lhs->loadStatus == MFX_WRN_PARTIAL_ACCELERATION && rhs->loadStatus == MFX_ERR_NONE) - { - return 1; - } - if (lhs->loadStatus == MFX_ERR_NONE && rhs->loadStatus == MFX_WRN_PARTIAL_ACCELERATION) - { - return -1; - } - - return 0; -} - -mfxStatus MFXInitEx(mfxInitParam par, mfxSession *session) -{ - MFX::MFXAutomaticCriticalSection guard(&dispGuard); - - DISPATCHER_LOG_BLOCK( ("MFXInitEx (impl=%s, pVer=%d.%d, ExternalThreads=%d session=0x%p\n" - , DispatcherLog_GetMFXImplString(par.Implementation).c_str() - , par.Version.Major - , par.Version.Minor - , par.ExternalThreads - , session)); - - mfxStatus mfxRes = MFX_ERR_UNSUPPORTED; - HandleVector allocatedHandle; - VectorHandleGuard handleGuard(allocatedHandle); - - MFX_DISP_HANDLE_EX *pHandle; - wchar_t dllName[MFX_MAX_DLL_PATH] = { 0 }; - MFX::MFXLibraryIterator libIterator; - - // there iterators are used only if the caller specified implicit type like AUTO - mfxU32 curImplIdx, maxImplIdx; - // implementation method masked from the input parameter - // special case for audio library - const mfxIMPL implMethod = (par.Implementation & MFX_IMPL_AUDIO) ? (sizeof(implTypesRange) / sizeof(implTypesRange[0]) - 1) : (par.Implementation & (MFX_IMPL_VIA_ANY - 1)); - - // implementation interface masked from the input parameter - mfxIMPL implInterface = par.Implementation & -MFX_IMPL_VIA_ANY; -#if (MFX_VERSION >= MFX_VERSION_NEXT) - bool isSingleThread = (implInterface & MFX_IMPL_EXTERNAL_THREADING) > 0; - implInterface &= ~MFX_IMPL_EXTERNAL_THREADING; -#endif - mfxIMPL implInterfaceOrig = implInterface; - mfxVersion requiredVersion = {{MFX_VERSION_MINOR, MFX_VERSION_MAJOR}}; - - // check error(s) - if (NULL == session) - { - return MFX_ERR_NULL_PTR; - } - -#if (MFX_VERSION >= MFX_VERSION_NEXT) - if (((MFX_IMPL_AUTO > implMethod) || (MFX_IMPL_SINGLE_THREAD < implMethod)) && !(par.Implementation & MFX_IMPL_AUDIO)) -#else - if (((MFX_IMPL_AUTO > implMethod) || (MFX_IMPL_RUNTIME < implMethod)) && !(par.Implementation & MFX_IMPL_AUDIO)) -#endif - { - return MFX_ERR_UNSUPPORTED; - } - - // set the minimal required version - requiredVersion = par.Version; - - try - { - // reset the session value - *session = 0; - - // allocate the dispatching handle and call-table - pHandle = new MFX_DISP_HANDLE_EX(requiredVersion); - } - catch(...) - { - return MFX_ERR_MEMORY_ALLOC; - } - - DISPATCHER_LOG_INFO((("Required API version is %u.%u\n"), requiredVersion.Major, requiredVersion.Minor)); - // particular implementation value - mfxIMPL curImpl; - - // Load HW library or RT from system location - curImplIdx = implTypesRange[implMethod].minIndex; - maxImplIdx = implTypesRange[implMethod].maxIndex; - do - { -#if (MFX_VERSION >= MFX_VERSION_NEXT) - if (isSingleThread && implTypes[curImplIdx].implType != MFX_LIB_HARDWARE) - continue; -#endif - - int currentStorage = MFX::MFX_STORAGE_ID_FIRST; - implInterface = implInterfaceOrig; - do - { - // this storage will be checked below - if (currentStorage == MFX::MFX_APP_FOLDER) - { - currentStorage += 1; - continue; - } - - // initialize the library iterator - mfxRes = libIterator.Init(implTypes[curImplIdx].implType, - implInterface, - implTypes[curImplIdx].adapterID, - currentStorage); - - // look through the list of installed SDK version, - // looking for a suitable library with higher merit value. - if (MFX_ERR_NONE == mfxRes) - { - - if ( - MFX_LIB_HARDWARE == implTypes[curImplIdx].implType - && (!implInterface - || MFX_IMPL_VIA_ANY == implInterface)) - { - implInterface = libIterator.GetImplementationType(); - } - - do - { - eMfxImplType implType = implTypes[curImplIdx].implType; - - // select a desired DLL - mfxRes = libIterator.SelectDLLVersion(dllName, - sizeof(dllName) / sizeof(dllName[0]), - &implType, - pHandle->apiVersion); - if (MFX_ERR_NONE != mfxRes) - { - break; - } - DISPATCHER_LOG_INFO((("loading library %S\n"), dllName)); - // try to load the selected DLL - curImpl = implTypes[curImplIdx].impl; -#if (MFX_VERSION >= MFX_VERSION_NEXT) - if (isSingleThread) - curImpl |= MFX_IMPL_EXTERNAL_THREADING; -#endif - mfxRes = pHandle->LoadSelectedDLL(dllName, implType, curImpl, implInterface, par); - // unload the failed DLL - if (MFX_ERR_NONE != mfxRes) - { - pHandle->Close(); - continue; - } - - mfxPlatform platform = { MFX_PLATFORM_UNKNOWN, 0, MFX_MEDIA_UNKNOWN }; - if (pHandle->callTable[eMFXVideoCORE_QueryPlatform]) - { - mfxRes = MFXVideoCORE_QueryPlatform((mfxSession)pHandle, &platform); - if (MFX_ERR_NONE != mfxRes) - { - DISPATCHER_LOG_WRN(("MFXVideoCORE_QueryPlatform failed, rejecting loaded library\n")); - pHandle->Close(); - continue; - } - } - pHandle->mediaAdapterType = platform.MediaAdapterType; - DISPATCHER_LOG_INFO((("media adapter type is %d\n"), pHandle->mediaAdapterType)); - - libIterator.GetSubKeyName(pHandle->subkeyName, sizeof(pHandle->subkeyName) / sizeof(pHandle->subkeyName[0])); - pHandle->storageID = libIterator.GetStorageID(); - allocatedHandle.push_back(pHandle); - pHandle = new MFX_DISP_HANDLE_EX(requiredVersion); - - } while (MFX_ERR_NONE != mfxRes); - } - - // select another place for loading engine - currentStorage += 1; - - } while ((MFX_ERR_NONE != mfxRes) && (MFX::MFX_STORAGE_ID_LAST >= currentStorage)); - - } while (++curImplIdx <= maxImplIdx); - - curImplIdx = implTypesRange[implMethod].minIndex; - maxImplIdx = implTypesRange[implMethod].maxIndex; - - // Load RT from app folder (libmfxsw64 with API >= 1.10) - do - { -#if (MFX_VERSION >= MFX_VERSION_NEXT) - if (isSingleThread && implTypes[curImplIdx].implType != MFX_LIB_HARDWARE) - continue; -#endif - - implInterface = implInterfaceOrig; - // initialize the library iterator - mfxRes = libIterator.Init(implTypes[curImplIdx].implType, - implInterface, - implTypes[curImplIdx].adapterID, - MFX::MFX_APP_FOLDER); - - if (MFX_ERR_NONE == mfxRes) - { - - if ( - MFX_LIB_HARDWARE == implTypes[curImplIdx].implType - && (!implInterface - || MFX_IMPL_VIA_ANY == implInterface)) - { - implInterface = libIterator.GetImplementationType(); - } - - do - { - eMfxImplType implType; - - // select a desired DLL - mfxRes = libIterator.SelectDLLVersion(dllName, - sizeof(dllName) / sizeof(dllName[0]), - &implType, - pHandle->apiVersion); - if (MFX_ERR_NONE != mfxRes) - { - break; - } - DISPATCHER_LOG_INFO((("loading library %S\n"), dllName)); - - // try to load the selected DLL - curImpl = implTypes[curImplIdx].impl; -#if (MFX_VERSION >= MFX_VERSION_NEXT) - if (isSingleThread) - curImpl |= MFX_IMPL_EXTERNAL_THREADING; -#endif - mfxRes = pHandle->LoadSelectedDLL(dllName, implType, curImpl, implInterface, par); - // unload the failed DLL - if (MFX_ERR_NONE != mfxRes) - { - pHandle->Close(); - } - else - { - if (pHandle->actualApiVersion.Major == 1 && pHandle->actualApiVersion.Minor <= 9) - { - // this is not RT, skip it - mfxRes = MFX_ERR_ABORTED; - break; - } - pHandle->storageID = MFX::MFX_UNKNOWN_KEY; - allocatedHandle.push_back(pHandle); - pHandle = new MFX_DISP_HANDLE_EX(requiredVersion); - } - - } while (MFX_ERR_NONE != mfxRes); - } - } while ((MFX_ERR_NONE != mfxRes) && (++curImplIdx <= maxImplIdx)); - - // Load HW and SW libraries using legacy default DLL search mechanism - // set current library index again - curImplIdx = implTypesRange[implMethod].minIndex; - do - { -#if (MFX_VERSION >= MFX_VERSION_NEXT) - if (isSingleThread && implTypes[curImplIdx].implType != MFX_LIB_HARDWARE) - continue; -#endif - - implInterface = implInterfaceOrig; - - if (par.Implementation & MFX_IMPL_AUDIO) - { - mfxRes = MFX::mfx_get_default_audio_dll_name(dllName, - sizeof(dllName) / sizeof(dllName[0]), - implTypes[curImplIdx].implType); - } - else - { - mfxRes = MFX::mfx_get_default_dll_name(dllName, - sizeof(dllName) / sizeof(dllName[0]), - implTypes[curImplIdx].implType); - } - - if (MFX_ERR_NONE == mfxRes) - { - DISPATCHER_LOG_INFO((("loading default library %S\n"), dllName)) - - // try to load the selected DLL using default DLL search mechanism - if (MFX_LIB_HARDWARE == implTypes[curImplIdx].implType) - { - if (!implInterface) - { - implInterface = MFX_IMPL_VIA_ANY; - } - mfxU32 curVendorID = 0, curDeviceID = 0; - mfxRes = MFX::SelectImplementationType(implTypes[curImplIdx].adapterID, &implInterface, &curVendorID, &curDeviceID); - if (curVendorID != INTEL_VENDOR_ID) - mfxRes = MFX_ERR_UNKNOWN; - } - if (MFX_ERR_NONE == mfxRes) - { - curImpl = implTypes[curImplIdx].impl; -#if (MFX_VERSION >= MFX_VERSION_NEXT) - if (isSingleThread) - curImpl |= MFX_IMPL_EXTERNAL_THREADING; -#endif - // try to load the selected DLL using default DLL search mechanism - mfxRes = pHandle->LoadSelectedDLL(dllName, - implTypes[curImplIdx].implType, - curImpl, - implInterface, - par); - } - // unload the failed DLL - if ((MFX_ERR_NONE != mfxRes) && - (MFX_WRN_PARTIAL_ACCELERATION != mfxRes)) - { - pHandle->Close(); - } - else - { - pHandle->storageID = MFX::MFX_UNKNOWN_KEY; - allocatedHandle.push_back(pHandle); - pHandle = new MFX_DISP_HANDLE_EX(requiredVersion); - } - } - } - while ((MFX_ERR_NONE > mfxRes) && (++curImplIdx <= maxImplIdx)); - delete pHandle; - - if (allocatedHandle.size() == 0) - return MFX_ERR_UNSUPPORTED; - - { // sort candidate list - bool NeedSort = false; - HandleVector::iterator first = allocatedHandle.begin(), - it = allocatedHandle.begin(), - et = allocatedHandle.end(); - for (it++; it != et; ++it) - if (HandleSort(&(*first), &(*it)) != 0) - NeedSort = true; - - // sort allocatedHandle so that the most preferred dll is at the beginning - if (NeedSort) - qsort(&(*allocatedHandle.begin()), allocatedHandle.size(), sizeof(MFX_DISP_HANDLE_EX*), &HandleSort); - } - HandleVector::iterator candidate = allocatedHandle.begin(); - // check the final result of loading - try - { - pHandle = *candidate; - //pulling up current mediasdk version, that required to match plugin version - mfxVersion apiVerActual = { { 0, 0 } }; - mfxStatus stsQueryVersion = MFXQueryVersion((mfxSession)pHandle, &apiVerActual); - - if (MFX_ERR_NONE != stsQueryVersion) - { - DISPATCHER_LOG_ERROR((("MFXQueryVersion returned: %d, cannot load plugins\n"), mfxRes)) - } - else - { - MFX::MFXPluginStorage & hive = pHandle->pluginHive; - - HandleVector::iterator it = allocatedHandle.begin(), - et = allocatedHandle.end(); - for (; it != et; ++it) - { - // Registering default plugins set - MFX::MFXDefaultPlugins defaultPugins(apiVerActual, *it, (*it)->implType); - hive.insert(hive.end(), defaultPugins.begin(), defaultPugins.end()); - - if ((*it)->storageID != MFX::MFX_UNKNOWN_KEY) - { - // Scan HW plugins in subkeys of registry library - MFX::MFXPluginsInHive plgsInHive((*it)->storageID, (*it)->subkeyName, apiVerActual); - hive.insert(hive.end(), plgsInHive.begin(), plgsInHive.end()); - } - } - - //setting up plugins records - for(int i = MFX::MFX_STORAGE_ID_FIRST; i <= MFX::MFX_STORAGE_ID_LAST; i++) - { - MFX::MFXPluginsInHive plgsInHive(i, NULL, apiVerActual); - hive.insert(hive.end(), plgsInHive.begin(), plgsInHive.end()); - } - - // SOLID dispatcher also loads plug-ins from file system - MFX::MFXPluginsInFS plgsInFS(apiVerActual); - hive.insert(hive.end(), plgsInFS.begin(), plgsInFS.end()); - } - - pHandle->callPlugInsTable[eMFXVideoUSER_Load] = (mfxFunctionPointer)MFXVideoUSER_Load; - pHandle->callPlugInsTable[eMFXVideoUSER_LoadByPath] = (mfxFunctionPointer)MFXVideoUSER_LoadByPath; - pHandle->callPlugInsTable[eMFXVideoUSER_UnLoad] = (mfxFunctionPointer)MFXVideoUSER_UnLoad; - pHandle->callPlugInsTable[eMFXAudioUSER_Load] = (mfxFunctionPointer)MFXAudioUSER_Load; - pHandle->callPlugInsTable[eMFXAudioUSER_UnLoad] = (mfxFunctionPointer)MFXAudioUSER_UnLoad; - - } - catch(...) - { - DISPATCHER_LOG_ERROR((("unknown exception while loading plugins\n"))) - } - - // everything is OK. Save pointers to the output variable - *candidate = 0; // keep this one safe from guard destructor - - - //=================================== - - // MFXVideoCORE_QueryPlatform call creates d3d device handle, so we have handle right after MFXInit and can't accept external handle - // This is a workaround which calls close-init to remove that handle - - mfxFunctionPointer *actualTable = (pHandle->impl & MFX_IMPL_AUDIO) ? pHandle->callAudioTable : pHandle->callTable; - mfxFunctionPointer pFunc; - - pFunc = actualTable[eMFXClose]; - mfxRes = (*(mfxStatus(MFX_CDECL *) (mfxSession)) pFunc) (pHandle->session); - if (mfxRes != MFX_ERR_NONE) - return mfxRes; - - pHandle->session = 0; - bool callOldInit = (pHandle->impl & MFX_IMPL_AUDIO) || !actualTable[eMFXInitEx]; - pFunc = actualTable[(callOldInit) ? eMFXInit : eMFXInitEx]; - - mfxVersion version(pHandle->apiVersion); - if (callOldInit) - { - pHandle->loadStatus = (*(mfxStatus(MFX_CDECL *) (mfxIMPL, mfxVersion *, mfxSession *)) pFunc) (pHandle->impl | pHandle->implInterface, &version, &pHandle->session); - } - else - { - mfxInitParam initPar = par; - initPar.Implementation = pHandle->impl | pHandle->implInterface; - initPar.Version = version; - pHandle->loadStatus = (*(mfxStatus(MFX_CDECL *) (mfxInitParam, mfxSession *)) pFunc) (initPar, &pHandle->session); - } - - //=================================== - - *((MFX_DISP_HANDLE_EX **) session) = pHandle; - - return pHandle->loadStatus; - -} // mfxStatus MFXInitEx(mfxIMPL impl, mfxVersion *ver, mfxSession *session) - -mfxStatus MFXClose(mfxSession session) -{ - MFX::MFXAutomaticCriticalSection guard(&dispGuard); - - mfxStatus mfxRes = MFX_ERR_INVALID_HANDLE; - MFX_DISP_HANDLE *pHandle = (MFX_DISP_HANDLE *) session; - - // check error(s) - if (pHandle) - { - try - { - // unload the DLL library - mfxRes = pHandle->Close(); - - // it is possible, that there is an active child session. - // can't unload library in that case. - if (MFX_ERR_UNDEFINED_BEHAVIOR != mfxRes) - { - // release the handle - delete pHandle; - } - } - catch(...) - { - mfxRes = MFX_ERR_INVALID_HANDLE; - } - } - - return mfxRes; - -} // mfxStatus MFXClose(mfxSession session) - -mfxStatus MFXVideoUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version) -{ - mfxStatus sts = MFX_ERR_NONE; - bool ErrFlag = false; - if (!session) - { - DISPATCHER_LOG_ERROR((("MFXVideoUSER_Load: session=NULL\n"))); - return MFX_ERR_NULL_PTR; - } - MFX_DISP_HANDLE &pHandle = *(MFX_DISP_HANDLE *) session; - if (!uid) - { - DISPATCHER_LOG_ERROR((("MFXVideoUSER_Load: uid=NULL\n"))); - return MFX_ERR_NULL_PTR; - } - DISPATCHER_LOG_INFO((("MFXVideoUSER_Load: uid=" MFXGUIDTYPE()" version=%d\n") - , MFXGUIDTOHEX(uid) - , version)) - size_t pluginsChecked = 0; - - for (MFX::MFXPluginStorage::iterator i = pHandle.pluginHive.begin();i != pHandle.pluginHive.end(); i++, pluginsChecked++) - { - if (i->PluginUID != *uid) - { - continue; - } - //check rest in records - if (i->PluginVersion < version) - { - DISPATCHER_LOG_INFO((("MFXVideoUSER_Load: registered \"Plugin Version\" for GUID=" MFXGUIDTYPE()" is %d, that is smaller that requested\n") - , MFXGUIDTOHEX(uid) - , i->PluginVersion)) - continue; - } - try - { - sts = pHandle.pluginFactory.Create(*i); - if( MFX_ERR_NONE != sts) - { - ErrFlag = (ErrFlag || (sts == MFX_ERR_UNDEFINED_BEHAVIOR)); - continue; - } - return MFX_ERR_NONE; - } - catch(...) - { - continue; - } - } - - // Specified UID was not found among individually registed plugins, now try load it from default sets if any - for (MFX::MFXPluginStorage::iterator i = pHandle.pluginHive.begin();i != pHandle.pluginHive.end(); i++, pluginsChecked++) - { - if (!i->Default) - continue; - - i->PluginUID = *uid; - i->PluginVersion = (mfxU16)version; - try - { - sts = pHandle.pluginFactory.Create(*i); - if( MFX_ERR_NONE != sts) - { - ErrFlag = (ErrFlag || (sts == MFX_ERR_UNDEFINED_BEHAVIOR)); - continue; - } - return MFX_ERR_NONE; - } - catch(...) - { - continue; - } - } - - DISPATCHER_LOG_ERROR((("MFXVideoUSER_Load: cannot find registered plugin with requested UID, total plugins available=%d\n"), pHandle.pluginHive.size())); - if (ErrFlag) - return MFX_ERR_UNDEFINED_BEHAVIOR; - else - return MFX_ERR_NOT_FOUND; -} - - -mfxStatus MFXVideoUSER_LoadByPath(mfxSession session, const mfxPluginUID *uid, mfxU32 version, const mfxChar *path, mfxU32 len) -{ - if (!session) - { - DISPATCHER_LOG_ERROR((("MFXVideoUSER_LoadByPath: session=NULL\n"))); - return MFX_ERR_NULL_PTR; - } - MFX_DISP_HANDLE &pHandle = *(MFX_DISP_HANDLE *) session; - if (!uid) - { - DISPATCHER_LOG_ERROR((("MFXVideoUSER_LoadByPath: uid=NULL\n"))); - return MFX_ERR_NULL_PTR; - } - - DISPATCHER_LOG_INFO((("MFXVideoUSER_LoadByPath: %S uid=" MFXGUIDTYPE()" version=%d\n") - , path - , MFXGUIDTOHEX(uid) - , version)) - - PluginDescriptionRecord record; - record.sName[0] = 0; - - wchar_t wPath[MAX_PLUGIN_PATH]; - int res = ::MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, path, len, wPath, MAX_PLUGIN_PATH-1); - - if (!res) - { - DISPATCHER_LOG_ERROR((("MFXVideoUSER_LoadByPath: can't convert UTF-8 path to UTF-16\n"))); - return MFX_ERR_NOT_FOUND; - } - wPath[res]=0; - - wcscpy_s(record.sPath, MAX_PLUGIN_PATH, wPath); - - record.PluginUID = *uid; - record.PluginVersion = (mfxU16)version; - record.Default = true; - - try - { - return pHandle.pluginFactory.Create(record); - } - catch(...) - { - return MFX_ERR_NOT_FOUND; - } -} - - -mfxStatus MFXVideoUSER_UnLoad(mfxSession session, const mfxPluginUID *uid) -{ - if (!session) - { - DISPATCHER_LOG_ERROR((("MFXVideoUSER_UnLoad: session=NULL\n"))); - return MFX_ERR_NULL_PTR; - } - MFX_DISP_HANDLE &rHandle = *(MFX_DISP_HANDLE *) session; - if (!uid) - { - DISPATCHER_LOG_ERROR((("MFXVideoUSER_UnLoad: uid=NULL\n"))); - return MFX_ERR_NULL_PTR; - } - - bool bDestroyed = rHandle.pluginFactory.Destroy(*uid); - if (bDestroyed) - { - DISPATCHER_LOG_INFO((("MFXVideoUSER_UnLoad : plugin with GUID=" MFXGUIDTYPE()" unloaded\n"), MFXGUIDTOHEX(uid))); - } else - { - DISPATCHER_LOG_ERROR((("MFXVideoUSER_UnLoad : plugin with GUID=" MFXGUIDTYPE()" not found\n"), MFXGUIDTOHEX(uid))); - } - - return bDestroyed ? MFX_ERR_NONE : MFX_ERR_NOT_FOUND; -} - -mfxStatus MFXAudioUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version) -{ - if (!session) - { - DISPATCHER_LOG_ERROR((("MFXAudioUSER_Load: session=NULL\n"))); - return MFX_ERR_NULL_PTR; - } - MFX_DISP_HANDLE &pHandle = *(MFX_DISP_HANDLE *) session; - if (!uid) - { - DISPATCHER_LOG_ERROR((("MFXAudioUSER_Load: uid=NULL\n"))); - return MFX_ERR_NULL_PTR; - } - DISPATCHER_LOG_INFO((("MFXAudioUSER_Load: uid=" MFXGUIDTYPE()" version=%d\n") - , MFXGUIDTOHEX(uid) - , version)) - size_t pluginsChecked = 0; - PluginDescriptionRecord defaultPluginRecord; - for (MFX::MFXPluginStorage::iterator i = pHandle.pluginHive.begin();i != pHandle.pluginHive.end(); i++, pluginsChecked++) - { - if (i->PluginUID != *uid) - { - if (i->Default) // PluginUID == 0 for default set - { - defaultPluginRecord = *i; - } - continue; - } - //check rest in records - if (i->PluginVersion < version) - { - DISPATCHER_LOG_INFO((("MFXAudioUSER_Load: registered \"Plugin Version\" for GUID=" MFXGUIDTYPE()" is %d, that is smaller that requested\n") - , MFXGUIDTOHEX(uid) - , i->PluginVersion)) - continue; - } - try { - return pHandle.pluginFactory.Create(*i); - } - catch(...) { - return MFX_ERR_UNKNOWN; - } - } - - // Specified UID was not found among individually registed plugins, now try load it from default set if any - if (defaultPluginRecord.Default) - { - defaultPluginRecord.PluginUID = *uid; - defaultPluginRecord.onlyVersionRegistered = true; - defaultPluginRecord.PluginVersion = (mfxU16)version; - try { - return pHandle.pluginFactory.Create(defaultPluginRecord); - } - catch(...) { - return MFX_ERR_UNKNOWN; - } - } - - DISPATCHER_LOG_ERROR((("MFXAudioUSER_Load: cannot find registered plugin with requested UID, total plugins available=%d\n"), pHandle.pluginHive.size())); - return MFX_ERR_NOT_FOUND; -} - -mfxStatus MFXAudioUSER_UnLoad(mfxSession session, const mfxPluginUID *uid) -{ - if (!session) - { - DISPATCHER_LOG_ERROR((("MFXAudioUSER_UnLoad: session=NULL\n"))); - return MFX_ERR_NULL_PTR; - } - MFX_DISP_HANDLE &rHandle = *(MFX_DISP_HANDLE *) session; - if (!uid) - { - DISPATCHER_LOG_ERROR((("MFXAudioUSER_Load: uid=NULL\n"))); - return MFX_ERR_NULL_PTR; - } - - bool bDestroyed = rHandle.pluginFactory.Destroy(*uid); - if (bDestroyed) - { - DISPATCHER_LOG_INFO((("MFXAudioUSER_UnLoad : plugin with GUID=" MFXGUIDTYPE()" unloaded\n"), MFXGUIDTOHEX(uid))); - } else - { - DISPATCHER_LOG_ERROR((("MFXAudioUSER_UnLoad : plugin with GUID=" MFXGUIDTYPE()" not found\n"), MFXGUIDTOHEX(uid))); - } - - return bDestroyed ? MFX_ERR_NONE : MFX_ERR_NOT_FOUND; -} -#else // relates to !defined (MEDIASDK_UWP_DISPATCHER), i.e. #else part as if MEDIASDK_UWP_DISPATCHER defined - -static mfxModuleHandle hModule; - -// for the UWP_DISPATCHER purposes implementation of MFXinitEx is calling -// InitialiseMediaSession() implemented in intel_gfx_api.dll -mfxStatus MFXInitEx(mfxInitParam par, mfxSession *session) -{ -#if defined(MEDIASDK_ARM_LOADER) - - return MFX_ERR_UNSUPPORTED; - -#else - - wchar_t IntelGFXAPIdllName[MFX_MAX_DLL_PATH] = { 0 }; - mfxI32 adapterNum = -1; - - switch (par.Implementation & 0xf) - { - case MFX_IMPL_SOFTWARE: -#if (MFX_VERSION >= MFX_VERSION_NEXT) - case MFX_IMPL_SINGLE_THREAD: -#endif - return MFX_ERR_UNSUPPORTED; - case MFX_IMPL_AUTO: - case MFX_IMPL_HARDWARE: - adapterNum = 0; - break; - case MFX_IMPL_HARDWARE2: - adapterNum = 1; - break; - case MFX_IMPL_HARDWARE3: - adapterNum = 2; - break; - case MFX_IMPL_HARDWARE4: - adapterNum = 3; - break; - default: - return GfxApiInitPriorityIntegrated(par, session, hModule); - } - - return GfxApiInitByAdapterNum(par, adapterNum, session, hModule); - -#endif -} - -// for the UWP_DISPATCHER purposes implementation of MFXClose is calling -// DisposeMediaSession() implemented in intel_gfx_api.dll -mfxStatus MFXClose(mfxSession session) -{ - if (NULL == session) { - return MFX_ERR_INVALID_HANDLE; - } - - mfxStatus sts = MFX_ERR_NONE; - -#if defined(MEDIASDK_ARM_LOADER) - - sts = MFX_ERR_UNSUPPORTED; - -#else - - sts = GfxApiClose(session, hModule); - -#endif - - session = (mfxSession)NULL; - return sts; -} - -#undef FUNCTION -#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \ - return_value func_name formal_param_list \ -{ \ - mfxStatus mfxRes = MFX_ERR_INVALID_HANDLE; \ -\ - _mfxSession *pHandle = (_mfxSession *) session; \ -\ - /* get the function's address and make a call */ \ - if (pHandle) \ -{ \ - mfxFunctionPointer pFunc = pHandle->callPlugInsTable[e##func_name]; \ - if (pFunc) \ -{ \ - /* pass down the call */ \ - mfxRes = (*(mfxStatus (MFX_CDECL *) formal_param_list) pFunc) actual_param_list; \ -} \ -} \ - return mfxRes; \ -} - -FUNCTION(mfxStatus, MFXVideoUSER_Load, (mfxSession session, const mfxPluginUID *uid, mfxU32 version), (session, uid, version)) -FUNCTION(mfxStatus, MFXVideoUSER_LoadByPath, (mfxSession session, const mfxPluginUID *uid, mfxU32 version, const mfxChar *path, mfxU32 len), (session, uid, version, path, len)) -FUNCTION(mfxStatus, MFXVideoUSER_UnLoad, (mfxSession session, const mfxPluginUID *uid), (session, uid)) -FUNCTION(mfxStatus, MFXAudioUSER_Load, (mfxSession session, const mfxPluginUID *uid, mfxU32 version), (session, uid, version)) -FUNCTION(mfxStatus, MFXAudioUSER_UnLoad, (mfxSession session, const mfxPluginUID *uid), (session, uid)) - -#endif //!defined(MEDIASDK_UWP_DISPATCHER) - -mfxStatus MFXJoinSession(mfxSession session, mfxSession child_session) -{ - mfxStatus mfxRes = MFX_ERR_INVALID_HANDLE; - MFX_DISP_HANDLE *pHandle = (MFX_DISP_HANDLE *)session; - MFX_DISP_HANDLE *pChildHandle = (MFX_DISP_HANDLE *)child_session; - - // get the function's address and make a call - if ((pHandle) && (pChildHandle) && (pHandle->actualApiVersion == pChildHandle->actualApiVersion)) - { - /* check whether it is audio session or video */ - int tableIndex = eMFXJoinSession; - mfxFunctionPointer pFunc; - if (pHandle->impl & MFX_IMPL_AUDIO) - { - pFunc = pHandle->callAudioTable[tableIndex]; - } - else - { - pFunc = pHandle->callTable[tableIndex]; - } - - if (pFunc) - { - // pass down the call - mfxRes = (*(mfxStatus(MFX_CDECL *) (mfxSession, mfxSession)) pFunc) (pHandle->session, - pChildHandle->session); - } - } - - return mfxRes; - -} // mfxStatus MFXJoinSession(mfxSession session, mfxSession child_session) - -mfxStatus MFXCloneSession(mfxSession session, mfxSession *clone) -{ - mfxStatus mfxRes = MFX_ERR_INVALID_HANDLE; - MFX_DISP_HANDLE *pHandle = (MFX_DISP_HANDLE *)session; - mfxVersion apiVersion; - mfxIMPL impl; - - // check error(s) - if (pHandle) - { - // initialize the clone session - apiVersion = pHandle->apiVersion; - impl = pHandle->impl | pHandle->implInterface; - mfxRes = MFXInit(impl, &apiVersion, clone); - if (MFX_ERR_NONE != mfxRes) - { - return mfxRes; - } - - // join the sessions - mfxRes = MFXJoinSession(session, *clone); - if (MFX_ERR_NONE != mfxRes) - { - MFXClose(*clone); - *clone = NULL; - return mfxRes; - } - } - - return mfxRes; - -} // mfxStatus MFXCloneSession(mfxSession session, mfxSession *clone) - -mfxStatus MFXInit(mfxIMPL impl, mfxVersion *pVer, mfxSession *session) -{ - mfxInitParam par = {}; - - par.Implementation = impl; - if (pVer) - { - par.Version = *pVer; - } - else - { - par.Version.Major = DEFAULT_API_VERSION_MAJOR; - par.Version.Minor = DEFAULT_API_VERSION_MINOR; - } - par.ExternalThreads = 0; - - return MFXInitEx(par, session); -} - -// -// -// implement all other calling functions. -// They just call a procedure of DLL library from the table. -// - -// define for common functions (from mfxsession.h) -#undef FUNCTION -#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \ - return_value func_name formal_param_list \ -{ \ - mfxStatus mfxRes = MFX_ERR_INVALID_HANDLE; \ - _mfxSession *pHandle = (_mfxSession *) session; \ - /* get the function's address and make a call */ \ - if (pHandle) \ -{ \ - /* check whether it is audio session or video */ \ - int tableIndex = e##func_name; \ - mfxFunctionPointer pFunc; \ - if (pHandle->impl & MFX_IMPL_AUDIO) \ -{ \ - pFunc = pHandle->callAudioTable[tableIndex]; \ -} \ - else \ -{ \ - pFunc = pHandle->callTable[tableIndex]; \ -} \ - if (pFunc) \ -{ \ - /* get the real session pointer */ \ - session = pHandle->session; \ - /* pass down the call */ \ - mfxRes = (*(mfxStatus (MFX_CDECL *) formal_param_list) pFunc) actual_param_list; \ -} \ -} \ - return mfxRes; \ -} - -FUNCTION(mfxStatus, MFXQueryIMPL, (mfxSession session, mfxIMPL *impl), (session, impl)) -FUNCTION(mfxStatus, MFXQueryVersion, (mfxSession session, mfxVersion *version), (session, version)) - -// these functions are not necessary in LOADER part of dispatcher and -// need to be included only in in SOLID dispatcher or PROCTABLE part of dispatcher - -FUNCTION(mfxStatus, MFXDisjoinSession, (mfxSession session), (session)) -FUNCTION(mfxStatus, MFXSetPriority, (mfxSession session, mfxPriority priority), (session, priority)) -FUNCTION(mfxStatus, MFXGetPriority, (mfxSession session, mfxPriority *priority), (session, priority)) - -#undef FUNCTION -#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \ - return_value func_name formal_param_list \ -{ \ - mfxStatus mfxRes = MFX_ERR_INVALID_HANDLE; \ - _mfxSession *pHandle = (_mfxSession *) session;\ - /* get the function's address and make a call */ \ - if (pHandle) \ -{ \ - mfxFunctionPointer pFunc = pHandle->callTable[e##func_name]; \ - if (pFunc) \ -{ \ - /* get the real session pointer */ \ - session = pHandle->session; \ - /* pass down the call */ \ - mfxRes = (*(mfxStatus (MFX_CDECL *) formal_param_list) pFunc) actual_param_list; \ -} \ -} \ - return mfxRes; \ -} - -#include "mfx_exposed_functions_list.h" -#undef FUNCTION -#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \ - return_value func_name formal_param_list \ -{ \ - mfxStatus mfxRes = MFX_ERR_INVALID_HANDLE; \ - _mfxSession *pHandle = (_mfxSession *) session; \ - /* get the function's address and make a call */ \ - if (pHandle) \ -{ \ - mfxFunctionPointer pFunc = pHandle->callAudioTable[e##func_name]; \ - if (pFunc) \ -{ \ - /* get the real session pointer */ \ - session = pHandle->session; \ - /* pass down the call */ \ - mfxRes = (*(mfxStatus (MFX_CDECL *) formal_param_list) pFunc) actual_param_list; \ -} \ -} \ - return mfxRes; \ -} - -#include "mfxaudio_exposed_functions_list.h" diff --git a/plugins/obs-qsv11/libmfx/src/mfx_critical_section.cpp b/plugins/obs-qsv11/libmfx/src/mfx_critical_section.cpp deleted file mode 100644 index 3920f4239..000000000 --- a/plugins/obs-qsv11/libmfx/src/mfx_critical_section.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) 2012-2019 Intel Corporation -// -// 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 "mfx_critical_section.h" - -#include -// SDK re-declares the following functions with different call declarator. -// We don't need them. Just redefine them to nothing. -#define _interlockedbittestandset fake_set -#define _interlockedbittestandreset fake_reset -#define _interlockedbittestandset64 fake_set64 -#define _interlockedbittestandreset64 fake_reset64 -#include - -#define MFX_WAIT() SwitchToThread() - -// static section of the file -namespace -{ - -enum -{ - MFX_SC_IS_FREE = 0, - MFX_SC_IS_TAKEN = 1 -}; - -} // namespace - -namespace MFX -{ - -mfxU32 mfxInterlockedCas32(mfxCriticalSection *pCSection, mfxU32 value_to_exchange, mfxU32 value_to_compare) -{ - return _InterlockedCompareExchange(pCSection, value_to_exchange, value_to_compare); -} - -mfxU32 mfxInterlockedXchg32(mfxCriticalSection *pCSection, mfxU32 value) -{ - return _InterlockedExchange(pCSection, value); -} - -void mfxEnterCriticalSection(mfxCriticalSection *pCSection) -{ - while (MFX_SC_IS_TAKEN == mfxInterlockedCas32(pCSection, - MFX_SC_IS_TAKEN, - MFX_SC_IS_FREE)) - { - MFX_WAIT(); - } -} // void mfxEnterCriticalSection(mfxCriticalSection *pCSection) - -void mfxLeaveCriticalSection(mfxCriticalSection *pCSection) -{ - mfxInterlockedXchg32(pCSection, MFX_SC_IS_FREE); -} // void mfxLeaveCriticalSection(mfxCriticalSection *pCSection) - -} // namespace MFX diff --git a/plugins/obs-qsv11/libmfx/src/mfx_dispatcher.cpp b/plugins/obs-qsv11/libmfx/src/mfx_dispatcher.cpp deleted file mode 100644 index d3b9c5a1c..000000000 --- a/plugins/obs-qsv11/libmfx/src/mfx_dispatcher.cpp +++ /dev/null @@ -1,661 +0,0 @@ -// Copyright (c) 2012-2020 Intel Corporation -// -// 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 "mfx_dispatcher.h" -#include "mfx_dispatcher_log.h" -#include "mfx_load_dll.h" - -#include - -#include -#include - -#include "mfx_dxva2_device.h" -#include "mfxvideo++.h" -#include "mfx_vector.h" -#include "mfxadapter.h" -#include - -#pragma warning(disable:4355) - -MFX_DISP_HANDLE::MFX_DISP_HANDLE(const mfxVersion requiredVersion) : - _mfxSession() - ,apiVersion(requiredVersion) - ,pluginHive() - ,pluginFactory((mfxSession)this) -{ - actualApiVersion.Version = 0; - implType = MFX_LIB_SOFTWARE; - impl = MFX_IMPL_SOFTWARE; - loadStatus = MFX_ERR_NOT_FOUND; - dispVersion.Major = MFX_DISPATCHER_VERSION_MAJOR; - dispVersion.Minor = MFX_DISPATCHER_VERSION_MINOR; - storageID = 0; - implInterface = MFX_IMPL_HARDWARE_ANY; - - hModule = (mfxModuleHandle) 0; - -} // MFX_DISP_HANDLE::MFX_DISP_HANDLE(const mfxVersion requiredVersion) - -MFX_DISP_HANDLE::~MFX_DISP_HANDLE(void) -{ - Close(); - -} // MFX_DISP_HANDLE::~MFX_DISP_HANDLE(void) - -mfxStatus MFX_DISP_HANDLE::Close(void) -{ - mfxStatus mfxRes; - - mfxRes = UnLoadSelectedDLL(); - - // need to reset dispatcher state after unloading dll - if (MFX_ERR_NONE == mfxRes) - { - implType = MFX_LIB_SOFTWARE; - impl = MFX_IMPL_SOFTWARE; - loadStatus = MFX_ERR_NOT_FOUND; - dispVersion.Major = MFX_DISPATCHER_VERSION_MAJOR; - dispVersion.Minor = MFX_DISPATCHER_VERSION_MINOR; - *static_cast<_mfxSession*>(this) = _mfxSession(); - hModule = (mfxModuleHandle) 0; - } - - return mfxRes; - -} // mfxStatus MFX_DISP_HANDLE::Close(void) - -mfxStatus MFX_DISP_HANDLE::LoadSelectedDLL(const wchar_t *pPath, eMfxImplType reqImplType, - mfxIMPL reqImpl, mfxIMPL reqImplInterface, mfxInitParam &par) -{ - mfxStatus mfxRes = MFX_ERR_NONE; - - // check error(s) - if ((MFX_LIB_SOFTWARE != reqImplType) && - (MFX_LIB_HARDWARE != reqImplType)) - { - DISPATCHER_LOG_ERROR((("implType == %s, should be either MFX_LIB_SOFTWARE ot MFX_LIB_HARDWARE\n"), DispatcherLog_GetMFXImplString(reqImplType).c_str())); - loadStatus = MFX_ERR_ABORTED; - return loadStatus; - } - // only exact types of implementation is allowed - if (!(reqImpl & MFX_IMPL_AUDIO) && -#if (MFX_VERSION >= MFX_VERSION_NEXT) - !(reqImpl & MFX_IMPL_EXTERNAL_THREADING) && -#endif - (MFX_IMPL_SOFTWARE != reqImpl) && - (MFX_IMPL_HARDWARE != reqImpl) && - (MFX_IMPL_HARDWARE2 != reqImpl) && - (MFX_IMPL_HARDWARE3 != reqImpl) && - (MFX_IMPL_HARDWARE4 != reqImpl)) - { - DISPATCHER_LOG_ERROR((("invalid implementation impl == %s\n"), DispatcherLog_GetMFXImplString(impl).c_str())); - loadStatus = MFX_ERR_ABORTED; - return loadStatus; - } - // only mfxExtThreadsParam is allowed - if (par.NumExtParam) - { - if ((par.NumExtParam > 1) || !par.ExtParam) - { - loadStatus = MFX_ERR_ABORTED; - return loadStatus; - } - if ((par.ExtParam[0]->BufferId != MFX_EXTBUFF_THREADS_PARAM) || - (par.ExtParam[0]->BufferSz != sizeof(mfxExtThreadsParam))) - { - loadStatus = MFX_ERR_ABORTED; - return loadStatus; - } - } - - // close the handle before initialization - Close(); - - // save the library's type - this->implType = reqImplType; - this->impl = reqImpl; - this->implInterface = reqImplInterface; - - { - assert(hModule == (mfxModuleHandle)0); - DISPATCHER_LOG_BLOCK(("invoking LoadLibrary(%S)\n", pPath)); - - // load the DLL into the memory - hModule = MFX::mfx_dll_load(pPath); - - if (hModule) - { - int i; - - DISPATCHER_LOG_OPERATION({ - wchar_t modulePath[1024]; - GetModuleFileNameW((HMODULE)hModule, modulePath, sizeof(modulePath)/sizeof(modulePath[0])); - DISPATCHER_LOG_INFO((("loaded module %S\n"), modulePath)) - }); - - if (impl & MFX_IMPL_AUDIO) - { - // load audio functions: pointers to exposed functions - for (i = 0; i < eAudioFuncTotal; i += 1) - { - // construct correct name of the function - remove "_a" postfix - - mfxFunctionPointer pProc = (mfxFunctionPointer) MFX::mfx_dll_get_addr(hModule, APIAudioFunc[i].pName); - if (pProc) - { - // function exists in the library, - // save the pointer. - callAudioTable[i] = pProc; - } - else - { - // The library doesn't contain the function - DISPATCHER_LOG_WRN((("Can't find API function \"%s\"\n"), APIAudioFunc[i].pName)); - if (apiVersion.Version >= APIAudioFunc[i].apiVersion.Version) - { - DISPATCHER_LOG_ERROR((("\"%s\" is required for API %u.%u\n"), APIAudioFunc[i].pName, apiVersion.Major, apiVersion.Minor)); - mfxRes = MFX_ERR_UNSUPPORTED; - break; - } - } - } - } - else - { - // load video functions: pointers to exposed functions - for (i = 0; i < eVideoFuncTotal; i += 1) - { - mfxFunctionPointer pProc = (mfxFunctionPointer) MFX::mfx_dll_get_addr(hModule, APIFunc[i].pName); - if (pProc) - { - // function exists in the library, - // save the pointer. - callTable[i] = pProc; - } - else - { - // The library doesn't contain the function - DISPATCHER_LOG_WRN((("Can't find API function \"%s\"\n"), APIFunc[i].pName)); - if (apiVersion.Version >= APIFunc[i].apiVersion.Version) - { - DISPATCHER_LOG_ERROR((("\"%s\" is required for API %u.%u\n"), APIFunc[i].pName, apiVersion.Major, apiVersion.Minor)); - mfxRes = MFX_ERR_UNSUPPORTED; - break; - } - } - } - } - } - else - { - DISPATCHER_LOG_WRN((("can't find DLL: GetLastErr()=0x%x\n"), GetLastError())) - mfxRes = MFX_ERR_UNSUPPORTED; - } - } - - // initialize the loaded DLL - if (MFX_ERR_NONE == mfxRes) - { - mfxVersion version(apiVersion); - - /* check whether it is audio session or video */ - mfxFunctionPointer *actualTable = (impl & MFX_IMPL_AUDIO) ? callAudioTable : callTable; - - // Call old-style MFXInit init for older libraries and audio library - bool callOldInit = (impl & MFX_IMPL_AUDIO) || !actualTable[eMFXInitEx]; // if true call eMFXInit, if false - eMFXInitEx - int tableIndex = (callOldInit) ? eMFXInit : eMFXInitEx; - - mfxFunctionPointer pFunc = actualTable[tableIndex]; - - { - if (callOldInit) - { - DISPATCHER_LOG_BLOCK(("MFXInit(%s,ver=%u.%u,session=0x%p)\n" - , DispatcherLog_GetMFXImplString(impl | implInterface).c_str() - , apiVersion.Major - , apiVersion.Minor - , &session)); - - mfxRes = (*(mfxStatus(MFX_CDECL *) (mfxIMPL, mfxVersion *, mfxSession *)) pFunc) (impl | implInterface, &version, &session); - } - else - { - DISPATCHER_LOG_BLOCK(("MFXInitEx(%s,ver=%u.%u,ExtThreads=%d,session=0x%p)\n" - , DispatcherLog_GetMFXImplString(impl | implInterface).c_str() - , apiVersion.Major - , apiVersion.Minor - , par.ExternalThreads - , &session)); - - mfxInitParam initPar = par; - // adjusting user parameters - initPar.Implementation = impl | implInterface; - initPar.Version = version; - mfxRes = (*(mfxStatus(MFX_CDECL *) (mfxInitParam, mfxSession *)) pFunc) (initPar, &session); - } - } - - if (MFX_ERR_NONE != mfxRes) - { - DISPATCHER_LOG_WRN((("library can't be load. MFXInit returned %s \n"), DispatcherLog_GetMFXStatusString(mfxRes))) - } - else - { - mfxRes = MFXQueryVersion((mfxSession) this, &actualApiVersion); - - if (MFX_ERR_NONE != mfxRes) - { - DISPATCHER_LOG_ERROR((("MFXQueryVersion returned: %d, skiped this library\n"), mfxRes)) - } - else - { - DISPATCHER_LOG_INFO((("MFXQueryVersion returned API: %d.%d\n"), actualApiVersion.Major, actualApiVersion.Minor)) - //special hook for applications that uses sink api to get loaded library path - DISPATCHER_LOG_LIBRARY(("%p" , hModule)); - DISPATCHER_LOG_INFO(("library loaded succesfully\n")) - } - } - } - - loadStatus = mfxRes; - return mfxRes; - -} // mfxStatus MFX_DISP_HANDLE::LoadSelectedDLL(const wchar_t *pPath, eMfxImplType implType, mfxIMPL impl) - -mfxStatus MFX_DISP_HANDLE::UnLoadSelectedDLL(void) -{ - mfxStatus mfxRes = MFX_ERR_NONE; - - //unregistered plugins if any - pluginFactory.Close(); - - // close the loaded DLL - if (session) - { - /* check whether it is audio session or video */ - int tableIndex = eMFXClose; - mfxFunctionPointer pFunc; - if (impl & MFX_IMPL_AUDIO) - { - pFunc = callAudioTable[tableIndex]; - } - else - { - pFunc = callTable[tableIndex]; - } - - mfxRes = (*(mfxStatus (MFX_CDECL *) (mfxSession)) pFunc) (session); - if (MFX_ERR_NONE == mfxRes) - { - session = (mfxSession) 0; - } - - DISPATCHER_LOG_INFO((("MFXClose(0x%x) returned %d\n"), session, mfxRes)); - // actually, the return value is required to pass outside only. - } - - // it is possible, that there is an active child session. - // can't unload library in that case. - if ((MFX_ERR_UNDEFINED_BEHAVIOR != mfxRes) && - (hModule)) - { - // unload the library. - if (!MFX::mfx_dll_free(hModule)) - { - mfxRes = MFX_ERR_UNDEFINED_BEHAVIOR; - } - hModule = (mfxModuleHandle) 0; - } - - return mfxRes; - -} // mfxStatus MFX_DISP_HANDLE::UnLoadSelectedDLL(void) - - -MFX_DISP_HANDLE_EX::MFX_DISP_HANDLE_EX(const mfxVersion requiredVersion) - : MFX_DISP_HANDLE(requiredVersion) - , mediaAdapterType(MFX_MEDIA_UNKNOWN) -{} - - -#if (defined(_WIN64) || defined(_WIN32)) && (MFX_VERSION >= 1031) -static mfxStatus InitDummySession(mfxU32 adapter_n, MFXVideoSession & dummy_session) -{ - mfxInitParam initPar; - memset(&initPar, 0, sizeof(initPar)); - - initPar.Version.Major = 1; - initPar.Version.Minor = 0; - - switch (adapter_n) - { - case 0: - initPar.Implementation = MFX_IMPL_HARDWARE; - break; - case 1: - initPar.Implementation = MFX_IMPL_HARDWARE2; - break; - case 2: - initPar.Implementation = MFX_IMPL_HARDWARE3; - break; - case 3: - initPar.Implementation = MFX_IMPL_HARDWARE4; - break; - - default: - // try searching on all display adapters - initPar.Implementation = MFX_IMPL_HARDWARE_ANY; - break; - } - - initPar.Implementation |= MFX_IMPL_VIA_D3D11; - - return dummy_session.InitEx(initPar); -} - -static inline bool is_iGPU(const mfxAdapterInfo& adapter_info) -{ - return adapter_info.Platform.MediaAdapterType == MFX_MEDIA_INTEGRATED; -} - -static inline bool is_dGPU(const mfxAdapterInfo& adapter_info) -{ - return adapter_info.Platform.MediaAdapterType == MFX_MEDIA_DISCRETE; -} - -// This function implies that iGPU has higher priority -static inline mfxI32 iGPU_priority(const void* ll, const void* rr) -{ - const mfxAdapterInfo& l = *(reinterpret_cast(ll)); - const mfxAdapterInfo& r = *(reinterpret_cast(rr)); - - if (is_iGPU(l) && is_iGPU(r) || is_dGPU(l) && is_dGPU(r)) - return 0; - - if (is_iGPU(l) && is_dGPU(r)) - return -1; - - // The only combination left is_dGPU(l) && is_iGPU(r)) - return 1; -} - - -static void RearrangeInPriorityOrder(const mfxComponentInfo & info, MFX::MFXVector & vec) -{ - (void)info; - { - // Move iGPU to top priority - qsort(vec.data(), vec.size(), sizeof(mfxAdapterInfo), &iGPU_priority); - } -} - -static mfxStatus PrepareAdaptersInfo(const mfxComponentInfo * info, MFX::MFXVector & vec, mfxAdaptersInfo& adapters) -{ - // No suitable adapters on system to handle user's workload - if (vec.empty()) - { - adapters.NumActual = 0; - return MFX_ERR_NOT_FOUND; - } - - if (info) - { - RearrangeInPriorityOrder(*info, vec); - } - - mfxU32 num_to_copy = (std::min)(mfxU32(vec.size()), adapters.NumAlloc); - for (mfxU32 i = 0; i < num_to_copy; ++i) - { - adapters.Adapters[i] = vec[i]; - } - - adapters.NumActual = num_to_copy; - - if (vec.size() > adapters.NumAlloc) - { - return MFX_WRN_OUT_OF_RANGE; - } - - return MFX_ERR_NONE; -} - -static inline bool QueryAdapterInfo(mfxU32 adapter_n, mfxU32& VendorID, mfxU32& DeviceID) -{ - MFX::DXVA2Device dxvaDevice; - - if (!dxvaDevice.InitDXGI1(adapter_n)) - return false; - - VendorID = dxvaDevice.GetVendorID(); - DeviceID = dxvaDevice.GetDeviceID(); - - return true; -} - -static inline mfxU32 MakeVersion(mfxU16 major, mfxU16 minor) -{ - return major * 1000 + minor; -} - -mfxStatus MFXQueryAdaptersDecode(mfxBitstream* bitstream, mfxU32 codec_id, mfxAdaptersInfo* adapters) -{ - if (!adapters || !bitstream) - return MFX_ERR_NULL_PTR; - - MFX::MFXVector obtained_info; - - mfxU32 adapter_n = 0, VendorID, DeviceID; - - mfxComponentInfo input_info; - memset(&input_info, 0, sizeof(input_info)); - input_info.Type = mfxComponentType::MFX_COMPONENT_DECODE; - input_info.Requirements.mfx.CodecId = codec_id; - - for(;;) - { - if (!QueryAdapterInfo(adapter_n, VendorID, DeviceID)) - break; - - ++adapter_n; - - if (VendorID != INTEL_VENDOR_ID) - continue; - - // Check if requested capabilities are supported - MFXVideoSession dummy_session; - - mfxStatus sts = InitDummySession(adapter_n - 1, dummy_session); - if (sts != MFX_ERR_NONE) - { - continue; - } - - mfxVideoParam stream_params, out; - memset(&out, 0, sizeof(out)); - memset(&stream_params, 0, sizeof(stream_params)); - out.mfx.CodecId = stream_params.mfx.CodecId = codec_id; - - sts = MFXVideoDECODE_DecodeHeader(dummy_session.operator mfxSession(), bitstream, &stream_params); - - if (sts != MFX_ERR_NONE) - { - continue; - } - - sts = MFXVideoDECODE_Query(dummy_session.operator mfxSession(), &stream_params, &out); - - if (sts != MFX_ERR_NONE) // skip MFX_ERR_UNSUPPORTED as well as MFX_WRN_INCOMPATIBLE_VIDEO_PARAM - continue; - - mfxAdapterInfo info; - memset(&info, 0, sizeof(info)); - - //WA for initialization when application built w/ new API, but lib w/ old one. - mfxVersion apiVersion; - sts = dummy_session.QueryVersion(&apiVersion); - if (sts != MFX_ERR_NONE) - continue; - - mfxU32 version = MakeVersion(apiVersion.Major, apiVersion.Minor); - - if (version >= 1019) - { - sts = MFXVideoCORE_QueryPlatform(dummy_session.operator mfxSession(), &info.Platform); - - if (sts != MFX_ERR_NONE) - { - continue; - } - } - else - { - // for API versions greater than 1.19 Device id is set inside QueryPlatform call - info.Platform.DeviceId = static_cast(DeviceID); - } - - info.Number = adapter_n - 1; - - obtained_info.push_back(info); - } - - return PrepareAdaptersInfo(&input_info, obtained_info, *adapters); -} - -mfxStatus MFXQueryAdapters(mfxComponentInfo* input_info, mfxAdaptersInfo* adapters) -{ - if (!adapters) - return MFX_ERR_NULL_PTR; - - MFX::MFXVector obtained_info; - //obtained_info.reserve(adapters->NumAdaptersAlloc); - - mfxU32 adapter_n = 0, VendorID, DeviceID; - - for (;;) - { - if (!QueryAdapterInfo(adapter_n, VendorID, DeviceID)) - break; - - ++adapter_n; - - if (VendorID != INTEL_VENDOR_ID) - continue; - - // Check if requested capabilities are supported - MFXVideoSession dummy_session; - - mfxStatus sts = InitDummySession(adapter_n - 1, dummy_session); - if (sts != MFX_ERR_NONE) - { - continue; - } - - // If input_info is NULL just return all Intel adapters and information about them - if (input_info) - { - mfxVideoParam out; - memset(&out, 0, sizeof(out)); - - switch (input_info->Type) - { - case mfxComponentType::MFX_COMPONENT_ENCODE: - { - out.mfx.CodecId = input_info->Requirements.mfx.CodecId; - - sts = MFXVideoENCODE_Query(dummy_session.operator mfxSession(), &input_info->Requirements, &out); - } - break; - case mfxComponentType::MFX_COMPONENT_DECODE: - { - out.mfx.CodecId = input_info->Requirements.mfx.CodecId; - - sts = MFXVideoDECODE_Query(dummy_session.operator mfxSession(), &input_info->Requirements, &out); - } - break; - case mfxComponentType::MFX_COMPONENT_VPP: - { - sts = MFXVideoVPP_Query(dummy_session.operator mfxSession(), &input_info->Requirements, &out); - } - break; - default: - sts = MFX_ERR_UNSUPPORTED; - } - } - - if (sts != MFX_ERR_NONE) // skip MFX_ERR_UNSUPPORTED as well as MFX_WRN_INCOMPATIBLE_VIDEO_PARAM - continue; - - mfxAdapterInfo info; - memset(&info, 0, sizeof(info)); - - //WA for initialization when application built w/ new API, but lib w/ old one. - mfxVersion apiVersion; - sts = dummy_session.QueryVersion(&apiVersion); - if (sts != MFX_ERR_NONE) - continue; - - mfxU32 version = MakeVersion(apiVersion.Major, apiVersion.Minor); - - if (version >= 1019) - { - sts = MFXVideoCORE_QueryPlatform(dummy_session.operator mfxSession(), &info.Platform); - - if (sts != MFX_ERR_NONE) - { - continue; - } - } - else - { - // for API versions greater than 1.19 Device id is set inside QueryPlatform call - info.Platform.DeviceId = static_cast(DeviceID); - } - - info.Number = adapter_n - 1; - - obtained_info.push_back(info); - } - - return PrepareAdaptersInfo(input_info, obtained_info, *adapters); -} - -mfxStatus MFXQueryAdaptersNumber(mfxU32* num_adapters) -{ - if (!num_adapters) - return MFX_ERR_NULL_PTR; - - mfxU32 intel_adapter_count = 0, VendorID, DeviceID; - - for (mfxU32 cur_adapter = 0; ; ++cur_adapter) - { - if (!QueryAdapterInfo(cur_adapter, VendorID, DeviceID)) - break; - - if (VendorID == INTEL_VENDOR_ID) - ++intel_adapter_count; - } - - *num_adapters = intel_adapter_count; - - return MFX_ERR_NONE; -} - -#endif // (defined(_WIN64) || defined(_WIN32)) && (MFX_VERSION >= 1031) diff --git a/plugins/obs-qsv11/libmfx/src/mfx_dispatcher_log.cpp b/plugins/obs-qsv11/libmfx/src/mfx_dispatcher_log.cpp deleted file mode 100644 index b96306b63..000000000 --- a/plugins/obs-qsv11/libmfx/src/mfx_dispatcher_log.cpp +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (c) 2012-2019 Intel Corporation -// -// 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(MFX_DISPATCHER_LOG) - -#include "mfx_dispatcher_log.h" -#include "mfxstructures.h" -#include -#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER) -#include -#include -#endif -#include -#include -#include -#include - -struct CodeStringTable -{ - int code; - const char *string; -} LevelStrings []= -{ - {DL_INFO, "INFO: "}, - {DL_WRN, "WARNING:"}, - {DL_ERROR, "ERROR: "} -}; - -#define DEFINE_CODE(code)\ - {code, #code} - -static CodeStringTable StringsOfImpl[] = { - DEFINE_CODE(MFX_IMPL_AUTO), - DEFINE_CODE(MFX_IMPL_SOFTWARE), - DEFINE_CODE(MFX_IMPL_HARDWARE), - DEFINE_CODE(MFX_IMPL_AUTO_ANY), - DEFINE_CODE(MFX_IMPL_HARDWARE_ANY), - DEFINE_CODE(MFX_IMPL_HARDWARE2), - DEFINE_CODE(MFX_IMPL_HARDWARE3), - DEFINE_CODE(MFX_IMPL_HARDWARE4), - - DEFINE_CODE(MFX_IMPL_UNSUPPORTED) -}; - -static CodeStringTable StringsOfImplVIA[] = { - DEFINE_CODE(MFX_IMPL_VIA_ANY), - DEFINE_CODE(MFX_IMPL_VIA_D3D9), - DEFINE_CODE(MFX_IMPL_VIA_D3D11), -}; - -static CodeStringTable StringsOfStatus[] = -{ - DEFINE_CODE(MFX_ERR_NONE ), - DEFINE_CODE(MFX_ERR_UNKNOWN ), - DEFINE_CODE(MFX_ERR_NULL_PTR ), - DEFINE_CODE(MFX_ERR_UNSUPPORTED ), - DEFINE_CODE(MFX_ERR_MEMORY_ALLOC ), - DEFINE_CODE(MFX_ERR_NOT_ENOUGH_BUFFER ), - DEFINE_CODE(MFX_ERR_INVALID_HANDLE ), - DEFINE_CODE(MFX_ERR_LOCK_MEMORY ), - DEFINE_CODE(MFX_ERR_NOT_INITIALIZED ), - DEFINE_CODE(MFX_ERR_NOT_FOUND ), - DEFINE_CODE(MFX_ERR_MORE_DATA ), - DEFINE_CODE(MFX_ERR_MORE_SURFACE ), - DEFINE_CODE(MFX_ERR_ABORTED ), - DEFINE_CODE(MFX_ERR_DEVICE_LOST ), - DEFINE_CODE(MFX_ERR_INCOMPATIBLE_VIDEO_PARAM), - DEFINE_CODE(MFX_ERR_INVALID_VIDEO_PARAM ), - DEFINE_CODE(MFX_ERR_UNDEFINED_BEHAVIOR ), - DEFINE_CODE(MFX_ERR_DEVICE_FAILED ), - DEFINE_CODE(MFX_WRN_IN_EXECUTION ), - DEFINE_CODE(MFX_WRN_DEVICE_BUSY ), - DEFINE_CODE(MFX_WRN_VIDEO_PARAM_CHANGED ), - DEFINE_CODE(MFX_WRN_PARTIAL_ACCELERATION ), - DEFINE_CODE(MFX_WRN_INCOMPATIBLE_VIDEO_PARAM), - DEFINE_CODE(MFX_WRN_VALUE_NOT_CHANGED ), - DEFINE_CODE(MFX_WRN_OUT_OF_RANGE ), - -}; - -#define CODE_TO_STRING(code, array)\ - CodeToString(code, array, sizeof(array)/sizeof(array[0])) - -const char* CodeToString(int code, CodeStringTable array[], int len ) -{ - for (int i = 0 ; i < len; i++) - { - if (array[i].code == code) - return array[i].string; - } - return "undef"; -} - -std::string DispatcherLog_GetMFXImplString(int impl) -{ - std::string str1 = CODE_TO_STRING(impl & ~(-MFX_IMPL_VIA_ANY), StringsOfImpl); - std::string str2 = CODE_TO_STRING(impl & (-MFX_IMPL_VIA_ANY), StringsOfImplVIA); - - return str1 + (str2 == "undef" ? "" : "|"+str2); -} - -const char *DispatcherLog_GetMFXStatusString(int sts) -{ - return CODE_TO_STRING(sts, StringsOfStatus); -} - -////////////////////////////////////////////////////////////////////////// - - -void DispatcherLogBracketsHelper::Write(const char * str, ...) -{ - va_list argsptr; - va_start(argsptr, str); - DispatchLog::get().Write(m_level, m_opcode, str, argsptr); - va_end(argsptr); -} - -void DispatchLogBlockHelper::Write(const char * str, ...) -{ - va_list argsptr; - va_start(argsptr, str); - DispatchLog::get().Write(m_level, DL_EVENT_START, str, argsptr); - va_end(argsptr); -} - -DispatchLogBlockHelper::~DispatchLogBlockHelper() -{ - DispatchLog::get().Write(m_level, DL_EVENT_STOP, NULL, NULL); -} - -////////////////////////////////////////////////////////////////////////// - -DispatchLog::DispatchLog() - : m_DispatcherLogSink(DL_SINK_PRINTF) -{ - -} - -void DispatchLog::SetSink(int nSink, IMsgHandler * pHandler) -{ - DetachAllSinks(); - AttachSink(nSink, pHandler); -} - -void DispatchLog::AttachSink(int nsink, IMsgHandler *pHandler) -{ - m_DispatcherLogSink |= nsink; - if (NULL != pHandler) - m_Recepients.push_back(pHandler); -} - -void DispatchLog::DetachSink(int nsink, IMsgHandler *pHandler) -{ - if (nsink & DL_SINK_IMsgHandler) - { - m_Recepients.remove(pHandler); - } - - m_DispatcherLogSink &= ~nsink; -} - -void DispatchLog::ExchangeSink(int nsink, IMsgHandler *oldHdl, IMsgHandler *newHdl) -{ - if (nsink & DL_SINK_IMsgHandler) - { - std::list :: iterator it = std::find(m_Recepients.begin(), m_Recepients.end(), oldHdl); - - //cannot exchange in that case - if (m_Recepients.end() == it) - return; - - *it = newHdl; - } -} - - -void DispatchLog::DetachAllSinks() -{ - m_Recepients.clear(); - m_DispatcherLogSink = DL_SINK_NULL; -} - -void DispatchLog::Write(int level, int opcode, const char * msg, va_list argptr) -{ - int sinkTable[] = - { - DL_SINK_PRINTF, - DL_SINK_IMsgHandler, - }; - - for (size_t i = 0; i < sizeof(sinkTable) / sizeof(sinkTable[0]); i++) - { - switch(m_DispatcherLogSink & sinkTable[i]) - { - case DL_SINK_NULL: - break; - - case DL_SINK_PRINTF: - { - char msg_formated[8048] = {0}; - - if (NULL != msg && level != DL_LOADED_LIBRARY) - { -#if _MSC_VER >= 1400 - vsprintf_s(msg_formated, sizeof(msg_formated)/sizeof(msg_formated[0]), msg, argptr); -#else - vsnprintf(msg_formated, sizeof(msg_formated)/sizeof(msg_formated[0]), msg, argptr); -#endif - //TODO: improve this , add opcode handling - printf("%s %s", CODE_TO_STRING(level, LevelStrings), msg_formated); - } - break; - } - - case DL_SINK_IMsgHandler: - { - std::list::iterator it; - - for (it = m_Recepients.begin(); it != m_Recepients.end(); ++it) - { - (*it)->Write(level, opcode, msg, argptr); - } - break; - } - } - } -} - -#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER) -class ETWHandler : public IMsgHandler -{ -public: - ETWHandler(const wchar_t * guid_str) - : m_bUseFormatter(DISPATCHER_LOG_USE_FORMATING) - , m_EventHandle() - , m_bProviderEnable() - { - GUID rguid = GUID_NULL; - if (FAILED(CLSIDFromString(guid_str, &rguid))) - { - return; - } - - EventRegister(&rguid, NULL, NULL, &m_EventHandle); - - m_bProviderEnable = 0 != EventProviderEnabled(m_EventHandle, 1,0); - } - - ~ETWHandler() - { - if (m_EventHandle) - { - EventUnregister(m_EventHandle); - } - } - - virtual void Write(int level, int opcode, const char * msg, va_list argptr) - { - //event not registered - if (0==m_EventHandle) - { - return; - } - if (!m_bProviderEnable) - { - return; - } - if (level == DL_LOADED_LIBRARY) - { - return; - } - - char msg_formated[1024]; - EVENT_DESCRIPTOR descriptor; - EVENT_DATA_DESCRIPTOR data_descriptor; - - EventDescZero(&descriptor); - - descriptor.Opcode = (UCHAR)opcode; - descriptor.Level = (UCHAR)level; - - if (m_bUseFormatter) - { - if (NULL != msg) - { -#if _MSC_VER >= 1400 - vsprintf_s(msg_formated, sizeof (msg_formated) / sizeof (msg_formated[0]), msg, argptr); -#else - vsnprintf(msg_formated, sizeof (msg_formated) / sizeof (msg_formated[0]), msg, argptr); -#endif - EventDataDescCreate(&data_descriptor, msg_formated, (ULONG)(strlen(msg_formated) + 1)); - }else - { - EventDataDescCreate(&data_descriptor, NULL, 0); - } - }else - { - //TODO: non formated events supports under zbb - } - - EventWrite(m_EventHandle, &descriptor, 1, &data_descriptor); - } - -protected: - - //we may not use formatter in some cases described in dispatch_log macro - //it significantly increases performance by eliminating any vsprintf operations - bool m_bUseFormatter; - //consumer is attached, dispatcher trace to reduce formating overhead - //submits event only if consumer attached - bool m_bProviderEnable; - REGHANDLE m_EventHandle; -}; -// - - -IMsgHandler *ETWHandlerFactory::GetSink(const wchar_t* sguid) -{ - _storage_type::iterator it; - it = m_storage.find(sguid); - if (it == m_storage.end()) - { - ETWHandler * handler = new ETWHandler(sguid); - _storage_type::_Pairib it_bool = m_storage.insert(_storage_type::value_type(sguid, handler)); - it = it_bool.first; - } - - return it->second; -} - -ETWHandlerFactory::~ETWHandlerFactory() -{ - for each(_storage_type::value_type val in m_storage) - { - delete val.second; - } -} - -class EventRegistrator : public IMsgHandler -{ - const wchar_t * m_sguid; -public: - EventRegistrator(const wchar_t* sguid = DISPATCHER_LOG_EVENT_GUID) - :m_sguid(sguid) - { - DispatchLog::get().AttachSink( DL_SINK_IMsgHandler - , this); - } - - virtual void Write(int level, int opcode, const char * msg, va_list argptr) - { - //we cannot call attach sink since we may have been called from iteration - //we axchanging preserve that placeholding - IMsgHandler * pSink = NULL; - DispatchLog::get().ExchangeSink(DL_SINK_IMsgHandler, - this, - pSink = ETWHandlerFactory::get().GetSink(m_sguid)); - //need to call only once here all next calls will be done inside dispatcherlog - if (NULL != pSink) - { - pSink->Write(level, opcode, msg, argptr); - } - } -}; -#endif - -template -class SinkRegistrator -{ -}; - -#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER) -template <> -class SinkRegistrator -{ -public: - SinkRegistrator(const wchar_t* sguid = DISPATCHER_LOG_EVENT_GUID) - { - DispatchLog::get().AttachSink( DL_SINK_IMsgHandler - , ETWHandlerFactory::get().GetSink(sguid)); - } -}; -#endif - -#if defined(DISPATCHER_LOG_REGISTER_FILE_WRITER) -template <> -class SinkRegistrator -{ -public: - SinkRegistrator() - { - DispatchLog::get().AttachSink( DL_SINK_IMsgHandler, &FileSink::get(DISPACTHER_LOG_FW_PATH)); - } -}; - -void FileSink::Write(int level, int /*opcode*/, const char * msg, va_list argptr) -{ - if (NULL != m_hdl && NULL != msg) - { - fprintf(m_hdl, "%s", CODE_TO_STRING(level, LevelStrings)); - vfprintf(m_hdl, msg, argptr); - } -} -#endif - -////////////////////////////////////////////////////////////////////////// -//singletons initialization section - - -#ifdef DISPATCHER_LOG_REGISTER_EVENT_PROVIDER - static SinkRegistrator g_registrator1; -#endif - - -#ifdef DISPATCHER_LOG_REGISTER_FILE_WRITER - static SinkRegistrator g_registrator2; -#endif - - -#endif//(MFX_DISPATCHER_LOG) \ No newline at end of file diff --git a/plugins/obs-qsv11/libmfx/src/mfx_driver_store_loader.cpp b/plugins/obs-qsv11/libmfx/src/mfx_driver_store_loader.cpp deleted file mode 100644 index 17f00787b..000000000 --- a/plugins/obs-qsv11/libmfx/src/mfx_driver_store_loader.cpp +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) 2019-2020 Intel Corporation -// -// 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 "mfx_driver_store_loader.h" -#include "mfx_dispatcher_log.h" -#include "mfx_load_dll.h" - -namespace MFX -{ - - -inline bool IsIntelDeviceInstanceID(const wchar_t * DeviceID) -{ - return wcsstr(DeviceID, L"VEN_8086") || wcsstr(DeviceID, L"ven_8086"); -} - -inline bool ExctractDeviceID(const wchar_t* descrString, mfxU32& deviceID) -{ - const wchar_t *begin = wcsstr(descrString, L"DEV_"); - - if (!begin) - { - begin = wcsstr(descrString, L"dev_"); - if (!begin) - { - DISPATCHER_LOG_WRN(("exctracting device id: failed to find device id substring\n")); - return false; - } - } - - begin += wcslen(L"DEV_"); - deviceID = wcstoul(begin, NULL, 16); - if (!deviceID) - { - DISPATCHER_LOG_WRN(("exctracting device id: failed to convert device id str to int\n")); - return false; - } - - return true; -} - - - -DriverStoreLoader::DriverStoreLoader(void) - : m_moduleCfgMgr(NULL) - , m_pCM_Get_Device_ID_List_Size(NULL) - , m_pCM_Get_Device_ID_List(NULL) - , m_pCM_Locate_DevNode(NULL) - , m_pCM_Open_DevNode_Key(NULL) -{ -} - -DriverStoreLoader::~DriverStoreLoader(void) -{ -} - -bool DriverStoreLoader::GetDriverStorePath(wchar_t * path, DWORD dwPathSize, mfxU32 deviceID) -{ - if (path == NULL || dwPathSize == 0) - { - return false; - } - - // Obtain a PnP handle to the Intel graphics adapter - CONFIGRET result = CR_SUCCESS; - ULONG DeviceIDListSize = 0; - MFXVector DeviceIDList; - wchar_t DisplayGUID[40]; - DEVINST DeviceInst; - - DISPATCHER_LOG_INFO(("Looking for MediaSDK in DriverStore\n")); - - if (!LoadCfgMgr() || !LoadCmFuncs()) - { - return false; - } - - if (StringFromGUID2(GUID_DEVCLASS_DISPLAY, DisplayGUID, sizeof(DisplayGUID)) == 0) - { - DISPATCHER_LOG_WRN(("Couldn't prepare string from GUID\n")); - return false; - } - - do - { - result = m_pCM_Get_Device_ID_List_Size(&DeviceIDListSize, DisplayGUID, CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT); - if (result != CR_SUCCESS) - { - break; - } - - try - { - DeviceIDList.resize(DeviceIDListSize); - } - catch (...) - { - return false; - } - result = m_pCM_Get_Device_ID_List(DisplayGUID, DeviceIDList.data(), DeviceIDListSize, CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT); - - } while (result == CR_BUFFER_SMALL); - - if (result != CR_SUCCESS) - { - return false; - } - - //Look for MediaSDK record - wchar_t *begin = DeviceIDList.data(); - wchar_t *end = begin + DeviceIDList.size(); - size_t len = 0; - - for (; (begin < end) && (len = wcslen(begin)) > 0; begin += len + 1) - { - if (IsIntelDeviceInstanceID(begin)) - { - mfxU32 curDeviceID = 0; - if (!ExctractDeviceID(begin, curDeviceID) || curDeviceID != deviceID) - { - continue; - } - - result = m_pCM_Locate_DevNode(&DeviceInst, begin, CM_LOCATE_DEVNODE_NORMAL); - if (result != CR_SUCCESS) - { - continue; - } - - HKEY hKey_sw; - result = m_pCM_Open_DevNode_Key(DeviceInst, KEY_READ, 0, RegDisposition_OpenExisting, &hKey_sw, CM_REGISTRY_SOFTWARE); - if (result != CR_SUCCESS) - { - continue; - } - - ULONG nError; - - DWORD pathSize = dwPathSize; - - nError = RegQueryValueExW(hKey_sw, L"DriverStorePathForMediaSDK", 0, NULL, (LPBYTE)path, &pathSize); - - RegCloseKey(hKey_sw); - - if (ERROR_SUCCESS == nError) - { - if (path[wcslen(path) - 1] != '/' && path[wcslen(path) - 1] != '\\') - { - wcscat_s(path, MFX_MAX_DLL_PATH, L"\\"); - } - DISPATCHER_LOG_INFO(("DriverStore path is found\n")); - return true; - } - } - } - - DISPATCHER_LOG_INFO(("DriverStore path isn't found\n")); - return false; - -} // bool DriverStoreLoader::GetDriverStorePath(wchar_t * path, DWORD dwPathSize) - -bool DriverStoreLoader::LoadCfgMgr() -{ - if (!m_moduleCfgMgr) - { - m_moduleCfgMgr = mfx_dll_load(L"cfgmgr32.dll"); - - if (!m_moduleCfgMgr) - { - DISPATCHER_LOG_WRN(("cfgmgr32.dll couldn't be loaded\n")); - return false; - } - } - - return true; - -} // bool DriverStoreLoader::LoadCfgMgr() - -bool DriverStoreLoader::LoadCmFuncs() -{ - if (!m_pCM_Get_Device_ID_List || !m_pCM_Get_Device_ID_List_Size || !m_pCM_Locate_DevNode || !m_pCM_Open_DevNode_Key) - { - m_pCM_Get_Device_ID_List = (Func_CM_Get_Device_ID_ListW) mfx_dll_get_addr((HMODULE)m_moduleCfgMgr, "CM_Get_Device_ID_ListW"); - m_pCM_Get_Device_ID_List_Size = (Func_CM_Get_Device_ID_List_SizeW) mfx_dll_get_addr((HMODULE)m_moduleCfgMgr, "CM_Get_Device_ID_List_SizeW"); - m_pCM_Locate_DevNode = (Func_CM_Locate_DevNodeW) mfx_dll_get_addr((HMODULE)m_moduleCfgMgr, "CM_Locate_DevNodeW"); - m_pCM_Open_DevNode_Key = (Func_CM_Open_DevNode_Key) mfx_dll_get_addr((HMODULE)m_moduleCfgMgr, "CM_Open_DevNode_Key"); - - if (!m_pCM_Get_Device_ID_List || !m_pCM_Get_Device_ID_List_Size || !m_pCM_Locate_DevNode || !m_pCM_Open_DevNode_Key) - { - DISPATCHER_LOG_WRN(("One of cfgmgr32.dll function isn't found\n")); - return false; - } - } - - return true; - -} // bool DriverStoreLoader::LoadCmFuncs() - -} // namespace MFX diff --git a/plugins/obs-qsv11/libmfx/src/mfx_dxva2_device.cpp b/plugins/obs-qsv11/libmfx/src/mfx_dxva2_device.cpp deleted file mode 100644 index ad69528a1..000000000 --- a/plugins/obs-qsv11/libmfx/src/mfx_dxva2_device.cpp +++ /dev/null @@ -1,568 +0,0 @@ -// Copyright (c) 2012-2019 Intel Corporation -// -// 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. - -#define INITGUID -#include -#include - -#include "mfx_dxva2_device.h" - - -using namespace MFX; - - -DXDevice::DXDevice(void) -{ - m_hModule = (HMODULE) 0; - - m_numAdapters = 0; - - m_vendorID = 0; - m_deviceID = 0; - m_driverVersion = 0; - m_luid = 0; - -} // DXDevice::DXDevice(void) - -DXDevice::~DXDevice(void) -{ - Close(); - - // free DX library only when device is destroyed - UnloadDLLModule(); - -} // DXDevice::~DXDevice(void) - -mfxU32 DXDevice::GetVendorID(void) const -{ - return m_vendorID; - -} // mfxU32 DXDevice::GetVendorID(void) const - -mfxU32 DXDevice::GetDeviceID(void) const -{ - return m_deviceID; - -} // mfxU32 DXDevice::GetDeviceID(void) const - -mfxU64 DXDevice::GetDriverVersion(void) const -{ - return m_driverVersion; - -}// mfxU64 DXDevice::GetDriverVersion(void) const - -mfxU64 DXDevice::GetLUID(void) const -{ - return m_luid; - -} // mfxU64 DXDevice::GetLUID(void) const - -mfxU32 DXDevice::GetAdapterCount(void) const -{ - return m_numAdapters; - -} // mfxU32 DXDevice::GetAdapterCount(void) const - -void DXDevice::Close(void) -{ - m_numAdapters = 0; - - m_vendorID = 0; - m_deviceID = 0; - m_luid = 0; - -} // void DXDevice::Close(void) - -void DXDevice::LoadDLLModule(const wchar_t *pModuleName) -{ - // unload the module if it is required - UnloadDLLModule(); - -#if !defined(MEDIASDK_UWP_DISPATCHER) - DWORD prevErrorMode = 0; - // set the silent error mode -#if (_WIN32_WINNT >= 0x0600) - SetThreadErrorMode(SEM_FAILCRITICALERRORS, &prevErrorMode); -#else - prevErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); -#endif -#endif // !defined(MEDIASDK_UWP_DISPATCHER) - - // load specified library - m_hModule = LoadLibraryExW(pModuleName, NULL, 0); - -#if !defined(MEDIASDK_UWP_DISPATCHER) - // set the previous error mode -#if (_WIN32_WINNT >= 0x0600) - SetThreadErrorMode(prevErrorMode, NULL); -#else - SetErrorMode(prevErrorMode); -#endif -#endif // !defined(MEDIASDK_UWP_DISPATCHER) - -} // void LoadDLLModule(const wchar_t *pModuleName) - -void DXDevice::UnloadDLLModule(void) -{ - if (m_hModule) - { - FreeLibrary(m_hModule); - m_hModule = (HMODULE) 0; - } - -} // void DXDevice::UnloaDLLdModule(void) - -#ifdef MFX_D3D9_ENABLED -D3D9Device::D3D9Device(void) -{ - m_pD3D9 = (void *) 0; - m_pD3D9Ex = (void *) 0; - -} // D3D9Device::D3D9Device(void) - -D3D9Device::~D3D9Device(void) -{ - Close(); - -} // D3D9Device::~D3D9Device(void) - -void D3D9Device::Close(void) -{ - // release the interfaces - if (m_pD3D9Ex) - { - ((IDirect3D9Ex *) m_pD3D9Ex)->Release(); - } - - // release the interfaces - if (m_pD3D9) - { - ((IDirect3D9 *) m_pD3D9)->Release(); - } - - m_pD3D9 = (void *) 0; - m_pD3D9Ex = (void *) 0; - -} // void D3D9Device::Close(void) - -typedef - IDirect3D9 * (WINAPI *D3DCreateFunctionPtr_t) (UINT); - -typedef - HRESULT (WINAPI *D3DExCreateFunctionPtr_t) (UINT, IDirect3D9Ex **); - -bool D3D9Device::Init(const mfxU32 adapterNum) -{ - // close the device before initialization - Close(); - - // load the library - if (NULL == m_hModule) - { - LoadDLLModule(L"d3d9.dll"); - } - - if (m_hModule) - { - D3DCreateFunctionPtr_t pFunc; - - // load address of procedure to create D3D device - pFunc = (D3DCreateFunctionPtr_t) GetProcAddress(m_hModule, "Direct3DCreate9"); - if (pFunc) - { - D3DADAPTER_IDENTIFIER9 adapterIdent; - IDirect3D9 *pD3D9; - HRESULT hRes; - - // create D3D object - m_pD3D9 = pFunc(D3D_SDK_VERSION); - - if (NULL == m_pD3D9) - { - DXVA2DEVICE_TRACE(("FAIL: Direct3DCreate9(%d) : GetLastError()=0x%x", D3D_SDK_VERSION, GetLastError())); - return false; - } - - // cast the interface - pD3D9 = (IDirect3D9 *) m_pD3D9; - - m_numAdapters = pD3D9->GetAdapterCount(); - if (adapterNum >= m_numAdapters) - { - return false; - } - - // get the card's parameters - hRes = pD3D9->GetAdapterIdentifier(adapterNum, 0, &adapterIdent); - if (D3D_OK != hRes) - { - DXVA2DEVICE_TRACE(("FAIL: GetAdapterIdentifier(%d) = 0x%x \n", adapterNum, hRes)); - return false; - } - - m_vendorID = adapterIdent.VendorId; - m_deviceID = adapterIdent.DeviceId; - m_driverVersion = (mfxU64)adapterIdent.DriverVersion.QuadPart; - - // load LUID - IDirect3D9Ex *pD3D9Ex; - D3DExCreateFunctionPtr_t pFuncEx; - LUID d3d9LUID; - - // find the appropriate function - pFuncEx = (D3DExCreateFunctionPtr_t) GetProcAddress(m_hModule, "Direct3DCreate9Ex"); - if (NULL == pFuncEx) - { - // the extended interface is not supported - return true; - } - - // create extended interface - hRes = pFuncEx(D3D_SDK_VERSION, &pD3D9Ex); - if (FAILED(hRes)) - { - // can't create extended interface - return true; - } - m_pD3D9Ex = pD3D9Ex; - - // obtain D3D9 device LUID - hRes = pD3D9Ex->GetAdapterLUID(adapterNum, &d3d9LUID); - if (FAILED(hRes)) - { - // can't get LUID - return true; - } - // copy the LUID - *((LUID *) &m_luid) = d3d9LUID; - } - else - { - DXVA2DEVICE_TRACE_OPERATION({ - wchar_t path[1024]; - DWORD lastErr = GetLastError(); - GetModuleFileNameW(m_hModule, path, sizeof(path)/sizeof(path[0])); - DXVA2DEVICE_TRACE(("FAIL: invoking GetProcAddress(Direct3DCreate9) in %S : GetLastError()==0x%x\n", path, lastErr)); }); - return false; - } - } - else - { - DXVA2DEVICE_TRACE(("FAIL: invoking LoadLibrary(\"d3d9.dll\") : GetLastError()==0x%x\n", GetLastError())); - return false; - } - - return true; - -} // bool D3D9Device::Init(const mfxU32 adapterNum) -#endif //MFX_D3D9_ENABLED - -typedef -HRESULT (WINAPI *DXGICreateFactoryFunc) (REFIID riid, void **ppFactory); - -DXGI1Device::DXGI1Device(void) -{ - m_pDXGIFactory1 = (void *) 0; - m_pDXGIAdapter1 = (void *) 0; - -} // DXGI1Device::DXGI1Device(void) - -DXGI1Device::~DXGI1Device(void) -{ - Close(); - -} // DXGI1Device::~DXGI1Device(void) - -void DXGI1Device::Close(void) -{ - // release the interfaces - if (m_pDXGIAdapter1) - { - ((IDXGIAdapter1 *) m_pDXGIAdapter1)->Release(); - } - - if (m_pDXGIFactory1) - { - ((IDXGIFactory1 *) m_pDXGIFactory1)->Release(); - } - - m_pDXGIFactory1 = (void *) 0; - m_pDXGIAdapter1 = (void *) 0; - -} // void DXGI1Device::Close(void) - -bool DXGI1Device::Init(const mfxU32 adapterNum) -{ - // release the object before initialization - Close(); - - IDXGIFactory1 *pFactory = NULL; - IDXGIAdapter1 *pAdapter = NULL; - DXGI_ADAPTER_DESC1 desc = { 0 }; - mfxU32 curAdapter = 0; - mfxU32 maxAdapters = 0; - HRESULT hRes = E_FAIL; - - DXGICreateFactoryFunc pFunc = NULL; - - // load up the library if it is not loaded - if (NULL == m_hModule) - { - LoadDLLModule(L"dxgi.dll"); - } - - if (m_hModule) - { - // load address of procedure to create DXGI 1.1 factory - pFunc = (DXGICreateFactoryFunc)GetProcAddress(m_hModule, "CreateDXGIFactory1"); - } - - if (NULL == pFunc) - { - return false; - } - - // create the factory -#if _MSC_VER >= 1400 - hRes = pFunc(__uuidof(IDXGIFactory1), (void**)(&pFactory)); -#else - hRes = pFunc(IID_IDXGIFactory1, (void**)(&pFactory)); -#endif - - if (FAILED(hRes)) - { - return false; - } - m_pDXGIFactory1 = pFactory; - - // get the number of adapters - curAdapter = 0; - maxAdapters = 0; - do - { - // get the required adapted - hRes = pFactory->EnumAdapters1(curAdapter, &pAdapter); - if (FAILED(hRes)) - { - break; - } - - // if it is the required adapter, save the interface - if (curAdapter == adapterNum) - { - m_pDXGIAdapter1 = pAdapter; - } - else - { - pAdapter->Release(); - } - - // get the next adapter - curAdapter += 1; - - } while (SUCCEEDED(hRes)); - maxAdapters = curAdapter; - - // there is no required adapter - if (adapterNum >= maxAdapters) - { - return false; - } - pAdapter = (IDXGIAdapter1 *) m_pDXGIAdapter1; - - // get the adapter's parameters - hRes = pAdapter->GetDesc1(&desc); - if (FAILED(hRes)) - { - return false; - } - - // save the parameters - m_vendorID = desc.VendorId; - m_deviceID = desc.DeviceId; - *((LUID *) &m_luid) = desc.AdapterLuid; - - return true; - -} // bool DXGI1Device::Init(const mfxU32 adapterNum) - -DXVA2Device::DXVA2Device(void) -{ - m_numAdapters = 0; - - m_vendorID = 0; - m_deviceID = 0; - - m_driverVersion = 0; -} // DXVA2Device::DXVA2Device(void) - -DXVA2Device::~DXVA2Device(void) -{ - Close(); - -} // DXVA2Device::~DXVA2Device(void) - -void DXVA2Device::Close(void) -{ - m_numAdapters = 0; - - m_vendorID = 0; - m_deviceID = 0; - - m_driverVersion = 0; -} // void DXVA2Device::Close(void) - -#ifdef MFX_D3D9_ENABLED -bool DXVA2Device::InitD3D9(const mfxU32 adapterNum) -{ - D3D9Device d3d9Device; - bool bRes; - - // release the object before initialization - Close(); - - // create 'old fashion' device - bRes = d3d9Device.Init(adapterNum); - if (false == bRes) - { - return false; - } - - - m_numAdapters = d3d9Device.GetAdapterCount(); - - // check if the application is under Remote Desktop - if ((0 == d3d9Device.GetVendorID()) || (0 == d3d9Device.GetDeviceID())) - { - // get the required parameters alternative way and ... - UseAlternativeWay(&d3d9Device); - } - else - { - // save the parameters and ... - m_vendorID = d3d9Device.GetVendorID(); - m_deviceID = d3d9Device.GetDeviceID(); - m_driverVersion = d3d9Device.GetDriverVersion(); - } - - // ... say goodbye - return true; -} // bool InitD3D9(const mfxU32 adapterNum) -#else // MFX_D3D9_ENABLED -bool DXVA2Device::InitD3D9(const mfxU32 adapterNum) -{ - (void)adapterNum; - return false; -} -#endif // MFX_D3D9_ENABLED - -bool DXVA2Device::InitDXGI1(const mfxU32 adapterNum) -{ - DXGI1Device dxgi1Device; - bool bRes; - - // release the object before initialization - Close(); - - // create modern DXGI device - bRes = dxgi1Device.Init(adapterNum); - if (false == bRes) - { - return false; - } - - // save the parameters and ... - m_vendorID = dxgi1Device.GetVendorID(); - m_deviceID = dxgi1Device.GetDeviceID(); - m_numAdapters = dxgi1Device.GetAdapterCount(); - - // ... say goodbye - return true; - -} // bool DXVA2Device::InitDXGI1(const mfxU32 adapterNum) - -#ifdef MFX_D3D9_ENABLED -void DXVA2Device::UseAlternativeWay(const D3D9Device *pD3D9Device) -{ - mfxU64 d3d9LUID = pD3D9Device->GetLUID(); - - // work only with valid LUIDs - if (0 == d3d9LUID) - { - return; - } - - DXGI1Device dxgi1Device; - mfxU32 curDevice = 0; - bool bRes = false; - - do - { - // initialize the next DXGI1 or DXGI device - bRes = dxgi1Device.Init(curDevice); - if (false == bRes) - { - // there is no more devices - break; - } - - // is it required device ? - if (d3d9LUID == dxgi1Device.GetLUID()) - { - m_vendorID = dxgi1Device.GetVendorID(); - m_deviceID = dxgi1Device.GetDeviceID(); - m_driverVersion = dxgi1Device.GetDriverVersion(); - return ; - } - - // get the next device - curDevice += 1; - - } while (bRes); - - dxgi1Device.Close(); - // we need to match a DXGI(1) device to the D3D9 device - -} // void DXVA2Device::UseAlternativeWay(const D3D9Device *pD3D9Device) -#endif // MFX_D3D9_ENABLED - -mfxU32 DXVA2Device::GetVendorID(void) const -{ - return m_vendorID; - -} // mfxU32 DXVA2Device::GetVendorID(void) const - -mfxU32 DXVA2Device::GetDeviceID(void) const -{ - return m_deviceID; - -} // mfxU32 DXVA2Device::GetDeviceID(void) const - -mfxU64 DXVA2Device::GetDriverVersion(void) const -{ - return m_driverVersion; -}// mfxU64 DXVA2Device::GetDriverVersion(void) const - -mfxU32 DXVA2Device::GetAdapterCount(void) const -{ - return m_numAdapters; - -} // mfxU32 DXVA2Device::GetAdapterCount(void) const - diff --git a/plugins/obs-qsv11/libmfx/src/mfx_function_table.cpp b/plugins/obs-qsv11/libmfx/src/mfx_function_table.cpp deleted file mode 100644 index fb56e4922..000000000 --- a/plugins/obs-qsv11/libmfx/src/mfx_function_table.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) 2012-2019 Intel Corporation -// -// 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 "mfx_dispatcher.h" - -// -// implement a table with functions names -// - -#undef FUNCTION -#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \ - {#func_name, API_VERSION}, - -const -FUNCTION_DESCRIPTION APIFunc[eVideoFuncTotal] = -{ - {"MFXInit", {{0, 1}}}, - {"MFXClose", {{0, 1}}}, - {"MFXQueryIMPL", {{0, 1}}}, - {"MFXQueryVersion", {{0, 1}}}, - - {"MFXJoinSession", {{1, 1}}}, - {"MFXDisjoinSession", {{1, 1}}}, - {"MFXCloneSession", {{1, 1}}}, - {"MFXSetPriority", {{1, 1}}}, - {"MFXGetPriority", {{1, 1}}}, - - {"MFXInitEx", {{1, 14}}}, - -#include "mfx_exposed_functions_list.h" -}; - -const -FUNCTION_DESCRIPTION APIAudioFunc[eAudioFuncTotal] = -{ - {"MFXInit", {{8, 1}}}, - {"MFXClose", {{8, 1}}}, - {"MFXQueryIMPL", {{8, 1}}}, - {"MFXQueryVersion", {{8, 1}}}, - - {"MFXJoinSession", {{8, 1}}}, - {"MFXDisjoinSession", {{8, 1}}}, - {"MFXCloneSession", {{8, 1}}}, - {"MFXSetPriority", {{8, 1}}}, - {"MFXGetPriority", {{8, 1}}}, - -#include "mfxaudio_exposed_functions_list.h" -}; - -// static section of the file -namespace -{ - -// -// declare pseudo-functions. -// they are used as default values for call-tables. -// - -mfxStatus pseudoMFXInit(mfxIMPL impl, mfxVersion *ver, mfxSession *session) -{ - // touch unreferenced parameters - (void) impl; - (void) ver; - (void) session; - - return MFX_ERR_UNKNOWN; - -} // mfxStatus pseudoMFXInit(mfxIMPL impl, mfxVersion *ver, mfxSession *session) - -mfxStatus pseudoMFXClose(mfxSession session) -{ - // touch unreferenced parameters - (void) session; - - return MFX_ERR_UNKNOWN; - -} // mfxStatus pseudoMFXClose(mfxSession session) - -mfxStatus pseudoMFXJoinSession(mfxSession session, mfxSession child_session) -{ - // touch unreferenced parameters - (void) session; - (void) child_session; - - return MFX_ERR_UNKNOWN; - -} // mfxStatus pseudoMFXJoinSession(mfxSession session, mfxSession child_session) - -mfxStatus pseudoMFXCloneSession(mfxSession session, mfxSession *clone) -{ - // touch unreferenced parameters - (void) session; - (void) clone; - - return MFX_ERR_UNKNOWN; - -} // mfxStatus pseudoMFXCloneSession(mfxSession session, mfxSession *clone) - -void SuppressWarnings(...) -{ - // this functions is suppose to suppress warnings. - // Actually it does nothing. - -} // void SuppressWarnings(...) - -#undef FUNCTION -#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \ -return_value pseudo##func_name formal_param_list \ -{ \ - SuppressWarnings actual_param_list; \ - return MFX_ERR_UNKNOWN; \ -} - -#include "mfx_exposed_functions_list.h" - -} // namespace diff --git a/plugins/obs-qsv11/libmfx/src/mfx_library_iterator.cpp b/plugins/obs-qsv11/libmfx/src/mfx_library_iterator.cpp deleted file mode 100644 index 9a2cfe2da..000000000 --- a/plugins/obs-qsv11/libmfx/src/mfx_library_iterator.cpp +++ /dev/null @@ -1,592 +0,0 @@ -// Copyright (c) 2012-2020 Intel Corporation -// -// 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 "mfx_library_iterator.h" - -#include "mfx_dispatcher.h" -#include "mfx_dispatcher_log.h" - -#include "mfx_dxva2_device.h" -#include "mfx_load_dll.h" - -#include -#include - -namespace MFX -{ - -enum -{ - MFX_MAX_MERIT = 0x7fffffff -}; - -// -// declare registry keys -// - -const -wchar_t rootDispPath[] = L"Software\\Intel\\MediaSDK\\Dispatch"; -const -wchar_t vendorIDKeyName[] = L"VendorID"; -const -wchar_t deviceIDKeyName[] = L"DeviceID"; -const -wchar_t meritKeyName[] = L"Merit"; -const -wchar_t pathKeyName[] = L"Path"; -const -wchar_t apiVersionName[] = L"APIVersion"; - -mfxStatus SelectImplementationType(const mfxU32 adapterNum, mfxIMPL *pImplInterface, mfxU32 *pVendorID, mfxU32 *pDeviceID) -{ - if (NULL == pImplInterface) - { - return MFX_ERR_NULL_PTR; - } -#if (MFX_VERSION >= MFX_VERSION_NEXT) - mfxIMPL impl_via = (*pImplInterface & ~MFX_IMPL_EXTERNAL_THREADING); -#else - mfxIMPL impl_via = *pImplInterface; -#endif - - DXVA2Device dxvaDevice; - if (MFX_IMPL_VIA_D3D9 == impl_via) - { - // try to create the Direct3D 9 device and find right adapter - if (!dxvaDevice.InitD3D9(adapterNum)) - { - DISPATCHER_LOG_INFO((("dxvaDevice.InitD3D9(%d) Failed\n"), adapterNum )); - return MFX_ERR_UNSUPPORTED; - } - } - else if (MFX_IMPL_VIA_D3D11 == impl_via) - { - // try to open DXGI 1.1 device to get hardware ID - if (!dxvaDevice.InitDXGI1(adapterNum)) - { - DISPATCHER_LOG_INFO((("dxvaDevice.InitDXGI1(%d) Failed\n"), adapterNum )); - return MFX_ERR_UNSUPPORTED; - } - } - else if (MFX_IMPL_VIA_ANY == impl_via) - { - // try the Direct3D 9 device - if (dxvaDevice.InitD3D9(adapterNum)) - { - *pImplInterface = MFX_IMPL_VIA_D3D9; // store value for GetImplementationType() call - } - // else try to open DXGI 1.1 device to get hardware ID - else if (dxvaDevice.InitDXGI1(adapterNum)) - { - *pImplInterface = MFX_IMPL_VIA_D3D11; // store value for GetImplementationType() call - } - else - { - DISPATCHER_LOG_INFO((("Unsupported adapter %d\n"), adapterNum )); - return MFX_ERR_UNSUPPORTED; - } - } - else - { - DISPATCHER_LOG_ERROR((("Unknown implementation type %d\n"), *pImplInterface )); - return MFX_ERR_UNSUPPORTED; - } - - // obtain card's parameters - if (pVendorID && pDeviceID) - { - *pVendorID = dxvaDevice.GetVendorID(); - *pDeviceID = dxvaDevice.GetDeviceID(); - } - - return MFX_ERR_NONE; -} - -MFXLibraryIterator::MFXLibraryIterator(void) -#if !defined(MEDIASDK_UWP_DISPATCHER) - : m_baseRegKey() -#endif -{ - m_implType = MFX_LIB_PSEUDO; - m_implInterface = MFX_IMPL_UNSUPPORTED; - - m_vendorID = 0; - m_deviceID = 0; - - m_lastLibIndex = 0; - m_lastLibMerit = MFX_MAX_MERIT; - - m_bIsSubKeyValid = 0; - m_StorageID = 0; - - m_SubKeyName[0] = 0; -} // MFXLibraryIterator::MFXLibraryIterator(void) - -MFXLibraryIterator::~MFXLibraryIterator(void) -{ - Release(); - -} // MFXLibraryIterator::~MFXLibraryIterator(void) - -void MFXLibraryIterator::Release(void) -{ - m_implType = MFX_LIB_PSEUDO; - m_implInterface = MFX_IMPL_UNSUPPORTED; - - m_vendorID = 0; - m_deviceID = 0; - - m_lastLibIndex = 0; - m_lastLibMerit = MFX_MAX_MERIT; - m_SubKeyName[0] = 0; - -} // void MFXLibraryIterator::Release(void) - -DECLSPEC_NOINLINE HMODULE GetThisDllModuleHandle() -{ - HMODULE hDll = NULL; - - GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | - GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, - reinterpret_cast(&GetThisDllModuleHandle), &hDll); - return hDll; -} - -// wchar_t* sImplPath must be allocated with size not less then msdk_disp_path_len -bool GetImplPath(int storageID, wchar_t* sImplPath) -{ - HMODULE hModule = NULL; - - sImplPath[0] = L'\0'; - - switch (storageID) { - case MFX_APP_FOLDER: - hModule = 0; - break; - case MFX_PATH_MSDK_FOLDER: - hModule = GetThisDllModuleHandle(); - HMODULE exeModule = GetModuleHandleW(NULL); - //It should works only if Dispatcher is linked with Dynamic Linked Library - if (!hModule || !exeModule || hModule == exeModule) - return false; - break; - } - - DWORD nSize = 0; - DWORD allocSize = msdk_disp_path_len; - - nSize = GetModuleFileNameW(hModule, &sImplPath[0], allocSize); - - if (nSize == 0 || nSize == allocSize) { - // nSize == 0 meanse that system can't get this info for hModule - // nSize == allocSize buffer is too small - return false; - } - - // for any case because WinXP implementation of GetModuleFileName does not add \0 to the end of string - sImplPath[nSize] = L'\0'; - - wchar_t * dirSeparator = wcsrchr(sImplPath, L'\\'); - if (dirSeparator != NULL && dirSeparator < (sImplPath + msdk_disp_path_len)) - { - *++dirSeparator = 0; - } - return true; -} - -mfxStatus MFXLibraryIterator::Init(eMfxImplType implType, mfxIMPL implInterface, const mfxU32 adapterNum, int storageID) -{ - // check error(s) - if ((MFX_LIB_SOFTWARE != implType) && - (MFX_LIB_HARDWARE != implType)) - { - return MFX_ERR_UNSUPPORTED; - } - - // release the object before initialization - Release(); - m_StorageID = storageID; - m_lastLibIndex = 0; - m_implType = implType; - m_implInterface = implInterface != 0 - ? implInterface - : MFX_IMPL_VIA_ANY; - - // for HW impl check impl interface, check adapter, obtain deviceID and vendorID - if (m_implType != MFX_LIB_SOFTWARE) - { - mfxStatus mfxRes = MFX::SelectImplementationType(adapterNum, &m_implInterface, &m_vendorID, &m_deviceID); - if (MFX_ERR_NONE != mfxRes) - { - return mfxRes; - } - } - -#if !defined(MEDIASDK_UWP_DISPATCHER) - if (storageID == MFX_CURRENT_USER_KEY || storageID == MFX_LOCAL_MACHINE_KEY) - { - return InitRegistry(storageID); - } - -#if defined(MFX_TRACER_WA_FOR_DS) - if (storageID == MFX_TRACER) - { - return InitRegistryTracer(); - } -#endif - -#endif - - wchar_t sMediaSDKPath[msdk_disp_path_len] = {}; - - if (storageID == MFX_DRIVER_STORE) - { - if (!m_driverStoreLoader.GetDriverStorePath(sMediaSDKPath, sizeof(sMediaSDKPath), m_deviceID)) - { - return MFX_ERR_UNSUPPORTED; - } - } - else if(!GetImplPath(storageID, sMediaSDKPath)) - { - return MFX_ERR_UNSUPPORTED; - } - - return InitFolder(implType, sMediaSDKPath, storageID); - -} // mfxStatus MFXLibraryIterator::Init(eMfxImplType implType, const mfxU32 adapterNum, int storageID) - -mfxStatus MFXLibraryIterator::InitRegistry(int storageID) -{ -#if !defined(MEDIASDK_UWP_DISPATCHER) - HKEY rootHKey; - bool bRes; - - // open required registry key - rootHKey = (MFX_LOCAL_MACHINE_KEY == storageID) ? (HKEY_LOCAL_MACHINE) : (HKEY_CURRENT_USER); - bRes = m_baseRegKey.Open(rootHKey, rootDispPath, KEY_READ); - if (false == bRes) - { - DISPATCHER_LOG_WRN((("Can't open %s\\%S : RegOpenKeyExA()==0x%x\n"), - (MFX_LOCAL_MACHINE_KEY == storageID) ? ("HKEY_LOCAL_MACHINE") : ("HKEY_CURRENT_USER"), - rootDispPath, GetLastError())) - return MFX_ERR_UNKNOWN; - } - - DISPATCHER_LOG_INFO((("Inspecting %s\\%S\n"), - (MFX_LOCAL_MACHINE_KEY == storageID) ? ("HKEY_LOCAL_MACHINE") : ("HKEY_CURRENT_USER"), - rootDispPath)) - - return MFX_ERR_NONE; -#else - (void) storageID; - return MFX_ERR_UNSUPPORTED; -#endif // #if !defined(MEDIASDK_UWP_DISPATCHER) - -} // mfxStatus MFXLibraryIterator::InitRegistry(int storageID) - -#if defined(MFX_TRACER_WA_FOR_DS) -mfxStatus MFXLibraryIterator::InitRegistryTracer() -{ -#if !defined(MEDIASDK_UWP_DISPATCHER) - - const wchar_t tracerRegKeyPath[] = L"Software\\Intel\\MediaSDK\\Dispatch\\tracer"; - - if (!m_baseRegKey.Open(HKEY_LOCAL_MACHINE, tracerRegKeyPath, KEY_READ) && !m_baseRegKey.Open(HKEY_CURRENT_USER, tracerRegKeyPath, KEY_READ)) - { - DISPATCHER_LOG_WRN(("can't find tracer registry key\n")) - return MFX_ERR_UNKNOWN; - } - - DISPATCHER_LOG_INFO(("found tracer registry key\n")) - return MFX_ERR_NONE; - -#else - return MFX_ERR_UNSUPPORTED; -#endif // #if !defined(MEDIASDK_UWP_DISPATCHER) - -} // mfxStatus MFXLibraryIterator::InitRegistryTracer() -#endif - -mfxStatus MFXLibraryIterator::InitFolder(eMfxImplType implType, const wchar_t * path, const int storageID) -{ - const int maxPathLen = sizeof(m_path)/sizeof(m_path[0]); - m_path[0] = 0; - wcscpy_s(m_path, maxPathLen, path); - size_t pathLen = wcslen(m_path); - - if(storageID==MFX_APP_FOLDER) - { - // we looking for runtime in application folder, it should be named libmfxsw64 or libmfxsw32 - mfx_get_default_dll_name(m_path + pathLen, msdk_disp_path_len - pathLen, MFX_LIB_SOFTWARE); - } - else - { - mfx_get_default_dll_name(m_path + pathLen, msdk_disp_path_len - pathLen, implType); - } - - return MFX_ERR_NONE; -} // mfxStatus MFXLibraryIterator::InitFolder(eMfxImplType implType, const wchar_t * path, const int storageID) - -mfxStatus MFXLibraryIterator::SelectDLLVersion(wchar_t *pPath - , size_t pathSize - , eMfxImplType *pImplType, mfxVersion minVersion) -{ - UNREFERENCED_PARAMETER(minVersion); - - if (m_StorageID == MFX_APP_FOLDER) - { - if (m_lastLibIndex != 0) - return MFX_ERR_NOT_FOUND; - if (m_vendorID != INTEL_VENDOR_ID) - return MFX_ERR_UNKNOWN; - - m_lastLibIndex = 1; - wcscpy_s(pPath, pathSize, m_path); - *pImplType = MFX_LIB_SOFTWARE; - return MFX_ERR_NONE; - } - - if (m_StorageID == MFX_PATH_MSDK_FOLDER || m_StorageID == MFX_DRIVER_STORE) - { - if (m_lastLibIndex != 0) - return MFX_ERR_NOT_FOUND; - if (m_vendorID != INTEL_VENDOR_ID) - return MFX_ERR_UNKNOWN; - - m_lastLibIndex = 1; - wcscpy_s(pPath, pathSize, m_path); - // do not change impl type - return MFX_ERR_NONE; - } - -#if !defined(MEDIASDK_UWP_DISPATCHER) - -#if defined(MFX_TRACER_WA_FOR_DS) - if (m_StorageID == MFX_TRACER) - { - if (m_lastLibIndex != 0) - return MFX_ERR_NOT_FOUND; - if (m_vendorID != INTEL_VENDOR_ID) - return MFX_ERR_UNKNOWN; - - m_lastLibIndex = 1; - - if (m_baseRegKey.Query(pathKeyName, REG_SZ, (LPBYTE)pPath, (DWORD*)&pathSize)) - { - DISPATCHER_LOG_INFO((("loaded %S : %S\n"), pathKeyName, pPath)); - } - else - { - DISPATCHER_LOG_WRN((("error querying %S : RegQueryValueExA()==0x%x\n"), pathKeyName, GetLastError())); - } - return MFX_ERR_NONE; - } -#endif - - wchar_t libPath[MFX_MAX_DLL_PATH] = L""; - DWORD libIndex = 0; - DWORD libMerit = 0; - DWORD index; - bool enumRes; - - // main query cycle - index = 0; - m_bIsSubKeyValid = false; - do - { - WinRegKey subKey; - wchar_t subKeyName[MFX_MAX_REGISTRY_KEY_NAME] = { 0 }; - DWORD subKeyNameSize = sizeof(subKeyName) / sizeof(subKeyName[0]); - - // query next value name - enumRes = m_baseRegKey.EnumKey(index, subKeyName, &subKeyNameSize); - if (!enumRes) - { - DISPATCHER_LOG_WRN((("no more subkeys : RegEnumKeyExA()==0x%x\n"), GetLastError())) - } - else - { - DISPATCHER_LOG_INFO((("found subkey: %S\n"), subKeyName)) - - bool bRes; - - // open the sub key - bRes = subKey.Open(m_baseRegKey, subKeyName, KEY_READ); - if (!bRes) - { - DISPATCHER_LOG_WRN((("error opening key %S :RegOpenKeyExA()==0x%x\n"), subKeyName, GetLastError())); - } - else - { - DISPATCHER_LOG_INFO((("opened key: %S\n"), subKeyName)); - - mfxU32 vendorID = 0, deviceID = 0, merit = 0; - DWORD size; - - // query vendor and device IDs - size = sizeof(vendorID); - bRes = subKey.Query(vendorIDKeyName, REG_DWORD, (LPBYTE) &vendorID, &size); - DISPATCHER_LOG_OPERATION({ - if (bRes) - { - DISPATCHER_LOG_INFO((("loaded %S : 0x%x\n"), vendorIDKeyName, vendorID)); - } - else - { - DISPATCHER_LOG_WRN((("querying %S : RegQueryValueExA()==0x%x\n"), vendorIDKeyName, GetLastError())); - } - }) - - if (bRes) - { - size = sizeof(deviceID); - bRes = subKey.Query(deviceIDKeyName, REG_DWORD, (LPBYTE) &deviceID, &size); - DISPATCHER_LOG_OPERATION({ - if (bRes) - { - DISPATCHER_LOG_INFO((("loaded %S : 0x%x\n"), deviceIDKeyName, deviceID)); - } - else - { - DISPATCHER_LOG_WRN((("querying %S : RegQueryValueExA()==0x%x\n"), deviceIDKeyName, GetLastError())); - } - }) - } - // query merit value - if (bRes) - { - size = sizeof(merit); - bRes = subKey.Query(meritKeyName, REG_DWORD, (LPBYTE) &merit, &size); - DISPATCHER_LOG_OPERATION({ - if (bRes) - { - DISPATCHER_LOG_INFO((("loaded %S : %d\n"), meritKeyName, merit)); - } - else - { - DISPATCHER_LOG_WRN((("querying %S : RegQueryValueExA()==0x%x\n"), meritKeyName, GetLastError())); - } - }) - } - - // if the library fits required parameters, - // query the library's path - if (bRes) - { - // compare device's and library's IDs - if (MFX_LIB_HARDWARE == m_implType) - { - if (m_vendorID != vendorID) - { - bRes = false; - DISPATCHER_LOG_WRN((("%S conflict, actual = 0x%x : required = 0x%x\n"), vendorIDKeyName, m_vendorID, vendorID)); - } - if (bRes && m_deviceID != deviceID) - { - bRes = false; - DISPATCHER_LOG_WRN((("%S conflict, actual = 0x%x : required = 0x%x\n"), deviceIDKeyName, m_deviceID, deviceID)); - } - } - - DISPATCHER_LOG_OPERATION({ - if (bRes) - { - if (!(((m_lastLibMerit > merit) || ((m_lastLibMerit == merit) && (m_lastLibIndex < index))) && - (libMerit < merit))) - { - DISPATCHER_LOG_WRN((("merit conflict: lastMerit = 0x%x, requiredMerit = 0x%x, libraryMerit = 0x%x, lastindex = %d, index = %d\n") - , m_lastLibMerit, merit, libMerit, m_lastLibIndex, index)); - } - }}) - - if ((bRes) && - ((m_lastLibMerit > merit) || ((m_lastLibMerit == merit) && (m_lastLibIndex < index))) && - (libMerit < merit)) - { - wchar_t tmpPath[MFX_MAX_DLL_PATH]; - DWORD tmpPathSize = sizeof(tmpPath); - - bRes = subKey.Query(pathKeyName, REG_SZ, (LPBYTE) tmpPath, &tmpPathSize); - if (!bRes) - { - DISPATCHER_LOG_WRN((("error querying %S : RegQueryValueExA()==0x%x\n"), pathKeyName, GetLastError())); - } - else - { - DISPATCHER_LOG_INFO((("loaded %S : %S\n"), pathKeyName, tmpPath)); - - wcscpy_s(libPath, sizeof(libPath) / sizeof(libPath[0]), tmpPath); - wcscpy_s(m_SubKeyName, sizeof(m_SubKeyName) / sizeof(m_SubKeyName[0]), subKeyName); - - libMerit = merit; - libIndex = index; - - // set the library's type - if ((0 == vendorID) || (0 == deviceID)) - { - *pImplType = MFX_LIB_SOFTWARE; - DISPATCHER_LOG_INFO((("Library type is MFX_LIB_SOFTWARE\n"))); - } - else - { - *pImplType = MFX_LIB_HARDWARE; - DISPATCHER_LOG_INFO((("Library type is MFX_LIB_HARDWARE\n"))); - } - } - } - } - } - } - - // advance key index - index += 1; - - } while (enumRes); - - // if the library's path was successfully read, - // the merit variable holds valid value - if (0 == libMerit) - { - return MFX_ERR_NOT_FOUND; - } - - wcscpy_s(pPath, pathSize, libPath); - - m_lastLibIndex = libIndex; - m_lastLibMerit = libMerit; - m_bIsSubKeyValid = true; - -#endif - - return MFX_ERR_NONE; - -} // mfxStatus MFXLibraryIterator::SelectDLLVersion(wchar_t *pPath, size_t pathSize, eMfxImplType *pImplType, mfxVersion minVersion) - -mfxIMPL MFXLibraryIterator::GetImplementationType() -{ - return m_implInterface; -} // mfxIMPL MFXLibraryIterator::GetImplementationType() - -bool MFXLibraryIterator::GetSubKeyName(wchar_t *subKeyName, size_t length) const -{ - wcscpy_s(subKeyName, length, m_SubKeyName); - return m_bIsSubKeyValid; -} -} // namespace MFX diff --git a/plugins/obs-qsv11/libmfx/src/mfx_load_dll.cpp b/plugins/obs-qsv11/libmfx/src/mfx_load_dll.cpp deleted file mode 100644 index c472675ef..000000000 --- a/plugins/obs-qsv11/libmfx/src/mfx_load_dll.cpp +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (c) 2012-2019 Intel Corporation -// -// 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 "mfx_dispatcher.h" -#include "mfx_load_dll.h" - -#include -#include -#include - -#if defined(_WIN64) -const -wchar_t * const defaultDLLName[2] = {L"libmfxhw64.dll", - L"libmfxsw64.dll"}; -const -wchar_t * const defaultAudioDLLName[2] = {L"libmfxaudiosw64.dll", - L"libmfxaudiosw64.dll"}; - -const -wchar_t * const defaultPluginDLLName[2] = {L"mfxplugin64_hw.dll", - L"mfxplugin64_sw.dll"}; - -#if defined(MEDIASDK_UWP_DISPATCHER) -const -wchar_t * const IntelGFXAPIDLLName = {L"intel_gfx_api-x64.dll"}; -#endif - -#elif defined(_WIN32) -const -wchar_t * const defaultDLLName[2] = {L"libmfxhw32.dll", - L"libmfxsw32.dll"}; - -const -wchar_t * const defaultAudioDLLName[2] = {L"libmfxaudiosw32.dll", - L"libmfxaudiosw32.dll"}; - -const -wchar_t * const defaultPluginDLLName[2] = {L"mfxplugin32_hw.dll", - L"mfxplugin32_sw.dll"}; - -#if defined(MEDIASDK_UWP_DISPATCHER) -const -wchar_t * const IntelGFXAPIDLLName = {L"intel_gfx_api-x86.dll"}; -#endif - -#endif // (defined(_WIN64)) - -namespace MFX -{ - - -mfxStatus mfx_get_default_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType) -{ - if (!pPath) - { - return MFX_ERR_NULL_PTR; - } - - - // there are only 2 implementation with default DLL names -#if _MSC_VER >= 1400 - return 0 == wcscpy_s(pPath, pathSize, defaultDLLName[implType & 1]) - ? MFX_ERR_NONE : MFX_ERR_UNKNOWN; -#else - wcscpy(pPath, defaultDLLName[implType & 1]); - return MFX_ERR_NONE; -#endif -} // mfxStatus mfx_get_default_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType) - -#if defined(MEDIASDK_UWP_DISPATCHER) -mfxStatus mfx_get_default_intel_gfx_api_dll_name(wchar_t *pPath, size_t pathSize) -{ - if (!pPath) - { - return MFX_ERR_NULL_PTR; - } - -#if _MSC_VER >= 1400 - return 0 == wcscpy_s(pPath, pathSize, IntelGFXAPIDLLName) - ? MFX_ERR_NONE : MFX_ERR_UNKNOWN; -#else - wcscpy(pPath, IntelGFXAPIDLLName); - return MFX_ERR_NONE; -#endif -} // mfx_get_default_intel_gfx_api_dll_name(wchar_t *pPath, size_t pathSize) -#endif - -mfxStatus mfx_get_default_plugin_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType) -{ - if (!pPath) - { - return MFX_ERR_NULL_PTR; - } - - - // there are only 2 implementation with default DLL names -#if _MSC_VER >= 1400 - return 0 == wcscpy_s(pPath, pathSize, defaultPluginDLLName[implType & 1]) - ? MFX_ERR_NONE : MFX_ERR_UNKNOWN; -#else - wcscpy(pPath, defaultPluginDLLName[implType & 1]); - return MFX_ERR_NONE; -#endif -} - -mfxStatus mfx_get_default_audio_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType) -{ - if (!pPath) - { - return MFX_ERR_NULL_PTR; - } - - // there are only 2 implementation with default DLL names -#if _MSC_VER >= 1400 - return 0 == wcscpy_s(pPath, pathSize, defaultAudioDLLName[implType & 1]) - ? MFX_ERR_NONE : MFX_ERR_UNKNOWN; -#else - wcscpy(pPath, defaultAudioDLLName[implType & 1]); - return MFX_ERR_NONE; -#endif -} // mfxStatus mfx_get_default_audio_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType) - -mfxModuleHandle mfx_dll_load(const wchar_t *pFileName) -{ - mfxModuleHandle hModule = (mfxModuleHandle) 0; - - // check error(s) - if (NULL == pFileName) - { - return NULL; - } -#if !defined(MEDIASDK_UWP_DISPATCHER) - // set the silent error mode - DWORD prevErrorMode = 0; -#if (_WIN32_WINNT >= 0x0600) - SetThreadErrorMode(SEM_FAILCRITICALERRORS, &prevErrorMode); -#else - prevErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); -#endif -#endif // !defined(MEDIASDK_UWP_DISPATCHER) - - // load the library's module -#if !defined(MEDIASDK_ARM_LOADER) - hModule = LoadLibraryExW(pFileName, NULL, 0); -#endif - -#if !defined(MEDIASDK_UWP_DISPATCHER) - // set the previous error mode -#if (_WIN32_WINNT >= 0x0600) - SetThreadErrorMode(prevErrorMode, NULL); -#else - SetErrorMode(prevErrorMode); -#endif -#endif // !defined(MEDIASDK_UWP_DISPATCHER) - - return hModule; - -} // mfxModuleHandle mfx_dll_load(const wchar_t *pFileName) - -mfxFunctionPointer mfx_dll_get_addr(mfxModuleHandle handle, const char *pFunctionName) -{ - if (NULL == handle) - { - return NULL; - } - - return (mfxFunctionPointer) GetProcAddress((HMODULE) handle, pFunctionName); -} // mfxFunctionPointer mfx_dll_get_addr(mfxModuleHandle handle, const char *pFunctionName) - -bool mfx_dll_free(mfxModuleHandle handle) -{ - if (NULL == handle) - { - return true; - } - - BOOL bRes = FreeLibrary((HMODULE)handle); - - return !!bRes; -} // bool mfx_dll_free(mfxModuleHandle handle) - -#if !defined(MEDIASDK_UWP_DISPATCHER) -mfxModuleHandle mfx_get_dll_handle(const wchar_t *pFileName) -{ - mfxModuleHandle hModule = (mfxModuleHandle) 0; - - // check error(s) - if (NULL == pFileName) - { - return NULL; - } - - // set the silent error mode - DWORD prevErrorMode = 0; -#if (_WIN32_WINNT >= 0x0600) - SetThreadErrorMode(SEM_FAILCRITICALERRORS, &prevErrorMode); -#else - prevErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS); -#endif - // load the library's module - GetModuleHandleExW(0, pFileName, (HMODULE*) &hModule); - // set the previous error mode -#if (_WIN32_WINNT >= 0x0600) - SetThreadErrorMode(prevErrorMode, NULL); -#else - SetErrorMode(prevErrorMode); -#endif - return hModule; -} -#endif //!defined(MEDIASDK_UWP_DISPATCHER) - -} // namespace MFX - diff --git a/plugins/obs-qsv11/libmfx/src/mfx_load_plugin.cpp b/plugins/obs-qsv11/libmfx/src/mfx_load_plugin.cpp deleted file mode 100644 index 8b84f4c45..000000000 --- a/plugins/obs-qsv11/libmfx/src/mfx_load_plugin.cpp +++ /dev/null @@ -1,454 +0,0 @@ -// Copyright (c) 2013-2019 Intel Corporation -// -// 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 "mfx_load_plugin.h" -#include "mfx_load_dll.h" -#include "mfx_dispatcher_log.h" - -#define TRACE_PLUGIN_ERROR(str, ...) DISPATCHER_LOG_ERROR((("[PLUGIN]: " str), __VA_ARGS__)) -#define TRACE_PLUGIN_INFO(str, ...) DISPATCHER_LOG_INFO((("[PLUGIN]: " str), __VA_ARGS__)) - -#define CREATE_PLUGIN_FNC "CreatePlugin" - -MFX::PluginModule::PluginModule() - : mHmodule() - , mCreatePluginPtr() - , mPath() -{ -} - -MFX::PluginModule::PluginModule(const PluginModule & that) - : mHmodule(mfx_dll_load(that.mPath)) - , mCreatePluginPtr(that.mCreatePluginPtr) -{ - wcscpy_s(mPath, sizeof(mPath) / sizeof(*mPath), that.mPath); -} - -MFX::PluginModule & MFX::PluginModule::operator = (const MFX::PluginModule & that) -{ - if (this != &that) - { - Tidy(); - mHmodule = mfx_dll_load(that.mPath); - mCreatePluginPtr = that.mCreatePluginPtr; - wcscpy_s(mPath, sizeof(mPath) / sizeof(*mPath), that.mPath); - } - return *this; -} - -MFX::PluginModule::PluginModule(const wchar_t * path) - : mCreatePluginPtr() -{ - mHmodule = mfx_dll_load(path); - if (NULL == mHmodule) { - TRACE_PLUGIN_ERROR("Cannot load module: %S\n", path); - return ; - } - TRACE_PLUGIN_INFO("Plugin loaded at: %S\n", path); - - mCreatePluginPtr = (CreatePluginPtr_t)mfx_dll_get_addr(mHmodule, CREATE_PLUGIN_FNC); - if (NULL == mCreatePluginPtr) { - TRACE_PLUGIN_ERROR("Cannot get procedure address: %s\n", CREATE_PLUGIN_FNC); - return ; - } - - wcscpy_s(mPath, sizeof(mPath) / sizeof(*mPath), path); -} - -bool MFX::PluginModule::Create( mfxPluginUID uid, mfxPlugin& plg) -{ - bool result = false; - if (mCreatePluginPtr) - { - mfxStatus mfxResult = mCreatePluginPtr(uid, &plg); - result = (MFX_ERR_NONE == mfxResult); - if (!result) { - TRACE_PLUGIN_ERROR("\"%S::%s\" returned %d\n", mPath, CREATE_PLUGIN_FNC, mfxResult); - } else { - TRACE_PLUGIN_INFO("\"%S::%s\" SUCCEED\n", mPath, CREATE_PLUGIN_FNC); - } - } - return result; -} - -void MFX::PluginModule::Tidy() -{ - mfx_dll_free(mHmodule); - mCreatePluginPtr = NULL; - mHmodule = NULL; -} - -MFX::PluginModule::~PluginModule(void) -{ - Tidy(); -} - -#if !defined(MEDIASDK_UWP_DISPATCHER) - -bool MFX::MFXPluginFactory::RunVerification( const mfxPlugin & plg, const PluginDescriptionRecord &dsc, mfxPluginParam &pluginParams) -{ - if (plg.PluginInit == 0) - { - TRACE_PLUGIN_ERROR("plg->PluginInit = 0\n", 0); - return false; - } - if (plg.PluginClose == 0) - { - TRACE_PLUGIN_ERROR("plg->PluginClose = 0\n", 0); - return false; - } - if (plg.GetPluginParam == 0) - { - TRACE_PLUGIN_ERROR("plg->GetPluginParam = 0\n", 0); - return false; - } - - if (plg.Execute == 0) - { - TRACE_PLUGIN_ERROR("plg->Execute = 0\n", 0); - return false; - } - if (plg.FreeResources == 0) - { - TRACE_PLUGIN_ERROR("plg->FreeResources = 0\n", 0); - return false; - } - - mfxStatus sts = plg.GetPluginParam(plg.pthis, &pluginParams); - if (sts != MFX_ERR_NONE) - { - TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned %d\n", sts); - return false; - } - - if (dsc.Default) - { - // for default plugins there is no description, dsc.APIVersion, dsc.PluginVersion and dsc.PluginUID were set by dispatcher - // dsc.PluginVersion == requested plugin version (parameter of MFXVideoUSER_Load); dsc.APIVersion == loaded library API - if (dsc.PluginVersion > pluginParams.PluginVersion) - { - TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned PluginVersion=%d, but it is smaller than requested : %d\n", pluginParams.PluginVersion, dsc.PluginVersion); - return false; - } - } - else - { - if (!dsc.onlyVersionRegistered && pluginParams.CodecId != dsc.CodecId) - { - TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned CodecId=" MFXFOURCCTYPE()", but registration has CodecId=" MFXFOURCCTYPE()"\n" - , MFXU32TOFOURCC(pluginParams.CodecId), MFXU32TOFOURCC(dsc.CodecId)); - return false; - } - - if (!dsc.onlyVersionRegistered && pluginParams.Type != dsc.Type) - { - TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned Type=%d, but registration has Type=%d\n", pluginParams.Type, dsc.Type); - return false; - } - - if (pluginParams.PluginUID != dsc.PluginUID) - { - TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned UID=" MFXGUIDTYPE()", but registration has UID=" MFXGUIDTYPE()"\n" - , MFXGUIDTOHEX(&pluginParams.PluginUID), MFXGUIDTOHEX(&dsc.PluginUID)); - return false; - } - - if (pluginParams.PluginVersion != dsc.PluginVersion) - { - TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned PluginVersion=%d, but registration has PlgVer=%d\n", pluginParams.PluginVersion, dsc.PluginVersion); - return false; - } - - if (pluginParams.APIVersion.Version != dsc.APIVersion.Version) - { - TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned APIVersion=%d.%d, but registration has APIVer=%d.%d\n" - , pluginParams.APIVersion.Major, pluginParams.APIVersion.Minor - , dsc.APIVersion.Major, dsc.APIVersion.Minor); - return false; - } - } - - switch(pluginParams.Type) - { - case MFX_PLUGINTYPE_VIDEO_DECODE: - case MFX_PLUGINTYPE_VIDEO_ENCODE: - case MFX_PLUGINTYPE_VIDEO_VPP: - { - TRACE_PLUGIN_INFO("plugin type= %d\n", pluginParams.Type); - if (plg.Video == 0) - { - TRACE_PLUGIN_ERROR("plg->Video = 0\n", 0); - return false; - } - - if (!VerifyCodecCommon(*plg.Video)) - return false; - break; - } - } - - switch(pluginParams.Type) - { - case MFX_PLUGINTYPE_VIDEO_DECODE: - return VerifyDecoder(*plg.Video); - case MFX_PLUGINTYPE_AUDIO_DECODE: - return VerifyAudioDecoder(*plg.Audio); - case MFX_PLUGINTYPE_VIDEO_ENCODE: - return VerifyEncoder(*plg.Video); - case MFX_PLUGINTYPE_AUDIO_ENCODE: - return VerifyAudioEncoder(*plg.Audio); - case MFX_PLUGINTYPE_VIDEO_VPP: - return VerifyVpp(*plg.Video); - case MFX_PLUGINTYPE_VIDEO_ENC: - return VerifyEnc(*plg.Video); - default: - { - TRACE_PLUGIN_ERROR("unsupported plugin type: %d\n", pluginParams.Type); - return false; - } - } -} - -bool MFX::MFXPluginFactory::VerifyVpp( const mfxVideoCodecPlugin &vpp ) -{ - if (vpp.VPPFrameSubmit == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->VPPFrameSubmit = 0\n", 0); - return false; - } - - return true; - -} - -bool MFX::MFXPluginFactory::VerifyEncoder( const mfxVideoCodecPlugin &encoder ) -{ - if (encoder.EncodeFrameSubmit == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->EncodeFrameSubmit = 0\n", 0); - return false; - } - - return true; -} - -bool MFX::MFXPluginFactory::VerifyAudioEncoder( const mfxAudioCodecPlugin &encoder ) -{ - if (encoder.EncodeFrameSubmit == 0) - { - TRACE_PLUGIN_ERROR("plg->Audio->EncodeFrameSubmit = 0\n", 0); - return false; - } - - return true; -} - -bool MFX::MFXPluginFactory::VerifyEnc( const mfxVideoCodecPlugin &videoEnc ) -{ - if (videoEnc.ENCFrameSubmit == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->EncodeFrameSubmit = 0\n", 0); - return false; - } - - return true; -} - -bool MFX::MFXPluginFactory::VerifyDecoder( const mfxVideoCodecPlugin &decoder ) -{ - if (decoder.DecodeHeader == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->DecodeHeader = 0\n", 0); - return false; - } - if (decoder.GetPayload == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->GetPayload = 0\n", 0); - return false; - } - if (decoder.DecodeFrameSubmit == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->DecodeFrameSubmit = 0\n", 0); - return false; - } - - return true; -} - -bool MFX::MFXPluginFactory::VerifyAudioDecoder( const mfxAudioCodecPlugin &decoder ) -{ - if (decoder.DecodeHeader == 0) - { - TRACE_PLUGIN_ERROR("plg->Audio->DecodeHeader = 0\n", 0); - return false; - } -// if (decoder.GetPayload == 0) - { - // TRACE_PLUGIN_ERROR("plg->Audio->GetPayload = 0\n", 0); - // return false; - } - if (decoder.DecodeFrameSubmit == 0) - { - TRACE_PLUGIN_ERROR("plg->Audio->DecodeFrameSubmit = 0\n", 0); - return false; - } - - return true; -} - -bool MFX::MFXPluginFactory::VerifyCodecCommon( const mfxVideoCodecPlugin & videoCodec ) -{ - if (videoCodec.Query == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->Query = 0\n", 0); - return false; - } - //todo: remove - if (videoCodec.Query == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->Query = 0\n", 0); - return false; - } - if (videoCodec.QueryIOSurf == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->QueryIOSurf = 0\n", 0); - return false; - } - if (videoCodec.Init == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->Init = 0\n", 0); - return false; - } - if (videoCodec.Reset == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->Reset = 0\n", 0); - return false; - } - if (videoCodec.Close == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->Close = 0\n", 0); - return false; - } - if (videoCodec.GetVideoParam == 0) - { - TRACE_PLUGIN_ERROR("plg->Video->GetVideoParam = 0\n", 0); - return false; - } - - return true; -} - -mfxStatus MFX::MFXPluginFactory::Create(const PluginDescriptionRecord & rec) -{ - PluginModule plgModule(rec.sPath); - mfxPlugin plg = {}; - mfxPluginParam plgParams; - - if (!plgModule.Create(rec.PluginUID, plg)) - { - return MFX_ERR_UNKNOWN; - } - - if (!RunVerification(plg, rec, plgParams)) - { - //will do not call plugin close since it is not safe to do that until structure is corrected - return MFX_ERR_UNKNOWN; - } - - - if (rec.Type == MFX_PLUGINTYPE_AUDIO_DECODE || - rec.Type == MFX_PLUGINTYPE_AUDIO_ENCODE) - { - mfxStatus sts = MFXAudioUSER_Register(mSession, plgParams.Type, &plg); - if (MFX_ERR_NONE != sts) - { - TRACE_PLUGIN_ERROR(" MFXAudioUSER_Register returned %d\n", sts); - return sts; - } - } - else - { - mfxStatus sts = MFXVideoUSER_Register(mSession, plgParams.Type, &plg); - if (MFX_ERR_NONE != sts) - { - TRACE_PLUGIN_ERROR(" MFXVideoUSER_Register returned %d\n", sts); - return sts; - } - } - - mPlugins.push_back(FactoryRecord(plgParams, plgModule, plg)); - - return MFX_ERR_NONE; -} - -MFX::MFXPluginFactory::~MFXPluginFactory() -{ - Close(); -} - -MFX::MFXPluginFactory::MFXPluginFactory( mfxSession session ) : - mPlugins() -{ - mSession = session; - nPlugins = 0; -} - -bool MFX::MFXPluginFactory::Destroy( const mfxPluginUID & uidToDestroy) -{ - for (MFXVector::iterator i = mPlugins.begin(); i!= mPlugins.end(); i++) - { - if (i->plgParams.PluginUID == uidToDestroy) - { - DestroyPlugin(*i); - //dll unload should happen here - //todo: check that dll_free fail is traced - mPlugins.erase(i); - return true; - } - } - return false; -} - -void MFX::MFXPluginFactory::Close() -{ - for (MFXVector::iterator i = mPlugins.begin(); i!= mPlugins.end(); i++) - { - DestroyPlugin(*i); - } - mPlugins.clear(); -} - -void MFX::MFXPluginFactory::DestroyPlugin( FactoryRecord & record) -{ - mfxStatus sts; - if (record.plgParams.Type == MFX_PLUGINTYPE_AUDIO_DECODE || - record.plgParams.Type == MFX_PLUGINTYPE_AUDIO_ENCODE) - { - sts = MFXAudioUSER_Unregister(mSession, record.plgParams.Type); - TRACE_PLUGIN_INFO(" MFXAudioUSER_Unregister for Type=%d, returned %d\n", record.plgParams.Type, sts); - } - else - { - sts = MFXVideoUSER_Unregister(mSession, record.plgParams.Type); - TRACE_PLUGIN_INFO(" MFXVideoUSER_Unregister for Type=%d, returned %d\n", record.plgParams.Type, sts); - } -} - -#endif //!defined(MEDIASDK_UWP_DISPATCHER) \ No newline at end of file diff --git a/plugins/obs-qsv11/libmfx/src/mfx_plugin_hive.cpp b/plugins/obs-qsv11/libmfx/src/mfx_plugin_hive.cpp deleted file mode 100644 index e7b47d461..000000000 --- a/plugins/obs-qsv11/libmfx/src/mfx_plugin_hive.cpp +++ /dev/null @@ -1,491 +0,0 @@ -// Copyright (c) 2013-2019 Intel Corporation -// -// 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 "mfx_plugin_hive.h" -#include "mfx_library_iterator.h" -#include "mfx_dispatcher.h" -#include "mfx_dispatcher_log.h" -#include "mfx_load_dll.h" - -#define TRACE_HIVE_ERROR(str, ...) DISPATCHER_LOG_ERROR((("[HIVE]: " str), __VA_ARGS__)) -#define TRACE_HIVE_INFO(str, ...) DISPATCHER_LOG_INFO((("[HIVE]: " str), __VA_ARGS__)) -#define TRACE_HIVE_WRN(str, ...) DISPATCHER_LOG_WRN((("[HIVE]: " str), __VA_ARGS__)) - -namespace -{ - const wchar_t rootPluginPath[] = L"Software\\Intel\\MediaSDK\\Plugin"; - const wchar_t rootDispatchPath[] = L"Software\\Intel\\MediaSDK\\Dispatch"; - const wchar_t pluginSubkey[] = L"Plugin"; - const wchar_t TypeKeyName[] = L"Type"; - const wchar_t CodecIDKeyName[] = L"CodecID"; - const wchar_t GUIDKeyName[] = L"GUID"; - const wchar_t PathKeyName[] = L"Path"; - const wchar_t DefaultKeyName[] = L"Default"; - const wchar_t PlgVerKeyName[] = L"PluginVersion"; - const wchar_t APIVerKeyName[] = L"APIVersion"; -} - -namespace -{ -#ifdef _WIN64 - const wchar_t pluginFileName[] = L"FileName64"; -#else - const wchar_t pluginFileName[] = L"FileName32"; -#endif // _WIN64 - - //do not allow store plugin in different hierarchy - const wchar_t pluginFileNameRestrictedCharacters[] = L"\\/"; - const wchar_t pluginCfgFileName[] = L"plugin.cfg"; - const wchar_t pluginSearchPattern[] = L"????????????????????????????????"; - const mfxU32 pluginCfgFileNameLen = 10; - const mfxU32 pluginDirNameLen = 32; - const mfxU32 defaultPluginNameLen = 25; - const mfxU32 charsPermfxU8 = 2; - const mfxU32 slashLen = 1; - enum - { - MAX_PLUGIN_FILE_LINE = 4096 - }; - - #define alignStr() "%-14S" -} - -#if !defined(MEDIASDK_UWP_DISPATCHER) - -MFX::MFXPluginsInHive::MFXPluginsInHive(int mfxStorageID, const wchar_t *msdkLibSubKey, mfxVersion currentAPIVersion) - : MFXPluginStorageBase(currentAPIVersion) -{ - HKEY rootHKey; - bool bRes; - WinRegKey regKey; - - if (MFX_LOCAL_MACHINE_KEY != mfxStorageID && MFX_CURRENT_USER_KEY != mfxStorageID) - return; - - // open required registry key - rootHKey = (MFX_LOCAL_MACHINE_KEY == mfxStorageID) ? (HKEY_LOCAL_MACHINE) : (HKEY_CURRENT_USER); - if (msdkLibSubKey) { - //dispatch/subkey/plugin - bRes = regKey.Open(rootHKey, rootDispatchPath, KEY_READ); - if (bRes) - { - bRes = regKey.Open(regKey, msdkLibSubKey, KEY_READ); - } - if (bRes) - { - bRes = regKey.Open(regKey, pluginSubkey, KEY_READ); - } - } - else - { - bRes = regKey.Open(rootHKey, rootPluginPath, KEY_READ); - } - - if (false == bRes) { - return; - } - DWORD index = 0; - if (!regKey.QueryInfo(&index)) { - return; - } - try - { - resize(index); - } - catch (...) { - TRACE_HIVE_ERROR("new PluginDescriptionRecord[%d] threw an exception: \n", index); - return; - } - - for(index = 0; ; index++) - { - wchar_t subKeyName[MFX_MAX_REGISTRY_KEY_NAME]; - DWORD subKeyNameSize = sizeof(subKeyName) / sizeof(subKeyName[0]); - WinRegKey subKey; - - // query next value name - bool enumRes = regKey.EnumKey(index, subKeyName, &subKeyNameSize); - if (!enumRes) { - break; - } - - // open the sub key - bRes = subKey.Open(regKey, subKeyName, KEY_READ); - if (!bRes) { - continue; - } - - if (msdkLibSubKey) - { - TRACE_HIVE_INFO("Found Plugin: %s\\%S\\%S\\%S\\%S\n", (MFX_LOCAL_MACHINE_KEY == mfxStorageID) ? ("HKEY_LOCAL_MACHINE") : ("HKEY_CURRENT_USER"), - rootDispatchPath, msdkLibSubKey, pluginSubkey, subKeyName); - } - else - { - TRACE_HIVE_INFO("Found Plugin: %s\\%S\\%S\n", (MFX_LOCAL_MACHINE_KEY == mfxStorageID) ? ("HKEY_LOCAL_MACHINE") : ("HKEY_CURRENT_USER"), - rootPluginPath, subKeyName); - } - - PluginDescriptionRecord descriptionRecord; - - if (!QueryKey(subKey, TypeKeyName, descriptionRecord.Type)) - { - continue; - } - TRACE_HIVE_INFO(alignStr()" : %d\n", TypeKeyName, descriptionRecord.Type); - - if (QueryKey(subKey, CodecIDKeyName, descriptionRecord.CodecId)) - { - TRACE_HIVE_INFO(alignStr()" : " MFXFOURCCTYPE()" \n", CodecIDKeyName, MFXU32TOFOURCC(descriptionRecord.CodecId)); - } - else - { - TRACE_HIVE_INFO(alignStr()" : \n", CodecIDKeyName, "NOT REGISTERED"); - } - - if (!QueryKey(subKey, GUIDKeyName, descriptionRecord.PluginUID)) - { - continue; - } - TRACE_HIVE_INFO(alignStr()" : " MFXGUIDTYPE()"\n", GUIDKeyName, MFXGUIDTOHEX(&descriptionRecord.PluginUID)); - - mfxU32 nSize = sizeof(descriptionRecord.sPath)/sizeof(*descriptionRecord.sPath); - if (!subKey.Query(PathKeyName, descriptionRecord.sPath, nSize)) - { - TRACE_HIVE_WRN("no value for : %S\n", PathKeyName); - continue; - } - TRACE_HIVE_INFO(alignStr()" : %S\n", PathKeyName, descriptionRecord.sPath); - - if (!QueryKey(subKey, DefaultKeyName, descriptionRecord.Default)) - { - continue; - } - TRACE_HIVE_INFO(alignStr()" : %s\n", DefaultKeyName, descriptionRecord.Default ? "true" : "false"); - - mfxU32 version = 0; - if (!QueryKey(subKey, PlgVerKeyName, version)) - { - continue; - } - descriptionRecord.PluginVersion = static_cast(version); - if (0 == version) - { - TRACE_HIVE_ERROR(alignStr()" : %d, which is invalid\n", PlgVerKeyName, descriptionRecord.PluginVersion); - continue; - } - else - { - TRACE_HIVE_INFO(alignStr()" : %d\n", PlgVerKeyName, descriptionRecord.PluginVersion); - } - - mfxU32 APIVersion = 0; - if (!QueryKey(subKey, APIVerKeyName, APIVersion)) - { - continue; - } - ConvertAPIVersion(APIVersion, descriptionRecord); - TRACE_HIVE_INFO(alignStr()" : %d.%d \n", APIVerKeyName, descriptionRecord.APIVersion.Major, descriptionRecord.APIVersion.Minor); - - try - { - operator[](index) = descriptionRecord; - } - catch (...) { - TRACE_HIVE_ERROR("operator[](%d) = descriptionRecord; - threw exception \n", index); - } - } -} - -MFX::MFXPluginsInFS::MFXPluginsInFS( mfxVersion currentAPIVersion ) - : MFXPluginStorageBase(currentAPIVersion) - , mIsVersionParsed() - , mIsAPIVersionParsed() -{ - WIN32_FIND_DATAW find_data; - wchar_t currentModuleName[MAX_PLUGIN_PATH]; - - GetModuleFileNameW(NULL, currentModuleName, MAX_PLUGIN_PATH); - if (GetLastError() != 0) - { - TRACE_HIVE_ERROR("GetModuleFileName() reported an error: %d\n", GetLastError()); - return; - } - wchar_t *lastSlashPos = wcsrchr(currentModuleName, L'\\'); - if (!lastSlashPos) { - lastSlashPos = currentModuleName; - } - mfxU32 executableDirLen = (mfxU32)(lastSlashPos - currentModuleName) + slashLen; - if (executableDirLen + pluginDirNameLen + pluginCfgFileNameLen >= MAX_PLUGIN_PATH) - { - TRACE_HIVE_ERROR("MAX_PLUGIN_PATH which is %d, not enough to locate plugin path\n", MAX_PLUGIN_PATH); - return; - } - wcscpy_s(lastSlashPos + slashLen - , MAX_PLUGIN_PATH - executableDirLen, pluginSearchPattern); - - HANDLE fileFirst = FindFirstFileW(currentModuleName, &find_data); - if (INVALID_HANDLE_VALUE == fileFirst) - { - TRACE_HIVE_ERROR("FindFirstFileW() unable to locate any plugins folders\n", 0); - return; - } - do - { - if (!(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) - { - continue; - } - if (pluginDirNameLen != wcslen(find_data.cFileName)) - { - continue; - } - //converting dirname into guid - PluginDescriptionRecord descriptionRecord; - descriptionRecord.APIVersion = currentAPIVersion; - descriptionRecord.onlyVersionRegistered = true; - - mfxU32 i = 0; - for(i = 0; i != pluginDirNameLen / charsPermfxU8; i++) - { - mfxU32 hexNum = 0; - if (1 != swscanf_s(find_data.cFileName + charsPermfxU8 * i, L"%2x", &hexNum)) - { - // it is ok to have non-plugin subdirs with length 32 - //TRACE_HIVE_INFO("folder name \"%S\" is not a valid GUID string\n", find_data.cFileName); - break; - } - if (hexNum == 0 && find_data.cFileName + charsPermfxU8 * i != wcsstr(find_data.cFileName + 2*i, L"00")) - { - // it is ok to have non-plugin subdirs with length 32 - //TRACE_HIVE_INFO("folder name \"%S\" is not a valid GUID string\n", find_data.cFileName); - break; - } - descriptionRecord.PluginUID.Data[i] = (mfxU8)hexNum; - } - if (i != pluginDirNameLen / charsPermfxU8) { - continue; - } - - wcscpy_s(currentModuleName + executableDirLen - , MAX_PLUGIN_PATH - executableDirLen, find_data.cFileName); - - wcscpy_s(currentModuleName + executableDirLen + pluginDirNameLen - , MAX_PLUGIN_PATH - executableDirLen - pluginDirNameLen, L"\\"); - - //this is path to plugin directory - wcscpy_s(descriptionRecord.sPath - , sizeof(descriptionRecord.sPath) / sizeof(*descriptionRecord.sPath), currentModuleName); - - wcscpy_s(currentModuleName + executableDirLen + pluginDirNameLen + slashLen - , MAX_PLUGIN_PATH - executableDirLen - pluginDirNameLen - slashLen, pluginCfgFileName); - - FILE *pluginCfgFile = 0; - _wfopen_s(&pluginCfgFile, currentModuleName, L"r"); - if (!pluginCfgFile) - { - TRACE_HIVE_INFO("in directory \"%S\" no mandatory \"%S\"\n" - , find_data.cFileName, pluginCfgFileName); - continue; - } - - if (ParseFile(pluginCfgFile, descriptionRecord)) - { - try - { - push_back(descriptionRecord); - } - catch (...) { - TRACE_HIVE_ERROR("mRecords.push_back(descriptionRecord); - threw exception \n", 0); - } - } - - fclose(pluginCfgFile); - }while (FindNextFileW(fileFirst, &find_data)); - FindClose(fileFirst); -} - -bool MFX::MFXPluginsInFS::ParseFile(FILE * f, PluginDescriptionRecord & descriptionRecord) -{ - wchar_t line[MAX_PLUGIN_FILE_LINE]; - - while(NULL != fgetws(line, sizeof(line) / sizeof(*line), f)) - { - wchar_t *delimiter = wcschr(line, L'='); - if (0 == delimiter) - { - TRACE_HIVE_INFO("plugin.cfg contains line \"%S\" which is not in K=V format, skipping \n", line); - continue; - } - *delimiter = 0; - if (!ParseKVPair(line, delimiter + 1, descriptionRecord)) - { - return false; - } - } - - if (!mIsVersionParsed) - { - TRACE_HIVE_ERROR("%S : Mandatory key %S not found\n", pluginCfgFileName, PlgVerKeyName); - return false; - } - - if (!mIsAPIVersionParsed) - { - TRACE_HIVE_ERROR("%S : Mandatory key %S not found\n", pluginCfgFileName, APIVerKeyName); - return false; - } - - if (!wcslen(descriptionRecord.sPath)) - { - TRACE_HIVE_ERROR("%S : Mandatory key %S not found\n", pluginCfgFileName, pluginFileName); - return false; - } - - return true; -} - -bool MFX::MFXPluginsInFS::ParseKVPair( wchar_t * key, wchar_t* value, PluginDescriptionRecord & descriptionRecord) -{ - if (0 != wcsstr(key, PlgVerKeyName)) - { - mfxU32 version ; - if (0 == swscanf_s(value, L"%d", &version)) - { - return false; - } - descriptionRecord.PluginVersion = (mfxU16)version; - - if (0 == descriptionRecord.PluginVersion) - { - TRACE_HIVE_ERROR("%S: %S = %d, which is invalid\n", pluginCfgFileName, PlgVerKeyName, descriptionRecord.PluginVersion); - return false; - } - - TRACE_HIVE_INFO("%S: %S = %d \n", pluginCfgFileName, PlgVerKeyName, descriptionRecord.PluginVersion); - mIsVersionParsed = true; - return true; - } - - if (0 != wcsstr(key, APIVerKeyName)) - { - mfxU32 APIversion; - if (0 == swscanf_s(value, L"%d", &APIversion)) - { - return false; - } - - ConvertAPIVersion(APIversion, descriptionRecord); - TRACE_HIVE_INFO("%S: %S = %d.%d \n", pluginCfgFileName, APIVerKeyName, descriptionRecord.APIVersion.Major, descriptionRecord.APIVersion.Minor); - - mIsAPIVersionParsed = true; - return true; - } - - - if (0!=wcsstr(key, pluginFileName)) - { - wchar_t *startQuoteMark = wcschr(value, L'\"'); - if (!startQuoteMark) - { - TRACE_HIVE_ERROR("plugin filename not in quotes : %S\n", value); - return false; - } - wchar_t *endQuoteMark = wcschr(startQuoteMark + 1, L'\"'); - - if (!endQuoteMark) - { - TRACE_HIVE_ERROR("plugin filename not in quotes : %S\n", value); - return false; - } - *endQuoteMark = 0; - - mfxU32 currentPathLen = (mfxU32)wcslen(descriptionRecord.sPath); - if (currentPathLen + wcslen(startQuoteMark + 1) > sizeof(descriptionRecord.sPath) / sizeof(*descriptionRecord.sPath)) - { - TRACE_HIVE_ERROR("buffer of MAX_PLUGIN_PATH characters which is %d, not enough lo store plugin path: %S%S\n" - , MAX_PLUGIN_PATH, descriptionRecord.sPath, startQuoteMark + 1); - return false; - } - - size_t restrictedCharIdx = wcscspn(startQuoteMark + 1, pluginFileNameRestrictedCharacters); - if (restrictedCharIdx != wcslen(startQuoteMark + 1)) - { - TRACE_HIVE_ERROR("plugin filename :%S, contains one of restricted characters: %S\n", startQuoteMark + 1, pluginFileNameRestrictedCharacters); - return false; - } - - wcscpy_s(descriptionRecord.sPath + currentPathLen - , sizeof(descriptionRecord.sPath) / sizeof(*descriptionRecord.sPath) - currentPathLen, startQuoteMark + 1); - - TRACE_HIVE_INFO("%S: %S = \"%S\" \n", pluginCfgFileName, pluginFileName, startQuoteMark + 1); - - return true; - } - - - return true; -} - -#endif //#if !defined(MEDIASDK_UWP_DISPATCHER) - -MFX::MFXDefaultPlugins::MFXDefaultPlugins(mfxVersion currentAPIVersion, MFX_DISP_HANDLE * hdl, int implType) - : MFXPluginStorageBase(currentAPIVersion) -{ - wchar_t libModuleName[MAX_PLUGIN_PATH]; - - GetModuleFileNameW((HMODULE)hdl->hModule, libModuleName, MAX_PLUGIN_PATH); - if (GetLastError() != 0) - { - TRACE_HIVE_ERROR("GetModuleFileName() reported an error: %d\n", GetLastError()); - return; - } - wchar_t *lastSlashPos = wcsrchr(libModuleName, L'\\'); - if (!lastSlashPos) { - lastSlashPos = libModuleName; - } - mfxU32 executableDirLen = (mfxU32)(lastSlashPos - libModuleName) + slashLen; - if (executableDirLen + defaultPluginNameLen >= MAX_PLUGIN_PATH) - { - TRACE_HIVE_ERROR("MAX_PLUGIN_PATH which is %d, not enough to locate default plugin path\n", MAX_PLUGIN_PATH); - return; - } - - mfx_get_default_plugin_name(lastSlashPos + slashLen, MAX_PLUGIN_PATH - executableDirLen, (eMfxImplType)implType); - - if (-1 != GetFileAttributesW(libModuleName)) - { - // add single default plugin description - PluginDescriptionRecord descriptionRecord; - descriptionRecord.APIVersion = currentAPIVersion; - descriptionRecord.Default = true; - - wcscpy_s(descriptionRecord.sPath - , sizeof(descriptionRecord.sPath) / sizeof(*descriptionRecord.sPath), libModuleName); - - push_back(descriptionRecord); - } - else - { - TRACE_HIVE_INFO("GetFileAttributesW() unable to locate default plugin dll named %S\n", libModuleName); - } -} - - diff --git a/plugins/obs-qsv11/libmfx/src/mfx_win_reg_key.cpp b/plugins/obs-qsv11/libmfx/src/mfx_win_reg_key.cpp deleted file mode 100644 index b9df88955..000000000 --- a/plugins/obs-qsv11/libmfx/src/mfx_win_reg_key.cpp +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) 2012-2019 Intel Corporation -// -// 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(MEDIASDK_UWP_DISPATCHER) -#include "mfx_win_reg_key.h" -#include "mfx_dispatcher_log.h" - -#define TRACE_WINREG_ERROR(str, ...) DISPATCHER_LOG_ERROR((("[WINREG]: " str), __VA_ARGS__)) - -namespace MFX -{ - -WinRegKey::WinRegKey(void) -{ - m_hKey = (HKEY) 0; - -} // WinRegKey::WinRegKey(void) - -WinRegKey::~WinRegKey(void) -{ - Release(); - -} // WinRegKey::~WinRegKey(void) - -void WinRegKey::Release(void) -{ - // close the opened key - if (m_hKey) - { - RegCloseKey(m_hKey); - } - - m_hKey = (HKEY) 0; - -} // void WinRegKey::Release(void) - -bool WinRegKey::Open(HKEY hRootKey, const wchar_t *pSubKey, REGSAM samDesired) -{ - LONG lRes; - HKEY hTemp; - - // - // All operation are performed in this order by intention. - // It makes possible to reopen the keys, using itself as a base. - // - - // try to the open registry key - lRes = RegOpenKeyExW(hRootKey, pSubKey, 0, samDesired, &hTemp); - if (ERROR_SUCCESS != lRes) - { - DISPATCHER_LOG_OPERATION(SetLastError(lRes)); - TRACE_WINREG_ERROR("Opening key \"%s\\%S\" : RegOpenKeyExW()==0x%x\n" - , (HKEY_LOCAL_MACHINE == hRootKey) ? ("HKEY_LOCAL_MACHINE") - : (HKEY_CURRENT_USER == hRootKey) ? ("HKEY_CURRENT_USER") - : "UNSUPPORTED_KEY", pSubKey, GetLastError()); - return false; - } - - // release the object before initialization - Release(); - - // save the handle - m_hKey = hTemp; - - return true; - -} // bool WinRegKey::Open(HKEY hRootKey, const wchar_t *pSubKey, REGSAM samDesired) - -bool WinRegKey::Open(WinRegKey &rootKey, const wchar_t *pSubKey, REGSAM samDesired) -{ - return Open(rootKey.m_hKey, pSubKey, samDesired); - -} // bool WinRegKey::Open(WinRegKey &rootKey, const wchar_t *pSubKey, REGSAM samDesired) - -bool WinRegKey::QueryValueSize(const wchar_t *pValueName, DWORD type, LPDWORD pcbData) { - DWORD keyType = type; - LONG lRes; - - // query the value - lRes = RegQueryValueExW(m_hKey, pValueName, NULL, &keyType, 0, pcbData); - if (ERROR_SUCCESS != lRes) - { - DISPATCHER_LOG_OPERATION(SetLastError(lRes)); - TRACE_WINREG_ERROR("Querying \"%S\" : RegQueryValueExA()==0x%x\n", pValueName, GetLastError()); - return false; - } - - return true; -} - -bool WinRegKey::Query(const wchar_t *pValueName, DWORD type, LPBYTE pData, LPDWORD pcbData) -{ - DWORD keyType = type; - LONG lRes; - DWORD dstSize = (pcbData) ? (*pcbData) : (0); - - // query the value - lRes = RegQueryValueExW(m_hKey, pValueName, NULL, &keyType, pData, pcbData); - if (ERROR_SUCCESS != lRes) - { - DISPATCHER_LOG_OPERATION(SetLastError(lRes)); - TRACE_WINREG_ERROR("Querying \"%S\" : RegQueryValueExA()==0x%x\n", pValueName, GetLastError()); - return false; - } - - // check the type - if (keyType != type) - { - TRACE_WINREG_ERROR("Querying \"%S\" : expectedType=%d, returned=%d\n", pValueName, type, keyType); - return false; - } - - // terminate the string only if pointers not NULL - if ((REG_SZ == type || REG_EXPAND_SZ == type) && NULL != pData && NULL != pcbData) - { - wchar_t *pString = (wchar_t *) pData; - size_t NullEndingSizeBytes = sizeof(wchar_t); // size of string termination null character - if (dstSize < NullEndingSizeBytes) - { - TRACE_WINREG_ERROR("Querying \"%S\" : buffer is too small for null-terminated string", pValueName); - return false; - } - size_t maxStringLengthBytes = dstSize - NullEndingSizeBytes; - size_t maxStringIndex = dstSize / sizeof(wchar_t) - 1; - - size_t lastIndex = (maxStringLengthBytes < *pcbData) ? (maxStringIndex) : (*pcbData) / sizeof(wchar_t); - - pString[lastIndex] = (wchar_t) 0; - } - else if(REG_MULTI_SZ == type && NULL != pData && NULL != pcbData) - { - wchar_t *pString = (wchar_t *) pData; - size_t NullEndingSizeBytes = sizeof(wchar_t)*2; // size of string termination null characters - if (dstSize < NullEndingSizeBytes) - { - TRACE_WINREG_ERROR("Querying \"%S\" : buffer is too small for multi-line null-terminated string", pValueName); - return false; - } - size_t maxStringLengthBytes = dstSize - NullEndingSizeBytes; - size_t maxStringIndex = dstSize / sizeof(wchar_t) - 1; - - size_t lastIndex = (maxStringLengthBytes < *pcbData) ? (maxStringIndex) : (*pcbData) / sizeof(wchar_t) + 1; - - // last 2 bytes should be 0 in case of REG_MULTI_SZ - pString[lastIndex] = pString[lastIndex - 1] = (wchar_t) 0; - } - - return true; - -} // bool WinRegKey::Query(const wchar_t *pValueName, DWORD type, LPBYTE pData, LPDWORD pcbData) - -bool WinRegKey::EnumValue(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName, LPDWORD pType) -{ - LONG lRes; - - // enum the values - lRes = RegEnumValueW(m_hKey, index, pValueName, pcchValueName, 0, pType, NULL, NULL); - if (ERROR_SUCCESS != lRes) - { - DISPATCHER_LOG_OPERATION(SetLastError(lRes)); - return false; - } - - return true; - -} // bool WinRegKey::EnumValue(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName, LPDWORD pType) - -bool WinRegKey::EnumKey(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName) -{ - LONG lRes; - - // enum the keys - lRes = RegEnumKeyExW(m_hKey, index, pValueName, pcchValueName, NULL, NULL, NULL, NULL); - if (ERROR_SUCCESS != lRes) - { - DISPATCHER_LOG_OPERATION(SetLastError(lRes)); - TRACE_WINREG_ERROR("EnumKey with index=%d: RegEnumKeyExW()==0x%x\n", index, GetLastError()); - return false; - } - - return true; - -} // bool WinRegKey::EnumKey(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName) - -bool WinRegKey::QueryInfo(LPDWORD lpcSubkeys) -{ - LONG lRes; - - lRes = RegQueryInfoKeyW(m_hKey, NULL, 0, 0, lpcSubkeys, 0, 0, 0, 0, 0, 0, 0); - if (ERROR_SUCCESS != lRes) { - TRACE_WINREG_ERROR("RegQueryInfoKeyW()==0x%x\n", lRes); - return false; - } - return true; - -} //bool QueryInfo(LPDWORD lpcSubkeys); - -} // namespace MFX - -#endif // #if !defined(MEDIASDK_UWP_DISPATCHER) \ No newline at end of file