obs-qsv11: Add native obs-studio QSV encoder

This commit is contained in:
Seung-Woo Kim
2015-10-12 01:22:01 -07:00
committed by jp9000
parent d56dc4791d
commit 3e4bcf06bc
56 changed files with 13085 additions and 0 deletions

View File

@@ -0,0 +1,76 @@
/* ****************************************************************************** *\
Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_critical_section.h
\* ****************************************************************************** */
#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

View File

@@ -0,0 +1,213 @@
/* ****************************************************************************** *\
Copyright (C) 2012-2015 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_dispatcher.h
\* ****************************************************************************** */
#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"
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 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 = 2
};
// declare a dispatcher's handle
struct MFX_DISP_HANDLE
{
// Default constructor
MFX_DISP_HANDLE(const mfxVersion requiredVersion);
// Destructor
~MFX_DISP_HANDLE(void);
// Load the library's module
mfxStatus LoadSelectedDLL(const msdk_disp_char *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 implementation (exact implementation)
mfxIMPL impl;
// 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;
// A real handle passed to a called function
mfxSession session;
// 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
msdk_disp_char 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;
// function call table
mfxFunctionPointer callTable[eVideoFuncTotal];
mfxFunctionPointer callAudioTable[eAudioFuncTotal];
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 &);
};
// declare comparison operator
inline
bool operator == (const mfxVersion &one, const mfxVersion &two)
{
return (one.Version == two.Version);
} // bool operator == (const mfxVersion &one, const mfxVersion &two)
inline
bool operator < (const mfxVersion &one, const mfxVersion &two)
{
return (one.Major == two.Major) && (one.Minor < two.Minor);
} // bool operator < (const mfxVersion &one, const mfxVersion &two)
inline
bool operator <= (const mfxVersion &one, const mfxVersion &two)
{
return (one == two) || (one < two);
} // bool operator <= (const mfxVersion &one, const mfxVersion &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

View File

@@ -0,0 +1,85 @@
/* ****************************************************************************** *\
Copyright (C) 2013-2015 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_dispatcher_defs.h
\* ****************************************************************************** */
#pragma once
#include "mfxdefs.h"
#include <cstring>
#if defined(MFX_DISPATCHER_LOG)
#include <string>
#include <string.h>
#endif
#if defined(_WIN32) || defined(_WIN64)
typedef wchar_t msdk_disp_char;
#define MSDK2WIDE(x) x
#if _MSC_VER >= 1400
#define msdk_disp_char_cpy_s(to, to_size, from) wcscpy_s(to,to_size, from)
#else
#define msdk_disp_char_cpy_s(to, to_size, from) wcscpy(to, from)
#endif
#else
typedef char msdk_disp_char;
//#define msdk_disp_char_cpy_s(to, to_size, from) strcpy(to, from)
inline void msdk_disp_char_cpy_s(char * to, size_t to_size, const char * from)
{
size_t source_len = strlen(from);
size_t num_chars = (to_size - 1) < source_len ? (to_size - 1) : source_len;
strncpy(to, from, num_chars);
to[num_chars] = 0;
}
#if defined(MFX_DISPATCHER_LOG)
#define MSDK2WIDE(x) getWideString(x).c_str()
inline std::wstring getWideString(const char * string)
{
size_t len = strlen(string);
return std::wstring(string, string + len);
}
#else
#define MSDK2WIDE(x) x
#endif
#endif
#ifdef __GNUC__
#define sscanf_s sscanf
#define swscanf_s swscanf
#endif
// declare library module's handle
typedef void * mfxModuleHandle;
typedef void (MFX_CDECL * mfxFunctionPointer)(void);

View File

@@ -0,0 +1,306 @@
/* ****************************************************************************** *\
Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_dispatcher_log.h
\* ****************************************************************************** */
#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
#if defined(_WIN32) || defined(_WIN64)
// 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"
#endif // #if defined(_WIN32) || defined(_WIN64)
#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 defined(_WIN32) || defined(_WIN64)
#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
#else
#define DISPATCHER_LOG(lvl, opcode, str)
#define DISPATCHER_LOG_OPERATION(operation)
#endif
#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::auto_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(_WIN32) || defined(_WIN64)
#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
#endif // #if defined(_WIN32) || defined(_WIN64)
#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()
{
if (NULL != m_hdl)
fclose(m_hdl);
}
private:
FILE * m_hdl;
FileSink(const std::string & log_file)
{
#if defined(_WIN32) || defined(_WIN64)
fopen_s(&m_hdl, log_file.c_str(), "a");
#else
m_hdl = fopen(log_file.c_str(), "a");
#endif
}
};
#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)

