mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 09:39:15 +00:00
obs-qsv11: Remove MSDK headers
This commit is contained in:
parent
dbbbcd8c57
commit
61a3e4365b
|
@ -1,3 +0,0 @@
|
|||
Language: Cpp
|
||||
SortIncludes: false
|
||||
DisableFormat: true
|
|
@ -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 <mfxdefs.h>
|
||||
|
||||
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
|
|
@ -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 <mfxvideo.h>
|
||||
#include <mfxaudio.h>
|
||||
#include <mfxplugin.h>
|
||||
#include <stddef.h>
|
||||
#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
|
|
@ -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 <cstring>
|
||||
#include <cstdio>
|
||||
|
||||
#if defined(MFX_DISPATCHER_LOG)
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#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
|
|
@ -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 <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
//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 <memory>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
template <class T>
|
||||
class DSSingleTone
|
||||
{
|
||||
public:
|
||||
template <class TParam1>
|
||||
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<T> instance;
|
||||
if (NULL != obj)
|
||||
{
|
||||
instance.reset(obj);
|
||||
}
|
||||
return instance.get();
|
||||
}
|
||||
};
|
||||
|
||||
class DispatchLog
|
||||
: public DSSingleTone<DispatchLog>
|
||||
{
|
||||
friend class DSSingleTone<DispatchLog>;
|
||||
std::list<IMsgHandler*>m_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<ETWHandlerFactory>
|
||||
{
|
||||
friend class DSSingleTone<ETWHandlerFactory>;
|
||||
typedef std::map<std::wstring, IMsgHandler*> _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<FileSink>
|
||||
, public IMsgHandler
|
||||
{
|
||||
friend class DSSingleTone<FileSink>;
|
||||
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)
|
|
@ -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 <windows.h>
|
||||
#include <cfgmgr32.h>
|
||||
#include <devguid.h>
|
||||
|
||||
#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
|
|
@ -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 <windows.h>
|
||||
|
||||
#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 <mfxdefs.h>
|
||||
|
||||
#ifdef DXVA2DEVICE_LOG
|
||||
#include <stdio.h>
|
||||
#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
|
|
@ -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
|
|
@ -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 <mfxvideo.h>
|
||||
|
||||
#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
|
|
@ -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
|
|
@ -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<FactoryRecord> 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 );
|
||||
};
|
||||
}
|
|
@ -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 <string.h>
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
|
||||
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<PluginDescriptionRecord> 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<mfxU16> (APIVersion & 0x0ff);
|
||||
descriptionRecord.APIVersion.Major = static_cast<mfxU16> (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:
|
||||
};
|
||||
|
||||
}
|
|
@ -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 <exception>
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
template <class T>
|
||||
class iterator_tmpl
|
||||
{
|
||||
template <class U> 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<T> & that )const
|
||||
{
|
||||
return mIndex == that.mIndex;
|
||||
}
|
||||
bool operator !=(const iterator_tmpl<T> & that )const
|
||||
{
|
||||
return mIndex != that.mIndex;
|
||||
}
|
||||
mfxU32 operator - (const iterator_tmpl<T> &that) const
|
||||
{
|
||||
return mIndex - that.mIndex;
|
||||
}
|
||||
iterator_tmpl<T> & operator ++()
|
||||
{
|
||||
mIndex++;
|
||||
return * this;
|
||||
}
|
||||
iterator_tmpl<T> & operator ++(int)
|
||||
{
|
||||
mIndex++;
|
||||
return * this;
|
||||
}
|
||||
T & operator *()
|
||||
{
|
||||
return mRecords[mIndex];
|
||||
}
|
||||
T * operator ->()
|
||||
{
|
||||
return mRecords + mIndex;
|
||||
}
|
||||
};
|
||||
|
||||
class MFXVectorRangeError : public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
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<T> 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; i++)
|
||||
{
|
||||
newRecords[i] = mRecords[i];
|
||||
}
|
||||
newRecords[i] = obj;
|
||||
delete [] mRecords;
|
||||
|
||||
mRecords = newRecords;
|
||||
mNrecords = i + 1;
|
||||
}
|
||||
void erase (iterator at)
|
||||
{
|
||||
if (at.mIndex >= 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 <mNrecords; i++)
|
||||
{
|
||||
newRecords[i] = mRecords[i];
|
||||
}
|
||||
delete [] mRecords;
|
||||
mRecords = newRecords;
|
||||
mNrecords = nSize;
|
||||
}
|
||||
mfxU32 size() const
|
||||
{
|
||||
return mNrecords;
|
||||
}
|
||||
void clear()
|
||||
{
|
||||
delete [] mRecords;
|
||||
mRecords = 0;
|
||||
mNrecords = 0;
|
||||
}
|
||||
bool empty()
|
||||
{
|
||||
return !mRecords;
|
||||
}
|
||||
T * data() const
|
||||
{
|
||||
return mRecords;
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,104 +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_WIN_REG_KEY_H)
|
||||
#define __MFX_WIN_REG_KEY_H
|
||||
|
||||
#include <windows.h>
|
||||
#include "mfxplugin.h"
|
||||
#include "mfx_dispatcher_log.h"
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
namespace MFX {
|
||||
|
||||
template<class T> struct RegKey{};
|
||||
template<> struct RegKey<bool>{enum {type = REG_DWORD};};
|
||||
template<> struct RegKey<mfxU32>{enum {type = REG_DWORD};};
|
||||
template<> struct RegKey<mfxPluginUID>{enum {type = REG_BINARY};};
|
||||
template<> struct RegKey<mfxVersion>{enum {type = REG_DWORD};};
|
||||
template<> struct RegKey<char*>{enum {type = REG_SZ};};
|
||||
template<> struct RegKey<wchar_t*>{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<wchar_t*>::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<class T>
|
||||
inline bool QueryKey(WinRegKey & key, const wchar_t *pValueName, T &data ) {
|
||||
DWORD size = sizeof(data);
|
||||
return key.Query(pValueName, RegKey<T>::type, (LPBYTE) &data, &size);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline bool QueryKey<bool>(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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
|
@ -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__ */
|
|
@ -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
|
||||
|
|
@ -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__
|
|
@ -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
|
||||
|
|
@ -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
|
|
@ -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 T>
|
||||
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<T*>(pthis)->PluginInit(core);
|
||||
}
|
||||
static mfxStatus _PluginClose(mfxHDL pthis) {
|
||||
return reinterpret_cast<T*>(pthis)->PluginClose();
|
||||
}
|
||||
static mfxStatus _GetPluginParam(mfxHDL pthis, mfxPluginParam *par) {
|
||||
return reinterpret_cast<T*>(pthis)->GetPluginParam(par);
|
||||
}
|
||||
static mfxStatus _Execute(mfxHDL pthis, mfxThreadTask task, mfxU32 thread_id, mfxU32 call_count) {
|
||||
return reinterpret_cast<T*>(pthis)->Execute(task, thread_id, call_count);
|
||||
}
|
||||
static mfxStatus _FreeResources(mfxHDL pthis, mfxThreadTask task, mfxStatus sts) {
|
||||
return reinterpret_cast<T*>(pthis)->FreeResources(task, sts);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class MFXCodecPluginAdapterBase : public MFXPluginAdapterBase<T>
|
||||
{
|
||||
protected:
|
||||
//stub to feed mediasdk plugin API
|
||||
mfxVideoCodecPlugin m_codecPlg;
|
||||
public:
|
||||
MFXCodecPluginAdapterBase(T * pCodecPlg)
|
||||
: MFXPluginAdapterBase<T>(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<T> & that)
|
||||
: MFXPluginAdapterBase<T>(reinterpret_cast<T*>(that.m_mfxAPI.pthis), &m_codecPlg)
|
||||
, m_codecPlg() {
|
||||
SetupCallbacks();
|
||||
}
|
||||
MFXCodecPluginAdapterBase<T>& operator = (const MFXCodecPluginAdapterBase<T> & that) {
|
||||
MFXPluginAdapterBase<T> :: SetupCallbacks(reinterpret_cast<T*>(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<T*>(pthis)->Query(in, out);
|
||||
}
|
||||
static mfxStatus _QueryIOSurf(mfxHDL pthis, mfxVideoParam *par, mfxFrameAllocRequest *in, mfxFrameAllocRequest *out){
|
||||
return reinterpret_cast<T*>(pthis)->QueryIOSurf(par, in, out);
|
||||
}
|
||||
static mfxStatus _Init(mfxHDL pthis, mfxVideoParam *par){
|
||||
return reinterpret_cast<T*>(pthis)->Init(par);
|
||||
}
|
||||
static mfxStatus _Reset(mfxHDL pthis, mfxVideoParam *par){
|
||||
return reinterpret_cast<T*>(pthis)->Reset(par);
|
||||
}
|
||||
static mfxStatus _Close(mfxHDL pthis) {
|
||||
return reinterpret_cast<T*>(pthis)->Close();
|
||||
}
|
||||
static mfxStatus _GetVideoParam(mfxHDL pthis, mfxVideoParam *par) {
|
||||
return reinterpret_cast<T*>(pthis)->GetVideoParam(par);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class MFXAudioCodecPluginAdapterBase : public MFXPluginAdapterBase<T>
|
||||
{
|
||||
protected:
|
||||
//stub to feed mediasdk plugin API
|
||||
mfxAudioCodecPlugin m_codecPlg;
|
||||
public:
|
||||
MFXAudioCodecPluginAdapterBase(T * pCodecPlg)
|
||||
: MFXPluginAdapterBase<T>(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<T> & that)
|
||||
: MFXPluginAdapterBase<T>(reinterpret_cast<T*>(that.m_mfxAPI.pthis), &m_codecPlg)
|
||||
, m_codecPlg() {
|
||||
SetupCallbacks();
|
||||
}
|
||||
MFXAudioCodecPluginAdapterBase<T>& operator = (const MFXAudioCodecPluginAdapterBase<T> & that) {
|
||||
MFXPluginAdapterBase<T> :: SetupCallbacks(reinterpret_cast<T*>(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<T*>(pthis)->Query(in, out);
|
||||
}
|
||||
static mfxStatus _QueryIOSize(mfxHDL pthis, mfxAudioParam *par, mfxAudioAllocRequest *request){
|
||||
return reinterpret_cast<T*>(pthis)->QueryIOSize(par, request);
|
||||
}
|
||||
static mfxStatus _Init(mfxHDL pthis, mfxAudioParam *par){
|
||||
return reinterpret_cast<T*>(pthis)->Init(par);
|
||||
}
|
||||
static mfxStatus _Reset(mfxHDL pthis, mfxAudioParam *par){
|
||||
return reinterpret_cast<T*>(pthis)->Reset(par);
|
||||
}
|
||||
static mfxStatus _Close(mfxHDL pthis) {
|
||||
return reinterpret_cast<T*>(pthis)->Close();
|
||||
}
|
||||
static mfxStatus _GetAudioParam(mfxHDL pthis, mfxAudioParam *par) {
|
||||
return reinterpret_cast<T*>(pthis)->GetAudioParam(par);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct MFXPluginAdapterInternal{};
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXGenericPlugin> : public MFXPluginAdapterBase<MFXGenericPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXGenericPlugin *pPlugin)
|
||||
: MFXPluginAdapterBase<MFXGenericPlugin>(pPlugin)
|
||||
{
|
||||
m_mfxAPI.Submit = _Submit;
|
||||
}
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that )
|
||||
: MFXPluginAdapterBase<MFXGenericPlugin>(that) {
|
||||
m_mfxAPI.Submit = that._Submit;
|
||||
}
|
||||
MFXPluginAdapterInternal<MFXGenericPlugin>& operator = (const MFXPluginAdapterInternal<MFXGenericPlugin> & that) {
|
||||
MFXPluginAdapterBase<MFXGenericPlugin>::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<MFXGenericPlugin*>(pthis)->Submit(in, in_num, out, out_num, task);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXDecoderPlugin> : public MFXCodecPluginAdapterBase<MFXDecoderPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXDecoderPlugin *pPlugin)
|
||||
: MFXCodecPluginAdapterBase<MFXDecoderPlugin>(pPlugin)
|
||||
{
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXCodecPluginAdapterBase<MFXDecoderPlugin>(that) {
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXDecoderPlugin>& operator = (const MFXPluginAdapterInternal<MFXDecoderPlugin> & that) {
|
||||
MFXCodecPluginAdapterBase<MFXDecoderPlugin>::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<MFXDecoderPlugin*>(pthis)->DecodeHeader(bs, par);
|
||||
}
|
||||
static mfxStatus _GetPayload(mfxHDL pthis, mfxU64 *ts, mfxPayload *payload) {
|
||||
return reinterpret_cast<MFXDecoderPlugin*>(pthis)->GetPayload(ts, payload);
|
||||
}
|
||||
static mfxStatus _DecodeFrameSubmit(mfxHDL pthis, mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task) {
|
||||
return reinterpret_cast<MFXDecoderPlugin*>(pthis)->DecodeFrameSubmit(bs, surface_work, surface_out, task);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXAudioDecoderPlugin> : public MFXAudioCodecPluginAdapterBase<MFXAudioDecoderPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXAudioDecoderPlugin *pPlugin)
|
||||
: MFXAudioCodecPluginAdapterBase<MFXAudioDecoderPlugin>(pPlugin)
|
||||
{
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXAudioCodecPluginAdapterBase<MFXAudioDecoderPlugin>(that) {
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXAudioDecoderPlugin>& operator = (const MFXPluginAdapterInternal<MFXAudioDecoderPlugin> & that) {
|
||||
MFXAudioCodecPluginAdapterBase<MFXAudioDecoderPlugin>::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<MFXAudioDecoderPlugin*>(pthis)->DecodeHeader(bs, par);
|
||||
}
|
||||
static mfxStatus _DecodeFrameSubmit(mfxHDL pthis, mfxBitstream *in, mfxAudioFrame *out, mfxThreadTask *task) {
|
||||
return reinterpret_cast<MFXAudioDecoderPlugin*>(pthis)->DecodeFrameSubmit(in, out, task);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXEncoderPlugin> : public MFXCodecPluginAdapterBase<MFXEncoderPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXEncoderPlugin *pPlugin)
|
||||
: MFXCodecPluginAdapterBase<MFXEncoderPlugin>(pPlugin)
|
||||
{
|
||||
m_codecPlg.EncodeFrameSubmit = _EncodeFrameSubmit;
|
||||
}
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXCodecPluginAdapterBase<MFXEncoderPlugin>(that) {
|
||||
m_codecPlg.EncodeFrameSubmit = _EncodeFrameSubmit;
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXEncoderPlugin>& operator = (const MFXPluginAdapterInternal<MFXEncoderPlugin> & that) {
|
||||
MFXCodecPluginAdapterBase<MFXEncoderPlugin>::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<MFXEncoderPlugin*>(pthis)->EncodeFrameSubmit(ctrl, surface, bs, task);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXAudioEncoderPlugin> : public MFXAudioCodecPluginAdapterBase<MFXAudioEncoderPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXAudioEncoderPlugin *pPlugin)
|
||||
: MFXAudioCodecPluginAdapterBase<MFXAudioEncoderPlugin>(pPlugin)
|
||||
{
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXAudioCodecPluginAdapterBase<MFXAudioEncoderPlugin>(that) {
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXAudioEncoderPlugin>& operator = (const MFXPluginAdapterInternal<MFXAudioEncoderPlugin> & that) {
|
||||
MFXAudioCodecPluginAdapterBase<MFXAudioEncoderPlugin>::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<MFXAudioEncoderPlugin*>(pthis)->EncodeFrameSubmit(aFrame, out, task);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXEncPlugin> : public MFXCodecPluginAdapterBase<MFXEncPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXEncPlugin *pPlugin)
|
||||
: MFXCodecPluginAdapterBase<MFXEncPlugin>(pPlugin)
|
||||
{
|
||||
m_codecPlg.ENCFrameSubmit = _ENCFrameSubmit;
|
||||
}
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXCodecPluginAdapterBase<MFXEncPlugin>(that) {
|
||||
m_codecPlg.ENCFrameSubmit = _ENCFrameSubmit;
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXEncPlugin>& operator = (const MFXPluginAdapterInternal<MFXEncPlugin> & that) {
|
||||
MFXCodecPluginAdapterBase<MFXEncPlugin>::operator = (that);
|
||||
m_codecPlg.ENCFrameSubmit = _ENCFrameSubmit;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
static mfxStatus _ENCFrameSubmit(mfxHDL pthis,mfxENCInput *in, mfxENCOutput *out, mfxThreadTask *task) {
|
||||
return reinterpret_cast<MFXEncPlugin*>(pthis)->EncFrameSubmit(in, out, task);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXVPPPlugin> : public MFXCodecPluginAdapterBase<MFXVPPPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXVPPPlugin *pPlugin)
|
||||
: MFXCodecPluginAdapterBase<MFXVPPPlugin>(pPlugin)
|
||||
{
|
||||
SetupCallbacks();
|
||||
}
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXCodecPluginAdapterBase<MFXVPPPlugin>(that) {
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXVPPPlugin>& operator = (const MFXPluginAdapterInternal<MFXVPPPlugin> & that) {
|
||||
MFXCodecPluginAdapterBase<MFXVPPPlugin>::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<MFXVPPPlugin*>(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<MFXVPPPlugin*>(pthis)->VPPFrameSubmitEx(surface_in, surface_work, surface_out, task);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* adapter for particular plugin type*/
|
||||
template<class T>
|
||||
class MFXPluginAdapter
|
||||
{
|
||||
public:
|
||||
detail::MFXPluginAdapterInternal<T> m_Adapter;
|
||||
|
||||
operator mfxPlugin () const {
|
||||
return m_Adapter.operator mfxPlugin();
|
||||
}
|
||||
|
||||
MFXPluginAdapter(T* pPlugin = NULL)
|
||||
: m_Adapter(pPlugin)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
inline MFXPluginAdapter<T> make_mfx_plugin_adapter(T* pPlugin) {
|
||||
|
||||
MFXPluginAdapter<T> adapt(pPlugin);
|
||||
return adapt;
|
||||
}
|
||||
|
||||
#endif // __MFXPLUGINPLUSPLUS_H
|
|
@ -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__ */
|
|
@ -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
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -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
|
|
@ -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
|
|
@ -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"
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -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 <windows.h>
|
||||
// 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 <intrin.h>
|
||||
|
||||
#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
|
|
@ -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 <assert.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "mfx_dxva2_device.h"
|
||||
#include "mfxvideo++.h"
|
||||
#include "mfx_vector.h"
|
||||
#include "mfxadapter.h"
|
||||
#include <algorithm>
|
||||
|
||||
#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<const mfxAdapterInfo*>(ll));
|
||||
const mfxAdapterInfo& r = *(reinterpret_cast<const mfxAdapterInfo*>(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<mfxAdapterInfo> & 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<mfxAdapterInfo> & 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<mfxAdapterInfo> 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<mfxU16>(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<mfxAdapterInfo> 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<mfxU16>(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)
|
|
@ -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 <windows.h>
|
||||
#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER)
|
||||
#include <evntprov.h>
|
||||
#include <winmeta.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
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<IMsgHandler*> :: 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<IMsgHandler*>::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 TSink>
|
||||
class SinkRegistrator
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER)
|
||||
template <>
|
||||
class SinkRegistrator<ETWHandlerFactory>
|
||||
{
|
||||
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<FileSink>
|
||||
{
|
||||
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<ETWHandlerFactory> g_registrator1;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DISPATCHER_LOG_REGISTER_FILE_WRITER
|
||||
static SinkRegistrator<FileSink> g_registrator2;
|
||||
#endif
|
||||
|
||||
|
||||
#endif//(MFX_DISPATCHER_LOG)
|
|
@ -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 <tchar.h>
|
||||
|
||||
#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<WCHAR> 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
|
|
@ -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 <d3d9.h>
|
||||
#include <dxgi.h>
|
||||
|
||||
#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
|
||||
|
|
@ -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
|
|
@ -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 <tchar.h>
|
||||
#include <windows.h>
|
||||
|
||||
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<LPCWSTR>(&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
|
|
@ -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 <wchar.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
#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
|
||||
|
|
@ -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<FactoryRecord >::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<FactoryRecord>::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)
|
|
@ -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<mfxU16>(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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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)
|
Loading…
Reference in a new issue