View File

@@ -0,0 +1,210 @@
/* ****************************************************************************** *\
Copyright (C) 2012-2013 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_dxva2_device.h
\* ****************************************************************************** */
#if !defined(__MFX_DXVA2_DEVICE_H)
#define __MFX_DXVA2_DEVICE_H
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#endif // #if defined(_WIN32) || defined(_WIN64)
#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);
#if defined(_WIN32) || defined(_WIN64)
// Handle to the DLL library
HMODULE m_hModule;
#endif // #if defined(_WIN32) || defined(_WIN64)
// 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 &);
};
#if defined(_WIN32) || defined(_WIN64)
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;
};
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;
};
#endif // #if defined(_WIN32) || defined(_WIN64)
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:
// Get vendor & device IDs by alternative way (D3D9 in Remote Desktop sessions)
void UseAlternativeWay(const D3D9Device *pD3D9Device);
// 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

View File

@@ -0,0 +1,142 @@
/* ****************************************************************************** *\
Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_exposed_functions_list.h
\* ****************************************************************************** */
//
// 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

View File

@@ -0,0 +1,161 @@
/* ****************************************************************************** *\
Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_library_iterator.h
\* ****************************************************************************** */
#if !defined(__MFX_LIBRARY_ITERATOR_H)
#define __MFX_LIBRARY_ITERATOR_H
#include <mfxvideo.h>
#include "mfx_win_reg_key.h"
#include "mfx_dispatcher.h"
#if !defined(_WIN32) && !defined(_WIN64)
struct mfx_disp_adapters
{
mfxU32 vendor_id;
mfxU32 device_id;
};
#ifndef __APPLE__
#define MFX_SO_BASE_NAME_LEN 15 // sizeof("libmfxhw32-p.so") = 15
#else
#define MFX_SO_BASE_NAME_LEN 16 // sizeof("libmfxhw64.dylib") = 16
#endif
#define MFX_MIN_REAL_LIBNAME MFX_SO_BASE_NAME_LEN + 4 // sizeof("libmfxhw32-p.so.0.0") >= 19
#define MFX_MAX_REAL_LIBNAME MFX_MIN_REAL_LIBNAME + 8 // sizeof("libmfxhw32-p.so.<mj>.<mn>") <= 27, max(sizeof(<mj>))=sizeof(0xFFFF) = sizeof(65535) = 5
struct mfx_libs
{
char name[MFX_MAX_REAL_LIBNAME+1];
mfxVersion version;
};
#endif
namespace MFX
{
// declare desired storage ID
#if defined(_WIN32) || defined(_WIN64)
enum
{
MFX_UNKNOWN_KEY = -1,
MFX_CURRENT_USER_KEY = 0,
MFX_LOCAL_MACHINE_KEY = 1,
MFX_APP_FOLDER = 2,
MFX_STORAGE_ID_FIRST = MFX_CURRENT_USER_KEY,
MFX_STORAGE_ID_LAST = MFX_LOCAL_MACHINE_KEY
};
#else
enum
{
MFX_UNKNOWN_KEY = -1,
MFX_STORAGE_ID_OPT = 0, // storage is: /opt/intel
MFX_APP_FOLDER = 1,
MFX_STORAGE_ID_FIRST = MFX_STORAGE_ID_OPT,
MFX_STORAGE_ID_LAST = MFX_STORAGE_ID_OPT
};
#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);
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(msdk_disp_char *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(msdk_disp_char *subKeyName, size_t length) const;
int GetStorageID() const { return m_StorageID; }
protected:
// Release the iterator
void Release(void);
// Initialize the registry iterator
mfxStatus InitRegistry(eMfxImplType implType, mfxIMPL implInterface, const mfxU32 adapterNum, int storageID);
// Initialize the app folder iterator
mfxStatus InitFolder(eMfxImplType implType, mfxIMPL implInterface, const mfxU32 adapterNum, const msdk_disp_char * path);
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(_WIN32) || defined(_WIN64)
WinRegKey m_baseRegKey; // (WinRegKey) main registry key
mfxU32 m_lastLibIndex; // (mfxU32) index of previously returned library
mfxU32 m_lastLibMerit; // (mfxU32) merit of previously returned library
#else
int m_lastLibIndex; // (mfxU32) index of previously returned library
mfxU32 m_adapters_num;
struct mfx_disp_adapters* m_adapters;
int m_selected_adapter;
mfxU32 m_libs_num;
struct mfx_libs* m_libs;
#endif // #if defined(_WIN32) || defined(_WIN64)
msdk_disp_char m_path[260];
private:
// unimplemented by intent to make this class non-copyable
MFXLibraryIterator(const MFXLibraryIterator &);
void operator=(const MFXLibraryIterator &);
};
} // namespace MFX
#endif // __MFX_LIBRARY_ITERATOR_H

View File

@@ -0,0 +1,59 @@
/* ****************************************************************************** *\
Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_load_dll.h
\* ****************************************************************************** */
#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(msdk_disp_char *pPath, size_t pathSize);
mfxStatus mfx_get_default_dll_name(msdk_disp_char *pPath, size_t pathSize, eMfxImplType implType);
mfxStatus mfx_get_default_plugin_name(msdk_disp_char *pPath, size_t pathSize, eMfxImplType implType);
mfxStatus mfx_get_default_audio_dll_name(msdk_disp_char *pPath, size_t pathSize, eMfxImplType implType);
mfxModuleHandle mfx_dll_load(const msdk_disp_char *file_name);
//increments reference counter
mfxModuleHandle mfx_get_dll_handle(const msdk_disp_char *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

View File

@@ -0,0 +1,93 @@
/* ****************************************************************************** *\
Copyright (C) 2013-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_load_plugin.h
\* ****************************************************************************** */
#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;
msdk_disp_char mPath[MAX_PLUGIN_PATH];
public:
PluginModule();
PluginModule(const msdk_disp_char * 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 () {}
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 );
};
}

View File

@@ -0,0 +1,132 @@
/* ****************************************************************************** *\
Copyright (C) 2013-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_plugin_hive.h
\* ****************************************************************************** */
#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 {
enum
{
MAX_PLUGIN_PATH = 4096
};
enum
{
MAX_PLUGIN_NAME = 4096
};
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:
msdk_disp_char 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);
}
};
//populated from registry
class MFXPluginsInHive : public MFXPluginStorageBase
{
public:
MFXPluginsInHive(int mfxStorageID, const msdk_disp_char *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( msdk_disp_char *key, msdk_disp_char * value, PluginDescriptionRecord & des);
};
//plugins are loaded from FS close to Runtime library
class MFXDefaultPlugins : public MFXPluginStorageBase
{
public:
MFXDefaultPlugins(mfxVersion currentAPIVersion, MFX_DISP_HANDLE * hdl, int implType);
private:
};
}

View File

@@ -0,0 +1,220 @@
/* ****************************************************************************** *\
Copyright (C) 2013-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_vector.h
\* ****************************************************************************** */
#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;
}
};
}

View File

@@ -0,0 +1,116 @@
/* ****************************************************************************** *\
Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfx_win_reg_key.h
\* ****************************************************************************** */
#if !defined(__MFX_WIN_REG_KEY_H)
#define __MFX_WIN_REG_KEY_H
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#include "mfxplugin.h"
#include "mfx_dispatcher_log.h"
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(_WIN32) || defined(_WIN64)
#endif // __MFX_WIN_REG_KEY_H

View File

@@ -0,0 +1,81 @@
/* ****************************************************************************** *\
Copyright (C) 2013-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxaudio_exposed_function_list.h
\* ****************************************************************************** */
//
// 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

View File

@@ -0,0 +1,172 @@
/*******************************************************************************
Copyright (C) 2013 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxastructures.h
*******************************************************************************/
#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
};
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;
typedef struct {
mfxU16 AsyncDepth;
mfxU16 Protected;
mfxU16 reserved[14];
mfxAudioInfoMFX mfx;
mfxExtBuffer** ExtParam;
mfxU16 NumExtParam;
} mfxAudioParam;
typedef struct {
mfxU32 SuggestedInputSize;
mfxU32 SuggestedOutputSize;
mfxU32 reserved[6];
} mfxAudioAllocRequest;
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;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View File

@@ -0,0 +1,113 @@
/*******************************************************************************
Copyright (C) 2013 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxaudio++.h
*******************************************************************************/
#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

View File

@@ -0,0 +1,70 @@
/*******************************************************************************
Copyright (C) 2013 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxaudio.h
*******************************************************************************/
#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 */
mfxStatus MFX_CDECL MFXAudioCORE_SyncOperation(mfxSession session, mfxSyncPoint syncp, mfxU32 wait);
/* AudioENCODE */
mfxStatus MFX_CDECL MFXAudioENCODE_Query(mfxSession session, mfxAudioParam *in, mfxAudioParam *out);
mfxStatus MFX_CDECL MFXAudioENCODE_QueryIOSize(mfxSession session, mfxAudioParam *par, mfxAudioAllocRequest *request);
mfxStatus MFX_CDECL MFXAudioENCODE_Init(mfxSession session, mfxAudioParam *par);
mfxStatus MFX_CDECL MFXAudioENCODE_Reset(mfxSession session, mfxAudioParam *par);
mfxStatus MFX_CDECL MFXAudioENCODE_Close(mfxSession session);
mfxStatus MFX_CDECL MFXAudioENCODE_GetAudioParam(mfxSession session, mfxAudioParam *par);
mfxStatus MFX_CDECL MFXAudioENCODE_EncodeFrameAsync(mfxSession session, mfxAudioFrame *frame, mfxBitstream *bs, mfxSyncPoint *syncp);
/* AudioDECODE */
mfxStatus MFX_CDECL MFXAudioDECODE_Query(mfxSession session, mfxAudioParam *in, mfxAudioParam *out);
mfxStatus MFX_CDECL MFXAudioDECODE_DecodeHeader(mfxSession session, mfxBitstream *bs, mfxAudioParam* par);
mfxStatus MFX_CDECL MFXAudioDECODE_Init(mfxSession session, mfxAudioParam *par);
mfxStatus MFX_CDECL MFXAudioDECODE_Reset(mfxSession session, mfxAudioParam *par);
mfxStatus MFX_CDECL MFXAudioDECODE_Close(mfxSession session);
mfxStatus MFX_CDECL MFXAudioDECODE_QueryIOSize(mfxSession session, mfxAudioParam *par, mfxAudioAllocRequest *request);
mfxStatus MFX_CDECL MFXAudioDECODE_GetAudioParam(mfxSession session, mfxAudioParam *par);
mfxStatus MFX_CDECL MFXAudioDECODE_DecodeFrameAsync(mfxSession session, mfxBitstream *bs, mfxAudioFrame *frame, mfxSyncPoint *syncp);
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@@ -0,0 +1,159 @@
/*******************************************************************************
Copyright (C) 2013-2015 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxcommon.h
*******************************************************************************/
#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 */
typedef struct {
mfxU32 BufferId;
mfxU32 BufferSz;
} mfxExtBuffer;
/* 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,
MFX_IMPL_VIA_ANY = 0x0100,
MFX_IMPL_VIA_D3D9 = 0x0200,
MFX_IMPL_VIA_D3D11 = 0x0300,
MFX_IMPL_VIA_VAAPI = 0x0400,
MFX_IMPL_AUDIO = 0x8000,
MFX_IMPL_UNSUPPORTED = 0x0000 /* One of the MFXQueryIMPL returns */
};
/* Version Info */
typedef union {
struct {
mfxU16 Minor;
mfxU16 Major;
};
mfxU32 Version;
} mfxVersion;
/* session priority */
typedef enum
{
MFX_PRIORITY_LOW = 0,
MFX_PRIORITY_NORMAL = 1,
MFX_PRIORITY_HIGH = 2
} mfxPriority;
typedef struct _mfxEncryptedData mfxEncryptedData;
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;
typedef struct _mfxSyncPoint *mfxSyncPoint;
/* GPUCopy */
enum {
MFX_GPUCOPY_DEFAULT = 0,
MFX_GPUCOPY_ON = 1,
MFX_GPUCOPY_OFF = 2
};
typedef struct {
mfxIMPL Implementation;
mfxVersion Version;
mfxU16 ExternalThreads;
union {
struct {
mfxExtBuffer **ExtParam;
mfxU16 NumExtParam;
};
mfxU16 reserved2[5];
};
mfxU16 GPUCopy;
mfxU16 reserved[21];
} mfxInitParam;
enum {
MFX_EXTBUFF_THREADS_PARAM = MFX_MAKEFOURCC('T','H','D','P')
};
typedef struct {
mfxExtBuffer Header;
mfxU16 NumThread;
mfxI32 SchedulingType;
mfxI32 Priority;
mfxU16 reserved[55];
} mfxExtThreadsParam;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View File

@@ -0,0 +1,153 @@
/* ****************************************************************************** *\
Copyright (C) 2007-2015 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxdefs.h
\* ****************************************************************************** */
#ifndef __MFXDEFS_H__
#define __MFXDEFS_H__
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#if (defined( _WIN32 ) || defined ( _WIN64 )) && !defined (__GNUC__)
#define __INT64 __int64
#define __UINT64 unsigned __int64
#else
#define __INT64 long long
#define __UINT64 unsigned long long
#endif
#ifdef _WIN32
#define MFX_CDECL __cdecl
#define MFX_STDCALL __stdcall
#else
#define MFX_CDECL
#define MFX_STDCALL
#endif /* _WIN32 */
#define MFX_INFINITE 0xFFFFFFFF
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 */
/* 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 */
/* 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 */
} mfxStatus;
// Application
#if defined(MFX_DISPATCHER_EXPOSED_PREFIX)
#include "mfxdispatcherprefixedfunctions.h"
#endif // MFX_DISPATCHER_EXPOSED_PREFIX
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __MFXDEFS_H__ */

View File

@@ -0,0 +1,80 @@
/******************************************************************************* *\
Copyright (C) 2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxenc.h
*******************************************************************************/
#ifndef __MFXENC_H__
#define __MFXENC_H__
#include "mfxdefs.h"
#include "mfxvstructures.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
typedef struct _mfxENCInput mfxENCInput;
struct _mfxENCInput{
mfxU32 reserved[32];
mfxFrameSurface1 *InSurface;
mfxU16 NumFrameL0;
mfxFrameSurface1 **L0Surface;
mfxU16 NumFrameL1;
mfxFrameSurface1 **L1Surface;
mfxU16 NumExtParam;
mfxExtBuffer **ExtParam;
} ;
typedef struct _mfxENCOutput mfxENCOutput;
struct _mfxENCOutput{
mfxU32 reserved[32];
mfxFrameSurface1 *OutSurface;
mfxU16 NumExtParam;
mfxExtBuffer **ExtParam;
} ;
mfxStatus MFX_CDECL MFXVideoENC_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out);
mfxStatus MFX_CDECL MFXVideoENC_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request);
mfxStatus MFX_CDECL MFXVideoENC_Init(mfxSession session, mfxVideoParam *par);
mfxStatus MFX_CDECL MFXVideoENC_Reset(mfxSession session, mfxVideoParam *par);
mfxStatus MFX_CDECL MFXVideoENC_Close(mfxSession session);
mfxStatus MFX_CDECL MFXVideoENC_ProcessFrameAsync(mfxSession session, mfxENCInput *in, mfxENCOutput *out, mfxSyncPoint *syncp);
#ifdef __cplusplus
} // extern "C"
#endif /* __cplusplus */
#endif

View File

@@ -0,0 +1,107 @@
/******************************************************************************* *\
Copyright (C) 2010-2013 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxjpeg.h
*******************************************************************************/
#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
};
typedef struct {
mfxExtBuffer Header;
mfxU16 reserved[7];
mfxU16 NumTable;
mfxU16 Qm[4][64];
} mfxExtJPEGQuantTables;
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;
#ifdef __cplusplus
} // extern "C"
#endif /* __cplusplus */
#endif // __MFX_JPEG_H__

View File

@@ -0,0 +1,109 @@
/******************************************************************************* *\
Copyright (C) 2010-2013 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxmvc.h
*******************************************************************************/
#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')
};
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;
typedef struct {
mfxU16 TemporalId;
mfxU16 LevelIdc;
mfxU16 NumViews;
mfxU16 NumTargetViews;
mfxU16 *TargetViewId;
} mfxMVCOperationPoint;
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;
typedef struct {
mfxExtBuffer Header;
mfxU16 TemporalId;
mfxU32 NumView;
mfxU16 ViewId[1024];
} mfxExtMVCTargetViews ;
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@@ -0,0 +1,78 @@
/******************************************************************************* *\
Copyright (C) 2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxpak.h
*******************************************************************************/
#ifndef __MFXPAK_H__
#define __MFXPAK_H__
#include "mfxdefs.h"
#include "mfxvstructures.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
typedef struct {
mfxU32 reserved[32];
mfxFrameSurface1 *InSurface;
mfxU16 NumFrameL0;
mfxFrameSurface1 **L0Surface;
mfxU16 NumFrameL1;
mfxFrameSurface1 **L1Surface;
mfxU16 NumExtParam;
mfxExtBuffer **ExtParam;
} mfxPAKInput;
typedef struct {
mfxBitstream *Bs;
mfxFrameSurface1 *OutSurface;
mfxU16 NumExtParam;
mfxExtBuffer **ExtParam;
} mfxPAKOutput;
typedef struct _mfxSession *mfxSession;
mfxStatus MFX_CDECL MFXVideoPAK_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out);
mfxStatus MFX_CDECL MFXVideoPAK_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request);
mfxStatus MFX_CDECL MFXVideoPAK_Init(mfxSession session, mfxVideoParam *par);
mfxStatus MFX_CDECL MFXVideoPAK_Reset(mfxSession session, mfxVideoParam *par);
mfxStatus MFX_CDECL MFXVideoPAK_Close(mfxSession session);
mfxStatus MFX_CDECL MFXVideoPAK_ProcessFrameAsync(mfxSession session, mfxPAKInput *in, mfxPAKOutput *out, mfxSyncPoint *syncp);
#ifdef __cplusplus
} // extern "C"
#endif /* __cplusplus */
#endif

View File

@@ -0,0 +1,719 @@
/* ****************************************************************************** *\
Copyright (C) 2007-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxplugin++.h
\* ****************************************************************************** */
#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;
}
} ;
/* 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)
{
SetupCallbacks(plugin, pCodec);
}
MFXPluginAdapterBase( T *plugin, mfxAudioCodecPlugin *pCodec)
{
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.GetPayload = _GetPayload;
m_codecPlg.DecodeFrameSubmit = _DecodeFrameSubmit;
}
static mfxStatus _DecodeHeader(mfxHDL pthis, mfxBitstream *bs, mfxAudioParam *par) {
return reinterpret_cast<MFXAudioDecoderPlugin*>(pthis)->DecodeHeader(bs, par);
}
// static mfxStatus _GetPayload(mfxHDL pthis, mfxU64 *ts, mfxPayload *payload) {
// return reinterpret_cast<MFXAudioDecoderPlugin*>(pthis)->GetPayload(ts, payload);
// }
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

View File

@@ -0,0 +1,206 @@
/******************************************************************************* *\
Copyright (C) 2007-2015 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxplugin.h
*******************************************************************************/
#ifndef __MFXPLUGIN_H__
#define __MFXPLUGIN_H__
#include "mfxvideo.h"
#include "mfxaudio.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
typedef struct {
mfxU8 Data[16];
} mfxPluginUID;
static const mfxPluginUID MFX_PLUGINID_HEVCD_SW = {{0x15, 0xdd, 0x93, 0x68, 0x25, 0xad, 0x47, 0x5e, 0xa3, 0x4e, 0x35, 0xf3, 0xf5, 0x42, 0x17, 0xa6}};
static const mfxPluginUID MFX_PLUGINID_HEVCD_HW = {{0x33, 0xa6, 0x1c, 0x0b, 0x4c, 0x27, 0x45, 0x4c, 0xa8, 0xd8, 0x5d, 0xde, 0x75, 0x7c, 0x6f, 0x8e}};
static const mfxPluginUID MFX_PLUGINID_HEVCE_SW = {{0x2f, 0xca, 0x99, 0x74, 0x9f, 0xdb, 0x49, 0xae, 0xb1, 0x21, 0xa5, 0xb6, 0x3e, 0xf5, 0x68, 0xf7}};
static const mfxPluginUID MFX_PLUGINID_HEVCE_GACC = {{0xe5, 0x40, 0x0a, 0x06, 0xc7, 0x4d, 0x41, 0xf5, 0xb1, 0x2d, 0x43, 0x0b, 0xba, 0xa2, 0x3d, 0x0b}};
static const mfxPluginUID MFX_PLUGINID_HEVCE_HW = {{0x6f, 0xad, 0xc7, 0x91, 0xa0, 0xc2, 0xeb, 0x47, 0x9a, 0xb6, 0xdc, 0xd5, 0xea, 0x9d, 0xa3, 0x47}};
static const mfxPluginUID MFX_PLUGINID_VP8D_HW = {{0xf6, 0x22, 0x39, 0x4d, 0x8d, 0x87, 0x45, 0x2f, 0x87, 0x8c, 0x51, 0xf2, 0xfc, 0x9b, 0x41, 0x31}};
static const mfxPluginUID MFX_PLUGINID_VP8E_HW = {{0xbf, 0xfc, 0x51, 0x8c, 0xde, 0x13, 0x4d, 0xf9, 0x8a, 0x96, 0xf4, 0xcf, 0x81, 0x6c, 0x0f, 0xac}};
static const mfxPluginUID MFX_PLUGINID_VP9E_HW = {{0xce, 0x44, 0xef, 0x6f, 0x1a, 0x6d, 0x22, 0x46, 0xb4, 0x12, 0xbb, 0x38, 0xd6, 0xe4, 0x51, 0x82}};
static const mfxPluginUID MFX_PLUGINID_VP9D_HW = {{0xa9, 0x22, 0x39, 0x4d, 0x8d, 0x87, 0x45, 0x2f, 0x87, 0x8c, 0x51, 0xf2, 0xfc, 0x9b, 0x41, 0x31}};
static const mfxPluginUID MFX_PLUGINID_CAMERA_HW = {{0x54, 0x54, 0x26, 0x16, 0x24, 0x33, 0x41, 0xe6, 0x93, 0xae, 0x89, 0x99, 0x42, 0xce, 0x73, 0x55}};
static const mfxPluginUID MFX_PLUGINID_CAPTURE_HW = {{0x22, 0xd6, 0x2c, 0x07, 0xe6, 0x72, 0x40, 0x8f, 0xbb, 0x4c, 0xc2, 0x0e, 0xd7, 0xa0, 0x53, 0xe4}};
static const mfxPluginUID MFX_PLUGINID_ITELECINE_HW = {{0xe7, 0x44, 0x75, 0x3a, 0xcd, 0x74, 0x40, 0x2e, 0x89, 0xa2, 0xee, 0x06, 0x35, 0x49, 0x61, 0x79}};
static const mfxPluginUID MFX_PLUGINID_H264LA_HW = {{0x58, 0x8f, 0x11, 0x85, 0xd4, 0x7b, 0x42, 0x96, 0x8d, 0xea, 0x37, 0x7b, 0xb5, 0xd0, 0xdc, 0xb4}};
static const mfxPluginUID MFX_PLUGINID_AACD = {{0xe9, 0x34, 0x67, 0x25, 0xac, 0x2f, 0x4c, 0x93, 0xaa, 0x58, 0x5c, 0x11, 0xc7, 0x08, 0x7c, 0xf4}};
static const mfxPluginUID MFX_PLUGINID_AACE = {{0xb2, 0xa2, 0xa0, 0x5a, 0x4e, 0xac, 0x46, 0xbf, 0xa9, 0xde, 0x7e, 0x80, 0xc9, 0x8d, 0x2e, 0x18}};
static const mfxPluginUID MFX_PLUGINID_HEVCE_FEI_HW = {{0x87, 0xe0, 0xe8, 0x02, 0x07, 0x37, 0x52, 0x40, 0x85, 0x25, 0x15, 0xcf, 0x4a, 0x5e, 0xdd, 0xe6}};
typedef enum {
MFX_PLUGINTYPE_VIDEO_GENERAL = 0,
MFX_PLUGINTYPE_VIDEO_DECODE = 1,
MFX_PLUGINTYPE_VIDEO_ENCODE = 2,
MFX_PLUGINTYPE_VIDEO_VPP = 3,
MFX_PLUGINTYPE_VIDEO_ENC = 4,
MFX_PLUGINTYPE_AUDIO_DECODE = 5,
MFX_PLUGINTYPE_AUDIO_ENCODE = 6
} mfxPluginType;
typedef enum {
MFX_THREADPOLICY_SERIAL = 0,
MFX_THREADPOLICY_PARALLEL = 1
} mfxThreadPolicy;
typedef struct mfxPluginParam {
mfxU32 reserved[6];
mfxU16 reserved1;
mfxU16 PluginVersion;
mfxVersion APIVersion;
mfxPluginUID PluginUID;
mfxU32 Type;
mfxU32 CodecId;
mfxThreadPolicy ThreadPolicy;
mfxU32 MaxThreadNum;
} mfxPluginParam;
typedef struct mfxCoreParam{
mfxU32 reserved[13];
mfxIMPL Impl;
mfxVersion Version;
mfxU32 NumWorkingThread;
} mfxCoreParam;
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);
mfxHDL reserved4[3];
} mfxCoreInterface;
/* video codec plugin extension*/
typedef struct _mfxENCInput mfxENCInput;
typedef struct _mfxENCOutput mfxENCOutput;
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;
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;
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;
mfxStatus MFX_CDECL MFXVideoUSER_Register(mfxSession session, mfxU32 type, const mfxPlugin *par);
mfxStatus MFX_CDECL MFXVideoUSER_Unregister(mfxSession session, mfxU32 type);
mfxStatus MFX_CDECL MFXVideoUSER_ProcessFrameAsync(mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp);
mfxStatus MFX_CDECL MFXVideoUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version);
mfxStatus MFX_CDECL MFXVideoUSER_LoadByPath(mfxSession session, const mfxPluginUID *uid, mfxU32 version, const mfxChar *path, mfxU32 len);
mfxStatus MFX_CDECL MFXVideoUSER_UnLoad(mfxSession session, const mfxPluginUID *uid);
mfxStatus MFX_CDECL MFXAudioUSER_Register(mfxSession session, mfxU32 type, const mfxPlugin *par);
mfxStatus MFX_CDECL MFXAudioUSER_Unregister(mfxSession session, mfxU32 type);
mfxStatus MFX_CDECL MFXAudioUSER_ProcessFrameAsync(mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp);
mfxStatus MFX_CDECL MFXAudioUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version);
mfxStatus MFX_CDECL MFXAudioUSER_UnLoad(mfxSession session, const mfxPluginUID *uid);
#ifdef __cplusplus
} // extern "C"
#endif /* __cplusplus */
#endif /* __MFXPLUGIN_H__ */

View File

@@ -0,0 +1,60 @@
/*******************************************************************************
Copyright (C) 2013 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxsession.h
*******************************************************************************/
#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);
mfxStatus MFX_CDECL MFXDoWork(mfxSession session);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,197 @@
/* ****************************************************************************** *\
Copyright (C) 2007-2014 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxvideo++.h
\* ****************************************************************************** */
#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);}
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 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 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 MFXVideoENCODE_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

View File

@@ -0,0 +1,112 @@
/* ****************************************************************************** *\
Copyright (C) 2007-2015 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxvideo.h
\* ****************************************************************************** */
#ifndef __MFXVIDEO_H__
#define __MFXVIDEO_H__
#include "mfxsession.h"
#include "mfxvstructures.h"
#define MFX_VERSION_MAJOR 1
#define MFX_VERSION_MINOR 17
#ifdef __cplusplus
extern "C"
{
#endif
/* MFXVideoCORE */
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;
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;
/* VideoCORE */
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_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);
mfxStatus MFX_CDECL MFXVideoVPP_RunFrameVPPAsyncEx(mfxSession session, mfxFrameSurface1 *in, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxSyncPoint *syncp);
#ifdef __cplusplus
} // extern "C"
#endif
#endif

View File

@@ -0,0 +1,32 @@
/*******************************************************************************
Copyright (C) 2013 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL INTEL CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File Name: mfxvstructures.h
*******************************************************************************/
#include "mfxstructures.h"