mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
init
This commit is contained in:
40
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxadapter.h
vendored
Normal file
40
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxadapter.h
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2019-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "mfxdefs.h"
|
||||
#if (MFX_VERSION >= 1031)
|
||||
#ifndef __MFXADAPTER_H__
|
||||
#define __MFXADAPTER_H__
|
||||
|
||||
#include "mfxstructures.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
mfxStatus MFX_CDECL MFXQueryAdapters(mfxComponentInfo* input_info, mfxAdaptersInfo* adapters);
|
||||
mfxStatus MFX_CDECL MFXQueryAdaptersDecode(mfxBitstream* bitstream, mfxU32 codec_id, mfxAdaptersInfo* adapters);
|
||||
mfxStatus MFX_CDECL MFXQueryAdaptersNumber(mfxU32* num_adapters);
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // __MFXADAPTER_H__
|
||||
#endif
|
||||
170
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxastructures.h
vendored
Normal file
170
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxastructures.h
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
// Copyright (c) 2017-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXASTRUCTURES_H__
|
||||
#define __MFXASTRUCTURES_H__
|
||||
#include "mfxcommon.h"
|
||||
|
||||
#if !defined (__GNUC__)
|
||||
#pragma warning(disable: 4201)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* CodecId */
|
||||
enum {
|
||||
MFX_CODEC_AAC =MFX_MAKEFOURCC('A','A','C',' '),
|
||||
MFX_CODEC_MP3 =MFX_MAKEFOURCC('M','P','3',' ')
|
||||
};
|
||||
|
||||
enum {
|
||||
/* AAC Profiles & Levels */
|
||||
MFX_PROFILE_AAC_LC =2,
|
||||
MFX_PROFILE_AAC_LTP =4,
|
||||
MFX_PROFILE_AAC_MAIN =1,
|
||||
MFX_PROFILE_AAC_SSR =3,
|
||||
MFX_PROFILE_AAC_HE =5,
|
||||
MFX_PROFILE_AAC_ALS =0x20,
|
||||
MFX_PROFILE_AAC_BSAC =22,
|
||||
MFX_PROFILE_AAC_PS =29,
|
||||
|
||||
/*MPEG AUDIO*/
|
||||
MFX_AUDIO_MPEG1_LAYER1 =0x00000110,
|
||||
MFX_AUDIO_MPEG1_LAYER2 =0x00000120,
|
||||
MFX_AUDIO_MPEG1_LAYER3 =0x00000140,
|
||||
MFX_AUDIO_MPEG2_LAYER1 =0x00000210,
|
||||
MFX_AUDIO_MPEG2_LAYER2 =0x00000220,
|
||||
MFX_AUDIO_MPEG2_LAYER3 =0x00000240
|
||||
};
|
||||
|
||||
/*AAC HE decoder down sampling*/
|
||||
enum {
|
||||
MFX_AUDIO_AAC_HE_DWNSMPL_OFF=0,
|
||||
MFX_AUDIO_AAC_HE_DWNSMPL_ON= 1
|
||||
};
|
||||
|
||||
/* AAC decoder support of PS */
|
||||
enum {
|
||||
MFX_AUDIO_AAC_PS_DISABLE= 0,
|
||||
MFX_AUDIO_AAC_PS_PARSER= 1,
|
||||
MFX_AUDIO_AAC_PS_ENABLE_BL= 111,
|
||||
MFX_AUDIO_AAC_PS_ENABLE_UR= 411
|
||||
};
|
||||
|
||||
/*AAC decoder SBR support*/
|
||||
enum {
|
||||
MFX_AUDIO_AAC_SBR_DISABLE = 0,
|
||||
MFX_AUDIO_AAC_SBR_ENABLE= 1,
|
||||
MFX_AUDIO_AAC_SBR_UNDEF= 2
|
||||
};
|
||||
|
||||
/*AAC header type*/
|
||||
enum{
|
||||
MFX_AUDIO_AAC_ADTS= 1,
|
||||
MFX_AUDIO_AAC_ADIF= 2,
|
||||
MFX_AUDIO_AAC_RAW= 3,
|
||||
};
|
||||
|
||||
/*AAC encoder stereo mode*/
|
||||
enum
|
||||
{
|
||||
MFX_AUDIO_AAC_MONO= 0,
|
||||
MFX_AUDIO_AAC_LR_STEREO= 1,
|
||||
MFX_AUDIO_AAC_MS_STEREO= 2,
|
||||
MFX_AUDIO_AAC_JOINT_STEREO= 3
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxU32 CodecId;
|
||||
mfxU16 CodecProfile;
|
||||
mfxU16 CodecLevel;
|
||||
|
||||
mfxU32 Bitrate;
|
||||
mfxU32 SampleFrequency;
|
||||
mfxU16 NumChannel;
|
||||
mfxU16 BitPerSample;
|
||||
|
||||
mfxU16 reserved1[22];
|
||||
|
||||
union {
|
||||
struct { /* AAC Decoding Options */
|
||||
mfxU16 FlagPSSupportLev;
|
||||
mfxU16 Layer;
|
||||
mfxU16 AACHeaderDataSize;
|
||||
mfxU8 AACHeaderData[64];
|
||||
};
|
||||
struct { /* AAC Encoding Options */
|
||||
mfxU16 OutputFormat;
|
||||
mfxU16 StereoMode;
|
||||
mfxU16 reserved2[61];
|
||||
};
|
||||
};
|
||||
} mfxAudioInfoMFX;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
typedef struct {
|
||||
mfxU16 AsyncDepth;
|
||||
mfxU16 Protected;
|
||||
mfxU16 reserved[14];
|
||||
|
||||
mfxAudioInfoMFX mfx;
|
||||
mfxExtBuffer** ExtParam;
|
||||
mfxU16 NumExtParam;
|
||||
} mfxAudioParam;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxU32 SuggestedInputSize;
|
||||
mfxU32 SuggestedOutputSize;
|
||||
mfxU32 reserved[6];
|
||||
} mfxAudioAllocRequest;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
|
||||
typedef struct {
|
||||
mfxU64 TimeStamp; /* 1/90KHz */
|
||||
mfxU16 Locked;
|
||||
mfxU16 NumChannels;
|
||||
mfxU32 SampleFrequency;
|
||||
mfxU16 BitPerSample;
|
||||
mfxU16 reserved1[7];
|
||||
|
||||
mfxU8* Data;
|
||||
mfxU32 reserved2;
|
||||
mfxU32 DataLength;
|
||||
mfxU32 MaxLength;
|
||||
|
||||
mfxU32 NumExtParam;
|
||||
mfxExtBuffer **ExtParam;
|
||||
} mfxAudioFrame;
|
||||
MFX_PACK_END()
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
101
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxaudio++.h
vendored
Normal file
101
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxaudio++.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
// Copyright (c) 2017 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXAUDIOPLUSPLUS_H
|
||||
#define __MFXAUDIOPLUSPLUS_H
|
||||
|
||||
#include "mfxaudio.h"
|
||||
|
||||
class MFXAudioSession
|
||||
{
|
||||
public:
|
||||
MFXAudioSession(void) { m_session = (mfxSession) 0; }
|
||||
virtual ~MFXAudioSession(void) { Close(); }
|
||||
|
||||
virtual mfxStatus Init(mfxIMPL impl, mfxVersion *ver) { return MFXInit(impl, ver, &m_session); }
|
||||
virtual mfxStatus Close(void)
|
||||
{
|
||||
mfxStatus mfxRes;
|
||||
mfxRes = MFXClose(m_session); m_session = (mfxSession) 0;
|
||||
return mfxRes;
|
||||
}
|
||||
|
||||
virtual mfxStatus QueryIMPL(mfxIMPL *impl) { return MFXQueryIMPL(m_session, impl); }
|
||||
virtual mfxStatus QueryVersion(mfxVersion *version) { return MFXQueryVersion(m_session, version); }
|
||||
|
||||
virtual mfxStatus JoinSession(mfxSession child_session) { return MFXJoinSession(m_session, child_session);}
|
||||
virtual mfxStatus DisjoinSession( ) { return MFXDisjoinSession(m_session);}
|
||||
virtual mfxStatus CloneSession( mfxSession *clone) { return MFXCloneSession(m_session, clone);}
|
||||
virtual mfxStatus SetPriority( mfxPriority priority) { return MFXSetPriority(m_session, priority);}
|
||||
virtual mfxStatus GetPriority( mfxPriority *priority) { return MFXGetPriority(m_session, priority);}
|
||||
|
||||
virtual mfxStatus SyncOperation(mfxSyncPoint syncp, mfxU32 wait) { return MFXAudioCORE_SyncOperation(m_session, syncp, wait); }
|
||||
|
||||
virtual operator mfxSession (void) { return m_session; }
|
||||
|
||||
protected:
|
||||
|
||||
mfxSession m_session; // (mfxSession) handle to the owning session
|
||||
};
|
||||
|
||||
|
||||
class MFXAudioDECODE
|
||||
{
|
||||
public:
|
||||
|
||||
MFXAudioDECODE(mfxSession session) { m_session = session; }
|
||||
virtual ~MFXAudioDECODE(void) { Close(); }
|
||||
|
||||
virtual mfxStatus Query(mfxAudioParam *in, mfxAudioParam *out) { return MFXAudioDECODE_Query(m_session, in, out); }
|
||||
virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxAudioParam *par) { return MFXAudioDECODE_DecodeHeader(m_session, bs, par); }
|
||||
virtual mfxStatus QueryIOSize(mfxAudioParam *par, mfxAudioAllocRequest *request) { return MFXAudioDECODE_QueryIOSize(m_session, par, request); }
|
||||
virtual mfxStatus Init(mfxAudioParam *par) { return MFXAudioDECODE_Init(m_session, par); }
|
||||
virtual mfxStatus Reset(mfxAudioParam *par) { return MFXAudioDECODE_Reset(m_session, par); }
|
||||
virtual mfxStatus Close(void) { return MFXAudioDECODE_Close(m_session); }
|
||||
virtual mfxStatus GetAudioParam(mfxAudioParam *par) { return MFXAudioDECODE_GetAudioParam(m_session, par); }
|
||||
virtual mfxStatus DecodeFrameAsync(mfxBitstream *bs, mfxAudioFrame *frame, mfxSyncPoint *syncp) { return MFXAudioDECODE_DecodeFrameAsync(m_session, bs, frame, syncp); }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
mfxSession m_session; // (mfxSession) handle to the owning session
|
||||
};
|
||||
|
||||
|
||||
class MFXAudioENCODE
|
||||
{
|
||||
public:
|
||||
|
||||
MFXAudioENCODE(mfxSession session) { m_session = session; }
|
||||
virtual ~MFXAudioENCODE(void) { Close(); }
|
||||
|
||||
virtual mfxStatus Query(mfxAudioParam *in, mfxAudioParam *out) { return MFXAudioENCODE_Query(m_session, in, out); }
|
||||
virtual mfxStatus QueryIOSize(mfxAudioParam *par, mfxAudioAllocRequest *request) { return MFXAudioENCODE_QueryIOSize(m_session, par, request); }
|
||||
virtual mfxStatus Init(mfxAudioParam *par) { return MFXAudioENCODE_Init(m_session, par); }
|
||||
virtual mfxStatus Reset(mfxAudioParam *par) { return MFXAudioENCODE_Reset(m_session, par); }
|
||||
virtual mfxStatus Close(void) { return MFXAudioENCODE_Close(m_session); }
|
||||
virtual mfxStatus GetAudioParam(mfxAudioParam *par) { return MFXAudioENCODE_GetAudioParam(m_session, par); }
|
||||
virtual mfxStatus EncodeFrameAsync(mfxAudioFrame *frame, mfxBitstream *buffer_out, mfxSyncPoint *syncp) { return MFXAudioENCODE_EncodeFrameAsync(m_session, frame, buffer_out, syncp); }
|
||||
|
||||
protected:
|
||||
|
||||
mfxSession m_session; // (mfxSession) handle to the owning session
|
||||
};
|
||||
|
||||
#endif
|
||||
60
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxaudio.h
vendored
Normal file
60
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxaudio.h
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) 2017 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#ifndef __MFXAUDIO_H__
|
||||
#define __MFXAUDIO_H__
|
||||
#include "mfxsession.h"
|
||||
#include "mfxastructures.h"
|
||||
|
||||
#define MFX_AUDIO_VERSION_MAJOR 1
|
||||
#define MFX_AUDIO_VERSION_MINOR 15
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* AudioCORE */
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioCORE_SyncOperation(mfxSession session, mfxSyncPoint syncp, mfxU32 wait);
|
||||
|
||||
/* AudioENCODE */
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_Query(mfxSession session, mfxAudioParam *in, mfxAudioParam *out);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_QueryIOSize(mfxSession session, mfxAudioParam *par, mfxAudioAllocRequest *request);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_Init(mfxSession session, mfxAudioParam *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_Reset(mfxSession session, mfxAudioParam *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_Close(mfxSession session);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_GetAudioParam(mfxSession session, mfxAudioParam *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioENCODE_EncodeFrameAsync(mfxSession session, mfxAudioFrame *frame, mfxBitstream *bs, mfxSyncPoint *syncp);
|
||||
|
||||
/* AudioDECODE */
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_Query(mfxSession session, mfxAudioParam *in, mfxAudioParam *out);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_DecodeHeader(mfxSession session, mfxBitstream *bs, mfxAudioParam* par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_Init(mfxSession session, mfxAudioParam *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_Reset(mfxSession session, mfxAudioParam *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_Close(mfxSession session);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_QueryIOSize(mfxSession session, mfxAudioParam *par, mfxAudioAllocRequest *request);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_GetAudioParam(mfxSession session, mfxAudioParam *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioDECODE_DecodeFrameAsync(mfxSession session, mfxBitstream *bs, mfxAudioFrame *frame, mfxSyncPoint *syncp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
129
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxbrc.h
vendored
Normal file
129
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxbrc.h
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
// Copyright (c) 2019-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXBRC_H__
|
||||
#define __MFXBRC_H__
|
||||
|
||||
#include "mfxvstructures.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Extended Buffer Ids */
|
||||
enum {
|
||||
MFX_EXTBUFF_BRC = MFX_MAKEFOURCC('E','B','R','C')
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
typedef struct {
|
||||
#if (MFX_VERSION >= 1026)
|
||||
mfxU32 reserved[23];
|
||||
mfxU16 SceneChange; // Frame is Scene Chg frame
|
||||
mfxU16 LongTerm; // Frame is long term refrence
|
||||
mfxU32 FrameCmplx; // Frame Complexity
|
||||
#else
|
||||
mfxU32 reserved[25];
|
||||
#endif
|
||||
mfxU32 EncodedOrder; // Frame number in a sequence of reordered frames starting from encoder Init()
|
||||
mfxU32 DisplayOrder; // Frame number in a sequence of frames in display order starting from last IDR
|
||||
mfxU32 CodedFrameSize; // Size of frame in bytes after encoding
|
||||
mfxU16 FrameType; // See FrameType enumerator
|
||||
mfxU16 PyramidLayer; // B-pyramid or P-pyramid layer, frame belongs to
|
||||
mfxU16 NumRecode; // Number of recodings performed for this frame
|
||||
mfxU16 NumExtParam;
|
||||
mfxExtBuffer** ExtParam;
|
||||
} mfxBRCFrameParam;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
typedef struct {
|
||||
mfxI32 QpY; // Frame-level Luma QP
|
||||
#if (MFX_VERSION >= 1029)
|
||||
mfxU32 InitialCpbRemovalDelay;
|
||||
mfxU32 InitialCpbRemovalOffset;
|
||||
mfxU32 reserved1[7];
|
||||
mfxU32 MaxFrameSize; // Max frame size in bytes (used for rePak)
|
||||
mfxU8 DeltaQP[8]; // deltaQP[i] is adding to QP value while i-rePak
|
||||
mfxU16 MaxNumRepak; // Max number of rePak to provide MaxFrameSize (from 0 to 8)
|
||||
mfxU16 NumExtParam;
|
||||
mfxExtBuffer** ExtParam; // extension buffer list
|
||||
#else
|
||||
mfxU32 reserved1[13];
|
||||
mfxHDL reserved2;
|
||||
#endif
|
||||
} mfxBRCFrameCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* BRCStatus */
|
||||
enum {
|
||||
MFX_BRC_OK = 0, // CodedFrameSize is acceptable, no further recoding/padding/skip required
|
||||
MFX_BRC_BIG_FRAME = 1, // Coded frame is too big, recoding required
|
||||
MFX_BRC_SMALL_FRAME = 2, // Coded frame is too small, recoding required
|
||||
MFX_BRC_PANIC_BIG_FRAME = 3, // Coded frame is too big, no further recoding possible - skip frame
|
||||
MFX_BRC_PANIC_SMALL_FRAME = 4 // Coded frame is too small, no further recoding possible - required padding to MinFrameSize
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
typedef struct {
|
||||
mfxU32 MinFrameSize; // Size in bytes, coded frame must be padded to when Status = MFX_BRC_PANIC_SMALL_FRAME
|
||||
mfxU16 BRCStatus; // See BRCStatus enumerator
|
||||
mfxU16 reserved[25];
|
||||
mfxHDL reserved1;
|
||||
} mfxBRCFrameStatus;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* Structure contains set of callbacks to perform external bit-rate control.
|
||||
Can be attached to mfxVideoParam structure during encoder initialization.
|
||||
Turn mfxExtCodingOption2::ExtBRC option ON to make encoder use external BRC instead of native one. */
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU32 reserved[14];
|
||||
mfxHDL pthis; // Pointer to user-defined BRC instance. Will be passed to each mfxExtBRC callback.
|
||||
|
||||
// Initialize BRC. Will be invoked during encoder Init(). In - pthis, par.
|
||||
mfxStatus (MFX_CDECL *Init) (mfxHDL pthis, mfxVideoParam* par);
|
||||
|
||||
// Reset BRC. Will be invoked during encoder Reset(). In - pthis, par.
|
||||
mfxStatus (MFX_CDECL *Reset) (mfxHDL pthis, mfxVideoParam* par);
|
||||
|
||||
// Close BRC. Will be invoked during encoder Close(). In - pthis.
|
||||
mfxStatus (MFX_CDECL *Close) (mfxHDL pthis);
|
||||
|
||||
// Obtain from BRC controls required for frame encoding.
|
||||
// Will be invoked BEFORE encoding of each frame. In - pthis, par; Out - ctrl.
|
||||
mfxStatus (MFX_CDECL *GetFrameCtrl) (mfxHDL pthis, mfxBRCFrameParam* par, mfxBRCFrameCtrl* ctrl);
|
||||
|
||||
// Update BRC state and return command to continue/recode frame/do padding/skip frame.
|
||||
// Will be invoked AFTER encoding of each frame. In - pthis, par, ctrl; Out - status.
|
||||
mfxStatus (MFX_CDECL *Update) (mfxHDL pthis, mfxBRCFrameParam* par, mfxBRCFrameCtrl* ctrl, mfxBRCFrameStatus* status);
|
||||
|
||||
mfxHDL reserved1[10];
|
||||
} mfxExtBRC;
|
||||
MFX_PACK_END()
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
271
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxcamera.h
vendored
Normal file
271
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxcamera.h
vendored
Normal file
@@ -0,0 +1,271 @@
|
||||
// Copyright (c) 2018-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXCAMERA_H__
|
||||
#define __MFXCAMERA_H__
|
||||
#include "mfxcommon.h"
|
||||
|
||||
#if !defined (__GNUC__)
|
||||
#pragma warning(disable: 4201)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Camera Extended Buffer Ids */
|
||||
enum {
|
||||
MFX_EXTBUF_CAM_GAMMA_CORRECTION = MFX_MAKEFOURCC('C','G','A','M'),
|
||||
MFX_EXTBUF_CAM_WHITE_BALANCE = MFX_MAKEFOURCC('C','W','B','L'),
|
||||
MFX_EXTBUF_CAM_HOT_PIXEL_REMOVAL = MFX_MAKEFOURCC('C','H','P','R'),
|
||||
MFX_EXTBUF_CAM_BLACK_LEVEL_CORRECTION = MFX_MAKEFOURCC('C','B','L','C'),
|
||||
MFX_EXTBUF_CAM_VIGNETTE_CORRECTION = MFX_MAKEFOURCC('C','V','G','T'),
|
||||
MFX_EXTBUF_CAM_BAYER_DENOISE = MFX_MAKEFOURCC('C','D','N','S'),
|
||||
MFX_EXTBUF_CAM_COLOR_CORRECTION_3X3 = MFX_MAKEFOURCC('C','C','3','3'),
|
||||
MFX_EXTBUF_CAM_PADDING = MFX_MAKEFOURCC('C','P','A','D'),
|
||||
MFX_EXTBUF_CAM_PIPECONTROL = MFX_MAKEFOURCC('C','P','P','C'),
|
||||
MFX_EXTBUF_CAM_FORWARD_GAMMA_CORRECTION = MFX_MAKEFOURCC('C','F','G','C'),
|
||||
MFX_EXTBUF_CAM_LENS_GEOM_DIST_CORRECTION = MFX_MAKEFOURCC('C','L','G','D'),
|
||||
MFX_EXTBUF_CAM_3DLUT = MFX_MAKEFOURCC('C','L','U','T'),
|
||||
MFX_EXTBUF_CAM_TOTAL_COLOR_CONTROL = MFX_MAKEFOURCC('C','T','C','C'),
|
||||
MFX_EXTBUF_CAM_CSC_YUV_RGB = MFX_MAKEFOURCC('C','C','Y','R')
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
MFX_CAM_GAMMA_VALUE = 0x0001,
|
||||
MFX_CAM_GAMMA_LUT = 0x0002,
|
||||
} mfxCamGammaParam;
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU16 Mode;
|
||||
mfxU16 reserved1;
|
||||
mfxF64 GammaValue;
|
||||
|
||||
mfxU16 reserved2[3];
|
||||
mfxU16 NumPoints;
|
||||
mfxU16 GammaPoint[1024];
|
||||
mfxU16 GammaCorrected[1024];
|
||||
mfxU32 reserved3[4];
|
||||
} mfxExtCamGammaCorrection;
|
||||
MFX_PACK_END()
|
||||
|
||||
typedef enum {
|
||||
MFX_CAM_WHITE_BALANCE_MANUAL = 0x0001,
|
||||
MFX_CAM_WHITE_BALANCE_AUTO = 0x0002
|
||||
} mfxCamWhiteBalanceMode;
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 Mode;
|
||||
mfxF64 R;
|
||||
mfxF64 G0;
|
||||
mfxF64 B;
|
||||
mfxF64 G1;
|
||||
mfxU32 reserved[8];
|
||||
} mfxExtCamWhiteBalance;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU16 R;
|
||||
mfxU16 G;
|
||||
mfxU16 B;
|
||||
mfxU16 C;
|
||||
mfxU16 M;
|
||||
mfxU16 Y;
|
||||
mfxU16 reserved[6];
|
||||
} mfxExtCamTotalColorControl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxF32 PreOffset[3];
|
||||
mfxF32 Matrix[3][3];
|
||||
mfxF32 PostOffset[3];
|
||||
mfxU16 reserved[30];
|
||||
} mfxExtCamCscYuvRgb;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU16 PixelThresholdDifference;
|
||||
mfxU16 PixelCountThreshold;
|
||||
} mfxExtCamHotPixelRemoval;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU16 R;
|
||||
mfxU16 G0;
|
||||
mfxU16 B;
|
||||
mfxU16 G1;
|
||||
mfxU32 reserved[4];
|
||||
} mfxExtCamBlackLevelCorrection;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxU8 integer;
|
||||
mfxU8 mantissa;
|
||||
} mfxCamVignetteCorrectionElement;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxCamVignetteCorrectionElement R;
|
||||
mfxCamVignetteCorrectionElement G0;
|
||||
mfxCamVignetteCorrectionElement B;
|
||||
mfxCamVignetteCorrectionElement G1;
|
||||
} mfxCamVignetteCorrectionParam;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU32 Width;
|
||||
mfxU32 Height;
|
||||
mfxU32 Pitch;
|
||||
mfxU32 reserved[7];
|
||||
|
||||
mfxCamVignetteCorrectionParam *CorrectionMap;
|
||||
|
||||
} mfxExtCamVignetteCorrection;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU16 Threshold;
|
||||
mfxU16 reserved[27];
|
||||
} mfxExtCamBayerDenoise;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxF64 CCM[3][3];
|
||||
mfxU32 reserved[4];
|
||||
} mfxExtCamColorCorrection3x3;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU16 Top;
|
||||
mfxU16 Bottom;
|
||||
mfxU16 Left;
|
||||
mfxU16 Right;
|
||||
mfxU32 reserved[4];
|
||||
} mfxExtCamPadding;
|
||||
MFX_PACK_END()
|
||||
|
||||
typedef enum {
|
||||
MFX_CAM_BAYER_BGGR = 0x0000,
|
||||
MFX_CAM_BAYER_RGGB = 0x0001,
|
||||
MFX_CAM_BAYER_GBRG = 0x0002,
|
||||
MFX_CAM_BAYER_GRBG = 0x0003
|
||||
} mfxCamBayerFormat;
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU16 RawFormat;
|
||||
mfxU16 reserved1;
|
||||
mfxU32 reserved[5];
|
||||
} mfxExtCamPipeControl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct{
|
||||
mfxU16 Pixel;
|
||||
mfxU16 Red;
|
||||
mfxU16 Green;
|
||||
mfxU16 Blue;
|
||||
} mfxCamFwdGammaSegment;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 reserved[19];
|
||||
mfxU16 NumSegments;
|
||||
union {
|
||||
mfxCamFwdGammaSegment* Segment;
|
||||
mfxU64 reserved1;
|
||||
};
|
||||
} mfxExtCamFwdGamma;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxF32 a[3]; // [R, G, B]
|
||||
mfxF32 b[3]; // [R, G, B]
|
||||
mfxF32 c[3]; // [R, G, B]
|
||||
mfxF32 d[3]; // [R, G, B]
|
||||
mfxU16 reserved[36];
|
||||
} mfxExtCamLensGeomDistCorrection;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* LUTSize */
|
||||
enum {
|
||||
MFX_CAM_3DLUT17_SIZE = (17 * 17 * 17),
|
||||
MFX_CAM_3DLUT33_SIZE = (33 * 33 * 33),
|
||||
MFX_CAM_3DLUT65_SIZE = (65 * 65 * 65)
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxU16 R;
|
||||
mfxU16 G;
|
||||
mfxU16 B;
|
||||
mfxU16 Reserved;
|
||||
} mfxCam3DLutEntry;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 reserved[10];
|
||||
mfxU32 Size;
|
||||
union
|
||||
{
|
||||
mfxCam3DLutEntry* Table;
|
||||
mfxU64 reserved1;
|
||||
};
|
||||
} mfxExtCam3DLut;
|
||||
MFX_PACK_END()
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // __MFXCAMERA_H__
|
||||
214
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxcommon.h
vendored
Normal file
214
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxcommon.h
vendored
Normal file
@@ -0,0 +1,214 @@
|
||||
// Copyright (c) 2018-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXCOMMON_H__
|
||||
#define __MFXCOMMON_H__
|
||||
#include "mfxdefs.h"
|
||||
|
||||
#if !defined (__GNUC__)
|
||||
#pragma warning(disable: 4201)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define MFX_MAKEFOURCC(A,B,C,D) ((((int)A))+(((int)B)<<8)+(((int)C)<<16)+(((int)D)<<24))
|
||||
|
||||
/* Extended Configuration Header Structure */
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxU32 BufferId;
|
||||
mfxU32 BufferSz;
|
||||
} mfxExtBuffer;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* Library initialization and deinitialization */
|
||||
typedef mfxI32 mfxIMPL;
|
||||
#define MFX_IMPL_BASETYPE(x) (0x00ff & (x))
|
||||
|
||||
enum {
|
||||
MFX_IMPL_AUTO = 0x0000, /* Auto Selection/In or Not Supported/Out */
|
||||
MFX_IMPL_SOFTWARE = 0x0001, /* Pure Software Implementation */
|
||||
MFX_IMPL_HARDWARE = 0x0002, /* Hardware Accelerated Implementation (default device) */
|
||||
MFX_IMPL_AUTO_ANY = 0x0003, /* Auto selection of any hardware/software implementation */
|
||||
MFX_IMPL_HARDWARE_ANY = 0x0004, /* Auto selection of any hardware implementation */
|
||||
MFX_IMPL_HARDWARE2 = 0x0005, /* Hardware accelerated implementation (2nd device) */
|
||||
MFX_IMPL_HARDWARE3 = 0x0006, /* Hardware accelerated implementation (3rd device) */
|
||||
MFX_IMPL_HARDWARE4 = 0x0007, /* Hardware accelerated implementation (4th device) */
|
||||
MFX_IMPL_RUNTIME = 0x0008,
|
||||
#if (MFX_VERSION >= MFX_VERSION_NEXT)
|
||||
MFX_IMPL_SINGLE_THREAD= 0x0009,
|
||||
#endif
|
||||
MFX_IMPL_VIA_ANY = 0x0100,
|
||||
MFX_IMPL_VIA_D3D9 = 0x0200,
|
||||
MFX_IMPL_VIA_D3D11 = 0x0300,
|
||||
MFX_IMPL_VIA_VAAPI = 0x0400,
|
||||
|
||||
MFX_IMPL_AUDIO = 0x8000,
|
||||
#if (MFX_VERSION >= MFX_VERSION_NEXT)
|
||||
MFX_IMPL_EXTERNAL_THREADING = 0x10000,
|
||||
#endif
|
||||
|
||||
MFX_IMPL_UNSUPPORTED = 0x0000 /* One of the MFXQueryIMPL returns */
|
||||
};
|
||||
|
||||
/* Version Info */
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef union {
|
||||
struct {
|
||||
mfxU16 Minor;
|
||||
mfxU16 Major;
|
||||
};
|
||||
mfxU32 Version;
|
||||
} mfxVersion;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* session priority */
|
||||
typedef enum
|
||||
{
|
||||
MFX_PRIORITY_LOW = 0,
|
||||
MFX_PRIORITY_NORMAL = 1,
|
||||
MFX_PRIORITY_HIGH = 2
|
||||
|
||||
} mfxPriority;
|
||||
|
||||
typedef struct _mfxEncryptedData mfxEncryptedData;
|
||||
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
mfxEncryptedData* EncryptedData;
|
||||
mfxExtBuffer **ExtParam;
|
||||
mfxU16 NumExtParam;
|
||||
};
|
||||
mfxU32 reserved[6];
|
||||
};
|
||||
mfxI64 DecodeTimeStamp;
|
||||
mfxU64 TimeStamp;
|
||||
mfxU8* Data;
|
||||
mfxU32 DataOffset;
|
||||
mfxU32 DataLength;
|
||||
mfxU32 MaxLength;
|
||||
|
||||
mfxU16 PicStruct;
|
||||
mfxU16 FrameType;
|
||||
mfxU16 DataFlag;
|
||||
mfxU16 reserved2;
|
||||
} mfxBitstream;
|
||||
MFX_PACK_END()
|
||||
|
||||
typedef struct _mfxSyncPoint *mfxSyncPoint;
|
||||
|
||||
/* GPUCopy */
|
||||
enum {
|
||||
MFX_GPUCOPY_DEFAULT = 0,
|
||||
MFX_GPUCOPY_ON = 1,
|
||||
MFX_GPUCOPY_OFF = 2
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
typedef struct {
|
||||
mfxIMPL Implementation;
|
||||
mfxVersion Version;
|
||||
mfxU16 ExternalThreads;
|
||||
union {
|
||||
struct {
|
||||
mfxExtBuffer **ExtParam;
|
||||
mfxU16 NumExtParam;
|
||||
};
|
||||
mfxU16 reserved2[5];
|
||||
};
|
||||
mfxU16 GPUCopy;
|
||||
mfxU16 reserved[21];
|
||||
} mfxInitParam;
|
||||
MFX_PACK_END()
|
||||
|
||||
enum {
|
||||
MFX_EXTBUFF_THREADS_PARAM = MFX_MAKEFOURCC('T','H','D','P')
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 NumThread;
|
||||
mfxI32 SchedulingType;
|
||||
mfxI32 Priority;
|
||||
mfxU16 reserved[55];
|
||||
} mfxExtThreadsParam;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* PlatformCodeName */
|
||||
enum {
|
||||
MFX_PLATFORM_UNKNOWN = 0,
|
||||
MFX_PLATFORM_SANDYBRIDGE = 1,
|
||||
MFX_PLATFORM_IVYBRIDGE = 2,
|
||||
MFX_PLATFORM_HASWELL = 3,
|
||||
MFX_PLATFORM_BAYTRAIL = 4,
|
||||
MFX_PLATFORM_BROADWELL = 5,
|
||||
MFX_PLATFORM_CHERRYTRAIL = 6,
|
||||
MFX_PLATFORM_SKYLAKE = 7,
|
||||
MFX_PLATFORM_APOLLOLAKE = 8,
|
||||
MFX_PLATFORM_KABYLAKE = 9,
|
||||
#if (MFX_VERSION >= 1025)
|
||||
MFX_PLATFORM_GEMINILAKE = 10,
|
||||
MFX_PLATFORM_COFFEELAKE = 11,
|
||||
MFX_PLATFORM_CANNONLAKE = 20,
|
||||
#endif
|
||||
#if (MFX_VERSION >= 1027)
|
||||
MFX_PLATFORM_ICELAKE = 30,
|
||||
#endif
|
||||
MFX_PLATFORM_JASPERLAKE = 32,
|
||||
MFX_PLATFORM_ELKHARTLAKE = 33,
|
||||
MFX_PLATFORM_TIGERLAKE = 40,
|
||||
MFX_PLATFORM_ROCKETLAKE = 42,
|
||||
MFX_PLATFORM_ALDERLAKE_S = 43,
|
||||
MFX_PLATFORM_KEEMBAY = 50,
|
||||
};
|
||||
|
||||
#if (MFX_VERSION >= 1031)
|
||||
typedef enum
|
||||
{
|
||||
MFX_MEDIA_UNKNOWN = 0xffff,
|
||||
MFX_MEDIA_INTEGRATED = 0,
|
||||
MFX_MEDIA_DISCRETE = 1
|
||||
} mfxMediaAdapterType;
|
||||
#endif
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxU16 CodeName;
|
||||
mfxU16 DeviceId;
|
||||
#if (MFX_VERSION >= 1031)
|
||||
mfxU16 MediaAdapterType;
|
||||
mfxU16 reserved[13];
|
||||
#else
|
||||
mfxU16 reserved[14];
|
||||
#endif
|
||||
} mfxPlatform;
|
||||
MFX_PACK_END()
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
258
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxdefs.h
vendored
Normal file
258
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxdefs.h
vendored
Normal file
@@ -0,0 +1,258 @@
|
||||
// Copyright (c) 2019-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXDEFS_H__
|
||||
#define __MFXDEFS_H__
|
||||
|
||||
#define MFX_VERSION_MAJOR 1
|
||||
#define MFX_VERSION_MINOR 35
|
||||
|
||||
// MFX_VERSION_NEXT is always +1 from last public release
|
||||
// may be enforced by MFX_VERSION_USE_LATEST define
|
||||
// if MFX_VERSION_USE_LATEST is defined MFX_VERSION is ignored
|
||||
|
||||
#define MFX_VERSION_NEXT (MFX_VERSION_MAJOR * 1000 + MFX_VERSION_MINOR + 1)
|
||||
|
||||
// MFX_VERSION - version of API that 'assumed' by build may be provided externally
|
||||
// if it omitted then latest stable API derived from Major.Minor is assumed
|
||||
|
||||
|
||||
#if !defined(MFX_VERSION)
|
||||
#if defined(MFX_VERSION_USE_LATEST)
|
||||
#define MFX_VERSION MFX_VERSION_NEXT
|
||||
#else
|
||||
#define MFX_VERSION (MFX_VERSION_MAJOR * 1000 + MFX_VERSION_MINOR)
|
||||
#endif
|
||||
#else
|
||||
#undef MFX_VERSION_MINOR
|
||||
#define MFX_VERSION_MINOR ((MFX_VERSION) % 1000)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* In preprocessor syntax # symbol has stringize meaning,
|
||||
so to expand some macro to preprocessor pragma we need to use
|
||||
special compiler dependent construction */
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define MFX_PRAGMA_IMPL(x) __pragma(x)
|
||||
#else
|
||||
#define MFX_PRAGMA_IMPL(x) _Pragma(#x)
|
||||
#endif
|
||||
|
||||
#define MFX_PACK_BEGIN_X(x) MFX_PRAGMA_IMPL(pack(push, x))
|
||||
#define MFX_PACK_END() MFX_PRAGMA_IMPL(pack(pop))
|
||||
|
||||
/* The general rule for alignment is following:
|
||||
- structures with pointers have 4/8 bytes alignment on 32/64 bit systems
|
||||
- structures with fields of type mfxU64/mfxF64 (unsigned long long / double)
|
||||
have alignment 8 bytes on 64 bit and 32 bit Windows, on Linux alignment is 4 bytes
|
||||
- all the rest structures are 4 bytes aligned
|
||||
- there are several exceptions: some structs which had 4-byte alignment were extended
|
||||
with pointer / long type fields; such structs have 4-byte alignment to keep binary
|
||||
compatibility with previously release API */
|
||||
|
||||
#define MFX_PACK_BEGIN_USUAL_STRUCT() MFX_PACK_BEGIN_X(4)
|
||||
|
||||
/* 64-bit LP64 data model */
|
||||
#if defined(_WIN64) || defined(__LP64__)
|
||||
#define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(8)
|
||||
#define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(8)
|
||||
/* 32-bit ILP32 data model Windows (Intel architecture) */
|
||||
#elif defined(_WIN32) || defined(_M_IX86) && !defined(__linux__)
|
||||
#define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(4)
|
||||
#define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(8)
|
||||
/* 32-bit ILP32 data model Linux */
|
||||
#elif defined(__ILP32__)
|
||||
#define MFX_PACK_BEGIN_STRUCT_W_PTR() MFX_PACK_BEGIN_X(4)
|
||||
#define MFX_PACK_BEGIN_STRUCT_W_L_TYPE() MFX_PACK_BEGIN_X(4)
|
||||
#else
|
||||
#error Unknown packing
|
||||
#endif
|
||||
|
||||
#define __INT64 long long
|
||||
#define __UINT64 unsigned long long
|
||||
|
||||
#ifdef _WIN32
|
||||
#define MFX_CDECL __cdecl
|
||||
#define MFX_STDCALL __stdcall
|
||||
#else
|
||||
#define MFX_CDECL
|
||||
#define MFX_STDCALL
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#define MFX_INFINITE 0xFFFFFFFF
|
||||
|
||||
#if !defined(MFX_DEPRECATED_OFF) && (MFX_VERSION >= 1034)
|
||||
#define MFX_DEPRECATED_OFF
|
||||
#endif
|
||||
|
||||
#ifndef MFX_DEPRECATED_OFF
|
||||
#if defined(__cplusplus) && __cplusplus >= 201402L
|
||||
#define MFX_DEPRECATED [[deprecated]]
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg [[deprecated]]
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
|
||||
#elif defined(__clang__)
|
||||
#define MFX_DEPRECATED __attribute__((deprecated))
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
|
||||
#elif defined(__INTEL_COMPILER)
|
||||
#if (defined(_WIN32) || defined(_WIN64))
|
||||
#define MFX_DEPRECATED __declspec(deprecated)
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg))
|
||||
#elif defined(__linux__)
|
||||
#define MFX_DEPRECATED __attribute__((deprecated))
|
||||
#if defined(__cplusplus)
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
|
||||
#else
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
|
||||
#endif
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
|
||||
#endif
|
||||
#elif defined(_MSC_VER) && _MSC_VER > 1200 // VS 6 doesn't support deprecation
|
||||
#define MFX_DEPRECATED __declspec(deprecated)
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg) __pragma(deprecated(arg))
|
||||
#elif defined(__GNUC__)
|
||||
#define MFX_DEPRECATED __attribute__((deprecated))
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg __attribute__((deprecated))
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
|
||||
#else
|
||||
#define MFX_DEPRECATED
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
|
||||
#endif
|
||||
#else
|
||||
#define MFX_DEPRECATED
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_INSIDE(arg) arg
|
||||
#define MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(arg)
|
||||
#endif
|
||||
|
||||
typedef unsigned char mfxU8;
|
||||
typedef char mfxI8;
|
||||
typedef short mfxI16;
|
||||
typedef unsigned short mfxU16;
|
||||
typedef unsigned int mfxU32;
|
||||
typedef int mfxI32;
|
||||
#if defined( _WIN32 ) || defined ( _WIN64 )
|
||||
typedef unsigned long mfxUL32;
|
||||
typedef long mfxL32;
|
||||
#else
|
||||
typedef unsigned int mfxUL32;
|
||||
typedef int mfxL32;
|
||||
#endif
|
||||
typedef float mfxF32;
|
||||
typedef double mfxF64;
|
||||
typedef __UINT64 mfxU64;
|
||||
typedef __INT64 mfxI64;
|
||||
typedef void* mfxHDL;
|
||||
typedef mfxHDL mfxMemId;
|
||||
typedef void* mfxThreadTask;
|
||||
typedef char mfxChar;
|
||||
|
||||
typedef struct {
|
||||
mfxI16 x;
|
||||
mfxI16 y;
|
||||
} mfxI16Pair;
|
||||
|
||||
typedef struct {
|
||||
mfxHDL first;
|
||||
mfxHDL second;
|
||||
} mfxHDLPair;
|
||||
|
||||
|
||||
/*********************************************************************************\
|
||||
Error message
|
||||
\*********************************************************************************/
|
||||
typedef enum
|
||||
{
|
||||
/* no error */
|
||||
MFX_ERR_NONE = 0, /* no error */
|
||||
|
||||
/* reserved for unexpected errors */
|
||||
MFX_ERR_UNKNOWN = -1, /* unknown error. */
|
||||
|
||||
/* error codes <0 */
|
||||
MFX_ERR_NULL_PTR = -2, /* null pointer */
|
||||
MFX_ERR_UNSUPPORTED = -3, /* undeveloped feature */
|
||||
MFX_ERR_MEMORY_ALLOC = -4, /* failed to allocate memory */
|
||||
MFX_ERR_NOT_ENOUGH_BUFFER = -5, /* insufficient buffer at input/output */
|
||||
MFX_ERR_INVALID_HANDLE = -6, /* invalid handle */
|
||||
MFX_ERR_LOCK_MEMORY = -7, /* failed to lock the memory block */
|
||||
MFX_ERR_NOT_INITIALIZED = -8, /* member function called before initialization */
|
||||
MFX_ERR_NOT_FOUND = -9, /* the specified object is not found */
|
||||
MFX_ERR_MORE_DATA = -10, /* expect more data at input */
|
||||
MFX_ERR_MORE_SURFACE = -11, /* expect more surface at output */
|
||||
MFX_ERR_ABORTED = -12, /* operation aborted */
|
||||
MFX_ERR_DEVICE_LOST = -13, /* lose the HW acceleration device */
|
||||
MFX_ERR_INCOMPATIBLE_VIDEO_PARAM = -14, /* incompatible video parameters */
|
||||
MFX_ERR_INVALID_VIDEO_PARAM = -15, /* invalid video parameters */
|
||||
MFX_ERR_UNDEFINED_BEHAVIOR = -16, /* undefined behavior */
|
||||
MFX_ERR_DEVICE_FAILED = -17, /* device operation failure */
|
||||
MFX_ERR_MORE_BITSTREAM = -18, /* expect more bitstream buffers at output */
|
||||
MFX_ERR_INCOMPATIBLE_AUDIO_PARAM = -19, /* incompatible audio parameters */
|
||||
MFX_ERR_INVALID_AUDIO_PARAM = -20, /* invalid audio parameters */
|
||||
MFX_ERR_GPU_HANG = -21, /* device operation failure caused by GPU hang */
|
||||
MFX_ERR_REALLOC_SURFACE = -22, /* bigger output surface required */
|
||||
|
||||
/* warnings >0 */
|
||||
MFX_WRN_IN_EXECUTION = 1, /* the previous asynchronous operation is in execution */
|
||||
MFX_WRN_DEVICE_BUSY = 2, /* the HW acceleration device is busy */
|
||||
MFX_WRN_VIDEO_PARAM_CHANGED = 3, /* the video parameters are changed during decoding */
|
||||
MFX_WRN_PARTIAL_ACCELERATION = 4, /* SW is used */
|
||||
MFX_WRN_INCOMPATIBLE_VIDEO_PARAM = 5, /* incompatible video parameters */
|
||||
MFX_WRN_VALUE_NOT_CHANGED = 6, /* the value is saturated based on its valid range */
|
||||
MFX_WRN_OUT_OF_RANGE = 7, /* the value is out of valid range */
|
||||
MFX_WRN_FILTER_SKIPPED = 10, /* one of requested filters has been skipped */
|
||||
MFX_WRN_INCOMPATIBLE_AUDIO_PARAM = 11, /* incompatible audio parameters */
|
||||
|
||||
#if MFX_VERSION >= 1031
|
||||
/* low-delay partial output */
|
||||
MFX_ERR_NONE_PARTIAL_OUTPUT = 12, /* frame is not ready, but bitstream contains partial output */
|
||||
#endif
|
||||
|
||||
/* threading statuses */
|
||||
MFX_TASK_DONE = MFX_ERR_NONE, /* task has been completed */
|
||||
MFX_TASK_WORKING = 8, /* there is some more work to do */
|
||||
MFX_TASK_BUSY = 9, /* task is waiting for resources */
|
||||
|
||||
/* plug-in statuses */
|
||||
MFX_ERR_MORE_DATA_SUBMIT_TASK = -10000, /* return MFX_ERR_MORE_DATA but submit internal asynchronous task */
|
||||
|
||||
} mfxStatus;
|
||||
|
||||
|
||||
// Application
|
||||
#if defined(MFX_DISPATCHER_EXPOSED_PREFIX)
|
||||
|
||||
#include "mfxdispatcherprefixedfunctions.h"
|
||||
|
||||
#endif // MFX_DISPATCHER_EXPOSED_PREFIX
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MFXDEFS_H__ */
|
||||
145
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxdispatcherprefixedfunctions.h
vendored
Normal file
145
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxdispatcherprefixedfunctions.h
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
// Copyright (c) 2017 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
|
||||
#ifndef __MFXDISPATCHERPREFIXEDFUNCTIONS_H__
|
||||
#define __MFXDISPATCHERPREFIXEDFUNCTIONS_H__
|
||||
|
||||
// API 1.0 functions
|
||||
#define MFXInit disp_MFXInit
|
||||
#define MFXClose disp_MFXClose
|
||||
#define MFXQueryIMPL disp_MFXQueryIMPL
|
||||
#define MFXQueryVersion disp_MFXQueryVersion
|
||||
|
||||
#define MFXJoinSession disp_MFXJoinSession
|
||||
#define MFXDisjoinSession disp_MFXDisjoinSession
|
||||
#define MFXCloneSession disp_MFXCloneSession
|
||||
#define MFXSetPriority disp_MFXSetPriority
|
||||
#define MFXGetPriority disp_MFXGetPriority
|
||||
|
||||
#define MFXVideoCORE_SetBufferAllocator disp_MFXVideoCORE_SetBufferAllocator
|
||||
#define MFXVideoCORE_SetFrameAllocator disp_MFXVideoCORE_SetFrameAllocator
|
||||
#define MFXVideoCORE_SetHandle disp_MFXVideoCORE_SetHandle
|
||||
#define MFXVideoCORE_GetHandle disp_MFXVideoCORE_GetHandle
|
||||
#define MFXVideoCORE_SyncOperation disp_MFXVideoCORE_SyncOperation
|
||||
|
||||
#define MFXVideoENCODE_Query disp_MFXVideoENCODE_Query
|
||||
#define MFXVideoENCODE_QueryIOSurf disp_MFXVideoENCODE_QueryIOSurf
|
||||
#define MFXVideoENCODE_Init disp_MFXVideoENCODE_Init
|
||||
#define MFXVideoENCODE_Reset disp_MFXVideoENCODE_Reset
|
||||
#define MFXVideoENCODE_Close disp_MFXVideoENCODE_Close
|
||||
#define MFXVideoENCODE_GetVideoParam disp_MFXVideoENCODE_GetVideoParam
|
||||
#define MFXVideoENCODE_GetEncodeStat disp_MFXVideoENCODE_GetEncodeStat
|
||||
#define MFXVideoENCODE_EncodeFrameAsync disp_MFXVideoENCODE_EncodeFrameAsync
|
||||
|
||||
#define MFXVideoDECODE_Query disp_MFXVideoDECODE_Query
|
||||
#define MFXVideoDECODE_DecodeHeader disp_MFXVideoDECODE_DecodeHeader
|
||||
#define MFXVideoDECODE_QueryIOSurf disp_MFXVideoDECODE_QueryIOSurf
|
||||
#define MFXVideoDECODE_Init disp_MFXVideoDECODE_Init
|
||||
#define MFXVideoDECODE_Reset disp_MFXVideoDECODE_Reset
|
||||
#define MFXVideoDECODE_Close disp_MFXVideoDECODE_Close
|
||||
#define MFXVideoDECODE_GetVideoParam disp_MFXVideoDECODE_GetVideoParam
|
||||
#define MFXVideoDECODE_GetDecodeStat disp_MFXVideoDECODE_GetDecodeStat
|
||||
#define MFXVideoDECODE_SetSkipMode disp_MFXVideoDECODE_SetSkipMode
|
||||
#define MFXVideoDECODE_GetPayload disp_MFXVideoDECODE_GetPayload
|
||||
#define MFXVideoDECODE_DecodeFrameAsync disp_MFXVideoDECODE_DecodeFrameAsync
|
||||
|
||||
#define MFXVideoVPP_Query disp_MFXVideoVPP_Query
|
||||
#define MFXVideoVPP_QueryIOSurf disp_MFXVideoVPP_QueryIOSurf
|
||||
#define MFXVideoVPP_Init disp_MFXVideoVPP_Init
|
||||
#define MFXVideoVPP_Reset disp_MFXVideoVPP_Reset
|
||||
#define MFXVideoVPP_Close disp_MFXVideoVPP_Close
|
||||
|
||||
#define MFXVideoVPP_GetVideoParam disp_MFXVideoVPP_GetVideoParam
|
||||
#define MFXVideoVPP_GetVPPStat disp_MFXVideoVPP_GetVPPStat
|
||||
#define MFXVideoVPP_RunFrameVPPAsync disp_MFXVideoVPP_RunFrameVPPAsync
|
||||
|
||||
// API 1.1 functions
|
||||
#define MFXVideoUSER_Register disp_MFXVideoUSER_Register
|
||||
#define MFXVideoUSER_Unregister disp_MFXVideoUSER_Unregister
|
||||
#define MFXVideoUSER_ProcessFrameAsync disp_MFXVideoUSER_ProcessFrameAsync
|
||||
|
||||
// API 1.10 functions
|
||||
|
||||
#define MFXVideoENC_Query disp_MFXVideoENC_Query
|
||||
#define MFXVideoENC_QueryIOSurf disp_MFXVideoENC_QueryIOSurf
|
||||
#define MFXVideoENC_Init disp_MFXVideoENC_Init
|
||||
#define MFXVideoENC_Reset disp_MFXVideoENC_Reset
|
||||
#define MFXVideoENC_Close disp_MFXVideoENC_Close
|
||||
#define MFXVideoENC_ProcessFrameAsync disp_MFXVideoENC_ProcessFrameAsync
|
||||
#define MFXVideoVPP_RunFrameVPPAsyncEx disp_MFXVideoVPP_RunFrameVPPAsyncEx
|
||||
#define MFXVideoUSER_Load disp_MFXVideoUSER_Load
|
||||
#define MFXVideoUSER_UnLoad disp_MFXVideoUSER_UnLoad
|
||||
|
||||
// API 1.11 functions
|
||||
|
||||
#define MFXVideoPAK_Query disp_MFXVideoPAK_Query
|
||||
#define MFXVideoPAK_QueryIOSurf disp_MFXVideoPAK_QueryIOSurf
|
||||
#define MFXVideoPAK_Init disp_MFXVideoPAK_Init
|
||||
#define MFXVideoPAK_Reset disp_MFXVideoPAK_Reset
|
||||
#define MFXVideoPAK_Close disp_MFXVideoPAK_Close
|
||||
#define MFXVideoPAK_ProcessFrameAsync disp_MFXVideoPAK_ProcessFrameAsync
|
||||
|
||||
// API 1.13 functions
|
||||
|
||||
#define MFXVideoUSER_LoadByPath disp_MFXVideoUSER_LoadByPath
|
||||
|
||||
// API 1.14 functions
|
||||
#define MFXInitEx disp_MFXInitEx
|
||||
#define MFXDoWork disp_MFXDoWork
|
||||
|
||||
// Audio library functions
|
||||
|
||||
// API 1.8 functions
|
||||
|
||||
#define MFXAudioCORE_SyncOperation disp_MFXAudioCORE_SyncOperation
|
||||
#define MFXAudioENCODE_Query disp_MFXAudioENCODE_Query
|
||||
#define MFXAudioENCODE_QueryIOSize disp_MFXAudioENCODE_QueryIOSize
|
||||
#define MFXAudioENCODE_Init disp_MFXAudioENCODE_Init
|
||||
#define MFXAudioENCODE_Reset disp_MFXAudioENCODE_Reset
|
||||
#define MFXAudioENCODE_Close disp_MFXAudioENCODE_Close
|
||||
#define MFXAudioENCODE_GetAudioParam disp_MFXAudioENCODE_GetAudioParam
|
||||
#define MFXAudioENCODE_EncodeFrameAsync disp_MFXAudioENCODE_EncodeFrameAsync
|
||||
|
||||
#define MFXAudioDECODE_Query disp_MFXAudioDECODE_Query
|
||||
#define MFXAudioDECODE_DecodeHeader disp_MFXAudioDECODE_DecodeHeader
|
||||
#define MFXAudioDECODE_Init disp_MFXAudioDECODE_Init
|
||||
#define MFXAudioDECODE_Reset disp_MFXAudioDECODE_Reset
|
||||
#define MFXAudioDECODE_Close disp_MFXAudioDECODE_Close
|
||||
#define MFXAudioDECODE_QueryIOSize disp_MFXAudioDECODE_QueryIOSize
|
||||
#define MFXAudioDECODE_GetAudioParam disp_MFXAudioDECODE_GetAudioParam
|
||||
#define MFXAudioDECODE_DecodeFrameAsync disp_MFXAudioDECODE_DecodeFrameAsync
|
||||
|
||||
// API 1.9 functions
|
||||
|
||||
#define MFXAudioUSER_Register disp_MFXAudioUSER_Register
|
||||
#define MFXAudioUSER_Unregister disp_MFXAudioUSER_Unregister
|
||||
#define MFXAudioUSER_ProcessFrameAsync disp_MFXAudioUSER_ProcessFrameAsync
|
||||
#define MFXAudioUSER_Load disp_MFXAudioUSER_Load
|
||||
#define MFXAudioUSER_UnLoad disp_MFXAudioUSER_UnLoad
|
||||
|
||||
// API 1.19 functions
|
||||
|
||||
#define MFXVideoENC_GetVideoParam disp_MFXVideoENC_GetVideoParam
|
||||
#define MFXVideoPAK_GetVideoParam disp_MFXVideoPAK_GetVideoParam
|
||||
#define MFXVideoCORE_QueryPlatform disp_MFXVideoCORE_QueryPlatform
|
||||
#define MFXVideoUSER_GetPlugin disp_MFXVideoUSER_GetPlugin
|
||||
|
||||
#endif
|
||||
74
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxenc.h
vendored
Normal file
74
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxenc.h
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
// Copyright (c) 2017-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXENC_H__
|
||||
#define __MFXENC_H__
|
||||
#include "mfxdefs.h"
|
||||
#include "mfxvstructures.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct _mfxENCInput{
|
||||
mfxU32 reserved[32];
|
||||
|
||||
mfxFrameSurface1 *InSurface;
|
||||
|
||||
mfxU16 NumFrameL0;
|
||||
mfxFrameSurface1 **L0Surface;
|
||||
mfxU16 NumFrameL1;
|
||||
mfxFrameSurface1 **L1Surface;
|
||||
|
||||
mfxU16 NumExtParam;
|
||||
mfxExtBuffer **ExtParam;
|
||||
} mfxENCInput;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct _mfxENCOutput{
|
||||
mfxU32 reserved[32];
|
||||
|
||||
mfxFrameSurface1 *OutSurface;
|
||||
|
||||
mfxU16 NumExtParam;
|
||||
mfxExtBuffer **ExtParam;
|
||||
} mfxENCOutput;
|
||||
MFX_PACK_END()
|
||||
|
||||
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_Init(mfxSession session, mfxVideoParam *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_Reset(mfxSession session, mfxVideoParam *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_Close(mfxSession session);
|
||||
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_ProcessFrameAsync(mfxSession session, mfxENCInput *in, mfxENCOutput *out, mfxSyncPoint *syncp);
|
||||
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoENC_GetVideoParam(mfxSession session, mfxVideoParam *par);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
614
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxfei.h
vendored
Normal file
614
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxfei.h
vendored
Normal file
@@ -0,0 +1,614 @@
|
||||
// Copyright (c) 2018-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXFEI_H__
|
||||
#define __MFXFEI_H__
|
||||
#include "mfxdefs.h"
|
||||
#include "mfxvstructures.h"
|
||||
#include "mfxpak.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 Qp;
|
||||
mfxU16 LenSP;
|
||||
mfxU16 SearchPath;
|
||||
mfxU16 SubMBPartMask;
|
||||
mfxU16 SubPelMode;
|
||||
mfxU16 InterSAD;
|
||||
mfxU16 IntraSAD;
|
||||
mfxU16 AdaptiveSearch;
|
||||
mfxU16 MVPredictor;
|
||||
mfxU16 MBQp;
|
||||
mfxU16 FTEnable;
|
||||
mfxU16 IntraPartMask;
|
||||
mfxU16 RefWidth;
|
||||
mfxU16 RefHeight;
|
||||
mfxU16 SearchWindow;
|
||||
mfxU16 DisableMVOutput;
|
||||
mfxU16 DisableStatisticsOutput;
|
||||
mfxU16 Enable8x8Stat;
|
||||
mfxU16 PictureType; /* Input picture type*/
|
||||
mfxU16 DownsampleInput;
|
||||
|
||||
mfxU16 RefPictureType[2]; /* reference picture type, 0 -L0, 1 - L1 */
|
||||
mfxU16 DownsampleReference[2];
|
||||
mfxFrameSurface1 *RefFrame[2];
|
||||
mfxU16 reserved[28];
|
||||
} mfxExtFeiPreEncCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 reserved1[3];
|
||||
mfxU32 NumMBAlloc; /* size of allocated memory in number of macroblocks */
|
||||
mfxU16 reserved2[20];
|
||||
|
||||
struct mfxExtFeiPreEncMVPredictorsMB {
|
||||
mfxI16Pair MV[2]; /* 0 for L0 and 1 for L1 */
|
||||
} *MB;
|
||||
} mfxExtFeiPreEncMVPredictors;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 reserved1[3];
|
||||
mfxU32 NumMBAlloc;
|
||||
mfxU16 reserved2[20];
|
||||
|
||||
mfxU8 *MB;
|
||||
} mfxExtFeiEncQP;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* PreENC output */
|
||||
/* Layout is exactly the same as mfxExtFeiEncMVs, this buffer may be removed in future */
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 reserved1[3];
|
||||
mfxU32 NumMBAlloc;
|
||||
mfxU16 reserved2[20];
|
||||
|
||||
struct mfxExtFeiPreEncMVMB {
|
||||
mfxI16Pair MV[16][2];
|
||||
} *MB;
|
||||
} mfxExtFeiPreEncMV;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 reserved1[3];
|
||||
mfxU32 NumMBAlloc;
|
||||
mfxU16 reserved2[20];
|
||||
|
||||
struct mfxExtFeiPreEncMBStatMB {
|
||||
struct mfxExtFeiPreEncMBStatMBInter {
|
||||
mfxU16 BestDistortion;
|
||||
mfxU16 Mode ;
|
||||
} Inter[2]; /*0 -L0, 1 - L1*/
|
||||
|
||||
mfxU16 BestIntraDistortion;
|
||||
mfxU16 IntraMode ;
|
||||
|
||||
mfxU16 NumOfNonZeroCoef;
|
||||
mfxU16 reserved1;
|
||||
mfxU32 SumOfCoef;
|
||||
|
||||
mfxU32 reserved2;
|
||||
|
||||
mfxU32 Variance16x16;
|
||||
mfxU32 Variance8x8[4];
|
||||
mfxU32 PixelAverage16x16;
|
||||
mfxU32 PixelAverage8x8[4];
|
||||
} *MB;
|
||||
} mfxExtFeiPreEncMBStat;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* 1 ENC_PAK input */
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 SearchPath;
|
||||
mfxU16 LenSP;
|
||||
mfxU16 SubMBPartMask;
|
||||
mfxU16 IntraPartMask;
|
||||
mfxU16 MultiPredL0;
|
||||
mfxU16 MultiPredL1;
|
||||
mfxU16 SubPelMode;
|
||||
mfxU16 InterSAD;
|
||||
mfxU16 IntraSAD;
|
||||
mfxU16 DistortionType;
|
||||
mfxU16 RepartitionCheckEnable;
|
||||
mfxU16 AdaptiveSearch;
|
||||
mfxU16 MVPredictor;
|
||||
mfxU16 NumMVPredictors[2];
|
||||
mfxU16 PerMBQp;
|
||||
mfxU16 PerMBInput;
|
||||
mfxU16 MBSizeCtrl;
|
||||
mfxU16 RefWidth;
|
||||
mfxU16 RefHeight;
|
||||
mfxU16 SearchWindow;
|
||||
mfxU16 ColocatedMbDistortion;
|
||||
mfxU16 reserved[38];
|
||||
} mfxExtFeiEncFrameCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 reserved1[3];
|
||||
mfxU32 NumMBAlloc;
|
||||
mfxU16 reserved2[20];
|
||||
|
||||
struct mfxExtFeiEncMVPredictorsMB {
|
||||
struct mfxExtFeiEncMVPredictorsMBRefIdx{
|
||||
mfxU8 RefL0: 4;
|
||||
mfxU8 RefL1: 4;
|
||||
} RefIdx[4]; /* index is predictor number */
|
||||
mfxU32 reserved;
|
||||
mfxI16Pair MV[4][2]; /* first index is predictor number, second is 0 for L0 and 1 for L1 */
|
||||
} *MB;
|
||||
} mfxExtFeiEncMVPredictors;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 reserved1[3];
|
||||
mfxU32 NumMBAlloc;
|
||||
mfxU16 reserved2[20];
|
||||
|
||||
struct mfxExtFeiEncMBCtrlMB {
|
||||
mfxU32 ForceToIntra : 1;
|
||||
mfxU32 ForceToSkip : 1;
|
||||
mfxU32 ForceToNoneSkip : 1;
|
||||
#if (MFX_VERSION >= 1025)
|
||||
mfxU32 DirectBiasAdjustment : 1;
|
||||
mfxU32 GlobalMotionBiasAdjustment : 1;
|
||||
mfxU32 MVCostScalingFactor : 3;
|
||||
|
||||
mfxU32 reserved1 : 24;
|
||||
#else
|
||||
mfxU32 reserved1 : 29;
|
||||
#endif
|
||||
mfxU32 reserved2;
|
||||
mfxU32 reserved3;
|
||||
|
||||
mfxU32 reserved4 : 16;
|
||||
mfxU32 TargetSizeInWord : 8;
|
||||
mfxU32 MaxSizeInWord : 8;
|
||||
} *MB;
|
||||
} mfxExtFeiEncMBCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* 1 ENC_PAK output */
|
||||
/* Buffer holds 32 MVs per MB. MVs are located in zigzag scan order.
|
||||
Number in diagram below shows location of MV in memory.
|
||||
For example, MV for right top 4x4 sub block is stored in 5-th element of the array.
|
||||
========================
|
||||
|| 00 | 01 || 04 | 05 ||
|
||||
------------------------
|
||||
|| 02 | 03 || 06 | 07 ||
|
||||
========================
|
||||
|| 08 | 09 || 12 | 13 ||
|
||||
------------------------
|
||||
|| 10 | 11 || 14 | 15 ||
|
||||
========================
|
||||
*/
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 reserved1[3];
|
||||
mfxU32 NumMBAlloc;
|
||||
mfxU16 reserved2[20];
|
||||
|
||||
struct mfxExtFeiEncMVMB {
|
||||
mfxI16Pair MV[16][2]; /* first index is block (4x4 pixels) number, second is 0 for L0 and 1 for L1 */
|
||||
} *MB;
|
||||
} mfxExtFeiEncMV;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 reserved1[3];
|
||||
mfxU32 NumMBAlloc;
|
||||
mfxU16 reserved2[20];
|
||||
|
||||
struct mfxExtFeiEncMBStatMB {
|
||||
mfxU16 InterDistortion[16];
|
||||
mfxU16 BestInterDistortion;
|
||||
mfxU16 BestIntraDistortion;
|
||||
mfxU16 ColocatedMbDistortion;
|
||||
mfxU16 reserved;
|
||||
mfxU32 reserved1[2];
|
||||
} *MB;
|
||||
} mfxExtFeiEncMBStat;
|
||||
MFX_PACK_END()
|
||||
|
||||
enum {
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PAK_OBJECT_HEADER) = 0x7149000A
|
||||
};
|
||||
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PAK_OBJECT_HEADER);
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
/* dword 0-2 */
|
||||
mfxU32 Header; /* MFX_PAK_OBJECT_HEADER */
|
||||
mfxU32 MVDataLength;
|
||||
mfxU32 MVDataOffset;
|
||||
|
||||
/* dword 3 */
|
||||
mfxU32 InterMbMode : 2;
|
||||
mfxU32 MBSkipFlag : 1;
|
||||
mfxU32 Reserved00 : 1;
|
||||
mfxU32 IntraMbMode : 2;
|
||||
mfxU32 Reserved01 : 1;
|
||||
mfxU32 FieldMbPolarityFlag : 1;
|
||||
mfxU32 MbType : 5;
|
||||
mfxU32 IntraMbFlag : 1;
|
||||
mfxU32 FieldMbFlag : 1;
|
||||
mfxU32 Transform8x8Flag : 1;
|
||||
mfxU32 Reserved02 : 1;
|
||||
mfxU32 DcBlockCodedCrFlag : 1;
|
||||
mfxU32 DcBlockCodedCbFlag : 1;
|
||||
mfxU32 DcBlockCodedYFlag : 1;
|
||||
mfxU32 MVFormat : 3; /* layout and number of MVs, 0 - no MVs, 6 - 32 MVs, the rest are reserved */
|
||||
mfxU32 Reserved03 : 8;
|
||||
mfxU32 ExtendedFormat : 1; /* should be 1, specifies that LumaIntraPredModes and RefIdx are replicated for 8x8 and 4x4 block/subblock */
|
||||
|
||||
/* dword 4 */
|
||||
mfxU8 HorzOrigin;
|
||||
mfxU8 VertOrigin;
|
||||
mfxU16 CbpY;
|
||||
|
||||
/* dword 5 */
|
||||
mfxU16 CbpCb;
|
||||
mfxU16 CbpCr;
|
||||
|
||||
/* dword 6 */
|
||||
mfxU32 QpPrimeY : 8;
|
||||
mfxU32 Reserved30 :17;
|
||||
mfxU32 MbSkipConvDisable : 1;
|
||||
mfxU32 IsLastMB : 1;
|
||||
mfxU32 EnableCoefficientClamp : 1;
|
||||
mfxU32 Direct8x8Pattern : 4;
|
||||
|
||||
union {
|
||||
struct {/* Intra MBs */
|
||||
/* dword 7-8 */
|
||||
mfxU16 LumaIntraPredModes[4];
|
||||
|
||||
/* dword 9 */
|
||||
mfxU32 ChromaIntraPredMode : 2;
|
||||
mfxU32 IntraPredAvailFlags : 6;
|
||||
mfxU32 Reserved60 : 24;
|
||||
} IntraMB;
|
||||
struct {/* Inter MBs */
|
||||
/*dword 7 */
|
||||
mfxU8 SubMbShapes;
|
||||
mfxU8 SubMbPredModes;
|
||||
mfxU16 Reserved40;
|
||||
|
||||
/* dword 8-9 */
|
||||
mfxU8 RefIdx[2][4]; /* first index is 0 for L0 and 1 for L1 */
|
||||
} InterMB;
|
||||
};
|
||||
|
||||
/* dword 10 */
|
||||
mfxU16 Reserved70;
|
||||
mfxU8 TargetSizeInWord;
|
||||
mfxU8 MaxSizeInWord;
|
||||
|
||||
mfxU32 reserved2[5];
|
||||
}mfxFeiPakMBCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 reserved1[3];
|
||||
mfxU32 NumMBAlloc;
|
||||
mfxU16 reserved2[20];
|
||||
|
||||
mfxFeiPakMBCtrl *MB;
|
||||
} mfxExtFeiPakMBCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 MaxFrameSize; /* in bytes */
|
||||
mfxU32 NumPasses; /* up to 8 */
|
||||
mfxU16 reserved[8];
|
||||
mfxU8 DeltaQP[8]; /* list of delta QPs, only positive values */
|
||||
} mfxExtFeiRepackCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
#if (MFX_VERSION >= 1025)
|
||||
/* FEI repack status */
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 NumPasses;
|
||||
mfxU16 reserved[58];
|
||||
} mfxExtFeiRepackStat;
|
||||
MFX_PACK_END()
|
||||
#endif
|
||||
|
||||
/* 1 decode stream out */
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
/* dword 0 */
|
||||
mfxU32 InterMbMode : 2;
|
||||
mfxU32 MBSkipFlag : 1;
|
||||
mfxU32 Reserved00 : 1;
|
||||
mfxU32 IntraMbMode : 2;
|
||||
mfxU32 Reserved01 : 1;
|
||||
mfxU32 FieldMbPolarityFlag : 1;
|
||||
mfxU32 MbType : 5;
|
||||
mfxU32 IntraMbFlag : 1;
|
||||
mfxU32 FieldMbFlag : 1;
|
||||
mfxU32 Transform8x8Flag : 1;
|
||||
mfxU32 Reserved02 : 1;
|
||||
mfxU32 DcBlockCodedCrFlag : 1;
|
||||
mfxU32 DcBlockCodedCbFlag : 1;
|
||||
mfxU32 DcBlockCodedYFlag : 1;
|
||||
mfxU32 Reserved03 :12;
|
||||
|
||||
/* dword 1 */
|
||||
mfxU16 HorzOrigin;
|
||||
mfxU16 VertOrigin;
|
||||
|
||||
/* dword 2 */
|
||||
mfxU32 CbpY :16;
|
||||
mfxU32 CbpCb : 4;
|
||||
mfxU32 CbpCr : 4;
|
||||
mfxU32 Reserved20 : 6;
|
||||
mfxU32 IsLastMB : 1;
|
||||
mfxU32 ConcealMB : 1;
|
||||
|
||||
/* dword 3 */
|
||||
mfxU32 QpPrimeY : 7;
|
||||
mfxU32 Reserved30 : 1;
|
||||
mfxU32 Reserved31 : 8;
|
||||
mfxU32 NzCoeffCount : 9;
|
||||
mfxU32 Reserved32 : 3;
|
||||
mfxU32 Direct8x8Pattern : 4;
|
||||
|
||||
/* dword 4-6 */
|
||||
union {
|
||||
struct {/* Intra MBs */
|
||||
/* dword 4-5 */
|
||||
mfxU16 LumaIntraPredModes[4];
|
||||
|
||||
/* dword 6 */
|
||||
mfxU32 ChromaIntraPredMode : 2;
|
||||
mfxU32 IntraPredAvailFlags : 6;
|
||||
mfxU32 Reserved60 : 24;
|
||||
} IntraMB;
|
||||
|
||||
struct {/* Inter MBs */
|
||||
/* dword 4 */
|
||||
mfxU8 SubMbShapes;
|
||||
mfxU8 SubMbPredModes;
|
||||
mfxU16 Reserved40;
|
||||
|
||||
/* dword 5-6 */
|
||||
mfxU8 RefIdx[2][4]; /* first index is 0 for L0 and 1 for L1 */
|
||||
} InterMB;
|
||||
};
|
||||
|
||||
/* dword 7 */
|
||||
mfxU32 Reserved70;
|
||||
|
||||
/* dword 8-15 */
|
||||
mfxI16Pair MV[4][2]; /* L0 - 0, L1 - 1 */
|
||||
}mfxFeiDecStreamOutMBCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 reserved1[3];
|
||||
mfxU32 NumMBAlloc;
|
||||
mfxU16 RemapRefIdx; /* tri-state option, default is OFF */
|
||||
mfxU16 PicStruct;
|
||||
mfxU16 reserved2[18];
|
||||
|
||||
mfxFeiDecStreamOutMBCtrl *MB;
|
||||
} mfxExtFeiDecStreamOut;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* SPS, PPS, Slice Header */
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 SPSId;
|
||||
|
||||
mfxU16 PicOrderCntType;
|
||||
mfxU16 Log2MaxPicOrderCntLsb;
|
||||
mfxU16 reserved[121];
|
||||
} mfxExtFeiSPS;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 SPSId;
|
||||
mfxU16 PPSId;
|
||||
|
||||
mfxU16 PictureType;
|
||||
mfxU16 FrameType;
|
||||
mfxU16 PicInitQP;
|
||||
mfxU16 NumRefIdxL0Active;
|
||||
mfxU16 NumRefIdxL1Active;
|
||||
mfxI16 ChromaQPIndexOffset;
|
||||
mfxI16 SecondChromaQPIndexOffset;
|
||||
mfxU16 Transform8x8ModeFlag;
|
||||
mfxU16 reserved[114];
|
||||
|
||||
struct mfxExtFeiPpsDPB {
|
||||
mfxU16 Index; /* index in mfxPAKInput::L0Surface array */
|
||||
mfxU16 PicType;
|
||||
mfxI32 FrameNumWrap;
|
||||
mfxU16 LongTermFrameIdx;
|
||||
mfxU16 reserved[3];
|
||||
} DpbBefore[16], DpbAfter[16];
|
||||
} mfxExtFeiPPS;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 NumSlice; /* actual number of slices in the picture */
|
||||
mfxU16 reserved[11];
|
||||
|
||||
struct mfxSlice{
|
||||
mfxU16 MBAddress;
|
||||
mfxU16 NumMBs;
|
||||
mfxU16 SliceType;
|
||||
mfxU16 PPSId;
|
||||
mfxU16 IdrPicId;
|
||||
|
||||
mfxU16 CabacInitIdc;
|
||||
|
||||
mfxU16 NumRefIdxL0Active;
|
||||
mfxU16 NumRefIdxL1Active;
|
||||
|
||||
mfxI16 SliceQPDelta;
|
||||
mfxU16 DisableDeblockingFilterIdc;
|
||||
mfxI16 SliceAlphaC0OffsetDiv2;
|
||||
mfxI16 SliceBetaOffsetDiv2;
|
||||
mfxU16 reserved[20];
|
||||
|
||||
struct mfxSliceRef{
|
||||
mfxU16 PictureType;
|
||||
mfxU16 Index;
|
||||
mfxU16 reserved[2];
|
||||
} RefL0[32], RefL1[32]; /* index in mfxPAKInput::L0Surface array */
|
||||
|
||||
} *Slice;
|
||||
}mfxExtFeiSliceHeader;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 DisableHME; /* 0 - enable, any other value means disable */
|
||||
mfxU16 DisableSuperHME;
|
||||
mfxU16 DisableUltraHME;
|
||||
|
||||
mfxU16 reserved[57];
|
||||
} mfxExtFeiCodingOption;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* 1 functions */
|
||||
typedef enum {
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_FEI_FUNCTION_PREENC) =1,
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_FEI_FUNCTION_ENCODE) =2,
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_FEI_FUNCTION_ENC) =3,
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_FEI_FUNCTION_PAK) =4,
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_FEI_FUNCTION_DEC) =5,
|
||||
} mfxFeiFunction;
|
||||
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_FEI_FUNCTION_PREENC);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_FEI_FUNCTION_ENCODE);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_FEI_FUNCTION_ENC);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_FEI_FUNCTION_PAK);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_FEI_FUNCTION_DEC);
|
||||
|
||||
enum {
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_PARAM) = MFX_MAKEFOURCC('F','E','P','R'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_PREENC_CTRL) = MFX_MAKEFOURCC('F','P','C','T'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_PREENC_MV_PRED) = MFX_MAKEFOURCC('F','P','M','P'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_PREENC_MV) = MFX_MAKEFOURCC('F','P','M','V'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_PREENC_MB) = MFX_MAKEFOURCC('F','P','M','B'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_ENC_CTRL) = MFX_MAKEFOURCC('F','E','C','T'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_ENC_MV_PRED) = MFX_MAKEFOURCC('F','E','M','P'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_ENC_QP) = MFX_MAKEFOURCC('F','E','Q','P'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_ENC_MV) = MFX_MAKEFOURCC('F','E','M','V'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_ENC_MB) = MFX_MAKEFOURCC('F','E','M','B'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_ENC_MB_STAT) = MFX_MAKEFOURCC('F','E','S','T'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_PAK_CTRL) = MFX_MAKEFOURCC('F','K','C','T'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_SPS) = MFX_MAKEFOURCC('F','S','P','S'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_PPS) = MFX_MAKEFOURCC('F','P','P','S'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_SLICE) = MFX_MAKEFOURCC('F','S','L','C'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_CODING_OPTION) = MFX_MAKEFOURCC('F','C','D','O'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_DEC_STREAM_OUT) = MFX_MAKEFOURCC('F','D','S','O'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_REPACK_CTRL) = MFX_MAKEFOURCC('F','E','R','P'),
|
||||
#if (MFX_VERSION >= 1025)
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_FEI_REPACK_STAT) = MFX_MAKEFOURCC('F','E','R','S')
|
||||
#endif
|
||||
};
|
||||
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_PARAM);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_PREENC_CTRL);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_PREENC_MV_PRED);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_PREENC_MV);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_PREENC_MB);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_ENC_CTRL);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_ENC_MV_PRED);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_ENC_QP);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_ENC_MV);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_ENC_MB);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_ENC_MB_STAT);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_PAK_CTRL);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_SPS);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_PPS);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_SLICE);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_CODING_OPTION);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_DEC_STREAM_OUT);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_REPACK_CTRL);
|
||||
|
||||
#if (MFX_VERSION >= 1025)
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_FEI_REPACK_STAT);
|
||||
#endif
|
||||
|
||||
/* should be attached to mfxVideoParam during initialization to indicate FEI function */
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxFeiFunction Func;
|
||||
mfxU16 SingleFieldProcessing;
|
||||
mfxU16 reserved[57];
|
||||
} mfxExtFeiParam;
|
||||
MFX_PACK_END()
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
303
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxfeihevc.h
vendored
Normal file
303
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxfeihevc.h
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
// Copyright (c) 2018-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXFEIHEVC_H__
|
||||
#define __MFXFEIHEVC_H__
|
||||
#include "mfxcommon.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if (MFX_VERSION >= 1027)
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 SearchPath;
|
||||
mfxU16 LenSP;
|
||||
mfxU16 RefWidth;
|
||||
mfxU16 RefHeight;
|
||||
mfxU16 SearchWindow;
|
||||
|
||||
mfxU16 NumMvPredictors[2]; /* 0 for L0 and 1 for L1 */
|
||||
mfxU16 MultiPred[2]; /* 0 for L0 and 1 for L1 */
|
||||
|
||||
mfxU16 SubPelMode;
|
||||
mfxU16 AdaptiveSearch;
|
||||
mfxU16 MVPredictor;
|
||||
|
||||
mfxU16 PerCuQp;
|
||||
mfxU16 PerCtuInput;
|
||||
mfxU16 ForceCtuSplit;
|
||||
mfxU16 NumFramePartitions;
|
||||
mfxU16 FastIntraMode;
|
||||
|
||||
mfxU16 reserved0[107];
|
||||
} mfxExtFeiHevcEncFrameCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
struct {
|
||||
mfxU8 RefL0 : 4;
|
||||
mfxU8 RefL1 : 4;
|
||||
} RefIdx[4]; /* index is predictor number */
|
||||
|
||||
mfxU32 BlockSize : 2;
|
||||
mfxU32 reserved0 : 30;
|
||||
|
||||
mfxI16Pair MV[4][2]; /* first index is predictor number, second is 0 for L0 and 1 for L1 */
|
||||
} mfxFeiHevcEncMVPredictors;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 VaBufferID;
|
||||
mfxU32 Pitch;
|
||||
mfxU32 Height;
|
||||
mfxU16 reserved0[54];
|
||||
|
||||
mfxFeiHevcEncMVPredictors *Data;
|
||||
} mfxExtFeiHevcEncMVPredictors;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 VaBufferID;
|
||||
mfxU32 Pitch;
|
||||
mfxU32 Height;
|
||||
mfxU16 reserved[6];
|
||||
|
||||
mfxU8 *Data;
|
||||
} mfxExtFeiHevcEncQP;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxU32 ForceToIntra : 1;
|
||||
mfxU32 ForceToInter : 1;
|
||||
mfxU32 reserved0 : 30;
|
||||
|
||||
mfxU32 reserved1[3];
|
||||
} mfxFeiHevcEncCtuCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 VaBufferID;
|
||||
mfxU32 Pitch;
|
||||
mfxU32 Height;
|
||||
mfxU16 reserved0[54];
|
||||
|
||||
mfxFeiHevcEncCtuCtrl *Data;
|
||||
} mfxExtFeiHevcEncCtuCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 MaxFrameSize; /* in bytes */
|
||||
mfxU32 NumPasses; /* up to 8 */
|
||||
mfxU16 reserved[8];
|
||||
mfxU8 DeltaQP[8]; /* list of delta QPs, only positive values */
|
||||
} mfxExtFeiHevcRepackCtrl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 NumPasses;
|
||||
mfxU16 reserved[58];
|
||||
} mfxExtFeiHevcRepackStat;
|
||||
MFX_PACK_END()
|
||||
|
||||
#if MFX_VERSION >= MFX_VERSION_NEXT
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
/* DWORD 0 */
|
||||
mfxU32 reserved0;
|
||||
|
||||
/* DWORD 1 */
|
||||
mfxU32 SplitLevel2Part0 : 4;
|
||||
mfxU32 SplitLevel2Part1 : 4;
|
||||
mfxU32 SplitLevel2Part2 : 4;
|
||||
mfxU32 SplitLevel2Part3 : 4;
|
||||
mfxU32 SplitLevel1 : 4;
|
||||
mfxU32 SplitLevel0 : 1;
|
||||
mfxU32 reserved10 : 3;
|
||||
mfxU32 CuCountMinus1 : 6;
|
||||
mfxU32 LastCtuOfTileFlag : 1;
|
||||
mfxU32 LastCtuOfSliceFlag : 1;
|
||||
|
||||
|
||||
/* DWORD 2 */
|
||||
mfxU32 CtuAddrX : 16;
|
||||
mfxU32 CtuAddrY : 16;
|
||||
|
||||
/* DWORD 3 */
|
||||
mfxU32 reserved3;
|
||||
} mfxFeiHevcPakCtuRecordV0;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 VaBufferID;
|
||||
mfxU32 Pitch;
|
||||
mfxU32 Height;
|
||||
mfxU16 reserved0[54];
|
||||
|
||||
mfxFeiHevcPakCtuRecordV0 *Data;
|
||||
} mfxExtFeiHevcPakCtuRecordV0;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
/* DWORD 0 */
|
||||
mfxU32 CuSize : 2;
|
||||
mfxU32 PredMode : 1;
|
||||
mfxU32 TransquantBypass : 1;
|
||||
mfxU32 PartMode : 3;
|
||||
mfxU32 IpcmEnable : 1;
|
||||
mfxU32 IntraChromaMode : 3;
|
||||
mfxU32 ZeroOutCoeffs : 1;
|
||||
mfxU32 reserved00 : 4;
|
||||
mfxU32 Qp : 7;
|
||||
mfxU32 QpSign : 1;
|
||||
mfxU32 InterpredIdc : 8;
|
||||
|
||||
|
||||
/* DWORD 1 */
|
||||
mfxU32 IntraMode0 : 6;
|
||||
mfxU32 reserved10 : 2;
|
||||
mfxU32 IntraMode1 : 6;
|
||||
mfxU32 reserved11 : 2;
|
||||
mfxU32 IntraMode2 : 6;
|
||||
mfxU32 reserved12 : 2;
|
||||
mfxU32 IntraMode3 : 6;
|
||||
mfxU32 reserved13 : 2;
|
||||
|
||||
|
||||
/* DWORD 2-9 */
|
||||
struct {
|
||||
mfxI16 x[4];
|
||||
mfxI16 y[4];
|
||||
} MVs[2]; /* 0-L0, 1-L1 */
|
||||
|
||||
|
||||
/* DWORD 10 */
|
||||
struct{
|
||||
mfxU16 Ref0 : 4;
|
||||
mfxU16 Ref1 : 4;
|
||||
mfxU16 Ref2 : 4;
|
||||
mfxU16 Ref3 : 4;
|
||||
} RefIdx[2]; /* 0-L0, 1-L1 */
|
||||
|
||||
|
||||
/* DWORD 11 */
|
||||
mfxU32 TuSize;
|
||||
|
||||
|
||||
/* DWORD 12 */
|
||||
mfxU32 TransformSkipY : 16;
|
||||
mfxU32 reserved120 : 12;
|
||||
mfxU32 TuCountM1 : 4;
|
||||
|
||||
|
||||
/* DWORD 13 */
|
||||
mfxU32 TransformSkipU : 16;
|
||||
mfxU32 TransformSkipV : 16;
|
||||
} mfxFeiHevcPakCuRecordV0;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 VaBufferID;
|
||||
mfxU32 Pitch;
|
||||
mfxU32 Height;
|
||||
mfxU16 reserved0[54];
|
||||
|
||||
mfxFeiHevcPakCuRecordV0 *Data;
|
||||
} mfxExtFeiHevcPakCuRecordV0;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxU32 BestDistortion;
|
||||
mfxU32 ColocatedCtuDistortion;
|
||||
} mfxFeiHevcDistortionCtu;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
mfxU32 VaBufferID;
|
||||
mfxU32 Pitch;
|
||||
mfxU32 Height;
|
||||
mfxU16 reserved[6];
|
||||
|
||||
mfxFeiHevcDistortionCtu *Data;
|
||||
} mfxExtFeiHevcDistortion;
|
||||
MFX_PACK_END()
|
||||
#endif
|
||||
|
||||
|
||||
enum {
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_HEVCFEI_ENC_CTRL) = MFX_MAKEFOURCC('F','H','C','T'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED) = MFX_MAKEFOURCC('F','H','P','D'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_HEVCFEI_ENC_QP) = MFX_MAKEFOURCC('F','H','Q','P'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_HEVCFEI_ENC_CTU_CTRL) = MFX_MAKEFOURCC('F','H','E','C'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_HEVCFEI_REPACK_CTRL) = MFX_MAKEFOURCC('F','H','R','P'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_HEVCFEI_REPACK_STAT) = MFX_MAKEFOURCC('F','H','R','S'),
|
||||
|
||||
#if MFX_VERSION >= MFX_VERSION_NEXT
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_HEVCFEI_PAK_CTU_REC) = MFX_MAKEFOURCC('F','H','T','B'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_HEVCFEI_PAK_CU_REC) = MFX_MAKEFOURCC('F','H','C','U'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_HEVCFEI_ENC_DIST) = MFX_MAKEFOURCC('F','H','D','S')
|
||||
#endif
|
||||
};
|
||||
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_HEVCFEI_ENC_CTRL);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_HEVCFEI_ENC_QP);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_HEVCFEI_ENC_CTU_CTRL);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_HEVCFEI_REPACK_CTRL);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_HEVCFEI_REPACK_STAT);
|
||||
|
||||
#if MFX_VERSION >= MFX_VERSION_NEXT
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_HEVCFEI_PAK_CTU_REC);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_HEVCFEI_PAK_CU_REC);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_HEVCFEI_ENC_DIST);
|
||||
#endif
|
||||
|
||||
#endif // MFX_VERSION
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif // __MFXFEIHEVC_H__
|
||||
105
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxjpeg.h
vendored
Normal file
105
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxjpeg.h
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
// Copyright (c) 2017-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFX_JPEG_H__
|
||||
#define __MFX_JPEG_H__
|
||||
|
||||
#include "mfxdefs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* CodecId */
|
||||
enum {
|
||||
MFX_CODEC_JPEG = MFX_MAKEFOURCC('J','P','E','G')
|
||||
};
|
||||
|
||||
/* CodecProfile, CodecLevel */
|
||||
enum
|
||||
{
|
||||
MFX_PROFILE_JPEG_BASELINE = 1
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MFX_ROTATION_0 = 0,
|
||||
MFX_ROTATION_90 = 1,
|
||||
MFX_ROTATION_180 = 2,
|
||||
MFX_ROTATION_270 = 3
|
||||
};
|
||||
|
||||
enum {
|
||||
MFX_EXTBUFF_JPEG_QT = MFX_MAKEFOURCC('J','P','G','Q'),
|
||||
MFX_EXTBUFF_JPEG_HUFFMAN = MFX_MAKEFOURCC('J','P','G','H')
|
||||
};
|
||||
|
||||
enum {
|
||||
MFX_JPEG_COLORFORMAT_UNKNOWN = 0,
|
||||
MFX_JPEG_COLORFORMAT_YCbCr = 1,
|
||||
MFX_JPEG_COLORFORMAT_RGB = 2
|
||||
};
|
||||
|
||||
enum {
|
||||
MFX_SCANTYPE_UNKNOWN = 0,
|
||||
MFX_SCANTYPE_INTERLEAVED = 1,
|
||||
MFX_SCANTYPE_NONINTERLEAVED = 2
|
||||
};
|
||||
|
||||
enum {
|
||||
MFX_CHROMAFORMAT_JPEG_SAMPLING = 6
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 reserved[7];
|
||||
mfxU16 NumTable;
|
||||
|
||||
mfxU16 Qm[4][64];
|
||||
} mfxExtJPEGQuantTables;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 reserved[2];
|
||||
mfxU16 NumDCTable;
|
||||
mfxU16 NumACTable;
|
||||
|
||||
struct {
|
||||
mfxU8 Bits[16];
|
||||
mfxU8 Values[12];
|
||||
} DCTables[4];
|
||||
|
||||
struct {
|
||||
mfxU8 Bits[16];
|
||||
mfxU8 Values[162];
|
||||
} ACTables[4];
|
||||
} mfxExtJPEGHuffmanTables;
|
||||
MFX_PACK_END()
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif // __MFX_JPEG_H__
|
||||
102
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxla.h
vendored
Normal file
102
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxla.h
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
// Copyright (c) 2017-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXLA_H__
|
||||
#define __MFXLA_H__
|
||||
#include "mfxdefs.h"
|
||||
#include "mfxvstructures.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_LOOKAHEAD_CTRL) = MFX_MAKEFOURCC('L','A','C','T'),
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_EXTBUFF_LOOKAHEAD_STAT) = MFX_MAKEFOURCC('L','A','S','T'),
|
||||
};
|
||||
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_LOOKAHEAD_CTRL);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_EXTBUFF_LOOKAHEAD_STAT);
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct
|
||||
{
|
||||
mfxExtBuffer Header;
|
||||
mfxU16 LookAheadDepth;
|
||||
mfxU16 DependencyDepth;
|
||||
mfxU16 DownScaleFactor;
|
||||
mfxU16 BPyramid;
|
||||
|
||||
mfxU16 reserved1[23];
|
||||
|
||||
mfxU16 NumOutStream;
|
||||
struct mfxStream{
|
||||
mfxU16 Width;
|
||||
mfxU16 Height;
|
||||
mfxU16 reserved2[14];
|
||||
} OutStream[16];
|
||||
}mfxExtLAControl;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_L_TYPE()
|
||||
MFX_DEPRECATED typedef struct
|
||||
{
|
||||
mfxU16 Width;
|
||||
mfxU16 Height;
|
||||
|
||||
mfxU32 FrameType;
|
||||
mfxU32 FrameDisplayOrder;
|
||||
mfxU32 FrameEncodeOrder;
|
||||
|
||||
mfxU32 IntraCost;
|
||||
mfxU32 InterCost;
|
||||
mfxU32 DependencyCost; //aggregated cost, how this frame influences subsequent frames
|
||||
mfxU16 Layer;
|
||||
mfxU16 reserved[23];
|
||||
|
||||
mfxU64 EstimatedRate[52];
|
||||
}mfxLAFrameInfo;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 reserved[20];
|
||||
|
||||
mfxU16 NumAlloc; //number of allocated mfxLAFrameInfo structures
|
||||
mfxU16 NumStream; //number of resolutions
|
||||
mfxU16 NumFrame; //number of frames for each resolution
|
||||
mfxLAFrameInfo *FrameStat; //frame statistics
|
||||
|
||||
mfxFrameSurface1 *OutSurface; //reordered surface
|
||||
|
||||
} mfxExtLAFrameStatistics;
|
||||
MFX_PACK_END()
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
106
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxmvc.h
vendored
Normal file
106
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxmvc.h
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
// Copyright (c) 2017-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXMVC_H__
|
||||
#define __MFXMVC_H__
|
||||
|
||||
#include "mfxdefs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* CodecProfile, CodecLevel */
|
||||
enum {
|
||||
/* MVC profiles */
|
||||
MFX_PROFILE_AVC_MULTIVIEW_HIGH =118,
|
||||
MFX_PROFILE_AVC_STEREO_HIGH =128
|
||||
};
|
||||
|
||||
/* Extended Buffer Ids */
|
||||
enum {
|
||||
MFX_EXTBUFF_MVC_SEQ_DESC = MFX_MAKEFOURCC('M','V','C','D'),
|
||||
MFX_EXTBUFF_MVC_TARGET_VIEWS = MFX_MAKEFOURCC('M','V','C','T')
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxU16 ViewId;
|
||||
|
||||
mfxU16 NumAnchorRefsL0;
|
||||
mfxU16 NumAnchorRefsL1;
|
||||
mfxU16 AnchorRefL0[16];
|
||||
mfxU16 AnchorRefL1[16];
|
||||
|
||||
mfxU16 NumNonAnchorRefsL0;
|
||||
mfxU16 NumNonAnchorRefsL1;
|
||||
mfxU16 NonAnchorRefL0[16];
|
||||
mfxU16 NonAnchorRefL1[16];
|
||||
} mfxMVCViewDependency;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
typedef struct {
|
||||
mfxU16 TemporalId;
|
||||
mfxU16 LevelIdc;
|
||||
|
||||
mfxU16 NumViews;
|
||||
mfxU16 NumTargetViews;
|
||||
mfxU16 *TargetViewId;
|
||||
} mfxMVCOperationPoint;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU32 NumView;
|
||||
mfxU32 NumViewAlloc;
|
||||
mfxMVCViewDependency *View;
|
||||
|
||||
mfxU32 NumViewId;
|
||||
mfxU32 NumViewIdAlloc;
|
||||
mfxU16 *ViewId;
|
||||
|
||||
mfxU32 NumOP;
|
||||
mfxU32 NumOPAlloc;
|
||||
mfxMVCOperationPoint *OP;
|
||||
|
||||
mfxU16 NumRefsTotal;
|
||||
mfxU32 Reserved[16];
|
||||
|
||||
} mfxExtMVCSeqDesc;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 TemporalId;
|
||||
mfxU32 NumView;
|
||||
mfxU16 ViewId[1024];
|
||||
} mfxExtMVCTargetViews ;
|
||||
MFX_PACK_END()
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
78
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxpak.h
vendored
Normal file
78
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxpak.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
// Copyright (c) 2017-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXPAK_H__
|
||||
#define __MFXPAK_H__
|
||||
#include "mfxdefs.h"
|
||||
#include "mfxvstructures.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxU16 reserved[32];
|
||||
|
||||
mfxFrameSurface1 *InSurface;
|
||||
|
||||
mfxU16 NumFrameL0;
|
||||
mfxFrameSurface1 **L0Surface;
|
||||
mfxU16 NumFrameL1;
|
||||
mfxFrameSurface1 **L1Surface;
|
||||
|
||||
mfxU16 NumExtParam;
|
||||
mfxExtBuffer **ExtParam;
|
||||
|
||||
mfxU16 NumPayload;
|
||||
mfxPayload **Payload;
|
||||
} mfxPAKInput;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct {
|
||||
mfxU16 reserved[32];
|
||||
|
||||
mfxBitstream *Bs;
|
||||
|
||||
mfxFrameSurface1 *OutSurface;
|
||||
|
||||
mfxU16 NumExtParam;
|
||||
mfxExtBuffer **ExtParam;
|
||||
} mfxPAKOutput;
|
||||
MFX_PACK_END()
|
||||
|
||||
typedef struct _mfxSession *mfxSession;
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest request[2]);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_Init(mfxSession session, mfxVideoParam *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_Reset(mfxSession session, mfxVideoParam *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_Close(mfxSession session);
|
||||
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_ProcessFrameAsync(mfxSession session, mfxPAKInput *in, mfxPAKOutput *out, mfxSyncPoint *syncp);
|
||||
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoPAK_GetVideoParam(mfxSession session, mfxVideoParam *par);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
56
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxpcp.h
vendored
Normal file
56
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxpcp.h
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
// Copyright (c) 2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXPCP_H__
|
||||
#define __MFXPCP_H__
|
||||
#include "mfxstructures.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if MFX_VERSION >= 1030
|
||||
/* Protected in mfxVideoParam */
|
||||
enum {
|
||||
MFX_PROTECTION_CENC_WV_CLASSIC = 0x0004,
|
||||
MFX_PROTECTION_CENC_WV_GOOGLE_DASH = 0x0005,
|
||||
};
|
||||
|
||||
/* Extended Buffer Ids */
|
||||
enum {
|
||||
MFX_EXTBUFF_CENC_PARAM = MFX_MAKEFOURCC('C','E','N','P')
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct _mfxExtCencParam{
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU32 StatusReportIndex;
|
||||
mfxU32 reserved[15];
|
||||
} mfxExtCencParam;
|
||||
MFX_PACK_END()
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
717
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxplugin++.h
vendored
Normal file
717
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxplugin++.h
vendored
Normal file
@@ -0,0 +1,717 @@
|
||||
// Copyright (c) 2017-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#ifndef __MFXPLUGINPLUSPLUS_H
|
||||
#define __MFXPLUGINPLUSPLUS_H
|
||||
|
||||
#include "mfxplugin.h"
|
||||
|
||||
// base class for MFXVideoUSER/MFXAudioUSER API
|
||||
|
||||
class MFXBaseUSER {
|
||||
public:
|
||||
explicit MFXBaseUSER(mfxSession session = NULL)
|
||||
: m_session(session){}
|
||||
|
||||
virtual ~MFXBaseUSER() {}
|
||||
|
||||
virtual mfxStatus Register(mfxU32 type, const mfxPlugin *par) = 0;
|
||||
virtual mfxStatus Unregister(mfxU32 type) = 0;
|
||||
virtual mfxStatus ProcessFrameAsync(const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp) = 0;
|
||||
|
||||
protected:
|
||||
mfxSession m_session;
|
||||
};
|
||||
|
||||
//c++ wrapper over only 3 exposed functions from MFXVideoUSER module
|
||||
class MFXVideoUSER: public MFXBaseUSER {
|
||||
public:
|
||||
explicit MFXVideoUSER(mfxSession session = NULL)
|
||||
: MFXBaseUSER(session){}
|
||||
|
||||
virtual mfxStatus Register(mfxU32 type, const mfxPlugin *par) {
|
||||
return MFXVideoUSER_Register(m_session, type, par);
|
||||
}
|
||||
virtual mfxStatus Unregister(mfxU32 type) {
|
||||
return MFXVideoUSER_Unregister(m_session, type);
|
||||
}
|
||||
virtual mfxStatus ProcessFrameAsync(const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp) {
|
||||
return MFXVideoUSER_ProcessFrameAsync(m_session, in, in_num, out, out_num, syncp);
|
||||
}
|
||||
};
|
||||
|
||||
//c++ wrapper over only 3 exposed functions from MFXAudioUSER module
|
||||
class MFXAudioUSER: public MFXBaseUSER {
|
||||
public:
|
||||
explicit MFXAudioUSER(mfxSession session = NULL)
|
||||
: MFXBaseUSER(session){}
|
||||
|
||||
virtual mfxStatus Register(mfxU32 type, const mfxPlugin *par) {
|
||||
return MFXAudioUSER_Register(m_session, type, par);
|
||||
}
|
||||
virtual mfxStatus Unregister(mfxU32 type) {
|
||||
return MFXAudioUSER_Unregister(m_session, type);
|
||||
}
|
||||
virtual mfxStatus ProcessFrameAsync(const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp) {
|
||||
return MFXAudioUSER_ProcessFrameAsync(m_session, in, in_num, out, out_num, syncp);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//initialize mfxPlugin struct
|
||||
class MFXPluginParam {
|
||||
mfxPluginParam m_param;
|
||||
|
||||
public:
|
||||
MFXPluginParam(mfxU32 CodecId, mfxU32 Type, mfxPluginUID uid, mfxThreadPolicy ThreadPolicy = MFX_THREADPOLICY_SERIAL, mfxU32 MaxThreadNum = 1)
|
||||
: m_param() {
|
||||
m_param.PluginUID = uid;
|
||||
m_param.Type = Type;
|
||||
m_param.CodecId = CodecId;
|
||||
m_param.MaxThreadNum = MaxThreadNum;
|
||||
m_param.ThreadPolicy = ThreadPolicy;
|
||||
}
|
||||
operator const mfxPluginParam& () const {
|
||||
return m_param;
|
||||
}
|
||||
operator mfxPluginParam& () {
|
||||
return m_param;
|
||||
}
|
||||
};
|
||||
|
||||
//common interface part for every plugin: decoder/encoder and generic
|
||||
struct MFXPlugin
|
||||
{
|
||||
virtual ~MFXPlugin() {};
|
||||
//init function always required for any transform or codec plugins, for codec plugins it maps to callback from MediaSDK
|
||||
//for generic plugin application should call it
|
||||
//MediaSDK mfxPlugin API mapping
|
||||
virtual mfxStatus PluginInit(mfxCoreInterface *core) = 0;
|
||||
//release CoreInterface, and destroy plugin state, not destroy plugin instance
|
||||
virtual mfxStatus PluginClose() = 0;
|
||||
virtual mfxStatus GetPluginParam(mfxPluginParam *par) = 0;
|
||||
virtual mfxStatus Execute(mfxThreadTask task, mfxU32 uid_p, mfxU32 uid_a) = 0;
|
||||
virtual mfxStatus FreeResources(mfxThreadTask task, mfxStatus sts) = 0;
|
||||
//destroy plugin due to shared module distribution model plugin wont support virtual destructor
|
||||
virtual void Release() = 0;
|
||||
//release resources associated with current instance of plugin, but do not release CoreInterface related resource set in pluginInit
|
||||
virtual mfxStatus Close() = 0;
|
||||
//communication protocol between particular version of plugin and application
|
||||
virtual mfxStatus SetAuxParams(void* auxParam, int auxParamSize) = 0;
|
||||
};
|
||||
|
||||
//common extension interface that codec plugins should expose additionally to MFXPlugin
|
||||
struct MFXCodecPlugin : MFXPlugin
|
||||
{
|
||||
virtual mfxStatus Init(mfxVideoParam *par) = 0;
|
||||
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *in, mfxFrameAllocRequest *out) = 0;
|
||||
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) =0;
|
||||
virtual mfxStatus Reset(mfxVideoParam *par) = 0;
|
||||
virtual mfxStatus GetVideoParam(mfxVideoParam *par) = 0;
|
||||
};
|
||||
|
||||
//common extension interface that audio codec plugins should expose additionally to MFXPlugin
|
||||
struct MFXAudioCodecPlugin : MFXPlugin
|
||||
{
|
||||
virtual mfxStatus Init(mfxAudioParam *par) = 0;
|
||||
virtual mfxStatus Query(mfxAudioParam *in, mfxAudioParam *out) =0;
|
||||
virtual mfxStatus QueryIOSize(mfxAudioParam *par, mfxAudioAllocRequest *request) = 0;
|
||||
virtual mfxStatus Reset(mfxAudioParam *par) = 0;
|
||||
virtual mfxStatus GetAudioParam(mfxAudioParam *par) = 0;
|
||||
};
|
||||
|
||||
//general purpose transform plugin interface, not a codec plugin
|
||||
struct MFXGenericPlugin : MFXPlugin
|
||||
{
|
||||
virtual mfxStatus Init(mfxVideoParam *par) = 0;
|
||||
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *in, mfxFrameAllocRequest *out) = 0;
|
||||
virtual mfxStatus Submit(const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxThreadTask *task) = 0;
|
||||
};
|
||||
|
||||
//decoder plugins may only support this interface
|
||||
struct MFXDecoderPlugin : MFXCodecPlugin
|
||||
{
|
||||
virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxVideoParam *par) = 0;
|
||||
virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) = 0;
|
||||
virtual mfxStatus DecodeFrameSubmit(mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task) = 0;
|
||||
};
|
||||
|
||||
//audio decoder plugins may only support this interface
|
||||
struct MFXAudioDecoderPlugin : MFXAudioCodecPlugin
|
||||
{
|
||||
virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxAudioParam *par) = 0;
|
||||
// virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) = 0;
|
||||
virtual mfxStatus DecodeFrameSubmit(mfxBitstream *in, mfxAudioFrame *out, mfxThreadTask *task) = 0;
|
||||
};
|
||||
|
||||
//encoder plugins may only support this interface
|
||||
struct MFXEncoderPlugin : MFXCodecPlugin
|
||||
{
|
||||
virtual mfxStatus EncodeFrameSubmit(mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxThreadTask *task) = 0;
|
||||
};
|
||||
|
||||
//audio encoder plugins may only support this interface
|
||||
struct MFXAudioEncoderPlugin : MFXAudioCodecPlugin
|
||||
{
|
||||
virtual mfxStatus EncodeFrameSubmit(mfxAudioFrame *aFrame, mfxBitstream *out, mfxThreadTask *task) = 0;
|
||||
};
|
||||
|
||||
//vpp plugins may only support this interface
|
||||
struct MFXVPPPlugin : MFXCodecPlugin
|
||||
{
|
||||
virtual mfxStatus VPPFrameSubmit(mfxFrameSurface1 *surface_in, mfxFrameSurface1 *surface_out, mfxExtVppAuxData *aux, mfxThreadTask *task) = 0;
|
||||
virtual mfxStatus VPPFrameSubmitEx(mfxFrameSurface1 *in, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task) = 0;
|
||||
};
|
||||
|
||||
struct MFXEncPlugin : MFXCodecPlugin
|
||||
{
|
||||
virtual mfxStatus EncFrameSubmit(mfxENCInput *in, mfxENCOutput *out, mfxThreadTask *task) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class MFXCoreInterface
|
||||
{
|
||||
protected:
|
||||
mfxCoreInterface m_core;
|
||||
public:
|
||||
|
||||
MFXCoreInterface()
|
||||
: m_core() {
|
||||
}
|
||||
MFXCoreInterface(const mfxCoreInterface & pCore)
|
||||
: m_core(pCore) {
|
||||
}
|
||||
|
||||
MFXCoreInterface(const MFXCoreInterface & that)
|
||||
: m_core(that.m_core) {
|
||||
}
|
||||
MFXCoreInterface &operator = (const MFXCoreInterface & that)
|
||||
{
|
||||
m_core = that.m_core;
|
||||
return *this;
|
||||
}
|
||||
bool IsCoreSet() {
|
||||
return m_core.pthis != 0;
|
||||
}
|
||||
mfxStatus GetCoreParam(mfxCoreParam *par) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.GetCoreParam(m_core.pthis, par);
|
||||
}
|
||||
mfxStatus GetHandle (mfxHandleType type, mfxHDL *handle) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.GetHandle(m_core.pthis, type, handle);
|
||||
}
|
||||
mfxStatus IncreaseReference (mfxFrameData *fd) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.IncreaseReference(m_core.pthis, fd);
|
||||
}
|
||||
mfxStatus DecreaseReference (mfxFrameData *fd) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.DecreaseReference(m_core.pthis, fd);
|
||||
}
|
||||
mfxStatus CopyFrame (mfxFrameSurface1 *dst, mfxFrameSurface1 *src) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.CopyFrame(m_core.pthis, dst, src);
|
||||
}
|
||||
mfxStatus CopyBuffer(mfxU8 *dst, mfxU32 size, mfxFrameSurface1 *src) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.CopyBuffer(m_core.pthis, dst, size, src);
|
||||
}
|
||||
mfxStatus MapOpaqueSurface(mfxU32 num, mfxU32 type, mfxFrameSurface1 **op_surf) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.MapOpaqueSurface(m_core.pthis, num, type, op_surf);
|
||||
}
|
||||
mfxStatus UnmapOpaqueSurface(mfxU32 num, mfxU32 type, mfxFrameSurface1 **op_surf) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.UnmapOpaqueSurface(m_core.pthis, num, type, op_surf);
|
||||
}
|
||||
mfxStatus GetRealSurface(mfxFrameSurface1 *op_surf, mfxFrameSurface1 **surf) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.GetRealSurface(m_core.pthis, op_surf, surf);
|
||||
}
|
||||
mfxStatus GetOpaqueSurface(mfxFrameSurface1 *surf, mfxFrameSurface1 **op_surf) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.GetOpaqueSurface(m_core.pthis, surf, op_surf);
|
||||
}
|
||||
mfxStatus CreateAccelerationDevice(mfxHandleType type, mfxHDL *handle) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.CreateAccelerationDevice(m_core.pthis, type, handle);
|
||||
}
|
||||
mfxFrameAllocator & FrameAllocator() {
|
||||
return m_core.FrameAllocator;
|
||||
}
|
||||
mfxStatus GetFrameHandle(mfxFrameData *fd, mfxHDL *handle) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.GetFrameHandle(m_core.pthis, fd, handle);
|
||||
}
|
||||
mfxStatus QueryPlatform(mfxPlatform *platform) {
|
||||
if (!IsCoreSet()) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
return m_core.QueryPlatform(m_core.pthis, platform);
|
||||
}
|
||||
} ;
|
||||
|
||||
/* Class adapter between "C" structure mfxPlugin and C++ interface MFXPlugin */
|
||||
|
||||
namespace detail
|
||||
{
|
||||
template <class T>
|
||||
class MFXPluginAdapterBase
|
||||
{
|
||||
protected:
|
||||
mfxPlugin m_mfxAPI;
|
||||
public:
|
||||
MFXPluginAdapterBase( T *plugin, mfxVideoCodecPlugin *pCodec = NULL)
|
||||
: m_mfxAPI()
|
||||
{
|
||||
SetupCallbacks(plugin, pCodec);
|
||||
}
|
||||
|
||||
MFXPluginAdapterBase( T *plugin, mfxAudioCodecPlugin *pCodec)
|
||||
: m_mfxAPI()
|
||||
{
|
||||
SetupCallbacks(plugin, pCodec);
|
||||
}
|
||||
|
||||
operator mfxPlugin () const {
|
||||
return m_mfxAPI;
|
||||
}
|
||||
void SetupCallbacks(T *plugin) {
|
||||
m_mfxAPI.pthis = plugin;
|
||||
m_mfxAPI.PluginInit = _PluginInit;
|
||||
m_mfxAPI.PluginClose = _PluginClose;
|
||||
m_mfxAPI.GetPluginParam = _GetPluginParam;
|
||||
m_mfxAPI.Submit = 0;
|
||||
m_mfxAPI.Execute = _Execute;
|
||||
m_mfxAPI.FreeResources = _FreeResources;
|
||||
}
|
||||
|
||||
void SetupCallbacks( T *plugin, mfxVideoCodecPlugin *pCodec) {
|
||||
SetupCallbacks(plugin);
|
||||
m_mfxAPI.Video = pCodec;
|
||||
}
|
||||
|
||||
void SetupCallbacks( T *plugin, mfxAudioCodecPlugin *pCodec) {
|
||||
SetupCallbacks(plugin);
|
||||
m_mfxAPI.Audio = pCodec;
|
||||
}
|
||||
private:
|
||||
|
||||
static mfxStatus _PluginInit(mfxHDL pthis, mfxCoreInterface *core) {
|
||||
return reinterpret_cast<T*>(pthis)->PluginInit(core);
|
||||
}
|
||||
static mfxStatus _PluginClose(mfxHDL pthis) {
|
||||
return reinterpret_cast<T*>(pthis)->PluginClose();
|
||||
}
|
||||
static mfxStatus _GetPluginParam(mfxHDL pthis, mfxPluginParam *par) {
|
||||
return reinterpret_cast<T*>(pthis)->GetPluginParam(par);
|
||||
}
|
||||
static mfxStatus _Execute(mfxHDL pthis, mfxThreadTask task, mfxU32 thread_id, mfxU32 call_count) {
|
||||
return reinterpret_cast<T*>(pthis)->Execute(task, thread_id, call_count);
|
||||
}
|
||||
static mfxStatus _FreeResources(mfxHDL pthis, mfxThreadTask task, mfxStatus sts) {
|
||||
return reinterpret_cast<T*>(pthis)->FreeResources(task, sts);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class MFXCodecPluginAdapterBase : public MFXPluginAdapterBase<T>
|
||||
{
|
||||
protected:
|
||||
//stub to feed mediasdk plugin API
|
||||
mfxVideoCodecPlugin m_codecPlg;
|
||||
public:
|
||||
MFXCodecPluginAdapterBase(T * pCodecPlg)
|
||||
: MFXPluginAdapterBase<T>(pCodecPlg, &m_codecPlg)
|
||||
, m_codecPlg()
|
||||
{
|
||||
m_codecPlg.Query = _Query;
|
||||
m_codecPlg.QueryIOSurf = _QueryIOSurf ;
|
||||
m_codecPlg.Init = _Init;
|
||||
m_codecPlg.Reset = _Reset;
|
||||
m_codecPlg.Close = _Close;
|
||||
m_codecPlg.GetVideoParam = _GetVideoParam;
|
||||
}
|
||||
MFXCodecPluginAdapterBase(const MFXCodecPluginAdapterBase<T> & that)
|
||||
: MFXPluginAdapterBase<T>(reinterpret_cast<T*>(that.m_mfxAPI.pthis), &m_codecPlg)
|
||||
, m_codecPlg() {
|
||||
SetupCallbacks();
|
||||
}
|
||||
MFXCodecPluginAdapterBase<T>& operator = (const MFXCodecPluginAdapterBase<T> & that) {
|
||||
MFXPluginAdapterBase<T> :: SetupCallbacks(reinterpret_cast<T*>(that.m_mfxAPI.pthis), &m_codecPlg);
|
||||
SetupCallbacks();
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
void SetupCallbacks() {
|
||||
m_codecPlg.Query = _Query;
|
||||
m_codecPlg.QueryIOSurf = _QueryIOSurf ;
|
||||
m_codecPlg.Init = _Init;
|
||||
m_codecPlg.Reset = _Reset;
|
||||
m_codecPlg.Close = _Close;
|
||||
m_codecPlg.GetVideoParam = _GetVideoParam;
|
||||
}
|
||||
static mfxStatus _Query(mfxHDL pthis, mfxVideoParam *in, mfxVideoParam *out) {
|
||||
return reinterpret_cast<T*>(pthis)->Query(in, out);
|
||||
}
|
||||
static mfxStatus _QueryIOSurf(mfxHDL pthis, mfxVideoParam *par, mfxFrameAllocRequest *in, mfxFrameAllocRequest *out){
|
||||
return reinterpret_cast<T*>(pthis)->QueryIOSurf(par, in, out);
|
||||
}
|
||||
static mfxStatus _Init(mfxHDL pthis, mfxVideoParam *par){
|
||||
return reinterpret_cast<T*>(pthis)->Init(par);
|
||||
}
|
||||
static mfxStatus _Reset(mfxHDL pthis, mfxVideoParam *par){
|
||||
return reinterpret_cast<T*>(pthis)->Reset(par);
|
||||
}
|
||||
static mfxStatus _Close(mfxHDL pthis) {
|
||||
return reinterpret_cast<T*>(pthis)->Close();
|
||||
}
|
||||
static mfxStatus _GetVideoParam(mfxHDL pthis, mfxVideoParam *par) {
|
||||
return reinterpret_cast<T*>(pthis)->GetVideoParam(par);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class MFXAudioCodecPluginAdapterBase : public MFXPluginAdapterBase<T>
|
||||
{
|
||||
protected:
|
||||
//stub to feed mediasdk plugin API
|
||||
mfxAudioCodecPlugin m_codecPlg;
|
||||
public:
|
||||
MFXAudioCodecPluginAdapterBase(T * pCodecPlg)
|
||||
: MFXPluginAdapterBase<T>(pCodecPlg, &m_codecPlg)
|
||||
, m_codecPlg()
|
||||
{
|
||||
m_codecPlg.Query = _Query;
|
||||
m_codecPlg.QueryIOSize = _QueryIOSize ;
|
||||
m_codecPlg.Init = _Init;
|
||||
m_codecPlg.Reset = _Reset;
|
||||
m_codecPlg.Close = _Close;
|
||||
m_codecPlg.GetAudioParam = _GetAudioParam;
|
||||
}
|
||||
MFXAudioCodecPluginAdapterBase(const MFXCodecPluginAdapterBase<T> & that)
|
||||
: MFXPluginAdapterBase<T>(reinterpret_cast<T*>(that.m_mfxAPI.pthis), &m_codecPlg)
|
||||
, m_codecPlg() {
|
||||
SetupCallbacks();
|
||||
}
|
||||
MFXAudioCodecPluginAdapterBase<T>& operator = (const MFXAudioCodecPluginAdapterBase<T> & that) {
|
||||
MFXPluginAdapterBase<T> :: SetupCallbacks(reinterpret_cast<T*>(that.m_mfxAPI.pthis), &m_codecPlg);
|
||||
SetupCallbacks();
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
void SetupCallbacks() {
|
||||
m_codecPlg.Query = _Query;
|
||||
m_codecPlg.QueryIOSize = _QueryIOSize;
|
||||
m_codecPlg.Init = _Init;
|
||||
m_codecPlg.Reset = _Reset;
|
||||
m_codecPlg.Close = _Close;
|
||||
m_codecPlg.GetAudioParam = _GetAudioParam;
|
||||
}
|
||||
static mfxStatus _Query(mfxHDL pthis, mfxAudioParam *in, mfxAudioParam *out) {
|
||||
return reinterpret_cast<T*>(pthis)->Query(in, out);
|
||||
}
|
||||
static mfxStatus _QueryIOSize(mfxHDL pthis, mfxAudioParam *par, mfxAudioAllocRequest *request){
|
||||
return reinterpret_cast<T*>(pthis)->QueryIOSize(par, request);
|
||||
}
|
||||
static mfxStatus _Init(mfxHDL pthis, mfxAudioParam *par){
|
||||
return reinterpret_cast<T*>(pthis)->Init(par);
|
||||
}
|
||||
static mfxStatus _Reset(mfxHDL pthis, mfxAudioParam *par){
|
||||
return reinterpret_cast<T*>(pthis)->Reset(par);
|
||||
}
|
||||
static mfxStatus _Close(mfxHDL pthis) {
|
||||
return reinterpret_cast<T*>(pthis)->Close();
|
||||
}
|
||||
static mfxStatus _GetAudioParam(mfxHDL pthis, mfxAudioParam *par) {
|
||||
return reinterpret_cast<T*>(pthis)->GetAudioParam(par);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct MFXPluginAdapterInternal{};
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXGenericPlugin> : public MFXPluginAdapterBase<MFXGenericPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXGenericPlugin *pPlugin)
|
||||
: MFXPluginAdapterBase<MFXGenericPlugin>(pPlugin)
|
||||
{
|
||||
m_mfxAPI.Submit = _Submit;
|
||||
}
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that )
|
||||
: MFXPluginAdapterBase<MFXGenericPlugin>(that) {
|
||||
m_mfxAPI.Submit = that._Submit;
|
||||
}
|
||||
MFXPluginAdapterInternal<MFXGenericPlugin>& operator = (const MFXPluginAdapterInternal<MFXGenericPlugin> & that) {
|
||||
MFXPluginAdapterBase<MFXGenericPlugin>::operator=(that);
|
||||
m_mfxAPI.Submit = that._Submit;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
static mfxStatus _Submit(mfxHDL pthis, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxThreadTask *task) {
|
||||
return reinterpret_cast<MFXGenericPlugin*>(pthis)->Submit(in, in_num, out, out_num, task);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXDecoderPlugin> : public MFXCodecPluginAdapterBase<MFXDecoderPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXDecoderPlugin *pPlugin)
|
||||
: MFXCodecPluginAdapterBase<MFXDecoderPlugin>(pPlugin)
|
||||
{
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXCodecPluginAdapterBase<MFXDecoderPlugin>(that) {
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXDecoderPlugin>& operator = (const MFXPluginAdapterInternal<MFXDecoderPlugin> & that) {
|
||||
MFXCodecPluginAdapterBase<MFXDecoderPlugin>::operator=(that);
|
||||
SetupCallbacks();
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
void SetupCallbacks() {
|
||||
m_codecPlg.DecodeHeader = _DecodeHeader;
|
||||
m_codecPlg.GetPayload = _GetPayload;
|
||||
m_codecPlg.DecodeFrameSubmit = _DecodeFrameSubmit;
|
||||
}
|
||||
static mfxStatus _DecodeHeader(mfxHDL pthis, mfxBitstream *bs, mfxVideoParam *par) {
|
||||
return reinterpret_cast<MFXDecoderPlugin*>(pthis)->DecodeHeader(bs, par);
|
||||
}
|
||||
static mfxStatus _GetPayload(mfxHDL pthis, mfxU64 *ts, mfxPayload *payload) {
|
||||
return reinterpret_cast<MFXDecoderPlugin*>(pthis)->GetPayload(ts, payload);
|
||||
}
|
||||
static mfxStatus _DecodeFrameSubmit(mfxHDL pthis, mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task) {
|
||||
return reinterpret_cast<MFXDecoderPlugin*>(pthis)->DecodeFrameSubmit(bs, surface_work, surface_out, task);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXAudioDecoderPlugin> : public MFXAudioCodecPluginAdapterBase<MFXAudioDecoderPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXAudioDecoderPlugin *pPlugin)
|
||||
: MFXAudioCodecPluginAdapterBase<MFXAudioDecoderPlugin>(pPlugin)
|
||||
{
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXAudioCodecPluginAdapterBase<MFXAudioDecoderPlugin>(that) {
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXAudioDecoderPlugin>& operator = (const MFXPluginAdapterInternal<MFXAudioDecoderPlugin> & that) {
|
||||
MFXAudioCodecPluginAdapterBase<MFXAudioDecoderPlugin>::operator=(that);
|
||||
SetupCallbacks();
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
void SetupCallbacks() {
|
||||
m_codecPlg.DecodeHeader = _DecodeHeader;
|
||||
m_codecPlg.DecodeFrameSubmit = _DecodeFrameSubmit;
|
||||
}
|
||||
static mfxStatus _DecodeHeader(mfxHDL pthis, mfxBitstream *bs, mfxAudioParam *par) {
|
||||
return reinterpret_cast<MFXAudioDecoderPlugin*>(pthis)->DecodeHeader(bs, par);
|
||||
}
|
||||
static mfxStatus _DecodeFrameSubmit(mfxHDL pthis, mfxBitstream *in, mfxAudioFrame *out, mfxThreadTask *task) {
|
||||
return reinterpret_cast<MFXAudioDecoderPlugin*>(pthis)->DecodeFrameSubmit(in, out, task);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXEncoderPlugin> : public MFXCodecPluginAdapterBase<MFXEncoderPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXEncoderPlugin *pPlugin)
|
||||
: MFXCodecPluginAdapterBase<MFXEncoderPlugin>(pPlugin)
|
||||
{
|
||||
m_codecPlg.EncodeFrameSubmit = _EncodeFrameSubmit;
|
||||
}
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXCodecPluginAdapterBase<MFXEncoderPlugin>(that) {
|
||||
m_codecPlg.EncodeFrameSubmit = _EncodeFrameSubmit;
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXEncoderPlugin>& operator = (const MFXPluginAdapterInternal<MFXEncoderPlugin> & that) {
|
||||
MFXCodecPluginAdapterBase<MFXEncoderPlugin>::operator = (that);
|
||||
m_codecPlg.EncodeFrameSubmit = _EncodeFrameSubmit;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
static mfxStatus _EncodeFrameSubmit(mfxHDL pthis, mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxThreadTask *task) {
|
||||
return reinterpret_cast<MFXEncoderPlugin*>(pthis)->EncodeFrameSubmit(ctrl, surface, bs, task);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXAudioEncoderPlugin> : public MFXAudioCodecPluginAdapterBase<MFXAudioEncoderPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXAudioEncoderPlugin *pPlugin)
|
||||
: MFXAudioCodecPluginAdapterBase<MFXAudioEncoderPlugin>(pPlugin)
|
||||
{
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXAudioCodecPluginAdapterBase<MFXAudioEncoderPlugin>(that) {
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXAudioEncoderPlugin>& operator = (const MFXPluginAdapterInternal<MFXAudioEncoderPlugin> & that) {
|
||||
MFXAudioCodecPluginAdapterBase<MFXAudioEncoderPlugin>::operator=(that);
|
||||
SetupCallbacks();
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
void SetupCallbacks() {
|
||||
m_codecPlg.EncodeFrameSubmit = _EncodeFrameSubmit;
|
||||
}
|
||||
static mfxStatus _EncodeFrameSubmit(mfxHDL pthis, mfxAudioFrame *aFrame, mfxBitstream *out, mfxThreadTask *task) {
|
||||
return reinterpret_cast<MFXAudioEncoderPlugin*>(pthis)->EncodeFrameSubmit(aFrame, out, task);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXEncPlugin> : public MFXCodecPluginAdapterBase<MFXEncPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXEncPlugin *pPlugin)
|
||||
: MFXCodecPluginAdapterBase<MFXEncPlugin>(pPlugin)
|
||||
{
|
||||
m_codecPlg.ENCFrameSubmit = _ENCFrameSubmit;
|
||||
}
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXCodecPluginAdapterBase<MFXEncPlugin>(that) {
|
||||
m_codecPlg.ENCFrameSubmit = _ENCFrameSubmit;
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXEncPlugin>& operator = (const MFXPluginAdapterInternal<MFXEncPlugin> & that) {
|
||||
MFXCodecPluginAdapterBase<MFXEncPlugin>::operator = (that);
|
||||
m_codecPlg.ENCFrameSubmit = _ENCFrameSubmit;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
static mfxStatus _ENCFrameSubmit(mfxHDL pthis,mfxENCInput *in, mfxENCOutput *out, mfxThreadTask *task) {
|
||||
return reinterpret_cast<MFXEncPlugin*>(pthis)->EncFrameSubmit(in, out, task);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<>
|
||||
class MFXPluginAdapterInternal<MFXVPPPlugin> : public MFXCodecPluginAdapterBase<MFXVPPPlugin>
|
||||
{
|
||||
public:
|
||||
MFXPluginAdapterInternal(MFXVPPPlugin *pPlugin)
|
||||
: MFXCodecPluginAdapterBase<MFXVPPPlugin>(pPlugin)
|
||||
{
|
||||
SetupCallbacks();
|
||||
}
|
||||
MFXPluginAdapterInternal(const MFXPluginAdapterInternal & that)
|
||||
: MFXCodecPluginAdapterBase<MFXVPPPlugin>(that) {
|
||||
SetupCallbacks();
|
||||
}
|
||||
|
||||
MFXPluginAdapterInternal<MFXVPPPlugin>& operator = (const MFXPluginAdapterInternal<MFXVPPPlugin> & that) {
|
||||
MFXCodecPluginAdapterBase<MFXVPPPlugin>::operator = (that);
|
||||
SetupCallbacks();
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
void SetupCallbacks() {
|
||||
m_codecPlg.VPPFrameSubmit = _VPPFrameSubmit;
|
||||
m_codecPlg.VPPFrameSubmitEx = _VPPFrameSubmitEx;
|
||||
}
|
||||
static mfxStatus _VPPFrameSubmit(mfxHDL pthis, mfxFrameSurface1 *surface_in, mfxFrameSurface1 *surface_out, mfxExtVppAuxData *aux, mfxThreadTask *task) {
|
||||
return reinterpret_cast<MFXVPPPlugin*>(pthis)->VPPFrameSubmit(surface_in, surface_out, aux, task);
|
||||
}
|
||||
static mfxStatus _VPPFrameSubmitEx(mfxHDL pthis, mfxFrameSurface1 *surface_in, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task) {
|
||||
return reinterpret_cast<MFXVPPPlugin*>(pthis)->VPPFrameSubmitEx(surface_in, surface_work, surface_out, task);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/* adapter for particular plugin type*/
|
||||
template<class T>
|
||||
class MFXPluginAdapter
|
||||
{
|
||||
public:
|
||||
detail::MFXPluginAdapterInternal<T> m_Adapter;
|
||||
|
||||
operator mfxPlugin () const {
|
||||
return m_Adapter.operator mfxPlugin();
|
||||
}
|
||||
|
||||
MFXPluginAdapter(T* pPlugin = NULL)
|
||||
: m_Adapter(pPlugin)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
inline MFXPluginAdapter<T> make_mfx_plugin_adapter(T* pPlugin) {
|
||||
|
||||
MFXPluginAdapter<T> adapt(pPlugin);
|
||||
return adapt;
|
||||
}
|
||||
|
||||
#endif // __MFXPLUGINPLUSPLUS_H
|
||||
227
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxplugin.h
vendored
Normal file
227
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxplugin.h
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
// Copyright (c) 2018-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXPLUGIN_H__
|
||||
#define __MFXPLUGIN_H__
|
||||
#include "mfxvideo.h"
|
||||
#include "mfxaudio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxU8 Data[16];
|
||||
} mfxPluginUID;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCD_SW = {{0x15, 0xdd, 0x93, 0x68, 0x25, 0xad, 0x47, 0x5e, 0xa3, 0x4e, 0x35, 0xf3, 0xf5, 0x42, 0x17, 0xa6}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCD_HW = {{0x33, 0xa6, 0x1c, 0x0b, 0x4c, 0x27, 0x45, 0x4c, 0xa8, 0xd8, 0x5d, 0xde, 0x75, 0x7c, 0x6f, 0x8e}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCE_SW = {{0x2f, 0xca, 0x99, 0x74, 0x9f, 0xdb, 0x49, 0xae, 0xb1, 0x21, 0xa5, 0xb6, 0x3e, 0xf5, 0x68, 0xf7}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCE_GACC = {{0xe5, 0x40, 0x0a, 0x06, 0xc7, 0x4d, 0x41, 0xf5, 0xb1, 0x2d, 0x43, 0x0b, 0xba, 0xa2, 0x3d, 0x0b}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCE_DP_GACC = {{0x2b, 0xad, 0x6f, 0x9d, 0x77, 0x54, 0x41, 0x2d, 0xbf, 0x63, 0x03, 0xed, 0x4b, 0xb5, 0x09, 0x68}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCE_HW = {{0x6f, 0xad, 0xc7, 0x91, 0xa0, 0xc2, 0xeb, 0x47, 0x9a, 0xb6, 0xdc, 0xd5, 0xea, 0x9d, 0xa3, 0x47}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_VP8D_HW = {{0xf6, 0x22, 0x39, 0x4d, 0x8d, 0x87, 0x45, 0x2f, 0x87, 0x8c, 0x51, 0xf2, 0xfc, 0x9b, 0x41, 0x31}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_VP8E_HW = {{0xbf, 0xfc, 0x51, 0x8c, 0xde, 0x13, 0x4d, 0xf9, 0x8a, 0x96, 0xf4, 0xcf, 0x81, 0x6c, 0x0f, 0xac}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_VP9E_HW = {{0xce, 0x44, 0xef, 0x6f, 0x1a, 0x6d, 0x22, 0x46, 0xb4, 0x12, 0xbb, 0x38, 0xd6, 0xe4, 0x51, 0x82}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_VP9D_HW = {{0xa9, 0x22, 0x39, 0x4d, 0x8d, 0x87, 0x45, 0x2f, 0x87, 0x8c, 0x51, 0xf2, 0xfc, 0x9b, 0x41, 0x31}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_CAMERA_HW = {{0x54, 0x54, 0x26, 0x16, 0x24, 0x33, 0x41, 0xe6, 0x93, 0xae, 0x89, 0x99, 0x42, 0xce, 0x73, 0x55}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_CAPTURE_HW = {{0x22, 0xd6, 0x2c, 0x07, 0xe6, 0x72, 0x40, 0x8f, 0xbb, 0x4c, 0xc2, 0x0e, 0xd7, 0xa0, 0x53, 0xe4}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_ITELECINE_HW = {{0xe7, 0x44, 0x75, 0x3a, 0xcd, 0x74, 0x40, 0x2e, 0x89, 0xa2, 0xee, 0x06, 0x35, 0x49, 0x61, 0x79}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_H264LA_HW = {{0x58, 0x8f, 0x11, 0x85, 0xd4, 0x7b, 0x42, 0x96, 0x8d, 0xea, 0x37, 0x7b, 0xb5, 0xd0, 0xdc, 0xb4}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_AACD = {{0xe9, 0x34, 0x67, 0x25, 0xac, 0x2f, 0x4c, 0x93, 0xaa, 0x58, 0x5c, 0x11, 0xc7, 0x08, 0x7c, 0xf4}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_AACE = {{0xb2, 0xa2, 0xa0, 0x5a, 0x4e, 0xac, 0x46, 0xbf, 0xa9, 0xde, 0x7e, 0x80, 0xc9, 0x8d, 0x2e, 0x18}};
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVCE_FEI_HW = {{0x87, 0xe0, 0xe8, 0x02, 0x07, 0x37, 0x52, 0x40, 0x85, 0x25, 0x15, 0xcf, 0x4a, 0x5e, 0xdd, 0xe6}};
|
||||
#if (MFX_VERSION >= 1027)
|
||||
MFX_DEPRECATED static const mfxPluginUID MFX_PLUGINID_HEVC_FEI_ENCODE = {{0x54, 0x18, 0xa7, 0x06, 0x66, 0xf9, 0x4d, 0x5c, 0xb4, 0xf7, 0xb1, 0xca, 0xee, 0x86, 0x33, 0x9b}};
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum {
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_VIDEO_GENERAL) = 0,
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_VIDEO_DECODE) = 1,
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_VIDEO_ENCODE) = 2,
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_VIDEO_VPP) = 3,
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_VIDEO_ENC) = 4,
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_AUDIO_DECODE) = 5,
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_PLUGINTYPE_AUDIO_ENCODE) = 6
|
||||
} mfxPluginType;
|
||||
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_VIDEO_GENERAL);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_VIDEO_DECODE);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_VIDEO_ENCODE);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_VIDEO_VPP);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_VIDEO_ENC);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_AUDIO_DECODE);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_PLUGINTYPE_AUDIO_ENCODE);
|
||||
|
||||
typedef enum {
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_THREADPOLICY_SERIAL) = 0,
|
||||
MFX_DEPRECATED_ENUM_FIELD_INSIDE(MFX_THREADPOLICY_PARALLEL) = 1
|
||||
} mfxThreadPolicy;
|
||||
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_THREADPOLICY_SERIAL);
|
||||
MFX_DEPRECATED_ENUM_FIELD_OUTSIDE(MFX_THREADPOLICY_PARALLEL);
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct mfxPluginParam {
|
||||
mfxU32 reserved[6];
|
||||
mfxU16 reserved1;
|
||||
mfxU16 PluginVersion;
|
||||
mfxVersion APIVersion;
|
||||
mfxPluginUID PluginUID;
|
||||
mfxU32 Type;
|
||||
mfxU32 CodecId;
|
||||
mfxThreadPolicy ThreadPolicy;
|
||||
mfxU32 MaxThreadNum;
|
||||
} mfxPluginParam;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
MFX_DEPRECATED typedef struct mfxCoreParam{
|
||||
mfxU32 reserved[13];
|
||||
mfxIMPL Impl;
|
||||
mfxVersion Version;
|
||||
mfxU32 NumWorkingThread;
|
||||
} mfxCoreParam;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct mfxCoreInterface {
|
||||
mfxHDL pthis;
|
||||
|
||||
mfxHDL reserved1[2];
|
||||
mfxFrameAllocator FrameAllocator;
|
||||
mfxBufferAllocator reserved3;
|
||||
|
||||
mfxStatus (MFX_CDECL *GetCoreParam)(mfxHDL pthis, mfxCoreParam *par);
|
||||
mfxStatus (MFX_CDECL *GetHandle) (mfxHDL pthis, mfxHandleType type, mfxHDL *handle);
|
||||
mfxStatus (MFX_CDECL *IncreaseReference) (mfxHDL pthis, mfxFrameData *fd);
|
||||
mfxStatus (MFX_CDECL *DecreaseReference) (mfxHDL pthis, mfxFrameData *fd);
|
||||
mfxStatus (MFX_CDECL *CopyFrame) (mfxHDL pthis, mfxFrameSurface1 *dst, mfxFrameSurface1 *src);
|
||||
mfxStatus (MFX_CDECL *CopyBuffer)(mfxHDL pthis, mfxU8 *dst, mfxU32 size, mfxFrameSurface1 *src);
|
||||
|
||||
mfxStatus (MFX_CDECL *MapOpaqueSurface)(mfxHDL pthis, mfxU32 num, mfxU32 type, mfxFrameSurface1 **op_surf);
|
||||
mfxStatus (MFX_CDECL *UnmapOpaqueSurface)(mfxHDL pthis, mfxU32 num, mfxU32 type, mfxFrameSurface1 **op_surf);
|
||||
|
||||
mfxStatus (MFX_CDECL *GetRealSurface)(mfxHDL pthis, mfxFrameSurface1 *op_surf, mfxFrameSurface1 **surf);
|
||||
mfxStatus (MFX_CDECL *GetOpaqueSurface)(mfxHDL pthis, mfxFrameSurface1 *surf, mfxFrameSurface1 **op_surf);
|
||||
|
||||
mfxStatus (MFX_CDECL *CreateAccelerationDevice)(mfxHDL pthis, mfxHandleType type, mfxHDL *handle);
|
||||
mfxStatus (MFX_CDECL *GetFrameHandle) (mfxHDL pthis, mfxFrameData *fd, mfxHDL *handle);
|
||||
mfxStatus (MFX_CDECL *QueryPlatform) (mfxHDL pthis, mfxPlatform *platform);
|
||||
|
||||
mfxHDL reserved4[1];
|
||||
} mfxCoreInterface;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
/* video codec plugin extension */
|
||||
MFX_DEPRECATED typedef struct _mfxENCInput mfxENCInput;
|
||||
MFX_DEPRECATED typedef struct _mfxENCOutput mfxENCOutput;
|
||||
MFX_DEPRECATED typedef struct mfxVideoCodecPlugin{
|
||||
mfxStatus (MFX_CDECL *Query)(mfxHDL pthis, mfxVideoParam *in, mfxVideoParam *out);
|
||||
mfxStatus (MFX_CDECL *QueryIOSurf)(mfxHDL pthis, mfxVideoParam *par, mfxFrameAllocRequest *in, mfxFrameAllocRequest *out);
|
||||
mfxStatus (MFX_CDECL *Init)(mfxHDL pthis, mfxVideoParam *par);
|
||||
mfxStatus (MFX_CDECL *Reset)(mfxHDL pthis, mfxVideoParam *par);
|
||||
mfxStatus (MFX_CDECL *Close)(mfxHDL pthis);
|
||||
mfxStatus (MFX_CDECL *GetVideoParam)(mfxHDL pthis, mfxVideoParam *par);
|
||||
|
||||
mfxStatus (MFX_CDECL *EncodeFrameSubmit)(mfxHDL pthis, mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxThreadTask *task);
|
||||
|
||||
mfxStatus (MFX_CDECL *DecodeHeader)(mfxHDL pthis, mfxBitstream *bs, mfxVideoParam *par);
|
||||
mfxStatus (MFX_CDECL *GetPayload)(mfxHDL pthis, mfxU64 *ts, mfxPayload *payload);
|
||||
mfxStatus (MFX_CDECL *DecodeFrameSubmit)(mfxHDL pthis, mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task);
|
||||
|
||||
mfxStatus (MFX_CDECL *VPPFrameSubmit)(mfxHDL pthis, mfxFrameSurface1 *in, mfxFrameSurface1 *out, mfxExtVppAuxData *aux, mfxThreadTask *task);
|
||||
mfxStatus (MFX_CDECL *VPPFrameSubmitEx)(mfxHDL pthis, mfxFrameSurface1 *in, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxThreadTask *task);
|
||||
|
||||
mfxStatus (MFX_CDECL *ENCFrameSubmit)(mfxHDL pthis, mfxENCInput *in, mfxENCOutput *out, mfxThreadTask *task);
|
||||
|
||||
mfxHDL reserved1[3];
|
||||
mfxU32 reserved2[8];
|
||||
} mfxVideoCodecPlugin;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct mfxAudioCodecPlugin{
|
||||
mfxStatus (MFX_CDECL *Query)(mfxHDL pthis, mfxAudioParam *in, mfxAudioParam *out);
|
||||
mfxStatus (MFX_CDECL *QueryIOSize)(mfxHDL pthis, mfxAudioParam *par, mfxAudioAllocRequest *request);
|
||||
mfxStatus (MFX_CDECL *Init)(mfxHDL pthis, mfxAudioParam *par);
|
||||
mfxStatus (MFX_CDECL *Reset)(mfxHDL pthis, mfxAudioParam *par);
|
||||
mfxStatus (MFX_CDECL *Close)(mfxHDL pthis);
|
||||
mfxStatus (MFX_CDECL *GetAudioParam)(mfxHDL pthis, mfxAudioParam *par);
|
||||
|
||||
mfxStatus (MFX_CDECL *EncodeFrameSubmit)(mfxHDL pthis, mfxAudioFrame *aFrame, mfxBitstream *out, mfxThreadTask *task);
|
||||
|
||||
mfxStatus (MFX_CDECL *DecodeHeader)(mfxHDL pthis, mfxBitstream *bs, mfxAudioParam *par);
|
||||
// mfxStatus (MFX_CDECL *GetPayload)(mfxHDL pthis, mfxU64 *ts, mfxPayload *payload);
|
||||
mfxStatus (MFX_CDECL *DecodeFrameSubmit)(mfxHDL pthis, mfxBitstream *in, mfxAudioFrame *out, mfxThreadTask *task);
|
||||
|
||||
mfxHDL reserved1[6];
|
||||
mfxU32 reserved2[8];
|
||||
} mfxAudioCodecPlugin;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
MFX_DEPRECATED typedef struct mfxPlugin{
|
||||
mfxHDL pthis;
|
||||
|
||||
mfxStatus (MFX_CDECL *PluginInit) (mfxHDL pthis, mfxCoreInterface *core);
|
||||
mfxStatus (MFX_CDECL *PluginClose) (mfxHDL pthis);
|
||||
|
||||
mfxStatus (MFX_CDECL *GetPluginParam)(mfxHDL pthis, mfxPluginParam *par);
|
||||
|
||||
mfxStatus (MFX_CDECL *Submit)(mfxHDL pthis, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxThreadTask *task);
|
||||
mfxStatus (MFX_CDECL *Execute)(mfxHDL pthis, mfxThreadTask task, mfxU32 uid_p, mfxU32 uid_a);
|
||||
mfxStatus (MFX_CDECL *FreeResources)(mfxHDL pthis, mfxThreadTask task, mfxStatus sts);
|
||||
|
||||
union {
|
||||
mfxVideoCodecPlugin *Video;
|
||||
mfxAudioCodecPlugin *Audio;
|
||||
};
|
||||
|
||||
mfxHDL reserved[8];
|
||||
} mfxPlugin;
|
||||
MFX_PACK_END()
|
||||
|
||||
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_Register(mfxSession session, mfxU32 type, const mfxPlugin *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_Unregister(mfxSession session, mfxU32 type);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_GetPlugin(mfxSession session, mfxU32 type, mfxPlugin *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_ProcessFrameAsync(mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp);
|
||||
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_LoadByPath(mfxSession session, const mfxPluginUID *uid, mfxU32 version, const mfxChar *path, mfxU32 len);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoUSER_UnLoad(mfxSession session, const mfxPluginUID *uid);
|
||||
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioUSER_Register(mfxSession session, mfxU32 type, const mfxPlugin *par);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioUSER_Unregister(mfxSession session, mfxU32 type);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioUSER_ProcessFrameAsync(mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp);
|
||||
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXAudioUSER_UnLoad(mfxSession session, const mfxPluginUID *uid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MFXPLUGIN_H__ */
|
||||
54
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxsc.h
vendored
Normal file
54
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxsc.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
// Copyright (c) 2018-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXSC_H__
|
||||
#define __MFXSC_H__
|
||||
#include "mfxdefs.h"
|
||||
#include "mfxvstructures.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Extended Buffer Ids */
|
||||
enum
|
||||
{
|
||||
MFX_EXTBUFF_SCREEN_CAPTURE_PARAM = MFX_MAKEFOURCC('S','C','P','A')
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct
|
||||
{
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU32 DisplayIndex;
|
||||
mfxU16 EnableDirtyRect;
|
||||
mfxU16 EnableCursorCapture;
|
||||
mfxU16 reserved[24];
|
||||
} mfxExtScreenCaptureParam;
|
||||
MFX_PACK_END()
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
61
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxscd.h
vendored
Normal file
61
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxscd.h
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
// Copyright (c) 2018-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXSCD_H__
|
||||
#define __MFXSCD_H__
|
||||
|
||||
#include "mfxenc.h"
|
||||
#include "mfxplugin.h"
|
||||
|
||||
#define MFX_ENC_SCD_PLUGIN_VERSION 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static const mfxPluginUID MFX_PLUGINID_ENC_SCD = {{ 0xdf, 0xc2, 0x15, 0xb3, 0xe3, 0xd3, 0x90, 0x4d, 0x7f, 0xa5, 0x04, 0x12, 0x7e, 0xf5, 0x64, 0xd5 }};
|
||||
|
||||
/* SCD Extended Buffer Ids */
|
||||
enum {
|
||||
MFX_EXTBUFF_SCD = MFX_MAKEFOURCC('S','C','D',' ')
|
||||
};
|
||||
|
||||
/* SceneType */
|
||||
enum {
|
||||
MFX_SCD_SCENE_SAME = 0x00,
|
||||
MFX_SCD_SCENE_NEW_FIELD_1 = 0x01,
|
||||
MFX_SCD_SCENE_NEW_FIELD_2 = 0x02,
|
||||
MFX_SCD_SCENE_NEW_PICTURE = MFX_SCD_SCENE_NEW_FIELD_1 | MFX_SCD_SCENE_NEW_FIELD_2
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 SceneType;
|
||||
mfxU16 reserved[27];
|
||||
} mfxExtSCD;
|
||||
MFX_PACK_END()
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
50
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxsession.h
vendored
Normal file
50
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxsession.h
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2017 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXSESSION_H__
|
||||
#define __MFXSESSION_H__
|
||||
#include "mfxcommon.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Global Functions */
|
||||
typedef struct _mfxSession *mfxSession;
|
||||
mfxStatus MFX_CDECL MFXInit(mfxIMPL impl, mfxVersion *ver, mfxSession *session);
|
||||
mfxStatus MFX_CDECL MFXInitEx(mfxInitParam par, mfxSession *session);
|
||||
mfxStatus MFX_CDECL MFXClose(mfxSession session);
|
||||
|
||||
mfxStatus MFX_CDECL MFXQueryIMPL(mfxSession session, mfxIMPL *impl);
|
||||
mfxStatus MFX_CDECL MFXQueryVersion(mfxSession session, mfxVersion *version);
|
||||
|
||||
mfxStatus MFX_CDECL MFXJoinSession(mfxSession session, mfxSession child);
|
||||
mfxStatus MFX_CDECL MFXDisjoinSession(mfxSession session);
|
||||
mfxStatus MFX_CDECL MFXCloneSession(mfxSession session, mfxSession *clone);
|
||||
mfxStatus MFX_CDECL MFXSetPriority(mfxSession session, mfxPriority priority);
|
||||
mfxStatus MFX_CDECL MFXGetPriority(mfxSession session, mfxPriority *priority);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXDoWork(mfxSession session);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
2521
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxstructures.h
vendored
Normal file
2521
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxstructures.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
188
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxvideo++.h
vendored
Normal file
188
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxvideo++.h
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
// Copyright (c) 2017 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#ifndef __MFXVIDEOPLUSPLUS_H
|
||||
#define __MFXVIDEOPLUSPLUS_H
|
||||
|
||||
#include "mfxvideo.h"
|
||||
#include "mfxenc.h"
|
||||
#include "mfxpak.h"
|
||||
|
||||
class MFXVideoSession
|
||||
{
|
||||
public:
|
||||
MFXVideoSession(void) { m_session = (mfxSession) 0; }
|
||||
virtual ~MFXVideoSession(void) { Close(); }
|
||||
|
||||
virtual mfxStatus Init(mfxIMPL impl, mfxVersion *ver) { return MFXInit(impl, ver, &m_session); }
|
||||
virtual mfxStatus InitEx(mfxInitParam par) { return MFXInitEx(par, &m_session); }
|
||||
virtual mfxStatus Close(void)
|
||||
{
|
||||
mfxStatus mfxRes;
|
||||
mfxRes = MFXClose(m_session); m_session = (mfxSession) 0;
|
||||
return mfxRes;
|
||||
}
|
||||
|
||||
virtual mfxStatus QueryIMPL(mfxIMPL *impl) { return MFXQueryIMPL(m_session, impl); }
|
||||
virtual mfxStatus QueryVersion(mfxVersion *version) { return MFXQueryVersion(m_session, version); }
|
||||
|
||||
virtual mfxStatus JoinSession(mfxSession child_session) { return MFXJoinSession(m_session, child_session);}
|
||||
virtual mfxStatus DisjoinSession( ) { return MFXDisjoinSession(m_session);}
|
||||
virtual mfxStatus CloneSession( mfxSession *clone) { return MFXCloneSession(m_session, clone);}
|
||||
virtual mfxStatus SetPriority( mfxPriority priority) { return MFXSetPriority(m_session, priority);}
|
||||
virtual mfxStatus GetPriority( mfxPriority *priority) { return MFXGetPriority(m_session, priority);}
|
||||
|
||||
MFX_DEPRECATED virtual mfxStatus SetBufferAllocator(mfxBufferAllocator *allocator) { return MFXVideoCORE_SetBufferAllocator(m_session, allocator); }
|
||||
virtual mfxStatus SetFrameAllocator(mfxFrameAllocator *allocator) { return MFXVideoCORE_SetFrameAllocator(m_session, allocator); }
|
||||
virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl) { return MFXVideoCORE_SetHandle(m_session, type, hdl); }
|
||||
virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *hdl) { return MFXVideoCORE_GetHandle(m_session, type, hdl); }
|
||||
virtual mfxStatus QueryPlatform(mfxPlatform* platform) { return MFXVideoCORE_QueryPlatform(m_session, platform); }
|
||||
|
||||
virtual mfxStatus SyncOperation(mfxSyncPoint syncp, mfxU32 wait) { return MFXVideoCORE_SyncOperation(m_session, syncp, wait); }
|
||||
|
||||
virtual mfxStatus DoWork() { return MFXDoWork(m_session); }
|
||||
|
||||
virtual operator mfxSession (void) { return m_session; }
|
||||
|
||||
protected:
|
||||
|
||||
mfxSession m_session; // (mfxSession) handle to the owning session
|
||||
private:
|
||||
MFXVideoSession(const MFXVideoSession &);
|
||||
void operator=(MFXVideoSession &);
|
||||
};
|
||||
|
||||
class MFXVideoENCODE
|
||||
{
|
||||
public:
|
||||
|
||||
MFXVideoENCODE(mfxSession session) { m_session = session; }
|
||||
virtual ~MFXVideoENCODE(void) { Close(); }
|
||||
|
||||
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { return MFXVideoENCODE_Query(m_session, in, out); }
|
||||
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) { return MFXVideoENCODE_QueryIOSurf(m_session, par, request); }
|
||||
virtual mfxStatus Init(mfxVideoParam *par) { return MFXVideoENCODE_Init(m_session, par); }
|
||||
virtual mfxStatus Reset(mfxVideoParam *par) { return MFXVideoENCODE_Reset(m_session, par); }
|
||||
virtual mfxStatus Close(void) { return MFXVideoENCODE_Close(m_session); }
|
||||
|
||||
virtual mfxStatus GetVideoParam(mfxVideoParam *par) { return MFXVideoENCODE_GetVideoParam(m_session, par); }
|
||||
virtual mfxStatus GetEncodeStat(mfxEncodeStat *stat) { return MFXVideoENCODE_GetEncodeStat(m_session, stat); }
|
||||
|
||||
virtual mfxStatus EncodeFrameAsync(mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxSyncPoint *syncp) { return MFXVideoENCODE_EncodeFrameAsync(m_session, ctrl, surface, bs, syncp); }
|
||||
|
||||
protected:
|
||||
|
||||
mfxSession m_session; // (mfxSession) handle to the owning session
|
||||
};
|
||||
|
||||
class MFXVideoDECODE
|
||||
{
|
||||
public:
|
||||
|
||||
MFXVideoDECODE(mfxSession session) { m_session = session; }
|
||||
virtual ~MFXVideoDECODE(void) { Close(); }
|
||||
|
||||
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { return MFXVideoDECODE_Query(m_session, in, out); }
|
||||
virtual mfxStatus DecodeHeader(mfxBitstream *bs, mfxVideoParam *par) { return MFXVideoDECODE_DecodeHeader(m_session, bs, par); }
|
||||
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) { return MFXVideoDECODE_QueryIOSurf(m_session, par, request); }
|
||||
virtual mfxStatus Init(mfxVideoParam *par) { return MFXVideoDECODE_Init(m_session, par); }
|
||||
virtual mfxStatus Reset(mfxVideoParam *par) { return MFXVideoDECODE_Reset(m_session, par); }
|
||||
virtual mfxStatus Close(void) { return MFXVideoDECODE_Close(m_session); }
|
||||
|
||||
virtual mfxStatus GetVideoParam(mfxVideoParam *par) { return MFXVideoDECODE_GetVideoParam(m_session, par); }
|
||||
|
||||
virtual mfxStatus GetDecodeStat(mfxDecodeStat *stat) { return MFXVideoDECODE_GetDecodeStat(m_session, stat); }
|
||||
virtual mfxStatus GetPayload(mfxU64 *ts, mfxPayload *payload) {return MFXVideoDECODE_GetPayload(m_session, ts, payload); }
|
||||
virtual mfxStatus SetSkipMode(mfxSkipMode mode) { return MFXVideoDECODE_SetSkipMode(m_session, mode); }
|
||||
virtual mfxStatus DecodeFrameAsync(mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxSyncPoint *syncp) { return MFXVideoDECODE_DecodeFrameAsync(m_session, bs, surface_work, surface_out, syncp); }
|
||||
|
||||
protected:
|
||||
|
||||
mfxSession m_session; // (mfxSession) handle to the owning session
|
||||
};
|
||||
|
||||
class MFXVideoVPP
|
||||
{
|
||||
public:
|
||||
|
||||
MFXVideoVPP(mfxSession session) { m_session = session; }
|
||||
virtual ~MFXVideoVPP(void) { Close(); }
|
||||
|
||||
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { return MFXVideoVPP_Query(m_session, in, out); }
|
||||
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest request[2]) { return MFXVideoVPP_QueryIOSurf(m_session, par, request); }
|
||||
virtual mfxStatus Init(mfxVideoParam *par) { return MFXVideoVPP_Init(m_session, par); }
|
||||
virtual mfxStatus Reset(mfxVideoParam *par) { return MFXVideoVPP_Reset(m_session, par); }
|
||||
virtual mfxStatus Close(void) { return MFXVideoVPP_Close(m_session); }
|
||||
|
||||
virtual mfxStatus GetVideoParam(mfxVideoParam *par) { return MFXVideoVPP_GetVideoParam(m_session, par); }
|
||||
virtual mfxStatus GetVPPStat(mfxVPPStat *stat) { return MFXVideoVPP_GetVPPStat(m_session, stat); }
|
||||
virtual mfxStatus RunFrameVPPAsync(mfxFrameSurface1 *in, mfxFrameSurface1 *out, mfxExtVppAuxData *aux, mfxSyncPoint *syncp) { return MFXVideoVPP_RunFrameVPPAsync(m_session, in, out, aux, syncp); }
|
||||
virtual mfxStatus RunFrameVPPAsyncEx(mfxFrameSurface1 *in, mfxFrameSurface1 *work, mfxFrameSurface1 **out, mfxSyncPoint *syncp) {return MFXVideoVPP_RunFrameVPPAsyncEx(m_session, in, work, out, syncp); }
|
||||
|
||||
protected:
|
||||
|
||||
mfxSession m_session; // (mfxSession) handle to the owning session
|
||||
};
|
||||
|
||||
class MFXVideoENC
|
||||
{
|
||||
public:
|
||||
|
||||
MFXVideoENC(mfxSession session) { m_session = session; }
|
||||
virtual ~MFXVideoENC(void) { Close(); }
|
||||
|
||||
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { return MFXVideoENC_Query(m_session, in, out); }
|
||||
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) { return MFXVideoENC_QueryIOSurf(m_session, par, request); }
|
||||
virtual mfxStatus Init(mfxVideoParam *par) { return MFXVideoENC_Init(m_session, par); }
|
||||
virtual mfxStatus Reset(mfxVideoParam *par) { return MFXVideoENC_Reset(m_session, par); }
|
||||
virtual mfxStatus Close(void) { return MFXVideoENC_Close(m_session); }
|
||||
|
||||
virtual mfxStatus GetVideoParam(mfxVideoParam *par) { return MFXVideoENC_GetVideoParam(m_session, par); }
|
||||
virtual mfxStatus ProcessFrameAsync(mfxENCInput *in, mfxENCOutput *out, mfxSyncPoint *syncp) { return MFXVideoENC_ProcessFrameAsync(m_session, in, out, syncp); }
|
||||
|
||||
protected:
|
||||
|
||||
mfxSession m_session; // (mfxSession) handle to the owning session
|
||||
};
|
||||
|
||||
class MFXVideoPAK
|
||||
{
|
||||
public:
|
||||
|
||||
MFXVideoPAK(mfxSession session) { m_session = session; }
|
||||
virtual ~MFXVideoPAK(void) { Close(); }
|
||||
|
||||
virtual mfxStatus Query(mfxVideoParam *in, mfxVideoParam *out) { return MFXVideoPAK_Query(m_session, in, out); }
|
||||
virtual mfxStatus QueryIOSurf(mfxVideoParam *par, mfxFrameAllocRequest *request) { return MFXVideoPAK_QueryIOSurf(m_session, par, request); }
|
||||
virtual mfxStatus Init(mfxVideoParam *par) { return MFXVideoPAK_Init(m_session, par); }
|
||||
virtual mfxStatus Reset(mfxVideoParam *par) { return MFXVideoPAK_Reset(m_session, par); }
|
||||
virtual mfxStatus Close(void) { return MFXVideoPAK_Close(m_session); }
|
||||
|
||||
virtual mfxStatus GetVideoParam(mfxVideoParam *par) { return MFXVideoPAK_GetVideoParam(m_session, par); }
|
||||
//virtual mfxStatus GetEncodeStat(mfxEncodeStat *stat) { return MFXVideoENCODE_GetEncodeStat(m_session, stat); }
|
||||
|
||||
virtual mfxStatus ProcessFrameAsync(mfxPAKInput *in, mfxPAKOutput *out, mfxSyncPoint *syncp) { return MFXVideoPAK_ProcessFrameAsync(m_session, in, out, syncp); }
|
||||
|
||||
protected:
|
||||
|
||||
mfxSession m_session; // (mfxSession) handle to the owning session
|
||||
};
|
||||
|
||||
#endif // __MFXVIDEOPLUSPLUS_H
|
||||
104
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxvideo.h
vendored
Normal file
104
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxvideo.h
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// Copyright (c) 2017-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXVIDEO_H__
|
||||
#define __MFXVIDEO_H__
|
||||
#include "mfxsession.h"
|
||||
#include "mfxvstructures.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* MFXVideoCORE */
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
typedef struct {
|
||||
mfxU32 reserved[4];
|
||||
mfxHDL pthis;
|
||||
mfxStatus (MFX_CDECL *Alloc) (mfxHDL pthis, mfxU32 nbytes, mfxU16 type, mfxMemId *mid);
|
||||
mfxStatus (MFX_CDECL *Lock) (mfxHDL pthis, mfxMemId mid, mfxU8 **ptr);
|
||||
mfxStatus (MFX_CDECL *Unlock) (mfxHDL pthis, mfxMemId mid);
|
||||
mfxStatus (MFX_CDECL *Free) (mfxHDL pthis, mfxMemId mid);
|
||||
} mfxBufferAllocator;
|
||||
MFX_PACK_END()
|
||||
|
||||
MFX_PACK_BEGIN_STRUCT_W_PTR()
|
||||
typedef struct {
|
||||
mfxU32 reserved[4];
|
||||
mfxHDL pthis;
|
||||
|
||||
mfxStatus (MFX_CDECL *Alloc) (mfxHDL pthis, mfxFrameAllocRequest *request, mfxFrameAllocResponse *response);
|
||||
mfxStatus (MFX_CDECL *Lock) (mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr);
|
||||
mfxStatus (MFX_CDECL *Unlock) (mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr);
|
||||
mfxStatus (MFX_CDECL *GetHDL) (mfxHDL pthis, mfxMemId mid, mfxHDL *handle);
|
||||
mfxStatus (MFX_CDECL *Free) (mfxHDL pthis, mfxFrameAllocResponse *response);
|
||||
} mfxFrameAllocator;
|
||||
MFX_PACK_END()
|
||||
|
||||
/* VideoCORE */
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoCORE_SetBufferAllocator(mfxSession session, mfxBufferAllocator *allocator);
|
||||
mfxStatus MFX_CDECL MFXVideoCORE_SetFrameAllocator(mfxSession session, mfxFrameAllocator *allocator);
|
||||
mfxStatus MFX_CDECL MFXVideoCORE_SetHandle(mfxSession session, mfxHandleType type, mfxHDL hdl);
|
||||
mfxStatus MFX_CDECL MFXVideoCORE_GetHandle(mfxSession session, mfxHandleType type, mfxHDL *hdl);
|
||||
mfxStatus MFX_CDECL MFXVideoCORE_QueryPlatform(mfxSession session, mfxPlatform* platform);
|
||||
mfxStatus MFX_CDECL MFXVideoCORE_SyncOperation(mfxSession session, mfxSyncPoint syncp, mfxU32 wait);
|
||||
|
||||
/* VideoENCODE */
|
||||
mfxStatus MFX_CDECL MFXVideoENCODE_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out);
|
||||
mfxStatus MFX_CDECL MFXVideoENCODE_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request);
|
||||
mfxStatus MFX_CDECL MFXVideoENCODE_Init(mfxSession session, mfxVideoParam *par);
|
||||
mfxStatus MFX_CDECL MFXVideoENCODE_Reset(mfxSession session, mfxVideoParam *par);
|
||||
mfxStatus MFX_CDECL MFXVideoENCODE_Close(mfxSession session);
|
||||
|
||||
mfxStatus MFX_CDECL MFXVideoENCODE_GetVideoParam(mfxSession session, mfxVideoParam *par);
|
||||
mfxStatus MFX_CDECL MFXVideoENCODE_GetEncodeStat(mfxSession session, mfxEncodeStat *stat);
|
||||
mfxStatus MFX_CDECL MFXVideoENCODE_EncodeFrameAsync(mfxSession session, mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxSyncPoint *syncp);
|
||||
|
||||
/* VideoDECODE */
|
||||
mfxStatus MFX_CDECL MFXVideoDECODE_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out);
|
||||
mfxStatus MFX_CDECL MFXVideoDECODE_DecodeHeader(mfxSession session, mfxBitstream *bs, mfxVideoParam *par);
|
||||
mfxStatus MFX_CDECL MFXVideoDECODE_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request);
|
||||
mfxStatus MFX_CDECL MFXVideoDECODE_Init(mfxSession session, mfxVideoParam *par);
|
||||
mfxStatus MFX_CDECL MFXVideoDECODE_Reset(mfxSession session, mfxVideoParam *par);
|
||||
mfxStatus MFX_CDECL MFXVideoDECODE_Close(mfxSession session);
|
||||
|
||||
mfxStatus MFX_CDECL MFXVideoDECODE_GetVideoParam(mfxSession session, mfxVideoParam *par);
|
||||
mfxStatus MFX_CDECL MFXVideoDECODE_GetDecodeStat(mfxSession session, mfxDecodeStat *stat);
|
||||
mfxStatus MFX_CDECL MFXVideoDECODE_SetSkipMode(mfxSession session, mfxSkipMode mode);
|
||||
mfxStatus MFX_CDECL MFXVideoDECODE_GetPayload(mfxSession session, mfxU64 *ts, mfxPayload *payload);
|
||||
mfxStatus MFX_CDECL MFXVideoDECODE_DecodeFrameAsync(mfxSession session, mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxSyncPoint *syncp);
|
||||
|
||||
/* VideoVPP */
|
||||
mfxStatus MFX_CDECL MFXVideoVPP_Query(mfxSession session, mfxVideoParam *in, mfxVideoParam *out);
|
||||
mfxStatus MFX_CDECL MFXVideoVPP_QueryIOSurf(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest request[2]);
|
||||
mfxStatus MFX_CDECL MFXVideoVPP_Init(mfxSession session, mfxVideoParam *par);
|
||||
mfxStatus MFX_CDECL MFXVideoVPP_Reset(mfxSession session, mfxVideoParam *par);
|
||||
mfxStatus MFX_CDECL MFXVideoVPP_Close(mfxSession session);
|
||||
|
||||
mfxStatus MFX_CDECL MFXVideoVPP_GetVideoParam(mfxSession session, mfxVideoParam *par);
|
||||
mfxStatus MFX_CDECL MFXVideoVPP_GetVPPStat(mfxSession session, mfxVPPStat *stat);
|
||||
mfxStatus MFX_CDECL MFXVideoVPP_RunFrameVPPAsync(mfxSession session, mfxFrameSurface1 *in, mfxFrameSurface1 *out, mfxExtVppAuxData *aux, mfxSyncPoint *syncp);
|
||||
MFX_DEPRECATED mfxStatus MFX_CDECL MFXVideoVPP_RunFrameVPPAsyncEx(mfxSession session, mfxFrameSurface1 *in, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxSyncPoint *syncp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
71
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxvp8.h
vendored
Normal file
71
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxvp8.h
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
// Copyright (c) 2017-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXVP8_H__
|
||||
#define __MFXVP8_H__
|
||||
|
||||
#include "mfxdefs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
MFX_CODEC_VP8 = MFX_MAKEFOURCC('V','P','8',' '),
|
||||
};
|
||||
|
||||
/* CodecProfile*/
|
||||
enum {
|
||||
MFX_PROFILE_VP8_0 = 0+1,
|
||||
MFX_PROFILE_VP8_1 = 1+1,
|
||||
MFX_PROFILE_VP8_2 = 2+1,
|
||||
MFX_PROFILE_VP8_3 = 3+1,
|
||||
};
|
||||
|
||||
/* Extended Buffer Ids */
|
||||
enum {
|
||||
MFX_EXTBUFF_VP8_CODING_OPTION = MFX_MAKEFOURCC('V','P','8','E'),
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 Version;
|
||||
mfxU16 EnableMultipleSegments;
|
||||
mfxU16 LoopFilterType;
|
||||
mfxU16 LoopFilterLevel[4];
|
||||
mfxU16 SharpnessLevel;
|
||||
mfxU16 NumTokenPartitions;
|
||||
mfxI16 LoopFilterRefTypeDelta[4];
|
||||
mfxI16 LoopFilterMbModeDelta[4];
|
||||
mfxI16 SegmentQPDelta[4];
|
||||
mfxI16 CoeffTypeQPDelta[5];
|
||||
mfxU16 WriteIVFHeaders;
|
||||
mfxU32 NumFramesForIVFHeader;
|
||||
mfxU16 reserved[223];
|
||||
} mfxExtVP8CodingOption;
|
||||
MFX_PACK_END()
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
53
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxvp9.h
vendored
Normal file
53
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxvp9.h
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2018-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#ifndef __MFXVP9_H__
|
||||
#define __MFXVP9_H__
|
||||
|
||||
#include "mfxdefs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if (MFX_VERSION >= MFX_VERSION_NEXT)
|
||||
|
||||
/* Extended Buffer Ids */
|
||||
enum {
|
||||
MFX_EXTBUFF_VP9_DECODED_FRAME_INFO = MFX_MAKEFOURCC('9','D','F','I')
|
||||
};
|
||||
|
||||
MFX_PACK_BEGIN_USUAL_STRUCT()
|
||||
typedef struct {
|
||||
mfxExtBuffer Header;
|
||||
|
||||
mfxU16 DisplayWidth;
|
||||
mfxU16 DisplayHeight;
|
||||
mfxU16 reserved[58];
|
||||
} mfxExtVP9DecodedFrameInfo;
|
||||
MFX_PACK_END()
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
22
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxvstructures.h
vendored
Normal file
22
libs/hwcodec/externals/MediaSDK_22.5.4/api/include/mfxvstructures.h
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright (c) 2017 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
#include "mfxstructures.h"
|
||||
|
||||
|
||||
158
libs/hwcodec/externals/MediaSDK_22.5.4/api/mediasdk_structures/ts_ext_buffers_decl.h
vendored
Normal file
158
libs/hwcodec/externals/MediaSDK_22.5.4/api/mediasdk_structures/ts_ext_buffers_decl.h
vendored
Normal file
@@ -0,0 +1,158 @@
|
||||
// Copyright (c) 2018-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if defined(__MFXSTRUCTURES_H__)
|
||||
EXTBUF(mfxExtCodingOption , MFX_EXTBUFF_CODING_OPTION )
|
||||
EXTBUF(mfxExtCodingOptionSPSPPS , MFX_EXTBUFF_CODING_OPTION_SPSPPS )
|
||||
EXTBUF(mfxExtCodingOptionVPS , MFX_EXTBUFF_CODING_OPTION_VPS )
|
||||
EXTBUF(mfxExtVPPDoNotUse , MFX_EXTBUFF_VPP_DONOTUSE )
|
||||
EXTBUF(mfxExtVppAuxData , MFX_EXTBUFF_VPP_AUXDATA )
|
||||
EXTBUF(mfxExtVPPDenoise , MFX_EXTBUFF_VPP_DENOISE )
|
||||
EXTBUF(mfxExtVPPProcAmp , MFX_EXTBUFF_VPP_PROCAMP )
|
||||
EXTBUF(mfxExtVPPDetail , MFX_EXTBUFF_VPP_DETAIL )
|
||||
EXTBUF(mfxExtVideoSignalInfo , MFX_EXTBUFF_VIDEO_SIGNAL_INFO )
|
||||
EXTBUF(mfxExtVPPDoUse , MFX_EXTBUFF_VPP_DOUSE )
|
||||
EXTBUF(mfxExtOpaqueSurfaceAlloc , MFX_EXTBUFF_OPAQUE_SURFACE_ALLOCATION )
|
||||
EXTBUF(mfxExtAVCRefListCtrl , MFX_EXTBUFF_AVC_REFLIST_CTRL )
|
||||
EXTBUF(mfxExtVPPFrameRateConversion , MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION )
|
||||
EXTBUF(mfxExtPictureTimingSEI , MFX_EXTBUFF_PICTURE_TIMING_SEI )
|
||||
EXTBUF(mfxExtAvcTemporalLayers , MFX_EXTBUFF_AVC_TEMPORAL_LAYERS )
|
||||
EXTBUF(mfxExtCodingOption2 , MFX_EXTBUFF_CODING_OPTION2 )
|
||||
EXTBUF(mfxExtVPPImageStab , MFX_EXTBUFF_VPP_IMAGE_STABILIZATION )
|
||||
EXTBUF(mfxExtEncoderCapability , MFX_EXTBUFF_ENCODER_CAPABILITY )
|
||||
EXTBUF(mfxExtEncoderResetOption , MFX_EXTBUFF_ENCODER_RESET_OPTION )
|
||||
EXTBUF(mfxExtAVCEncodedFrameInfo , MFX_EXTBUFF_ENCODED_FRAME_INFO )
|
||||
EXTBUF(mfxExtVPPComposite , MFX_EXTBUFF_VPP_COMPOSITE )
|
||||
EXTBUF(mfxExtVPPVideoSignalInfo , MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO )
|
||||
EXTBUF(mfxExtEncoderROI , MFX_EXTBUFF_ENCODER_ROI )
|
||||
EXTBUF(mfxExtVPPDeinterlacing , MFX_EXTBUFF_VPP_DEINTERLACING )
|
||||
EXTBUF(mfxExtVP8CodingOption , MFX_EXTBUFF_VP8_CODING_OPTION )
|
||||
EXTBUF(mfxExtVPPFieldProcessing , MFX_EXTBUFF_VPP_FIELD_PROCESSING )
|
||||
EXTBUF(mfxExtContentLightLevelInfo , MFX_EXTBUFF_CONTENT_LIGHT_LEVEL_INFO )
|
||||
EXTBUF(mfxExtMasteringDisplayColourVolume, MFX_EXTBUFF_MASTERING_DISPLAY_COLOUR_VOLUME )
|
||||
EXTBUF(mfxExtMultiFrameParam , MFX_EXTBUFF_MULTI_FRAME_PARAM )
|
||||
EXTBUF(mfxExtMultiFrameControl , MFX_EXTBUFF_MULTI_FRAME_CONTROL )
|
||||
EXTBUF(mfxExtColorConversion , MFX_EXTBUFF_VPP_COLOR_CONVERSION )
|
||||
EXTBUF(mfxExtAVCRefLists , MFX_EXTBUFF_AVC_REFLISTS )
|
||||
EXTBUF(mfxExtCodingOption3 , MFX_EXTBUFF_CODING_OPTION3 )
|
||||
EXTBUF(mfxExtMBQP , MFX_EXTBUFF_MBQP )
|
||||
EXTBUF(mfxExtMBForceIntra , MFX_EXTBUFF_MB_FORCE_INTRA )
|
||||
EXTBUF(mfxExtChromaLocInfo , MFX_EXTBUFF_CHROMA_LOC_INFO )
|
||||
EXTBUF(mfxExtDecodedFrameInfo , MFX_EXTBUFF_DECODED_FRAME_INFO )
|
||||
EXTBUF(mfxExtDecodeErrorReport , MFX_EXTBUFF_DECODE_ERROR_REPORT )
|
||||
EXTBUF(mfxExtVPPRotation , MFX_EXTBUFF_VPP_ROTATION )
|
||||
EXTBUF(mfxExtVPPMirroring , MFX_EXTBUFF_VPP_MIRRORING )
|
||||
EXTBUF(mfxExtMVCSeqDesc , MFX_EXTBUFF_MVC_SEQ_DESC )
|
||||
EXTBUF(mfxExtMBDisableSkipMap , MFX_EXTBUFF_MB_DISABLE_SKIP_MAP )
|
||||
EXTBUF(mfxExtDirtyRect , MFX_EXTBUFF_DIRTY_RECTANGLES )
|
||||
EXTBUF(mfxExtMoveRect , MFX_EXTBUFF_MOVING_RECTANGLES )
|
||||
EXTBUF(mfxExtHEVCParam , MFX_EXTBUFF_HEVC_PARAM )
|
||||
EXTBUF(mfxExtHEVCTiles , MFX_EXTBUFF_HEVC_TILES )
|
||||
EXTBUF(mfxExtPredWeightTable , MFX_EXTBUFF_PRED_WEIGHT_TABLE )
|
||||
EXTBUF(mfxExtEncodedUnitsInfo , MFX_EXTBUFF_ENCODED_UNITS_INFO )
|
||||
#if (MFX_VERSION >= 1026)
|
||||
EXTBUF(mfxExtVppMctf , MFX_EXTBUFF_VPP_MCTF )
|
||||
EXTBUF(mfxExtVP9Segmentation , MFX_EXTBUFF_VP9_SEGMENTATION )
|
||||
EXTBUF(mfxExtVP9TemporalLayers , MFX_EXTBUFF_VP9_TEMPORAL_LAYERS )
|
||||
EXTBUF(mfxExtVP9Param , MFX_EXTBUFF_VP9_PARAM )
|
||||
#endif
|
||||
EXTBUF(mfxExtEncoderIPCMArea , MFX_EXTBUFF_ENCODER_IPCM_AREA )
|
||||
EXTBUF(mfxExtInsertHeaders , MFX_EXTBUFF_INSERT_HEADERS )
|
||||
|
||||
#if (MFX_VERSION >= MFX_VERSION_NEXT)
|
||||
EXTBUF(mfxExtAVCScalingMatrix , MFX_EXTBUFF_AVC_SCALING_MATRIX )
|
||||
EXTBUF(mfxExtDPB , MFX_EXTBUFF_DPB )
|
||||
#endif
|
||||
#endif //defined(__MFXSTRUCTURES_H__)
|
||||
|
||||
#if defined(__MFXFEI_H__)
|
||||
EXTBUF(mfxExtFeiParam , MFX_EXTBUFF_FEI_PARAM )
|
||||
EXTBUF(mfxExtFeiSPS , MFX_EXTBUFF_FEI_SPS )
|
||||
EXTBUF(mfxExtFeiPPS , MFX_EXTBUFF_FEI_PPS )
|
||||
EXTBUF(mfxExtFeiEncFrameCtrl , MFX_EXTBUFF_FEI_ENC_CTRL )
|
||||
EXTBUF(mfxExtFeiEncMVPredictors , MFX_EXTBUFF_FEI_ENC_MV_PRED )
|
||||
EXTBUF(mfxExtFeiEncMBCtrl , MFX_EXTBUFF_FEI_ENC_MB )
|
||||
EXTBUF(mfxExtFeiEncMV , MFX_EXTBUFF_FEI_ENC_MV )
|
||||
EXTBUF(mfxExtFeiEncMBStat , MFX_EXTBUFF_FEI_ENC_MB_STAT )
|
||||
EXTBUF(mfxExtFeiEncQP , MFX_EXTBUFF_FEI_ENC_QP )
|
||||
EXTBUF(mfxExtFeiPreEncCtrl , MFX_EXTBUFF_FEI_PREENC_CTRL )
|
||||
EXTBUF(mfxExtFeiPreEncMVPredictors , MFX_EXTBUFF_FEI_PREENC_MV_PRED )
|
||||
EXTBUF(mfxExtFeiPreEncMV , MFX_EXTBUFF_FEI_PREENC_MV )
|
||||
EXTBUF(mfxExtFeiPreEncMBStat , MFX_EXTBUFF_FEI_PREENC_MB )
|
||||
EXTBUF(mfxExtFeiPakMBCtrl , MFX_EXTBUFF_FEI_PAK_CTRL )
|
||||
EXTBUF(mfxExtFeiSliceHeader , MFX_EXTBUFF_FEI_SLICE )
|
||||
EXTBUF(mfxExtFeiRepackCtrl , MFX_EXTBUFF_FEI_REPACK_CTRL )
|
||||
EXTBUF(mfxExtFeiDecStreamOut , MFX_EXTBUFF_FEI_DEC_STREAM_OUT )
|
||||
#if (MFX_VERSION >= 1027)
|
||||
EXTBUF(mfxExtFeiHevcEncFrameCtrl , MFX_EXTBUFF_HEVCFEI_ENC_CTRL )
|
||||
EXTBUF(mfxExtFeiHevcEncMVPredictors , MFX_EXTBUFF_HEVCFEI_ENC_MV_PRED )
|
||||
EXTBUF(mfxExtFeiHevcEncQP , MFX_EXTBUFF_HEVCFEI_ENC_QP )
|
||||
EXTBUF(mfxExtFeiHevcEncCtuCtrl , MFX_EXTBUFF_HEVCFEI_ENC_CTU_CTRL )
|
||||
#endif
|
||||
#endif //defined(__MFXFEI_H__)
|
||||
|
||||
#if defined(__MFXCAMERA_H__)
|
||||
EXTBUF(mfxExtCamTotalColorControl , MFX_EXTBUF_CAM_TOTAL_COLOR_CONTROL )
|
||||
EXTBUF(mfxExtCamCscYuvRgb , MFX_EXTBUF_CAM_CSC_YUV_RGB )
|
||||
EXTBUF(mfxExtCamGammaCorrection , MFX_EXTBUF_CAM_GAMMA_CORRECTION )
|
||||
EXTBUF(mfxExtCamWhiteBalance , MFX_EXTBUF_CAM_WHITE_BALANCE )
|
||||
EXTBUF(mfxExtCamHotPixelRemoval , MFX_EXTBUF_CAM_HOT_PIXEL_REMOVAL )
|
||||
EXTBUF(mfxExtCamBlackLevelCorrection, MFX_EXTBUF_CAM_BLACK_LEVEL_CORRECTION )
|
||||
EXTBUF(mfxExtCamVignetteCorrection , MFX_EXTBUF_CAM_VIGNETTE_CORRECTION )
|
||||
EXTBUF(mfxExtCamBayerDenoise , MFX_EXTBUF_CAM_BAYER_DENOISE )
|
||||
EXTBUF(mfxExtCamColorCorrection3x3 , MFX_EXTBUF_CAM_COLOR_CORRECTION_3X3 )
|
||||
EXTBUF(mfxExtCamPadding , MFX_EXTBUF_CAM_PADDING )
|
||||
EXTBUF(mfxExtCamPipeControl , MFX_EXTBUF_CAM_PIPECONTROL )
|
||||
#endif //defined(__MFXCAMERA_H__)
|
||||
|
||||
#if defined(__MFXCOMMON_H__)
|
||||
// Threading API
|
||||
EXTBUF(mfxExtThreadsParam , MFX_EXTBUFF_THREADS_PARAM)
|
||||
#endif //defined(__MFXCOMMON_H__)
|
||||
|
||||
#if defined(__MFXSC_H__)
|
||||
//Screen capture
|
||||
EXTBUF(mfxExtScreenCaptureParam , MFX_EXTBUFF_SCREEN_CAPTURE_PARAM )
|
||||
#endif //defined(__MFXSC_H__)
|
||||
|
||||
#if defined(__MFXVP9_H__)
|
||||
#if (MFX_VERSION >= MFX_VERSION_NEXT)
|
||||
EXTBUF(mfxExtVP9DecodedFrameInfo , MFX_EXTBUFF_VP9_DECODED_FRAME_INFO )
|
||||
#endif
|
||||
#endif //defined(__MFXVP9_H__)
|
||||
|
||||
#if defined(__MFXBRC_H__)
|
||||
EXTBUF(mfxExtBRC, MFX_EXTBUFF_BRC)
|
||||
#endif // defined(__MFXBRC_H__)
|
||||
|
||||
#if defined(__MFXPCP_H__)
|
||||
#if (MFX_VERSION >= 1030)
|
||||
EXTBUF(mfxExtCencParam , MFX_EXTBUFF_CENC_PARAM )
|
||||
#endif
|
||||
#endif // defined(__MFXPCP_H__)
|
||||
|
||||
#if defined(__MFXSCD_H__)
|
||||
EXTBUF(mfxExtSCD, MFX_EXTBUFF_SCD)
|
||||
#endif // defined(__MFXSCD_H__)
|
||||
|
||||
#ifdef __MFXLA_H__
|
||||
EXTBUF(mfxExtLAControl , MFX_EXTBUFF_LOOKAHEAD_CTRL )
|
||||
EXTBUF(mfxExtLAFrameStatistics , MFX_EXTBUFF_LOOKAHEAD_STAT )
|
||||
#endif //__MFXLA_H__
|
||||
1443
libs/hwcodec/externals/MediaSDK_22.5.4/api/mediasdk_structures/ts_struct_decl.h
vendored
Normal file
1443
libs/hwcodec/externals/MediaSDK_22.5.4/api/mediasdk_structures/ts_struct_decl.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
50
libs/hwcodec/externals/MediaSDK_22.5.4/api/mediasdk_structures/ts_typedef.h
vendored
Normal file
50
libs/hwcodec/externals/MediaSDK_22.5.4/api/mediasdk_structures/ts_typedef.h
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2017-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
#define TYPEDEF_MEMBER(base, member, name) typedef std::remove_reference<decltype(((base*)0)->member)>::type name;
|
||||
#else
|
||||
#if defined(__GNUC__)
|
||||
#define TYPEDEF_MEMBER(base, member, name) typedef typeof(((base*)0)->member) name;
|
||||
#endif
|
||||
#endif
|
||||
TYPEDEF_MEMBER(mfxExtOpaqueSurfaceAlloc, In, mfxExtOpaqueSurfaceAlloc_InOut)
|
||||
TYPEDEF_MEMBER(mfxExtAVCRefListCtrl, PreferredRefList[0], mfxExtAVCRefListCtrl_Entry)
|
||||
TYPEDEF_MEMBER(mfxExtPictureTimingSEI, TimeStamp[0], mfxExtPictureTimingSEI_TimeStamp)
|
||||
TYPEDEF_MEMBER(mfxExtAvcTemporalLayers, Layer[0], mfxExtAvcTemporalLayers_Layer)
|
||||
TYPEDEF_MEMBER(mfxExtAVCEncodedFrameInfo, UsedRefListL0[0], mfxExtAVCEncodedFrameInfo_RefList)
|
||||
TYPEDEF_MEMBER(mfxExtVPPVideoSignalInfo, In, mfxExtVPPVideoSignalInfo_InOut)
|
||||
TYPEDEF_MEMBER(mfxExtEncoderROI, ROI[0], mfxExtEncoderROI_Entry)
|
||||
TYPEDEF_MEMBER(mfxExtDirtyRect, Rect[0], mfxExtDirtyRect_Entry)
|
||||
TYPEDEF_MEMBER(mfxExtMoveRect, Rect[0], mfxExtMoveRect_Entry)
|
||||
typedef union { mfxU32 n; char c[4]; } mfx4CC;
|
||||
typedef mfxExtAVCRefLists::mfxRefPic mfxExtAVCRefLists_mfxRefPic;
|
||||
typedef mfxExtFeiEncMV::mfxExtFeiEncMVMB mfxExtFeiEncMV_MB;
|
||||
typedef mfxExtFeiEncMBCtrl::mfxExtFeiEncMBCtrlMB mfxExtFeiEncMBCtrl_MB;
|
||||
typedef mfxExtFeiPreEncMVPredictors::mfxExtFeiPreEncMVPredictorsMB mfxExtFeiPreEncMVPredictors_MB;
|
||||
typedef mfxExtFeiPreEncMV::mfxExtFeiPreEncMVMB mfxExtFeiPreEncMV_MB;
|
||||
typedef mfxExtFeiPreEncMBStat::mfxExtFeiPreEncMBStatMB mfxExtFeiPreEncMBStat_MB;
|
||||
typedef mfxExtEncoderIPCMArea::area mfxExtEncoderIPCMArea_area;
|
||||
|
||||
#if MFX_VERSION >= 1023
|
||||
typedef mfxExtFeiPPS::mfxExtFeiPpsDPB mfxExtFeiPPS_mfxExtFeiPpsDPB;
|
||||
#endif // MFX_VERSION >= 1023
|
||||
3
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/Android.mk
vendored
Normal file
3
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/Android.mk
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Recursively call sub-folder Android.mk
|
||||
|
||||
include $(call all-subdir-makefiles)
|
||||
30
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/Android.mk
vendored
Normal file
30
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/Android.mk
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
# =============================================================================
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
include $(MFX_HOME)/android/mfx_defs.mk
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
mfxloader.cpp \
|
||||
mfxparser.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := $(MFX_INCLUDES)
|
||||
|
||||
LOCAL_CFLAGS := \
|
||||
$(MFX_CFLAGS_INTERNAL) \
|
||||
-DMFX_PLUGINS_CONF_DIR=\"/vendor/etc\"
|
||||
LOCAL_CFLAGS_32 := \
|
||||
$(MFX_CFLAGS_INTERNAL_32) \
|
||||
-DMFX_MODULES_DIR=\"/system/vendor/lib\"
|
||||
LOCAL_CFLAGS_64 := \
|
||||
$(MFX_CFLAGS_INTERNAL_64) \
|
||||
-DMFX_MODULES_DIR=\"/system/vendor/lib64\"
|
||||
|
||||
LOCAL_HEADER_LIBRARIES := libmfx_headers
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE := libmfx
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
121
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/CMakeLists.txt
vendored
Normal file
121
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
# Copyright (c) 2017 Intel Corporation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
cmake_minimum_required( VERSION 3.6 FATAL_ERROR )
|
||||
project( mfx )
|
||||
|
||||
set( MFX_API_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/../../include )
|
||||
|
||||
# While equal to get_mfx_version in samples/builder, this function should remain separate to make this file self-sufficient
|
||||
function( get_api_version mfx_version_major mfx_version_minor )
|
||||
file(STRINGS ${MFX_API_FOLDER}/mfxdefs.h major REGEX "#define MFX_VERSION_MAJOR" LIMIT_COUNT 1)
|
||||
file(STRINGS ${MFX_API_FOLDER}/mfxdefs.h minor REGEX "#define MFX_VERSION_MINOR" LIMIT_COUNT 1)
|
||||
string(REPLACE "#define MFX_VERSION_MAJOR " "" major ${major})
|
||||
string(REPLACE "#define MFX_VERSION_MINOR " "" minor ${minor})
|
||||
set(${mfx_version_major} ${major} PARENT_SCOPE)
|
||||
set(${mfx_version_minor} ${minor} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
set( CMAKE_LIB_DIR ${CMAKE_BINARY_DIR}/__bin )
|
||||
|
||||
# If user did not override CMAKE_INSTALL_PREFIX, then set the default prefix
|
||||
# to /opt/intel/mediasdk instead of cmake's default
|
||||
if( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
|
||||
set( CMAKE_INSTALL_PREFIX /opt/intel/mediasdk CACHE PATH "Install Path Prefix" FORCE )
|
||||
endif( )
|
||||
message( STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" )
|
||||
|
||||
include( GNUInstallDirs )
|
||||
|
||||
if( NOT DEFINED MFX_PLUGINS_CONF_DIR )
|
||||
set( MFX_PLUGINS_CONF_DIR ${CMAKE_INSTALL_FULL_DATADIR}/mfx )
|
||||
endif( )
|
||||
add_definitions( -DMFX_PLUGINS_CONF_DIR="${MFX_PLUGINS_CONF_DIR}" )
|
||||
message( STATUS "MFX_PLUGINS_CONF_DIR=${MFX_PLUGINS_CONF_DIR}" )
|
||||
|
||||
if( NOT DEFINED MFX_MODULES_DIR )
|
||||
set( MFX_MODULES_DIR ${CMAKE_INSTALL_FULL_LIBDIR} )
|
||||
endif( )
|
||||
add_definitions( -DMFX_MODULES_DIR="${MFX_MODULES_DIR}" )
|
||||
message( STATUS "MFX_MODULES_DIR=${MFX_MODULES_DIR}" )
|
||||
|
||||
add_definitions(-DUNIX)
|
||||
add_definitions(-DMFX_DEPRECATED_OFF)
|
||||
|
||||
if( CMAKE_SYSTEM_NAME MATCHES Linux )
|
||||
add_definitions(-D__USE_LARGEFILE64 -D_FILE_OFFSET_BITS=64 -DLINUX -DLINUX32)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
add_definitions(-DLINUX64)
|
||||
endif( )
|
||||
endif( )
|
||||
|
||||
if( CMAKE_SYSTEM_NAME MATCHES Darwin )
|
||||
add_definitions(-DOSX)
|
||||
add_definitions(-DOSX32)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
add_definitions(-DOSX64)
|
||||
endif( )
|
||||
endif( )
|
||||
|
||||
set(no_warnings "-Wno-unknown-pragmas -Wno-unused")
|
||||
set(warnings "-Wall -Wformat -Wformat-security")
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe -fPIC -std=c++11 ${warnings} ${no_warnings}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
|
||||
|
||||
if (DEFINED CMAKE_FIND_ROOT_PATH)
|
||||
append("--sysroot=${CMAKE_FIND_ROOT_PATH} " LINK_FLAGS)
|
||||
endif (DEFINED CMAKE_FIND_ROOT_PATH)
|
||||
|
||||
list(APPEND sources
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mfxloader.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/mfxparser.cpp
|
||||
)
|
||||
|
||||
include_directories (
|
||||
${MFX_API_FOLDER}
|
||||
)
|
||||
|
||||
add_library(mfx SHARED ${sources})
|
||||
target_link_libraries(mfx dl)
|
||||
|
||||
get_api_version(MFX_VERSION_MAJOR MFX_VERSION_MINOR)
|
||||
|
||||
set_target_properties( mfx PROPERTIES LINK_FLAGS
|
||||
"-Wl,--no-undefined,-z,relro,-z,now,-z,noexecstack -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libmfx.map -fstack-protector")
|
||||
set_target_properties( mfx PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIB_DIR}/${CMAKE_BUILD_TYPE} FOLDER mfx )
|
||||
set_target_properties( mfx PROPERTIES VERSION ${MFX_VERSION_MAJOR}.${MFX_VERSION_MINOR})
|
||||
set_target_properties( mfx PROPERTIES SOVERSION ${MFX_VERSION_MAJOR})
|
||||
|
||||
install(TARGETS mfx LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
|
||||
set( PKG_CONFIG_FNAME "${CMAKE_LIB_DIR}/${CMAKE_BUILD_TYPE}/lib${PROJECT_NAME}.pc")
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pkg-config.pc.cmake" ${PKG_CONFIG_FNAME} @ONLY)
|
||||
|
||||
install( FILES ${PKG_CONFIG_FNAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig )
|
||||
install( DIRECTORY ${MFX_API_FOLDER}/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mfx FILES_MATCHING PATTERN *.h )
|
||||
|
||||
# For backwards compatibility, create a relative symbolic link without the "lib"
|
||||
# prefix to the .pc file.
|
||||
set( PKG_CONFIG_LFNAME "${CMAKE_LIB_DIR}/${CMAKE_BUILD_TYPE}/${PROJECT_NAME}.pc" )
|
||||
add_custom_target(pc_link_target ALL COMMAND ${CMAKE_COMMAND} -E create_symlink lib${PROJECT_NAME}.pc ${PKG_CONFIG_LFNAME})
|
||||
install( FILES ${PKG_CONFIG_LFNAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig )
|
||||
447
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/device_ids.h
vendored
Normal file
447
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/device_ids.h
vendored
Normal file
@@ -0,0 +1,447 @@
|
||||
// Copyright (c) 2022 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum eMFXHWType
|
||||
{
|
||||
MFX_HW_UNKNOWN = 0,
|
||||
MFX_HW_SNB = 0x300000,
|
||||
|
||||
MFX_HW_IVB = 0x400000,
|
||||
|
||||
MFX_HW_HSW = 0x500000,
|
||||
MFX_HW_HSW_ULT = 0x500001,
|
||||
|
||||
MFX_HW_VLV = 0x600000,
|
||||
|
||||
MFX_HW_BDW = 0x700000,
|
||||
|
||||
MFX_HW_CHT = 0x800000,
|
||||
|
||||
MFX_HW_SKL = 0x900000,
|
||||
|
||||
MFX_HW_APL = 0x1000000,
|
||||
|
||||
MFX_HW_KBL = 0x1100000,
|
||||
MFX_HW_GLK = MFX_HW_KBL + 1,
|
||||
MFX_HW_CFL = MFX_HW_KBL + 2,
|
||||
|
||||
MFX_HW_CNL = 0x1200000,
|
||||
|
||||
MFX_HW_ICL = 0x1400000,
|
||||
MFX_HW_ICL_LP = MFX_HW_ICL + 1,
|
||||
MFX_HW_JSL = 0x1500001,
|
||||
MFX_HW_EHL = 0x1500002,
|
||||
|
||||
MFX_HW_TGL_LP = 0x1600000,
|
||||
MFX_HW_RKL = MFX_HW_TGL_LP + 2,
|
||||
MFX_HW_DG1 = 0x1600003,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int device_id;
|
||||
eMFXHWType platform;
|
||||
} mfx_device_item;
|
||||
|
||||
// list of dev ID supported by legacy Media SDK
|
||||
const mfx_device_item msdkDevIDs[] = {
|
||||
/*IVB*/
|
||||
{ 0x0156, MFX_HW_IVB }, /* GT1 mobile */
|
||||
{ 0x0166, MFX_HW_IVB }, /* GT2 mobile */
|
||||
{ 0x0152, MFX_HW_IVB }, /* GT1 desktop */
|
||||
{ 0x0162, MFX_HW_IVB }, /* GT2 desktop */
|
||||
{ 0x015a, MFX_HW_IVB }, /* GT1 server */
|
||||
{ 0x016a, MFX_HW_IVB }, /* GT2 server */
|
||||
/*HSW*/
|
||||
{ 0x0402, MFX_HW_HSW }, /* GT1 desktop */
|
||||
{ 0x0412, MFX_HW_HSW }, /* GT2 desktop */
|
||||
{ 0x0422, MFX_HW_HSW }, /* GT2 desktop */
|
||||
{ 0x041e, MFX_HW_HSW }, /* Core i3-4130 */
|
||||
{ 0x040a, MFX_HW_HSW }, /* GT1 server */
|
||||
{ 0x041a, MFX_HW_HSW }, /* GT2 server */
|
||||
{ 0x042a, MFX_HW_HSW }, /* GT2 server */
|
||||
{ 0x0406, MFX_HW_HSW }, /* GT1 mobile */
|
||||
{ 0x0416, MFX_HW_HSW }, /* GT2 mobile */
|
||||
{ 0x0426, MFX_HW_HSW }, /* GT2 mobile */
|
||||
{ 0x0C02, MFX_HW_HSW }, /* SDV GT1 desktop */
|
||||
{ 0x0C12, MFX_HW_HSW }, /* SDV GT2 desktop */
|
||||
{ 0x0C22, MFX_HW_HSW }, /* SDV GT2 desktop */
|
||||
{ 0x0C0A, MFX_HW_HSW }, /* SDV GT1 server */
|
||||
{ 0x0C1A, MFX_HW_HSW }, /* SDV GT2 server */
|
||||
{ 0x0C2A, MFX_HW_HSW }, /* SDV GT2 server */
|
||||
{ 0x0C06, MFX_HW_HSW }, /* SDV GT1 mobile */
|
||||
{ 0x0C16, MFX_HW_HSW }, /* SDV GT2 mobile */
|
||||
{ 0x0C26, MFX_HW_HSW }, /* SDV GT2 mobile */
|
||||
{ 0x0A02, MFX_HW_HSW }, /* ULT GT1 desktop */
|
||||
{ 0x0A12, MFX_HW_HSW }, /* ULT GT2 desktop */
|
||||
{ 0x0A22, MFX_HW_HSW }, /* ULT GT2 desktop */
|
||||
{ 0x0A0A, MFX_HW_HSW }, /* ULT GT1 server */
|
||||
{ 0x0A1A, MFX_HW_HSW }, /* ULT GT2 server */
|
||||
{ 0x0A2A, MFX_HW_HSW }, /* ULT GT2 server */
|
||||
{ 0x0A06, MFX_HW_HSW }, /* ULT GT1 mobile */
|
||||
{ 0x0A16, MFX_HW_HSW }, /* ULT GT2 mobile */
|
||||
{ 0x0A26, MFX_HW_HSW }, /* ULT GT2 mobile */
|
||||
{ 0x0D02, MFX_HW_HSW }, /* CRW GT1 desktop */
|
||||
{ 0x0D12, MFX_HW_HSW }, /* CRW GT2 desktop */
|
||||
{ 0x0D22, MFX_HW_HSW }, /* CRW GT2 desktop */
|
||||
{ 0x0D0A, MFX_HW_HSW }, /* CRW GT1 server */
|
||||
{ 0x0D1A, MFX_HW_HSW }, /* CRW GT2 server */
|
||||
{ 0x0D2A, MFX_HW_HSW }, /* CRW GT2 server */
|
||||
{ 0x0D06, MFX_HW_HSW }, /* CRW GT1 mobile */
|
||||
{ 0x0D16, MFX_HW_HSW }, /* CRW GT2 mobile */
|
||||
{ 0x0D26, MFX_HW_HSW }, /* CRW GT2 mobile */
|
||||
{ 0x040B, MFX_HW_HSW }, /*HASWELL_B_GT1 *//* Reserved */
|
||||
{ 0x041B, MFX_HW_HSW }, /*HASWELL_B_GT2*/
|
||||
{ 0x042B, MFX_HW_HSW }, /*HASWELL_B_GT3*/
|
||||
{ 0x040E, MFX_HW_HSW }, /*HASWELL_E_GT1*//* Reserved */
|
||||
{ 0x041E, MFX_HW_HSW }, /*HASWELL_E_GT2*/
|
||||
{ 0x042E, MFX_HW_HSW }, /*HASWELL_E_GT3*/
|
||||
|
||||
{ 0x0C0B, MFX_HW_HSW }, /*HASWELL_SDV_B_GT1*/ /* Reserved */
|
||||
{ 0x0C1B, MFX_HW_HSW }, /*HASWELL_SDV_B_GT2*/
|
||||
{ 0x0C2B, MFX_HW_HSW }, /*HASWELL_SDV_B_GT3*/
|
||||
{ 0x0C0E, MFX_HW_HSW }, /*HASWELL_SDV_B_GT1*//* Reserved */
|
||||
{ 0x0C1E, MFX_HW_HSW }, /*HASWELL_SDV_B_GT2*/
|
||||
{ 0x0C2E, MFX_HW_HSW }, /*HASWELL_SDV_B_GT3*/
|
||||
|
||||
{ 0x0A0B, MFX_HW_HSW }, /*HASWELL_ULT_B_GT1*/ /* Reserved */
|
||||
{ 0x0A1B, MFX_HW_HSW }, /*HASWELL_ULT_B_GT2*/
|
||||
{ 0x0A2B, MFX_HW_HSW }, /*HASWELL_ULT_B_GT3*/
|
||||
{ 0x0A0E, MFX_HW_HSW }, /*HASWELL_ULT_E_GT1*/ /* Reserved */
|
||||
{ 0x0A1E, MFX_HW_HSW }, /*HASWELL_ULT_E_GT2*/
|
||||
{ 0x0A2E, MFX_HW_HSW }, /*HASWELL_ULT_E_GT3*/
|
||||
|
||||
{ 0x0D0B, MFX_HW_HSW }, /*HASWELL_CRW_B_GT1*/ /* Reserved */
|
||||
{ 0x0D1B, MFX_HW_HSW }, /*HASWELL_CRW_B_GT2*/
|
||||
{ 0x0D2B, MFX_HW_HSW }, /*HASWELL_CRW_B_GT3*/
|
||||
{ 0x0D0E, MFX_HW_HSW }, /*HASWELL_CRW_E_GT1*/ /* Reserved */
|
||||
{ 0x0D1E, MFX_HW_HSW }, /*HASWELL_CRW_E_GT2*/
|
||||
{ 0x0D2E, MFX_HW_HSW }, /*HASWELL_CRW_E_GT3*/
|
||||
|
||||
/* VLV */
|
||||
{ 0x0f30, MFX_HW_VLV }, /* VLV mobile */
|
||||
{ 0x0f31, MFX_HW_VLV }, /* VLV mobile */
|
||||
{ 0x0f32, MFX_HW_VLV }, /* VLV mobile */
|
||||
{ 0x0f33, MFX_HW_VLV }, /* VLV mobile */
|
||||
{ 0x0157, MFX_HW_VLV },
|
||||
{ 0x0155, MFX_HW_VLV },
|
||||
|
||||
/* BDW */
|
||||
/*GT3: */
|
||||
{ 0x162D, MFX_HW_BDW },
|
||||
{ 0x162A, MFX_HW_BDW },
|
||||
/*GT2: */
|
||||
{ 0x161D, MFX_HW_BDW },
|
||||
{ 0x161A, MFX_HW_BDW },
|
||||
/* GT1: */
|
||||
{ 0x160D, MFX_HW_BDW },
|
||||
{ 0x160A, MFX_HW_BDW },
|
||||
/* BDW-ULT */
|
||||
/* (16x2 - ULT, 16x6 - ULT, 16xB - Iris, 16xE - ULX) */
|
||||
/*GT3: */
|
||||
{ 0x162E, MFX_HW_BDW },
|
||||
{ 0x162B, MFX_HW_BDW },
|
||||
{ 0x1626, MFX_HW_BDW },
|
||||
{ 0x1622, MFX_HW_BDW },
|
||||
{ 0x1636, MFX_HW_BDW }, /* ULT */
|
||||
{ 0x163B, MFX_HW_BDW }, /* Iris */
|
||||
{ 0x163E, MFX_HW_BDW }, /* ULX */
|
||||
{ 0x1632, MFX_HW_BDW }, /* ULT */
|
||||
{ 0x163A, MFX_HW_BDW }, /* Server */
|
||||
{ 0x163D, MFX_HW_BDW }, /* Workstation */
|
||||
|
||||
/* GT2: */
|
||||
{ 0x161E, MFX_HW_BDW },
|
||||
{ 0x161B, MFX_HW_BDW },
|
||||
{ 0x1616, MFX_HW_BDW },
|
||||
{ 0x1612, MFX_HW_BDW },
|
||||
/* GT1: */
|
||||
{ 0x160E, MFX_HW_BDW },
|
||||
{ 0x160B, MFX_HW_BDW },
|
||||
{ 0x1606, MFX_HW_BDW },
|
||||
{ 0x1602, MFX_HW_BDW },
|
||||
|
||||
/* CHT */
|
||||
{ 0x22b0, MFX_HW_CHT },
|
||||
{ 0x22b1, MFX_HW_CHT },
|
||||
{ 0x22b2, MFX_HW_CHT },
|
||||
{ 0x22b3, MFX_HW_CHT },
|
||||
|
||||
/* SKL */
|
||||
/* GT1F */
|
||||
{ 0x1902, MFX_HW_SKL }, // DT, 2x1F, 510
|
||||
{ 0x1906, MFX_HW_SKL }, // U-ULT, 2x1F, 510
|
||||
{ 0x190A, MFX_HW_SKL }, // Server, 4x1F
|
||||
{ 0x190B, MFX_HW_SKL },
|
||||
{ 0x190E, MFX_HW_SKL }, // Y-ULX 2x1F
|
||||
/*GT1.5*/
|
||||
{ 0x1913, MFX_HW_SKL }, // U-ULT, 2x1.5
|
||||
{ 0x1915, MFX_HW_SKL }, // Y-ULX, 2x1.5
|
||||
{ 0x1917, MFX_HW_SKL }, // DT, 2x1.5
|
||||
/* GT2 */
|
||||
{ 0x1912, MFX_HW_SKL }, // DT, 2x2, 530
|
||||
{ 0x1916, MFX_HW_SKL }, // U-ULD 2x2, 520
|
||||
{ 0x191A, MFX_HW_SKL }, // 2x2,4x2, Server
|
||||
{ 0x191B, MFX_HW_SKL }, // DT, 2x2, 530
|
||||
{ 0x191D, MFX_HW_SKL }, // 4x2, WKS, P530
|
||||
{ 0x191E, MFX_HW_SKL }, // Y-ULX, 2x2, P510,515
|
||||
{ 0x1921, MFX_HW_SKL }, // U-ULT, 2x2F, 540
|
||||
/* GT3 */
|
||||
{ 0x1923, MFX_HW_SKL }, // U-ULT, 2x3, 535
|
||||
{ 0x1926, MFX_HW_SKL }, // U-ULT, 2x3, 540 (15W)
|
||||
{ 0x1927, MFX_HW_SKL }, // U-ULT, 2x3e, 550 (28W)
|
||||
{ 0x192A, MFX_HW_SKL }, // Server, 2x3
|
||||
{ 0x192B, MFX_HW_SKL }, // Halo 3e
|
||||
{ 0x192D, MFX_HW_SKL },
|
||||
/* GT4e*/
|
||||
{ 0x1932, MFX_HW_SKL }, // DT
|
||||
{ 0x193A, MFX_HW_SKL }, // SRV
|
||||
{ 0x193B, MFX_HW_SKL }, // Halo
|
||||
{ 0x193D, MFX_HW_SKL }, // WKS
|
||||
|
||||
/* APL */
|
||||
{ 0x0A84, MFX_HW_APL },
|
||||
{ 0x0A85, MFX_HW_APL },
|
||||
{ 0x0A86, MFX_HW_APL },
|
||||
{ 0x0A87, MFX_HW_APL },
|
||||
{ 0x1A84, MFX_HW_APL },
|
||||
{ 0x1A85, MFX_HW_APL },
|
||||
{ 0x5A84, MFX_HW_APL },
|
||||
{ 0x5A85, MFX_HW_APL },
|
||||
|
||||
/* KBL */
|
||||
{ 0x5902, MFX_HW_KBL }, // DT GT1
|
||||
{ 0x5906, MFX_HW_KBL }, // ULT GT1
|
||||
{ 0x5908, MFX_HW_KBL }, // HALO GT1F
|
||||
{ 0x590A, MFX_HW_KBL }, // SERV GT1
|
||||
{ 0x590B, MFX_HW_KBL }, // HALO GT1
|
||||
{ 0x590E, MFX_HW_KBL }, // ULX GT1
|
||||
{ 0x5912, MFX_HW_KBL }, // DT GT2
|
||||
{ 0x5913, MFX_HW_KBL }, // ULT GT1 5
|
||||
{ 0x5915, MFX_HW_KBL }, // ULX GT1 5
|
||||
{ 0x5916, MFX_HW_KBL }, // ULT GT2
|
||||
{ 0x5917, MFX_HW_KBL }, // ULT GT2 R
|
||||
{ 0x591A, MFX_HW_KBL }, // SERV GT2
|
||||
{ 0x591B, MFX_HW_KBL }, // HALO GT2
|
||||
{ 0x591C, MFX_HW_KBL }, // ULX GT2
|
||||
{ 0x591D, MFX_HW_KBL }, // WRK GT2
|
||||
{ 0x591E, MFX_HW_KBL }, // ULX GT2
|
||||
{ 0x5921, MFX_HW_KBL }, // ULT GT2F
|
||||
{ 0x5923, MFX_HW_KBL }, // ULT GT3
|
||||
{ 0x5926, MFX_HW_KBL }, // ULT GT3 15W
|
||||
{ 0x5927, MFX_HW_KBL }, // ULT GT3 28W
|
||||
{ 0x592A, MFX_HW_KBL }, // SERV GT3
|
||||
{ 0x592B, MFX_HW_KBL }, // HALO GT3
|
||||
{ 0x5932, MFX_HW_KBL }, // DT GT4
|
||||
{ 0x593A, MFX_HW_KBL }, // SERV GT4
|
||||
{ 0x593B, MFX_HW_KBL }, // HALO GT4
|
||||
{ 0x593D, MFX_HW_KBL }, // WRK GT4
|
||||
{ 0x87C0, MFX_HW_KBL }, // ULX GT2
|
||||
|
||||
/* GLK */
|
||||
{ 0x3184, MFX_HW_GLK },
|
||||
{ 0x3185, MFX_HW_GLK },
|
||||
|
||||
/* CFL */
|
||||
{ 0x3E90, MFX_HW_CFL },
|
||||
{ 0x3E91, MFX_HW_CFL },
|
||||
{ 0x3E92, MFX_HW_CFL },
|
||||
{ 0x3E93, MFX_HW_CFL },
|
||||
{ 0x3E94, MFX_HW_CFL },
|
||||
{ 0x3E96, MFX_HW_CFL },
|
||||
{ 0x3E98, MFX_HW_CFL },
|
||||
{ 0x3E99, MFX_HW_CFL },
|
||||
{ 0x3E9A, MFX_HW_CFL },
|
||||
{ 0x3E9C, MFX_HW_CFL },
|
||||
{ 0x3E9B, MFX_HW_CFL },
|
||||
{ 0x3EA5, MFX_HW_CFL },
|
||||
{ 0x3EA6, MFX_HW_CFL },
|
||||
{ 0x3EA7, MFX_HW_CFL },
|
||||
{ 0x3EA8, MFX_HW_CFL },
|
||||
{ 0x3EA9, MFX_HW_CFL },
|
||||
{ 0x87CA, MFX_HW_CFL },
|
||||
|
||||
/* WHL */
|
||||
{ 0x3EA0, MFX_HW_CFL },
|
||||
{ 0x3EA1, MFX_HW_CFL },
|
||||
{ 0x3EA2, MFX_HW_CFL },
|
||||
{ 0x3EA3, MFX_HW_CFL },
|
||||
{ 0x3EA4, MFX_HW_CFL },
|
||||
|
||||
|
||||
/* CML GT1 */
|
||||
{ 0x9b21, MFX_HW_CFL },
|
||||
{ 0x9baa, MFX_HW_CFL },
|
||||
{ 0x9bab, MFX_HW_CFL },
|
||||
{ 0x9bac, MFX_HW_CFL },
|
||||
{ 0x9ba0, MFX_HW_CFL },
|
||||
{ 0x9ba5, MFX_HW_CFL },
|
||||
{ 0x9ba8, MFX_HW_CFL },
|
||||
{ 0x9ba4, MFX_HW_CFL },
|
||||
{ 0x9ba2, MFX_HW_CFL },
|
||||
|
||||
/* CML GT2 */
|
||||
{ 0x9b41, MFX_HW_CFL },
|
||||
{ 0x9bca, MFX_HW_CFL },
|
||||
{ 0x9bcb, MFX_HW_CFL },
|
||||
{ 0x9bcc, MFX_HW_CFL },
|
||||
{ 0x9bc0, MFX_HW_CFL },
|
||||
{ 0x9bc5, MFX_HW_CFL },
|
||||
{ 0x9bc8, MFX_HW_CFL },
|
||||
{ 0x9bc4, MFX_HW_CFL },
|
||||
{ 0x9bc2, MFX_HW_CFL },
|
||||
{ 0x9bc6, MFX_HW_CFL },
|
||||
{ 0x9be6, MFX_HW_CFL },
|
||||
{ 0x9bf6, MFX_HW_CFL },
|
||||
|
||||
|
||||
/* CNL */
|
||||
{ 0x5A51, MFX_HW_CNL },
|
||||
{ 0x5A52, MFX_HW_CNL },
|
||||
{ 0x5A5A, MFX_HW_CNL },
|
||||
{ 0x5A40, MFX_HW_CNL },
|
||||
{ 0x5A42, MFX_HW_CNL },
|
||||
{ 0x5A4A, MFX_HW_CNL },
|
||||
{ 0x5A4C, MFX_HW_CNL },
|
||||
{ 0x5A50, MFX_HW_CNL },
|
||||
{ 0x5A54, MFX_HW_CNL },
|
||||
{ 0x5A59, MFX_HW_CNL },
|
||||
{ 0x5A5C, MFX_HW_CNL },
|
||||
{ 0x5A41, MFX_HW_CNL },
|
||||
{ 0x5A44, MFX_HW_CNL },
|
||||
{ 0x5A49, MFX_HW_CNL },
|
||||
|
||||
/* ICL LP */
|
||||
{ 0xFF05, MFX_HW_ICL_LP },
|
||||
{ 0x8A50, MFX_HW_ICL_LP },
|
||||
{ 0x8A51, MFX_HW_ICL_LP },
|
||||
{ 0x8A52, MFX_HW_ICL_LP },
|
||||
{ 0x8A53, MFX_HW_ICL_LP },
|
||||
{ 0x8A54, MFX_HW_ICL_LP },
|
||||
{ 0x8A56, MFX_HW_ICL_LP },
|
||||
{ 0x8A57, MFX_HW_ICL_LP },
|
||||
{ 0x8A58, MFX_HW_ICL_LP },
|
||||
{ 0x8A59, MFX_HW_ICL_LP },
|
||||
{ 0x8A5A, MFX_HW_ICL_LP },
|
||||
{ 0x8A5B, MFX_HW_ICL_LP },
|
||||
{ 0x8A5C, MFX_HW_ICL_LP },
|
||||
{ 0x8A5D, MFX_HW_ICL_LP },
|
||||
{ 0x8A70, MFX_HW_ICL_LP },
|
||||
{ 0x8A71, MFX_HW_ICL_LP }, // GT05, but 1 ok in this context
|
||||
|
||||
/* JSL */
|
||||
{ 0x4E51, MFX_HW_JSL },
|
||||
{ 0x4E55, MFX_HW_JSL },
|
||||
{ 0x4E61, MFX_HW_JSL },
|
||||
{ 0x4E71, MFX_HW_JSL },
|
||||
|
||||
/* EHL */
|
||||
{ 0x4500, MFX_HW_EHL },
|
||||
{ 0x4541, MFX_HW_EHL },
|
||||
{ 0x4551, MFX_HW_EHL },
|
||||
{ 0x4555, MFX_HW_EHL },
|
||||
{ 0x4569, MFX_HW_EHL },
|
||||
{ 0x4571, MFX_HW_EHL },
|
||||
|
||||
/* TGL */
|
||||
{ 0x9A40, MFX_HW_TGL_LP },
|
||||
{ 0x9A49, MFX_HW_TGL_LP },
|
||||
{ 0x9A59, MFX_HW_TGL_LP },
|
||||
{ 0x9A60, MFX_HW_TGL_LP },
|
||||
{ 0x9A68, MFX_HW_TGL_LP },
|
||||
{ 0x9A70, MFX_HW_TGL_LP },
|
||||
{ 0x9A78, MFX_HW_TGL_LP },
|
||||
|
||||
/* DG1/SG1 */
|
||||
{ 0x4905, MFX_HW_DG1 },
|
||||
{ 0x4906, MFX_HW_DG1 },
|
||||
{ 0x4907, MFX_HW_DG1 },
|
||||
{ 0x4908, MFX_HW_DG1 },
|
||||
|
||||
/* RKL */
|
||||
{ 0x4C80, MFX_HW_RKL }, // RKL-S
|
||||
{ 0x4C8A, MFX_HW_RKL }, // RKL-S
|
||||
{ 0x4C81, MFX_HW_RKL }, // RKL-S
|
||||
{ 0x4C8B, MFX_HW_RKL }, // RKL-S
|
||||
{ 0x4C90, MFX_HW_RKL }, // RKL-S
|
||||
{ 0x4C9A, MFX_HW_RKL }, // RKL-S
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int vendor_id;
|
||||
int device_id;
|
||||
eMFXHWType platform;
|
||||
} Device;
|
||||
|
||||
static inline eMFXHWType get_platform(int device_id) {
|
||||
for (unsigned i = 0; i < sizeof(msdkDevIDs) / sizeof(msdkDevIDs[0]); ++i) {
|
||||
if (msdkDevIDs[i].device_id == device_id) {
|
||||
return msdkDevIDs[i].platform;
|
||||
}
|
||||
}
|
||||
return MFX_HW_UNKNOWN;
|
||||
}
|
||||
|
||||
std::vector <Device> get_devices() {
|
||||
const char *dir = "/sys/class/drm";
|
||||
const char *device_id_file = "/device/device";
|
||||
const char *vendor_id_file = "/device/vendor";
|
||||
int i = 0;
|
||||
int err = 0;
|
||||
std::vector <Device> result;
|
||||
for (; i < 64; ++i) {
|
||||
Device device;
|
||||
std::string node_num = std::to_string(128 + i);
|
||||
std::string path = std::string(dir) + "/renderD" + node_num + vendor_id_file;
|
||||
FILE *file = fopen(path.c_str(), "r");
|
||||
if (!file) continue;
|
||||
err = fscanf(file, "%x", &device.vendor_id);
|
||||
fclose(file);
|
||||
if (err == EOF) continue;
|
||||
if (device.vendor_id != 0x8086) { // Filter out non-Intel devices
|
||||
continue;
|
||||
}
|
||||
path = std::string(dir) + "/renderD" + node_num + device_id_file;
|
||||
file = fopen(path.c_str(), "r");
|
||||
if (!file) continue;
|
||||
err = fscanf(file, "%x", &device.device_id);
|
||||
fclose(file);
|
||||
if (err == EOF) continue;
|
||||
|
||||
// if user only mapped /dev/dri/renderD129 in container, need to skip /dev/dri/renderD128
|
||||
path = "/dev/dri/renderD" + node_num;
|
||||
int fd = open(path.c_str(), O_RDWR);
|
||||
if (fd < 0) continue; //device not accessible
|
||||
close(fd);
|
||||
|
||||
device.platform = get_platform(device.device_id);
|
||||
result.emplace_back(device);
|
||||
}
|
||||
std::sort(result.begin(), result.end(), [](const Device &a, const Device &b) {
|
||||
return a.platform < b.platform;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
111
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/libmfx.map
vendored
Normal file
111
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/libmfx.map
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
LIBMFX_1.0 {
|
||||
global:
|
||||
MFXInit;
|
||||
MFXClose;
|
||||
MFXQueryIMPL;
|
||||
MFXQueryVersion;
|
||||
|
||||
MFXJoinSession;
|
||||
MFXDisjoinSession;
|
||||
MFXCloneSession;
|
||||
MFXSetPriority;
|
||||
MFXGetPriority;
|
||||
|
||||
MFXVideoCORE_SetBufferAllocator;
|
||||
MFXVideoCORE_SetFrameAllocator;
|
||||
MFXVideoCORE_SetHandle;
|
||||
MFXVideoCORE_GetHandle;
|
||||
MFXVideoCORE_SyncOperation;
|
||||
|
||||
MFXVideoENCODE_Query;
|
||||
MFXVideoENCODE_QueryIOSurf;
|
||||
MFXVideoENCODE_Init;
|
||||
MFXVideoENCODE_Reset;
|
||||
MFXVideoENCODE_Close;
|
||||
MFXVideoENCODE_GetVideoParam;
|
||||
MFXVideoENCODE_GetEncodeStat;
|
||||
MFXVideoENCODE_EncodeFrameAsync;
|
||||
|
||||
MFXVideoDECODE_Query;
|
||||
MFXVideoDECODE_DecodeHeader;
|
||||
MFXVideoDECODE_QueryIOSurf;
|
||||
MFXVideoDECODE_Init;
|
||||
MFXVideoDECODE_Reset;
|
||||
MFXVideoDECODE_Close;
|
||||
MFXVideoDECODE_GetVideoParam;
|
||||
MFXVideoDECODE_GetDecodeStat;
|
||||
MFXVideoDECODE_SetSkipMode;
|
||||
MFXVideoDECODE_GetPayload;
|
||||
MFXVideoDECODE_DecodeFrameAsync;
|
||||
|
||||
MFXVideoVPP_Query;
|
||||
MFXVideoVPP_QueryIOSurf;
|
||||
MFXVideoVPP_Init;
|
||||
MFXVideoVPP_Reset;
|
||||
MFXVideoVPP_Close;
|
||||
|
||||
MFXVideoVPP_GetVideoParam;
|
||||
MFXVideoVPP_GetVPPStat;
|
||||
MFXVideoVPP_RunFrameVPPAsync;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
||||
|
||||
LIBMFX_1.1 {
|
||||
global:
|
||||
MFXVideoUSER_Register;
|
||||
MFXVideoUSER_Unregister;
|
||||
MFXVideoUSER_ProcessFrameAsync;
|
||||
} LIBMFX_1.0;
|
||||
|
||||
LIBMFX_1.8 {
|
||||
global:
|
||||
MFXVideoUSER_Load;
|
||||
MFXVideoUSER_UnLoad;
|
||||
} LIBMFX_1.1;
|
||||
|
||||
LIBMFX_1.10 {
|
||||
global:
|
||||
MFXVideoENC_Query;
|
||||
MFXVideoENC_QueryIOSurf;
|
||||
MFXVideoENC_Init;
|
||||
MFXVideoENC_Reset;
|
||||
MFXVideoENC_Close;
|
||||
MFXVideoENC_ProcessFrameAsync;
|
||||
MFXVideoVPP_RunFrameVPPAsyncEx;
|
||||
|
||||
} LIBMFX_1.1;
|
||||
|
||||
LIBMFX_1.13 {
|
||||
global:
|
||||
MFXVideoPAK_Query;
|
||||
MFXVideoPAK_QueryIOSurf;
|
||||
MFXVideoPAK_Init;
|
||||
MFXVideoPAK_Reset;
|
||||
MFXVideoPAK_Close;
|
||||
MFXVideoPAK_ProcessFrameAsync;
|
||||
MFXVideoUSER_LoadByPath;
|
||||
} LIBMFX_1.10;
|
||||
|
||||
LIBMFX_1.14 {
|
||||
global:
|
||||
MFXInitEx;
|
||||
MFXDoWork;
|
||||
} LIBMFX_1.13;
|
||||
|
||||
LIBMFX_1.19 {
|
||||
global:
|
||||
MFXVideoENC_GetVideoParam;
|
||||
MFXVideoPAK_GetVideoParam;
|
||||
MFXVideoCORE_QueryPlatform;
|
||||
MFXVideoUSER_GetPlugin;
|
||||
} LIBMFX_1.14;
|
||||
|
||||
LIBMFXAUDIO_1.9 {
|
||||
global:
|
||||
MFXAudioUSER_Load;
|
||||
MFXAudioUSER_UnLoad;
|
||||
local:
|
||||
*;
|
||||
};
|
||||
71
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/mfxaudio_functions.h
vendored
Normal file
71
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/mfxaudio_functions.h
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
// Copyright (c) 2017 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
//
|
||||
// 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
|
||||
621
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/mfxloader.cpp
vendored
Normal file
621
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/mfxloader.cpp
vendored
Normal file
@@ -0,0 +1,621 @@
|
||||
// Copyright (c) 2017-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <assert.h>
|
||||
#include <dlfcn.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "mfxvideo.h"
|
||||
#include "mfxplugin.h"
|
||||
#include "mfxpak.h"
|
||||
|
||||
#include "mfxloader.h"
|
||||
|
||||
#include "device_ids.h"
|
||||
|
||||
namespace MFX {
|
||||
|
||||
#if defined(__i386__)
|
||||
#ifdef ANDROID
|
||||
#define LIBMFXSW "libmfxsw32.so"
|
||||
#define LIBMFXHW "libmfxhw32.so"
|
||||
#else
|
||||
#define LIBMFXSW "libmfxsw32.so.1"
|
||||
#define LIBMFXHW "libmfxhw32.so.1"
|
||||
#define ONEVPLRT "libmfx-gen.so.1.2"
|
||||
#endif
|
||||
#elif defined(__x86_64__)
|
||||
#ifdef ANDROID
|
||||
#define LIBMFXSW "libmfxsw64.so"
|
||||
#define LIBMFXHW "libmfxhw64.so"
|
||||
#else
|
||||
#define LIBMFXSW "libmfxsw64.so.1"
|
||||
#define LIBMFXHW "libmfxhw64.so.1"
|
||||
#define ONEVPLRT "libmfx-gen.so.1.2"
|
||||
#endif
|
||||
#else
|
||||
#error Unsupported architecture
|
||||
#endif
|
||||
|
||||
#undef FUNCTION
|
||||
#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \
|
||||
e##func_name,
|
||||
|
||||
enum Function
|
||||
{
|
||||
eMFXInit,
|
||||
eMFXInitEx,
|
||||
eMFXClose,
|
||||
eMFXJoinSession,
|
||||
#include "mfxvideo_functions.h"
|
||||
eFunctionsNum,
|
||||
eNoMoreFunctions = eFunctionsNum
|
||||
};
|
||||
|
||||
struct FunctionsTable
|
||||
{
|
||||
Function id;
|
||||
const char* name;
|
||||
mfxVersion version;
|
||||
};
|
||||
|
||||
#define VERSION(major, minor) {{minor, major}}
|
||||
|
||||
#undef FUNCTION
|
||||
#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \
|
||||
{ e##func_name, #func_name, API_VERSION },
|
||||
|
||||
static const FunctionsTable g_mfxFuncTable[] =
|
||||
{
|
||||
{ eMFXInit, "MFXInit", VERSION(1, 0) },
|
||||
{ eMFXInitEx, "MFXInitEx", VERSION(1, 14) },
|
||||
{ eMFXClose, "MFXClose", VERSION(1, 0) },
|
||||
{ eMFXJoinSession, "MFXJoinSession", VERSION(1, 1) },
|
||||
#include "mfxvideo_functions.h"
|
||||
{ eNoMoreFunctions }
|
||||
};
|
||||
|
||||
typedef mfxStatus (MFX_CDECL *CreatePluginPtr)(mfxPluginUID, mfxPlugin*);
|
||||
|
||||
class LoaderCtx;
|
||||
|
||||
class PluginCtx
|
||||
{
|
||||
public:
|
||||
PluginCtx(LoaderCtx& loader)
|
||||
: m_loader(loader)
|
||||
{}
|
||||
|
||||
mfxStatus Load(const mfxPluginUID& uid, mfxU32 version, const char *path);
|
||||
mfxStatus Unload();
|
||||
|
||||
inline mfxPluginUID getUID() const { return m_uid; }
|
||||
|
||||
private:
|
||||
LoaderCtx& m_loader;
|
||||
std::shared_ptr<void> m_dlh;
|
||||
CreatePluginPtr m_create_plugin = nullptr;
|
||||
mfxPluginUID m_uid{};
|
||||
mfxPlugin m_plugin{};
|
||||
mfxPluginParam m_plugin_param{};
|
||||
};
|
||||
|
||||
class LoaderCtx
|
||||
{
|
||||
public:
|
||||
mfxStatus Init(mfxInitParam& par);
|
||||
mfxStatus Close();
|
||||
|
||||
mfxStatus LoadPlugin(const mfxPluginUID& uid, mfxU32 version, const char *path);
|
||||
mfxStatus UnloadPlugin(const mfxPluginUID& uid);
|
||||
|
||||
inline void* getFunction(Function func) const {
|
||||
return m_table[func];
|
||||
}
|
||||
|
||||
inline mfxSession getSession() const {
|
||||
return m_session;
|
||||
}
|
||||
|
||||
inline mfxIMPL getImpl() const {
|
||||
return m_implementation;
|
||||
}
|
||||
|
||||
inline mfxVersion getVersion() const {
|
||||
return m_version;
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<void> m_dlh;
|
||||
mfxVersion m_version{};
|
||||
mfxIMPL m_implementation{};
|
||||
mfxSession m_session = nullptr;
|
||||
void* m_table[eFunctionsNum]{};
|
||||
|
||||
std::mutex m_guard;
|
||||
std::list<PluginCtx> m_plugins;
|
||||
};
|
||||
|
||||
struct GlobalCtx
|
||||
{
|
||||
std::mutex m_mutex;
|
||||
std::list<PluginInfo> m_plugins;
|
||||
};
|
||||
|
||||
static GlobalCtx g_GlobalCtx;
|
||||
|
||||
std::shared_ptr<void> make_dlopen(const char* filename, int flags)
|
||||
{
|
||||
return std::shared_ptr<void>(
|
||||
dlopen(filename, flags),
|
||||
[] (void* handle) { if (handle) dlclose(handle); });
|
||||
}
|
||||
|
||||
mfxStatus LoaderCtx::Init(mfxInitParam& par)
|
||||
{
|
||||
if (par.Implementation & MFX_IMPL_AUDIO) {
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
eMFXHWType platform = MFX_HW_UNKNOWN;
|
||||
auto devices = get_devices();
|
||||
if (devices.size()) {
|
||||
platform = devices[devices.size() - 1].platform;
|
||||
}
|
||||
|
||||
std::vector<std::string> libs;
|
||||
|
||||
const char *selected_runtime = getenv("INTEL_MEDIA_RUNTIME");
|
||||
if (selected_runtime && strcmp(selected_runtime, "ONEVPL") == 0) {
|
||||
libs.emplace_back(ONEVPLRT);
|
||||
libs.emplace_back(MFX_MODULES_DIR "/" ONEVPLRT);
|
||||
} else if ((selected_runtime && strcmp(selected_runtime, "MSDK") == 0) || (platform != MFX_HW_UNKNOWN)) {
|
||||
if (MFX_IMPL_BASETYPE(par.Implementation) == MFX_IMPL_AUTO ||
|
||||
MFX_IMPL_BASETYPE(par.Implementation) == MFX_IMPL_AUTO_ANY) {
|
||||
libs.emplace_back(LIBMFXHW);
|
||||
libs.emplace_back(MFX_MODULES_DIR "/" LIBMFXHW);
|
||||
libs.emplace_back(LIBMFXSW);
|
||||
libs.emplace_back(MFX_MODULES_DIR "/" LIBMFXSW);
|
||||
} else if (par.Implementation & MFX_IMPL_HARDWARE ||
|
||||
par.Implementation & MFX_IMPL_HARDWARE_ANY) {
|
||||
libs.emplace_back(LIBMFXHW);
|
||||
libs.emplace_back(MFX_MODULES_DIR "/" LIBMFXHW);
|
||||
} else if (par.Implementation & MFX_IMPL_SOFTWARE) {
|
||||
libs.emplace_back(LIBMFXSW);
|
||||
libs.emplace_back(MFX_MODULES_DIR "/" LIBMFXSW);
|
||||
} else {
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
} else {
|
||||
libs.emplace_back(ONEVPLRT);
|
||||
libs.emplace_back(MFX_MODULES_DIR "/" ONEVPLRT);
|
||||
}
|
||||
|
||||
mfxStatus mfx_res = MFX_ERR_UNSUPPORTED;
|
||||
|
||||
for (auto& lib: libs) {
|
||||
std::shared_ptr<void> hdl = make_dlopen(lib.c_str(), RTLD_LOCAL|RTLD_NOW);
|
||||
if (hdl) {
|
||||
do {
|
||||
/* Loading functions table */
|
||||
bool wrong_version = false;
|
||||
for (int i = 0; i < eFunctionsNum; ++i) {
|
||||
assert(i == g_mfxFuncTable[i].id);
|
||||
m_table[i] = dlsym(hdl.get(), g_mfxFuncTable[i].name);
|
||||
if (!m_table[i] && ((par.Version <= g_mfxFuncTable[i].version) ||
|
||||
(g_mfxFuncTable[i].version <= mfxVersion(VERSION(1, 14))))) {
|
||||
// this version of dispatcher requires MFXInitEx which appeared
|
||||
// in Media SDK API 1.14
|
||||
wrong_version = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (wrong_version) {
|
||||
mfx_res = MFX_ERR_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Initializing loaded library */
|
||||
mfx_res = ((decltype(MFXInitEx)*)m_table[eMFXInitEx])(par, &m_session);
|
||||
if (MFX_ERR_NONE != mfx_res) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Below we just get some data and double check that we got what we have expected
|
||||
// to get. Some of these checks are done inside mediasdk init function
|
||||
mfx_res = ((decltype(MFXQueryVersion)*)m_table[eMFXQueryVersion])(m_session, &m_version);
|
||||
if (MFX_ERR_NONE != mfx_res) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_version < par.Version) {
|
||||
mfx_res = MFX_ERR_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
mfx_res = ((decltype(MFXQueryIMPL)*)m_table[eMFXQueryIMPL])(m_session, &m_implementation);
|
||||
if (MFX_ERR_NONE != mfx_res) {
|
||||
mfx_res = MFX_ERR_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
} while(false);
|
||||
|
||||
if (MFX_ERR_NONE == mfx_res) {
|
||||
m_dlh = std::move(hdl);
|
||||
break;
|
||||
} else {
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return mfx_res;
|
||||
}
|
||||
|
||||
mfxStatus LoaderCtx::Close()
|
||||
{
|
||||
auto proc = (decltype(MFXClose)*)m_table[eMFXClose];
|
||||
mfxStatus mfx_res = (proc)? (*proc)(m_session): MFX_ERR_NONE;
|
||||
|
||||
m_implementation = {};
|
||||
m_version = {};
|
||||
m_session = nullptr;
|
||||
std::fill(std::begin(m_table), std::end(m_table), nullptr);
|
||||
return mfx_res;
|
||||
}
|
||||
|
||||
mfxStatus PluginCtx::Load(const mfxPluginUID& uid, mfxU32 version, const char *path)
|
||||
{
|
||||
if (!path) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
mfxStatus mfx_res = MFX_ERR_NONE;
|
||||
std::shared_ptr<void> hdl = make_dlopen(path, RTLD_LOCAL|RTLD_NOW);
|
||||
|
||||
if (!hdl) {
|
||||
return MFX_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
do {
|
||||
m_uid = uid;
|
||||
m_create_plugin = (CreatePluginPtr)dlsym(hdl.get(), "CreatePlugin");
|
||||
if (!m_create_plugin) {
|
||||
mfx_res = MFX_ERR_NOT_FOUND;
|
||||
break;
|
||||
}
|
||||
|
||||
mfx_res = m_create_plugin(m_uid, &m_plugin);
|
||||
if (MFX_ERR_NONE != mfx_res) {
|
||||
break;
|
||||
}
|
||||
|
||||
mfx_res = m_plugin.GetPluginParam(m_plugin.pthis, &m_plugin_param);
|
||||
if (MFX_ERR_NONE != mfx_res) {
|
||||
break;
|
||||
}
|
||||
|
||||
mfx_res = MFXVideoUSER_Register((mfxSession)&m_loader, m_plugin_param.Type, &m_plugin);
|
||||
if (MFX_ERR_NONE != mfx_res) {
|
||||
break;
|
||||
}
|
||||
} while(false);
|
||||
|
||||
if (MFX_ERR_NONE == mfx_res) {
|
||||
m_dlh = std::move(hdl);
|
||||
} else {
|
||||
m_uid = {};
|
||||
m_create_plugin = nullptr;
|
||||
m_plugin = {};
|
||||
m_plugin_param = {};
|
||||
}
|
||||
return mfx_res;
|
||||
}
|
||||
|
||||
mfxStatus PluginCtx::Unload()
|
||||
{
|
||||
return MFXVideoUSER_Unregister((mfxSession)&m_loader, m_plugin_param.Type);
|
||||
}
|
||||
|
||||
mfxStatus LoaderCtx::LoadPlugin(const mfxPluginUID &uid, mfxU32 version, const char *path)
|
||||
{
|
||||
if (!path) return MFX_ERR_NULL_PTR;
|
||||
|
||||
std::lock_guard<std::mutex> lock(m_guard);
|
||||
|
||||
for (auto& it: m_plugins) {
|
||||
if (it.getUID() == uid) return MFX_ERR_UNDEFINED_BEHAVIOR;
|
||||
}
|
||||
|
||||
PluginCtx ctx(*this);
|
||||
|
||||
mfxStatus mfx_res = ctx.Load(uid, version, path);
|
||||
if (MFX_ERR_NONE != mfx_res) {
|
||||
return mfx_res;
|
||||
}
|
||||
|
||||
m_plugins.emplace_back(std::move(ctx));
|
||||
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
mfxStatus LoaderCtx::UnloadPlugin(const mfxPluginUID& uid)
|
||||
{
|
||||
std::list<PluginCtx> ctx;
|
||||
{
|
||||
// We will move plugin ctx which we are going to delete to the
|
||||
// array allocated on stack. In this way we will move bottom half
|
||||
// of plugin ctx destroy, including potentially long dlclose, out
|
||||
// of the mutex.
|
||||
std::lock_guard<std::mutex> lock(m_guard);
|
||||
auto it = std::find_if(std::begin(m_plugins), std::end(m_plugins),
|
||||
[&uid](const PluginCtx& cur_ctx){ return cur_ctx.getUID() == uid; });
|
||||
|
||||
if (it != std::end(m_plugins)) {
|
||||
mfxStatus mfx_res = it->Unload();
|
||||
if (MFX_ERR_NONE != mfx_res) {
|
||||
return mfx_res;
|
||||
}
|
||||
ctx.splice(ctx.end(), m_plugins, it);
|
||||
}
|
||||
}
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
} // namespace MFX
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
mfxStatus MFXInit(mfxIMPL impl, mfxVersion *ver, mfxSession *session)
|
||||
{
|
||||
mfxInitParam par{};
|
||||
|
||||
par.Implementation = impl;
|
||||
if (ver) {
|
||||
par.Version = *ver;
|
||||
} else {
|
||||
par.Version = VERSION(MFX_VERSION_MAJOR, MFX_VERSION_MINOR);
|
||||
}
|
||||
|
||||
return MFXInitEx(par, session);
|
||||
}
|
||||
|
||||
mfxStatus MFXInitEx(mfxInitParam par, mfxSession *session)
|
||||
{
|
||||
if (!session) return MFX_ERR_NULL_PTR;
|
||||
|
||||
try {
|
||||
std::unique_ptr<MFX::LoaderCtx> loader;
|
||||
|
||||
loader.reset(new MFX::LoaderCtx{});
|
||||
|
||||
mfxStatus mfx_res = loader->Init(par);
|
||||
if (MFX_ERR_NONE == mfx_res) {
|
||||
*session = (mfxSession)loader.release();
|
||||
} else {
|
||||
*session = nullptr;
|
||||
}
|
||||
|
||||
return mfx_res;
|
||||
} catch(...) {
|
||||
return MFX_ERR_MEMORY_ALLOC;
|
||||
}
|
||||
}
|
||||
|
||||
mfxStatus MFXClose(mfxSession session)
|
||||
{
|
||||
if (!session) return MFX_ERR_INVALID_HANDLE;
|
||||
|
||||
try {
|
||||
std::unique_ptr<MFX::LoaderCtx> loader((MFX::LoaderCtx*)session);
|
||||
mfxStatus mfx_res = loader->Close();
|
||||
|
||||
if (mfx_res == MFX_ERR_UNDEFINED_BEHAVIOR) {
|
||||
// It is possible, that there is an active child session.
|
||||
// Can't unload library in this case.
|
||||
loader.release();
|
||||
}
|
||||
return mfx_res;
|
||||
} catch(...) {
|
||||
return MFX_ERR_MEMORY_ALLOC;
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool IsEmbeddedPlugin(const mfxPluginUID *uid)
|
||||
{
|
||||
return (
|
||||
*uid == MFX_PLUGINID_HEVCD_HW ||
|
||||
*uid == MFX_PLUGINID_HEVCE_HW ||
|
||||
*uid == MFX_PLUGINID_VP8D_HW ||
|
||||
*uid == MFX_PLUGINID_VP8E_HW ||
|
||||
*uid == MFX_PLUGINID_VP9D_HW ||
|
||||
*uid == MFX_PLUGINID_VP9E_HW);
|
||||
}
|
||||
|
||||
mfxStatus MFXVideoUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version)
|
||||
{
|
||||
if (!session) return MFX_ERR_INVALID_HANDLE;
|
||||
if (!uid) return MFX_ERR_NULL_PTR;
|
||||
if (IsEmbeddedPlugin(uid)) {
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
try {
|
||||
MFX::LoaderCtx* loader = (MFX::LoaderCtx*)session;
|
||||
std::string path;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(MFX::g_GlobalCtx.m_mutex);
|
||||
|
||||
auto find_uid = [](const mfxPluginUID& puid) {
|
||||
return std::find_if(
|
||||
MFX::g_GlobalCtx.m_plugins.begin(),
|
||||
MFX::g_GlobalCtx.m_plugins.end(),
|
||||
[&puid](MFX::PluginInfo& item){ return item.getUID() == puid; }
|
||||
);
|
||||
};
|
||||
|
||||
if (MFX::g_GlobalCtx.m_plugins.empty()) {
|
||||
// Parsing plugin configuration file and loading information of
|
||||
// _all_ plugins registered on the system.
|
||||
parse(MFX_PLUGINS_CONF_DIR "/plugins.cfg", MFX::g_GlobalCtx.m_plugins);
|
||||
}
|
||||
|
||||
// search for plugin description
|
||||
auto it = find_uid(*uid);
|
||||
if (it == MFX::g_GlobalCtx.m_plugins.end()) {
|
||||
return MFX_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
path = it->getPath();
|
||||
}
|
||||
|
||||
return loader->LoadPlugin(*uid, version, path.c_str());
|
||||
} catch(...) {
|
||||
return MFX_ERR_MEMORY_ALLOC;
|
||||
}
|
||||
}
|
||||
|
||||
mfxStatus MFXVideoUSER_LoadByPath(mfxSession session, const mfxPluginUID *uid, mfxU32 version, const mfxChar *path, mfxU32 /*len*/)
|
||||
{
|
||||
if (!session) return MFX_ERR_INVALID_HANDLE;
|
||||
if (!uid) return MFX_ERR_NULL_PTR;
|
||||
if (IsEmbeddedPlugin(uid)) {
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
try {
|
||||
MFX::LoaderCtx* loader = (MFX::LoaderCtx*)session;
|
||||
return loader->LoadPlugin(*uid, version, path);
|
||||
} catch(...) {
|
||||
return MFX_ERR_MEMORY_ALLOC;
|
||||
}
|
||||
}
|
||||
|
||||
mfxStatus MFXVideoUSER_UnLoad(mfxSession session, const mfxPluginUID *uid)
|
||||
{
|
||||
if (!session) return MFX_ERR_INVALID_HANDLE;
|
||||
if (!uid) return MFX_ERR_NULL_PTR;
|
||||
if (IsEmbeddedPlugin(uid)) {
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
try {
|
||||
MFX::LoaderCtx* loader = (MFX::LoaderCtx*)session;
|
||||
return loader->UnloadPlugin(*uid);
|
||||
} catch(...) {
|
||||
return MFX_ERR_MEMORY_ALLOC;
|
||||
}
|
||||
}
|
||||
|
||||
mfxStatus MFXAudioUSER_Load(mfxSession session, const mfxPluginUID *uid, mfxU32 version)
|
||||
{
|
||||
return MFX_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
mfxStatus MFXAudioUSER_UnLoad(mfxSession session, const mfxPluginUID *uid)
|
||||
{
|
||||
return MFX_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
mfxStatus MFXJoinSession(mfxSession session, mfxSession child_session)
|
||||
{
|
||||
if (!session || !child_session) {
|
||||
return MFX_ERR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
MFX::LoaderCtx* loader = (MFX::LoaderCtx*)session;
|
||||
MFX::LoaderCtx* child_loader = (MFX::LoaderCtx*)child_session;
|
||||
|
||||
if (loader->getVersion().Version != child_loader->getVersion().Version) {
|
||||
return MFX_ERR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
auto proc = (decltype(MFXJoinSession)*)loader->getFunction(MFX::eMFXJoinSession);
|
||||
if (!proc) {
|
||||
return MFX_ERR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
return (*proc)(loader->getSession(), child_loader->getSession());
|
||||
}
|
||||
|
||||
mfxStatus MFXCloneSession(mfxSession session, mfxSession *clone)
|
||||
{
|
||||
if (!session) return MFX_ERR_INVALID_HANDLE;
|
||||
|
||||
MFX::LoaderCtx* loader = (MFX::LoaderCtx*)session;
|
||||
// initialize the clone session
|
||||
mfxVersion version = loader->getVersion();
|
||||
mfxStatus mfx_res = MFXInit(loader->getImpl(), &version, clone);
|
||||
if (MFX_ERR_NONE != mfx_res) {
|
||||
return mfx_res;
|
||||
}
|
||||
|
||||
// join the sessions
|
||||
mfx_res = MFXJoinSession(session, *clone);
|
||||
if (MFX_ERR_NONE != mfx_res) {
|
||||
MFXClose(*clone);
|
||||
*clone = nullptr;
|
||||
return mfx_res;
|
||||
}
|
||||
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
#undef FUNCTION
|
||||
#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \
|
||||
return_value MFX_CDECL func_name formal_param_list \
|
||||
{ \
|
||||
/* get the function's address and make a call */ \
|
||||
if (!session) return MFX_ERR_INVALID_HANDLE; \
|
||||
\
|
||||
MFX::LoaderCtx *loader = (MFX::LoaderCtx*) session; \
|
||||
\
|
||||
auto proc = (decltype(func_name)*)loader->getFunction(MFX::e##func_name); \
|
||||
if (!proc) return MFX_ERR_INVALID_HANDLE; \
|
||||
\
|
||||
/* get the real session pointer */ \
|
||||
session = loader->getSession(); \
|
||||
/* pass down the call */ \
|
||||
return (*proc) actual_param_list; \
|
||||
}
|
||||
|
||||
#include "mfxvideo_functions.h"
|
||||
|
||||
#undef FUNCTION
|
||||
#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list)
|
||||
// as of now we don't expose audio support, but we still want to check certain
|
||||
// consistency of mfxaudio_functions.h file, so include it here
|
||||
|
||||
#include "mfxaudio_functions.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
104
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/mfxloader.h
vendored
Normal file
104
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/mfxloader.h
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// Copyright (c) 2017-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#ifndef __MFXLOADER_H__
|
||||
#define __MFXLOADER_H__
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "mfxdefs.h"
|
||||
#include "mfxplugin.h"
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
inline bool operator < (const mfxVersion &lhs, const mfxVersion & rhs)
|
||||
{
|
||||
return (lhs.Major < rhs.Major ||
|
||||
(lhs.Major == rhs.Major && lhs.Minor < rhs.Minor));
|
||||
}
|
||||
|
||||
inline bool operator <= (const mfxVersion &lhs, const mfxVersion & rhs)
|
||||
{
|
||||
return (lhs < rhs || (lhs.Major == rhs.Major && lhs.Minor == rhs.Minor));
|
||||
}
|
||||
|
||||
namespace MFX {
|
||||
|
||||
class PluginInfo : public mfxPluginParam
|
||||
{
|
||||
public:
|
||||
PluginInfo()
|
||||
: mfxPluginParam()
|
||||
, m_parsed()
|
||||
, m_path()
|
||||
, m_default()
|
||||
{}
|
||||
|
||||
inline bool isValid() {
|
||||
return m_parsed;
|
||||
}
|
||||
|
||||
inline mfxPluginUID getUID() {
|
||||
return PluginUID;
|
||||
}
|
||||
|
||||
inline std::string getPath() {
|
||||
return std::string(m_path);
|
||||
}
|
||||
|
||||
void Load(const char* name, const char* value);
|
||||
void Print();
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
PARSED_TYPE = 0x1,
|
||||
PARSED_CODEC_ID = 0x2,
|
||||
PARSED_UID = 0x4,
|
||||
PARSED_PATH = 0x8,
|
||||
PARSED_DEFAULT = 0x10,
|
||||
PARSED_VERSION = 0x20,
|
||||
PARSED_API_VERSION = 0x40,
|
||||
PARSED_NAME = 0x80,
|
||||
};
|
||||
|
||||
mfxU32 m_parsed;
|
||||
|
||||
char m_path[PATH_MAX];
|
||||
bool m_default;
|
||||
};
|
||||
|
||||
void parse(const char* file_name, std::list<PluginInfo>& all_records);
|
||||
|
||||
|
||||
} // namespace MFX
|
||||
|
||||
#endif
|
||||
215
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/mfxparser.cpp
vendored
Normal file
215
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/mfxparser.cpp
vendored
Normal file
@@ -0,0 +1,215 @@
|
||||
// Copyright (c) 2017-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "mfxloader.h"
|
||||
|
||||
namespace MFX {
|
||||
|
||||
static bool parseGUID(const char* src, mfxPluginUID* uid)
|
||||
{
|
||||
mfxPluginUID plugin_uid{};
|
||||
mfxU8* p = plugin_uid.Data;
|
||||
|
||||
int res = sscanf(src,
|
||||
"%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx",
|
||||
p, p + 1, p + 2, p + 3, p + 4, p + 5, p + 6, p + 7,
|
||||
p + 8, p + 9, p + 10, p + 11, p + 12, p + 13, p + 14, p + 15);
|
||||
|
||||
if (res != sizeof(uid->Data)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*uid = plugin_uid;
|
||||
return true;
|
||||
}
|
||||
|
||||
static std::string printUID(const mfxPluginUID& uid)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << std::hex;
|
||||
for (auto c: uid.Data) ss << static_cast<unsigned>(c);
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
static std::string printCodecId(mfxU32 id)
|
||||
{
|
||||
uint8_t* data = reinterpret_cast<uint8_t*>(&id);
|
||||
std::stringstream ss;
|
||||
for (size_t i=0; i < sizeof(id); ++i) ss << data[i];
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void PluginInfo::Load(const char* name, const char* value)
|
||||
{
|
||||
#ifdef LINUX64
|
||||
#define FIELD_FileName "FileName64"
|
||||
#else
|
||||
#define FIELD_FileName "FileName32"
|
||||
#endif
|
||||
|
||||
if (!strcmp(name, "Type")) {
|
||||
Type = atoi(value);
|
||||
m_parsed |= PARSED_TYPE;
|
||||
} else if (!strcmp(name, "CodecID")) {
|
||||
const int fourccLen = 4;
|
||||
if (strlen(value) == 0 || strlen(value) > fourccLen)
|
||||
return;
|
||||
|
||||
CodecId = MFX_MAKEFOURCC(' ',' ',' ',' ');
|
||||
char* id = reinterpret_cast<char*>(&CodecId);
|
||||
for (size_t i = 0; i < strlen(value); ++i)
|
||||
id[i] = value[i];
|
||||
|
||||
m_parsed |= PARSED_CODEC_ID;
|
||||
} else if (!strcmp(name, "GUID")) {
|
||||
if (!parseGUID(value, &PluginUID))
|
||||
return;
|
||||
|
||||
m_parsed |= PARSED_UID;
|
||||
} else if (!strcmp(name, "Path") || !strcmp(name, FIELD_FileName)) {
|
||||
// strip quotes
|
||||
std::string str_value(value);
|
||||
|
||||
if (!str_value.empty() && str_value.front() == '"' && str_value.back() == '"')
|
||||
{
|
||||
str_value.pop_back();
|
||||
|
||||
if (!str_value.empty())
|
||||
str_value.erase(0, 1);
|
||||
}
|
||||
|
||||
if (strlen(m_path) + strlen("/") + str_value.size() >= PATH_MAX)
|
||||
return;
|
||||
strncpy(m_path + strlen(m_path), str_value.c_str(), str_value.size() + 1);
|
||||
m_parsed |= PARSED_PATH;
|
||||
} else if (0 == strcmp(name, "Default")) {
|
||||
m_default = (0 != atoi(value));
|
||||
m_parsed |= PARSED_DEFAULT;
|
||||
} else if (0 == strcmp(name, "PluginVersion")) {
|
||||
PluginVersion = atoi(value);
|
||||
m_parsed |= PARSED_VERSION;
|
||||
} else if (0 == strcmp(name, "APIVersion")) {
|
||||
APIVersion.Version = atoi(value);
|
||||
m_parsed |= PARSED_API_VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
void PluginInfo::Print()
|
||||
{
|
||||
printf("[%s]\n", printUID(PluginUID).c_str());
|
||||
printf(" GUID=%s\n", printUID(PluginUID).c_str());
|
||||
printf(" PluginVersion=%d\n", PluginVersion);
|
||||
printf(" APIVersion=%d\n", APIVersion.Version);
|
||||
printf(" Path=%s\n", m_path);
|
||||
printf(" Type=%d\n", Type);
|
||||
printf(" CodecID=%s\n", printCodecId(CodecId).c_str());
|
||||
printf(" Default=%d\n", m_default);
|
||||
}
|
||||
|
||||
const std::string space_search_pattern(" \f\n\r\t\v");
|
||||
// strip tailing spaces
|
||||
void strip(std::string & str)
|
||||
{
|
||||
static_assert(std::string::npos + 1 == 0, "");
|
||||
str.erase(str.find_last_not_of(space_search_pattern) + 1);
|
||||
}
|
||||
|
||||
// skip initial spaces
|
||||
void skip(std::string & str)
|
||||
{
|
||||
str.erase(0, str.find_first_not_of(space_search_pattern));
|
||||
}
|
||||
|
||||
void parse(const char* file_name, std::list<PluginInfo>& plugins)
|
||||
{
|
||||
#if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)
|
||||
const char* mode = "re";
|
||||
#else
|
||||
const char* mode = "r";
|
||||
#endif
|
||||
|
||||
FILE* file = fopen(file_name, mode);
|
||||
if (!file)
|
||||
return;
|
||||
|
||||
char c_line[PATH_MAX];
|
||||
PluginInfo plg;
|
||||
std::string line;
|
||||
|
||||
while(fgets(c_line, PATH_MAX, file))
|
||||
{
|
||||
line = c_line;
|
||||
|
||||
strip(line);
|
||||
skip(line);
|
||||
|
||||
if (line.find_first_not_of(";#") != 0)
|
||||
{
|
||||
// skip comments
|
||||
continue;
|
||||
}
|
||||
else if (line[0] == '[')
|
||||
{
|
||||
if (plg.isValid()) {
|
||||
plugins.push_back(std::move(plg));
|
||||
plg = PluginInfo{};
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string name = line, value = line;
|
||||
|
||||
size_t pos = value.find_first_of("=:");
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
// Get left part relative to delimiter
|
||||
name.erase(pos);
|
||||
strip(name);
|
||||
|
||||
// Get right part relative to delimiter
|
||||
value.erase(0, pos + 1);
|
||||
skip(value);
|
||||
|
||||
static_assert(std::string::npos + 1 == 0, "");
|
||||
value.erase(value.find_last_not_of(";#") + 1);
|
||||
}
|
||||
if (!name.empty() && !value.empty()) {
|
||||
plg.Load(name.c_str(), value.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plg.isValid()) {
|
||||
plugins.push_back(std::move(plg));
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
|
||||
//print(plugins); // for debug
|
||||
}
|
||||
|
||||
} // namespace MFX
|
||||
148
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/mfxvideo_functions.h
vendored
Normal file
148
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/mfxvideo_functions.h
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
// Copyright (c) 2017 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
//
|
||||
// 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}}
|
||||
|
||||
FUNCTION(mfxStatus, MFXQueryIMPL, (mfxSession session, mfxIMPL *impl), (session, impl))
|
||||
FUNCTION(mfxStatus, MFXQueryVersion, (mfxSession session, mfxVersion *version), (session, version))
|
||||
|
||||
// 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, MFXDisjoinSession, (mfxSession session), (session))
|
||||
FUNCTION(mfxStatus, MFXSetPriority, (mfxSession session, mfxPriority priority), (session, priority))
|
||||
FUNCTION(mfxStatus, MFXGetPriority, (mfxSession session, mfxPriority *priority), (session, priority))
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoUSER_Register, (mfxSession session, mfxU32 type, const mfxPlugin *par), (session, type, par))
|
||||
FUNCTION(mfxStatus, MFXVideoUSER_Unregister, (mfxSession session, mfxU32 type), (session, type))
|
||||
FUNCTION(mfxStatus, MFXVideoUSER_ProcessFrameAsync, (mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp), (session, in, in_num, out, out_num, syncp))
|
||||
|
||||
#undef API_VERSION
|
||||
|
||||
//
|
||||
// API version 1.10 functions
|
||||
//
|
||||
|
||||
#define API_VERSION {{10, 1}}
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoENC_Query,(mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session,in,out))
|
||||
FUNCTION(mfxStatus, MFXVideoENC_QueryIOSurf,(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session,par,request))
|
||||
FUNCTION(mfxStatus, MFXVideoENC_Init,(mfxSession session, mfxVideoParam *par), (session,par))
|
||||
FUNCTION(mfxStatus, MFXVideoENC_Reset,(mfxSession session, mfxVideoParam *par), (session,par))
|
||||
FUNCTION(mfxStatus, MFXVideoENC_Close,(mfxSession session),(session))
|
||||
FUNCTION(mfxStatus, MFXVideoENC_ProcessFrameAsync,(mfxSession session, mfxENCInput *in, mfxENCOutput *out, mfxSyncPoint *syncp),(session,in,out,syncp))
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoVPP_RunFrameVPPAsyncEx, (mfxSession session, mfxFrameSurface1 *in, mfxFrameSurface1 *work, mfxFrameSurface1 **out, mfxSyncPoint *syncp), (session, in, work, out, syncp))
|
||||
|
||||
#undef API_VERSION
|
||||
|
||||
#define API_VERSION {{13, 1}}
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_Query, (mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session, in, out))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_QueryIOSurf, (mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session, par, request))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_Init, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_Reset, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_Close, (mfxSession session), (session))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_ProcessFrameAsync, (mfxSession session, mfxPAKInput *in, mfxPAKOutput *out, mfxSyncPoint *syncp), (session, in, out, syncp))
|
||||
|
||||
#undef API_VERSION
|
||||
|
||||
#define API_VERSION {{14, 1}}
|
||||
|
||||
// FUNCTION(mfxStatus, MFXInitEx, (mfxInitParam par, mfxSession session), (par, session))
|
||||
FUNCTION(mfxStatus, MFXDoWork, (mfxSession session), (session))
|
||||
|
||||
#undef API_VERSION
|
||||
|
||||
#define API_VERSION {{19, 1}}
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoENC_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoCORE_QueryPlatform, (mfxSession session, mfxPlatform* platform), (session, platform))
|
||||
FUNCTION(mfxStatus, MFXVideoUSER_GetPlugin, (mfxSession session, mfxU32 type, mfxPlugin *par), (session, type, par))
|
||||
|
||||
#undef API_VERSION
|
||||
10
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/pkg-config-shared.pc.cmake
vendored
Normal file
10
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/pkg-config-shared.pc.cmake
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
Name: @PROJECT_NAME@
|
||||
Description: Intel(R) Media SDK Dispatcher
|
||||
Version: @MFX_VERSION_MAJOR@.@MFX_VERSION_MINOR@
|
||||
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||
Libs: -L${libdir} -ldispatch_shared -lstdc++ -ldl
|
||||
Cflags: -I${includedir} -I${includedir}/mfx -DMFX_DISPATCHER_EXPOSED_PREFIX
|
||||
|
||||
9
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/pkg-config.pc.cmake
vendored
Normal file
9
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/linux/pkg-config.pc.cmake
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
Name: @PROJECT_NAME@
|
||||
Description: Intel(R) Media SDK Dispatcher
|
||||
Version: @MFX_VERSION_MAJOR@.@MFX_VERSION_MINOR@
|
||||
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
|
||||
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
||||
Libs: -L${libdir} -lmfx -lstdc++ -ldl
|
||||
Cflags: -I${includedir} -I${includedir}/mfx
|
||||
66
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_critical_section.h
vendored
Normal file
66
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_critical_section.h
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
// Copyright (c) 2012-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if !defined(__MFX_CRITICAL_SECTION_H)
|
||||
#define __MFX_CRITICAL_SECTION_H
|
||||
|
||||
#include <mfxdefs.h>
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
// Just set "critical section" instance to zero for initialization.
|
||||
typedef volatile mfxL32 mfxCriticalSection;
|
||||
|
||||
// Enter the global critical section.
|
||||
void mfxEnterCriticalSection(mfxCriticalSection *pCSection);
|
||||
|
||||
// Leave the global critical section.
|
||||
void mfxLeaveCriticalSection(mfxCriticalSection *pCSection);
|
||||
|
||||
class MFXAutomaticCriticalSection
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
explicit MFXAutomaticCriticalSection(mfxCriticalSection *pCSection)
|
||||
{
|
||||
m_pCSection = pCSection;
|
||||
mfxEnterCriticalSection(m_pCSection);
|
||||
}
|
||||
|
||||
// Destructor
|
||||
~MFXAutomaticCriticalSection()
|
||||
{
|
||||
mfxLeaveCriticalSection(m_pCSection);
|
||||
}
|
||||
|
||||
protected:
|
||||
// Pointer to a critical section
|
||||
mfxCriticalSection *m_pCSection;
|
||||
|
||||
private:
|
||||
// unimplemented by intent to make this class non-copyable
|
||||
MFXAutomaticCriticalSection(const MFXAutomaticCriticalSection &);
|
||||
void operator=(const MFXAutomaticCriticalSection &);
|
||||
};
|
||||
|
||||
} // namespace MFX
|
||||
|
||||
#endif // __MFX_CRITICAL_SECTION_H
|
||||
232
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_dispatcher.h
vendored
Normal file
232
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_dispatcher.h
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
// Copyright (c) 2012-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if !defined(__MFX_DISPATCHER_H)
|
||||
#define __MFX_DISPATCHER_H
|
||||
|
||||
#include <mfxvideo.h>
|
||||
#include <mfxaudio.h>
|
||||
#include <mfxplugin.h>
|
||||
#include <stddef.h>
|
||||
#include "mfx_dispatcher_defs.h"
|
||||
#include "mfx_load_plugin.h"
|
||||
#include "mfxenc.h"
|
||||
#include "mfxpak.h"
|
||||
|
||||
#define INTEL_VENDOR_ID 0x8086
|
||||
|
||||
mfxStatus MFXQueryVersion(mfxSession session, mfxVersion *version);
|
||||
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
// to avoid code changing versions are just inherited
|
||||
// from the API header file.
|
||||
DEFAULT_API_VERSION_MAJOR = MFX_VERSION_MAJOR,
|
||||
DEFAULT_API_VERSION_MINOR = MFX_VERSION_MINOR
|
||||
};
|
||||
|
||||
//
|
||||
// declare functions' integer identifiers.
|
||||
//
|
||||
|
||||
#undef FUNCTION
|
||||
#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \
|
||||
e##func_name,
|
||||
|
||||
enum eFunc
|
||||
{
|
||||
eMFXInit,
|
||||
eMFXClose,
|
||||
eMFXQueryIMPL,
|
||||
eMFXQueryVersion,
|
||||
eMFXJoinSession,
|
||||
eMFXDisjoinSession,
|
||||
eMFXCloneSession,
|
||||
eMFXSetPriority,
|
||||
eMFXGetPriority,
|
||||
eMFXInitEx,
|
||||
#include "mfx_exposed_functions_list.h"
|
||||
eVideoFuncTotal
|
||||
};
|
||||
|
||||
enum ePluginFunc
|
||||
{
|
||||
eMFXVideoUSER_Load,
|
||||
eMFXVideoUSER_LoadByPath,
|
||||
eMFXVideoUSER_UnLoad,
|
||||
eMFXAudioUSER_Load,
|
||||
eMFXAudioUSER_UnLoad,
|
||||
ePluginFuncTotal
|
||||
};
|
||||
|
||||
enum eAudioFunc
|
||||
{
|
||||
eFakeAudioEnum = eMFXGetPriority,
|
||||
#include "mfxaudio_exposed_functions_list.h"
|
||||
eAudioFuncTotal
|
||||
};
|
||||
|
||||
// declare max buffer length for regsitry key name
|
||||
enum
|
||||
{
|
||||
MFX_MAX_REGISTRY_KEY_NAME = 256
|
||||
};
|
||||
|
||||
// declare the maximum DLL path
|
||||
enum
|
||||
{
|
||||
MFX_MAX_DLL_PATH = 1024
|
||||
};
|
||||
|
||||
// declare library's implementation types
|
||||
enum eMfxImplType
|
||||
{
|
||||
MFX_LIB_HARDWARE = 0,
|
||||
MFX_LIB_SOFTWARE = 1,
|
||||
MFX_LIB_PSEUDO = 2,
|
||||
|
||||
MFX_LIB_IMPL_TYPES
|
||||
};
|
||||
|
||||
// declare dispatcher's version
|
||||
enum
|
||||
{
|
||||
MFX_DISPATCHER_VERSION_MAJOR = 1,
|
||||
MFX_DISPATCHER_VERSION_MINOR = 3
|
||||
};
|
||||
|
||||
struct _mfxSession
|
||||
{
|
||||
// A real handle from MFX engine passed to a called function
|
||||
mfxSession session;
|
||||
|
||||
mfxFunctionPointer callTable[eVideoFuncTotal];
|
||||
mfxFunctionPointer callPlugInsTable[ePluginFuncTotal];
|
||||
mfxFunctionPointer callAudioTable[eAudioFuncTotal];
|
||||
|
||||
// Current library's implementation (exact implementation)
|
||||
mfxIMPL impl;
|
||||
};
|
||||
|
||||
// declare a dispatcher's handle
|
||||
struct MFX_DISP_HANDLE : public _mfxSession
|
||||
{
|
||||
// Default constructor
|
||||
MFX_DISP_HANDLE(const mfxVersion requiredVersion);
|
||||
// Destructor
|
||||
~MFX_DISP_HANDLE(void);
|
||||
|
||||
// Load the library's module
|
||||
mfxStatus LoadSelectedDLL(const wchar_t *pPath, eMfxImplType implType, mfxIMPL impl, mfxIMPL implInterface, mfxInitParam &par);
|
||||
// Unload the library's module
|
||||
mfxStatus UnLoadSelectedDLL(void);
|
||||
|
||||
// Close the handle
|
||||
mfxStatus Close(void);
|
||||
|
||||
// NOTE: changing order of struct's members can make different version of
|
||||
// dispatchers incompatible. Think of different modules (e.g. MFT filters)
|
||||
// within a single application.
|
||||
|
||||
// Library's implementation type (hardware or software)
|
||||
eMfxImplType implType;
|
||||
// Current library's VIA interface
|
||||
mfxIMPL implInterface;
|
||||
// Dispatcher's version. If version is 1.1 or lower, then old dispatcher's
|
||||
// architecture is used. Otherwise it means current dispatcher's version.
|
||||
mfxVersion dispVersion;
|
||||
// Required API version of session initialized
|
||||
const mfxVersion apiVersion;
|
||||
// Actual library API version
|
||||
mfxVersion actualApiVersion;
|
||||
// Status of loaded dll
|
||||
mfxStatus loadStatus;
|
||||
// Resgistry subkey name for windows version
|
||||
wchar_t subkeyName[MFX_MAX_REGISTRY_KEY_NAME];
|
||||
// Storage ID for windows version
|
||||
int storageID;
|
||||
|
||||
// Library's module handle
|
||||
mfxModuleHandle hModule;
|
||||
|
||||
MFX::MFXPluginStorage pluginHive;
|
||||
MFX::MFXPluginFactory pluginFactory;
|
||||
|
||||
private:
|
||||
// Declare assignment operator and copy constructor to prevent occasional assignment
|
||||
MFX_DISP_HANDLE(const MFX_DISP_HANDLE &);
|
||||
MFX_DISP_HANDLE & operator = (const MFX_DISP_HANDLE &);
|
||||
|
||||
};
|
||||
|
||||
// This struct extends MFX_DISP_HANDLE, we cannot extend MFX_DISP_HANDLE itself due to possible compatibility issues
|
||||
// This struct was added in dispatcher version 1.3
|
||||
// Check dispatcher handle's version when you cast session struct which came from outside of MSDK API function to this
|
||||
struct MFX_DISP_HANDLE_EX : public MFX_DISP_HANDLE
|
||||
{
|
||||
MFX_DISP_HANDLE_EX(const mfxVersion requiredVersion);
|
||||
|
||||
mfxU16 mediaAdapterType;
|
||||
mfxU16 reserved[10];
|
||||
};
|
||||
|
||||
// declare comparison operator
|
||||
inline
|
||||
bool operator == (const mfxVersion &one, const mfxVersion &two)
|
||||
{
|
||||
return (one.Version == two.Version);
|
||||
|
||||
}
|
||||
|
||||
inline
|
||||
bool operator < (const mfxVersion &one, const mfxVersion &two)
|
||||
{
|
||||
return (one.Major < two.Major) || ((one.Major == two.Major) && (one.Minor < two.Minor));
|
||||
|
||||
}
|
||||
|
||||
inline
|
||||
bool operator <= (const mfxVersion &one, const mfxVersion &two)
|
||||
{
|
||||
return (one == two) || (one < two);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// declare a table with functions descriptions
|
||||
//
|
||||
|
||||
typedef
|
||||
struct FUNCTION_DESCRIPTION
|
||||
{
|
||||
// Literal function's name
|
||||
const char *pName;
|
||||
// API version when function appeared first time
|
||||
mfxVersion apiVersion;
|
||||
} FUNCTION_DESCRIPTION;
|
||||
|
||||
extern const
|
||||
FUNCTION_DESCRIPTION APIFunc[eVideoFuncTotal];
|
||||
|
||||
extern const
|
||||
FUNCTION_DESCRIPTION APIAudioFunc[eAudioFuncTotal];
|
||||
#endif // __MFX_DISPATCHER_H
|
||||
47
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_dispatcher_defs.h
vendored
Normal file
47
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_dispatcher_defs.h
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright (c) 2013-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include "mfxdefs.h"
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
|
||||
#if defined(MFX_DISPATCHER_LOG)
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#define MAX_PLUGIN_PATH MAX_PATH
|
||||
#define MAX_PLUGIN_NAME MAX_PATH
|
||||
|
||||
#if _MSC_VER < 1400
|
||||
#define wcscpy_s(to,to_size, from) wcscpy(to, from)
|
||||
#define wcscat_s(to,to_size, from) wcscat(to, from)
|
||||
#endif
|
||||
|
||||
// declare library module's handle
|
||||
typedef void * mfxModuleHandle;
|
||||
|
||||
typedef void (MFX_CDECL * mfxFunctionPointer)(void);
|
||||
|
||||
// Tracer uses lib loading from Program Files logic (via Dispatch reg key) to make dispatcher load tracer dll.
|
||||
// With DriverStore loading put at 1st place, dispatcher loads real lib before it finds tracer dll.
|
||||
// This workaround explicitly checks tracer presence in Dispatch reg key and loads tracer dll before the search for lib in all other places.
|
||||
#define MFX_TRACER_WA_FOR_DS 1
|
||||
286
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_dispatcher_log.h
vendored
Normal file
286
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_dispatcher_log.h
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
// Copyright (c) 2012-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if !defined(__MFX_DISPATCHER_LOG_H)
|
||||
#define __MFX_DISPATCHER_LOG_H
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//dispatcher log (DL) level
|
||||
#define DL_INFO 1
|
||||
#define DL_WRN 2
|
||||
#define DL_ERROR 4
|
||||
#define DL_LOADED_LIBRARY 8
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//opcodes used only in events
|
||||
enum
|
||||
{
|
||||
DL_EVENT_START = 1,
|
||||
DL_EVENT_STOP,
|
||||
DL_EVENT_MSG
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
#define DL_SINK_NULL 0
|
||||
#define DL_SINK_PRINTF 1
|
||||
#define DL_SINK_IMsgHandler 2
|
||||
|
||||
#define MFXFOURCCTYPE() "%c%c%c%c"
|
||||
#define ZERO_OR_SPACE(value) ((0==(value)) ? '0' : (value))
|
||||
#define MFXU32TOFOURCC(mfxu32)\
|
||||
ZERO_OR_SPACE((char)(mfxu32 & 0xFF)), \
|
||||
ZERO_OR_SPACE((char)((mfxu32 >> 8) & 0xFF)),\
|
||||
ZERO_OR_SPACE((char)((mfxu32 >> 16) & 0xFF)),\
|
||||
ZERO_OR_SPACE((char)((mfxu32 >> 24) & 0xFF))
|
||||
|
||||
#define MFXGUIDTYPE() "%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X-%X"
|
||||
|
||||
#define MFXGUIDTOHEX(guid)\
|
||||
(guid)->Data[0],\
|
||||
(guid)->Data[1],\
|
||||
(guid)->Data[2],\
|
||||
(guid)->Data[3],\
|
||||
(guid)->Data[4],\
|
||||
(guid)->Data[5],\
|
||||
(guid)->Data[6],\
|
||||
(guid)->Data[7],\
|
||||
(guid)->Data[8],\
|
||||
(guid)->Data[9],\
|
||||
(guid)->Data[10],\
|
||||
(guid)->Data[11],\
|
||||
(guid)->Data[12],\
|
||||
(guid)->Data[13],\
|
||||
(guid)->Data[14],\
|
||||
(guid)->Data[15]
|
||||
|
||||
#if defined(MFX_DISPATCHER_LOG)
|
||||
|
||||
//---------------------------setup section------------------------
|
||||
//using of formating instead of variadic macro with NULL end,
|
||||
//leads to more flexibility in format, however constructing string
|
||||
//with vsprintf_s is a time wasting
|
||||
#define DISPATCHER_LOG_USE_FORMATING 1
|
||||
|
||||
//creates unique object, event guid registration, factories on heap
|
||||
//heap reduce stack allocation and reduce reservation time at startup
|
||||
//is a vital if mediasdk wont use
|
||||
#define DISPATCHER_LOG_HEAP_SINGLETONES
|
||||
|
||||
// guid for all dispatcher events
|
||||
#define DISPATCHER_LOG_EVENT_GUID L"{EB0538CC-4FEE-484d-ACEE-1182E9F37A57}"
|
||||
|
||||
//puts a sink into listeners list
|
||||
//#define DISPATCHER_LOG_REGISTER_EVENT_PROVIDER
|
||||
|
||||
//puts a sink into listeners list
|
||||
//#define DISPATCHER_LOG_REGISTER_FILE_WRITER
|
||||
#define DISPACTHER_LOG_FW_PATH "c:\\dispatcher.log"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
//callback interface for intercept logging messages
|
||||
class IMsgHandler
|
||||
{
|
||||
public:
|
||||
virtual ~IMsgHandler(){}
|
||||
virtual void Write(int level, int opcode, const char * msg, va_list argptr) = 0;
|
||||
};
|
||||
|
||||
#if DISPATCHER_LOG_USE_FORMATING
|
||||
|
||||
#define DISPATCHER_LOG(lvl, opcode, str)\
|
||||
{\
|
||||
DispatcherLogBracketsHelper wrt(lvl,opcode);\
|
||||
wrt.Write str;\
|
||||
}
|
||||
#else
|
||||
#define DISPATCHER_LOG_VA_ARGS(...) wrt.Write(__VA_ARGS__, NULL)
|
||||
//WARNING: don't use types that occupy more that 4 bytes in memory
|
||||
//WARNING: don't use %s in format specifier
|
||||
#define DISPATCHER_LOG(lvl, opcode, str) \
|
||||
{\
|
||||
DispatcherLogBracketsHelper wrt(lvl, opcode);\
|
||||
DISPATCHER_LOG_VA_ARGS str;\
|
||||
}
|
||||
#endif//DISPATCHER_LOG_USE_FORMATING
|
||||
|
||||
#define DISPATCHER_LOG_OPERATION(operation) operation
|
||||
|
||||
#define __name_from_line( name, line ) name ## line
|
||||
#define _name_from_line( name , line) __name_from_line( name, line )
|
||||
#define name_from_line( name ) _name_from_line( name, __LINE__)
|
||||
|
||||
|
||||
#define DISPATCHER_LOG_AUTO(lvl, msg)\
|
||||
DispatchLogBlockHelper name_from_line(__auto_log_)(lvl); name_from_line(__auto_log_).Write msg;
|
||||
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
template <class T>
|
||||
class DSSingleTone
|
||||
{
|
||||
public:
|
||||
template <class TParam1>
|
||||
inline static T & get(TParam1 par1)
|
||||
{
|
||||
T * pstored;
|
||||
if (NULL == (pstored = store_or_load()))
|
||||
{
|
||||
return *store_or_load(new T(par1));
|
||||
}
|
||||
return *pstored;
|
||||
}
|
||||
|
||||
inline static T & get()
|
||||
{
|
||||
T * pstored;
|
||||
if (NULL == (pstored = store_or_load()))
|
||||
{
|
||||
return *store_or_load(new T());
|
||||
}
|
||||
return *pstored;
|
||||
}
|
||||
private:
|
||||
//if obj == NULL, then it load
|
||||
//if obj != NULL then it store obj
|
||||
inline static T * store_or_load(T * obj = NULL)
|
||||
{
|
||||
static std::unique_ptr<T> instance;
|
||||
if (NULL != obj)
|
||||
{
|
||||
instance.reset(obj);
|
||||
}
|
||||
return instance.get();
|
||||
}
|
||||
};
|
||||
|
||||
class DispatchLog
|
||||
: public DSSingleTone<DispatchLog>
|
||||
{
|
||||
friend class DSSingleTone<DispatchLog>;
|
||||
std::list<IMsgHandler*>m_Recepients;
|
||||
int m_DispatcherLogSink;
|
||||
|
||||
public:
|
||||
//sets current sink
|
||||
void SetSink(int nsink, IMsgHandler *pHandler);
|
||||
void AttachSink(int nsink, IMsgHandler *pHandler);
|
||||
void DetachSink(int nsink, IMsgHandler *pHandler);
|
||||
void ExchangeSink(int nsink, IMsgHandler *pOld, IMsgHandler *pNew);
|
||||
void DetachAllSinks();
|
||||
void Write(int level, int opcode, const char * msg, va_list argptr);
|
||||
|
||||
protected:
|
||||
DispatchLog();
|
||||
};
|
||||
|
||||
//allows to push arguments on the stack without declaring them as function parameters
|
||||
struct DispatcherLogBracketsHelper
|
||||
{
|
||||
int m_level;
|
||||
int m_opcode;
|
||||
DispatcherLogBracketsHelper(int level, int opcode)
|
||||
:m_level(level)
|
||||
,m_opcode(opcode)
|
||||
{
|
||||
}
|
||||
void Write(const char * str, ...);
|
||||
} ;
|
||||
|
||||
//auto log on ctor dtor
|
||||
struct DispatchLogBlockHelper
|
||||
{
|
||||
int m_level;
|
||||
void Write(const char * str, ...);
|
||||
DispatchLogBlockHelper (int level)
|
||||
: m_level(level)
|
||||
{
|
||||
}
|
||||
~DispatchLogBlockHelper();
|
||||
};
|
||||
|
||||
//----utility sinks-----
|
||||
#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER)
|
||||
class ETWHandlerFactory
|
||||
: public DSSingleTone<ETWHandlerFactory>
|
||||
{
|
||||
friend class DSSingleTone<ETWHandlerFactory>;
|
||||
typedef std::map<std::wstring, IMsgHandler*> _storage_type;
|
||||
_storage_type m_storage;
|
||||
|
||||
public:
|
||||
~ETWHandlerFactory();
|
||||
IMsgHandler *GetSink(const wchar_t* sguid = DISPATCHER_LOG_EVENT_GUID);
|
||||
|
||||
protected:
|
||||
ETWHandlerFactory(){}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(DISPATCHER_LOG_REGISTER_FILE_WRITER)
|
||||
class FileSink
|
||||
: public DSSingleTone<FileSink>
|
||||
, public IMsgHandler
|
||||
{
|
||||
friend class DSSingleTone<FileSink>;
|
||||
public:
|
||||
virtual void Write(int level, int opcode, const char * msg, va_list argptr);
|
||||
FileSink()
|
||||
: m_hdl(NULL)
|
||||
{
|
||||
}
|
||||
~FileSink()
|
||||
{
|
||||
if (NULL != m_hdl)
|
||||
fclose(m_hdl);
|
||||
}
|
||||
private:
|
||||
FILE * m_hdl;
|
||||
FileSink(const std::string & log_file)
|
||||
{
|
||||
fopen_s(&m_hdl, log_file.c_str(), "a");
|
||||
}
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
//-----utility functions
|
||||
//since they are not called outside of macro we can define them here
|
||||
std::string DispatcherLog_GetMFXImplString(int impl);
|
||||
const char *DispatcherLog_GetMFXStatusString(int sts);
|
||||
|
||||
#else // !defined(MFX_DISPATCHER_LOG)
|
||||
|
||||
#define DISPATCHER_LOG(level, opcode, message)
|
||||
#define DISPATCHER_LOG_AUTO(level, message)
|
||||
#define DISPATCHER_LOG_OPERATION(operation)
|
||||
|
||||
#endif// !defined(MFX_DISPATCHER_LOG)
|
||||
|
||||
|
||||
#define DISPATCHER_LOG_INFO(msg) DISPATCHER_LOG(DL_INFO, DL_EVENT_MSG, msg)
|
||||
#define DISPATCHER_LOG_WRN(msg) DISPATCHER_LOG(DL_WRN, DL_EVENT_MSG, msg)
|
||||
#define DISPATCHER_LOG_ERROR(msg) DISPATCHER_LOG(DL_ERROR, DL_EVENT_MSG, msg)
|
||||
#define DISPATCHER_LOG_LIBRARY(msg) DISPATCHER_LOG(DL_LOADED_LIBRARY, DL_EVENT_MSG, msg)
|
||||
#define DISPATCHER_LOG_BLOCK(msg) DISPATCHER_LOG_AUTO(DL_INFO, msg)
|
||||
|
||||
#endif // !defined(__MFX_DISPATCHER_LOG_H)
|
||||
36
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_dispatcher_uwp.h
vendored
Normal file
36
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_dispatcher_uwp.h
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if !defined(__MFX_DISPATCHER_UWP_H)
|
||||
#define __MFX_DISPATCHER_UWP_H
|
||||
|
||||
// Loads intel_gfx_api dll from DriverStore fro specified device and calls InitialiseMediaSession from it
|
||||
mfxStatus GfxApiInit(mfxInitParam par, mfxU32 deviceID, mfxSession *session, mfxModuleHandle& hModule);
|
||||
|
||||
// Calls DisposeMediaSession from the intel_gfx_api dll and unloads it
|
||||
mfxStatus GfxApiClose(mfxSession& session, mfxModuleHandle& hModule);
|
||||
|
||||
// Initializes intel_gfx_api for specified adapter number
|
||||
mfxStatus GfxApiInitByAdapterNum(mfxInitParam par, mfxU32 adapterNum, mfxSession *session, mfxModuleHandle& hModule);
|
||||
|
||||
// Initializes intel_gfx_api for any Intel adapter, chooses integrated adapter with higher priority
|
||||
mfxStatus GfxApiInitPriorityIntegrated(mfxInitParam par, mfxSession *session, mfxModuleHandle& hModule);
|
||||
|
||||
#endif // __MFX_DISPATCHER_UWP_H
|
||||
@@ -0,0 +1,65 @@
|
||||
// Copyright (c) 2019-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if !defined(__MFX_DRIVER_STORE_LOADER_H)
|
||||
#define __MFX_DRIVER_STORE_LOADER_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <cfgmgr32.h>
|
||||
#include <devguid.h>
|
||||
|
||||
#include "mfx_dispatcher_defs.h"
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
typedef CONFIGRET(WINAPI *Func_CM_Get_Device_ID_List_SizeW)(PULONG pulLen, PCWSTR pszFilter, ULONG ulFlags);
|
||||
typedef CONFIGRET(WINAPI *Func_CM_Get_Device_ID_ListW)(PCWSTR pszFilter, PZZWSTR Buffer, ULONG BufferLen, ULONG ulFlags);
|
||||
typedef CONFIGRET(WINAPI *Func_CM_Locate_DevNodeW)(PDEVINST pdnDevInst, DEVINSTID_W pDeviceID, ULONG ulFlags);
|
||||
typedef CONFIGRET(WINAPI *Func_CM_Open_DevNode_Key)(DEVINST dnDevNode, REGSAM samDesired, ULONG ulHardwareProfile, REGDISPOSITION Disposition, PHKEY phkDevice, ULONG ulFlags);
|
||||
|
||||
class DriverStoreLoader
|
||||
{
|
||||
public:
|
||||
DriverStoreLoader(void);
|
||||
~DriverStoreLoader(void);
|
||||
|
||||
bool GetDriverStorePath(wchar_t *path, DWORD dwPathSize, mfxU32 deviceID);
|
||||
|
||||
protected:
|
||||
bool LoadCfgMgr();
|
||||
bool LoadCmFuncs();
|
||||
|
||||
mfxModuleHandle m_moduleCfgMgr;
|
||||
Func_CM_Get_Device_ID_List_SizeW m_pCM_Get_Device_ID_List_Size;
|
||||
Func_CM_Get_Device_ID_ListW m_pCM_Get_Device_ID_List;
|
||||
Func_CM_Locate_DevNodeW m_pCM_Locate_DevNode;
|
||||
Func_CM_Open_DevNode_Key m_pCM_Open_DevNode_Key;
|
||||
|
||||
private:
|
||||
// unimplemented by intent to make this class non-copyable
|
||||
DriverStoreLoader(const DriverStoreLoader &);
|
||||
void operator=(const DriverStoreLoader &);
|
||||
|
||||
};
|
||||
|
||||
} // namespace MFX
|
||||
|
||||
#endif // __MFX_DRIVER_STORE_LOADER_H
|
||||
213
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_dxva2_device.h
vendored
Normal file
213
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_dxva2_device.h
vendored
Normal file
@@ -0,0 +1,213 @@
|
||||
// Copyright (c) 2012-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if !defined(__MFX_DXVA2_DEVICE_H)
|
||||
#define __MFX_DXVA2_DEVICE_H
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define TOSTRING(L) #L
|
||||
#define STRINGIFY(L) TOSTRING(L)
|
||||
|
||||
#if defined(MEDIASDK_UWP_DISPATCHER)
|
||||
#if defined(MFX_D3D9_ENABLED) && !defined(MFX_FORCE_D3D9_ENABLED)
|
||||
#undef MFX_D3D9_ENABLED
|
||||
#pragma message("\n\nATTENTION:\nin file\n\t" __FILE__ " (" STRINGIFY(__LINE__) "):\nUsing of D3D9 disabled for UWP!\n\n")
|
||||
#endif
|
||||
#if defined(MFX_FORCE_D3D9_ENABLED)
|
||||
#define MFX_D3D9_ENABLED
|
||||
#endif
|
||||
#else
|
||||
#define MFX_D3D9_ENABLED
|
||||
#pragma message("\n\nATTENTION:\nin file\n\t" __FILE__ " (" STRINGIFY(__LINE__) "):\nUsing of D3D9 enabled!\n\n")
|
||||
#endif
|
||||
|
||||
#include <mfxdefs.h>
|
||||
|
||||
#ifdef DXVA2DEVICE_LOG
|
||||
#include <stdio.h>
|
||||
#define DXVA2DEVICE_TRACE(expr) printf expr;
|
||||
#define DXVA2DEVICE_TRACE_OPERATION(expr) expr;
|
||||
#else
|
||||
#define DXVA2DEVICE_TRACE(expr)
|
||||
#define DXVA2DEVICE_TRACE_OPERATION(expr)
|
||||
#endif
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
class DXDevice
|
||||
{
|
||||
public:
|
||||
// Default constructor
|
||||
DXDevice(void);
|
||||
// Destructor
|
||||
virtual
|
||||
~DXDevice(void) = 0;
|
||||
|
||||
// Initialize device using DXGI 1.1 or VAAPI interface
|
||||
virtual
|
||||
bool Init(const mfxU32 adapterNum) = 0;
|
||||
|
||||
// Obtain graphic card's parameter
|
||||
mfxU32 GetVendorID(void) const;
|
||||
mfxU32 GetDeviceID(void) const;
|
||||
mfxU64 GetDriverVersion(void) const;
|
||||
mfxU64 GetLUID(void) const;
|
||||
|
||||
// Provide the number of available adapters
|
||||
mfxU32 GetAdapterCount(void) const;
|
||||
|
||||
// Close the object
|
||||
virtual
|
||||
void Close(void);
|
||||
|
||||
// Load the required DLL module
|
||||
void LoadDLLModule(const wchar_t *pModuleName);
|
||||
|
||||
protected:
|
||||
|
||||
// Free DLL module
|
||||
void UnloadDLLModule(void);
|
||||
|
||||
// Handle to the DLL library
|
||||
HMODULE m_hModule;
|
||||
|
||||
// Number of adapters available
|
||||
mfxU32 m_numAdapters;
|
||||
|
||||
// Vendor ID
|
||||
mfxU32 m_vendorID;
|
||||
// Device ID
|
||||
mfxU32 m_deviceID;
|
||||
// x.x.x.x each x of two bytes
|
||||
mfxU64 m_driverVersion;
|
||||
// LUID
|
||||
mfxU64 m_luid;
|
||||
|
||||
private:
|
||||
// unimplemented by intent to make this class and its descendants non-copyable
|
||||
DXDevice(const DXDevice &);
|
||||
void operator=(const DXDevice &);
|
||||
};
|
||||
|
||||
#ifdef MFX_D3D9_ENABLED
|
||||
class D3D9Device : public DXDevice
|
||||
{
|
||||
public:
|
||||
// Default constructor
|
||||
D3D9Device(void);
|
||||
// Destructor
|
||||
virtual
|
||||
~D3D9Device(void);
|
||||
|
||||
// Initialize device using D3D v9 interface
|
||||
virtual
|
||||
bool Init(const mfxU32 adapterNum);
|
||||
|
||||
// Close the object
|
||||
virtual
|
||||
void Close(void);
|
||||
|
||||
protected:
|
||||
|
||||
// Pointer to the D3D v9 interface
|
||||
void *m_pD3D9;
|
||||
// Pointer to the D3D v9 extended interface
|
||||
void *m_pD3D9Ex;
|
||||
|
||||
};
|
||||
#endif // MFX_D3D9_ENABLED
|
||||
|
||||
class DXGI1Device : public DXDevice
|
||||
{
|
||||
public:
|
||||
// Default constructor
|
||||
DXGI1Device(void);
|
||||
// Destructor
|
||||
virtual
|
||||
~DXGI1Device(void);
|
||||
|
||||
// Initialize device
|
||||
virtual
|
||||
bool Init(const mfxU32 adapterNum);
|
||||
|
||||
// Close the object
|
||||
virtual
|
||||
void Close(void);
|
||||
|
||||
protected:
|
||||
|
||||
// Pointer to the DXGI1 factory
|
||||
void *m_pDXGIFactory1;
|
||||
// Pointer to the current DXGI1 adapter
|
||||
void *m_pDXGIAdapter1;
|
||||
|
||||
};
|
||||
|
||||
class DXVA2Device
|
||||
{
|
||||
public:
|
||||
// Default constructor
|
||||
DXVA2Device(void);
|
||||
// Destructor
|
||||
~DXVA2Device(void);
|
||||
|
||||
// Initialize device using D3D v9 interface
|
||||
bool InitD3D9(const mfxU32 adapterNum);
|
||||
|
||||
// Initialize device using DXGI 1.1 interface
|
||||
bool InitDXGI1(const mfxU32 adapterNum);
|
||||
|
||||
// Obtain graphic card's parameter
|
||||
mfxU32 GetVendorID(void) const;
|
||||
mfxU32 GetDeviceID(void) const;
|
||||
mfxU64 GetDriverVersion(void) const;
|
||||
|
||||
// Provide the number of available adapters
|
||||
mfxU32 GetAdapterCount(void) const;
|
||||
|
||||
void Close(void);
|
||||
|
||||
protected:
|
||||
|
||||
#ifdef MFX_D3D9_ENABLED
|
||||
// Get vendor & device IDs by alternative way (D3D9 in Remote Desktop sessions)
|
||||
void UseAlternativeWay(const D3D9Device *pD3D9Device);
|
||||
#endif // MFX_D3D9_ENABLED
|
||||
// Number of adapters available
|
||||
mfxU32 m_numAdapters;
|
||||
|
||||
// Vendor ID
|
||||
mfxU32 m_vendorID;
|
||||
// Device ID
|
||||
mfxU32 m_deviceID;
|
||||
//x.x.x.x
|
||||
mfxU64 m_driverVersion;
|
||||
|
||||
private:
|
||||
// unimplemented by intent to make this class non-copyable
|
||||
DXVA2Device(const DXVA2Device &);
|
||||
void operator=(const DXVA2Device &);
|
||||
};
|
||||
|
||||
} // namespace MFX
|
||||
|
||||
#endif // __MFX_DXVA2_DEVICE_H
|
||||
141
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_exposed_functions_list.h
vendored
Normal file
141
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_exposed_functions_list.h
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
// Copyright (c) 2012-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
//
|
||||
// WARNING:
|
||||
// this file doesn't contain an include guard by intension.
|
||||
// The file may be included into a source file many times.
|
||||
// That is why this header doesn't contain any include directive.
|
||||
// Please, do no try to fix it.
|
||||
//
|
||||
|
||||
|
||||
|
||||
// Use define API_VERSION to set the API of functions listed further
|
||||
// When new functions are added new section with functions declarations must be started with updated define
|
||||
|
||||
//
|
||||
// API version 1.0 functions
|
||||
//
|
||||
|
||||
// API version where a function is added. Minor value should precedes the major value
|
||||
#define API_VERSION {{0, 1}}
|
||||
|
||||
// CORE interface functions
|
||||
FUNCTION(mfxStatus, MFXVideoCORE_SetBufferAllocator, (mfxSession session, mfxBufferAllocator *allocator), (session, allocator))
|
||||
FUNCTION(mfxStatus, MFXVideoCORE_SetFrameAllocator, (mfxSession session, mfxFrameAllocator *allocator), (session, allocator))
|
||||
FUNCTION(mfxStatus, MFXVideoCORE_SetHandle, (mfxSession session, mfxHandleType type, mfxHDL hdl), (session, type, hdl))
|
||||
FUNCTION(mfxStatus, MFXVideoCORE_GetHandle, (mfxSession session, mfxHandleType type, mfxHDL *hdl), (session, type, hdl))
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoCORE_SyncOperation, (mfxSession session, mfxSyncPoint syncp, mfxU32 wait), (session, syncp, wait))
|
||||
|
||||
// ENCODE interface functions
|
||||
FUNCTION(mfxStatus, MFXVideoENCODE_Query, (mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session, in, out))
|
||||
FUNCTION(mfxStatus, MFXVideoENCODE_QueryIOSurf, (mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session, par, request))
|
||||
FUNCTION(mfxStatus, MFXVideoENCODE_Init, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoENCODE_Reset, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoENCODE_Close, (mfxSession session), (session))
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoENCODE_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoENCODE_GetEncodeStat, (mfxSession session, mfxEncodeStat *stat), (session, stat))
|
||||
FUNCTION(mfxStatus, MFXVideoENCODE_EncodeFrameAsync, (mfxSession session, mfxEncodeCtrl *ctrl, mfxFrameSurface1 *surface, mfxBitstream *bs, mfxSyncPoint *syncp), (session, ctrl, surface, bs, syncp))
|
||||
|
||||
// DECODE interface functions
|
||||
FUNCTION(mfxStatus, MFXVideoDECODE_Query, (mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session, in, out))
|
||||
FUNCTION(mfxStatus, MFXVideoDECODE_DecodeHeader, (mfxSession session, mfxBitstream *bs, mfxVideoParam *par), (session, bs, par))
|
||||
FUNCTION(mfxStatus, MFXVideoDECODE_QueryIOSurf, (mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session, par, request))
|
||||
FUNCTION(mfxStatus, MFXVideoDECODE_Init, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoDECODE_Reset, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoDECODE_Close, (mfxSession session), (session))
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoDECODE_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoDECODE_GetDecodeStat, (mfxSession session, mfxDecodeStat *stat), (session, stat))
|
||||
FUNCTION(mfxStatus, MFXVideoDECODE_SetSkipMode, (mfxSession session, mfxSkipMode mode), (session, mode))
|
||||
FUNCTION(mfxStatus, MFXVideoDECODE_GetPayload, (mfxSession session, mfxU64 *ts, mfxPayload *payload), (session, ts, payload))
|
||||
FUNCTION(mfxStatus, MFXVideoDECODE_DecodeFrameAsync, (mfxSession session, mfxBitstream *bs, mfxFrameSurface1 *surface_work, mfxFrameSurface1 **surface_out, mfxSyncPoint *syncp), (session, bs, surface_work, surface_out, syncp))
|
||||
|
||||
// VPP interface functions
|
||||
FUNCTION(mfxStatus, MFXVideoVPP_Query, (mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session, in, out))
|
||||
FUNCTION(mfxStatus, MFXVideoVPP_QueryIOSurf, (mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session, par, request))
|
||||
FUNCTION(mfxStatus, MFXVideoVPP_Init, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoVPP_Reset, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoVPP_Close, (mfxSession session), (session))
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoVPP_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoVPP_GetVPPStat, (mfxSession session, mfxVPPStat *stat), (session, stat))
|
||||
FUNCTION(mfxStatus, MFXVideoVPP_RunFrameVPPAsync, (mfxSession session, mfxFrameSurface1 *in, mfxFrameSurface1 *out, mfxExtVppAuxData *aux, mfxSyncPoint *syncp), (session, in, out, aux, syncp))
|
||||
|
||||
#undef API_VERSION
|
||||
|
||||
//
|
||||
// API version 1.1 functions
|
||||
//
|
||||
|
||||
#define API_VERSION {{1, 1}}
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoUSER_Register, (mfxSession session, mfxU32 type, const mfxPlugin *par), (session, type, par))
|
||||
FUNCTION(mfxStatus, MFXVideoUSER_Unregister, (mfxSession session, mfxU32 type), (session, type))
|
||||
FUNCTION(mfxStatus, MFXVideoUSER_ProcessFrameAsync, (mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp), (session, in, in_num, out, out_num, syncp))
|
||||
|
||||
#undef API_VERSION
|
||||
|
||||
//
|
||||
// API version 1.10 functions
|
||||
//
|
||||
|
||||
#define API_VERSION {{10, 1}}
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoENC_Query,(mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session,in,out))
|
||||
FUNCTION(mfxStatus, MFXVideoENC_QueryIOSurf,(mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session,par,request))
|
||||
FUNCTION(mfxStatus, MFXVideoENC_Init,(mfxSession session, mfxVideoParam *par), (session,par))
|
||||
FUNCTION(mfxStatus, MFXVideoENC_Reset,(mfxSession session, mfxVideoParam *par), (session,par))
|
||||
FUNCTION(mfxStatus, MFXVideoENC_Close,(mfxSession session),(session))
|
||||
FUNCTION(mfxStatus, MFXVideoENC_ProcessFrameAsync,(mfxSession session, mfxENCInput *in, mfxENCOutput *out, mfxSyncPoint *syncp),(session,in,out,syncp))
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoVPP_RunFrameVPPAsyncEx, (mfxSession session, mfxFrameSurface1 *in, mfxFrameSurface1 *work, mfxFrameSurface1 **out, mfxSyncPoint *syncp), (session, in, work, out, syncp))
|
||||
|
||||
#undef API_VERSION
|
||||
|
||||
#define API_VERSION {{13, 1}}
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_Query, (mfxSession session, mfxVideoParam *in, mfxVideoParam *out), (session, in, out))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_QueryIOSurf, (mfxSession session, mfxVideoParam *par, mfxFrameAllocRequest *request), (session, par, request))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_Init, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_Reset, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_Close, (mfxSession session), (session))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_ProcessFrameAsync, (mfxSession session, mfxPAKInput *in, mfxPAKOutput *out, mfxSyncPoint *syncp), (session, in, out, syncp))
|
||||
|
||||
#undef API_VERSION
|
||||
|
||||
#define API_VERSION {{14, 1}}
|
||||
|
||||
// FUNCTION(mfxStatus, MFXInitEx, (mfxInitParam par, mfxSession session), (par, session))
|
||||
FUNCTION(mfxStatus, MFXDoWork, (mfxSession session), (session))
|
||||
|
||||
#undef API_VERSION
|
||||
|
||||
#define API_VERSION {{19, 1}}
|
||||
|
||||
FUNCTION(mfxStatus, MFXVideoENC_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoPAK_GetVideoParam, (mfxSession session, mfxVideoParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXVideoCORE_QueryPlatform, (mfxSession session, mfxPlatform* platform), (session, platform))
|
||||
FUNCTION(mfxStatus, MFXVideoUSER_GetPlugin, (mfxSession session, mfxU32 type, mfxPlugin *par), (session, type, par))
|
||||
|
||||
#undef API_VERSION
|
||||
134
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_library_iterator.h
vendored
Normal file
134
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_library_iterator.h
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
// Copyright (c) 2012-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if !defined(__MFX_LIBRARY_ITERATOR_H)
|
||||
#define __MFX_LIBRARY_ITERATOR_H
|
||||
|
||||
|
||||
#include <mfxvideo.h>
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
#include "mfx_win_reg_key.h"
|
||||
#endif
|
||||
|
||||
#include "mfx_driver_store_loader.h"
|
||||
|
||||
#include "mfx_dispatcher.h"
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
// declare desired storage ID
|
||||
enum
|
||||
{
|
||||
#if defined (MFX_TRACER_WA_FOR_DS)
|
||||
MFX_UNKNOWN_KEY = -1,
|
||||
MFX_TRACER = 0,
|
||||
MFX_DRIVER_STORE = 1,
|
||||
MFX_CURRENT_USER_KEY = 2,
|
||||
MFX_LOCAL_MACHINE_KEY = 3,
|
||||
MFX_APP_FOLDER = 4,
|
||||
MFX_PATH_MSDK_FOLDER = 5,
|
||||
MFX_STORAGE_ID_FIRST = MFX_TRACER,
|
||||
MFX_STORAGE_ID_LAST = MFX_PATH_MSDK_FOLDER
|
||||
#else
|
||||
MFX_UNKNOWN_KEY = -1,
|
||||
MFX_DRIVER_STORE = 0,
|
||||
MFX_CURRENT_USER_KEY = 1,
|
||||
MFX_LOCAL_MACHINE_KEY = 2,
|
||||
MFX_APP_FOLDER = 3,
|
||||
MFX_PATH_MSDK_FOLDER = 4,
|
||||
MFX_STORAGE_ID_FIRST = MFX_DRIVER_STORE,
|
||||
MFX_STORAGE_ID_LAST = MFX_PATH_MSDK_FOLDER
|
||||
#endif
|
||||
};
|
||||
|
||||
// Try to initialize using given implementation type. Select appropriate type automatically in case of MFX_IMPL_VIA_ANY.
|
||||
// Params: adapterNum - in, pImplInterface - in/out, pVendorID - out, pDeviceID - out
|
||||
mfxStatus SelectImplementationType(const mfxU32 adapterNum, mfxIMPL *pImplInterface, mfxU32 *pVendorID, mfxU32 *pDeviceID);
|
||||
|
||||
const mfxU32 msdk_disp_path_len = 1024;
|
||||
|
||||
class MFXLibraryIterator
|
||||
{
|
||||
public:
|
||||
// Default constructor
|
||||
MFXLibraryIterator(void);
|
||||
// Destructor
|
||||
~MFXLibraryIterator(void);
|
||||
|
||||
// Initialize the iterator
|
||||
mfxStatus Init(eMfxImplType implType, mfxIMPL implInterface, const mfxU32 adapterNum, int storageID);
|
||||
|
||||
// Get the next library path
|
||||
mfxStatus SelectDLLVersion(wchar_t *pPath, size_t pathSize,
|
||||
eMfxImplType *pImplType, mfxVersion minVersion);
|
||||
|
||||
// Return interface type on which Intel adapter was found (if any): D3D9 or D3D11
|
||||
mfxIMPL GetImplementationType();
|
||||
|
||||
// Retrun registry subkey name on which dll was selected after sucesfull call to selectDllVesion
|
||||
bool GetSubKeyName(wchar_t *subKeyName, size_t length) const;
|
||||
|
||||
int GetStorageID() const { return m_StorageID; }
|
||||
protected:
|
||||
|
||||
// Release the iterator
|
||||
void Release(void);
|
||||
|
||||
// Initialize the registry iterator
|
||||
mfxStatus InitRegistry(int storageID);
|
||||
#if defined(MFX_TRACER_WA_FOR_DS)
|
||||
// Initialize the registry iterator for searching for tracer
|
||||
mfxStatus InitRegistryTracer();
|
||||
#endif
|
||||
// Initialize the app/module folder iterator
|
||||
mfxStatus InitFolder(eMfxImplType implType, const wchar_t * path, const int storageID);
|
||||
|
||||
|
||||
eMfxImplType m_implType; // Required library implementation
|
||||
mfxIMPL m_implInterface; // Required interface (D3D9, D3D11)
|
||||
|
||||
mfxU32 m_vendorID; // (mfxU32) property of used graphic card
|
||||
mfxU32 m_deviceID; // (mfxU32) property of used graphic card
|
||||
bool m_bIsSubKeyValid;
|
||||
wchar_t m_SubKeyName[MFX_MAX_REGISTRY_KEY_NAME]; // registry subkey for selected module loaded
|
||||
int m_StorageID;
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
WinRegKey m_baseRegKey; // (WinRegKey) main registry key
|
||||
#endif
|
||||
|
||||
mfxU32 m_lastLibIndex; // (mfxU32) index of previously returned library
|
||||
mfxU32 m_lastLibMerit; // (mfxU32) merit of previously returned library
|
||||
|
||||
wchar_t m_path[msdk_disp_path_len];
|
||||
|
||||
DriverStoreLoader m_driverStoreLoader; // for loading MediaSDK from DriverStore
|
||||
|
||||
private:
|
||||
// unimplemented by intent to make this class non-copyable
|
||||
MFXLibraryIterator(const MFXLibraryIterator &);
|
||||
void operator=(const MFXLibraryIterator &);
|
||||
};
|
||||
|
||||
} // namespace MFX
|
||||
|
||||
#endif // __MFX_LIBRARY_ITERATOR_H
|
||||
52
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_load_dll.h
vendored
Normal file
52
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_load_dll.h
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2012-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if !defined(__MFX_LOAD_DLL_H)
|
||||
#define __MFX_LOAD_DLL_H
|
||||
|
||||
#include "mfx_dispatcher.h"
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
|
||||
//
|
||||
// declare DLL loading routines
|
||||
//
|
||||
|
||||
mfxStatus mfx_get_rt_dll_name(wchar_t *pPath, size_t pathSize);
|
||||
mfxStatus mfx_get_default_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType);
|
||||
mfxStatus mfx_get_default_plugin_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType);
|
||||
#if defined(MEDIASDK_UWP_DISPATCHER)
|
||||
mfxStatus mfx_get_default_intel_gfx_api_dll_name(wchar_t *pPath, size_t pathSize);
|
||||
#endif
|
||||
|
||||
mfxStatus mfx_get_default_audio_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType);
|
||||
|
||||
|
||||
mfxModuleHandle mfx_dll_load(const wchar_t *file_name);
|
||||
//increments reference counter
|
||||
mfxModuleHandle mfx_get_dll_handle(const wchar_t *file_name);
|
||||
mfxFunctionPointer mfx_dll_get_addr(mfxModuleHandle handle, const char *func_name);
|
||||
bool mfx_dll_free(mfxModuleHandle handle);
|
||||
|
||||
} // namespace MFX
|
||||
|
||||
#endif // __MFX_LOAD_DLL_H
|
||||
85
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_load_plugin.h
vendored
Normal file
85
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_load_plugin.h
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
// Copyright (c) 2013-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include "mfxplugin.h"
|
||||
#include "mfx_dispatcher_defs.h"
|
||||
#include "mfx_plugin_hive.h"
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
typedef mfxStatus (MFX_CDECL *CreatePluginPtr_t)(mfxPluginUID uid, mfxPlugin* plugin);
|
||||
|
||||
class PluginModule
|
||||
{
|
||||
mfxModuleHandle mHmodule;
|
||||
CreatePluginPtr_t mCreatePluginPtr;
|
||||
wchar_t mPath[MAX_PLUGIN_PATH];
|
||||
|
||||
public:
|
||||
PluginModule();
|
||||
PluginModule(const wchar_t * path);
|
||||
PluginModule(const PluginModule & that) ;
|
||||
PluginModule & operator = (const PluginModule & that);
|
||||
bool Create(mfxPluginUID guid, mfxPlugin&);
|
||||
~PluginModule(void);
|
||||
|
||||
private:
|
||||
void Tidy();
|
||||
};
|
||||
|
||||
class MFXPluginFactory {
|
||||
struct FactoryRecord {
|
||||
mfxPluginParam plgParams;
|
||||
PluginModule module;
|
||||
mfxPlugin plugin;
|
||||
FactoryRecord ()
|
||||
: plgParams(), plugin()
|
||||
{}
|
||||
FactoryRecord(const mfxPluginParam &plgParams,
|
||||
PluginModule &module,
|
||||
mfxPlugin plugin)
|
||||
: plgParams(plgParams)
|
||||
, module(module)
|
||||
, plugin(plugin) {
|
||||
}
|
||||
};
|
||||
MFXVector<FactoryRecord> mPlugins;
|
||||
mfxU32 nPlugins;
|
||||
mfxSession mSession;
|
||||
public:
|
||||
MFXPluginFactory(mfxSession session);
|
||||
void Close();
|
||||
mfxStatus Create(const PluginDescriptionRecord &);
|
||||
bool Destroy(const mfxPluginUID &);
|
||||
|
||||
~MFXPluginFactory();
|
||||
protected:
|
||||
void DestroyPlugin( FactoryRecord & );
|
||||
static bool RunVerification( const mfxPlugin & plg, const PluginDescriptionRecord &dsc, mfxPluginParam &pluginParams );
|
||||
static bool VerifyEncoder( const mfxVideoCodecPlugin &videoCodec );
|
||||
static bool VerifyAudioEncoder( const mfxAudioCodecPlugin &audioCodec );
|
||||
static bool VerifyEnc( const mfxVideoCodecPlugin &videoEnc );
|
||||
static bool VerifyVpp( const mfxVideoCodecPlugin &videoCodec );
|
||||
static bool VerifyDecoder( const mfxVideoCodecPlugin &videoCodec );
|
||||
static bool VerifyAudioDecoder( const mfxAudioCodecPlugin &audioCodec );
|
||||
static bool VerifyCodecCommon( const mfxVideoCodecPlugin & Video );
|
||||
};
|
||||
}
|
||||
115
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_plugin_hive.h
vendored
Normal file
115
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_plugin_hive.h
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
// Copyright (c) 2013-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mfx_dispatcher_defs.h"
|
||||
#include "mfxplugin.h"
|
||||
#include "mfx_win_reg_key.h"
|
||||
#include "mfx_vector.h"
|
||||
#include <string.h>
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
|
||||
struct MFX_DISP_HANDLE;
|
||||
|
||||
namespace MFX {
|
||||
|
||||
inline bool operator == (const mfxPluginUID &lhs, const mfxPluginUID & rhs)
|
||||
{
|
||||
return !memcmp(lhs.Data, rhs.Data, sizeof(mfxPluginUID));
|
||||
}
|
||||
|
||||
inline bool operator != (const mfxPluginUID &lhs, const mfxPluginUID & rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
#ifdef _WIN32
|
||||
//warning C4351: new behavior: elements of array 'MFX::PluginDescriptionRecord::sName' will be default initialized
|
||||
#pragma warning (disable: 4351)
|
||||
#endif
|
||||
class PluginDescriptionRecord : public mfxPluginParam
|
||||
{
|
||||
public:
|
||||
wchar_t sPath[MAX_PLUGIN_PATH];
|
||||
char sName[MAX_PLUGIN_NAME];
|
||||
//used for FS plugins that has poor description
|
||||
bool onlyVersionRegistered;
|
||||
bool Default;
|
||||
PluginDescriptionRecord()
|
||||
: mfxPluginParam()
|
||||
, sPath()
|
||||
, sName()
|
||||
, onlyVersionRegistered()
|
||||
, Default()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
typedef MFXVector<PluginDescriptionRecord> MFXPluginStorage;
|
||||
|
||||
class MFXPluginStorageBase : public MFXPluginStorage
|
||||
{
|
||||
protected:
|
||||
mfxVersion mCurrentAPIVersion;
|
||||
protected:
|
||||
MFXPluginStorageBase(mfxVersion currentAPIVersion)
|
||||
: mCurrentAPIVersion(currentAPIVersion)
|
||||
{
|
||||
}
|
||||
void ConvertAPIVersion( mfxU32 APIVersion, PluginDescriptionRecord &descriptionRecord) const
|
||||
{
|
||||
descriptionRecord.APIVersion.Minor = static_cast<mfxU16> (APIVersion & 0x0ff);
|
||||
descriptionRecord.APIVersion.Major = static_cast<mfxU16> (APIVersion >> 8);
|
||||
}
|
||||
};
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
//populated from registry
|
||||
class MFXPluginsInHive : public MFXPluginStorageBase
|
||||
{
|
||||
public:
|
||||
MFXPluginsInHive(int mfxStorageID, const wchar_t *msdkLibSubKey, mfxVersion currentAPIVersion);
|
||||
};
|
||||
|
||||
//plugins are loaded from FS close to executable
|
||||
class MFXPluginsInFS : public MFXPluginStorageBase
|
||||
{
|
||||
bool mIsVersionParsed;
|
||||
bool mIsAPIVersionParsed;
|
||||
public:
|
||||
MFXPluginsInFS(mfxVersion currentAPIVersion);
|
||||
private:
|
||||
bool ParseFile(FILE * f, PluginDescriptionRecord & des);
|
||||
bool ParseKVPair( wchar_t *key, wchar_t * value, PluginDescriptionRecord & des);
|
||||
};
|
||||
|
||||
#endif //#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
//plugins are loaded from FS close to Runtime library
|
||||
class MFXDefaultPlugins : public MFXPluginStorageBase
|
||||
{
|
||||
public:
|
||||
MFXDefaultPlugins(mfxVersion currentAPIVersion, MFX_DISP_HANDLE * hdl, int implType);
|
||||
private:
|
||||
};
|
||||
|
||||
}
|
||||
217
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_vector.h
vendored
Normal file
217
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_vector.h
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
// Copyright (c) 2013-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
#include "mfxstructures.h"
|
||||
#include <exception>
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
template <class T>
|
||||
class iterator_tmpl
|
||||
{
|
||||
template <class U> friend class MFXVector;
|
||||
mfxU32 mIndex;
|
||||
T* mRecords;
|
||||
iterator_tmpl(mfxU32 index , T * records)
|
||||
: mIndex (index)
|
||||
, mRecords(records)
|
||||
{}
|
||||
public:
|
||||
iterator_tmpl()
|
||||
: mIndex ()
|
||||
, mRecords()
|
||||
{}
|
||||
bool operator ==(const iterator_tmpl<T> & that )const
|
||||
{
|
||||
return mIndex == that.mIndex;
|
||||
}
|
||||
bool operator !=(const iterator_tmpl<T> & that )const
|
||||
{
|
||||
return mIndex != that.mIndex;
|
||||
}
|
||||
mfxU32 operator - (const iterator_tmpl<T> &that) const
|
||||
{
|
||||
return mIndex - that.mIndex;
|
||||
}
|
||||
iterator_tmpl<T> & operator ++()
|
||||
{
|
||||
mIndex++;
|
||||
return * this;
|
||||
}
|
||||
iterator_tmpl<T> & operator ++(int)
|
||||
{
|
||||
mIndex++;
|
||||
return * this;
|
||||
}
|
||||
T & operator *()
|
||||
{
|
||||
return mRecords[mIndex];
|
||||
}
|
||||
T * operator ->()
|
||||
{
|
||||
return mRecords + mIndex;
|
||||
}
|
||||
};
|
||||
|
||||
class MFXVectorRangeError : public std::exception
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class MFXVector
|
||||
{
|
||||
T* mRecords;
|
||||
mfxU32 mNrecords;
|
||||
public:
|
||||
MFXVector()
|
||||
: mRecords()
|
||||
, mNrecords()
|
||||
{}
|
||||
MFXVector(const MFXVector & rhs)
|
||||
: mRecords()
|
||||
, mNrecords()
|
||||
{
|
||||
insert(end(), rhs.begin(), rhs.end());
|
||||
}
|
||||
MFXVector & operator = (const MFXVector & rhs)
|
||||
{
|
||||
if (this != &rhs)
|
||||
{
|
||||
clear();
|
||||
insert(end(), rhs.begin(), rhs.end());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
virtual ~MFXVector ()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
typedef iterator_tmpl<T> iterator;
|
||||
|
||||
iterator begin() const
|
||||
{
|
||||
return iterator(0u, mRecords);
|
||||
}
|
||||
iterator end() const
|
||||
{
|
||||
return iterator(mNrecords, mRecords);
|
||||
}
|
||||
void insert(iterator where, iterator beg_iter, iterator end_iter)
|
||||
{
|
||||
mfxU32 elementsToInsert = (end_iter - beg_iter);
|
||||
if (!elementsToInsert)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (where.mIndex > mNrecords)
|
||||
{
|
||||
throw MFXVectorRangeError();
|
||||
}
|
||||
|
||||
T *newRecords = new T[mNrecords + elementsToInsert]();
|
||||
mfxU32 i = 0;
|
||||
|
||||
// save left
|
||||
for (; i < where.mIndex; i++)
|
||||
{
|
||||
newRecords[i] = mRecords[i];
|
||||
}
|
||||
// insert
|
||||
for (; beg_iter != end_iter; beg_iter++, i++)
|
||||
{
|
||||
newRecords[i] = *beg_iter;
|
||||
}
|
||||
|
||||
//save right
|
||||
for (; i < mNrecords + elementsToInsert; i++)
|
||||
{
|
||||
newRecords[i] = mRecords[i - elementsToInsert];
|
||||
}
|
||||
|
||||
delete [] mRecords;
|
||||
|
||||
mRecords = newRecords;
|
||||
mNrecords = i;
|
||||
}
|
||||
T& operator [] (mfxU32 idx)
|
||||
{
|
||||
return mRecords[idx];
|
||||
}
|
||||
void push_back(const T& obj)
|
||||
{
|
||||
T *newRecords = new T[mNrecords + 1]();
|
||||
mfxU32 i = 0;
|
||||
for (; i <mNrecords; i++)
|
||||
{
|
||||
newRecords[i] = mRecords[i];
|
||||
}
|
||||
newRecords[i] = obj;
|
||||
delete [] mRecords;
|
||||
|
||||
mRecords = newRecords;
|
||||
mNrecords = i + 1;
|
||||
}
|
||||
void erase (iterator at)
|
||||
{
|
||||
if (at.mIndex >= mNrecords)
|
||||
{
|
||||
throw MFXVectorRangeError();
|
||||
}
|
||||
mNrecords--;
|
||||
mfxU32 i = at.mIndex;
|
||||
for (; i != mNrecords; i++)
|
||||
{
|
||||
mRecords[i] = mRecords[i+1];
|
||||
}
|
||||
//destroy last element
|
||||
mRecords[i] = T();
|
||||
}
|
||||
void resize(mfxU32 nSize)
|
||||
{
|
||||
T * newRecords = new T[nSize]();
|
||||
for (mfxU32 i = 0; i <mNrecords; i++)
|
||||
{
|
||||
newRecords[i] = mRecords[i];
|
||||
}
|
||||
delete [] mRecords;
|
||||
mRecords = newRecords;
|
||||
mNrecords = nSize;
|
||||
}
|
||||
mfxU32 size() const
|
||||
{
|
||||
return mNrecords;
|
||||
}
|
||||
void clear()
|
||||
{
|
||||
delete [] mRecords;
|
||||
mRecords = 0;
|
||||
mNrecords = 0;
|
||||
}
|
||||
bool empty()
|
||||
{
|
||||
return !mRecords;
|
||||
}
|
||||
T * data() const
|
||||
{
|
||||
return mRecords;
|
||||
}
|
||||
};
|
||||
}
|
||||
104
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_win_reg_key.h
vendored
Normal file
104
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/include/mfx_win_reg_key.h
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// Copyright (c) 2012-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if !defined(__MFX_WIN_REG_KEY_H)
|
||||
#define __MFX_WIN_REG_KEY_H
|
||||
|
||||
#include <windows.h>
|
||||
#include "mfxplugin.h"
|
||||
#include "mfx_dispatcher_log.h"
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
namespace MFX {
|
||||
|
||||
template<class T> struct RegKey{};
|
||||
template<> struct RegKey<bool>{enum {type = REG_DWORD};};
|
||||
template<> struct RegKey<mfxU32>{enum {type = REG_DWORD};};
|
||||
template<> struct RegKey<mfxPluginUID>{enum {type = REG_BINARY};};
|
||||
template<> struct RegKey<mfxVersion>{enum {type = REG_DWORD};};
|
||||
template<> struct RegKey<char*>{enum {type = REG_SZ};};
|
||||
template<> struct RegKey<wchar_t*>{enum {type = REG_SZ};};
|
||||
|
||||
|
||||
class WinRegKey
|
||||
{
|
||||
public:
|
||||
// Default constructor
|
||||
WinRegKey(void);
|
||||
// Destructor
|
||||
~WinRegKey(void);
|
||||
|
||||
// Open a registry key
|
||||
bool Open(HKEY hRootKey, const wchar_t *pSubKey, REGSAM samDesired);
|
||||
bool Open(WinRegKey &rootKey, const wchar_t *pSubKey, REGSAM samDesired);
|
||||
|
||||
// Query value
|
||||
bool QueryInfo(LPDWORD lpcSubkeys);
|
||||
|
||||
bool QueryValueSize(const wchar_t *pValueName, DWORD type, LPDWORD pcbData);
|
||||
bool Query(const wchar_t *pValueName, DWORD type, LPBYTE pData, LPDWORD pcbData);
|
||||
|
||||
bool Query(const wchar_t *pValueName, wchar_t *pData, mfxU32 &nData) {
|
||||
DWORD dw = (DWORD)nData;
|
||||
if (!Query(pValueName, RegKey<wchar_t*>::type, (LPBYTE)pData, &dw)){
|
||||
return false;
|
||||
}
|
||||
nData = dw;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Enumerate value names
|
||||
bool EnumValue(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName, LPDWORD pType);
|
||||
bool EnumKey(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName);
|
||||
|
||||
protected:
|
||||
|
||||
// Release the object
|
||||
void Release(void);
|
||||
|
||||
HKEY m_hKey; // (HKEY) handle to the opened key
|
||||
|
||||
private:
|
||||
// unimplemented by intent to make this class non-copyable
|
||||
WinRegKey(const WinRegKey &);
|
||||
void operator=(const WinRegKey &);
|
||||
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool QueryKey(WinRegKey & key, const wchar_t *pValueName, T &data ) {
|
||||
DWORD size = sizeof(data);
|
||||
return key.Query(pValueName, RegKey<T>::type, (LPBYTE) &data, &size);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline bool QueryKey<bool>(WinRegKey & key, const wchar_t *pValueName, bool &data ) {
|
||||
mfxU32 value = 0;
|
||||
bool bRes = QueryKey(key, pValueName, value);
|
||||
data = (1 == value);
|
||||
return bRes;
|
||||
}
|
||||
|
||||
|
||||
} // namespace MFX
|
||||
#endif // #if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
#endif // __MFX_WIN_REG_KEY_H
|
||||
@@ -0,0 +1,71 @@
|
||||
// Copyright (c) 2013-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
//
|
||||
// WARNING:
|
||||
// this file doesn't contain an include guard by intension.
|
||||
// The file may be included into a source file many times.
|
||||
// That is why this header doesn't contain any include directive.
|
||||
// Please, do no try to fix it.
|
||||
//
|
||||
|
||||
//
|
||||
// API version 1.8 functions
|
||||
//
|
||||
|
||||
// Minor value should precedes the major value
|
||||
#define API_VERSION {{8, 1}}
|
||||
|
||||
// CORE interface functions
|
||||
FUNCTION(mfxStatus, MFXAudioCORE_SyncOperation, (mfxSession session, mfxSyncPoint syncp, mfxU32 wait), (session, syncp, wait))
|
||||
|
||||
// ENCODE interface functions
|
||||
FUNCTION(mfxStatus, MFXAudioENCODE_Query, (mfxSession session, mfxAudioParam *in, mfxAudioParam *out), (session, in, out))
|
||||
FUNCTION(mfxStatus, MFXAudioENCODE_QueryIOSize, (mfxSession session, mfxAudioParam *par, mfxAudioAllocRequest *request), (session, par, request))
|
||||
FUNCTION(mfxStatus, MFXAudioENCODE_Init, (mfxSession session, mfxAudioParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXAudioENCODE_Reset, (mfxSession session, mfxAudioParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXAudioENCODE_Close, (mfxSession session), (session))
|
||||
FUNCTION(mfxStatus, MFXAudioENCODE_GetAudioParam, (mfxSession session, mfxAudioParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXAudioENCODE_EncodeFrameAsync, (mfxSession session, mfxAudioFrame *frame, mfxBitstream *buffer_out, mfxSyncPoint *syncp), (session, frame, buffer_out, syncp))
|
||||
|
||||
// DECODE interface functions
|
||||
FUNCTION(mfxStatus, MFXAudioDECODE_Query, (mfxSession session, mfxAudioParam *in, mfxAudioParam *out), (session, in, out))
|
||||
FUNCTION(mfxStatus, MFXAudioDECODE_DecodeHeader, (mfxSession session, mfxBitstream *bs, mfxAudioParam *par), (session, bs, par))
|
||||
FUNCTION(mfxStatus, MFXAudioDECODE_Init, (mfxSession session, mfxAudioParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXAudioDECODE_Reset, (mfxSession session, mfxAudioParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXAudioDECODE_Close, (mfxSession session), (session))
|
||||
FUNCTION(mfxStatus, MFXAudioDECODE_QueryIOSize, (mfxSession session, mfxAudioParam *par, mfxAudioAllocRequest *request), (session, par, request))
|
||||
FUNCTION(mfxStatus, MFXAudioDECODE_GetAudioParam, (mfxSession session, mfxAudioParam *par), (session, par))
|
||||
FUNCTION(mfxStatus, MFXAudioDECODE_DecodeFrameAsync, (mfxSession session, mfxBitstream *bs, mfxAudioFrame *frame_out, mfxSyncPoint *syncp), (session, bs, frame_out, syncp))
|
||||
|
||||
#undef API_VERSION
|
||||
|
||||
//
|
||||
// API version 1.9 functions
|
||||
//
|
||||
|
||||
#define API_VERSION {{9, 1}}
|
||||
|
||||
FUNCTION(mfxStatus, MFXAudioUSER_Register, (mfxSession session, mfxU32 type, const mfxPlugin *par), (session, type, par))
|
||||
FUNCTION(mfxStatus, MFXAudioUSER_Unregister, (mfxSession session, mfxU32 type), (session, type))
|
||||
FUNCTION(mfxStatus, MFXAudioUSER_ProcessFrameAsync, (mfxSession session, const mfxHDL *in, mfxU32 in_num, const mfxHDL *out, mfxU32 out_num, mfxSyncPoint *syncp), (session, in, in_num, out, out_num, syncp))
|
||||
|
||||
|
||||
#undef API_VERSION
|
||||
179
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/libmfx_uwp.vcxproj
vendored
Normal file
179
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/libmfx_uwp.vcxproj
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{336AEFC3-987C-40AA-9678-E8BF1EC9C26F}</ProjectGuid>
|
||||
<RootNamespace>libmfx_uwp</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>libmfx_uwp</ProjectName>
|
||||
<WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
|
||||
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="$(Configuration.Contains('Release'))" Label="Configuration">
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(Configuration.Contains('Debug'))" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
<OutDir>..\..\..\..\build\win_$(Platform)\$(Configuration)\lib\</OutDir>
|
||||
<IntDir>$(OutDir)..\objs\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<IncludePath>$(MINIDDK_ROOT)\Include\um;$(MINIDDK_ROOT)\Include\shared;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(MINIDDK_ROOT)\Lib\win8\um\x86;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules />
|
||||
<CodeAnalysisRuleAssemblies />
|
||||
</PropertyGroup>
|
||||
<!-- Global settings -->
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<PreprocessorDefinitions>_LIB;WINAPI_FAMILY=WINAPI_FAMILY_APP;MEDIASDK_UWP_DISPATCHER;MFX_D3D11_ENABLED;_UNICODE;UNICODE;MFX_VA;_ALLOW_MSC_VER_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_RUNTIME_LIBRARY_MISMATCH;%(PreprocessorDefinitions);WINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP</PreprocessorDefinitions>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<AdditionalIncludeDirectories>include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- End of Global settings -->
|
||||
<!-- Configuration dependent settings -->
|
||||
<ItemDefinitionGroup Condition="$(Configuration.Contains('Debug'))">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<ControlFlowGuard>Guard</ControlFlowGuard>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="$(Configuration.Contains('Release'))">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<ControlFlowGuard>Guard</ControlFlowGuard>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="!$(Platform.Contains('ARM'))">
|
||||
<Lib>
|
||||
<AdditionalLibraryDirectories>$(MfxBuildDir)..\build\win_$(Platform)\lib\</AdditionalLibraryDirectories>
|
||||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
|
||||
</Lib>
|
||||
<ProjectReference>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- End of Configuration dependent settings -->
|
||||
<!-- Platform dependent settings -->
|
||||
<ItemDefinitionGroup Condition="'$(Platform)'=='Win32'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Platform)'=='x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="$(Platform.Contains('ARM'))">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>MEDIASDK_ARM_LOADER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<!-- End of Platform dependent settings -->
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\main.cpp" />
|
||||
<ClCompile Include="src\mfx_dispatcher.cpp" />
|
||||
<ClCompile Include="src\mfx_dispatcher_uwp.cpp" />
|
||||
<ClCompile Include="src\mfx_dispatcher_log.cpp" />
|
||||
<ClCompile Include="src\mfx_driver_store_loader.cpp" />
|
||||
<ClCompile Include="src\mfx_function_table.cpp" />
|
||||
<ClCompile Include="src\mfx_load_dll.cpp" />
|
||||
<ClCompile Include="src\mfx_dxva2_device.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\mfxaudio_exposed_functions_list.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher_uwp.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher_defs.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher_log.h" />
|
||||
<ClInclude Include="include\mfx_driver_store_loader.h" />
|
||||
<ClInclude Include="include\mfx_exposed_functions_list.h" />
|
||||
<ClInclude Include="include\mfx_load_dll.h" />
|
||||
<ClInclude Include="include\mfx_dxva2_device.h" />
|
||||
<ClInclude Include="include\mfx_vector.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
30
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/libmfx_uwp.vcxproj.filters
vendored
Normal file
30
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/libmfx_uwp.vcxproj.filters
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\mfx_dispatcher.cpp" />
|
||||
<ClCompile Include="src\mfx_dispatcher_uwp.cpp" />
|
||||
<ClCompile Include="src\mfx_dispatcher_log.cpp" />
|
||||
<ClCompile Include="src\mfx_function_table.cpp" />
|
||||
<ClCompile Include="src\main.cpp" />
|
||||
<ClCompile Include="src\mfx_load_dll.cpp" />
|
||||
<ClCompile Include="src\mfx_driver_store_loader.cpp" />
|
||||
<ClCompile Include="src\mfx_dxva2_device.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\mfxaudio_exposed_functions_list.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher_uwp.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher_defs.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher_log.h" />
|
||||
<ClInclude Include="include\mfx_exposed_functions_list.h" />
|
||||
<ClInclude Include="include\mfx_vector.h" />
|
||||
<ClInclude Include="include\mfx_load_dll.h" />
|
||||
<ClInclude Include="include\mfx_driver_store_loader.h" />
|
||||
<ClInclude Include="include\mfx_dxva2_device.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Documentation">
|
||||
<UniqueIdentifier>{a76fc74b-469b-40f4-888b-abe6d364d3e2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
248
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/libmfx_vs2015.vcxproj
vendored
Normal file
248
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/libmfx_vs2015.vcxproj
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A9F7AEFB-DC6C-49E8-8E71-5351ABDCE627}</ProjectGuid>
|
||||
<RootNamespace>libmfx</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>libmfx_vs2015</ProjectName>
|
||||
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<SpectreMitigation>false</SpectreMitigation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<SpectreMitigation>false</SpectreMitigation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<SpectreMitigation>false</SpectreMitigation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<SpectreMitigation>false</SpectreMitigation>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<PropertyGroup>
|
||||
<OutDir>..\..\..\..\build\win_$(Platform)\$(Configuration)\lib\</OutDir>
|
||||
<IntDir>$(OutDir)..\objs\$(ProjectName)\</IntDir>
|
||||
<IncludePath>$(MINIDDK_ROOT)\Include\um;$(MINIDDK_ROOT)\Include\shared;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(MINIDDK_ROOT)\Lib\win8\um\x86;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<TargetName>$(ProjectName)</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalOptions>$(CPPFLAGS) %(AdditionalOptions)</AdditionalOptions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<PreprocessorDefinitions>MFX_D3D11_ENABLED;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)</TargetName>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;MFX_VA;MFX_DEPRECATED_OFF;_ALLOW_MSC_VER_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_RUNTIME_LIBRARY_MISMATCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<ControlFlowGuard>Guard</ControlFlowGuard>
|
||||
</ClCompile>
|
||||
<Lib />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<ControlFlowGuard>Guard</ControlFlowGuard>
|
||||
</ClCompile>
|
||||
<Lib />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;MFX_VA;MFX_DEPRECATED_OFF;_ALLOW_MSC_VER_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_RUNTIME_LIBRARY_MISMATCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<ControlFlowGuard>Guard</ControlFlowGuard>
|
||||
</ClCompile>
|
||||
<Lib />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_LIB;_ALLOW_MSC_VER_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_RUNTIME_LIBRARY_MISMATCH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>true</BufferSecurityCheck>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
|
||||
<ControlFlowGuard>Guard</ControlFlowGuard>
|
||||
</ClCompile>
|
||||
<Lib />
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\mfx_dispatcher_main.cpp" />
|
||||
<ClCompile Include="src\mfx_critical_section.cpp" />
|
||||
<ClCompile Include="src\mfx_dispatcher.cpp" />
|
||||
<ClCompile Include="src\mfx_dispatcher_log.cpp" />
|
||||
<ClCompile Include="src\mfx_driver_store_loader.cpp" />
|
||||
<ClCompile Include="src\mfx_dxva2_device.cpp" />
|
||||
<ClCompile Include="src\mfx_function_table.cpp" />
|
||||
<ClCompile Include="src\mfx_library_iterator.cpp" />
|
||||
<ClCompile Include="src\mfx_load_dll.cpp" />
|
||||
<ClCompile Include="src\mfx_load_plugin.cpp" />
|
||||
<ClCompile Include="src\mfx_plugin_hive.cpp" />
|
||||
<ClCompile Include="src\mfx_win_reg_key.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\mfxaudio_exposed_functions_list.h" />
|
||||
<ClInclude Include="include\mfx_critical_section.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher_defs.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher_log.h" />
|
||||
<ClInclude Include="include\mfx_driver_store_loader.h" />
|
||||
<ClInclude Include="include\mfx_dxva2_device.h" />
|
||||
<ClInclude Include="include\mfx_exposed_functions_list.h" />
|
||||
<ClInclude Include="include\mfx_library_iterator.h" />
|
||||
<ClInclude Include="include\mfx_load_dll.h" />
|
||||
<ClInclude Include="include\mfx_load_plugin.h" />
|
||||
<ClInclude Include="include\mfx_plugin_hive.h" />
|
||||
<ClInclude Include="include\mfx_win_reg_key.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
4
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/libmfx_vs2015.vcxproj.user
vendored
Normal file
4
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/libmfx_vs2015.vcxproj.user
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
@@ -0,0 +1,193 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>mfx_dispatch_trace_lib</ProjectName>
|
||||
<ProjectGuid>{45806EE4-0256-4B1D-A730-EB70966E070A}</ProjectGuid>
|
||||
<RootNamespace>mfx_dispatch_trace</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\..\build\win_$(Platform)\lib\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)..\objs\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\..\build\win_$(Platform)\lib\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)..\objs\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\..\build\win_$(Platform)\lib\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)..\objs\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\..\build\win_$(Platform)\lib\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)..\objs\$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)_mbcs</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectName)_mbcs</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<TargetName>$(ProjectName)_d_mbcs</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<TargetName>$(ProjectName)_d_mbcs</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>include;../shared/include;../../include;$(MfxIppIncludeDir);../mfx_lib/shared/include;../shared/umc/core/umc/include;../shared/umc/core/vm/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;MFX_DISPATCHER_LOG;DXVA2DEVICE_LOG;MFX_DISPATCHER_EXPOSED_PREFIX;MFX_VA;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)\$(TargetName)$(TargetExt)</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>include;../shared/include;../../include;$(MfxIppIncludeDir);../mfx_lib/shared/include;../shared/umc/core/umc/include;../shared/umc/core/vm/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;_DEBUG;_CONSOLE;MFX_DISPATCHER_LOG;DXVA2DEVICE_LOG;MFX_DISPATCHER_EXPOSED_PREFIX;MFX_VA;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)\$(TargetName)$(TargetExt)</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>include;../shared/include;../../include;$(MfxIppIncludeDir);../mfx_lib/shared/include;../shared/umc/core/umc/include;../shared/umc/core/vm/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;MFX_DISPATCHER_LOG;DXVA2DEVICE_LOG;MFX_DISPATCHER_EXPOSED_PREFIX;MFX_VA;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib />
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)\$(TargetName)$(TargetExt)</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<AdditionalIncludeDirectories>include;../shared/include;../../include;$(MfxIppIncludeDir);../mfx_lib/shared/include;../shared/umc/core/umc/include;../shared/umc/core/vm/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN64;NDEBUG;_CONSOLE;MFX_DISPATCHER_LOG;DXVA2DEVICE_LOG;MFX_DISPATCHER_EXPOSED_PREFIX;MFX_VA;NOMINMAX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>Async</ExceptionHandling>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Lib />
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)\$(TargetName)$(TargetExt)</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\main.cpp" />
|
||||
<ClCompile Include="src\mfx_critical_section.cpp" />
|
||||
<ClCompile Include="src\mfx_dispatcher.cpp" />
|
||||
<ClCompile Include="src\mfx_dispatcher_log.cpp" />
|
||||
<ClCompile Include="src\mfx_driver_store_loader.cpp" />
|
||||
<ClCompile Include="src\mfx_dxva2_device.cpp" />
|
||||
<ClCompile Include="src\mfx_function_table.cpp" />
|
||||
<ClCompile Include="src\mfx_library_iterator.cpp" />
|
||||
<ClCompile Include="src\mfx_load_dll.cpp" />
|
||||
<ClCompile Include="src\mfx_load_plugin.cpp" />
|
||||
<ClCompile Include="src\mfx_plugin_hive.cpp" />
|
||||
<ClCompile Include="src\mfx_win_reg_key.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\mfx_critical_section.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher_defs.h" />
|
||||
<ClInclude Include="include\mfx_dispatcher_log.h" />
|
||||
<ClInclude Include="include\mfx_driver_store_loader.h" />
|
||||
<ClInclude Include="include\mfx_dxva2_device.h" />
|
||||
<ClInclude Include="include\mfx_exposed_functions_list.h" />
|
||||
<ClInclude Include="include\mfx_library_iterator.h" />
|
||||
<ClInclude Include="include\mfx_load_dll.h" />
|
||||
<ClInclude Include="include\mfx_load_plugin.h" />
|
||||
<ClInclude Include="include\mfx_plugin_hive.h" />
|
||||
<ClInclude Include="include\mfx_win_reg_key.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
74
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_critical_section.cpp
vendored
Normal file
74
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_critical_section.cpp
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
// Copyright (c) 2012-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "mfx_critical_section.h"
|
||||
|
||||
#include <windows.h>
|
||||
// SDK re-declares the following functions with different call declarator.
|
||||
// We don't need them. Just redefine them to nothing.
|
||||
#define _interlockedbittestandset fake_set
|
||||
#define _interlockedbittestandreset fake_reset
|
||||
#define _interlockedbittestandset64 fake_set64
|
||||
#define _interlockedbittestandreset64 fake_reset64
|
||||
#include <intrin.h>
|
||||
|
||||
#define MFX_WAIT() SwitchToThread()
|
||||
|
||||
// static section of the file
|
||||
namespace
|
||||
{
|
||||
|
||||
enum
|
||||
{
|
||||
MFX_SC_IS_FREE = 0,
|
||||
MFX_SC_IS_TAKEN = 1
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
mfxU32 mfxInterlockedCas32(mfxCriticalSection *pCSection, mfxU32 value_to_exchange, mfxU32 value_to_compare)
|
||||
{
|
||||
return _InterlockedCompareExchange(pCSection, value_to_exchange, value_to_compare);
|
||||
}
|
||||
|
||||
mfxU32 mfxInterlockedXchg32(mfxCriticalSection *pCSection, mfxU32 value)
|
||||
{
|
||||
return _InterlockedExchange(pCSection, value);
|
||||
}
|
||||
|
||||
void mfxEnterCriticalSection(mfxCriticalSection *pCSection)
|
||||
{
|
||||
while (MFX_SC_IS_TAKEN == mfxInterlockedCas32(pCSection,
|
||||
MFX_SC_IS_TAKEN,
|
||||
MFX_SC_IS_FREE))
|
||||
{
|
||||
MFX_WAIT();
|
||||
}
|
||||
} // void mfxEnterCriticalSection(mfxCriticalSection *pCSection)
|
||||
|
||||
void mfxLeaveCriticalSection(mfxCriticalSection *pCSection)
|
||||
{
|
||||
mfxInterlockedXchg32(pCSection, MFX_SC_IS_FREE);
|
||||
} // void mfxLeaveCriticalSection(mfxCriticalSection *pCSection)
|
||||
|
||||
} // namespace MFX
|
||||
661
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_dispatcher.cpp
vendored
Normal file
661
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_dispatcher.cpp
vendored
Normal file
@@ -0,0 +1,661 @@
|
||||
// Copyright (c) 2012-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "mfx_dispatcher.h"
|
||||
#include "mfx_dispatcher_log.h"
|
||||
#include "mfx_load_dll.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "mfx_dxva2_device.h"
|
||||
#include "mfxvideo++.h"
|
||||
#include "mfx_vector.h"
|
||||
#include "mfxadapter.h"
|
||||
#include <algorithm>
|
||||
|
||||
#pragma warning(disable:4355)
|
||||
|
||||
MFX_DISP_HANDLE::MFX_DISP_HANDLE(const mfxVersion requiredVersion) :
|
||||
_mfxSession()
|
||||
,apiVersion(requiredVersion)
|
||||
,pluginHive()
|
||||
,pluginFactory((mfxSession)this)
|
||||
{
|
||||
actualApiVersion.Version = 0;
|
||||
implType = MFX_LIB_SOFTWARE;
|
||||
impl = MFX_IMPL_SOFTWARE;
|
||||
loadStatus = MFX_ERR_NOT_FOUND;
|
||||
dispVersion.Major = MFX_DISPATCHER_VERSION_MAJOR;
|
||||
dispVersion.Minor = MFX_DISPATCHER_VERSION_MINOR;
|
||||
storageID = 0;
|
||||
implInterface = MFX_IMPL_HARDWARE_ANY;
|
||||
|
||||
hModule = (mfxModuleHandle) 0;
|
||||
|
||||
} // MFX_DISP_HANDLE::MFX_DISP_HANDLE(const mfxVersion requiredVersion)
|
||||
|
||||
MFX_DISP_HANDLE::~MFX_DISP_HANDLE(void)
|
||||
{
|
||||
Close();
|
||||
|
||||
} // MFX_DISP_HANDLE::~MFX_DISP_HANDLE(void)
|
||||
|
||||
mfxStatus MFX_DISP_HANDLE::Close(void)
|
||||
{
|
||||
mfxStatus mfxRes;
|
||||
|
||||
mfxRes = UnLoadSelectedDLL();
|
||||
|
||||
// need to reset dispatcher state after unloading dll
|
||||
if (MFX_ERR_NONE == mfxRes)
|
||||
{
|
||||
implType = MFX_LIB_SOFTWARE;
|
||||
impl = MFX_IMPL_SOFTWARE;
|
||||
loadStatus = MFX_ERR_NOT_FOUND;
|
||||
dispVersion.Major = MFX_DISPATCHER_VERSION_MAJOR;
|
||||
dispVersion.Minor = MFX_DISPATCHER_VERSION_MINOR;
|
||||
*static_cast<_mfxSession*>(this) = _mfxSession();
|
||||
hModule = (mfxModuleHandle) 0;
|
||||
}
|
||||
|
||||
return mfxRes;
|
||||
|
||||
} // mfxStatus MFX_DISP_HANDLE::Close(void)
|
||||
|
||||
mfxStatus MFX_DISP_HANDLE::LoadSelectedDLL(const wchar_t *pPath, eMfxImplType reqImplType,
|
||||
mfxIMPL reqImpl, mfxIMPL reqImplInterface, mfxInitParam &par)
|
||||
{
|
||||
mfxStatus mfxRes = MFX_ERR_NONE;
|
||||
|
||||
// check error(s)
|
||||
if ((MFX_LIB_SOFTWARE != reqImplType) &&
|
||||
(MFX_LIB_HARDWARE != reqImplType))
|
||||
{
|
||||
DISPATCHER_LOG_ERROR((("implType == %s, should be either MFX_LIB_SOFTWARE ot MFX_LIB_HARDWARE\n"), DispatcherLog_GetMFXImplString(reqImplType).c_str()));
|
||||
loadStatus = MFX_ERR_ABORTED;
|
||||
return loadStatus;
|
||||
}
|
||||
// only exact types of implementation is allowed
|
||||
if (!(reqImpl & MFX_IMPL_AUDIO) &&
|
||||
#if (MFX_VERSION >= MFX_VERSION_NEXT)
|
||||
!(reqImpl & MFX_IMPL_EXTERNAL_THREADING) &&
|
||||
#endif
|
||||
(MFX_IMPL_SOFTWARE != reqImpl) &&
|
||||
(MFX_IMPL_HARDWARE != reqImpl) &&
|
||||
(MFX_IMPL_HARDWARE2 != reqImpl) &&
|
||||
(MFX_IMPL_HARDWARE3 != reqImpl) &&
|
||||
(MFX_IMPL_HARDWARE4 != reqImpl))
|
||||
{
|
||||
DISPATCHER_LOG_ERROR((("invalid implementation impl == %s\n"), DispatcherLog_GetMFXImplString(impl).c_str()));
|
||||
loadStatus = MFX_ERR_ABORTED;
|
||||
return loadStatus;
|
||||
}
|
||||
// only mfxExtThreadsParam is allowed
|
||||
if (par.NumExtParam)
|
||||
{
|
||||
if ((par.NumExtParam > 1) || !par.ExtParam)
|
||||
{
|
||||
loadStatus = MFX_ERR_ABORTED;
|
||||
return loadStatus;
|
||||
}
|
||||
if ((par.ExtParam[0]->BufferId != MFX_EXTBUFF_THREADS_PARAM) ||
|
||||
(par.ExtParam[0]->BufferSz != sizeof(mfxExtThreadsParam)))
|
||||
{
|
||||
loadStatus = MFX_ERR_ABORTED;
|
||||
return loadStatus;
|
||||
}
|
||||
}
|
||||
|
||||
// close the handle before initialization
|
||||
Close();
|
||||
|
||||
// save the library's type
|
||||
this->implType = reqImplType;
|
||||
this->impl = reqImpl;
|
||||
this->implInterface = reqImplInterface;
|
||||
|
||||
{
|
||||
assert(hModule == (mfxModuleHandle)0);
|
||||
DISPATCHER_LOG_BLOCK(("invoking LoadLibrary(%S)\n", pPath));
|
||||
|
||||
// load the DLL into the memory
|
||||
hModule = MFX::mfx_dll_load(pPath);
|
||||
|
||||
if (hModule)
|
||||
{
|
||||
int i;
|
||||
|
||||
DISPATCHER_LOG_OPERATION({
|
||||
wchar_t modulePath[1024];
|
||||
GetModuleFileNameW((HMODULE)hModule, modulePath, sizeof(modulePath)/sizeof(modulePath[0]));
|
||||
DISPATCHER_LOG_INFO((("loaded module %S\n"), modulePath))
|
||||
});
|
||||
|
||||
if (impl & MFX_IMPL_AUDIO)
|
||||
{
|
||||
// load audio functions: pointers to exposed functions
|
||||
for (i = 0; i < eAudioFuncTotal; i += 1)
|
||||
{
|
||||
// construct correct name of the function - remove "_a" postfix
|
||||
|
||||
mfxFunctionPointer pProc = (mfxFunctionPointer) MFX::mfx_dll_get_addr(hModule, APIAudioFunc[i].pName);
|
||||
if (pProc)
|
||||
{
|
||||
// function exists in the library,
|
||||
// save the pointer.
|
||||
callAudioTable[i] = pProc;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The library doesn't contain the function
|
||||
DISPATCHER_LOG_WRN((("Can't find API function \"%s\"\n"), APIAudioFunc[i].pName));
|
||||
if (apiVersion.Version >= APIAudioFunc[i].apiVersion.Version)
|
||||
{
|
||||
DISPATCHER_LOG_ERROR((("\"%s\" is required for API %u.%u\n"), APIAudioFunc[i].pName, apiVersion.Major, apiVersion.Minor));
|
||||
mfxRes = MFX_ERR_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// load video functions: pointers to exposed functions
|
||||
for (i = 0; i < eVideoFuncTotal; i += 1)
|
||||
{
|
||||
mfxFunctionPointer pProc = (mfxFunctionPointer) MFX::mfx_dll_get_addr(hModule, APIFunc[i].pName);
|
||||
if (pProc)
|
||||
{
|
||||
// function exists in the library,
|
||||
// save the pointer.
|
||||
callTable[i] = pProc;
|
||||
}
|
||||
else
|
||||
{
|
||||
// The library doesn't contain the function
|
||||
DISPATCHER_LOG_WRN((("Can't find API function \"%s\"\n"), APIFunc[i].pName));
|
||||
if (apiVersion.Version >= APIFunc[i].apiVersion.Version)
|
||||
{
|
||||
DISPATCHER_LOG_ERROR((("\"%s\" is required for API %u.%u\n"), APIFunc[i].pName, apiVersion.Major, apiVersion.Minor));
|
||||
mfxRes = MFX_ERR_UNSUPPORTED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_WRN((("can't find DLL: GetLastErr()=0x%x\n"), GetLastError()))
|
||||
mfxRes = MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
// initialize the loaded DLL
|
||||
if (MFX_ERR_NONE == mfxRes)
|
||||
{
|
||||
mfxVersion version(apiVersion);
|
||||
|
||||
/* check whether it is audio session or video */
|
||||
mfxFunctionPointer *actualTable = (impl & MFX_IMPL_AUDIO) ? callAudioTable : callTable;
|
||||
|
||||
// Call old-style MFXInit init for older libraries and audio library
|
||||
bool callOldInit = (impl & MFX_IMPL_AUDIO) || !actualTable[eMFXInitEx]; // if true call eMFXInit, if false - eMFXInitEx
|
||||
int tableIndex = (callOldInit) ? eMFXInit : eMFXInitEx;
|
||||
|
||||
mfxFunctionPointer pFunc = actualTable[tableIndex];
|
||||
|
||||
{
|
||||
if (callOldInit)
|
||||
{
|
||||
DISPATCHER_LOG_BLOCK(("MFXInit(%s,ver=%u.%u,session=0x%p)\n"
|
||||
, DispatcherLog_GetMFXImplString(impl | implInterface).c_str()
|
||||
, apiVersion.Major
|
||||
, apiVersion.Minor
|
||||
, &session));
|
||||
|
||||
mfxRes = (*(mfxStatus(MFX_CDECL *) (mfxIMPL, mfxVersion *, mfxSession *)) pFunc) (impl | implInterface, &version, &session);
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_BLOCK(("MFXInitEx(%s,ver=%u.%u,ExtThreads=%d,session=0x%p)\n"
|
||||
, DispatcherLog_GetMFXImplString(impl | implInterface).c_str()
|
||||
, apiVersion.Major
|
||||
, apiVersion.Minor
|
||||
, par.ExternalThreads
|
||||
, &session));
|
||||
|
||||
mfxInitParam initPar = par;
|
||||
// adjusting user parameters
|
||||
initPar.Implementation = impl | implInterface;
|
||||
initPar.Version = version;
|
||||
mfxRes = (*(mfxStatus(MFX_CDECL *) (mfxInitParam, mfxSession *)) pFunc) (initPar, &session);
|
||||
}
|
||||
}
|
||||
|
||||
if (MFX_ERR_NONE != mfxRes)
|
||||
{
|
||||
DISPATCHER_LOG_WRN((("library can't be load. MFXInit returned %s \n"), DispatcherLog_GetMFXStatusString(mfxRes)))
|
||||
}
|
||||
else
|
||||
{
|
||||
mfxRes = MFXQueryVersion((mfxSession) this, &actualApiVersion);
|
||||
|
||||
if (MFX_ERR_NONE != mfxRes)
|
||||
{
|
||||
DISPATCHER_LOG_ERROR((("MFXQueryVersion returned: %d, skiped this library\n"), mfxRes))
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_INFO((("MFXQueryVersion returned API: %d.%d\n"), actualApiVersion.Major, actualApiVersion.Minor))
|
||||
//special hook for applications that uses sink api to get loaded library path
|
||||
DISPATCHER_LOG_LIBRARY(("%p" , hModule));
|
||||
DISPATCHER_LOG_INFO(("library loaded succesfully\n"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadStatus = mfxRes;
|
||||
return mfxRes;
|
||||
|
||||
} // mfxStatus MFX_DISP_HANDLE::LoadSelectedDLL(const wchar_t *pPath, eMfxImplType implType, mfxIMPL impl)
|
||||
|
||||
mfxStatus MFX_DISP_HANDLE::UnLoadSelectedDLL(void)
|
||||
{
|
||||
mfxStatus mfxRes = MFX_ERR_NONE;
|
||||
|
||||
//unregistered plugins if any
|
||||
pluginFactory.Close();
|
||||
|
||||
// close the loaded DLL
|
||||
if (session)
|
||||
{
|
||||
/* check whether it is audio session or video */
|
||||
int tableIndex = eMFXClose;
|
||||
mfxFunctionPointer pFunc;
|
||||
if (impl & MFX_IMPL_AUDIO)
|
||||
{
|
||||
pFunc = callAudioTable[tableIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
pFunc = callTable[tableIndex];
|
||||
}
|
||||
|
||||
mfxRes = (*(mfxStatus (MFX_CDECL *) (mfxSession)) pFunc) (session);
|
||||
if (MFX_ERR_NONE == mfxRes)
|
||||
{
|
||||
session = (mfxSession) 0;
|
||||
}
|
||||
|
||||
DISPATCHER_LOG_INFO((("MFXClose(0x%x) returned %d\n"), session, mfxRes));
|
||||
// actually, the return value is required to pass outside only.
|
||||
}
|
||||
|
||||
// it is possible, that there is an active child session.
|
||||
// can't unload library in that case.
|
||||
if ((MFX_ERR_UNDEFINED_BEHAVIOR != mfxRes) &&
|
||||
(hModule))
|
||||
{
|
||||
// unload the library.
|
||||
if (!MFX::mfx_dll_free(hModule))
|
||||
{
|
||||
mfxRes = MFX_ERR_UNDEFINED_BEHAVIOR;
|
||||
}
|
||||
hModule = (mfxModuleHandle) 0;
|
||||
}
|
||||
|
||||
return mfxRes;
|
||||
|
||||
} // mfxStatus MFX_DISP_HANDLE::UnLoadSelectedDLL(void)
|
||||
|
||||
|
||||
MFX_DISP_HANDLE_EX::MFX_DISP_HANDLE_EX(const mfxVersion requiredVersion)
|
||||
: MFX_DISP_HANDLE(requiredVersion)
|
||||
, mediaAdapterType(MFX_MEDIA_UNKNOWN)
|
||||
{}
|
||||
|
||||
|
||||
#if (defined(_WIN64) || defined(_WIN32)) && (MFX_VERSION >= 1031)
|
||||
static mfxStatus InitDummySession(mfxU32 adapter_n, MFXVideoSession & dummy_session)
|
||||
{
|
||||
mfxInitParam initPar;
|
||||
memset(&initPar, 0, sizeof(initPar));
|
||||
|
||||
initPar.Version.Major = 1;
|
||||
initPar.Version.Minor = 0;
|
||||
|
||||
switch (adapter_n)
|
||||
{
|
||||
case 0:
|
||||
initPar.Implementation = MFX_IMPL_HARDWARE;
|
||||
break;
|
||||
case 1:
|
||||
initPar.Implementation = MFX_IMPL_HARDWARE2;
|
||||
break;
|
||||
case 2:
|
||||
initPar.Implementation = MFX_IMPL_HARDWARE3;
|
||||
break;
|
||||
case 3:
|
||||
initPar.Implementation = MFX_IMPL_HARDWARE4;
|
||||
break;
|
||||
|
||||
default:
|
||||
// try searching on all display adapters
|
||||
initPar.Implementation = MFX_IMPL_HARDWARE_ANY;
|
||||
break;
|
||||
}
|
||||
|
||||
initPar.Implementation |= MFX_IMPL_VIA_D3D11;
|
||||
|
||||
return dummy_session.InitEx(initPar);
|
||||
}
|
||||
|
||||
static inline bool is_iGPU(const mfxAdapterInfo& adapter_info)
|
||||
{
|
||||
return adapter_info.Platform.MediaAdapterType == MFX_MEDIA_INTEGRATED;
|
||||
}
|
||||
|
||||
static inline bool is_dGPU(const mfxAdapterInfo& adapter_info)
|
||||
{
|
||||
return adapter_info.Platform.MediaAdapterType == MFX_MEDIA_DISCRETE;
|
||||
}
|
||||
|
||||
// This function implies that iGPU has higher priority
|
||||
static inline mfxI32 iGPU_priority(const void* ll, const void* rr)
|
||||
{
|
||||
const mfxAdapterInfo& l = *(reinterpret_cast<const mfxAdapterInfo*>(ll));
|
||||
const mfxAdapterInfo& r = *(reinterpret_cast<const mfxAdapterInfo*>(rr));
|
||||
|
||||
if (is_iGPU(l) && is_iGPU(r) || is_dGPU(l) && is_dGPU(r))
|
||||
return 0;
|
||||
|
||||
if (is_iGPU(l) && is_dGPU(r))
|
||||
return -1;
|
||||
|
||||
// The only combination left is_dGPU(l) && is_iGPU(r))
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void RearrangeInPriorityOrder(const mfxComponentInfo & info, MFX::MFXVector<mfxAdapterInfo> & vec)
|
||||
{
|
||||
(void)info;
|
||||
{
|
||||
// Move iGPU to top priority
|
||||
qsort(vec.data(), vec.size(), sizeof(mfxAdapterInfo), &iGPU_priority);
|
||||
}
|
||||
}
|
||||
|
||||
static mfxStatus PrepareAdaptersInfo(const mfxComponentInfo * info, MFX::MFXVector<mfxAdapterInfo> & vec, mfxAdaptersInfo& adapters)
|
||||
{
|
||||
// No suitable adapters on system to handle user's workload
|
||||
if (vec.empty())
|
||||
{
|
||||
adapters.NumActual = 0;
|
||||
return MFX_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (info)
|
||||
{
|
||||
RearrangeInPriorityOrder(*info, vec);
|
||||
}
|
||||
|
||||
mfxU32 num_to_copy = (std::min)(mfxU32(vec.size()), adapters.NumAlloc);
|
||||
for (mfxU32 i = 0; i < num_to_copy; ++i)
|
||||
{
|
||||
adapters.Adapters[i] = vec[i];
|
||||
}
|
||||
|
||||
adapters.NumActual = num_to_copy;
|
||||
|
||||
if (vec.size() > adapters.NumAlloc)
|
||||
{
|
||||
return MFX_WRN_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline bool QueryAdapterInfo(mfxU32 adapter_n, mfxU32& VendorID, mfxU32& DeviceID)
|
||||
{
|
||||
MFX::DXVA2Device dxvaDevice;
|
||||
|
||||
if (!dxvaDevice.InitDXGI1(adapter_n))
|
||||
return false;
|
||||
|
||||
VendorID = dxvaDevice.GetVendorID();
|
||||
DeviceID = dxvaDevice.GetDeviceID();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline mfxU32 MakeVersion(mfxU16 major, mfxU16 minor)
|
||||
{
|
||||
return major * 1000 + minor;
|
||||
}
|
||||
|
||||
mfxStatus MFXQueryAdaptersDecode(mfxBitstream* bitstream, mfxU32 codec_id, mfxAdaptersInfo* adapters)
|
||||
{
|
||||
if (!adapters || !bitstream)
|
||||
return MFX_ERR_NULL_PTR;
|
||||
|
||||
MFX::MFXVector<mfxAdapterInfo> obtained_info;
|
||||
|
||||
mfxU32 adapter_n = 0, VendorID, DeviceID;
|
||||
|
||||
mfxComponentInfo input_info;
|
||||
memset(&input_info, 0, sizeof(input_info));
|
||||
input_info.Type = mfxComponentType::MFX_COMPONENT_DECODE;
|
||||
input_info.Requirements.mfx.CodecId = codec_id;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if (!QueryAdapterInfo(adapter_n, VendorID, DeviceID))
|
||||
break;
|
||||
|
||||
++adapter_n;
|
||||
|
||||
if (VendorID != INTEL_VENDOR_ID)
|
||||
continue;
|
||||
|
||||
// Check if requested capabilities are supported
|
||||
MFXVideoSession dummy_session;
|
||||
|
||||
mfxStatus sts = InitDummySession(adapter_n - 1, dummy_session);
|
||||
if (sts != MFX_ERR_NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
mfxVideoParam stream_params, out;
|
||||
memset(&out, 0, sizeof(out));
|
||||
memset(&stream_params, 0, sizeof(stream_params));
|
||||
out.mfx.CodecId = stream_params.mfx.CodecId = codec_id;
|
||||
|
||||
sts = MFXVideoDECODE_DecodeHeader(dummy_session.operator mfxSession(), bitstream, &stream_params);
|
||||
|
||||
if (sts != MFX_ERR_NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
sts = MFXVideoDECODE_Query(dummy_session.operator mfxSession(), &stream_params, &out);
|
||||
|
||||
if (sts != MFX_ERR_NONE) // skip MFX_ERR_UNSUPPORTED as well as MFX_WRN_INCOMPATIBLE_VIDEO_PARAM
|
||||
continue;
|
||||
|
||||
mfxAdapterInfo info;
|
||||
memset(&info, 0, sizeof(info));
|
||||
|
||||
//WA for initialization when application built w/ new API, but lib w/ old one.
|
||||
mfxVersion apiVersion;
|
||||
sts = dummy_session.QueryVersion(&apiVersion);
|
||||
if (sts != MFX_ERR_NONE)
|
||||
continue;
|
||||
|
||||
mfxU32 version = MakeVersion(apiVersion.Major, apiVersion.Minor);
|
||||
|
||||
if (version >= 1019)
|
||||
{
|
||||
sts = MFXVideoCORE_QueryPlatform(dummy_session.operator mfxSession(), &info.Platform);
|
||||
|
||||
if (sts != MFX_ERR_NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// for API versions greater than 1.19 Device id is set inside QueryPlatform call
|
||||
info.Platform.DeviceId = static_cast<mfxU16>(DeviceID);
|
||||
}
|
||||
|
||||
info.Number = adapter_n - 1;
|
||||
|
||||
obtained_info.push_back(info);
|
||||
}
|
||||
|
||||
return PrepareAdaptersInfo(&input_info, obtained_info, *adapters);
|
||||
}
|
||||
|
||||
mfxStatus MFXQueryAdapters(mfxComponentInfo* input_info, mfxAdaptersInfo* adapters)
|
||||
{
|
||||
if (!adapters)
|
||||
return MFX_ERR_NULL_PTR;
|
||||
|
||||
MFX::MFXVector<mfxAdapterInfo> obtained_info;
|
||||
//obtained_info.reserve(adapters->NumAdaptersAlloc);
|
||||
|
||||
mfxU32 adapter_n = 0, VendorID, DeviceID;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (!QueryAdapterInfo(adapter_n, VendorID, DeviceID))
|
||||
break;
|
||||
|
||||
++adapter_n;
|
||||
|
||||
if (VendorID != INTEL_VENDOR_ID)
|
||||
continue;
|
||||
|
||||
// Check if requested capabilities are supported
|
||||
MFXVideoSession dummy_session;
|
||||
|
||||
mfxStatus sts = InitDummySession(adapter_n - 1, dummy_session);
|
||||
if (sts != MFX_ERR_NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// If input_info is NULL just return all Intel adapters and information about them
|
||||
if (input_info)
|
||||
{
|
||||
mfxVideoParam out;
|
||||
memset(&out, 0, sizeof(out));
|
||||
|
||||
switch (input_info->Type)
|
||||
{
|
||||
case mfxComponentType::MFX_COMPONENT_ENCODE:
|
||||
{
|
||||
out.mfx.CodecId = input_info->Requirements.mfx.CodecId;
|
||||
|
||||
sts = MFXVideoENCODE_Query(dummy_session.operator mfxSession(), &input_info->Requirements, &out);
|
||||
}
|
||||
break;
|
||||
case mfxComponentType::MFX_COMPONENT_DECODE:
|
||||
{
|
||||
out.mfx.CodecId = input_info->Requirements.mfx.CodecId;
|
||||
|
||||
sts = MFXVideoDECODE_Query(dummy_session.operator mfxSession(), &input_info->Requirements, &out);
|
||||
}
|
||||
break;
|
||||
case mfxComponentType::MFX_COMPONENT_VPP:
|
||||
{
|
||||
sts = MFXVideoVPP_Query(dummy_session.operator mfxSession(), &input_info->Requirements, &out);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
sts = MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
if (sts != MFX_ERR_NONE) // skip MFX_ERR_UNSUPPORTED as well as MFX_WRN_INCOMPATIBLE_VIDEO_PARAM
|
||||
continue;
|
||||
|
||||
mfxAdapterInfo info;
|
||||
memset(&info, 0, sizeof(info));
|
||||
|
||||
//WA for initialization when application built w/ new API, but lib w/ old one.
|
||||
mfxVersion apiVersion;
|
||||
sts = dummy_session.QueryVersion(&apiVersion);
|
||||
if (sts != MFX_ERR_NONE)
|
||||
continue;
|
||||
|
||||
mfxU32 version = MakeVersion(apiVersion.Major, apiVersion.Minor);
|
||||
|
||||
if (version >= 1019)
|
||||
{
|
||||
sts = MFXVideoCORE_QueryPlatform(dummy_session.operator mfxSession(), &info.Platform);
|
||||
|
||||
if (sts != MFX_ERR_NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// for API versions greater than 1.19 Device id is set inside QueryPlatform call
|
||||
info.Platform.DeviceId = static_cast<mfxU16>(DeviceID);
|
||||
}
|
||||
|
||||
info.Number = adapter_n - 1;
|
||||
|
||||
obtained_info.push_back(info);
|
||||
}
|
||||
|
||||
return PrepareAdaptersInfo(input_info, obtained_info, *adapters);
|
||||
}
|
||||
|
||||
mfxStatus MFXQueryAdaptersNumber(mfxU32* num_adapters)
|
||||
{
|
||||
if (!num_adapters)
|
||||
return MFX_ERR_NULL_PTR;
|
||||
|
||||
mfxU32 intel_adapter_count = 0, VendorID, DeviceID;
|
||||
|
||||
for (mfxU32 cur_adapter = 0; ; ++cur_adapter)
|
||||
{
|
||||
if (!QueryAdapterInfo(cur_adapter, VendorID, DeviceID))
|
||||
break;
|
||||
|
||||
if (VendorID == INTEL_VENDOR_ID)
|
||||
++intel_adapter_count;
|
||||
}
|
||||
|
||||
*num_adapters = intel_adapter_count;
|
||||
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
#endif // (defined(_WIN64) || defined(_WIN32)) && (MFX_VERSION >= 1031)
|
||||
446
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_dispatcher_log.cpp
vendored
Normal file
446
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_dispatcher_log.cpp
vendored
Normal file
@@ -0,0 +1,446 @@
|
||||
// Copyright (c) 2012-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if defined(MFX_DISPATCHER_LOG)
|
||||
|
||||
#include "mfx_dispatcher_log.h"
|
||||
#include "mfxstructures.h"
|
||||
#include <windows.h>
|
||||
#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER)
|
||||
#include <evntprov.h>
|
||||
#include <winmeta.h>
|
||||
#endif
|
||||
#include <stdarg.h>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
struct CodeStringTable
|
||||
{
|
||||
int code;
|
||||
const char *string;
|
||||
} LevelStrings []=
|
||||
{
|
||||
{DL_INFO, "INFO: "},
|
||||
{DL_WRN, "WARNING:"},
|
||||
{DL_ERROR, "ERROR: "}
|
||||
};
|
||||
|
||||
#define DEFINE_CODE(code)\
|
||||
{code, #code}
|
||||
|
||||
static CodeStringTable StringsOfImpl[] = {
|
||||
DEFINE_CODE(MFX_IMPL_AUTO),
|
||||
DEFINE_CODE(MFX_IMPL_SOFTWARE),
|
||||
DEFINE_CODE(MFX_IMPL_HARDWARE),
|
||||
DEFINE_CODE(MFX_IMPL_AUTO_ANY),
|
||||
DEFINE_CODE(MFX_IMPL_HARDWARE_ANY),
|
||||
DEFINE_CODE(MFX_IMPL_HARDWARE2),
|
||||
DEFINE_CODE(MFX_IMPL_HARDWARE3),
|
||||
DEFINE_CODE(MFX_IMPL_HARDWARE4),
|
||||
|
||||
DEFINE_CODE(MFX_IMPL_UNSUPPORTED)
|
||||
};
|
||||
|
||||
static CodeStringTable StringsOfImplVIA[] = {
|
||||
DEFINE_CODE(MFX_IMPL_VIA_ANY),
|
||||
DEFINE_CODE(MFX_IMPL_VIA_D3D9),
|
||||
DEFINE_CODE(MFX_IMPL_VIA_D3D11),
|
||||
};
|
||||
|
||||
static CodeStringTable StringsOfStatus[] =
|
||||
{
|
||||
DEFINE_CODE(MFX_ERR_NONE ),
|
||||
DEFINE_CODE(MFX_ERR_UNKNOWN ),
|
||||
DEFINE_CODE(MFX_ERR_NULL_PTR ),
|
||||
DEFINE_CODE(MFX_ERR_UNSUPPORTED ),
|
||||
DEFINE_CODE(MFX_ERR_MEMORY_ALLOC ),
|
||||
DEFINE_CODE(MFX_ERR_NOT_ENOUGH_BUFFER ),
|
||||
DEFINE_CODE(MFX_ERR_INVALID_HANDLE ),
|
||||
DEFINE_CODE(MFX_ERR_LOCK_MEMORY ),
|
||||
DEFINE_CODE(MFX_ERR_NOT_INITIALIZED ),
|
||||
DEFINE_CODE(MFX_ERR_NOT_FOUND ),
|
||||
DEFINE_CODE(MFX_ERR_MORE_DATA ),
|
||||
DEFINE_CODE(MFX_ERR_MORE_SURFACE ),
|
||||
DEFINE_CODE(MFX_ERR_ABORTED ),
|
||||
DEFINE_CODE(MFX_ERR_DEVICE_LOST ),
|
||||
DEFINE_CODE(MFX_ERR_INCOMPATIBLE_VIDEO_PARAM),
|
||||
DEFINE_CODE(MFX_ERR_INVALID_VIDEO_PARAM ),
|
||||
DEFINE_CODE(MFX_ERR_UNDEFINED_BEHAVIOR ),
|
||||
DEFINE_CODE(MFX_ERR_DEVICE_FAILED ),
|
||||
DEFINE_CODE(MFX_ERR_MORE_BITSTREAM ),
|
||||
DEFINE_CODE(MFX_ERR_INVALID_AUDIO_PARAM ),
|
||||
DEFINE_CODE(MFX_ERR_GPU_HANG ),
|
||||
DEFINE_CODE(MFX_ERR_REALLOC_SURFACE ),
|
||||
DEFINE_CODE(MFX_WRN_IN_EXECUTION ),
|
||||
DEFINE_CODE(MFX_WRN_DEVICE_BUSY ),
|
||||
DEFINE_CODE(MFX_WRN_VIDEO_PARAM_CHANGED ),
|
||||
DEFINE_CODE(MFX_WRN_PARTIAL_ACCELERATION ),
|
||||
DEFINE_CODE(MFX_WRN_INCOMPATIBLE_VIDEO_PARAM),
|
||||
DEFINE_CODE(MFX_WRN_VALUE_NOT_CHANGED ),
|
||||
DEFINE_CODE(MFX_WRN_OUT_OF_RANGE ),
|
||||
DEFINE_CODE(MFX_WRN_FILTER_SKIPPED ),
|
||||
DEFINE_CODE(MFX_WRN_INCOMPATIBLE_AUDIO_PARAM),
|
||||
DEFINE_CODE(MFX_ERR_NONE_PARTIAL_OUTPUT ),
|
||||
DEFINE_CODE(MFX_TASK_WORKING ),
|
||||
DEFINE_CODE(MFX_TASK_BUSY ),
|
||||
DEFINE_CODE(MFX_ERR_MORE_DATA_SUBMIT_TASK ),
|
||||
};
|
||||
|
||||
#define CODE_TO_STRING(code, array)\
|
||||
CodeToString(code, array, sizeof(array)/sizeof(array[0]))
|
||||
|
||||
const char* CodeToString(int code, CodeStringTable array[], int len )
|
||||
{
|
||||
for (int i = 0 ; i < len; i++)
|
||||
{
|
||||
if (array[i].code == code)
|
||||
return array[i].string;
|
||||
}
|
||||
return "undef";
|
||||
}
|
||||
|
||||
std::string DispatcherLog_GetMFXImplString(int impl)
|
||||
{
|
||||
std::string str1 = CODE_TO_STRING(impl & ~(-MFX_IMPL_VIA_ANY), StringsOfImpl);
|
||||
std::string str2 = CODE_TO_STRING(impl & (-MFX_IMPL_VIA_ANY), StringsOfImplVIA);
|
||||
|
||||
return str1 + (str2 == "undef" ? "" : "|"+str2);
|
||||
}
|
||||
|
||||
const char *DispatcherLog_GetMFXStatusString(int sts)
|
||||
{
|
||||
return CODE_TO_STRING(sts, StringsOfStatus);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void DispatcherLogBracketsHelper::Write(const char * str, ...)
|
||||
{
|
||||
va_list argsptr;
|
||||
va_start(argsptr, str);
|
||||
DispatchLog::get().Write(m_level, m_opcode, str, argsptr);
|
||||
va_end(argsptr);
|
||||
}
|
||||
|
||||
void DispatchLogBlockHelper::Write(const char * str, ...)
|
||||
{
|
||||
va_list argsptr;
|
||||
va_start(argsptr, str);
|
||||
DispatchLog::get().Write(m_level, DL_EVENT_START, str, argsptr);
|
||||
va_end(argsptr);
|
||||
}
|
||||
|
||||
DispatchLogBlockHelper::~DispatchLogBlockHelper()
|
||||
{
|
||||
DispatchLog::get().Write(m_level, DL_EVENT_STOP, NULL, NULL);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DispatchLog::DispatchLog()
|
||||
: m_DispatcherLogSink(DL_SINK_PRINTF)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void DispatchLog::SetSink(int nSink, IMsgHandler * pHandler)
|
||||
{
|
||||
DetachAllSinks();
|
||||
AttachSink(nSink, pHandler);
|
||||
}
|
||||
|
||||
void DispatchLog::AttachSink(int nsink, IMsgHandler *pHandler)
|
||||
{
|
||||
m_DispatcherLogSink |= nsink;
|
||||
if (NULL != pHandler)
|
||||
m_Recepients.push_back(pHandler);
|
||||
}
|
||||
|
||||
void DispatchLog::DetachSink(int nsink, IMsgHandler *pHandler)
|
||||
{
|
||||
if (nsink & DL_SINK_IMsgHandler)
|
||||
{
|
||||
m_Recepients.remove(pHandler);
|
||||
}
|
||||
|
||||
m_DispatcherLogSink &= ~nsink;
|
||||
}
|
||||
|
||||
void DispatchLog::ExchangeSink(int nsink, IMsgHandler *oldHdl, IMsgHandler *newHdl)
|
||||
{
|
||||
if (nsink & DL_SINK_IMsgHandler)
|
||||
{
|
||||
std::list<IMsgHandler*> :: iterator it = std::find(m_Recepients.begin(), m_Recepients.end(), oldHdl);
|
||||
|
||||
//cannot exchange in that case
|
||||
if (m_Recepients.end() == it)
|
||||
return;
|
||||
|
||||
*it = newHdl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DispatchLog::DetachAllSinks()
|
||||
{
|
||||
m_Recepients.clear();
|
||||
m_DispatcherLogSink = DL_SINK_NULL;
|
||||
}
|
||||
|
||||
void DispatchLog::Write(int level, int opcode, const char * msg, va_list argptr)
|
||||
{
|
||||
int sinkTable[] =
|
||||
{
|
||||
DL_SINK_PRINTF,
|
||||
DL_SINK_IMsgHandler,
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < sizeof(sinkTable) / sizeof(sinkTable[0]); i++)
|
||||
{
|
||||
switch(m_DispatcherLogSink & sinkTable[i])
|
||||
{
|
||||
case DL_SINK_NULL:
|
||||
break;
|
||||
|
||||
case DL_SINK_PRINTF:
|
||||
{
|
||||
char msg_formated[8048] = {0};
|
||||
|
||||
if (NULL != msg && level != DL_LOADED_LIBRARY)
|
||||
{
|
||||
#if _MSC_VER >= 1400
|
||||
vsprintf_s(msg_formated, sizeof(msg_formated)/sizeof(msg_formated[0]), msg, argptr);
|
||||
#else
|
||||
vsnprintf(msg_formated, sizeof(msg_formated)/sizeof(msg_formated[0]), msg, argptr);
|
||||
#endif
|
||||
//TODO: improve this , add opcode handling
|
||||
printf("%s %s", CODE_TO_STRING(level, LevelStrings), msg_formated);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case DL_SINK_IMsgHandler:
|
||||
{
|
||||
std::list<IMsgHandler*>::iterator it;
|
||||
|
||||
for (it = m_Recepients.begin(); it != m_Recepients.end(); ++it)
|
||||
{
|
||||
(*it)->Write(level, opcode, msg, argptr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER)
|
||||
class ETWHandler : public IMsgHandler
|
||||
{
|
||||
public:
|
||||
ETWHandler(const wchar_t * guid_str)
|
||||
: m_bUseFormatter(DISPATCHER_LOG_USE_FORMATING)
|
||||
, m_EventHandle()
|
||||
, m_bProviderEnable()
|
||||
{
|
||||
GUID rguid = GUID_NULL;
|
||||
if (FAILED(CLSIDFromString(guid_str, &rguid)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EventRegister(&rguid, NULL, NULL, &m_EventHandle);
|
||||
|
||||
m_bProviderEnable = 0 != EventProviderEnabled(m_EventHandle, 1,0);
|
||||
}
|
||||
|
||||
~ETWHandler()
|
||||
{
|
||||
if (m_EventHandle)
|
||||
{
|
||||
EventUnregister(m_EventHandle);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Write(int level, int opcode, const char * msg, va_list argptr)
|
||||
{
|
||||
//event not registered
|
||||
if (0==m_EventHandle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!m_bProviderEnable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (level == DL_LOADED_LIBRARY)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char msg_formated[1024];
|
||||
EVENT_DESCRIPTOR descriptor;
|
||||
EVENT_DATA_DESCRIPTOR data_descriptor;
|
||||
|
||||
EventDescZero(&descriptor);
|
||||
|
||||
descriptor.Opcode = (UCHAR)opcode;
|
||||
descriptor.Level = (UCHAR)level;
|
||||
|
||||
if (m_bUseFormatter)
|
||||
{
|
||||
if (NULL != msg)
|
||||
{
|
||||
#if _MSC_VER >= 1400
|
||||
vsprintf_s(msg_formated, sizeof (msg_formated) / sizeof (msg_formated[0]), msg, argptr);
|
||||
#else
|
||||
vsnprintf(msg_formated, sizeof (msg_formated) / sizeof (msg_formated[0]), msg, argptr);
|
||||
#endif
|
||||
EventDataDescCreate(&data_descriptor, msg_formated, (ULONG)(strlen(msg_formated) + 1));
|
||||
}else
|
||||
{
|
||||
EventDataDescCreate(&data_descriptor, NULL, 0);
|
||||
}
|
||||
}else
|
||||
{
|
||||
//TODO: non formated events supports under zbb
|
||||
}
|
||||
|
||||
EventWrite(m_EventHandle, &descriptor, 1, &data_descriptor);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//we may not use formatter in some cases described in dispatch_log macro
|
||||
//it significantly increases performance by eliminating any vsprintf operations
|
||||
bool m_bUseFormatter;
|
||||
//consumer is attached, dispatcher trace to reduce formating overhead
|
||||
//submits event only if consumer attached
|
||||
bool m_bProviderEnable;
|
||||
REGHANDLE m_EventHandle;
|
||||
};
|
||||
//
|
||||
|
||||
|
||||
IMsgHandler *ETWHandlerFactory::GetSink(const wchar_t* sguid)
|
||||
{
|
||||
_storage_type::iterator it;
|
||||
it = m_storage.find(sguid);
|
||||
if (it == m_storage.end())
|
||||
{
|
||||
ETWHandler * handler = new ETWHandler(sguid);
|
||||
_storage_type::_Pairib it_bool = m_storage.insert(_storage_type::value_type(sguid, handler));
|
||||
it = it_bool.first;
|
||||
}
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
ETWHandlerFactory::~ETWHandlerFactory()
|
||||
{
|
||||
for each(_storage_type::value_type val in m_storage)
|
||||
{
|
||||
delete val.second;
|
||||
}
|
||||
}
|
||||
|
||||
class EventRegistrator : public IMsgHandler
|
||||
{
|
||||
const wchar_t * m_sguid;
|
||||
public:
|
||||
EventRegistrator(const wchar_t* sguid = DISPATCHER_LOG_EVENT_GUID)
|
||||
:m_sguid(sguid)
|
||||
{
|
||||
DispatchLog::get().AttachSink( DL_SINK_IMsgHandler
|
||||
, this);
|
||||
}
|
||||
|
||||
virtual void Write(int level, int opcode, const char * msg, va_list argptr)
|
||||
{
|
||||
//we cannot call attach sink since we may have been called from iteration
|
||||
//we axchanging preserve that placeholding
|
||||
IMsgHandler * pSink = NULL;
|
||||
DispatchLog::get().ExchangeSink(DL_SINK_IMsgHandler,
|
||||
this,
|
||||
pSink = ETWHandlerFactory::get().GetSink(m_sguid));
|
||||
//need to call only once here all next calls will be done inside dispatcherlog
|
||||
if (NULL != pSink)
|
||||
{
|
||||
pSink->Write(level, opcode, msg, argptr);
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
template <class TSink>
|
||||
class SinkRegistrator
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(DISPATCHER_LOG_REGISTER_EVENT_PROVIDER)
|
||||
template <>
|
||||
class SinkRegistrator<ETWHandlerFactory>
|
||||
{
|
||||
public:
|
||||
SinkRegistrator(const wchar_t* sguid = DISPATCHER_LOG_EVENT_GUID)
|
||||
{
|
||||
DispatchLog::get().AttachSink( DL_SINK_IMsgHandler
|
||||
, ETWHandlerFactory::get().GetSink(sguid));
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(DISPATCHER_LOG_REGISTER_FILE_WRITER)
|
||||
template <>
|
||||
class SinkRegistrator<FileSink>
|
||||
{
|
||||
public:
|
||||
SinkRegistrator()
|
||||
{
|
||||
DispatchLog::get().AttachSink( DL_SINK_IMsgHandler, &FileSink::get(DISPACTHER_LOG_FW_PATH));
|
||||
}
|
||||
};
|
||||
|
||||
void FileSink::Write(int level, int /*opcode*/, const char * msg, va_list argptr)
|
||||
{
|
||||
if (NULL != m_hdl && NULL != msg)
|
||||
{
|
||||
fprintf(m_hdl, "%s", CODE_TO_STRING(level, LevelStrings));
|
||||
vfprintf(m_hdl, msg, argptr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//singletons initialization section
|
||||
|
||||
|
||||
#ifdef DISPATCHER_LOG_REGISTER_EVENT_PROVIDER
|
||||
static SinkRegistrator<ETWHandlerFactory> g_registrator1;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef DISPATCHER_LOG_REGISTER_FILE_WRITER
|
||||
static SinkRegistrator<FileSink> g_registrator2;
|
||||
#endif
|
||||
|
||||
|
||||
#endif//(MFX_DISPATCHER_LOG)
|
||||
1180
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_dispatcher_main.cpp
vendored
Normal file
1180
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_dispatcher_main.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
288
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_dispatcher_uwp.cpp
vendored
Normal file
288
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_dispatcher_uwp.cpp
vendored
Normal file
@@ -0,0 +1,288 @@
|
||||
// Copyright (c) 2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "mfx_dispatcher.h"
|
||||
#include "mfx_dispatcher_uwp.h"
|
||||
#include "mfx_driver_store_loader.h"
|
||||
#include "mfx_dxva2_device.h"
|
||||
#include "mfx_load_dll.h"
|
||||
|
||||
mfxStatus GfxApiInit(mfxInitParam par, mfxU32 deviceID, mfxSession *session, mfxModuleHandle& hModule)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (hModule == NULL)
|
||||
{
|
||||
wchar_t IntelGFXAPIdllName[MFX_MAX_DLL_PATH] = { 0 };
|
||||
MFX::DriverStoreLoader dsLoader;
|
||||
|
||||
if (!dsLoader.GetDriverStorePath(IntelGFXAPIdllName, sizeof(IntelGFXAPIdllName), deviceID))
|
||||
{
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
size_t pathLen = wcslen(IntelGFXAPIdllName);
|
||||
MFX::mfx_get_default_intel_gfx_api_dll_name(IntelGFXAPIdllName + pathLen, sizeof(IntelGFXAPIdllName) / sizeof(IntelGFXAPIdllName[0]) - pathLen);
|
||||
DISPATCHER_LOG_INFO((("loading %S\n"), IntelGFXAPIdllName));
|
||||
|
||||
hModule = MFX::mfx_dll_load(IntelGFXAPIdllName);
|
||||
if (!hModule)
|
||||
{
|
||||
DISPATCHER_LOG_ERROR("Can't load intel_gfx_api\n");
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
mfxFunctionPointer pFunc = (mfxFunctionPointer)MFX::mfx_dll_get_addr(hModule, "InitialiseMediaSession");
|
||||
if (!pFunc)
|
||||
{
|
||||
DISPATCHER_LOG_ERROR("Can't find required API function: InitialiseMediaSession\n");
|
||||
MFX::mfx_dll_free(hModule);
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
typedef HRESULT(APIENTRY *InitialiseMediaSessionPtr) (HANDLE*, LPVOID, LPVOID);
|
||||
InitialiseMediaSessionPtr init = (InitialiseMediaSessionPtr)pFunc;
|
||||
hr = init((HANDLE*)session, &par, NULL);
|
||||
|
||||
return (hr == S_OK) ? MFX_ERR_NONE : MFX_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
mfxStatus GfxApiClose(mfxSession& session, mfxModuleHandle& hModule)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
|
||||
if (!hModule)
|
||||
{
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
mfxFunctionPointer pFunc = (mfxFunctionPointer)MFX::mfx_dll_get_addr(hModule, "DisposeMediaSession");
|
||||
if (!pFunc)
|
||||
{
|
||||
DISPATCHER_LOG_ERROR("Can't find required API function: DisposeMediaSession\n");
|
||||
return MFX_ERR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
typedef HRESULT(APIENTRY *DisposeMediaSessionPtr) (HANDLE);
|
||||
DisposeMediaSessionPtr dispose = (DisposeMediaSessionPtr)pFunc;
|
||||
hr = dispose((HANDLE)session);
|
||||
session = NULL;
|
||||
|
||||
MFX::mfx_dll_free(hModule);
|
||||
hModule = NULL;
|
||||
|
||||
return (hr == S_OK) ? MFX_ERR_NONE : MFX_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
mfxStatus GfxApiInitByAdapterNum(mfxInitParam par, mfxU32 adapterNum, mfxSession *session, mfxModuleHandle& hModule)
|
||||
{
|
||||
MFX::DXVA2Device dxvaDevice;
|
||||
|
||||
if (!dxvaDevice.InitDXGI1(adapterNum))
|
||||
{
|
||||
DISPATCHER_LOG_ERROR((("dxvaDevice.InitDXGI1(%d) Failed\n"), adapterNum));
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (dxvaDevice.GetVendorID() != INTEL_VENDOR_ID)
|
||||
{
|
||||
DISPATCHER_LOG_ERROR("Specified adapter is not Intel\n");
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return GfxApiInit(par, dxvaDevice.GetDeviceID(), session, hModule);
|
||||
}
|
||||
|
||||
struct GfxApiHandle
|
||||
{
|
||||
mfxModuleHandle hModule;
|
||||
mfxSession session;
|
||||
mfxU16 mediaAdapterType;
|
||||
};
|
||||
|
||||
static int GfxApiHandleSort(const void * plhs, const void * prhs)
|
||||
{
|
||||
const GfxApiHandle * lhs = *(const GfxApiHandle **)plhs;
|
||||
const GfxApiHandle * rhs = *(const GfxApiHandle **)prhs;
|
||||
|
||||
// prefer integrated GPU
|
||||
if (lhs->mediaAdapterType != MFX_MEDIA_INTEGRATED && rhs->mediaAdapterType == MFX_MEDIA_INTEGRATED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (lhs->mediaAdapterType == MFX_MEDIA_INTEGRATED && rhs->mediaAdapterType != MFX_MEDIA_INTEGRATED)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
mfxStatus GfxApiInitPriorityIntegrated(mfxInitParam par, mfxSession *session, mfxModuleHandle& hModule)
|
||||
{
|
||||
mfxStatus sts = MFX_ERR_UNSUPPORTED;
|
||||
MFX::MFXVector<GfxApiHandle> gfxApiHandles;
|
||||
|
||||
for (int adapterNum = 0; adapterNum < 4; ++adapterNum)
|
||||
{
|
||||
MFX::DXVA2Device dxvaDevice;
|
||||
|
||||
if (!dxvaDevice.InitDXGI1(adapterNum) || dxvaDevice.GetVendorID() != INTEL_VENDOR_ID)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
par.Implementation &= ~(0xf);
|
||||
switch (adapterNum)
|
||||
{
|
||||
case 0:
|
||||
par.Implementation |= MFX_IMPL_HARDWARE;
|
||||
break;
|
||||
case 1:
|
||||
par.Implementation |= MFX_IMPL_HARDWARE2;
|
||||
break;
|
||||
case 2:
|
||||
par.Implementation |= MFX_IMPL_HARDWARE3;
|
||||
break;
|
||||
case 3:
|
||||
par.Implementation |= MFX_IMPL_HARDWARE4;
|
||||
break;
|
||||
}
|
||||
|
||||
mfxModuleHandle hModuleCur = NULL;
|
||||
mfxSession sessionCur = NULL;
|
||||
|
||||
sts = GfxApiInit(par, dxvaDevice.GetDeviceID(), &sessionCur, hModuleCur);
|
||||
if (sts != MFX_ERR_NONE)
|
||||
continue;
|
||||
|
||||
mfxPlatform platform = { MFX_PLATFORM_UNKNOWN, 0, MFX_MEDIA_UNKNOWN };
|
||||
sts = MFXVideoCORE_QueryPlatform(sessionCur, &platform);
|
||||
if (sts != MFX_ERR_NONE)
|
||||
{
|
||||
sts = GfxApiClose(sessionCur, hModuleCur);
|
||||
if (sts != MFX_ERR_NONE)
|
||||
return sts;
|
||||
continue;
|
||||
}
|
||||
|
||||
GfxApiHandle handle = { hModuleCur, sessionCur, platform.MediaAdapterType };
|
||||
gfxApiHandles.push_back(handle);
|
||||
}
|
||||
|
||||
//Try to use fallback from System folder
|
||||
mfxModuleHandle hFallback = NULL;
|
||||
|
||||
if (gfxApiHandles.size() == 0)
|
||||
{
|
||||
wchar_t IntelGFXAPIdllName[MFX_MAX_DLL_PATH] = { 0 };
|
||||
MFX::mfx_get_default_intel_gfx_api_dll_name(IntelGFXAPIdllName, sizeof(IntelGFXAPIdllName) / sizeof(IntelGFXAPIdllName[0]));
|
||||
DISPATCHER_LOG_INFO((("loading fallback %S\n"), IntelGFXAPIdllName));
|
||||
|
||||
hFallback = MFX::mfx_dll_load(IntelGFXAPIdllName);
|
||||
if (!hFallback)
|
||||
{
|
||||
DISPATCHER_LOG_ERROR("Can't load intel_gfx_api\n");
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
for (int adapterNum = 0; adapterNum < 4; ++adapterNum)
|
||||
{
|
||||
MFX::DXVA2Device dxvaDevice;
|
||||
|
||||
if (!dxvaDevice.InitDXGI1(adapterNum) || dxvaDevice.GetVendorID() != INTEL_VENDOR_ID)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
par.Implementation &= ~(0xf);
|
||||
switch (adapterNum)
|
||||
{
|
||||
case 0:
|
||||
par.Implementation |= MFX_IMPL_HARDWARE;
|
||||
break;
|
||||
case 1:
|
||||
par.Implementation |= MFX_IMPL_HARDWARE2;
|
||||
break;
|
||||
case 2:
|
||||
par.Implementation |= MFX_IMPL_HARDWARE3;
|
||||
break;
|
||||
case 3:
|
||||
par.Implementation |= MFX_IMPL_HARDWARE4;
|
||||
break;
|
||||
}
|
||||
|
||||
mfxSession sessionCur = NULL;
|
||||
|
||||
sts = GfxApiInit(par, dxvaDevice.GetDeviceID(), &sessionCur, hFallback);
|
||||
if (sts != MFX_ERR_NONE)
|
||||
continue;
|
||||
|
||||
mfxPlatform platform = { MFX_PLATFORM_UNKNOWN, 0, MFX_MEDIA_UNKNOWN };
|
||||
sts = MFXVideoCORE_QueryPlatform(sessionCur, &platform);
|
||||
if (sts != MFX_ERR_NONE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
GfxApiHandle handle = { NULL, sessionCur, platform.MediaAdapterType };
|
||||
gfxApiHandles.push_back(handle);
|
||||
}
|
||||
}
|
||||
|
||||
if (gfxApiHandles.size() == 0)
|
||||
{
|
||||
if (hFallback != NULL)
|
||||
{
|
||||
MFX::mfx_dll_free(hFallback);
|
||||
hFallback = NULL;
|
||||
}
|
||||
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
qsort(&(*gfxApiHandles.begin()), gfxApiHandles.size(), sizeof(GfxApiHandle), &GfxApiHandleSort);
|
||||
|
||||
// When hModule == NULL and hFallback != NULL - it means dispatcher uses fallback library from System folder
|
||||
hModule = ( gfxApiHandles.begin()->hModule == NULL && hFallback != NULL )? hFallback : gfxApiHandles.begin()->hModule;
|
||||
*session = gfxApiHandles.begin()->session;
|
||||
|
||||
MFX::MFXVector<GfxApiHandle>::iterator it = gfxApiHandles.begin()++;
|
||||
for (; it != gfxApiHandles.end(); ++it)
|
||||
{
|
||||
sts = GfxApiClose(it->session, it->hModule);
|
||||
|
||||
if (sts == MFX_ERR_NULL_PTR)
|
||||
continue;
|
||||
|
||||
if (sts != MFX_ERR_NONE)
|
||||
return sts;
|
||||
}
|
||||
|
||||
//If dispatcher has tried a fallback, but returns something else - free loaded fallback
|
||||
if (hFallback != NULL && hModule != hFallback)
|
||||
{
|
||||
MFX::mfx_dll_free(hFallback);
|
||||
hFallback = NULL;
|
||||
}
|
||||
|
||||
return sts;
|
||||
}
|
||||
225
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_driver_store_loader.cpp
vendored
Normal file
225
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_driver_store_loader.cpp
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
// Copyright (c) 2019-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
#include "mfx_driver_store_loader.h"
|
||||
#include "mfx_dispatcher_log.h"
|
||||
#include "mfx_load_dll.h"
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
|
||||
inline bool IsIntelDeviceInstanceID(const wchar_t * DeviceID)
|
||||
{
|
||||
return wcsstr(DeviceID, L"VEN_8086") || wcsstr(DeviceID, L"ven_8086");
|
||||
}
|
||||
|
||||
inline bool ExctractDeviceID(const wchar_t* descrString, mfxU32& deviceID)
|
||||
{
|
||||
const wchar_t *begin = wcsstr(descrString, L"DEV_");
|
||||
|
||||
if (!begin)
|
||||
{
|
||||
begin = wcsstr(descrString, L"dev_");
|
||||
if (!begin)
|
||||
{
|
||||
DISPATCHER_LOG_WRN(("exctracting device id: failed to find device id substring\n"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
begin += wcslen(L"DEV_");
|
||||
deviceID = wcstoul(begin, NULL, 16);
|
||||
if (!deviceID)
|
||||
{
|
||||
DISPATCHER_LOG_WRN(("exctracting device id: failed to convert device id str to int\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool GetGuidString(const GUID guid, wchar_t * string, size_t size)
|
||||
{
|
||||
return swprintf_s(string, size,
|
||||
L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||
guid.Data1, guid.Data2, guid.Data3,
|
||||
guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
|
||||
guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);
|
||||
}
|
||||
|
||||
DriverStoreLoader::DriverStoreLoader(void)
|
||||
: m_moduleCfgMgr(NULL)
|
||||
, m_pCM_Get_Device_ID_List_Size(NULL)
|
||||
, m_pCM_Get_Device_ID_List(NULL)
|
||||
, m_pCM_Locate_DevNode(NULL)
|
||||
, m_pCM_Open_DevNode_Key(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
DriverStoreLoader::~DriverStoreLoader(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool DriverStoreLoader::GetDriverStorePath(wchar_t * path, DWORD dwPathSize, mfxU32 deviceID)
|
||||
{
|
||||
if (path == NULL || dwPathSize == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Obtain a PnP handle to the Intel graphics adapter
|
||||
CONFIGRET result = CR_SUCCESS;
|
||||
ULONG DeviceIDListSize = 0;
|
||||
MFXVector<WCHAR> DeviceIDList;
|
||||
wchar_t DisplayGUID[40];
|
||||
DEVINST DeviceInst;
|
||||
|
||||
DISPATCHER_LOG_INFO(("Looking for MediaSDK in DriverStore\n"));
|
||||
|
||||
if (!LoadCfgMgr() || !LoadCmFuncs())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!GetGuidString(GUID_DEVCLASS_DISPLAY, DisplayGUID, sizeof(DisplayGUID) / sizeof(DisplayGUID[0])))
|
||||
{
|
||||
DISPATCHER_LOG_WRN(("Couldn't prepare string from GUID\n"));
|
||||
return false;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
result = m_pCM_Get_Device_ID_List_Size(&DeviceIDListSize, DisplayGUID, CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT);
|
||||
if (result != CR_SUCCESS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DeviceIDList.resize(DeviceIDListSize);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
result = m_pCM_Get_Device_ID_List(DisplayGUID, DeviceIDList.data(), DeviceIDListSize, CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT);
|
||||
|
||||
} while (result == CR_BUFFER_SMALL);
|
||||
|
||||
if (result != CR_SUCCESS)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Look for MediaSDK record
|
||||
wchar_t *begin = DeviceIDList.data();
|
||||
wchar_t *end = begin + DeviceIDList.size();
|
||||
size_t len = 0;
|
||||
|
||||
for (; (begin < end) && (len = wcslen(begin)) > 0; begin += len + 1)
|
||||
{
|
||||
if (IsIntelDeviceInstanceID(begin))
|
||||
{
|
||||
mfxU32 curDeviceID = 0;
|
||||
if (!ExctractDeviceID(begin, curDeviceID) || curDeviceID != deviceID)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
result = m_pCM_Locate_DevNode(&DeviceInst, begin, CM_LOCATE_DEVNODE_NORMAL);
|
||||
if (result != CR_SUCCESS)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
HKEY hKey_sw;
|
||||
result = m_pCM_Open_DevNode_Key(DeviceInst, KEY_READ, 0, RegDisposition_OpenExisting, &hKey_sw, CM_REGISTRY_SOFTWARE);
|
||||
if (result != CR_SUCCESS)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ULONG nError;
|
||||
|
||||
DWORD pathSize = dwPathSize;
|
||||
|
||||
nError = RegGetValueW(hKey_sw, NULL, L"DriverStorePathForMediaSDK", RRF_RT_REG_SZ, NULL, (LPBYTE)path, &pathSize);
|
||||
|
||||
RegCloseKey(hKey_sw);
|
||||
|
||||
if (ERROR_SUCCESS == nError)
|
||||
{
|
||||
if (path[wcslen(path) - 1] != '/' && path[wcslen(path) - 1] != '\\')
|
||||
{
|
||||
wcscat_s(path, dwPathSize / sizeof(path[0]), L"\\");
|
||||
}
|
||||
DISPATCHER_LOG_INFO(("DriverStore path is found\n"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DISPATCHER_LOG_INFO(("DriverStore path isn't found\n"));
|
||||
return false;
|
||||
|
||||
} // bool DriverStoreLoader::GetDriverStorePath(wchar_t * path, DWORD dwPathSize)
|
||||
|
||||
bool DriverStoreLoader::LoadCfgMgr()
|
||||
{
|
||||
if (!m_moduleCfgMgr)
|
||||
{
|
||||
m_moduleCfgMgr = mfx_dll_load(L"cfgmgr32.dll");
|
||||
|
||||
if (!m_moduleCfgMgr)
|
||||
{
|
||||
DISPATCHER_LOG_WRN(("cfgmgr32.dll couldn't be loaded\n"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // bool DriverStoreLoader::LoadCfgMgr()
|
||||
|
||||
bool DriverStoreLoader::LoadCmFuncs()
|
||||
{
|
||||
if (!m_pCM_Get_Device_ID_List || !m_pCM_Get_Device_ID_List_Size || !m_pCM_Locate_DevNode || !m_pCM_Open_DevNode_Key)
|
||||
{
|
||||
m_pCM_Get_Device_ID_List = (Func_CM_Get_Device_ID_ListW) mfx_dll_get_addr((HMODULE)m_moduleCfgMgr, "CM_Get_Device_ID_ListW");
|
||||
m_pCM_Get_Device_ID_List_Size = (Func_CM_Get_Device_ID_List_SizeW) mfx_dll_get_addr((HMODULE)m_moduleCfgMgr, "CM_Get_Device_ID_List_SizeW");
|
||||
m_pCM_Locate_DevNode = (Func_CM_Locate_DevNodeW) mfx_dll_get_addr((HMODULE)m_moduleCfgMgr, "CM_Locate_DevNodeW");
|
||||
m_pCM_Open_DevNode_Key = (Func_CM_Open_DevNode_Key) mfx_dll_get_addr((HMODULE)m_moduleCfgMgr, "CM_Open_DevNode_Key");
|
||||
|
||||
if (!m_pCM_Get_Device_ID_List || !m_pCM_Get_Device_ID_List_Size || !m_pCM_Locate_DevNode || !m_pCM_Open_DevNode_Key)
|
||||
{
|
||||
DISPATCHER_LOG_WRN(("One of cfgmgr32.dll function isn't found\n"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // bool DriverStoreLoader::LoadCmFuncs()
|
||||
|
||||
} // namespace MFX
|
||||
568
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_dxva2_device.cpp
vendored
Normal file
568
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_dxva2_device.cpp
vendored
Normal file
@@ -0,0 +1,568 @@
|
||||
// Copyright (c) 2012-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#define INITGUID
|
||||
#include <d3d9.h>
|
||||
#include <dxgi.h>
|
||||
|
||||
#include "mfx_dxva2_device.h"
|
||||
|
||||
|
||||
using namespace MFX;
|
||||
|
||||
|
||||
DXDevice::DXDevice(void)
|
||||
{
|
||||
m_hModule = (HMODULE) 0;
|
||||
|
||||
m_numAdapters = 0;
|
||||
|
||||
m_vendorID = 0;
|
||||
m_deviceID = 0;
|
||||
m_driverVersion = 0;
|
||||
m_luid = 0;
|
||||
|
||||
} // DXDevice::DXDevice(void)
|
||||
|
||||
DXDevice::~DXDevice(void)
|
||||
{
|
||||
Close();
|
||||
|
||||
// free DX library only when device is destroyed
|
||||
UnloadDLLModule();
|
||||
|
||||
} // DXDevice::~DXDevice(void)
|
||||
|
||||
mfxU32 DXDevice::GetVendorID(void) const
|
||||
{
|
||||
return m_vendorID;
|
||||
|
||||
} // mfxU32 DXDevice::GetVendorID(void) const
|
||||
|
||||
mfxU32 DXDevice::GetDeviceID(void) const
|
||||
{
|
||||
return m_deviceID;
|
||||
|
||||
} // mfxU32 DXDevice::GetDeviceID(void) const
|
||||
|
||||
mfxU64 DXDevice::GetDriverVersion(void) const
|
||||
{
|
||||
return m_driverVersion;
|
||||
|
||||
}// mfxU64 DXDevice::GetDriverVersion(void) const
|
||||
|
||||
mfxU64 DXDevice::GetLUID(void) const
|
||||
{
|
||||
return m_luid;
|
||||
|
||||
} // mfxU64 DXDevice::GetLUID(void) const
|
||||
|
||||
mfxU32 DXDevice::GetAdapterCount(void) const
|
||||
{
|
||||
return m_numAdapters;
|
||||
|
||||
} // mfxU32 DXDevice::GetAdapterCount(void) const
|
||||
|
||||
void DXDevice::Close(void)
|
||||
{
|
||||
m_numAdapters = 0;
|
||||
|
||||
m_vendorID = 0;
|
||||
m_deviceID = 0;
|
||||
m_luid = 0;
|
||||
|
||||
} // void DXDevice::Close(void)
|
||||
|
||||
void DXDevice::LoadDLLModule(const wchar_t *pModuleName)
|
||||
{
|
||||
// unload the module if it is required
|
||||
UnloadDLLModule();
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
DWORD prevErrorMode = 0;
|
||||
// set the silent error mode
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
|
||||
SetThreadErrorMode(SEM_FAILCRITICALERRORS, &prevErrorMode);
|
||||
#else
|
||||
prevErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||
#endif
|
||||
#endif // !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
// load specified library
|
||||
m_hModule = LoadLibraryExW(pModuleName, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32 | LOAD_LIBRARY_SEARCH_USER_DIRS);
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
// set the previous error mode
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
|
||||
SetThreadErrorMode(prevErrorMode, NULL);
|
||||
#else
|
||||
SetErrorMode(prevErrorMode);
|
||||
#endif
|
||||
#endif // !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
} // void LoadDLLModule(const wchar_t *pModuleName)
|
||||
|
||||
void DXDevice::UnloadDLLModule(void)
|
||||
{
|
||||
if (m_hModule)
|
||||
{
|
||||
FreeLibrary(m_hModule);
|
||||
m_hModule = (HMODULE) 0;
|
||||
}
|
||||
|
||||
} // void DXDevice::UnloaDLLdModule(void)
|
||||
|
||||
#ifdef MFX_D3D9_ENABLED
|
||||
D3D9Device::D3D9Device(void)
|
||||
{
|
||||
m_pD3D9 = (void *) 0;
|
||||
m_pD3D9Ex = (void *) 0;
|
||||
|
||||
} // D3D9Device::D3D9Device(void)
|
||||
|
||||
D3D9Device::~D3D9Device(void)
|
||||
{
|
||||
Close();
|
||||
|
||||
} // D3D9Device::~D3D9Device(void)
|
||||
|
||||
void D3D9Device::Close(void)
|
||||
{
|
||||
// release the interfaces
|
||||
if (m_pD3D9Ex)
|
||||
{
|
||||
((IDirect3D9Ex *) m_pD3D9Ex)->Release();
|
||||
}
|
||||
|
||||
// release the interfaces
|
||||
if (m_pD3D9)
|
||||
{
|
||||
((IDirect3D9 *) m_pD3D9)->Release();
|
||||
}
|
||||
|
||||
m_pD3D9 = (void *) 0;
|
||||
m_pD3D9Ex = (void *) 0;
|
||||
|
||||
} // void D3D9Device::Close(void)
|
||||
|
||||
typedef
|
||||
IDirect3D9 * (WINAPI *D3DCreateFunctionPtr_t) (UINT);
|
||||
|
||||
typedef
|
||||
HRESULT (WINAPI *D3DExCreateFunctionPtr_t) (UINT, IDirect3D9Ex **);
|
||||
|
||||
bool D3D9Device::Init(const mfxU32 adapterNum)
|
||||
{
|
||||
// close the device before initialization
|
||||
Close();
|
||||
|
||||
// load the library
|
||||
if (NULL == m_hModule)
|
||||
{
|
||||
LoadDLLModule(L"d3d9.dll");
|
||||
}
|
||||
|
||||
if (m_hModule)
|
||||
{
|
||||
D3DCreateFunctionPtr_t pFunc;
|
||||
|
||||
// load address of procedure to create D3D device
|
||||
pFunc = (D3DCreateFunctionPtr_t) GetProcAddress(m_hModule, "Direct3DCreate9");
|
||||
if (pFunc)
|
||||
{
|
||||
D3DADAPTER_IDENTIFIER9 adapterIdent;
|
||||
IDirect3D9 *pD3D9;
|
||||
HRESULT hRes;
|
||||
|
||||
// create D3D object
|
||||
m_pD3D9 = pFunc(D3D_SDK_VERSION);
|
||||
|
||||
if (NULL == m_pD3D9)
|
||||
{
|
||||
DXVA2DEVICE_TRACE(("FAIL: Direct3DCreate9(%d) : GetLastError()=0x%x", D3D_SDK_VERSION, GetLastError()));
|
||||
return false;
|
||||
}
|
||||
|
||||
// cast the interface
|
||||
pD3D9 = (IDirect3D9 *) m_pD3D9;
|
||||
|
||||
m_numAdapters = pD3D9->GetAdapterCount();
|
||||
if (adapterNum >= m_numAdapters)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the card's parameters
|
||||
hRes = pD3D9->GetAdapterIdentifier(adapterNum, 0, &adapterIdent);
|
||||
if (D3D_OK != hRes)
|
||||
{
|
||||
DXVA2DEVICE_TRACE(("FAIL: GetAdapterIdentifier(%d) = 0x%x \n", adapterNum, hRes));
|
||||
return false;
|
||||
}
|
||||
|
||||
m_vendorID = adapterIdent.VendorId;
|
||||
m_deviceID = adapterIdent.DeviceId;
|
||||
m_driverVersion = (mfxU64)adapterIdent.DriverVersion.QuadPart;
|
||||
|
||||
// load LUID
|
||||
IDirect3D9Ex *pD3D9Ex;
|
||||
D3DExCreateFunctionPtr_t pFuncEx;
|
||||
LUID d3d9LUID;
|
||||
|
||||
// find the appropriate function
|
||||
pFuncEx = (D3DExCreateFunctionPtr_t) GetProcAddress(m_hModule, "Direct3DCreate9Ex");
|
||||
if (NULL == pFuncEx)
|
||||
{
|
||||
// the extended interface is not supported
|
||||
return true;
|
||||
}
|
||||
|
||||
// create extended interface
|
||||
hRes = pFuncEx(D3D_SDK_VERSION, &pD3D9Ex);
|
||||
if (FAILED(hRes))
|
||||
{
|
||||
// can't create extended interface
|
||||
return true;
|
||||
}
|
||||
m_pD3D9Ex = pD3D9Ex;
|
||||
|
||||
// obtain D3D9 device LUID
|
||||
hRes = pD3D9Ex->GetAdapterLUID(adapterNum, &d3d9LUID);
|
||||
if (FAILED(hRes))
|
||||
{
|
||||
// can't get LUID
|
||||
return true;
|
||||
}
|
||||
// copy the LUID
|
||||
*((LUID *) &m_luid) = d3d9LUID;
|
||||
}
|
||||
else
|
||||
{
|
||||
DXVA2DEVICE_TRACE_OPERATION({
|
||||
wchar_t path[1024];
|
||||
DWORD lastErr = GetLastError();
|
||||
GetModuleFileNameW(m_hModule, path, sizeof(path)/sizeof(path[0]));
|
||||
DXVA2DEVICE_TRACE(("FAIL: invoking GetProcAddress(Direct3DCreate9) in %S : GetLastError()==0x%x\n", path, lastErr)); });
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DXVA2DEVICE_TRACE(("FAIL: invoking LoadLibrary(\"d3d9.dll\") : GetLastError()==0x%x\n", GetLastError()));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // bool D3D9Device::Init(const mfxU32 adapterNum)
|
||||
#endif //MFX_D3D9_ENABLED
|
||||
|
||||
typedef
|
||||
HRESULT (WINAPI *DXGICreateFactoryFunc) (REFIID riid, void **ppFactory);
|
||||
|
||||
DXGI1Device::DXGI1Device(void)
|
||||
{
|
||||
m_pDXGIFactory1 = (void *) 0;
|
||||
m_pDXGIAdapter1 = (void *) 0;
|
||||
|
||||
} // DXGI1Device::DXGI1Device(void)
|
||||
|
||||
DXGI1Device::~DXGI1Device(void)
|
||||
{
|
||||
Close();
|
||||
|
||||
} // DXGI1Device::~DXGI1Device(void)
|
||||
|
||||
void DXGI1Device::Close(void)
|
||||
{
|
||||
// release the interfaces
|
||||
if (m_pDXGIAdapter1)
|
||||
{
|
||||
((IDXGIAdapter1 *) m_pDXGIAdapter1)->Release();
|
||||
}
|
||||
|
||||
if (m_pDXGIFactory1)
|
||||
{
|
||||
((IDXGIFactory1 *) m_pDXGIFactory1)->Release();
|
||||
}
|
||||
|
||||
m_pDXGIFactory1 = (void *) 0;
|
||||
m_pDXGIAdapter1 = (void *) 0;
|
||||
|
||||
} // void DXGI1Device::Close(void)
|
||||
|
||||
bool DXGI1Device::Init(const mfxU32 adapterNum)
|
||||
{
|
||||
// release the object before initialization
|
||||
Close();
|
||||
|
||||
IDXGIFactory1 *pFactory = NULL;
|
||||
IDXGIAdapter1 *pAdapter = NULL;
|
||||
DXGI_ADAPTER_DESC1 desc = { 0 };
|
||||
mfxU32 curAdapter = 0;
|
||||
mfxU32 maxAdapters = 0;
|
||||
HRESULT hRes = E_FAIL;
|
||||
|
||||
DXGICreateFactoryFunc pFunc = NULL;
|
||||
|
||||
// load up the library if it is not loaded
|
||||
if (NULL == m_hModule)
|
||||
{
|
||||
LoadDLLModule(L"dxgi.dll");
|
||||
}
|
||||
|
||||
if (m_hModule)
|
||||
{
|
||||
// load address of procedure to create DXGI 1.1 factory
|
||||
pFunc = (DXGICreateFactoryFunc)GetProcAddress(m_hModule, "CreateDXGIFactory1");
|
||||
}
|
||||
|
||||
if (NULL == pFunc)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// create the factory
|
||||
#if _MSC_VER >= 1400
|
||||
hRes = pFunc(__uuidof(IDXGIFactory1), (void**)(&pFactory));
|
||||
#else
|
||||
hRes = pFunc(IID_IDXGIFactory1, (void**)(&pFactory));
|
||||
#endif
|
||||
|
||||
if (FAILED(hRes))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_pDXGIFactory1 = pFactory;
|
||||
|
||||
// get the number of adapters
|
||||
curAdapter = 0;
|
||||
maxAdapters = 0;
|
||||
do
|
||||
{
|
||||
// get the required adapted
|
||||
hRes = pFactory->EnumAdapters1(curAdapter, &pAdapter);
|
||||
if (FAILED(hRes))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// if it is the required adapter, save the interface
|
||||
if (curAdapter == adapterNum)
|
||||
{
|
||||
m_pDXGIAdapter1 = pAdapter;
|
||||
}
|
||||
else
|
||||
{
|
||||
pAdapter->Release();
|
||||
}
|
||||
|
||||
// get the next adapter
|
||||
curAdapter += 1;
|
||||
|
||||
} while (SUCCEEDED(hRes));
|
||||
maxAdapters = curAdapter;
|
||||
|
||||
// there is no required adapter
|
||||
if (adapterNum >= maxAdapters)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
pAdapter = (IDXGIAdapter1 *) m_pDXGIAdapter1;
|
||||
|
||||
// get the adapter's parameters
|
||||
hRes = pAdapter->GetDesc1(&desc);
|
||||
if (FAILED(hRes))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// save the parameters
|
||||
m_vendorID = desc.VendorId;
|
||||
m_deviceID = desc.DeviceId;
|
||||
*((LUID *) &m_luid) = desc.AdapterLuid;
|
||||
|
||||
return true;
|
||||
|
||||
} // bool DXGI1Device::Init(const mfxU32 adapterNum)
|
||||
|
||||
DXVA2Device::DXVA2Device(void)
|
||||
{
|
||||
m_numAdapters = 0;
|
||||
|
||||
m_vendorID = 0;
|
||||
m_deviceID = 0;
|
||||
|
||||
m_driverVersion = 0;
|
||||
} // DXVA2Device::DXVA2Device(void)
|
||||
|
||||
DXVA2Device::~DXVA2Device(void)
|
||||
{
|
||||
Close();
|
||||
|
||||
} // DXVA2Device::~DXVA2Device(void)
|
||||
|
||||
void DXVA2Device::Close(void)
|
||||
{
|
||||
m_numAdapters = 0;
|
||||
|
||||
m_vendorID = 0;
|
||||
m_deviceID = 0;
|
||||
|
||||
m_driverVersion = 0;
|
||||
} // void DXVA2Device::Close(void)
|
||||
|
||||
#ifdef MFX_D3D9_ENABLED
|
||||
bool DXVA2Device::InitD3D9(const mfxU32 adapterNum)
|
||||
{
|
||||
D3D9Device d3d9Device;
|
||||
bool bRes;
|
||||
|
||||
// release the object before initialization
|
||||
Close();
|
||||
|
||||
// create 'old fashion' device
|
||||
bRes = d3d9Device.Init(adapterNum);
|
||||
if (false == bRes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
m_numAdapters = d3d9Device.GetAdapterCount();
|
||||
|
||||
// check if the application is under Remote Desktop
|
||||
if ((0 == d3d9Device.GetVendorID()) || (0 == d3d9Device.GetDeviceID()))
|
||||
{
|
||||
// get the required parameters alternative way and ...
|
||||
UseAlternativeWay(&d3d9Device);
|
||||
}
|
||||
else
|
||||
{
|
||||
// save the parameters and ...
|
||||
m_vendorID = d3d9Device.GetVendorID();
|
||||
m_deviceID = d3d9Device.GetDeviceID();
|
||||
m_driverVersion = d3d9Device.GetDriverVersion();
|
||||
}
|
||||
|
||||
// ... say goodbye
|
||||
return true;
|
||||
} // bool InitD3D9(const mfxU32 adapterNum)
|
||||
#else // MFX_D3D9_ENABLED
|
||||
bool DXVA2Device::InitD3D9(const mfxU32 adapterNum)
|
||||
{
|
||||
(void)adapterNum;
|
||||
return false;
|
||||
}
|
||||
#endif // MFX_D3D9_ENABLED
|
||||
|
||||
bool DXVA2Device::InitDXGI1(const mfxU32 adapterNum)
|
||||
{
|
||||
DXGI1Device dxgi1Device;
|
||||
bool bRes;
|
||||
|
||||
// release the object before initialization
|
||||
Close();
|
||||
|
||||
// create modern DXGI device
|
||||
bRes = dxgi1Device.Init(adapterNum);
|
||||
if (false == bRes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// save the parameters and ...
|
||||
m_vendorID = dxgi1Device.GetVendorID();
|
||||
m_deviceID = dxgi1Device.GetDeviceID();
|
||||
m_numAdapters = dxgi1Device.GetAdapterCount();
|
||||
|
||||
// ... say goodbye
|
||||
return true;
|
||||
|
||||
} // bool DXVA2Device::InitDXGI1(const mfxU32 adapterNum)
|
||||
|
||||
#ifdef MFX_D3D9_ENABLED
|
||||
void DXVA2Device::UseAlternativeWay(const D3D9Device *pD3D9Device)
|
||||
{
|
||||
mfxU64 d3d9LUID = pD3D9Device->GetLUID();
|
||||
|
||||
// work only with valid LUIDs
|
||||
if (0 == d3d9LUID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DXGI1Device dxgi1Device;
|
||||
mfxU32 curDevice = 0;
|
||||
bool bRes = false;
|
||||
|
||||
do
|
||||
{
|
||||
// initialize the next DXGI1 or DXGI device
|
||||
bRes = dxgi1Device.Init(curDevice);
|
||||
if (false == bRes)
|
||||
{
|
||||
// there is no more devices
|
||||
break;
|
||||
}
|
||||
|
||||
// is it required device ?
|
||||
if (d3d9LUID == dxgi1Device.GetLUID())
|
||||
{
|
||||
m_vendorID = dxgi1Device.GetVendorID();
|
||||
m_deviceID = dxgi1Device.GetDeviceID();
|
||||
m_driverVersion = dxgi1Device.GetDriverVersion();
|
||||
return ;
|
||||
}
|
||||
|
||||
// get the next device
|
||||
curDevice += 1;
|
||||
|
||||
} while (bRes);
|
||||
|
||||
dxgi1Device.Close();
|
||||
// we need to match a DXGI(1) device to the D3D9 device
|
||||
|
||||
} // void DXVA2Device::UseAlternativeWay(const D3D9Device *pD3D9Device)
|
||||
#endif // MFX_D3D9_ENABLED
|
||||
|
||||
mfxU32 DXVA2Device::GetVendorID(void) const
|
||||
{
|
||||
return m_vendorID;
|
||||
|
||||
} // mfxU32 DXVA2Device::GetVendorID(void) const
|
||||
|
||||
mfxU32 DXVA2Device::GetDeviceID(void) const
|
||||
{
|
||||
return m_deviceID;
|
||||
|
||||
} // mfxU32 DXVA2Device::GetDeviceID(void) const
|
||||
|
||||
mfxU64 DXVA2Device::GetDriverVersion(void) const
|
||||
{
|
||||
return m_driverVersion;
|
||||
}// mfxU64 DXVA2Device::GetDriverVersion(void) const
|
||||
|
||||
mfxU32 DXVA2Device::GetAdapterCount(void) const
|
||||
{
|
||||
return m_numAdapters;
|
||||
|
||||
} // mfxU32 DXVA2Device::GetAdapterCount(void) const
|
||||
|
||||
133
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_function_table.cpp
vendored
Normal file
133
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_function_table.cpp
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
// Copyright (c) 2012-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "mfx_dispatcher.h"
|
||||
|
||||
//
|
||||
// implement a table with functions names
|
||||
//
|
||||
|
||||
#undef FUNCTION
|
||||
#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \
|
||||
{#func_name, API_VERSION},
|
||||
|
||||
const
|
||||
FUNCTION_DESCRIPTION APIFunc[eVideoFuncTotal] =
|
||||
{
|
||||
{"MFXInit", {{0, 1}}},
|
||||
{"MFXClose", {{0, 1}}},
|
||||
{"MFXQueryIMPL", {{0, 1}}},
|
||||
{"MFXQueryVersion", {{0, 1}}},
|
||||
|
||||
{"MFXJoinSession", {{1, 1}}},
|
||||
{"MFXDisjoinSession", {{1, 1}}},
|
||||
{"MFXCloneSession", {{1, 1}}},
|
||||
{"MFXSetPriority", {{1, 1}}},
|
||||
{"MFXGetPriority", {{1, 1}}},
|
||||
|
||||
{"MFXInitEx", {{1, 14}}},
|
||||
|
||||
#include "mfx_exposed_functions_list.h"
|
||||
};
|
||||
|
||||
const
|
||||
FUNCTION_DESCRIPTION APIAudioFunc[eAudioFuncTotal] =
|
||||
{
|
||||
{"MFXInit", {{8, 1}}},
|
||||
{"MFXClose", {{8, 1}}},
|
||||
{"MFXQueryIMPL", {{8, 1}}},
|
||||
{"MFXQueryVersion", {{8, 1}}},
|
||||
|
||||
{"MFXJoinSession", {{8, 1}}},
|
||||
{"MFXDisjoinSession", {{8, 1}}},
|
||||
{"MFXCloneSession", {{8, 1}}},
|
||||
{"MFXSetPriority", {{8, 1}}},
|
||||
{"MFXGetPriority", {{8, 1}}},
|
||||
|
||||
#include "mfxaudio_exposed_functions_list.h"
|
||||
};
|
||||
|
||||
// static section of the file
|
||||
namespace
|
||||
{
|
||||
|
||||
//
|
||||
// declare pseudo-functions.
|
||||
// they are used as default values for call-tables.
|
||||
//
|
||||
|
||||
mfxStatus pseudoMFXInit(mfxIMPL impl, mfxVersion *ver, mfxSession *session)
|
||||
{
|
||||
// touch unreferenced parameters
|
||||
(void) impl;
|
||||
(void) ver;
|
||||
(void) session;
|
||||
|
||||
return MFX_ERR_UNKNOWN;
|
||||
|
||||
} // mfxStatus pseudoMFXInit(mfxIMPL impl, mfxVersion *ver, mfxSession *session)
|
||||
|
||||
mfxStatus pseudoMFXClose(mfxSession session)
|
||||
{
|
||||
// touch unreferenced parameters
|
||||
(void) session;
|
||||
|
||||
return MFX_ERR_UNKNOWN;
|
||||
|
||||
} // mfxStatus pseudoMFXClose(mfxSession session)
|
||||
|
||||
mfxStatus pseudoMFXJoinSession(mfxSession session, mfxSession child_session)
|
||||
{
|
||||
// touch unreferenced parameters
|
||||
(void) session;
|
||||
(void) child_session;
|
||||
|
||||
return MFX_ERR_UNKNOWN;
|
||||
|
||||
} // mfxStatus pseudoMFXJoinSession(mfxSession session, mfxSession child_session)
|
||||
|
||||
mfxStatus pseudoMFXCloneSession(mfxSession session, mfxSession *clone)
|
||||
{
|
||||
// touch unreferenced parameters
|
||||
(void) session;
|
||||
(void) clone;
|
||||
|
||||
return MFX_ERR_UNKNOWN;
|
||||
|
||||
} // mfxStatus pseudoMFXCloneSession(mfxSession session, mfxSession *clone)
|
||||
|
||||
void SuppressWarnings(...)
|
||||
{
|
||||
// this functions is suppose to suppress warnings.
|
||||
// Actually it does nothing.
|
||||
|
||||
} // void SuppressWarnings(...)
|
||||
|
||||
#undef FUNCTION
|
||||
#define FUNCTION(return_value, func_name, formal_param_list, actual_param_list) \
|
||||
return_value pseudo##func_name formal_param_list \
|
||||
{ \
|
||||
SuppressWarnings actual_param_list; \
|
||||
return MFX_ERR_UNKNOWN; \
|
||||
}
|
||||
|
||||
#include "mfx_exposed_functions_list.h"
|
||||
|
||||
} // namespace
|
||||
592
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_library_iterator.cpp
vendored
Normal file
592
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_library_iterator.cpp
vendored
Normal file
@@ -0,0 +1,592 @@
|
||||
// Copyright (c) 2012-2020 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "mfx_library_iterator.h"
|
||||
|
||||
#include "mfx_dispatcher.h"
|
||||
#include "mfx_dispatcher_log.h"
|
||||
|
||||
#include "mfx_dxva2_device.h"
|
||||
#include "mfx_load_dll.h"
|
||||
|
||||
#include <tchar.h>
|
||||
#include <windows.h>
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
enum
|
||||
{
|
||||
MFX_MAX_MERIT = 0x7fffffff
|
||||
};
|
||||
|
||||
//
|
||||
// declare registry keys
|
||||
//
|
||||
|
||||
const
|
||||
wchar_t rootDispPath[] = L"Software\\Intel\\MediaSDK\\Dispatch";
|
||||
const
|
||||
wchar_t vendorIDKeyName[] = L"VendorID";
|
||||
const
|
||||
wchar_t deviceIDKeyName[] = L"DeviceID";
|
||||
const
|
||||
wchar_t meritKeyName[] = L"Merit";
|
||||
const
|
||||
wchar_t pathKeyName[] = L"Path";
|
||||
const
|
||||
wchar_t apiVersionName[] = L"APIVersion";
|
||||
|
||||
mfxStatus SelectImplementationType(const mfxU32 adapterNum, mfxIMPL *pImplInterface, mfxU32 *pVendorID, mfxU32 *pDeviceID)
|
||||
{
|
||||
if (NULL == pImplInterface)
|
||||
{
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
#if (MFX_VERSION >= MFX_VERSION_NEXT)
|
||||
mfxIMPL impl_via = (*pImplInterface & ~MFX_IMPL_EXTERNAL_THREADING);
|
||||
#else
|
||||
mfxIMPL impl_via = *pImplInterface;
|
||||
#endif
|
||||
|
||||
DXVA2Device dxvaDevice;
|
||||
if (MFX_IMPL_VIA_D3D9 == impl_via)
|
||||
{
|
||||
// try to create the Direct3D 9 device and find right adapter
|
||||
if (!dxvaDevice.InitD3D9(adapterNum))
|
||||
{
|
||||
DISPATCHER_LOG_INFO((("dxvaDevice.InitD3D9(%d) Failed\n"), adapterNum ));
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
else if (MFX_IMPL_VIA_D3D11 == impl_via)
|
||||
{
|
||||
// try to open DXGI 1.1 device to get hardware ID
|
||||
if (!dxvaDevice.InitDXGI1(adapterNum))
|
||||
{
|
||||
DISPATCHER_LOG_INFO((("dxvaDevice.InitDXGI1(%d) Failed\n"), adapterNum ));
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
else if (MFX_IMPL_VIA_ANY == impl_via)
|
||||
{
|
||||
// try the Direct3D 9 device
|
||||
if (dxvaDevice.InitD3D9(adapterNum))
|
||||
{
|
||||
*pImplInterface = MFX_IMPL_VIA_D3D9; // store value for GetImplementationType() call
|
||||
}
|
||||
// else try to open DXGI 1.1 device to get hardware ID
|
||||
else if (dxvaDevice.InitDXGI1(adapterNum))
|
||||
{
|
||||
*pImplInterface = MFX_IMPL_VIA_D3D11; // store value for GetImplementationType() call
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_INFO((("Unsupported adapter %d\n"), adapterNum ));
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_ERROR((("Unknown implementation type %d\n"), *pImplInterface ));
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
// obtain card's parameters
|
||||
if (pVendorID && pDeviceID)
|
||||
{
|
||||
*pVendorID = dxvaDevice.GetVendorID();
|
||||
*pDeviceID = dxvaDevice.GetDeviceID();
|
||||
}
|
||||
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
MFXLibraryIterator::MFXLibraryIterator(void)
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
: m_baseRegKey()
|
||||
#endif
|
||||
{
|
||||
m_implType = MFX_LIB_PSEUDO;
|
||||
m_implInterface = MFX_IMPL_UNSUPPORTED;
|
||||
|
||||
m_vendorID = 0;
|
||||
m_deviceID = 0;
|
||||
|
||||
m_lastLibIndex = 0;
|
||||
m_lastLibMerit = MFX_MAX_MERIT;
|
||||
|
||||
m_bIsSubKeyValid = 0;
|
||||
m_StorageID = 0;
|
||||
|
||||
m_SubKeyName[0] = 0;
|
||||
} // MFXLibraryIterator::MFXLibraryIterator(void)
|
||||
|
||||
MFXLibraryIterator::~MFXLibraryIterator(void)
|
||||
{
|
||||
Release();
|
||||
|
||||
} // MFXLibraryIterator::~MFXLibraryIterator(void)
|
||||
|
||||
void MFXLibraryIterator::Release(void)
|
||||
{
|
||||
m_implType = MFX_LIB_PSEUDO;
|
||||
m_implInterface = MFX_IMPL_UNSUPPORTED;
|
||||
|
||||
m_vendorID = 0;
|
||||
m_deviceID = 0;
|
||||
|
||||
m_lastLibIndex = 0;
|
||||
m_lastLibMerit = MFX_MAX_MERIT;
|
||||
m_SubKeyName[0] = 0;
|
||||
|
||||
} // void MFXLibraryIterator::Release(void)
|
||||
|
||||
DECLSPEC_NOINLINE HMODULE GetThisDllModuleHandle()
|
||||
{
|
||||
HMODULE hDll = NULL;
|
||||
|
||||
GetModuleHandleExW( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
|
||||
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
|
||||
reinterpret_cast<LPCWSTR>(&GetThisDllModuleHandle), &hDll);
|
||||
return hDll;
|
||||
}
|
||||
|
||||
// wchar_t* sImplPath must be allocated with size not less then msdk_disp_path_len
|
||||
bool GetImplPath(int storageID, wchar_t* sImplPath)
|
||||
{
|
||||
HMODULE hModule = NULL;
|
||||
|
||||
sImplPath[0] = L'\0';
|
||||
|
||||
switch (storageID) {
|
||||
case MFX_APP_FOLDER:
|
||||
hModule = 0;
|
||||
break;
|
||||
case MFX_PATH_MSDK_FOLDER:
|
||||
hModule = GetThisDllModuleHandle();
|
||||
HMODULE exeModule = GetModuleHandleW(NULL);
|
||||
//It should works only if Dispatcher is linked with Dynamic Linked Library
|
||||
if (!hModule || !exeModule || hModule == exeModule)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
DWORD nSize = 0;
|
||||
DWORD allocSize = msdk_disp_path_len;
|
||||
|
||||
nSize = GetModuleFileNameW(hModule, &sImplPath[0], allocSize);
|
||||
|
||||
if (nSize == 0 || nSize == allocSize) {
|
||||
// nSize == 0 meanse that system can't get this info for hModule
|
||||
// nSize == allocSize buffer is too small
|
||||
return false;
|
||||
}
|
||||
|
||||
// for any case because WinXP implementation of GetModuleFileName does not add \0 to the end of string
|
||||
sImplPath[nSize] = L'\0';
|
||||
|
||||
wchar_t * dirSeparator = wcsrchr(sImplPath, L'\\');
|
||||
if (dirSeparator != NULL && dirSeparator < (sImplPath + msdk_disp_path_len))
|
||||
{
|
||||
*++dirSeparator = 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
mfxStatus MFXLibraryIterator::Init(eMfxImplType implType, mfxIMPL implInterface, const mfxU32 adapterNum, int storageID)
|
||||
{
|
||||
// check error(s)
|
||||
if ((MFX_LIB_SOFTWARE != implType) &&
|
||||
(MFX_LIB_HARDWARE != implType))
|
||||
{
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
// release the object before initialization
|
||||
Release();
|
||||
m_StorageID = storageID;
|
||||
m_lastLibIndex = 0;
|
||||
m_implType = implType;
|
||||
m_implInterface = implInterface != 0
|
||||
? implInterface
|
||||
: MFX_IMPL_VIA_ANY;
|
||||
|
||||
// for HW impl check impl interface, check adapter, obtain deviceID and vendorID
|
||||
if (m_implType != MFX_LIB_SOFTWARE)
|
||||
{
|
||||
mfxStatus mfxRes = MFX::SelectImplementationType(adapterNum, &m_implInterface, &m_vendorID, &m_deviceID);
|
||||
if (MFX_ERR_NONE != mfxRes)
|
||||
{
|
||||
return mfxRes;
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
if (storageID == MFX_CURRENT_USER_KEY || storageID == MFX_LOCAL_MACHINE_KEY)
|
||||
{
|
||||
return InitRegistry(storageID);
|
||||
}
|
||||
|
||||
#if defined(MFX_TRACER_WA_FOR_DS)
|
||||
if (storageID == MFX_TRACER)
|
||||
{
|
||||
return InitRegistryTracer();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
wchar_t sMediaSDKPath[msdk_disp_path_len] = {};
|
||||
|
||||
if (storageID == MFX_DRIVER_STORE)
|
||||
{
|
||||
if (!m_driverStoreLoader.GetDriverStorePath(sMediaSDKPath, sizeof(sMediaSDKPath), m_deviceID))
|
||||
{
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
else if(!GetImplPath(storageID, sMediaSDKPath))
|
||||
{
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
return InitFolder(implType, sMediaSDKPath, storageID);
|
||||
|
||||
} // mfxStatus MFXLibraryIterator::Init(eMfxImplType implType, const mfxU32 adapterNum, int storageID)
|
||||
|
||||
mfxStatus MFXLibraryIterator::InitRegistry(int storageID)
|
||||
{
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
HKEY rootHKey;
|
||||
bool bRes;
|
||||
|
||||
// open required registry key
|
||||
rootHKey = (MFX_LOCAL_MACHINE_KEY == storageID) ? (HKEY_LOCAL_MACHINE) : (HKEY_CURRENT_USER);
|
||||
bRes = m_baseRegKey.Open(rootHKey, rootDispPath, KEY_READ);
|
||||
if (false == bRes)
|
||||
{
|
||||
DISPATCHER_LOG_WRN((("Can't open %s\\%S : RegOpenKeyExA()==0x%x\n"),
|
||||
(MFX_LOCAL_MACHINE_KEY == storageID) ? ("HKEY_LOCAL_MACHINE") : ("HKEY_CURRENT_USER"),
|
||||
rootDispPath, GetLastError()))
|
||||
return MFX_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
DISPATCHER_LOG_INFO((("Inspecting %s\\%S\n"),
|
||||
(MFX_LOCAL_MACHINE_KEY == storageID) ? ("HKEY_LOCAL_MACHINE") : ("HKEY_CURRENT_USER"),
|
||||
rootDispPath))
|
||||
|
||||
return MFX_ERR_NONE;
|
||||
#else
|
||||
(void) storageID;
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
#endif // #if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
} // mfxStatus MFXLibraryIterator::InitRegistry(int storageID)
|
||||
|
||||
#if defined(MFX_TRACER_WA_FOR_DS)
|
||||
mfxStatus MFXLibraryIterator::InitRegistryTracer()
|
||||
{
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
const wchar_t tracerRegKeyPath[] = L"Software\\Intel\\MediaSDK\\Dispatch\\tracer";
|
||||
|
||||
if (!m_baseRegKey.Open(HKEY_LOCAL_MACHINE, tracerRegKeyPath, KEY_READ) && !m_baseRegKey.Open(HKEY_CURRENT_USER, tracerRegKeyPath, KEY_READ))
|
||||
{
|
||||
DISPATCHER_LOG_WRN(("can't find tracer registry key\n"))
|
||||
return MFX_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
DISPATCHER_LOG_INFO(("found tracer registry key\n"))
|
||||
return MFX_ERR_NONE;
|
||||
|
||||
#else
|
||||
return MFX_ERR_UNSUPPORTED;
|
||||
#endif // #if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
} // mfxStatus MFXLibraryIterator::InitRegistryTracer()
|
||||
#endif
|
||||
|
||||
mfxStatus MFXLibraryIterator::InitFolder(eMfxImplType implType, const wchar_t * path, const int storageID)
|
||||
{
|
||||
const int maxPathLen = sizeof(m_path)/sizeof(m_path[0]);
|
||||
m_path[0] = 0;
|
||||
wcscpy_s(m_path, maxPathLen, path);
|
||||
size_t pathLen = wcslen(m_path);
|
||||
|
||||
if(storageID==MFX_APP_FOLDER)
|
||||
{
|
||||
// we looking for runtime in application folder, it should be named libmfxsw64 or libmfxsw32
|
||||
mfx_get_default_dll_name(m_path + pathLen, msdk_disp_path_len - pathLen, MFX_LIB_SOFTWARE);
|
||||
}
|
||||
else
|
||||
{
|
||||
mfx_get_default_dll_name(m_path + pathLen, msdk_disp_path_len - pathLen, implType);
|
||||
}
|
||||
|
||||
return MFX_ERR_NONE;
|
||||
} // mfxStatus MFXLibraryIterator::InitFolder(eMfxImplType implType, const wchar_t * path, const int storageID)
|
||||
|
||||
mfxStatus MFXLibraryIterator::SelectDLLVersion(wchar_t *pPath
|
||||
, size_t pathSize
|
||||
, eMfxImplType *pImplType, mfxVersion minVersion)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(minVersion);
|
||||
|
||||
if (m_StorageID == MFX_APP_FOLDER)
|
||||
{
|
||||
if (m_lastLibIndex != 0)
|
||||
return MFX_ERR_NOT_FOUND;
|
||||
if (m_vendorID != INTEL_VENDOR_ID)
|
||||
return MFX_ERR_UNKNOWN;
|
||||
|
||||
m_lastLibIndex = 1;
|
||||
wcscpy_s(pPath, pathSize, m_path);
|
||||
*pImplType = MFX_LIB_SOFTWARE;
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
if (m_StorageID == MFX_PATH_MSDK_FOLDER || m_StorageID == MFX_DRIVER_STORE)
|
||||
{
|
||||
if (m_lastLibIndex != 0)
|
||||
return MFX_ERR_NOT_FOUND;
|
||||
if (m_vendorID != INTEL_VENDOR_ID)
|
||||
return MFX_ERR_UNKNOWN;
|
||||
|
||||
m_lastLibIndex = 1;
|
||||
wcscpy_s(pPath, pathSize, m_path);
|
||||
// do not change impl type
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
#if defined(MFX_TRACER_WA_FOR_DS)
|
||||
if (m_StorageID == MFX_TRACER)
|
||||
{
|
||||
if (m_lastLibIndex != 0)
|
||||
return MFX_ERR_NOT_FOUND;
|
||||
if (m_vendorID != INTEL_VENDOR_ID)
|
||||
return MFX_ERR_UNKNOWN;
|
||||
|
||||
m_lastLibIndex = 1;
|
||||
|
||||
if (m_baseRegKey.Query(pathKeyName, REG_SZ, (LPBYTE)pPath, (DWORD*)&pathSize))
|
||||
{
|
||||
DISPATCHER_LOG_INFO((("loaded %S : %S\n"), pathKeyName, pPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_WRN((("error querying %S : RegQueryValueExA()==0x%x\n"), pathKeyName, GetLastError()));
|
||||
}
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
wchar_t libPath[MFX_MAX_DLL_PATH] = L"";
|
||||
DWORD libIndex = 0;
|
||||
DWORD libMerit = 0;
|
||||
DWORD index;
|
||||
bool enumRes;
|
||||
|
||||
// main query cycle
|
||||
index = 0;
|
||||
m_bIsSubKeyValid = false;
|
||||
do
|
||||
{
|
||||
WinRegKey subKey;
|
||||
wchar_t subKeyName[MFX_MAX_REGISTRY_KEY_NAME] = { 0 };
|
||||
DWORD subKeyNameSize = sizeof(subKeyName) / sizeof(subKeyName[0]);
|
||||
|
||||
// query next value name
|
||||
enumRes = m_baseRegKey.EnumKey(index, subKeyName, &subKeyNameSize);
|
||||
if (!enumRes)
|
||||
{
|
||||
DISPATCHER_LOG_WRN((("no more subkeys : RegEnumKeyExA()==0x%x\n"), GetLastError()))
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_INFO((("found subkey: %S\n"), subKeyName))
|
||||
|
||||
bool bRes;
|
||||
|
||||
// open the sub key
|
||||
bRes = subKey.Open(m_baseRegKey, subKeyName, KEY_READ);
|
||||
if (!bRes)
|
||||
{
|
||||
DISPATCHER_LOG_WRN((("error opening key %S :RegOpenKeyExA()==0x%x\n"), subKeyName, GetLastError()));
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_INFO((("opened key: %S\n"), subKeyName));
|
||||
|
||||
mfxU32 vendorID = 0, deviceID = 0, merit = 0;
|
||||
DWORD size;
|
||||
|
||||
// query vendor and device IDs
|
||||
size = sizeof(vendorID);
|
||||
bRes = subKey.Query(vendorIDKeyName, REG_DWORD, (LPBYTE) &vendorID, &size);
|
||||
DISPATCHER_LOG_OPERATION({
|
||||
if (bRes)
|
||||
{
|
||||
DISPATCHER_LOG_INFO((("loaded %S : 0x%x\n"), vendorIDKeyName, vendorID));
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_WRN((("querying %S : RegQueryValueExA()==0x%x\n"), vendorIDKeyName, GetLastError()));
|
||||
}
|
||||
})
|
||||
|
||||
if (bRes)
|
||||
{
|
||||
size = sizeof(deviceID);
|
||||
bRes = subKey.Query(deviceIDKeyName, REG_DWORD, (LPBYTE) &deviceID, &size);
|
||||
DISPATCHER_LOG_OPERATION({
|
||||
if (bRes)
|
||||
{
|
||||
DISPATCHER_LOG_INFO((("loaded %S : 0x%x\n"), deviceIDKeyName, deviceID));
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_WRN((("querying %S : RegQueryValueExA()==0x%x\n"), deviceIDKeyName, GetLastError()));
|
||||
}
|
||||
})
|
||||
}
|
||||
// query merit value
|
||||
if (bRes)
|
||||
{
|
||||
size = sizeof(merit);
|
||||
bRes = subKey.Query(meritKeyName, REG_DWORD, (LPBYTE) &merit, &size);
|
||||
DISPATCHER_LOG_OPERATION({
|
||||
if (bRes)
|
||||
{
|
||||
DISPATCHER_LOG_INFO((("loaded %S : %d\n"), meritKeyName, merit));
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_WRN((("querying %S : RegQueryValueExA()==0x%x\n"), meritKeyName, GetLastError()));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// if the library fits required parameters,
|
||||
// query the library's path
|
||||
if (bRes)
|
||||
{
|
||||
// compare device's and library's IDs
|
||||
if (MFX_LIB_HARDWARE == m_implType)
|
||||
{
|
||||
if (m_vendorID != vendorID)
|
||||
{
|
||||
bRes = false;
|
||||
DISPATCHER_LOG_WRN((("%S conflict, actual = 0x%x : required = 0x%x\n"), vendorIDKeyName, m_vendorID, vendorID));
|
||||
}
|
||||
if (bRes && m_deviceID != deviceID)
|
||||
{
|
||||
bRes = false;
|
||||
DISPATCHER_LOG_WRN((("%S conflict, actual = 0x%x : required = 0x%x\n"), deviceIDKeyName, m_deviceID, deviceID));
|
||||
}
|
||||
}
|
||||
|
||||
DISPATCHER_LOG_OPERATION({
|
||||
if (bRes)
|
||||
{
|
||||
if (!(((m_lastLibMerit > merit) || ((m_lastLibMerit == merit) && (m_lastLibIndex < index))) &&
|
||||
(libMerit < merit)))
|
||||
{
|
||||
DISPATCHER_LOG_WRN((("merit conflict: lastMerit = 0x%x, requiredMerit = 0x%x, libraryMerit = 0x%x, lastindex = %d, index = %d\n")
|
||||
, m_lastLibMerit, merit, libMerit, m_lastLibIndex, index));
|
||||
}
|
||||
}})
|
||||
|
||||
if ((bRes) &&
|
||||
((m_lastLibMerit > merit) || ((m_lastLibMerit == merit) && (m_lastLibIndex < index))) &&
|
||||
(libMerit < merit))
|
||||
{
|
||||
wchar_t tmpPath[MFX_MAX_DLL_PATH];
|
||||
DWORD tmpPathSize = sizeof(tmpPath);
|
||||
|
||||
bRes = subKey.Query(pathKeyName, REG_SZ, (LPBYTE) tmpPath, &tmpPathSize);
|
||||
if (!bRes)
|
||||
{
|
||||
DISPATCHER_LOG_WRN((("error querying %S : RegQueryValueExA()==0x%x\n"), pathKeyName, GetLastError()));
|
||||
}
|
||||
else
|
||||
{
|
||||
DISPATCHER_LOG_INFO((("loaded %S : %S\n"), pathKeyName, tmpPath));
|
||||
|
||||
wcscpy_s(libPath, sizeof(libPath) / sizeof(libPath[0]), tmpPath);
|
||||
wcscpy_s(m_SubKeyName, sizeof(m_SubKeyName) / sizeof(m_SubKeyName[0]), subKeyName);
|
||||
|
||||
libMerit = merit;
|
||||
libIndex = index;
|
||||
|
||||
// set the library's type
|
||||
if ((0 == vendorID) || (0 == deviceID))
|
||||
{
|
||||
*pImplType = MFX_LIB_SOFTWARE;
|
||||
DISPATCHER_LOG_INFO((("Library type is MFX_LIB_SOFTWARE\n")));
|
||||
}
|
||||
else
|
||||
{
|
||||
*pImplType = MFX_LIB_HARDWARE;
|
||||
DISPATCHER_LOG_INFO((("Library type is MFX_LIB_HARDWARE\n")));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// advance key index
|
||||
index += 1;
|
||||
|
||||
} while (enumRes);
|
||||
|
||||
// if the library's path was successfully read,
|
||||
// the merit variable holds valid value
|
||||
if (0 == libMerit)
|
||||
{
|
||||
return MFX_ERR_NOT_FOUND;
|
||||
}
|
||||
|
||||
wcscpy_s(pPath, pathSize, libPath);
|
||||
|
||||
m_lastLibIndex = libIndex;
|
||||
m_lastLibMerit = libMerit;
|
||||
m_bIsSubKeyValid = true;
|
||||
|
||||
#endif
|
||||
|
||||
return MFX_ERR_NONE;
|
||||
|
||||
} // mfxStatus MFXLibraryIterator::SelectDLLVersion(wchar_t *pPath, size_t pathSize, eMfxImplType *pImplType, mfxVersion minVersion)
|
||||
|
||||
mfxIMPL MFXLibraryIterator::GetImplementationType()
|
||||
{
|
||||
return m_implInterface;
|
||||
} // mfxIMPL MFXLibraryIterator::GetImplementationType()
|
||||
|
||||
bool MFXLibraryIterator::GetSubKeyName(wchar_t *subKeyName, size_t length) const
|
||||
{
|
||||
wcscpy_s(subKeyName, length, m_SubKeyName);
|
||||
return m_bIsSubKeyValid;
|
||||
}
|
||||
} // namespace MFX
|
||||
242
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_load_dll.cpp
vendored
Normal file
242
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_load_dll.cpp
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
// Copyright (c) 2012-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "mfx_dispatcher.h"
|
||||
#include "mfx_load_dll.h"
|
||||
|
||||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
#if defined(_WIN64)
|
||||
const
|
||||
wchar_t * const defaultDLLName[2] = {L"libmfxhw64.dll",
|
||||
L"libmfxsw64.dll"};
|
||||
const
|
||||
wchar_t * const defaultAudioDLLName[2] = {L"libmfxaudiosw64.dll",
|
||||
L"libmfxaudiosw64.dll"};
|
||||
|
||||
const
|
||||
wchar_t * const defaultPluginDLLName[2] = {L"mfxplugin64_hw.dll",
|
||||
L"mfxplugin64_sw.dll"};
|
||||
|
||||
#if defined(MEDIASDK_UWP_DISPATCHER)
|
||||
const
|
||||
wchar_t * const IntelGFXAPIDLLName = {L"intel_gfx_api-x64.dll"};
|
||||
#endif
|
||||
|
||||
#elif defined(_WIN32)
|
||||
const
|
||||
wchar_t * const defaultDLLName[2] = {L"libmfxhw32.dll",
|
||||
L"libmfxsw32.dll"};
|
||||
|
||||
const
|
||||
wchar_t * const defaultAudioDLLName[2] = {L"libmfxaudiosw32.dll",
|
||||
L"libmfxaudiosw32.dll"};
|
||||
|
||||
const
|
||||
wchar_t * const defaultPluginDLLName[2] = {L"mfxplugin32_hw.dll",
|
||||
L"mfxplugin32_sw.dll"};
|
||||
|
||||
#if defined(MEDIASDK_UWP_DISPATCHER)
|
||||
const
|
||||
wchar_t * const IntelGFXAPIDLLName = {L"intel_gfx_api-x86.dll"};
|
||||
#endif
|
||||
|
||||
#endif // (defined(_WIN64))
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
|
||||
mfxStatus mfx_get_default_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType)
|
||||
{
|
||||
if (!pPath)
|
||||
{
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
|
||||
// there are only 2 implementation with default DLL names
|
||||
#if _MSC_VER >= 1400
|
||||
return 0 == wcscpy_s(pPath, pathSize, defaultDLLName[implType & 1])
|
||||
? MFX_ERR_NONE : MFX_ERR_UNKNOWN;
|
||||
#else
|
||||
wcscpy(pPath, defaultDLLName[implType & 1]);
|
||||
return MFX_ERR_NONE;
|
||||
#endif
|
||||
} // mfxStatus mfx_get_default_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType)
|
||||
|
||||
#if defined(MEDIASDK_UWP_DISPATCHER)
|
||||
mfxStatus mfx_get_default_intel_gfx_api_dll_name(wchar_t *pPath, size_t pathSize)
|
||||
{
|
||||
if (!pPath)
|
||||
{
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
#if _MSC_VER >= 1400
|
||||
return 0 == wcscpy_s(pPath, pathSize, IntelGFXAPIDLLName)
|
||||
? MFX_ERR_NONE : MFX_ERR_UNKNOWN;
|
||||
#else
|
||||
wcscpy(pPath, IntelGFXAPIDLLName);
|
||||
return MFX_ERR_NONE;
|
||||
#endif
|
||||
} // mfx_get_default_intel_gfx_api_dll_name(wchar_t *pPath, size_t pathSize)
|
||||
#endif
|
||||
|
||||
mfxStatus mfx_get_default_plugin_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType)
|
||||
{
|
||||
if (!pPath)
|
||||
{
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
|
||||
// there are only 2 implementation with default DLL names
|
||||
#if _MSC_VER >= 1400
|
||||
return 0 == wcscpy_s(pPath, pathSize, defaultPluginDLLName[implType & 1])
|
||||
? MFX_ERR_NONE : MFX_ERR_UNKNOWN;
|
||||
#else
|
||||
wcscpy(pPath, defaultPluginDLLName[implType & 1]);
|
||||
return MFX_ERR_NONE;
|
||||
#endif
|
||||
}
|
||||
|
||||
mfxStatus mfx_get_default_audio_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType)
|
||||
{
|
||||
if (!pPath)
|
||||
{
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
|
||||
// there are only 2 implementation with default DLL names
|
||||
#if _MSC_VER >= 1400
|
||||
return 0 == wcscpy_s(pPath, pathSize, defaultAudioDLLName[implType & 1])
|
||||
? MFX_ERR_NONE : MFX_ERR_UNKNOWN;
|
||||
#else
|
||||
wcscpy(pPath, defaultAudioDLLName[implType & 1]);
|
||||
return MFX_ERR_NONE;
|
||||
#endif
|
||||
} // mfxStatus mfx_get_default_audio_dll_name(wchar_t *pPath, size_t pathSize, eMfxImplType implType)
|
||||
|
||||
// Force load library from system path to avoid DLL pre-loading attacks.
|
||||
// We try to avoid loading DLLs from the application directory because we provide a portable version.
|
||||
HMODULE load_library_system_path(const wchar_t *pFileName) {
|
||||
const wchar_t * pDllName = wcsrchr(pFileName, L'\\');
|
||||
if (pDllName == NULL) {
|
||||
pDllName = pFileName;
|
||||
} else {
|
||||
pDllName++;
|
||||
}
|
||||
return LoadLibraryExW(pDllName, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32 | LOAD_LIBRARY_SEARCH_USER_DIRS);
|
||||
}
|
||||
|
||||
mfxModuleHandle mfx_dll_load(const wchar_t *pFileName)
|
||||
{
|
||||
mfxModuleHandle hModule = (mfxModuleHandle) 0;
|
||||
|
||||
// check error(s)
|
||||
if (NULL == pFileName)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
// set the silent error mode
|
||||
DWORD prevErrorMode = 0;
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
|
||||
SetThreadErrorMode(SEM_FAILCRITICALERRORS, &prevErrorMode);
|
||||
#else
|
||||
prevErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||
#endif
|
||||
#endif // !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
// load the library's module
|
||||
#if !defined(MEDIASDK_ARM_LOADER)
|
||||
hModule = load_library_system_path(pFileName);
|
||||
#endif
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
// set the previous error mode
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
|
||||
SetThreadErrorMode(prevErrorMode, NULL);
|
||||
#else
|
||||
SetErrorMode(prevErrorMode);
|
||||
#endif
|
||||
#endif // !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
return hModule;
|
||||
|
||||
} // mfxModuleHandle mfx_dll_load(const wchar_t *pFileName)
|
||||
|
||||
mfxFunctionPointer mfx_dll_get_addr(mfxModuleHandle handle, const char *pFunctionName)
|
||||
{
|
||||
if (NULL == handle)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (mfxFunctionPointer) GetProcAddress((HMODULE) handle, pFunctionName);
|
||||
} // mfxFunctionPointer mfx_dll_get_addr(mfxModuleHandle handle, const char *pFunctionName)
|
||||
|
||||
bool mfx_dll_free(mfxModuleHandle handle)
|
||||
{
|
||||
if (NULL == handle)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL bRes = FreeLibrary((HMODULE)handle);
|
||||
|
||||
return !!bRes;
|
||||
} // bool mfx_dll_free(mfxModuleHandle handle)
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
mfxModuleHandle mfx_get_dll_handle(const wchar_t *pFileName)
|
||||
{
|
||||
mfxModuleHandle hModule = (mfxModuleHandle) 0;
|
||||
|
||||
// check error(s)
|
||||
if (NULL == pFileName)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// set the silent error mode
|
||||
DWORD prevErrorMode = 0;
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
|
||||
SetThreadErrorMode(SEM_FAILCRITICALERRORS, &prevErrorMode);
|
||||
#else
|
||||
prevErrorMode = SetErrorMode(SEM_FAILCRITICALERRORS);
|
||||
#endif
|
||||
// load the library's module
|
||||
GetModuleHandleExW(0, pFileName, (HMODULE*) &hModule);
|
||||
// set the previous error mode
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
|
||||
SetThreadErrorMode(prevErrorMode, NULL);
|
||||
#else
|
||||
SetErrorMode(prevErrorMode);
|
||||
#endif
|
||||
return hModule;
|
||||
}
|
||||
#endif //!defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
} // namespace MFX
|
||||
|
||||
454
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_load_plugin.cpp
vendored
Normal file
454
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_load_plugin.cpp
vendored
Normal file
@@ -0,0 +1,454 @@
|
||||
// Copyright (c) 2013-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "mfx_load_plugin.h"
|
||||
#include "mfx_load_dll.h"
|
||||
#include "mfx_dispatcher_log.h"
|
||||
|
||||
#define TRACE_PLUGIN_ERROR(str, ...) DISPATCHER_LOG_ERROR((("[PLUGIN]: " str), __VA_ARGS__))
|
||||
#define TRACE_PLUGIN_INFO(str, ...) DISPATCHER_LOG_INFO((("[PLUGIN]: " str), __VA_ARGS__))
|
||||
|
||||
#define CREATE_PLUGIN_FNC "CreatePlugin"
|
||||
|
||||
MFX::PluginModule::PluginModule()
|
||||
: mHmodule()
|
||||
, mCreatePluginPtr()
|
||||
, mPath()
|
||||
{
|
||||
}
|
||||
|
||||
MFX::PluginModule::PluginModule(const PluginModule & that)
|
||||
: mHmodule(mfx_dll_load(that.mPath))
|
||||
, mCreatePluginPtr(that.mCreatePluginPtr)
|
||||
{
|
||||
wcscpy_s(mPath, sizeof(mPath) / sizeof(*mPath), that.mPath);
|
||||
}
|
||||
|
||||
MFX::PluginModule & MFX::PluginModule::operator = (const MFX::PluginModule & that)
|
||||
{
|
||||
if (this != &that)
|
||||
{
|
||||
Tidy();
|
||||
mHmodule = mfx_dll_load(that.mPath);
|
||||
mCreatePluginPtr = that.mCreatePluginPtr;
|
||||
wcscpy_s(mPath, sizeof(mPath) / sizeof(*mPath), that.mPath);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
MFX::PluginModule::PluginModule(const wchar_t * path)
|
||||
: mCreatePluginPtr()
|
||||
{
|
||||
mHmodule = mfx_dll_load(path);
|
||||
if (NULL == mHmodule) {
|
||||
TRACE_PLUGIN_ERROR("Cannot load module: %S\n", path);
|
||||
return ;
|
||||
}
|
||||
TRACE_PLUGIN_INFO("Plugin loaded at: %S\n", path);
|
||||
|
||||
mCreatePluginPtr = (CreatePluginPtr_t)mfx_dll_get_addr(mHmodule, CREATE_PLUGIN_FNC);
|
||||
if (NULL == mCreatePluginPtr) {
|
||||
TRACE_PLUGIN_ERROR("Cannot get procedure address: %s\n", CREATE_PLUGIN_FNC);
|
||||
return ;
|
||||
}
|
||||
|
||||
wcscpy_s(mPath, sizeof(mPath) / sizeof(*mPath), path);
|
||||
}
|
||||
|
||||
bool MFX::PluginModule::Create( mfxPluginUID uid, mfxPlugin& plg)
|
||||
{
|
||||
bool result = false;
|
||||
if (mCreatePluginPtr)
|
||||
{
|
||||
mfxStatus mfxResult = mCreatePluginPtr(uid, &plg);
|
||||
result = (MFX_ERR_NONE == mfxResult);
|
||||
if (!result) {
|
||||
TRACE_PLUGIN_ERROR("\"%S::%s\" returned %d\n", mPath, CREATE_PLUGIN_FNC, mfxResult);
|
||||
} else {
|
||||
TRACE_PLUGIN_INFO("\"%S::%s\" SUCCEED\n", mPath, CREATE_PLUGIN_FNC);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void MFX::PluginModule::Tidy()
|
||||
{
|
||||
mfx_dll_free(mHmodule);
|
||||
mCreatePluginPtr = NULL;
|
||||
mHmodule = NULL;
|
||||
}
|
||||
|
||||
MFX::PluginModule::~PluginModule(void)
|
||||
{
|
||||
Tidy();
|
||||
}
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
bool MFX::MFXPluginFactory::RunVerification( const mfxPlugin & plg, const PluginDescriptionRecord &dsc, mfxPluginParam &pluginParams)
|
||||
{
|
||||
if (plg.PluginInit == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->PluginInit = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
if (plg.PluginClose == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->PluginClose = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
if (plg.GetPluginParam == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->GetPluginParam = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (plg.Execute == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Execute = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
if (plg.FreeResources == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->FreeResources = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
mfxStatus sts = plg.GetPluginParam(plg.pthis, &pluginParams);
|
||||
if (sts != MFX_ERR_NONE)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned %d\n", sts);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dsc.Default)
|
||||
{
|
||||
// for default plugins there is no description, dsc.APIVersion, dsc.PluginVersion and dsc.PluginUID were set by dispatcher
|
||||
// dsc.PluginVersion == requested plugin version (parameter of MFXVideoUSER_Load); dsc.APIVersion == loaded library API
|
||||
if (dsc.PluginVersion > pluginParams.PluginVersion)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned PluginVersion=%d, but it is smaller than requested : %d\n", pluginParams.PluginVersion, dsc.PluginVersion);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!dsc.onlyVersionRegistered && pluginParams.CodecId != dsc.CodecId)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned CodecId=" MFXFOURCCTYPE()", but registration has CodecId=" MFXFOURCCTYPE()"\n"
|
||||
, MFXU32TOFOURCC(pluginParams.CodecId), MFXU32TOFOURCC(dsc.CodecId));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!dsc.onlyVersionRegistered && pluginParams.Type != dsc.Type)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned Type=%d, but registration has Type=%d\n", pluginParams.Type, dsc.Type);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pluginParams.PluginUID != dsc.PluginUID)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned UID=" MFXGUIDTYPE()", but registration has UID=" MFXGUIDTYPE()"\n"
|
||||
, MFXGUIDTOHEX(&pluginParams.PluginUID), MFXGUIDTOHEX(&dsc.PluginUID));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pluginParams.PluginVersion != dsc.PluginVersion)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned PluginVersion=%d, but registration has PlgVer=%d\n", pluginParams.PluginVersion, dsc.PluginVersion);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pluginParams.APIVersion.Version != dsc.APIVersion.Version)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->GetPluginParam() returned APIVersion=%d.%d, but registration has APIVer=%d.%d\n"
|
||||
, pluginParams.APIVersion.Major, pluginParams.APIVersion.Minor
|
||||
, dsc.APIVersion.Major, dsc.APIVersion.Minor);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
switch(pluginParams.Type)
|
||||
{
|
||||
case MFX_PLUGINTYPE_VIDEO_DECODE:
|
||||
case MFX_PLUGINTYPE_VIDEO_ENCODE:
|
||||
case MFX_PLUGINTYPE_VIDEO_VPP:
|
||||
{
|
||||
TRACE_PLUGIN_INFO("plugin type= %d\n", pluginParams.Type);
|
||||
if (plg.Video == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!VerifyCodecCommon(*plg.Video))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch(pluginParams.Type)
|
||||
{
|
||||
case MFX_PLUGINTYPE_VIDEO_DECODE:
|
||||
return VerifyDecoder(*plg.Video);
|
||||
case MFX_PLUGINTYPE_AUDIO_DECODE:
|
||||
return VerifyAudioDecoder(*plg.Audio);
|
||||
case MFX_PLUGINTYPE_VIDEO_ENCODE:
|
||||
return VerifyEncoder(*plg.Video);
|
||||
case MFX_PLUGINTYPE_AUDIO_ENCODE:
|
||||
return VerifyAudioEncoder(*plg.Audio);
|
||||
case MFX_PLUGINTYPE_VIDEO_VPP:
|
||||
return VerifyVpp(*plg.Video);
|
||||
case MFX_PLUGINTYPE_VIDEO_ENC:
|
||||
return VerifyEnc(*plg.Video);
|
||||
default:
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("unsupported plugin type: %d\n", pluginParams.Type);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool MFX::MFXPluginFactory::VerifyVpp( const mfxVideoCodecPlugin &vpp )
|
||||
{
|
||||
if (vpp.VPPFrameSubmit == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->VPPFrameSubmit = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
bool MFX::MFXPluginFactory::VerifyEncoder( const mfxVideoCodecPlugin &encoder )
|
||||
{
|
||||
if (encoder.EncodeFrameSubmit == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->EncodeFrameSubmit = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MFX::MFXPluginFactory::VerifyAudioEncoder( const mfxAudioCodecPlugin &encoder )
|
||||
{
|
||||
if (encoder.EncodeFrameSubmit == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Audio->EncodeFrameSubmit = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MFX::MFXPluginFactory::VerifyEnc( const mfxVideoCodecPlugin &videoEnc )
|
||||
{
|
||||
if (videoEnc.ENCFrameSubmit == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->EncodeFrameSubmit = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MFX::MFXPluginFactory::VerifyDecoder( const mfxVideoCodecPlugin &decoder )
|
||||
{
|
||||
if (decoder.DecodeHeader == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->DecodeHeader = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
if (decoder.GetPayload == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->GetPayload = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
if (decoder.DecodeFrameSubmit == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->DecodeFrameSubmit = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MFX::MFXPluginFactory::VerifyAudioDecoder( const mfxAudioCodecPlugin &decoder )
|
||||
{
|
||||
if (decoder.DecodeHeader == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Audio->DecodeHeader = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
// if (decoder.GetPayload == 0)
|
||||
{
|
||||
// TRACE_PLUGIN_ERROR("plg->Audio->GetPayload = 0\n", 0);
|
||||
// return false;
|
||||
}
|
||||
if (decoder.DecodeFrameSubmit == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Audio->DecodeFrameSubmit = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MFX::MFXPluginFactory::VerifyCodecCommon( const mfxVideoCodecPlugin & videoCodec )
|
||||
{
|
||||
if (videoCodec.Query == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->Query = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
//todo: remove
|
||||
if (videoCodec.Query == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->Query = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
if (videoCodec.QueryIOSurf == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->QueryIOSurf = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
if (videoCodec.Init == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->Init = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
if (videoCodec.Reset == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->Reset = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
if (videoCodec.Close == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->Close = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
if (videoCodec.GetVideoParam == 0)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR("plg->Video->GetVideoParam = 0\n", 0);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
mfxStatus MFX::MFXPluginFactory::Create(const PluginDescriptionRecord & rec)
|
||||
{
|
||||
PluginModule plgModule(rec.sPath);
|
||||
mfxPlugin plg = {};
|
||||
mfxPluginParam plgParams;
|
||||
|
||||
if (!plgModule.Create(rec.PluginUID, plg))
|
||||
{
|
||||
return MFX_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
if (!RunVerification(plg, rec, plgParams))
|
||||
{
|
||||
//will do not call plugin close since it is not safe to do that until structure is corrected
|
||||
return MFX_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
if (rec.Type == MFX_PLUGINTYPE_AUDIO_DECODE ||
|
||||
rec.Type == MFX_PLUGINTYPE_AUDIO_ENCODE)
|
||||
{
|
||||
mfxStatus sts = MFXAudioUSER_Register(mSession, plgParams.Type, &plg);
|
||||
if (MFX_ERR_NONE != sts)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR(" MFXAudioUSER_Register returned %d\n", sts);
|
||||
return sts;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mfxStatus sts = MFXVideoUSER_Register(mSession, plgParams.Type, &plg);
|
||||
if (MFX_ERR_NONE != sts)
|
||||
{
|
||||
TRACE_PLUGIN_ERROR(" MFXVideoUSER_Register returned %d\n", sts);
|
||||
return sts;
|
||||
}
|
||||
}
|
||||
|
||||
mPlugins.push_back(FactoryRecord(plgParams, plgModule, plg));
|
||||
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
MFX::MFXPluginFactory::~MFXPluginFactory()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
MFX::MFXPluginFactory::MFXPluginFactory( mfxSession session ) :
|
||||
mPlugins()
|
||||
{
|
||||
mSession = session;
|
||||
nPlugins = 0;
|
||||
}
|
||||
|
||||
bool MFX::MFXPluginFactory::Destroy( const mfxPluginUID & uidToDestroy)
|
||||
{
|
||||
for (MFXVector<FactoryRecord >::iterator i = mPlugins.begin(); i!= mPlugins.end(); i++)
|
||||
{
|
||||
if (i->plgParams.PluginUID == uidToDestroy)
|
||||
{
|
||||
DestroyPlugin(*i);
|
||||
//dll unload should happen here
|
||||
//todo: check that dll_free fail is traced
|
||||
mPlugins.erase(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MFX::MFXPluginFactory::Close()
|
||||
{
|
||||
for (MFXVector<FactoryRecord>::iterator i = mPlugins.begin(); i!= mPlugins.end(); i++)
|
||||
{
|
||||
DestroyPlugin(*i);
|
||||
}
|
||||
mPlugins.clear();
|
||||
}
|
||||
|
||||
void MFX::MFXPluginFactory::DestroyPlugin( FactoryRecord & record)
|
||||
{
|
||||
mfxStatus sts;
|
||||
if (record.plgParams.Type == MFX_PLUGINTYPE_AUDIO_DECODE ||
|
||||
record.plgParams.Type == MFX_PLUGINTYPE_AUDIO_ENCODE)
|
||||
{
|
||||
sts = MFXAudioUSER_Unregister(mSession, record.plgParams.Type);
|
||||
TRACE_PLUGIN_INFO(" MFXAudioUSER_Unregister for Type=%d, returned %d\n", record.plgParams.Type, sts);
|
||||
}
|
||||
else
|
||||
{
|
||||
sts = MFXVideoUSER_Unregister(mSession, record.plgParams.Type);
|
||||
TRACE_PLUGIN_INFO(" MFXVideoUSER_Unregister for Type=%d, returned %d\n", record.plgParams.Type, sts);
|
||||
}
|
||||
}
|
||||
|
||||
#endif //!defined(MEDIASDK_UWP_DISPATCHER)
|
||||
491
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_plugin_hive.cpp
vendored
Normal file
491
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_plugin_hive.cpp
vendored
Normal file
@@ -0,0 +1,491 @@
|
||||
// Copyright (c) 2013-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "mfx_plugin_hive.h"
|
||||
#include "mfx_library_iterator.h"
|
||||
#include "mfx_dispatcher.h"
|
||||
#include "mfx_dispatcher_log.h"
|
||||
#include "mfx_load_dll.h"
|
||||
|
||||
#define TRACE_HIVE_ERROR(str, ...) DISPATCHER_LOG_ERROR((("[HIVE]: " str), __VA_ARGS__))
|
||||
#define TRACE_HIVE_INFO(str, ...) DISPATCHER_LOG_INFO((("[HIVE]: " str), __VA_ARGS__))
|
||||
#define TRACE_HIVE_WRN(str, ...) DISPATCHER_LOG_WRN((("[HIVE]: " str), __VA_ARGS__))
|
||||
|
||||
namespace
|
||||
{
|
||||
const wchar_t rootPluginPath[] = L"Software\\Intel\\MediaSDK\\Plugin";
|
||||
const wchar_t rootDispatchPath[] = L"Software\\Intel\\MediaSDK\\Dispatch";
|
||||
const wchar_t pluginSubkey[] = L"Plugin";
|
||||
const wchar_t TypeKeyName[] = L"Type";
|
||||
const wchar_t CodecIDKeyName[] = L"CodecID";
|
||||
const wchar_t GUIDKeyName[] = L"GUID";
|
||||
const wchar_t PathKeyName[] = L"Path";
|
||||
const wchar_t DefaultKeyName[] = L"Default";
|
||||
const wchar_t PlgVerKeyName[] = L"PluginVersion";
|
||||
const wchar_t APIVerKeyName[] = L"APIVersion";
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
#ifdef _WIN64
|
||||
const wchar_t pluginFileName[] = L"FileName64";
|
||||
#else
|
||||
const wchar_t pluginFileName[] = L"FileName32";
|
||||
#endif // _WIN64
|
||||
|
||||
//do not allow store plugin in different hierarchy
|
||||
const wchar_t pluginFileNameRestrictedCharacters[] = L"\\/";
|
||||
const wchar_t pluginCfgFileName[] = L"plugin.cfg";
|
||||
const wchar_t pluginSearchPattern[] = L"????????????????????????????????";
|
||||
const mfxU32 pluginCfgFileNameLen = 10;
|
||||
const mfxU32 pluginDirNameLen = 32;
|
||||
const mfxU32 defaultPluginNameLen = 25;
|
||||
const mfxU32 charsPermfxU8 = 2;
|
||||
const mfxU32 slashLen = 1;
|
||||
enum
|
||||
{
|
||||
MAX_PLUGIN_FILE_LINE = 4096
|
||||
};
|
||||
|
||||
#define alignStr() "%-14S"
|
||||
}
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
MFX::MFXPluginsInHive::MFXPluginsInHive(int mfxStorageID, const wchar_t *msdkLibSubKey, mfxVersion currentAPIVersion)
|
||||
: MFXPluginStorageBase(currentAPIVersion)
|
||||
{
|
||||
HKEY rootHKey;
|
||||
bool bRes;
|
||||
WinRegKey regKey;
|
||||
|
||||
if (MFX_LOCAL_MACHINE_KEY != mfxStorageID && MFX_CURRENT_USER_KEY != mfxStorageID)
|
||||
return;
|
||||
|
||||
// open required registry key
|
||||
rootHKey = (MFX_LOCAL_MACHINE_KEY == mfxStorageID) ? (HKEY_LOCAL_MACHINE) : (HKEY_CURRENT_USER);
|
||||
if (msdkLibSubKey) {
|
||||
//dispatch/subkey/plugin
|
||||
bRes = regKey.Open(rootHKey, rootDispatchPath, KEY_READ);
|
||||
if (bRes)
|
||||
{
|
||||
bRes = regKey.Open(regKey, msdkLibSubKey, KEY_READ);
|
||||
}
|
||||
if (bRes)
|
||||
{
|
||||
bRes = regKey.Open(regKey, pluginSubkey, KEY_READ);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bRes = regKey.Open(rootHKey, rootPluginPath, KEY_READ);
|
||||
}
|
||||
|
||||
if (false == bRes) {
|
||||
return;
|
||||
}
|
||||
DWORD index = 0;
|
||||
if (!regKey.QueryInfo(&index)) {
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
resize(index);
|
||||
}
|
||||
catch (...) {
|
||||
TRACE_HIVE_ERROR("new PluginDescriptionRecord[%d] threw an exception: \n", index);
|
||||
return;
|
||||
}
|
||||
|
||||
for(index = 0; ; index++)
|
||||
{
|
||||
wchar_t subKeyName[MFX_MAX_REGISTRY_KEY_NAME];
|
||||
DWORD subKeyNameSize = sizeof(subKeyName) / sizeof(subKeyName[0]);
|
||||
WinRegKey subKey;
|
||||
|
||||
// query next value name
|
||||
bool enumRes = regKey.EnumKey(index, subKeyName, &subKeyNameSize);
|
||||
if (!enumRes) {
|
||||
break;
|
||||
}
|
||||
|
||||
// open the sub key
|
||||
bRes = subKey.Open(regKey, subKeyName, KEY_READ);
|
||||
if (!bRes) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (msdkLibSubKey)
|
||||
{
|
||||
TRACE_HIVE_INFO("Found Plugin: %s\\%S\\%S\\%S\\%S\n", (MFX_LOCAL_MACHINE_KEY == mfxStorageID) ? ("HKEY_LOCAL_MACHINE") : ("HKEY_CURRENT_USER"),
|
||||
rootDispatchPath, msdkLibSubKey, pluginSubkey, subKeyName);
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_HIVE_INFO("Found Plugin: %s\\%S\\%S\n", (MFX_LOCAL_MACHINE_KEY == mfxStorageID) ? ("HKEY_LOCAL_MACHINE") : ("HKEY_CURRENT_USER"),
|
||||
rootPluginPath, subKeyName);
|
||||
}
|
||||
|
||||
PluginDescriptionRecord descriptionRecord;
|
||||
|
||||
if (!QueryKey(subKey, TypeKeyName, descriptionRecord.Type))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
TRACE_HIVE_INFO(alignStr()" : %d\n", TypeKeyName, descriptionRecord.Type);
|
||||
|
||||
if (QueryKey(subKey, CodecIDKeyName, descriptionRecord.CodecId))
|
||||
{
|
||||
TRACE_HIVE_INFO(alignStr()" : " MFXFOURCCTYPE()" \n", CodecIDKeyName, MFXU32TOFOURCC(descriptionRecord.CodecId));
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_HIVE_INFO(alignStr()" : \n", CodecIDKeyName, "NOT REGISTERED");
|
||||
}
|
||||
|
||||
if (!QueryKey(subKey, GUIDKeyName, descriptionRecord.PluginUID))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
TRACE_HIVE_INFO(alignStr()" : " MFXGUIDTYPE()"\n", GUIDKeyName, MFXGUIDTOHEX(&descriptionRecord.PluginUID));
|
||||
|
||||
mfxU32 nSize = sizeof(descriptionRecord.sPath)/sizeof(*descriptionRecord.sPath);
|
||||
if (!subKey.Query(PathKeyName, descriptionRecord.sPath, nSize))
|
||||
{
|
||||
TRACE_HIVE_WRN("no value for : %S\n", PathKeyName);
|
||||
continue;
|
||||
}
|
||||
TRACE_HIVE_INFO(alignStr()" : %S\n", PathKeyName, descriptionRecord.sPath);
|
||||
|
||||
if (!QueryKey(subKey, DefaultKeyName, descriptionRecord.Default))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
TRACE_HIVE_INFO(alignStr()" : %s\n", DefaultKeyName, descriptionRecord.Default ? "true" : "false");
|
||||
|
||||
mfxU32 version = 0;
|
||||
if (!QueryKey(subKey, PlgVerKeyName, version))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
descriptionRecord.PluginVersion = static_cast<mfxU16>(version);
|
||||
if (0 == version)
|
||||
{
|
||||
TRACE_HIVE_ERROR(alignStr()" : %d, which is invalid\n", PlgVerKeyName, descriptionRecord.PluginVersion);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_HIVE_INFO(alignStr()" : %d\n", PlgVerKeyName, descriptionRecord.PluginVersion);
|
||||
}
|
||||
|
||||
mfxU32 APIVersion = 0;
|
||||
if (!QueryKey(subKey, APIVerKeyName, APIVersion))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
ConvertAPIVersion(APIVersion, descriptionRecord);
|
||||
TRACE_HIVE_INFO(alignStr()" : %d.%d \n", APIVerKeyName, descriptionRecord.APIVersion.Major, descriptionRecord.APIVersion.Minor);
|
||||
|
||||
try
|
||||
{
|
||||
operator[](index) = descriptionRecord;
|
||||
}
|
||||
catch (...) {
|
||||
TRACE_HIVE_ERROR("operator[](%d) = descriptionRecord; - threw exception \n", index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MFX::MFXPluginsInFS::MFXPluginsInFS( mfxVersion currentAPIVersion )
|
||||
: MFXPluginStorageBase(currentAPIVersion)
|
||||
, mIsVersionParsed()
|
||||
, mIsAPIVersionParsed()
|
||||
{
|
||||
WIN32_FIND_DATAW find_data;
|
||||
wchar_t currentModuleName[MAX_PLUGIN_PATH];
|
||||
|
||||
GetModuleFileNameW(NULL, currentModuleName, MAX_PLUGIN_PATH);
|
||||
if (GetLastError() != 0)
|
||||
{
|
||||
TRACE_HIVE_ERROR("GetModuleFileName() reported an error: %d\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
wchar_t *lastSlashPos = wcsrchr(currentModuleName, L'\\');
|
||||
if (!lastSlashPos) {
|
||||
lastSlashPos = currentModuleName;
|
||||
}
|
||||
mfxU32 executableDirLen = (mfxU32)(lastSlashPos - currentModuleName) + slashLen;
|
||||
if (executableDirLen + pluginDirNameLen + pluginCfgFileNameLen >= MAX_PLUGIN_PATH)
|
||||
{
|
||||
TRACE_HIVE_ERROR("MAX_PLUGIN_PATH which is %d, not enough to locate plugin path\n", MAX_PLUGIN_PATH);
|
||||
return;
|
||||
}
|
||||
wcscpy_s(lastSlashPos + slashLen
|
||||
, MAX_PLUGIN_PATH - executableDirLen, pluginSearchPattern);
|
||||
|
||||
HANDLE fileFirst = FindFirstFileW(currentModuleName, &find_data);
|
||||
if (INVALID_HANDLE_VALUE == fileFirst)
|
||||
{
|
||||
TRACE_HIVE_ERROR("FindFirstFileW() unable to locate any plugins folders\n", 0);
|
||||
return;
|
||||
}
|
||||
do
|
||||
{
|
||||
if (!(find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (pluginDirNameLen != wcslen(find_data.cFileName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//converting dirname into guid
|
||||
PluginDescriptionRecord descriptionRecord;
|
||||
descriptionRecord.APIVersion = currentAPIVersion;
|
||||
descriptionRecord.onlyVersionRegistered = true;
|
||||
|
||||
mfxU32 i = 0;
|
||||
for(i = 0; i != pluginDirNameLen / charsPermfxU8; i++)
|
||||
{
|
||||
mfxU32 hexNum = 0;
|
||||
if (1 != swscanf_s(find_data.cFileName + charsPermfxU8 * i, L"%2x", &hexNum))
|
||||
{
|
||||
// it is ok to have non-plugin subdirs with length 32
|
||||
//TRACE_HIVE_INFO("folder name \"%S\" is not a valid GUID string\n", find_data.cFileName);
|
||||
break;
|
||||
}
|
||||
if (hexNum == 0 && find_data.cFileName + charsPermfxU8 * i != wcsstr(find_data.cFileName + 2*i, L"00"))
|
||||
{
|
||||
// it is ok to have non-plugin subdirs with length 32
|
||||
//TRACE_HIVE_INFO("folder name \"%S\" is not a valid GUID string\n", find_data.cFileName);
|
||||
break;
|
||||
}
|
||||
descriptionRecord.PluginUID.Data[i] = (mfxU8)hexNum;
|
||||
}
|
||||
if (i != pluginDirNameLen / charsPermfxU8) {
|
||||
continue;
|
||||
}
|
||||
|
||||
wcscpy_s(currentModuleName + executableDirLen
|
||||
, MAX_PLUGIN_PATH - executableDirLen, find_data.cFileName);
|
||||
|
||||
wcscpy_s(currentModuleName + executableDirLen + pluginDirNameLen
|
||||
, MAX_PLUGIN_PATH - executableDirLen - pluginDirNameLen, L"\\");
|
||||
|
||||
//this is path to plugin directory
|
||||
wcscpy_s(descriptionRecord.sPath
|
||||
, sizeof(descriptionRecord.sPath) / sizeof(*descriptionRecord.sPath), currentModuleName);
|
||||
|
||||
wcscpy_s(currentModuleName + executableDirLen + pluginDirNameLen + slashLen
|
||||
, MAX_PLUGIN_PATH - executableDirLen - pluginDirNameLen - slashLen, pluginCfgFileName);
|
||||
|
||||
FILE *pluginCfgFile = 0;
|
||||
_wfopen_s(&pluginCfgFile, currentModuleName, L"r");
|
||||
if (!pluginCfgFile)
|
||||
{
|
||||
TRACE_HIVE_INFO("in directory \"%S\" no mandatory \"%S\"\n"
|
||||
, find_data.cFileName, pluginCfgFileName);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ParseFile(pluginCfgFile, descriptionRecord))
|
||||
{
|
||||
try
|
||||
{
|
||||
push_back(descriptionRecord);
|
||||
}
|
||||
catch (...) {
|
||||
TRACE_HIVE_ERROR("mRecords.push_back(descriptionRecord); - threw exception \n", 0);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(pluginCfgFile);
|
||||
}while (FindNextFileW(fileFirst, &find_data));
|
||||
FindClose(fileFirst);
|
||||
}
|
||||
|
||||
bool MFX::MFXPluginsInFS::ParseFile(FILE * f, PluginDescriptionRecord & descriptionRecord)
|
||||
{
|
||||
wchar_t line[MAX_PLUGIN_FILE_LINE];
|
||||
|
||||
while(NULL != fgetws(line, sizeof(line) / sizeof(*line), f))
|
||||
{
|
||||
wchar_t *delimiter = wcschr(line, L'=');
|
||||
if (0 == delimiter)
|
||||
{
|
||||
TRACE_HIVE_INFO("plugin.cfg contains line \"%S\" which is not in K=V format, skipping \n", line);
|
||||
continue;
|
||||
}
|
||||
*delimiter = 0;
|
||||
if (!ParseKVPair(line, delimiter + 1, descriptionRecord))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mIsVersionParsed)
|
||||
{
|
||||
TRACE_HIVE_ERROR("%S : Mandatory key %S not found\n", pluginCfgFileName, PlgVerKeyName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mIsAPIVersionParsed)
|
||||
{
|
||||
TRACE_HIVE_ERROR("%S : Mandatory key %S not found\n", pluginCfgFileName, APIVerKeyName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!wcslen(descriptionRecord.sPath))
|
||||
{
|
||||
TRACE_HIVE_ERROR("%S : Mandatory key %S not found\n", pluginCfgFileName, pluginFileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MFX::MFXPluginsInFS::ParseKVPair( wchar_t * key, wchar_t* value, PluginDescriptionRecord & descriptionRecord)
|
||||
{
|
||||
if (0 != wcsstr(key, PlgVerKeyName))
|
||||
{
|
||||
mfxU32 version ;
|
||||
if (0 == swscanf_s(value, L"%d", &version))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
descriptionRecord.PluginVersion = (mfxU16)version;
|
||||
|
||||
if (0 == descriptionRecord.PluginVersion)
|
||||
{
|
||||
TRACE_HIVE_ERROR("%S: %S = %d, which is invalid\n", pluginCfgFileName, PlgVerKeyName, descriptionRecord.PluginVersion);
|
||||
return false;
|
||||
}
|
||||
|
||||
TRACE_HIVE_INFO("%S: %S = %d \n", pluginCfgFileName, PlgVerKeyName, descriptionRecord.PluginVersion);
|
||||
mIsVersionParsed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (0 != wcsstr(key, APIVerKeyName))
|
||||
{
|
||||
mfxU32 APIversion;
|
||||
if (0 == swscanf_s(value, L"%d", &APIversion))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ConvertAPIVersion(APIversion, descriptionRecord);
|
||||
TRACE_HIVE_INFO("%S: %S = %d.%d \n", pluginCfgFileName, APIVerKeyName, descriptionRecord.APIVersion.Major, descriptionRecord.APIVersion.Minor);
|
||||
|
||||
mIsAPIVersionParsed = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (0!=wcsstr(key, pluginFileName))
|
||||
{
|
||||
wchar_t *startQuoteMark = wcschr(value, L'\"');
|
||||
if (!startQuoteMark)
|
||||
{
|
||||
TRACE_HIVE_ERROR("plugin filename not in quotes : %S\n", value);
|
||||
return false;
|
||||
}
|
||||
wchar_t *endQuoteMark = wcschr(startQuoteMark + 1, L'\"');
|
||||
|
||||
if (!endQuoteMark)
|
||||
{
|
||||
TRACE_HIVE_ERROR("plugin filename not in quotes : %S\n", value);
|
||||
return false;
|
||||
}
|
||||
*endQuoteMark = 0;
|
||||
|
||||
mfxU32 currentPathLen = (mfxU32)wcslen(descriptionRecord.sPath);
|
||||
if (currentPathLen + wcslen(startQuoteMark + 1) > sizeof(descriptionRecord.sPath) / sizeof(*descriptionRecord.sPath))
|
||||
{
|
||||
TRACE_HIVE_ERROR("buffer of MAX_PLUGIN_PATH characters which is %d, not enough lo store plugin path: %S%S\n"
|
||||
, MAX_PLUGIN_PATH, descriptionRecord.sPath, startQuoteMark + 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t restrictedCharIdx = wcscspn(startQuoteMark + 1, pluginFileNameRestrictedCharacters);
|
||||
if (restrictedCharIdx != wcslen(startQuoteMark + 1))
|
||||
{
|
||||
TRACE_HIVE_ERROR("plugin filename :%S, contains one of restricted characters: %S\n", startQuoteMark + 1, pluginFileNameRestrictedCharacters);
|
||||
return false;
|
||||
}
|
||||
|
||||
wcscpy_s(descriptionRecord.sPath + currentPathLen
|
||||
, sizeof(descriptionRecord.sPath) / sizeof(*descriptionRecord.sPath) - currentPathLen, startQuoteMark + 1);
|
||||
|
||||
TRACE_HIVE_INFO("%S: %S = \"%S\" \n", pluginCfgFileName, pluginFileName, startQuoteMark + 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif //#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
|
||||
MFX::MFXDefaultPlugins::MFXDefaultPlugins(mfxVersion currentAPIVersion, MFX_DISP_HANDLE * hdl, int implType)
|
||||
: MFXPluginStorageBase(currentAPIVersion)
|
||||
{
|
||||
wchar_t libModuleName[MAX_PLUGIN_PATH];
|
||||
|
||||
GetModuleFileNameW((HMODULE)hdl->hModule, libModuleName, MAX_PLUGIN_PATH);
|
||||
if (GetLastError() != 0)
|
||||
{
|
||||
TRACE_HIVE_ERROR("GetModuleFileName() reported an error: %d\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
wchar_t *lastSlashPos = wcsrchr(libModuleName, L'\\');
|
||||
if (!lastSlashPos) {
|
||||
lastSlashPos = libModuleName;
|
||||
}
|
||||
mfxU32 executableDirLen = (mfxU32)(lastSlashPos - libModuleName) + slashLen;
|
||||
if (executableDirLen + defaultPluginNameLen >= MAX_PLUGIN_PATH)
|
||||
{
|
||||
TRACE_HIVE_ERROR("MAX_PLUGIN_PATH which is %d, not enough to locate default plugin path\n", MAX_PLUGIN_PATH);
|
||||
return;
|
||||
}
|
||||
|
||||
mfx_get_default_plugin_name(lastSlashPos + slashLen, MAX_PLUGIN_PATH - executableDirLen, (eMfxImplType)implType);
|
||||
|
||||
if (-1 != GetFileAttributesW(libModuleName))
|
||||
{
|
||||
// add single default plugin description
|
||||
PluginDescriptionRecord descriptionRecord;
|
||||
descriptionRecord.APIVersion = currentAPIVersion;
|
||||
descriptionRecord.Default = true;
|
||||
|
||||
wcscpy_s(descriptionRecord.sPath
|
||||
, sizeof(descriptionRecord.sPath) / sizeof(*descriptionRecord.sPath), libModuleName);
|
||||
|
||||
push_back(descriptionRecord);
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE_HIVE_INFO("GetFileAttributesW() unable to locate default plugin dll named %S\n", libModuleName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
217
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_win_reg_key.cpp
vendored
Normal file
217
libs/hwcodec/externals/MediaSDK_22.5.4/api/mfx_dispatch/windows/src/mfx_win_reg_key.cpp
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
// Copyright (c) 2012-2019 Intel Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
#include "mfx_win_reg_key.h"
|
||||
#include "mfx_dispatcher_log.h"
|
||||
|
||||
#define TRACE_WINREG_ERROR(str, ...) DISPATCHER_LOG_ERROR((("[WINREG]: " str), __VA_ARGS__))
|
||||
|
||||
namespace MFX
|
||||
{
|
||||
|
||||
WinRegKey::WinRegKey(void)
|
||||
{
|
||||
m_hKey = (HKEY) 0;
|
||||
|
||||
} // WinRegKey::WinRegKey(void)
|
||||
|
||||
WinRegKey::~WinRegKey(void)
|
||||
{
|
||||
Release();
|
||||
|
||||
} // WinRegKey::~WinRegKey(void)
|
||||
|
||||
void WinRegKey::Release(void)
|
||||
{
|
||||
// close the opened key
|
||||
if (m_hKey)
|
||||
{
|
||||
RegCloseKey(m_hKey);
|
||||
}
|
||||
|
||||
m_hKey = (HKEY) 0;
|
||||
|
||||
} // void WinRegKey::Release(void)
|
||||
|
||||
bool WinRegKey::Open(HKEY hRootKey, const wchar_t *pSubKey, REGSAM samDesired)
|
||||
{
|
||||
LONG lRes;
|
||||
HKEY hTemp;
|
||||
|
||||
//
|
||||
// All operation are performed in this order by intention.
|
||||
// It makes possible to reopen the keys, using itself as a base.
|
||||
//
|
||||
|
||||
// try to the open registry key
|
||||
lRes = RegOpenKeyExW(hRootKey, pSubKey, 0, samDesired, &hTemp);
|
||||
if (ERROR_SUCCESS != lRes)
|
||||
{
|
||||
DISPATCHER_LOG_OPERATION(SetLastError(lRes));
|
||||
TRACE_WINREG_ERROR("Opening key \"%s\\%S\" : RegOpenKeyExW()==0x%x\n"
|
||||
, (HKEY_LOCAL_MACHINE == hRootKey) ? ("HKEY_LOCAL_MACHINE")
|
||||
: (HKEY_CURRENT_USER == hRootKey) ? ("HKEY_CURRENT_USER")
|
||||
: "UNSUPPORTED_KEY", pSubKey, GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
// release the object before initialization
|
||||
Release();
|
||||
|
||||
// save the handle
|
||||
m_hKey = hTemp;
|
||||
|
||||
return true;
|
||||
|
||||
} // bool WinRegKey::Open(HKEY hRootKey, const wchar_t *pSubKey, REGSAM samDesired)
|
||||
|
||||
bool WinRegKey::Open(WinRegKey &rootKey, const wchar_t *pSubKey, REGSAM samDesired)
|
||||
{
|
||||
return Open(rootKey.m_hKey, pSubKey, samDesired);
|
||||
|
||||
} // bool WinRegKey::Open(WinRegKey &rootKey, const wchar_t *pSubKey, REGSAM samDesired)
|
||||
|
||||
bool WinRegKey::QueryValueSize(const wchar_t *pValueName, DWORD type, LPDWORD pcbData) {
|
||||
DWORD keyType = type;
|
||||
LONG lRes;
|
||||
|
||||
// query the value
|
||||
lRes = RegQueryValueExW(m_hKey, pValueName, NULL, &keyType, 0, pcbData);
|
||||
if (ERROR_SUCCESS != lRes)
|
||||
{
|
||||
DISPATCHER_LOG_OPERATION(SetLastError(lRes));
|
||||
TRACE_WINREG_ERROR("Querying \"%S\" : RegQueryValueExA()==0x%x\n", pValueName, GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WinRegKey::Query(const wchar_t *pValueName, DWORD type, LPBYTE pData, LPDWORD pcbData)
|
||||
{
|
||||
DWORD keyType = type;
|
||||
LONG lRes;
|
||||
DWORD dstSize = (pcbData) ? (*pcbData) : (0);
|
||||
|
||||
// query the value
|
||||
lRes = RegQueryValueExW(m_hKey, pValueName, NULL, &keyType, pData, pcbData);
|
||||
if (ERROR_SUCCESS != lRes)
|
||||
{
|
||||
DISPATCHER_LOG_OPERATION(SetLastError(lRes));
|
||||
TRACE_WINREG_ERROR("Querying \"%S\" : RegQueryValueExA()==0x%x\n", pValueName, GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
// check the type
|
||||
if (keyType != type)
|
||||
{
|
||||
TRACE_WINREG_ERROR("Querying \"%S\" : expectedType=%d, returned=%d\n", pValueName, type, keyType);
|
||||
return false;
|
||||
}
|
||||
|
||||
// terminate the string only if pointers not NULL
|
||||
if ((REG_SZ == type || REG_EXPAND_SZ == type) && NULL != pData && NULL != pcbData)
|
||||
{
|
||||
wchar_t *pString = (wchar_t *) pData;
|
||||
size_t NullEndingSizeBytes = sizeof(wchar_t); // size of string termination null character
|
||||
if (dstSize < NullEndingSizeBytes)
|
||||
{
|
||||
TRACE_WINREG_ERROR("Querying \"%S\" : buffer is too small for null-terminated string", pValueName);
|
||||
return false;
|
||||
}
|
||||
size_t maxStringLengthBytes = dstSize - NullEndingSizeBytes;
|
||||
size_t maxStringIndex = dstSize / sizeof(wchar_t) - 1;
|
||||
|
||||
size_t lastIndex = (maxStringLengthBytes < *pcbData) ? (maxStringIndex) : (*pcbData) / sizeof(wchar_t);
|
||||
|
||||
pString[lastIndex] = (wchar_t) 0;
|
||||
}
|
||||
else if(REG_MULTI_SZ == type && NULL != pData && NULL != pcbData)
|
||||
{
|
||||
wchar_t *pString = (wchar_t *) pData;
|
||||
size_t NullEndingSizeBytes = sizeof(wchar_t)*2; // size of string termination null characters
|
||||
if (dstSize < NullEndingSizeBytes)
|
||||
{
|
||||
TRACE_WINREG_ERROR("Querying \"%S\" : buffer is too small for multi-line null-terminated string", pValueName);
|
||||
return false;
|
||||
}
|
||||
size_t maxStringLengthBytes = dstSize - NullEndingSizeBytes;
|
||||
size_t maxStringIndex = dstSize / sizeof(wchar_t) - 1;
|
||||
|
||||
size_t lastIndex = (maxStringLengthBytes < *pcbData) ? (maxStringIndex) : (*pcbData) / sizeof(wchar_t) + 1;
|
||||
|
||||
// last 2 bytes should be 0 in case of REG_MULTI_SZ
|
||||
pString[lastIndex] = pString[lastIndex - 1] = (wchar_t) 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // bool WinRegKey::Query(const wchar_t *pValueName, DWORD type, LPBYTE pData, LPDWORD pcbData)
|
||||
|
||||
bool WinRegKey::EnumValue(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName, LPDWORD pType)
|
||||
{
|
||||
LONG lRes;
|
||||
|
||||
// enum the values
|
||||
lRes = RegEnumValueW(m_hKey, index, pValueName, pcchValueName, 0, pType, NULL, NULL);
|
||||
if (ERROR_SUCCESS != lRes)
|
||||
{
|
||||
DISPATCHER_LOG_OPERATION(SetLastError(lRes));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // bool WinRegKey::EnumValue(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName, LPDWORD pType)
|
||||
|
||||
bool WinRegKey::EnumKey(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName)
|
||||
{
|
||||
LONG lRes;
|
||||
|
||||
// enum the keys
|
||||
lRes = RegEnumKeyExW(m_hKey, index, pValueName, pcchValueName, NULL, NULL, NULL, NULL);
|
||||
if (ERROR_SUCCESS != lRes)
|
||||
{
|
||||
DISPATCHER_LOG_OPERATION(SetLastError(lRes));
|
||||
TRACE_WINREG_ERROR("EnumKey with index=%d: RegEnumKeyExW()==0x%x\n", index, GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
} // bool WinRegKey::EnumKey(DWORD index, wchar_t *pValueName, LPDWORD pcchValueName)
|
||||
|
||||
bool WinRegKey::QueryInfo(LPDWORD lpcSubkeys)
|
||||
{
|
||||
LONG lRes;
|
||||
|
||||
lRes = RegQueryInfoKeyW(m_hKey, NULL, 0, 0, lpcSubkeys, 0, 0, 0, 0, 0, 0, 0);
|
||||
if (ERROR_SUCCESS != lRes) {
|
||||
TRACE_WINREG_ERROR("RegQueryInfoKeyW()==0x%x\n", lRes);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
} //bool QueryInfo(LPDWORD lpcSubkeys);
|
||||
|
||||
} // namespace MFX
|
||||
|
||||
#endif // #if !defined(MEDIASDK_UWP_DISPATCHER)
|
||||
72
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/abstract_splitter.h
vendored
Normal file
72
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/abstract_splitter.h
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#ifndef _ABSTRACT_SPL_H__
|
||||
#define _ABSTRACT_SPL_H__
|
||||
|
||||
#include "mfxstructures.h"
|
||||
#include "vm/strings_defs.h"
|
||||
|
||||
enum SliceTypeCode {
|
||||
TYPE_I = 0,
|
||||
TYPE_P = 1,
|
||||
TYPE_B = 2,
|
||||
TYPE_SKIP=3,
|
||||
TYPE_UNKNOWN=4
|
||||
};
|
||||
|
||||
struct SliceSplitterInfo
|
||||
{
|
||||
mfxU32 DataOffset;
|
||||
mfxU32 DataLength;
|
||||
mfxU32 HeaderLength;
|
||||
SliceTypeCode SliceType;
|
||||
};
|
||||
|
||||
struct FrameSplitterInfo
|
||||
{
|
||||
SliceSplitterInfo * Slice; // array
|
||||
mfxU32 SliceNum;
|
||||
mfxU32 FirstFieldSliceNum;
|
||||
|
||||
mfxU8 * Data; // including data of slices
|
||||
mfxU32 DataLength;
|
||||
mfxU64 TimeStamp;
|
||||
};
|
||||
|
||||
class AbstractSplitter
|
||||
{
|
||||
public:
|
||||
|
||||
AbstractSplitter()
|
||||
{}
|
||||
|
||||
virtual ~AbstractSplitter()
|
||||
{}
|
||||
|
||||
virtual mfxStatus Reset() = 0;
|
||||
|
||||
virtual mfxStatus GetFrame(mfxBitstream * bs_in, FrameSplitterInfo ** frame) = 0;
|
||||
|
||||
virtual mfxStatus PostProcessing(FrameSplitterInfo *frame, mfxU32 sliceNum) = 0;
|
||||
|
||||
virtual void ResetCurrentState() = 0;
|
||||
};
|
||||
|
||||
#endif // _ABSTRACT_SPL_H__
|
||||
232
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/avc_bitstream.h
vendored
Normal file
232
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/avc_bitstream.h
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
#ifndef __AVC_BITSTREAM_H_
|
||||
#define __AVC_BITSTREAM_H_
|
||||
|
||||
#include "mfxstructures.h"
|
||||
#include "avc_structures.h"
|
||||
#include "avc_headers.h"
|
||||
|
||||
namespace ProtectedLibrary
|
||||
{
|
||||
|
||||
#define AVCPeek1Bit(current_data, offset) \
|
||||
((current_data[0] >> (offset)) & 1)
|
||||
|
||||
#define AVCDrop1Bit(current_data, offset) \
|
||||
{ \
|
||||
offset -= 1; \
|
||||
if (offset < 0) \
|
||||
{ \
|
||||
offset = 31; \
|
||||
current_data += 1; \
|
||||
} \
|
||||
}
|
||||
|
||||
// NAL unit definitions
|
||||
enum
|
||||
{
|
||||
NAL_STORAGE_IDC_BITS = 0x60,
|
||||
NAL_UNITTYPE_BITS = 0x1f
|
||||
};
|
||||
|
||||
class AVCBaseBitstream
|
||||
{
|
||||
public:
|
||||
|
||||
AVCBaseBitstream();
|
||||
AVCBaseBitstream(mfxU8 * const pb, const mfxU32 maxsize);
|
||||
virtual ~AVCBaseBitstream();
|
||||
|
||||
// Reset the bitstream with new data pointer
|
||||
void Reset(mfxU8 * const pb, mfxU32 maxsize);
|
||||
void Reset(mfxU8 * const pb, mfxI32 offset, mfxU32 maxsize);
|
||||
|
||||
inline mfxU32 GetBits(mfxU32 nbits);
|
||||
|
||||
// Read one VLC mfxI32 or mfxU32 value from bitstream
|
||||
mfxI32 GetVLCElement(bool bIsSigned);
|
||||
|
||||
// Reads one bit from the buffer.
|
||||
inline mfxU32 Get1Bit();
|
||||
|
||||
// Check amount of data
|
||||
bool More_RBSP_Data();
|
||||
|
||||
inline mfxU32 BytesDecoded();
|
||||
|
||||
inline mfxU32 BitsDecoded();
|
||||
|
||||
inline mfxU32 BytesLeft();
|
||||
|
||||
mfxStatus GetNALUnitType(NAL_Unit_Type &uNALUnitType, mfxU8 &uNALStorageIDC);
|
||||
void AlignPointerRight(void);
|
||||
|
||||
protected:
|
||||
mfxU32 *m_pbs; // pointer to the current position of the buffer.
|
||||
mfxI32 m_bitOffset; // the bit position (0 to 31) in the dword pointed by m_pbs.
|
||||
mfxU32 *m_pbsBase; // pointer to the first byte of the buffer.
|
||||
mfxU32 m_maxBsSize; // maximum buffer size in bytes.
|
||||
};
|
||||
|
||||
class AVCHeadersBitstream : public AVCBaseBitstream
|
||||
{
|
||||
public:
|
||||
|
||||
AVCHeadersBitstream();
|
||||
AVCHeadersBitstream(mfxU8 * const pb, const mfxU32 maxsize);
|
||||
|
||||
|
||||
// Decode sequence parameter set
|
||||
mfxStatus GetSequenceParamSet(AVCSeqParamSet *sps);
|
||||
// Decode sequence parameter set extension
|
||||
mfxStatus GetSequenceParamSetExtension(AVCSeqParamSetExtension *sps_ex);
|
||||
|
||||
// Decoding picture's parameter set functions
|
||||
mfxStatus GetPictureParamSetPart1(AVCPicParamSet *pps);
|
||||
mfxStatus GetPictureParamSetPart2(AVCPicParamSet *pps, const AVCSeqParamSet *sps);
|
||||
|
||||
mfxStatus GetSliceHeaderPart1(AVCSliceHeader *pSliceHeader);
|
||||
// Decoding slice header functions
|
||||
mfxStatus GetSliceHeaderPart2(AVCSliceHeader *hdr, // slice header read goes here
|
||||
const AVCPicParamSet *pps,
|
||||
const AVCSeqParamSet *sps); // from slice header NAL unit
|
||||
|
||||
mfxStatus GetSliceHeaderPart3(AVCSliceHeader *hdr, // slice header read goes here
|
||||
PredWeightTable *pPredWeight_L0, // L0 weight table goes here
|
||||
PredWeightTable *pPredWeight_L1, // L1 weight table goes here
|
||||
RefPicListReorderInfo *pReorderInfo_L0,
|
||||
RefPicListReorderInfo *pReorderInfo_L1,
|
||||
AdaptiveMarkingInfo *pAdaptiveMarkingInfo,
|
||||
const AVCPicParamSet *pps,
|
||||
const AVCSeqParamSet *sps,
|
||||
mfxU8 NALRef_idc); // from slice header NAL unit
|
||||
|
||||
|
||||
mfxStatus GetNalUnitPrefix(AVCNalExtension *pExt, mfxU32 NALRef_idc);
|
||||
|
||||
mfxI32 GetSEI(const HeaderSet<AVCSeqParamSet> & sps, mfxI32 current_sps, AVCSEIPayLoad *spl);
|
||||
|
||||
private:
|
||||
|
||||
mfxStatus GetNalUnitExtension(AVCNalExtension *pExt);
|
||||
|
||||
void GetScalingList4x4(AVCScalingList4x4 *scl, mfxU8 *def, mfxU8 *scl_type);
|
||||
void GetScalingList8x8(AVCScalingList8x8 *scl, mfxU8 *def, mfxU8 *scl_type);
|
||||
|
||||
mfxI32 GetSEIPayload(const HeaderSet<AVCSeqParamSet> & sps, mfxI32 current_sps, AVCSEIPayLoad *spl);
|
||||
mfxI32 recovery_point(const HeaderSet<AVCSeqParamSet> & sps, mfxI32 current_sps, AVCSEIPayLoad *spl);
|
||||
mfxI32 reserved_sei_message(const HeaderSet<AVCSeqParamSet> & sps, mfxI32 current_sps, AVCSEIPayLoad *spl);
|
||||
|
||||
mfxStatus GetVUIParam(AVCSeqParamSet *sps);
|
||||
mfxStatus GetHRDParam(AVCSeqParamSet *sps);
|
||||
};
|
||||
|
||||
|
||||
void SetDefaultScalingLists(AVCSeqParamSet * sps);
|
||||
|
||||
extern const mfxU32 bits_data[];
|
||||
|
||||
|
||||
#define _avcGetBits(current_data, offset, nbits, data) \
|
||||
{ \
|
||||
mfxU32 x; \
|
||||
\
|
||||
SAMPLE_ASSERT((nbits) > 0 && (nbits) <= 32); \
|
||||
SAMPLE_ASSERT(offset >= 0 && offset <= 31); \
|
||||
\
|
||||
offset -= (nbits); \
|
||||
\
|
||||
if (offset >= 0) \
|
||||
{ \
|
||||
x = current_data[0] >> (offset + 1); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
offset += 32; \
|
||||
\
|
||||
x = current_data[1] >> (offset); \
|
||||
x >>= 1; \
|
||||
x += current_data[0] << (31 - offset); \
|
||||
current_data++; \
|
||||
} \
|
||||
\
|
||||
SAMPLE_ASSERT(offset >= 0 && offset <= 31); \
|
||||
\
|
||||
(data) = x & bits_data[nbits]; \
|
||||
}
|
||||
|
||||
#define avcGetBits1(current_data, offset, data) \
|
||||
{ \
|
||||
data = ((current_data[0] >> (offset)) & 1); \
|
||||
offset -= 1; \
|
||||
if (offset < 0) \
|
||||
{ \
|
||||
offset = 31; \
|
||||
current_data += 1; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define avcUngetNBits(current_data, offset, nbits) \
|
||||
{ \
|
||||
SAMPLE_ASSERT(offset >= 0 && offset <= 31); \
|
||||
\
|
||||
offset += (nbits); \
|
||||
if (offset > 31) \
|
||||
{ \
|
||||
offset -= 32; \
|
||||
current_data--; \
|
||||
} \
|
||||
\
|
||||
SAMPLE_ASSERT(offset >= 0 && offset <= 31); \
|
||||
}
|
||||
|
||||
#define avcGetNBits( current_data, offset, nbits, data) \
|
||||
_avcGetBits(current_data, offset, nbits, data);
|
||||
|
||||
inline mfxU32 AVCBaseBitstream::GetBits(mfxU32 nbits)
|
||||
{
|
||||
mfxU32 w, n = nbits;
|
||||
|
||||
avcGetNBits(m_pbs, m_bitOffset, n, w);
|
||||
return w;
|
||||
}
|
||||
|
||||
inline mfxU32 AVCBaseBitstream::Get1Bit()
|
||||
{
|
||||
mfxU32 w;
|
||||
avcGetBits1(m_pbs, m_bitOffset, w);
|
||||
return w;
|
||||
|
||||
} // AVCBitstream::Get1Bit()
|
||||
|
||||
inline mfxU32 AVCBaseBitstream::BytesDecoded()
|
||||
{
|
||||
return static_cast<mfxU32>((mfxU8*)m_pbs - (mfxU8*)m_pbsBase) +
|
||||
((31 - m_bitOffset) >> 3);
|
||||
}
|
||||
|
||||
inline mfxU32 AVCBaseBitstream::BytesLeft()
|
||||
{
|
||||
return ((mfxI32)m_maxBsSize - (mfxI32) BytesDecoded());
|
||||
}
|
||||
|
||||
} // namespace ProtectedLibrary
|
||||
|
||||
#endif // __AVC_BITSTREAM_H_
|
||||
157
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/avc_headers.h
vendored
Normal file
157
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/avc_headers.h
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#ifndef __AVC_HEADERS_H
|
||||
#define __AVC_HEADERS_H
|
||||
|
||||
#include "avc_structures.h"
|
||||
#include <vector>
|
||||
|
||||
namespace ProtectedLibrary
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
class HeaderSet
|
||||
{
|
||||
public:
|
||||
|
||||
HeaderSet()
|
||||
: m_currentID(-1)
|
||||
{
|
||||
}
|
||||
|
||||
~HeaderSet()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void AddHeader(T* hdr)
|
||||
{
|
||||
mfxU32 id = hdr->GetID();
|
||||
if (id >= m_header.size())
|
||||
{
|
||||
m_header.resize(id + 1);
|
||||
}
|
||||
|
||||
delete m_header[id];
|
||||
|
||||
m_header[id] = new T();
|
||||
*(m_header[id]) = *hdr;
|
||||
}
|
||||
|
||||
T * GetHeader(mfxU32 id)
|
||||
{
|
||||
if (id >= m_header.size())
|
||||
return 0;
|
||||
|
||||
return m_header[id];
|
||||
}
|
||||
|
||||
void RemoveHeader(mfxU32 id)
|
||||
{
|
||||
if (id >= m_header.size())
|
||||
return;
|
||||
|
||||
delete m_header[id];
|
||||
m_header[id] = 0;
|
||||
}
|
||||
|
||||
void RemoveHeader(T * hdr)
|
||||
{
|
||||
if (!hdr)
|
||||
return;
|
||||
|
||||
RemoveHeader(hdr->GetID());
|
||||
}
|
||||
|
||||
const T * GetHeader(mfxU32 id) const
|
||||
{
|
||||
if (id >= m_header.size())
|
||||
return 0;
|
||||
|
||||
return m_header[id];
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
for (mfxU32 i = 0; i < m_header.size(); i++)
|
||||
{
|
||||
delete m_header[i];
|
||||
m_header[i]=0;
|
||||
}
|
||||
}
|
||||
|
||||
void SetCurrentID(mfxU32 id)
|
||||
{
|
||||
m_currentID = id;
|
||||
}
|
||||
|
||||
mfxI32 GetCurrrentID() const
|
||||
{
|
||||
return m_currentID;
|
||||
}
|
||||
|
||||
T * GetCurrentHeader()
|
||||
{
|
||||
if (m_currentID == -1)
|
||||
return 0;
|
||||
|
||||
return GetHeader(m_currentID);
|
||||
}
|
||||
|
||||
const T * GetCurrentHeader() const
|
||||
{
|
||||
if (m_currentID == -1)
|
||||
return 0;
|
||||
|
||||
return GetHeader(m_currentID);
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<T*> m_header;
|
||||
mfxI32 m_currentID;
|
||||
};
|
||||
|
||||
/****************************************************************************************************/
|
||||
// Headers stuff
|
||||
/****************************************************************************************************/
|
||||
class AVCHeaders
|
||||
{
|
||||
public:
|
||||
|
||||
void Reset()
|
||||
{
|
||||
m_SeqParams.Reset();
|
||||
m_SeqExParams.Reset();
|
||||
m_SeqParamsMvcExt.Reset();
|
||||
m_PicParams.Reset();
|
||||
m_SEIParams.Reset();
|
||||
}
|
||||
|
||||
HeaderSet<AVCSeqParamSet> m_SeqParams;
|
||||
HeaderSet<AVCSeqParamSetExtension> m_SeqExParams;
|
||||
HeaderSet<AVCSeqParamSet> m_SeqParamsMvcExt;
|
||||
HeaderSet<AVCPicParamSet> m_PicParams;
|
||||
HeaderSet<AVCSEIPayLoad> m_SEIParams;
|
||||
AVCNalExtension m_nalExtension;
|
||||
};
|
||||
|
||||
} //namespace ProtectedLibrary
|
||||
|
||||
#endif // __AVC_HEADERS_H
|
||||
101
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/avc_nal_spl.h
vendored
Normal file
101
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/avc_nal_spl.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
#ifndef __AVC_NAL_SPL_H
|
||||
#define __AVC_NAL_SPL_H
|
||||
|
||||
#include <vector>
|
||||
#include "mfxstructures.h"
|
||||
|
||||
namespace ProtectedLibrary
|
||||
{
|
||||
|
||||
class BytesSwapper
|
||||
{
|
||||
public:
|
||||
static void SwapMemory(mfxU8 *pDestination, mfxU32 &nDstSize, mfxU8 *pSource, mfxU32 nSrcSize);
|
||||
};
|
||||
|
||||
|
||||
class StartCodeIterator
|
||||
{
|
||||
public:
|
||||
|
||||
StartCodeIterator();
|
||||
|
||||
void Reset();
|
||||
|
||||
mfxI32 Init(mfxBitstream * source);
|
||||
|
||||
void SetSuggestedSize(mfxU32 size);
|
||||
|
||||
mfxI32 CheckNalUnitType(mfxBitstream * source);
|
||||
|
||||
mfxI32 GetNALUnit(mfxBitstream * source, mfxBitstream * destination);
|
||||
|
||||
mfxI32 EndOfStream(mfxBitstream * destination);
|
||||
|
||||
private:
|
||||
std::vector<mfxU8> m_prev;
|
||||
mfxU32 m_code;
|
||||
mfxU64 m_pts;
|
||||
|
||||
mfxU8 * m_pSource;
|
||||
mfxU32 m_nSourceSize;
|
||||
|
||||
mfxU8 * m_pSourceBase;
|
||||
mfxU32 m_nSourceBaseSize;
|
||||
|
||||
mfxU32 m_suggestedSize;
|
||||
|
||||
mfxI32 FindStartCode(mfxU8 * (&pb), mfxU32 & size, mfxI32 & startCodeSize);
|
||||
};
|
||||
|
||||
class NALUnitSplitter
|
||||
{
|
||||
public:
|
||||
|
||||
NALUnitSplitter();
|
||||
|
||||
virtual ~NALUnitSplitter();
|
||||
|
||||
virtual void Init();
|
||||
virtual void Release();
|
||||
|
||||
virtual mfxI32 CheckNalUnitType(mfxBitstream * source);
|
||||
virtual mfxI32 GetNalUnits(mfxBitstream * source, mfxBitstream * &destination);
|
||||
|
||||
virtual void Reset();
|
||||
|
||||
virtual void SetSuggestedSize(mfxU32 size)
|
||||
{
|
||||
m_pStartCodeIter.SetSuggestedSize(size);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
StartCodeIterator m_pStartCodeIter;
|
||||
|
||||
mfxBitstream m_bitstream;
|
||||
};
|
||||
|
||||
void SwapMemoryAndRemovePreventingBytes(mfxU8 *pDestination, mfxU32 &nDstSize, mfxU8 *pSource, mfxU32 nSrcSize);
|
||||
|
||||
} //namespace ProtectedLibrary
|
||||
|
||||
#endif // __AVC_NAL_SPL_H
|
||||
140
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/avc_spl.h
vendored
Normal file
140
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/avc_spl.h
vendored
Normal file
@@ -0,0 +1,140 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#ifndef _AVC_SPL_H__
|
||||
#define _AVC_SPL_H__
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
#include "abstract_splitter.h"
|
||||
|
||||
#include "avc_bitstream.h"
|
||||
#include "avc_headers.h"
|
||||
#include "avc_nal_spl.h"
|
||||
|
||||
namespace ProtectedLibrary
|
||||
{
|
||||
|
||||
class AVCSlice : public SliceSplitterInfo
|
||||
{
|
||||
public:
|
||||
|
||||
AVCSlice();
|
||||
|
||||
AVCSliceHeader * GetSliceHeader();
|
||||
|
||||
bool IsField() const {return m_sliceHeader.field_pic_flag != 0;}
|
||||
|
||||
mfxI32 RetrievePicParamSetNumber(mfxU8 *pSource, mfxU32 nSourceSize);
|
||||
|
||||
bool DecodeHeader(mfxU8 *pSource, mfxU32 nSourceSize);
|
||||
|
||||
AVCHeadersBitstream *GetBitStream(void){return &m_bitStream;}
|
||||
|
||||
AVCPicParamSet* m_picParamSet;
|
||||
AVCSeqParamSet* m_seqParamSet;
|
||||
AVCSeqParamSet* m_seqParamSetMvcEx;
|
||||
AVCSeqParamSetExtension* m_seqParamSetEx;
|
||||
|
||||
mfxU64 m_dTime;
|
||||
|
||||
protected:
|
||||
AVCSliceHeader m_sliceHeader;
|
||||
AVCHeadersBitstream m_bitStream;
|
||||
|
||||
void Reset();
|
||||
};
|
||||
|
||||
class AVCFrameInfo
|
||||
{
|
||||
public:
|
||||
|
||||
AVCFrameInfo();
|
||||
|
||||
void Reset();
|
||||
|
||||
AVCSlice * m_slice;
|
||||
mfxU32 m_index;
|
||||
};
|
||||
|
||||
class AVC_Spl : public AbstractSplitter
|
||||
{
|
||||
public:
|
||||
|
||||
AVC_Spl();
|
||||
|
||||
virtual ~AVC_Spl();
|
||||
|
||||
virtual mfxStatus Reset();
|
||||
|
||||
virtual mfxStatus GetFrame(mfxBitstream * bs_in, FrameSplitterInfo ** frame);
|
||||
|
||||
virtual mfxStatus PostProcessing(FrameSplitterInfo *frame, mfxU32 sliceNum);
|
||||
|
||||
void ResetCurrentState();
|
||||
|
||||
protected:
|
||||
std::unique_ptr<NALUnitSplitter> m_pNALSplitter;
|
||||
|
||||
mfxStatus Init();
|
||||
|
||||
void Close();
|
||||
|
||||
mfxStatus ProcessNalUnit(mfxI32 nalType, mfxBitstream * destination);
|
||||
|
||||
mfxStatus DecodeHeader(mfxBitstream * nalUnit);
|
||||
mfxStatus DecodeSEI(mfxBitstream * nalUnit);
|
||||
AVCSlice * DecodeSliceHeader(mfxBitstream * nalUnit);
|
||||
mfxStatus AddSlice(AVCSlice * pSlice);
|
||||
|
||||
AVCFrameInfo * GetFreeFrame();
|
||||
|
||||
mfxU8 * GetMemoryForSwapping(mfxU32 size);
|
||||
|
||||
mfxStatus AddNalUnit(mfxBitstream * nalUnit);
|
||||
mfxStatus AddSliceNalUnit(mfxBitstream * nalUnit, AVCSlice * pSlice);
|
||||
bool IsFieldOfOneFrame(AVCFrameInfo * frame, const AVCSliceHeader * slice1, const AVCSliceHeader *slice2);
|
||||
|
||||
bool m_WaitForIDR;
|
||||
|
||||
AVCHeaders m_headers;
|
||||
std::unique_ptr<AVCFrameInfo> m_AUInfo;
|
||||
AVCFrameInfo * m_currentInfo;
|
||||
AVCSlice * m_pLastSlice;
|
||||
|
||||
mfxBitstream * m_lastNalUnit;
|
||||
|
||||
enum
|
||||
{
|
||||
BUFFER_SIZE = 1024 * 1024
|
||||
};
|
||||
|
||||
std::vector<mfxU8> m_currentFrame;
|
||||
std::vector<mfxU8> m_swappingMemory;
|
||||
std::list<AVCSlice> m_slicesStorage;
|
||||
|
||||
std::vector<SliceSplitterInfo> m_slices;
|
||||
FrameSplitterInfo m_frame;
|
||||
};
|
||||
|
||||
} // namespace ProtectedLibrary
|
||||
|
||||
#endif // _AVC_SPL_H__
|
||||
1107
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/avc_structures.h
vendored
Normal file
1107
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/avc_structures.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
201
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/base_allocator.h
vendored
Normal file
201
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/base_allocator.h
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#ifndef __BASE_ALLOCATOR_H__
|
||||
#define __BASE_ALLOCATOR_H__
|
||||
|
||||
#include <list>
|
||||
#include <string.h>
|
||||
#include <functional>
|
||||
#include "mfxvideo.h"
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
struct mfxAllocatorParams
|
||||
{
|
||||
virtual ~mfxAllocatorParams(){};
|
||||
};
|
||||
|
||||
// this class implements methods declared in mfxFrameAllocator structure
|
||||
// simply redirecting them to virtual methods which should be overridden in derived classes
|
||||
class MFXFrameAllocator : public mfxFrameAllocator
|
||||
{
|
||||
public:
|
||||
MFXFrameAllocator();
|
||||
virtual ~MFXFrameAllocator();
|
||||
|
||||
// optional method, override if need to pass some parameters to allocator from application
|
||||
virtual mfxStatus Init(mfxAllocatorParams *pParams) = 0;
|
||||
virtual mfxStatus Close() = 0;
|
||||
|
||||
virtual mfxStatus AllocFrames(mfxFrameAllocRequest *request, mfxFrameAllocResponse *response) = 0;
|
||||
virtual mfxStatus ReallocFrame(mfxMemId midIn, const mfxFrameInfo *info, mfxU16 memType, mfxMemId *midOut) = 0;
|
||||
virtual mfxStatus LockFrame(mfxMemId mid, mfxFrameData *ptr) = 0;
|
||||
virtual mfxStatus UnlockFrame(mfxMemId mid, mfxFrameData *ptr) = 0;
|
||||
virtual mfxStatus GetFrameHDL(mfxMemId mid, mfxHDL *handle) = 0;
|
||||
virtual mfxStatus FreeFrames(mfxFrameAllocResponse *response) = 0;
|
||||
|
||||
private:
|
||||
static mfxStatus MFX_CDECL Alloc_(mfxHDL pthis, mfxFrameAllocRequest *request, mfxFrameAllocResponse *response);
|
||||
static mfxStatus MFX_CDECL Lock_(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr);
|
||||
static mfxStatus MFX_CDECL Unlock_(mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr);
|
||||
static mfxStatus MFX_CDECL GetHDL_(mfxHDL pthis, mfxMemId mid, mfxHDL *handle);
|
||||
static mfxStatus MFX_CDECL Free_(mfxHDL pthis, mfxFrameAllocResponse *response);
|
||||
};
|
||||
|
||||
// This class implements basic logic of memory allocator
|
||||
// Manages responses for different components according to allocation request type
|
||||
// External frames of a particular component-related type are allocated in one call
|
||||
// Further calls return previously allocated response.
|
||||
// Ex. Preallocated frame chain with type=FROM_ENCODE | FROM_VPPIN will be returned when
|
||||
// request type contains either FROM_ENCODE or FROM_VPPIN
|
||||
|
||||
// This class does not allocate any actual memory
|
||||
|
||||
class BaseFrameAllocator: public MFXFrameAllocator
|
||||
{
|
||||
public:
|
||||
BaseFrameAllocator();
|
||||
virtual ~BaseFrameAllocator();
|
||||
|
||||
virtual mfxStatus Init(mfxAllocatorParams *pParams) = 0;
|
||||
virtual mfxStatus Close();
|
||||
virtual mfxStatus AllocFrames(mfxFrameAllocRequest *request, mfxFrameAllocResponse *response);
|
||||
virtual mfxStatus ReallocFrame(mfxMemId midIn, const mfxFrameInfo *info, mfxU16 memType, mfxMemId *midOut);
|
||||
virtual mfxStatus FreeFrames(mfxFrameAllocResponse *response);
|
||||
|
||||
protected:
|
||||
std::mutex mtx;
|
||||
typedef std::list<mfxFrameAllocResponse>::iterator Iter;
|
||||
static const mfxU32 MEMTYPE_FROM_MASK = MFX_MEMTYPE_FROM_ENCODE | MFX_MEMTYPE_FROM_DECODE | \
|
||||
MFX_MEMTYPE_FROM_VPPIN | MFX_MEMTYPE_FROM_VPPOUT | \
|
||||
MFX_MEMTYPE_FROM_ENC | MFX_MEMTYPE_FROM_PAK;
|
||||
|
||||
static const mfxU32 MEMTYPE_FROM_MASK_INT_EXT = MEMTYPE_FROM_MASK | MFX_MEMTYPE_INTERNAL_FRAME | MFX_MEMTYPE_EXTERNAL_FRAME;
|
||||
|
||||
struct UniqueResponse
|
||||
: mfxFrameAllocResponse
|
||||
{
|
||||
mfxU16 m_width;
|
||||
mfxU16 m_height;
|
||||
mfxU32 m_refCount;
|
||||
mfxU16 m_type;
|
||||
|
||||
UniqueResponse()
|
||||
: m_width(0)
|
||||
, m_height(0)
|
||||
, m_refCount(0)
|
||||
, m_type(0)
|
||||
{
|
||||
memset(static_cast<mfxFrameAllocResponse*>(this), 0, sizeof(mfxFrameAllocResponse));
|
||||
}
|
||||
|
||||
// compare responses by actual frame size, alignment (w and h) is up to application
|
||||
UniqueResponse(const mfxFrameAllocResponse & response, mfxU16 width, mfxU16 height, mfxU16 type)
|
||||
: mfxFrameAllocResponse(response)
|
||||
, m_width(width)
|
||||
, m_height(height)
|
||||
, m_refCount(1)
|
||||
, m_type(type)
|
||||
{
|
||||
}
|
||||
|
||||
//compare by resolution (and memory type for FEI ENC / PAK)
|
||||
bool operator () (const UniqueResponse &response)const
|
||||
{
|
||||
if (m_width <= response.m_width && m_height <= response.m_height)
|
||||
{
|
||||
// For FEI ENC and PAK we need to distinguish between INTERNAL and EXTERNAL frames
|
||||
|
||||
if (m_type & response.m_type & (MFX_MEMTYPE_FROM_ENC | MFX_MEMTYPE_FROM_PAK))
|
||||
{
|
||||
return !!((m_type & response.m_type) & 0x000f);
|
||||
}
|
||||
else
|
||||
{
|
||||
return !!(m_type & response.m_type & MFX_MEMTYPE_FROM_DECODE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static mfxU16 CropMemoryTypeToStore(mfxU16 type)
|
||||
{
|
||||
// Remain INTERNAL / EXTERNAL flag for FEI ENC / PAK
|
||||
switch (type & 0xf000)
|
||||
{
|
||||
case MFX_MEMTYPE_FROM_ENC:
|
||||
case MFX_MEMTYPE_FROM_PAK:
|
||||
case (MFX_MEMTYPE_FROM_ENC | MFX_MEMTYPE_FROM_PAK):
|
||||
return type & MEMTYPE_FROM_MASK_INT_EXT;
|
||||
break;
|
||||
default:
|
||||
return type & MEMTYPE_FROM_MASK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
std::list<mfxFrameAllocResponse> m_responses;
|
||||
std::list<UniqueResponse> m_ExtResponses;
|
||||
|
||||
struct IsSame
|
||||
: public std::binary_function<mfxFrameAllocResponse, mfxFrameAllocResponse, bool>
|
||||
{
|
||||
bool operator () (const mfxFrameAllocResponse & l, const mfxFrameAllocResponse &r)const
|
||||
{
|
||||
return r.mids != 0 && l.mids != 0 &&
|
||||
r.mids[0] == l.mids[0] &&
|
||||
r.NumFrameActual == l.NumFrameActual;
|
||||
}
|
||||
};
|
||||
|
||||
// checks if request is supported
|
||||
virtual mfxStatus CheckRequestType(mfxFrameAllocRequest *request);
|
||||
|
||||
// frees memory attached to response
|
||||
virtual mfxStatus ReleaseResponse(mfxFrameAllocResponse *response) = 0;
|
||||
// allocates memory
|
||||
virtual mfxStatus AllocImpl(mfxFrameAllocRequest *request, mfxFrameAllocResponse *response) = 0;
|
||||
virtual mfxStatus ReallocImpl(mfxMemId midIn, const mfxFrameInfo *info, mfxU16 memType, mfxMemId *midOut) = 0;
|
||||
};
|
||||
|
||||
class MFXBufferAllocator : public mfxBufferAllocator
|
||||
{
|
||||
public:
|
||||
MFXBufferAllocator();
|
||||
virtual ~MFXBufferAllocator();
|
||||
|
||||
virtual mfxStatus AllocBuffer(mfxU32 nbytes, mfxU16 type, mfxMemId *mid) = 0;
|
||||
virtual mfxStatus LockBuffer(mfxMemId mid, mfxU8 **ptr) = 0;
|
||||
virtual mfxStatus UnlockBuffer(mfxMemId mid) = 0;
|
||||
virtual mfxStatus FreeBuffer(mfxMemId mid) = 0;
|
||||
|
||||
private:
|
||||
static mfxStatus MFX_CDECL Alloc_(mfxHDL pthis, mfxU32 nbytes, mfxU16 type, mfxMemId *mid);
|
||||
static mfxStatus MFX_CDECL Lock_(mfxHDL pthis, mfxMemId mid, mfxU8 **ptr);
|
||||
static mfxStatus MFX_CDECL Unlock_(mfxHDL pthis, mfxMemId mid);
|
||||
static mfxStatus MFX_CDECL Free_(mfxHDL pthis, mfxMemId mid);
|
||||
};
|
||||
|
||||
|
||||
#endif // __BASE_ALLOCATOR_H__
|
||||
425
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/brc_routines.h
vendored
Normal file
425
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/brc_routines.h
vendored
Normal file
@@ -0,0 +1,425 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
#include "sample_defs.h"
|
||||
#include "algorithm"
|
||||
|
||||
#ifndef MFX_VERSION
|
||||
#error MFX_VERSION not defined
|
||||
#endif
|
||||
|
||||
#if (MFX_VERSION >= 1024)
|
||||
#include "mfxbrc.h"
|
||||
|
||||
#ifndef __PIPELINE_ENCODE_BRC_H__
|
||||
#define __PIPELINE_ENCODE_BRC_H__
|
||||
|
||||
#define MFX_CHECK_NULL_PTR1(pointer) MSDK_CHECK_POINTER(pointer, MFX_ERR_NULL_PTR);
|
||||
|
||||
#define MFX_CHECK_NULL_PTR2(pointer1,pointer2 )\
|
||||
MFX_CHECK_NULL_PTR1(pointer1);\
|
||||
MFX_CHECK_NULL_PTR1(pointer2);
|
||||
|
||||
#define MFX_CHECK_NULL_PTR3(pointer1,pointer2, pointer3 )\
|
||||
MFX_CHECK_NULL_PTR2(pointer1,pointer2);\
|
||||
MFX_CHECK_NULL_PTR1(pointer3);
|
||||
|
||||
#define MFX_CHECK(cond, error) MSDK_CHECK_NOT_EQUAL(cond, true, error)
|
||||
#define MFX_CHECK_STS(sts) MFX_CHECK(sts == MFX_ERR_NONE, sts)
|
||||
|
||||
|
||||
/*
|
||||
NalHrdConformance | VuiNalHrdParameters | Result
|
||||
--------------------------------------------------------------
|
||||
off any => MFX_BRC_NO_HRD
|
||||
default off => MFX_BRC_NO_HRD
|
||||
on off => MFX_BRC_HRD_WEAK
|
||||
on (or default) on (or default) => MFX_BRC_HRD_STRONG
|
||||
--------------------------------------------------------------
|
||||
*/
|
||||
enum : mfxU16
|
||||
{
|
||||
MFX_BRC_NO_HRD = 0,
|
||||
MFX_BRC_HRD_WEAK, // IF HRD CALCULATION IS REQUIRED, BUT NOT WRITTEN TO THE STREAM
|
||||
MFX_BRC_HRD_STRONG
|
||||
};
|
||||
|
||||
class cBRCParams
|
||||
{
|
||||
public:
|
||||
mfxU16 rateControlMethod; // CBR or VBR
|
||||
|
||||
mfxU16 HRDConformance; // is HRD compliance needed
|
||||
mfxU16 bRec; // is Recoding possible
|
||||
mfxU16 bPanic; // is Panic mode possible
|
||||
|
||||
// HRD params
|
||||
mfxU32 bufferSizeInBytes;
|
||||
mfxU32 initialDelayInBytes;
|
||||
|
||||
// Sliding window parameters
|
||||
mfxU16 WinBRCMaxAvgKbps;
|
||||
mfxU16 WinBRCSize;
|
||||
|
||||
// RC params
|
||||
mfxU32 targetbps;
|
||||
mfxU32 maxbps;
|
||||
mfxF64 frameRate;
|
||||
mfxF64 inputBitsPerFrame;
|
||||
mfxF64 maxInputBitsPerFrame;
|
||||
mfxU32 maxFrameSizeInBits;
|
||||
|
||||
// Frame size params
|
||||
mfxU16 width;
|
||||
mfxU16 height;
|
||||
mfxU16 chromaFormat;
|
||||
mfxU16 bitDepthLuma;
|
||||
|
||||
// GOP params
|
||||
mfxU16 gopPicSize;
|
||||
mfxU16 gopRefDist;
|
||||
bool bPyr;
|
||||
|
||||
//BRC accurancy params
|
||||
mfxF64 fAbPeriodLong; // number on frames to calculate abberation from target frame
|
||||
mfxF64 fAbPeriodShort; // number on frames to calculate abberation from target frame
|
||||
mfxF64 dqAbPeriod; // number on frames to calculate abberation from dequant
|
||||
mfxF64 bAbPeriod; // number of frames to calculate abberation from target bitrate
|
||||
|
||||
//QP parameters
|
||||
mfxI32 quantOffset;
|
||||
mfxI32 quantMaxI;
|
||||
mfxI32 quantMinI;
|
||||
mfxI32 quantMaxP;
|
||||
mfxI32 quantMinP;
|
||||
mfxI32 quantMaxB;
|
||||
mfxI32 quantMinB;
|
||||
|
||||
public:
|
||||
cBRCParams():
|
||||
rateControlMethod(0),
|
||||
HRDConformance(MFX_BRC_NO_HRD),
|
||||
bRec(0),
|
||||
bPanic(0),
|
||||
bufferSizeInBytes(0),
|
||||
initialDelayInBytes(0),
|
||||
WinBRCMaxAvgKbps(0),
|
||||
WinBRCSize(0),
|
||||
targetbps(0),
|
||||
maxbps(0),
|
||||
frameRate(0),
|
||||
inputBitsPerFrame(0),
|
||||
maxInputBitsPerFrame(0),
|
||||
maxFrameSizeInBits(0),
|
||||
width(0),
|
||||
height(0),
|
||||
chromaFormat(0),
|
||||
bitDepthLuma(0),
|
||||
gopPicSize(0),
|
||||
gopRefDist(0),
|
||||
bPyr(0),
|
||||
fAbPeriodLong(0),
|
||||
fAbPeriodShort(0),
|
||||
dqAbPeriod(0),
|
||||
bAbPeriod(0),
|
||||
quantOffset(0),
|
||||
quantMaxI(0),
|
||||
quantMinI(0),
|
||||
quantMaxP(0),
|
||||
quantMinP(0),
|
||||
quantMaxB(0),
|
||||
quantMinB(0)
|
||||
{}
|
||||
|
||||
mfxStatus Init(mfxVideoParam* par, bool bFieldMode = false);
|
||||
mfxStatus GetBRCResetType(mfxVideoParam* par, bool bNewSequence, bool &bReset, bool &bSlidingWindowReset );
|
||||
};
|
||||
class cHRD
|
||||
{
|
||||
public:
|
||||
cHRD():
|
||||
m_bufFullness(0),
|
||||
m_prevBufFullness(0),
|
||||
m_frameNum(0),
|
||||
m_minFrameSize(0),
|
||||
m_maxFrameSize(0),
|
||||
m_underflowQuant(0),
|
||||
m_overflowQuant(0),
|
||||
m_buffSizeInBits(0),
|
||||
m_delayInBits(0),
|
||||
m_inputBitsPerFrame(0),
|
||||
m_bCBR (false)
|
||||
{}
|
||||
|
||||
void Init(mfxU32 buffSizeInBytes, mfxU32 delayInBytes, mfxF64 inputBitsPerFrame, bool cbr);
|
||||
mfxU16 UpdateAndCheckHRD(mfxI32 frameBits, mfxI32 recode, mfxI32 minQuant, mfxI32 maxQuant);
|
||||
mfxStatus UpdateMinMaxQPForRec(mfxU32 brcSts, mfxI32 qp);
|
||||
mfxI32 GetTargetSize(mfxU32 brcSts);
|
||||
mfxI32 GetMaxFrameSize() { return m_maxFrameSize;}
|
||||
mfxI32 GetMinFrameSize() { return m_minFrameSize;}
|
||||
mfxI32 GetMaxQuant() { return m_overflowQuant - 1;}
|
||||
mfxI32 GetMinQuant() { return m_underflowQuant + 1;}
|
||||
mfxF64 GetBufferDiviation(mfxU32 targetBitrate);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
mfxF64 m_bufFullness;
|
||||
mfxF64 m_prevBufFullness;
|
||||
mfxI32 m_frameNum;
|
||||
mfxI32 m_minFrameSize;
|
||||
mfxI32 m_maxFrameSize;
|
||||
mfxI32 m_underflowQuant;
|
||||
mfxI32 m_overflowQuant;
|
||||
|
||||
private:
|
||||
mfxI32 m_buffSizeInBits;
|
||||
mfxI32 m_delayInBits;
|
||||
mfxF64 m_inputBitsPerFrame;
|
||||
bool m_bCBR;
|
||||
|
||||
};
|
||||
|
||||
struct BRC_Ctx
|
||||
{
|
||||
mfxI32 QuantI; //currect qp for intra frames
|
||||
mfxI32 QuantP; //currect qp for P frames
|
||||
mfxI32 QuantB; //currect qp for B frames
|
||||
|
||||
mfxI32 Quant; // qp for last encoded frame
|
||||
mfxI32 QuantMin; // qp Min for last encoded frame (is used for recoding)
|
||||
mfxI32 QuantMax; // qp Max for last encoded frame (is used for recoding)
|
||||
|
||||
bool bToRecode; // last frame is needed in recoding
|
||||
bool bPanic; // last frame is needed in panic
|
||||
mfxU32 encOrder; // encoding order of last encoded frame
|
||||
mfxU32 poc; // poc of last encoded frame
|
||||
mfxI32 SceneChange; // scene change parameter of last encoded frame
|
||||
mfxU32 SChPoc; // poc of frame with scene change
|
||||
mfxU32 LastIEncOrder; // encoded order if last intra frame
|
||||
mfxU32 LastNonBFrameSize; // encoded frame size of last non B frame (is used for sceneChange)
|
||||
|
||||
mfxF64 fAbLong; // avarage frame size (long period)
|
||||
mfxF64 fAbShort; // avarage frame size (short period)
|
||||
mfxF64 dQuantAb; // avarage dequant
|
||||
mfxF64 totalDiviation; // divation from target bitrate (total)
|
||||
|
||||
mfxF64 eRate; // eRate of last encoded frame, this parameter is used for scene change calculation
|
||||
mfxF64 eRateSH; // eRate of last encoded scene change frame, this parameter is used for scene change calculation
|
||||
};
|
||||
class AVGBitrate
|
||||
{
|
||||
public:
|
||||
AVGBitrate(mfxU32 windowSize, mfxU32 maxBitPerFrame, mfxU32 avgBitPerFrame) :
|
||||
m_maxWinBits(maxBitPerFrame*windowSize),
|
||||
m_maxWinBitsLim(0),
|
||||
m_avgBitPerFrame(std::min(avgBitPerFrame, maxBitPerFrame)),
|
||||
m_currPosInWindow(windowSize-1),
|
||||
m_lastFrameOrder(mfxU32(-1))
|
||||
|
||||
{
|
||||
windowSize = windowSize > 0 ? windowSize : 1; // kw
|
||||
m_slidingWindow.resize(windowSize);
|
||||
for (mfxU32 i = 0; i < windowSize; i++)
|
||||
{
|
||||
m_slidingWindow[i] = maxBitPerFrame / 3; //initial value to prevent big first frames
|
||||
}
|
||||
m_maxWinBitsLim = GetMaxWinBitsLim();
|
||||
}
|
||||
virtual ~AVGBitrate()
|
||||
{
|
||||
|
||||
}
|
||||
void UpdateSlidingWindow(mfxU32 sizeInBits, mfxU32 FrameOrder, bool bPanic, bool bSH, mfxU32 recode)
|
||||
{
|
||||
mfxU32 windowSize = (mfxU32)m_slidingWindow.size();
|
||||
bool bNextFrame = FrameOrder != m_lastFrameOrder;
|
||||
|
||||
if (bNextFrame)
|
||||
{
|
||||
m_lastFrameOrder = FrameOrder;
|
||||
m_currPosInWindow = (m_currPosInWindow + 1) % windowSize;
|
||||
}
|
||||
m_slidingWindow[m_currPosInWindow] = sizeInBits;
|
||||
|
||||
if (bNextFrame)
|
||||
{
|
||||
if (bPanic || bSH)
|
||||
{
|
||||
m_maxWinBitsLim = mfx::clamp((GetLastFrameBits(windowSize, false) + m_maxWinBits)/2, GetMaxWinBitsLim(), m_maxWinBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (recode)
|
||||
{
|
||||
m_maxWinBitsLim = mfx::clamp(GetLastFrameBits(windowSize, false) + GetStep()/2, m_maxWinBitsLim, m_maxWinBits);
|
||||
}
|
||||
else if ((m_maxWinBitsLim > GetMaxWinBitsLim() + GetStep()) &&
|
||||
(m_maxWinBitsLim - GetStep() > (GetLastFrameBits(windowSize - 1, false) + sizeInBits)))
|
||||
m_maxWinBitsLim -= GetStep();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
mfxU32 GetMaxFrameSize(bool bPanic, bool bSH, mfxU32 recode)
|
||||
{
|
||||
mfxU32 winBits = GetLastFrameBits(GetWindowSize() - 1, !bPanic);
|
||||
|
||||
mfxU32 maxWinBitsLim = m_maxWinBitsLim;
|
||||
if (bSH)
|
||||
maxWinBitsLim = (m_maxWinBits + m_maxWinBitsLim)/2;
|
||||
if (bPanic)
|
||||
maxWinBitsLim = m_maxWinBits;
|
||||
maxWinBitsLim = std::min(maxWinBitsLim + recode*GetStep()/2, m_maxWinBits);
|
||||
|
||||
mfxU32 maxFrameSize = winBits >= m_maxWinBitsLim ?
|
||||
mfxU32(std::max<mfxI32>((mfxI32)m_maxWinBits - (mfxI32)winBits, 1)):
|
||||
maxWinBitsLim - winBits;
|
||||
|
||||
|
||||
|
||||
return maxFrameSize;
|
||||
}
|
||||
mfxU32 GetWindowSize()
|
||||
{
|
||||
return (mfxU32)m_slidingWindow.size();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
mfxU32 m_maxWinBits;
|
||||
mfxU32 m_maxWinBitsLim;
|
||||
mfxU32 m_avgBitPerFrame;
|
||||
|
||||
mfxU32 m_currPosInWindow;
|
||||
mfxU32 m_lastFrameOrder;
|
||||
std::vector<mfxU32> m_slidingWindow;
|
||||
|
||||
|
||||
|
||||
mfxU32 GetLastFrameBits(mfxU32 numFrames, bool bCheckSkip)
|
||||
{
|
||||
mfxU32 size = 0;
|
||||
numFrames = numFrames < m_slidingWindow.size() ? numFrames : (mfxU32)m_slidingWindow.size();
|
||||
for (mfxU32 i = 0; i < numFrames; i++)
|
||||
{
|
||||
mfxU32 frame_size = m_slidingWindow[(m_currPosInWindow + m_slidingWindow.size() - i) % m_slidingWindow.size()];
|
||||
if (bCheckSkip && (frame_size < m_avgBitPerFrame / 3))
|
||||
frame_size = m_avgBitPerFrame / 3;
|
||||
size += frame_size;
|
||||
//printf("GetLastFrames: %d) %d sum %d\n",i,m_slidingWindow[(m_currPosInWindow + m_slidingWindow.size() - i) % m_slidingWindow.size() ], size);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
mfxU32 GetStep()
|
||||
{
|
||||
return (m_maxWinBits / GetWindowSize() - m_avgBitPerFrame) / 2;
|
||||
}
|
||||
|
||||
mfxU32 GetMaxWinBitsLim()
|
||||
{
|
||||
return m_maxWinBits - GetStep() * GetWindowSize();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
class ExtBRC
|
||||
{
|
||||
private:
|
||||
cBRCParams m_par;
|
||||
cHRD m_hrd;
|
||||
bool m_bInit;
|
||||
BRC_Ctx m_ctx;
|
||||
std::unique_ptr<AVGBitrate> m_avg;
|
||||
|
||||
public:
|
||||
ExtBRC():
|
||||
m_par(),
|
||||
m_hrd(),
|
||||
m_bInit(false)
|
||||
{
|
||||
memset(&m_ctx, 0, sizeof(m_ctx));
|
||||
|
||||
}
|
||||
mfxStatus Init (mfxVideoParam* par);
|
||||
mfxStatus Reset(mfxVideoParam* par);
|
||||
mfxStatus Close () {m_bInit = false; return MFX_ERR_NONE;}
|
||||
mfxStatus GetFrameCtrl (mfxBRCFrameParam* par, mfxBRCFrameCtrl* ctrl);
|
||||
mfxStatus Update (mfxBRCFrameParam* par, mfxBRCFrameCtrl* ctrl, mfxBRCFrameStatus* status);
|
||||
protected:
|
||||
mfxI32 GetCurQP (mfxU32 type, mfxI32 layer);
|
||||
};
|
||||
|
||||
namespace HEVCExtBRC
|
||||
{
|
||||
inline mfxStatus Init (mfxHDL pthis, mfxVideoParam* par)
|
||||
{
|
||||
MFX_CHECK_NULL_PTR1(pthis);
|
||||
return ((ExtBRC*)pthis)->Init(par) ;
|
||||
}
|
||||
inline mfxStatus Reset (mfxHDL pthis, mfxVideoParam* par)
|
||||
{
|
||||
MFX_CHECK_NULL_PTR1(pthis);
|
||||
return ((ExtBRC*)pthis)->Reset(par) ;
|
||||
}
|
||||
inline mfxStatus Close (mfxHDL pthis)
|
||||
{
|
||||
MFX_CHECK_NULL_PTR1(pthis);
|
||||
return ((ExtBRC*)pthis)->Close() ;
|
||||
}
|
||||
inline mfxStatus GetFrameCtrl (mfxHDL pthis, mfxBRCFrameParam* par, mfxBRCFrameCtrl* ctrl)
|
||||
{
|
||||
MFX_CHECK_NULL_PTR1(pthis);
|
||||
return ((ExtBRC*)pthis)->GetFrameCtrl(par,ctrl) ;
|
||||
}
|
||||
inline mfxStatus Update (mfxHDL pthis, mfxBRCFrameParam* par, mfxBRCFrameCtrl* ctrl, mfxBRCFrameStatus* status)
|
||||
{
|
||||
MFX_CHECK_NULL_PTR1(pthis);
|
||||
return ((ExtBRC*)pthis)->Update(par,ctrl, status) ;
|
||||
}
|
||||
inline mfxStatus Create(mfxExtBRC & m_BRC)
|
||||
{
|
||||
MFX_CHECK(m_BRC.pthis == NULL, MFX_ERR_UNDEFINED_BEHAVIOR);
|
||||
m_BRC.pthis = new ExtBRC;
|
||||
m_BRC.Init = Init;
|
||||
m_BRC.Reset = Reset;
|
||||
m_BRC.Close = Close;
|
||||
m_BRC.GetFrameCtrl = GetFrameCtrl;
|
||||
m_BRC.Update = Update;
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
inline mfxStatus Destroy(mfxExtBRC & m_BRC)
|
||||
{
|
||||
if(m_BRC.pthis != NULL)
|
||||
{
|
||||
delete (ExtBRC*)m_BRC.pthis;
|
||||
m_BRC.pthis = 0;
|
||||
m_BRC.Init = 0;
|
||||
m_BRC.Reset = 0;
|
||||
m_BRC.Close = 0;
|
||||
m_BRC.GetFrameCtrl = 0;
|
||||
m_BRC.Update = 0;
|
||||
}
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
27
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/current_date.h
vendored
Normal file
27
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/current_date.h
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#define PRODUCT_NAME "Intel\xae Media SDK"
|
||||
#define FILE_VERSION 1,0,0,0
|
||||
#define FILE_VERSION_STRING "1,0,0,0"
|
||||
#define FILTER_NAME_PREFIX ""
|
||||
#define FILTER_NAME_SUFFIX ""
|
||||
#define PRODUCT_COPYRIGHT "Copyright\xa9 2003-2019 Intel Corporation"
|
||||
#define PRODUCT_VERSION 1,0,0,0
|
||||
#define PRODUCT_VERSION_STRING "1,0,0,0"
|
||||
263
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/d3d11_allocator.h
vendored
Normal file
263
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/d3d11_allocator.h
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#ifndef __D3D11_ALLOCATOR_H__
|
||||
#define __D3D11_ALLOCATOR_H__
|
||||
|
||||
#include "base_allocator.h"
|
||||
#include <limits>
|
||||
|
||||
#ifdef __gnu_linux__
|
||||
#include <stdint.h> // for uintptr_t on Linux
|
||||
#endif
|
||||
|
||||
//application can provide either generic mid from surface or this wrapper
|
||||
//wrapper distinguishes from generic mid by highest 1 bit
|
||||
//if it set then remained pointer points to extended structure of memid
|
||||
//64 bits system layout
|
||||
/*----+-----------------------------------------------------------+
|
||||
|b63=1|63 bits remained for pointer to extended structure of memid|
|
||||
|b63=0|63 bits from original mfxMemId |
|
||||
+-----+----------------------------------------------------------*/
|
||||
//32 bits system layout
|
||||
/*--+---+--------------------------------------------+
|
||||
|b31=1|31 bits remained for pointer to extended memid|
|
||||
|b31=0|31 bits remained for surface pointer |
|
||||
+---+---+-------------------------------------------*/
|
||||
//#pragma warning (disable:4293)
|
||||
class MFXReadWriteMid
|
||||
{
|
||||
static const uintptr_t bits_offset = std::numeric_limits<uintptr_t>::digits - 1;
|
||||
static const uintptr_t clear_mask = ~((uintptr_t)1 << bits_offset);
|
||||
public:
|
||||
enum
|
||||
{
|
||||
//if flag not set it means that read and write
|
||||
not_set = 0,
|
||||
reuse = 1,
|
||||
read = 2,
|
||||
write = 4,
|
||||
};
|
||||
//here mfxmemid might be as MFXReadWriteMid or mfxMemId memid
|
||||
MFXReadWriteMid(mfxMemId mid, mfxU8 flag = not_set)
|
||||
{
|
||||
//setup mid
|
||||
m_mid_to_report = (mfxMemId)((uintptr_t)&m_mid | ((uintptr_t)1 << bits_offset));
|
||||
if (0 != ((uintptr_t)mid >> bits_offset))
|
||||
{
|
||||
//it points to extended structure
|
||||
mfxMedIdEx * pMemIdExt = reinterpret_cast<mfxMedIdEx *>((uintptr_t)mid & clear_mask);
|
||||
m_mid.pId = pMemIdExt->pId;
|
||||
if (reuse == flag)
|
||||
{
|
||||
m_mid.read_write = pMemIdExt->read_write;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mid.read_write = flag;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mid.pId = mid;
|
||||
if (reuse == flag)
|
||||
m_mid.read_write = not_set;
|
||||
else
|
||||
m_mid.read_write = flag;
|
||||
}
|
||||
|
||||
}
|
||||
bool isRead() const
|
||||
{
|
||||
return 0 != (m_mid.read_write & read) || !m_mid.read_write;
|
||||
}
|
||||
bool isWrite() const
|
||||
{
|
||||
return 0 != (m_mid.read_write & write) || !m_mid.read_write;
|
||||
}
|
||||
/// returns original memid without read write flags
|
||||
mfxMemId raw() const
|
||||
{
|
||||
return m_mid.pId;
|
||||
}
|
||||
operator mfxMemId() const
|
||||
{
|
||||
return m_mid_to_report;
|
||||
}
|
||||
|
||||
private:
|
||||
struct mfxMedIdEx
|
||||
{
|
||||
mfxMemId pId;
|
||||
mfxU8 read_write;
|
||||
};
|
||||
|
||||
mfxMedIdEx m_mid;
|
||||
mfxMemId m_mid_to_report;
|
||||
};
|
||||
|
||||
#if (defined(_WIN32) || defined(_WIN64))
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
struct ID3D11VideoDevice;
|
||||
struct ID3D11VideoContext;
|
||||
|
||||
struct D3D11AllocatorParams : mfxAllocatorParams
|
||||
{
|
||||
ID3D11Device *pDevice;
|
||||
bool bUseSingleTexture;
|
||||
DWORD uncompressedResourceMiscFlags;
|
||||
|
||||
D3D11AllocatorParams()
|
||||
: pDevice()
|
||||
, bUseSingleTexture()
|
||||
, uncompressedResourceMiscFlags()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class D3D11FrameAllocator: public BaseFrameAllocator
|
||||
{
|
||||
public:
|
||||
|
||||
D3D11FrameAllocator();
|
||||
virtual ~D3D11FrameAllocator();
|
||||
|
||||
virtual mfxStatus Init(mfxAllocatorParams *pParams);
|
||||
virtual mfxStatus Close();
|
||||
virtual ID3D11Device * GetD3D11Device()
|
||||
{
|
||||
return m_initParams.pDevice;
|
||||
};
|
||||
virtual mfxStatus LockFrame(mfxMemId mid, mfxFrameData *ptr);
|
||||
virtual mfxStatus UnlockFrame(mfxMemId mid, mfxFrameData *ptr);
|
||||
virtual mfxStatus GetFrameHDL(mfxMemId mid, mfxHDL *handle);
|
||||
|
||||
protected:
|
||||
static DXGI_FORMAT ConverColortFormat(mfxU32 fourcc);
|
||||
virtual mfxStatus CheckRequestType(mfxFrameAllocRequest *request);
|
||||
virtual mfxStatus ReleaseResponse(mfxFrameAllocResponse *response);
|
||||
virtual mfxStatus AllocImpl(mfxFrameAllocRequest *request, mfxFrameAllocResponse *response);
|
||||
virtual mfxStatus ReallocImpl(mfxMemId midIn, const mfxFrameInfo *info, mfxU16 memType, mfxMemId *midOut);
|
||||
|
||||
D3D11AllocatorParams m_initParams;
|
||||
ID3D11DeviceContext *m_pDeviceContext;
|
||||
|
||||
struct TextureResource
|
||||
{
|
||||
std::vector<mfxMemId> outerMids;
|
||||
std::vector<ID3D11Texture2D*> textures;
|
||||
std::vector<ID3D11Texture2D*> stagingTexture;
|
||||
bool bAlloc;
|
||||
|
||||
TextureResource()
|
||||
: bAlloc(true)
|
||||
{
|
||||
}
|
||||
|
||||
static bool isAllocated (TextureResource & that)
|
||||
{
|
||||
return that.bAlloc;
|
||||
}
|
||||
ID3D11Texture2D* GetTexture(mfxMemId id)
|
||||
{
|
||||
if (outerMids.empty())
|
||||
return NULL;
|
||||
|
||||
return textures[((uintptr_t)id - (uintptr_t)outerMids.front()) % textures.size()];
|
||||
}
|
||||
UINT GetSubResource(mfxMemId id)
|
||||
{
|
||||
if (outerMids.empty())
|
||||
return NULL;
|
||||
|
||||
return (UINT)(((uintptr_t)id - (uintptr_t)outerMids.front()) / textures.size());
|
||||
}
|
||||
void Release()
|
||||
{
|
||||
size_t i = 0;
|
||||
for(i = 0; i < textures.size(); i++)
|
||||
{
|
||||
textures[i]->Release();
|
||||
}
|
||||
textures.clear();
|
||||
|
||||
for(i = 0; i < stagingTexture.size(); i++)
|
||||
{
|
||||
stagingTexture[i]->Release();
|
||||
}
|
||||
stagingTexture.clear();
|
||||
|
||||
//marking texture as deallocated
|
||||
bAlloc = false;
|
||||
}
|
||||
};
|
||||
class TextureSubResource
|
||||
{
|
||||
TextureResource * m_pTarget;
|
||||
ID3D11Texture2D * m_pTexture;
|
||||
ID3D11Texture2D * m_pStaging;
|
||||
UINT m_subResource;
|
||||
public:
|
||||
TextureSubResource(TextureResource * pTarget = NULL, mfxMemId id = 0)
|
||||
: m_pTarget(pTarget)
|
||||
, m_pTexture()
|
||||
, m_subResource()
|
||||
, m_pStaging(NULL)
|
||||
{
|
||||
if (NULL != m_pTarget && !m_pTarget->outerMids.empty())
|
||||
{
|
||||
ptrdiff_t idx = (uintptr_t)MFXReadWriteMid(id).raw() - (uintptr_t)m_pTarget->outerMids.front();
|
||||
m_pTexture = m_pTarget->textures[idx % m_pTarget->textures.size()];
|
||||
m_subResource = (UINT)(idx / m_pTarget->textures.size());
|
||||
m_pStaging = m_pTarget->stagingTexture.empty() ? NULL : m_pTarget->stagingTexture[idx];
|
||||
}
|
||||
}
|
||||
ID3D11Texture2D* GetStaging()const
|
||||
{
|
||||
return m_pStaging;
|
||||
}
|
||||
ID3D11Texture2D* GetTexture()const
|
||||
{
|
||||
return m_pTexture;
|
||||
}
|
||||
UINT GetSubResource()const
|
||||
{
|
||||
return m_subResource;
|
||||
}
|
||||
void Release()
|
||||
{
|
||||
if (NULL != m_pTarget)
|
||||
m_pTarget->Release();
|
||||
}
|
||||
};
|
||||
|
||||
TextureSubResource GetResourceFromMid(mfxMemId);
|
||||
|
||||
std::list <TextureResource> m_resourcesByRequest;//each alloc request generates new item in list
|
||||
|
||||
typedef std::list <TextureResource>::iterator referenceType;
|
||||
std::vector<referenceType> m_memIdMap;
|
||||
};
|
||||
|
||||
#endif // #if defined(_WIN32) || defined(_WIN64)
|
||||
#endif // __D3D11_ALLOCATOR_H__
|
||||
86
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/d3d11_device.h
vendored
Normal file
86
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/d3d11_device.h
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined( _WIN32 ) || defined ( _WIN64 )
|
||||
|
||||
#include "sample_defs.h" // defines MFX_D3D11_SUPPORT
|
||||
|
||||
#if MFX_D3D11_SUPPORT
|
||||
#include "hw_device.h"
|
||||
#include <windows.h>
|
||||
#include <d3d11.h>
|
||||
#include <atlbase.h>
|
||||
|
||||
#include <dxgi1_2.h>
|
||||
|
||||
class CD3D11Device: public CHWDevice
|
||||
{
|
||||
public:
|
||||
CD3D11Device();
|
||||
virtual ~CD3D11Device();
|
||||
virtual mfxStatus Init(
|
||||
mfxHDL hWindow,
|
||||
mfxU16 nViews,
|
||||
mfxU32 nAdapterNum);
|
||||
virtual mfxStatus Reset();
|
||||
virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *pHdl);
|
||||
virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl);
|
||||
virtual mfxStatus RenderFrame(mfxFrameSurface1 * pSurface, mfxFrameAllocator * pmfxAlloc);
|
||||
virtual void UpdateTitle(double /*fps*/) { }
|
||||
virtual void Close();
|
||||
void DefineFormat(bool isA2rgb10) { m_bIsA2rgb10 = (isA2rgb10) ? TRUE : FALSE; }
|
||||
virtual void SetMondelloInput(bool /*isMondelloInputEnabled*/ ) { }
|
||||
protected:
|
||||
virtual mfxStatus FillSCD(mfxHDL hWindow, DXGI_SWAP_CHAIN_DESC& scd);
|
||||
virtual mfxStatus FillSCD1(DXGI_SWAP_CHAIN_DESC1& scd);
|
||||
mfxStatus CreateVideoProcessor(mfxFrameSurface1 * pSrf);
|
||||
|
||||
CComPtr<ID3D11Device> m_pD3D11Device;
|
||||
CComPtr<ID3D11DeviceContext> m_pD3D11Ctx;
|
||||
CComQIPtr<ID3D11VideoDevice> m_pDX11VideoDevice;
|
||||
CComQIPtr<ID3D11VideoContext> m_pVideoContext;
|
||||
CComPtr<ID3D11VideoProcessorEnumerator> m_VideoProcessorEnum;
|
||||
|
||||
CComQIPtr<IDXGIDevice1> m_pDXGIDev;
|
||||
CComQIPtr<IDXGIAdapter> m_pAdapter;
|
||||
|
||||
CComPtr<IDXGIFactory2> m_pDXGIFactory;
|
||||
|
||||
CComPtr<IDXGISwapChain1> m_pSwapChain;
|
||||
CComPtr<ID3D11VideoProcessor> m_pVideoProcessor;
|
||||
|
||||
private:
|
||||
CComPtr<ID3D11VideoProcessorInputView> m_pInputViewLeft;
|
||||
CComPtr<ID3D11VideoProcessorInputView> m_pInputViewRight;
|
||||
CComPtr<ID3D11VideoProcessorOutputView> m_pOutputView;
|
||||
|
||||
CComPtr<ID3D11Texture2D> m_pDXGIBackBuffer;
|
||||
CComPtr<ID3D11Texture2D> m_pTempTexture;
|
||||
CComPtr<IDXGIDisplayControl> m_pDisplayControl;
|
||||
CComPtr<IDXGIOutput> m_pDXGIOutput;
|
||||
mfxU16 m_nViews;
|
||||
BOOL m_bDefaultStereoEnabled;
|
||||
BOOL m_bIsA2rgb10;
|
||||
HWND m_HandleWindow;
|
||||
};
|
||||
|
||||
#endif //#if defined( _WIN32 ) || defined ( _WIN64 )
|
||||
#endif //#if MFX_D3D11_SUPPORT
|
||||
86
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/d3d_allocator.h
vendored
Normal file
86
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/d3d_allocator.h
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#ifndef __D3D_ALLOCATOR_H__
|
||||
#define __D3D_ALLOCATOR_H__
|
||||
|
||||
#if defined( _WIN32 ) || defined ( _WIN64 )
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <d3d9.h>
|
||||
#include <dxva2api.h>
|
||||
#include "base_allocator.h"
|
||||
#include <vector>
|
||||
|
||||
enum eTypeHandle
|
||||
{
|
||||
DXVA2_PROCESSOR = 0x00,
|
||||
DXVA2_DECODER = 0x01
|
||||
};
|
||||
|
||||
struct D3DAllocatorParams : mfxAllocatorParams
|
||||
{
|
||||
IDirect3DDeviceManager9 *pManager;
|
||||
DWORD surfaceUsage;
|
||||
|
||||
D3DAllocatorParams()
|
||||
: pManager()
|
||||
, surfaceUsage()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class D3DFrameAllocator: public BaseFrameAllocator
|
||||
{
|
||||
public:
|
||||
D3DFrameAllocator();
|
||||
virtual ~D3DFrameAllocator();
|
||||
|
||||
virtual mfxStatus Init(mfxAllocatorParams *pParams);
|
||||
virtual mfxStatus Close();
|
||||
|
||||
virtual IDirect3DDeviceManager9* GetDeviceManager()
|
||||
{
|
||||
return m_manager;
|
||||
};
|
||||
|
||||
virtual mfxStatus LockFrame(mfxMemId mid, mfxFrameData *ptr);
|
||||
virtual mfxStatus UnlockFrame(mfxMemId mid, mfxFrameData *ptr);
|
||||
virtual mfxStatus GetFrameHDL(mfxMemId mid, mfxHDL *handle);
|
||||
|
||||
protected:
|
||||
virtual mfxStatus CheckRequestType(mfxFrameAllocRequest *request);
|
||||
virtual mfxStatus ReleaseResponse(mfxFrameAllocResponse *response);
|
||||
virtual mfxStatus AllocImpl(mfxFrameAllocRequest *request, mfxFrameAllocResponse *response);
|
||||
virtual mfxStatus ReallocImpl(mfxMemId midIn, const mfxFrameInfo *info, mfxU16 memType, mfxMemId *midOut);
|
||||
|
||||
void DeallocateMids(mfxHDLPair** pairs, int n);
|
||||
|
||||
std::vector<mfxHDLPair**> m_midsAllocated;
|
||||
|
||||
CComPtr<IDirect3DDeviceManager9> m_manager;
|
||||
CComPtr<IDirectXVideoDecoderService> m_decoderService;
|
||||
CComPtr<IDirectXVideoProcessorService> m_processorService;
|
||||
HANDLE m_hDecoder;
|
||||
HANDLE m_hProcessor;
|
||||
DWORD m_surfaceUsage;
|
||||
};
|
||||
|
||||
#endif // #if defined( _WIN32 ) || defined ( _WIN64 )
|
||||
#endif // __D3D_ALLOCATOR_H__
|
||||
88
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/d3d_device.h
vendored
Normal file
88
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/d3d_device.h
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined( _WIN32 ) || defined ( _WIN64 )
|
||||
|
||||
#include "hw_device.h"
|
||||
|
||||
#pragma warning(disable : 4201)
|
||||
#include <d3d9.h>
|
||||
#include <dxva2api.h>
|
||||
#include <dxva.h>
|
||||
#include <windows.h>
|
||||
|
||||
#define VIDEO_MAIN_FORMAT D3DFMT_YUY2
|
||||
|
||||
/** Direct3D 9 device implementation.
|
||||
@note Device always set D3DPRESENT_PARAMETERS::Windowed to TRUE.
|
||||
*/
|
||||
class CD3D9Device : public CHWDevice
|
||||
{
|
||||
public:
|
||||
CD3D9Device();
|
||||
virtual ~CD3D9Device();
|
||||
|
||||
virtual mfxStatus Init(
|
||||
mfxHDL hWindow,
|
||||
mfxU16 nViews,
|
||||
mfxU32 nAdapterNum);
|
||||
virtual mfxStatus Reset();
|
||||
virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *pHdl);
|
||||
virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl);
|
||||
virtual mfxStatus RenderFrame(mfxFrameSurface1 * pSurface, mfxFrameAllocator * pmfxAlloc);
|
||||
virtual void UpdateTitle(double /*fps*/) { }
|
||||
virtual void Close() ;
|
||||
void DefineFormat(bool isA2rgb10) { m_bIsA2rgb10 = (isA2rgb10) ? TRUE : FALSE; }
|
||||
virtual void SetMondelloInput(bool /*isMondelloInputEnabled*/) { }
|
||||
protected:
|
||||
mfxStatus CreateVideoProcessors();
|
||||
bool CheckOverlaySupport();
|
||||
virtual mfxStatus FillD3DPP(mfxHDL hWindow, mfxU16 nViews, D3DPRESENT_PARAMETERS &D3DPP);
|
||||
private:
|
||||
IDirect3D9Ex* m_pD3D9;
|
||||
IDirect3DDevice9Ex* m_pD3DD9;
|
||||
IDirect3DDeviceManager9* m_pDeviceManager9;
|
||||
D3DPRESENT_PARAMETERS m_D3DPP;
|
||||
UINT m_resetToken;
|
||||
|
||||
mfxU16 m_nViews;
|
||||
|
||||
D3DSURFACE_DESC m_backBufferDesc;
|
||||
|
||||
// service required to create video processors
|
||||
IDirectXVideoProcessorService* m_pDXVAVPS;
|
||||
//left channel processor
|
||||
IDirectXVideoProcessor* m_pDXVAVP_Left;
|
||||
// right channel processor
|
||||
IDirectXVideoProcessor* m_pDXVAVP_Right;
|
||||
|
||||
// target rectangle
|
||||
RECT m_targetRect;
|
||||
|
||||
// various structures for DXVA2 calls
|
||||
DXVA2_VideoDesc m_VideoDesc;
|
||||
DXVA2_VideoProcessBltParams m_BltParams;
|
||||
DXVA2_VideoSample m_Sample;
|
||||
|
||||
BOOL m_bIsA2rgb10;
|
||||
};
|
||||
|
||||
#endif // #if defined( _WIN32 ) || defined ( _WIN64 )
|
||||
109
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/decode_render.h
vendored
Normal file
109
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/decode_render.h
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
|
||||
#ifndef __DECODE_D3D_RENDER_H__
|
||||
#define __DECODE_D3D_RENDER_H__
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
#pragma warning(disable : 4201)
|
||||
#include <d3d9.h>
|
||||
#include <dxva2api.h>
|
||||
#include <dxva.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "mfxstructures.h"
|
||||
#include "mfxvideo.h"
|
||||
|
||||
#include "hw_device.h"
|
||||
|
||||
typedef void* WindowHandle;
|
||||
typedef void* Handle;
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
struct sWindowParams
|
||||
{
|
||||
LPCTSTR lpClassName;
|
||||
LPCTSTR lpWindowName;
|
||||
DWORD dwStyle;
|
||||
int nx;
|
||||
int ny;
|
||||
int ncell;
|
||||
int nAdapter;
|
||||
int nWidth;
|
||||
int nHeight;
|
||||
HWND hWndParent;
|
||||
HMENU hMenu;
|
||||
HINSTANCE hInstance;
|
||||
LPVOID lpParam;
|
||||
bool bFullScreen; // Stretch window to full screen
|
||||
};
|
||||
|
||||
class CDecodeD3DRender
|
||||
{
|
||||
public:
|
||||
|
||||
CDecodeD3DRender();
|
||||
virtual ~CDecodeD3DRender();
|
||||
|
||||
virtual mfxStatus Init(sWindowParams pWParams);
|
||||
virtual mfxStatus RenderFrame(mfxFrameSurface1 *pSurface, mfxFrameAllocator *pmfxAlloc);
|
||||
virtual VOID UpdateTitle(double fps);
|
||||
void Close();
|
||||
|
||||
HWND GetWindowHandle();
|
||||
|
||||
VOID OnDestroy(HWND hwnd);
|
||||
VOID OnKey(HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags);
|
||||
VOID ChangeWindowSize(bool bFullScreen);
|
||||
|
||||
void SetHWDevice(CHWDevice *dev)
|
||||
{
|
||||
m_hwdev = dev;
|
||||
}
|
||||
protected:
|
||||
void AdjustWindowRect(RECT *rect);
|
||||
|
||||
mfxStatus AllocateShiftedSurfaceIfNeeded(const mfxFrameSurface1* refSurface,mfxFrameAllocator* allocator);
|
||||
mfxFrameAllocResponse shiftSurfaceResponse;
|
||||
mfxFrameSurface1 shiftedSurface;
|
||||
mfxFrameAllocator* pAllocator;
|
||||
|
||||
CHWDevice *m_hwdev;
|
||||
|
||||
|
||||
sWindowParams m_sWindowParams;
|
||||
HWND m_Hwnd;
|
||||
RECT m_rect;
|
||||
DWORD m_style;
|
||||
|
||||
bool EnableDwmQueuing();
|
||||
static BOOL CALLBACK MonitorEnumProc(HMONITOR ,HDC ,LPRECT lprcMonitor,LPARAM dwData);
|
||||
static bool m_bIsMonitorFound;
|
||||
|
||||
bool m_bDwmEnabled;
|
||||
int m_nMonitorCurrent;
|
||||
::RECT m_RectWindow;
|
||||
};
|
||||
#endif // #if defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
#endif // __DECODE_D3D_RENDER_H__
|
||||
62
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/general_allocator.h
vendored
Normal file
62
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/general_allocator.h
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#ifndef __GENERAL_ALLOCATOR_H__
|
||||
#define __GENERAL_ALLOCATOR_H__
|
||||
|
||||
#include "sample_utils.h"
|
||||
#include "base_allocator.h"
|
||||
|
||||
#include <memory>
|
||||
#include <map>
|
||||
|
||||
class SysMemFrameAllocator;
|
||||
|
||||
// Wrapper on standard allocator for concurrent allocation of
|
||||
// D3D and system surfaces
|
||||
class GeneralAllocator : public BaseFrameAllocator
|
||||
{
|
||||
public:
|
||||
GeneralAllocator();
|
||||
virtual ~GeneralAllocator();
|
||||
|
||||
virtual mfxStatus Init(mfxAllocatorParams *pParams);
|
||||
virtual mfxStatus Close();
|
||||
|
||||
protected:
|
||||
virtual mfxStatus LockFrame(mfxMemId mid, mfxFrameData *ptr);
|
||||
virtual mfxStatus UnlockFrame(mfxMemId mid, mfxFrameData *ptr);
|
||||
virtual mfxStatus GetFrameHDL(mfxMemId mid, mfxHDL *handle);
|
||||
|
||||
virtual mfxStatus ReleaseResponse(mfxFrameAllocResponse *response);
|
||||
virtual mfxStatus AllocImpl(mfxFrameAllocRequest *request, mfxFrameAllocResponse *response);
|
||||
virtual mfxStatus ReallocImpl(mfxMemId midIn, const mfxFrameInfo *info, mfxU16 memType, mfxMemId *midOut);
|
||||
|
||||
void StoreFrameMids(bool isD3DFrames, mfxFrameAllocResponse *response);
|
||||
bool isD3DMid(mfxHDL mid);
|
||||
|
||||
std::map<mfxHDL, bool> m_Mids;
|
||||
std::unique_ptr<BaseFrameAllocator> m_D3DAllocator;
|
||||
std::unique_ptr<SysMemFrameAllocator> m_SYSAllocator;
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(GeneralAllocator);
|
||||
|
||||
};
|
||||
|
||||
#endif //__GENERAL_ALLOCATOR_H__
|
||||
50
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/hw_device.h
vendored
Normal file
50
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/hw_device.h
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mfxvideo++.h"
|
||||
|
||||
/// Base class for hw device
|
||||
class CHWDevice
|
||||
{
|
||||
public:
|
||||
virtual ~CHWDevice(){}
|
||||
/** Initializes device for requested processing.
|
||||
@param[in] hWindow Window handle to bundle device to.
|
||||
@param[in] nViews Number of views to process.
|
||||
@param[in] nAdapterNum Number of adapter to use
|
||||
*/
|
||||
virtual mfxStatus Init(
|
||||
mfxHDL hWindow,
|
||||
mfxU16 nViews,
|
||||
mfxU32 nAdapterNum) = 0;
|
||||
/// Reset device.
|
||||
virtual mfxStatus Reset() = 0;
|
||||
/// Get handle can be used for MFX session SetHandle calls
|
||||
virtual mfxStatus GetHandle(mfxHandleType type, mfxHDL *pHdl) = 0;
|
||||
/** Set handle.
|
||||
Particular device implementation may require other objects to operate.
|
||||
*/
|
||||
virtual mfxStatus SetHandle(mfxHandleType type, mfxHDL hdl) = 0;
|
||||
virtual mfxStatus RenderFrame(mfxFrameSurface1 * pSurface, mfxFrameAllocator * pmfxAlloc) = 0;
|
||||
virtual void UpdateTitle(double fps) = 0;
|
||||
virtual void SetMondelloInput(bool isMondelloInputEnabled) = 0;
|
||||
virtual void Close() = 0;
|
||||
};
|
||||
62
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/intrusive_ptr.h
vendored
Normal file
62
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/intrusive_ptr.h
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
//intrusive ptr concept
|
||||
//usage examples same as smart pointers except user has to define addref and release routine for that class
|
||||
|
||||
//inline void intrusive_ptr_addref(UserClassA * pResource);
|
||||
//inline void intrusive_ptr_release(UserClassA * pResource);
|
||||
|
||||
template <class T>
|
||||
class intrusive_ptr
|
||||
{
|
||||
T * m_pResource;
|
||||
public:
|
||||
intrusive_ptr(T* pResource = NULL)
|
||||
: m_pResource(pResource) {
|
||||
intrusive_ptr_addref(m_pResource);
|
||||
}
|
||||
intrusive_ptr(const intrusive_ptr<T> & rhs)
|
||||
: m_pResource(rhs.m_pResource) {
|
||||
intrusive_ptr_addref(m_pResource);
|
||||
}
|
||||
void reset(T* pResource) {
|
||||
if (m_pResource){
|
||||
intrusive_ptr_release(m_pResource);
|
||||
}
|
||||
m_pResource = pResource;
|
||||
intrusive_ptr_addref(m_pResource);
|
||||
}
|
||||
T* operator *() {
|
||||
return m_pResource;
|
||||
}
|
||||
T* operator ->() {
|
||||
return m_pResource;
|
||||
}
|
||||
T* get(){
|
||||
return m_pResource;
|
||||
}
|
||||
~intrusive_ptr(){
|
||||
if (m_pResource) {
|
||||
intrusive_ptr_release(m_pResource);
|
||||
}
|
||||
}
|
||||
};
|
||||
399
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/mfx_buffering.h
vendored
Normal file
399
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/mfx_buffering.h
vendored
Normal file
@@ -0,0 +1,399 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#ifndef __MFX_BUFFERING_H__
|
||||
#define __MFX_BUFFERING_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <mutex>
|
||||
|
||||
#include "mfxstructures.h"
|
||||
|
||||
#include "vm/strings_defs.h"
|
||||
#include "vm/thread_defs.h"
|
||||
#include "vm/time_defs.h"
|
||||
#include "vm/atomic_defs.h"
|
||||
|
||||
struct msdkFrameSurface
|
||||
{
|
||||
mfxFrameSurface1 frame; // NOTE: this _should_ be the first item (see CBuffering::FindUsedSurface())
|
||||
msdk_tick submit; // tick when frame was submitted for processing
|
||||
mfxU16 render_lock; // signifies that frame is locked for rendering
|
||||
msdkFrameSurface* prev;
|
||||
msdkFrameSurface* next;
|
||||
};
|
||||
|
||||
struct msdkOutputSurface
|
||||
{
|
||||
msdkFrameSurface* surface;
|
||||
mfxSyncPoint syncp;
|
||||
msdkOutputSurface* next;
|
||||
};
|
||||
|
||||
/** \brief Debug purpose macro to terminate execution if buggy situation happenned.
|
||||
*
|
||||
* Use this macro to check impossible, buggy condition which should not occur under
|
||||
* normal circumstances. Macro should be used where check in release mode is not
|
||||
* desirable and atually needed.
|
||||
*/
|
||||
#define MSDK_SELF_CHECK(C)
|
||||
|
||||
class CBuffering;
|
||||
|
||||
// LIFO list of frame surfaces
|
||||
class msdkFreeSurfacesPool
|
||||
{
|
||||
friend class CBuffering;
|
||||
public:
|
||||
msdkFreeSurfacesPool(std::mutex & mutex):
|
||||
m_pSurfaces(NULL),
|
||||
m_rMutex(mutex) {}
|
||||
|
||||
~msdkFreeSurfacesPool() {
|
||||
m_pSurfaces = NULL;
|
||||
}
|
||||
/** \brief The function adds free surface to the free surfaces array.
|
||||
*
|
||||
* @note That's caller responsibility to pass valid surface.
|
||||
* @note We always add and get free surface from the array head. In case not all surfaces
|
||||
* will be actually used we have good chance to avoid actual allocation of the surface memory.
|
||||
*/
|
||||
inline void AddSurface(msdkFrameSurface* surface) {
|
||||
std::lock_guard<std::mutex> lock(m_rMutex);
|
||||
AddSurfaceUnsafe(surface);
|
||||
}
|
||||
/** \brief The function gets the next free surface from the free surfaces array.
|
||||
*
|
||||
* @note Surface is detached from the free surfaces array.
|
||||
*/
|
||||
inline msdkFrameSurface* GetSurface() {
|
||||
std::lock_guard<std::mutex> lock(m_rMutex);
|
||||
return GetSurfaceUnsafe();
|
||||
}
|
||||
|
||||
private:
|
||||
inline void AddSurfaceUnsafe(msdkFrameSurface* surface) {
|
||||
msdkFrameSurface* head;
|
||||
|
||||
MSDK_SELF_CHECK(surface);
|
||||
MSDK_SELF_CHECK(!surface->prev);
|
||||
MSDK_SELF_CHECK(!surface->next);
|
||||
|
||||
head = m_pSurfaces;
|
||||
m_pSurfaces = surface;
|
||||
m_pSurfaces->next = head;
|
||||
}
|
||||
inline msdkFrameSurface* GetSurfaceUnsafe() {
|
||||
|
||||
msdkFrameSurface* surface = NULL;
|
||||
|
||||
if (m_pSurfaces) {
|
||||
surface = m_pSurfaces;
|
||||
m_pSurfaces = m_pSurfaces->next;
|
||||
surface->prev = surface->next = NULL;
|
||||
MSDK_SELF_CHECK(!surface->prev);
|
||||
MSDK_SELF_CHECK(!surface->next);
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
protected:
|
||||
msdkFrameSurface* m_pSurfaces;
|
||||
std::mutex & m_rMutex;
|
||||
|
||||
private:
|
||||
msdkFreeSurfacesPool(const msdkFreeSurfacesPool&);
|
||||
void operator=(const msdkFreeSurfacesPool&);
|
||||
};
|
||||
|
||||
// random access, predicted as FIFO
|
||||
class msdkUsedSurfacesPool
|
||||
{
|
||||
friend class CBuffering;
|
||||
public:
|
||||
msdkUsedSurfacesPool(std::mutex & mutex):
|
||||
m_pSurfacesHead(NULL),
|
||||
m_pSurfacesTail(NULL),
|
||||
m_rMutex(mutex) {}
|
||||
|
||||
~msdkUsedSurfacesPool() {
|
||||
m_pSurfacesHead = NULL;
|
||||
m_pSurfacesTail = NULL;
|
||||
}
|
||||
|
||||
/** \brief The function adds surface to the used surfaces array (m_pUsedSurfaces).
|
||||
*
|
||||
* @note That's caller responsibility to pass valid surface.
|
||||
* @note We can't actually know which surface will be returned by the decoder or unlocked. However,
|
||||
* we can make prediction that it will be the oldest surface. Thus, here the function adds new
|
||||
* surface (youngest) to the tail of the least. Check operations for the list will run starting from
|
||||
* head.
|
||||
*/
|
||||
inline void AddSurface(msdkFrameSurface* surface) {
|
||||
std::lock_guard<std::mutex> lock(m_rMutex);
|
||||
AddSurfaceUnsafe(surface);
|
||||
}
|
||||
|
||||
/** \brief The function detaches surface from the used surfaces array.
|
||||
*
|
||||
* @note That's caller responsibility to pass valid surface.
|
||||
*/
|
||||
|
||||
inline void DetachSurface(msdkFrameSurface* surface) {
|
||||
std::lock_guard<std::mutex> lock(m_rMutex);
|
||||
DetachSurfaceUnsafe(surface);
|
||||
}
|
||||
|
||||
private:
|
||||
inline void DetachSurfaceUnsafe(msdkFrameSurface* surface)
|
||||
{
|
||||
MSDK_SELF_CHECK(surface);
|
||||
|
||||
msdkFrameSurface *prev = surface->prev;
|
||||
msdkFrameSurface *next = surface->next;
|
||||
|
||||
if (prev) {
|
||||
prev->next = next;
|
||||
}
|
||||
else {
|
||||
MSDK_SELF_CHECK(surface == m_pSurfacesHead);
|
||||
m_pSurfacesHead = next;
|
||||
}
|
||||
if (next) {
|
||||
next->prev = prev;
|
||||
} else {
|
||||
MSDK_SELF_CHECK(surface == m_pSurfacesTail);
|
||||
m_pSurfacesTail = prev;
|
||||
}
|
||||
|
||||
surface->prev = surface->next = NULL;
|
||||
MSDK_SELF_CHECK(!surface->prev);
|
||||
MSDK_SELF_CHECK(!surface->next);
|
||||
}
|
||||
inline void AddSurfaceUnsafe(msdkFrameSurface* surface)
|
||||
{
|
||||
MSDK_SELF_CHECK(surface);
|
||||
MSDK_SELF_CHECK(!surface->prev);
|
||||
MSDK_SELF_CHECK(!surface->next);
|
||||
|
||||
surface->prev = m_pSurfacesTail;
|
||||
surface->next = NULL;
|
||||
if (m_pSurfacesTail) {
|
||||
m_pSurfacesTail->next = surface;
|
||||
m_pSurfacesTail = m_pSurfacesTail->next;
|
||||
} else {
|
||||
m_pSurfacesHead = m_pSurfacesTail = surface;
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
msdkFrameSurface* m_pSurfacesHead; // oldest surface
|
||||
msdkFrameSurface* m_pSurfacesTail; // youngest surface
|
||||
std::mutex & m_rMutex;
|
||||
|
||||
private:
|
||||
msdkUsedSurfacesPool(const msdkUsedSurfacesPool&);
|
||||
void operator=(const msdkUsedSurfacesPool&);
|
||||
};
|
||||
|
||||
// FIFO list of surfaces
|
||||
class msdkOutputSurfacesPool
|
||||
{
|
||||
friend class CBuffering;
|
||||
public:
|
||||
msdkOutputSurfacesPool(std::mutex & mutex):
|
||||
m_pSurfacesHead(NULL),
|
||||
m_pSurfacesTail(NULL),
|
||||
m_SurfacesCount(0),
|
||||
m_rMutex(mutex) {}
|
||||
|
||||
~msdkOutputSurfacesPool() {
|
||||
m_pSurfacesHead = NULL;
|
||||
m_pSurfacesTail = NULL;
|
||||
}
|
||||
|
||||
inline void AddSurface(msdkOutputSurface* surface) {
|
||||
std::lock_guard<std::mutex> lock(m_rMutex);
|
||||
AddSurfaceUnsafe(surface);
|
||||
}
|
||||
inline msdkOutputSurface* GetSurface() {
|
||||
std::lock_guard<std::mutex> lock(m_rMutex);
|
||||
return GetSurfaceUnsafe();
|
||||
}
|
||||
|
||||
inline mfxU32 GetSurfaceCount() {
|
||||
return m_SurfacesCount;
|
||||
}
|
||||
private:
|
||||
inline void AddSurfaceUnsafe(msdkOutputSurface* surface)
|
||||
{
|
||||
MSDK_SELF_CHECK(surface);
|
||||
MSDK_SELF_CHECK(!surface->next);
|
||||
surface->next = NULL;
|
||||
|
||||
if (m_pSurfacesTail) {
|
||||
m_pSurfacesTail->next = surface;
|
||||
m_pSurfacesTail = m_pSurfacesTail->next;
|
||||
} else {
|
||||
m_pSurfacesHead = m_pSurfacesTail = surface;
|
||||
}
|
||||
++m_SurfacesCount;
|
||||
}
|
||||
inline msdkOutputSurface* GetSurfaceUnsafe()
|
||||
{
|
||||
msdkOutputSurface* surface = NULL;
|
||||
|
||||
if (m_pSurfacesHead) {
|
||||
surface = m_pSurfacesHead;
|
||||
m_pSurfacesHead = m_pSurfacesHead->next;
|
||||
if (!m_pSurfacesHead) {
|
||||
// there was only one surface in the array...
|
||||
m_pSurfacesTail = NULL;
|
||||
}
|
||||
--m_SurfacesCount;
|
||||
surface->next = NULL;
|
||||
MSDK_SELF_CHECK(!surface->next);
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
protected:
|
||||
msdkOutputSurface* m_pSurfacesHead; // oldest surface
|
||||
msdkOutputSurface* m_pSurfacesTail; // youngest surface
|
||||
mfxU32 m_SurfacesCount;
|
||||
std::mutex & m_rMutex;
|
||||
|
||||
private:
|
||||
msdkOutputSurfacesPool(const msdkOutputSurfacesPool&);
|
||||
void operator=(const msdkOutputSurfacesPool&);
|
||||
};
|
||||
|
||||
/** \brief Helper class defining optimal buffering operations for the Media SDK decoder.
|
||||
*/
|
||||
class CBuffering
|
||||
{
|
||||
public:
|
||||
CBuffering();
|
||||
virtual ~CBuffering();
|
||||
|
||||
protected: // functions
|
||||
mfxStatus AllocBuffers(mfxU32 SurfaceNumber);
|
||||
mfxStatus AllocVppBuffers(mfxU32 VppSurfaceNumber);
|
||||
void AllocOutputBuffer();
|
||||
void FreeBuffers();
|
||||
void ResetBuffers();
|
||||
void ResetVppBuffers();
|
||||
|
||||
/** \brief The function syncs arrays of free and used surfaces.
|
||||
*
|
||||
* If Media SDK used surface for internal needs and unlocked it, the function moves such a surface
|
||||
* back to the free surfaces array.
|
||||
*/
|
||||
void SyncFrameSurfaces();
|
||||
void SyncVppFrameSurfaces();
|
||||
|
||||
/** \brief Returns surface which corresponds to the given one in Media SDK format (mfxFrameSurface1).
|
||||
*
|
||||
* @note This function will not detach the surface from the array, perform this explicitly.
|
||||
*/
|
||||
inline msdkFrameSurface* FindUsedSurface(mfxFrameSurface1* frame)
|
||||
{
|
||||
return (msdkFrameSurface*)(frame);
|
||||
}
|
||||
|
||||
inline void AddFreeOutputSurfaceUnsafe(msdkOutputSurface* surface)
|
||||
{
|
||||
msdkOutputSurface* head = m_pFreeOutputSurfaces;
|
||||
|
||||
MSDK_SELF_CHECK(surface);
|
||||
MSDK_SELF_CHECK(!surface->next);
|
||||
m_pFreeOutputSurfaces = surface;
|
||||
m_pFreeOutputSurfaces->next = head;
|
||||
}
|
||||
inline void AddFreeOutputSurface(msdkOutputSurface* surface) {
|
||||
std::lock_guard<std::mutex> lock(m_Mutex);
|
||||
AddFreeOutputSurfaceUnsafe(surface);
|
||||
}
|
||||
|
||||
inline msdkOutputSurface* GetFreeOutputSurfaceUnsafe(std::unique_lock<std::mutex> & lock)
|
||||
{
|
||||
msdkOutputSurface* surface = NULL;
|
||||
|
||||
if (!m_pFreeOutputSurfaces) {
|
||||
lock.unlock();
|
||||
AllocOutputBuffer();
|
||||
lock.lock();
|
||||
}
|
||||
if (m_pFreeOutputSurfaces) {
|
||||
surface = m_pFreeOutputSurfaces;
|
||||
m_pFreeOutputSurfaces = m_pFreeOutputSurfaces->next;
|
||||
surface->next = NULL;
|
||||
MSDK_SELF_CHECK(!surface->next);
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
inline msdkOutputSurface* GetFreeOutputSurface() {
|
||||
std::unique_lock<std::mutex> lock(m_Mutex);
|
||||
return GetFreeOutputSurfaceUnsafe(lock);
|
||||
}
|
||||
|
||||
/** \brief Function returns surface data to the corresponding buffers.
|
||||
*/
|
||||
inline void ReturnSurfaceToBuffers(msdkOutputSurface* output_surface)
|
||||
{
|
||||
MSDK_SELF_CHECK(output_surface);
|
||||
MSDK_SELF_CHECK(output_surface->surface);
|
||||
MSDK_SELF_CHECK(output_surface->syncp);
|
||||
|
||||
msdk_atomic_dec16(&(output_surface->surface->render_lock));
|
||||
|
||||
output_surface->surface = NULL;
|
||||
output_surface->syncp = NULL;
|
||||
|
||||
AddFreeOutputSurface(output_surface);
|
||||
}
|
||||
|
||||
protected: // variables
|
||||
mfxU32 m_SurfacesNumber;
|
||||
mfxU32 m_OutputSurfacesNumber;
|
||||
msdkFrameSurface* m_pSurfaces;
|
||||
msdkFrameSurface* m_pVppSurfaces;
|
||||
std::mutex m_Mutex;
|
||||
|
||||
// LIFO list of frame surfaces
|
||||
msdkFreeSurfacesPool m_FreeSurfacesPool;
|
||||
msdkFreeSurfacesPool m_FreeVppSurfacesPool;
|
||||
|
||||
// random access, predicted as FIFO
|
||||
msdkUsedSurfacesPool m_UsedSurfacesPool;
|
||||
msdkUsedSurfacesPool m_UsedVppSurfacesPool;
|
||||
|
||||
// LIFO list of output surfaces
|
||||
msdkOutputSurface* m_pFreeOutputSurfaces;
|
||||
|
||||
// FIFO list of surfaces
|
||||
msdkOutputSurfacesPool m_OutputSurfacesPool;
|
||||
msdkOutputSurfacesPool m_DeliveredSurfacesPool;
|
||||
|
||||
private:
|
||||
CBuffering(const CBuffering&);
|
||||
void operator=(const CBuffering&);
|
||||
};
|
||||
|
||||
#endif // __MFX_BUFFERING_H__
|
||||
59
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/mfx_itt_trace.h
vendored
Normal file
59
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/mfx_itt_trace.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#ifndef __MFX_ITT_TRACE_H__
|
||||
#define __MFX_ITT_TRACE_H__
|
||||
|
||||
#ifdef ITT_SUPPORT
|
||||
#include <ittnotify.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ITT_SUPPORT
|
||||
|
||||
static inline __itt_domain* mfx_itt_get_domain() {
|
||||
static __itt_domain *domain = NULL;
|
||||
|
||||
if (!domain) domain = __itt_domain_create("MFX_SAMPLES");
|
||||
return domain;
|
||||
}
|
||||
|
||||
class MFX_ITT_Tracer
|
||||
{
|
||||
public:
|
||||
MFX_ITT_Tracer(const char* trace_name)
|
||||
{
|
||||
m_domain = mfx_itt_get_domain();
|
||||
if (m_domain)
|
||||
__itt_task_begin(m_domain, __itt_null, __itt_null, __itt_string_handle_create(trace_name));
|
||||
}
|
||||
~MFX_ITT_Tracer()
|
||||
{
|
||||
if (m_domain) __itt_task_end(m_domain);
|
||||
}
|
||||
private:
|
||||
__itt_domain* m_domain;
|
||||
};
|
||||
#define MFX_ITT_TASK(x) MFX_ITT_Tracer __mfx_itt_tracer(x);
|
||||
|
||||
#else
|
||||
#define MFX_ITT_TASK(x)
|
||||
#endif
|
||||
|
||||
#endif //__MFX_ITT_TRACE_H__
|
||||
27
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/mfx_plugin_base.h
vendored
Normal file
27
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/mfx_plugin_base.h
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <mfxplugin++.h>
|
||||
|
||||
typedef MFXDecoderPlugin* (*mfxCreateDecoderPlugin)();
|
||||
typedef MFXEncoderPlugin* (*mfxCreateEncoderPlugin)();
|
||||
typedef MFXGenericPlugin* (*mfxCreateGenericPlugin)();
|
||||
40
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/mfx_plugin_module.h
vendored
Normal file
40
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/mfx_plugin_module.h
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "mfxplugin++.h"
|
||||
|
||||
struct PluginModuleTemplate {
|
||||
typedef MFXDecoderPlugin* (*fncCreateDecoderPlugin)();
|
||||
typedef MFXEncoderPlugin* (*fncCreateEncoderPlugin)();
|
||||
typedef MFXAudioDecoderPlugin* (*fncCreateAudioDecoderPlugin)();
|
||||
typedef MFXAudioEncoderPlugin* (*fncCreateAudioEncoderPlugin)();
|
||||
typedef MFXGenericPlugin* (*fncCreateGenericPlugin)();
|
||||
typedef mfxStatus (MFX_CDECL *CreatePluginPtr_t)(mfxPluginUID uid, mfxPlugin* plugin);
|
||||
|
||||
fncCreateDecoderPlugin CreateDecoderPlugin;
|
||||
fncCreateEncoderPlugin CreateEncoderPlugin;
|
||||
fncCreateGenericPlugin CreateGenericPlugin;
|
||||
CreatePluginPtr_t CreatePlugin;
|
||||
fncCreateAudioDecoderPlugin CreateAudioDecoderPlugin;
|
||||
fncCreateAudioEncoderPlugin CreateAudioEncoderPlugin;
|
||||
};
|
||||
|
||||
extern PluginModuleTemplate g_PluginModule;
|
||||
23
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/mfx_samples_config.h
vendored
Normal file
23
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/mfx_samples_config.h
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#ifndef __MFX_SAMPLES_CONFIG__
|
||||
#define __MFX_SAMPLES_CONFIG__
|
||||
|
||||
#endif //__MFX_SAMPLES_CONFIG__
|
||||
73
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/parameters_dumper.h
vendored
Normal file
73
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/parameters_dumper.h
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#ifndef __PARAMETERS_DUMPER_H__
|
||||
#define __PARAMETERS_DUMPER_H__
|
||||
#include "sample_defs.h"
|
||||
|
||||
class CParametersDumper
|
||||
{
|
||||
protected:
|
||||
static void SerializeFrameInfoStruct(msdk_ostream& sstr,msdk_string prefix,mfxFrameInfo& info);
|
||||
static void SerializeMfxInfoMFXStruct(msdk_ostream& sstr,msdk_string prefix,mfxInfoMFX& info);
|
||||
static void SerializeExtensionBuffer(msdk_ostream& sstr,msdk_string prefix,mfxExtBuffer* pExtBuffer);
|
||||
static void SerializeVPPCompInputStream(msdk_ostream& sstr, msdk_string prefix, mfxVPPCompInputStream& info);
|
||||
|
||||
template <class T>
|
||||
static mfxStatus GetUnitParams(T* pMfxUnit, const mfxVideoParam* pPresetParams, mfxVideoParam* pOutParams)
|
||||
{
|
||||
memset(pOutParams,0, sizeof(mfxVideoParam));
|
||||
mfxExtBuffer** paramsArray = new mfxExtBuffer*[pPresetParams->NumExtParam];
|
||||
for (int paramNum = 0; paramNum < pPresetParams->NumExtParam; paramNum++)
|
||||
{
|
||||
mfxExtBuffer* buf = pPresetParams->ExtParam[paramNum];
|
||||
mfxExtBuffer* newBuf = (mfxExtBuffer*)new mfxU8[buf->BufferSz];
|
||||
memset(newBuf, 0, buf->BufferSz);
|
||||
newBuf->BufferId = buf->BufferId;
|
||||
newBuf->BufferSz = buf->BufferSz;
|
||||
paramsArray[paramNum]=newBuf;
|
||||
}
|
||||
pOutParams->NumExtParam = pPresetParams->NumExtParam;
|
||||
pOutParams->ExtParam = paramsArray;
|
||||
|
||||
mfxStatus sts = pMfxUnit->GetVideoParam(pOutParams);
|
||||
MSDK_CHECK_STATUS_SAFE(sts, "Cannot read configuration from encoder: GetVideoParam failed", ClearExtBuffs(pOutParams));
|
||||
|
||||
return MFX_ERR_NONE;
|
||||
}
|
||||
|
||||
static void ClearExtBuffs(mfxVideoParam* params)
|
||||
{
|
||||
// Cleaning params array
|
||||
for (int paramNum = 0; paramNum < params->NumExtParam; paramNum++)
|
||||
{
|
||||
delete[] params->ExtParam[paramNum];
|
||||
}
|
||||
delete[] params->ExtParam;
|
||||
params->ExtParam = NULL;
|
||||
params->NumExtParam = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
static void SerializeVideoParamStruct(msdk_ostream& sstr,msdk_string sectionName,mfxVideoParam& info,bool shouldUseVPPSection=false);
|
||||
static mfxStatus DumpLibraryConfiguration(msdk_string fileName, MFXVideoDECODE* pMfxDec, MFXVideoVPP* pMfxVPP, MFXVideoENCODE* pMfxEnc,
|
||||
const mfxVideoParam* pDecoderPresetParams, const mfxVideoParam* pVPPPresetParams, const mfxVideoParam* pEncoderPresetParams);
|
||||
static void ShowConfigurationDiff(msdk_ostream& sstr1, msdk_ostream& sstr2);
|
||||
};
|
||||
#endif
|
||||
261
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/plugin_loader.h
vendored
Normal file
261
libs/hwcodec/externals/MediaSDK_22.5.4/samples/sample_common/include/plugin_loader.h
vendored
Normal file
@@ -0,0 +1,261 @@
|
||||
/******************************************************************************\
|
||||
Copyright (c) 2005-2019, 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:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. Neither the name of the copyright holder 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
|
||||
This sample was distributed or derived from the Intel's Media Samples package.
|
||||
The original version of this sample may be obtained from https://software.intel.com/en-us/intel-media-server-studio
|
||||
or https://software.intel.com/en-us/media-client-solutions-support.
|
||||
\**********************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __PLUGIN_LOADER_H__
|
||||
#define __PLUGIN_LOADER_H__
|
||||
|
||||
#include "vm/so_defs.h"
|
||||
#include "sample_utils.h"
|
||||
#include "plugin_utils.h"
|
||||
//#include "mfx_plugin_module.h"
|
||||
#include <iostream>
|
||||
#include <iomanip> // for std::setfill, std::setw
|
||||
#include <memory> // for std::unique_ptr
|
||||
|
||||
class MsdkSoModule
|
||||
{
|
||||
protected:
|
||||
msdk_so_handle m_module;
|
||||
public:
|
||||
MsdkSoModule()
|
||||
: m_module(NULL)
|
||||
{
|
||||
}
|
||||
MsdkSoModule(const msdk_string & pluginName)
|
||||
: m_module(NULL)
|
||||
{
|
||||
m_module = msdk_so_load(pluginName.c_str());
|
||||
if (NULL == m_module)
|
||||
{
|
||||
MSDK_TRACE_ERROR(msdk_tstring(MSDK_CHAR("Failed to load shared module: ")) + pluginName);
|
||||
}
|
||||
}
|
||||
template <class T>
|
||||
T GetAddr(const std::string & fncName)
|
||||
{
|
||||
T pCreateFunc = reinterpret_cast<T>(msdk_so_get_addr(m_module, fncName.c_str()));
|
||||
if (NULL == pCreateFunc) {
|
||||
MSDK_TRACE_ERROR(msdk_tstring("Failed to get function addres: ") + fncName.c_str());
|
||||
}
|
||||
return pCreateFunc;
|
||||
}
|
||||
|
||||
virtual ~MsdkSoModule()
|
||||
{
|
||||
if (m_module)
|
||||
{
|
||||
msdk_so_free(m_module);
|
||||
m_module = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Rationale: class to load+register any mediasdk plugin decoder/encoder/generic by given name
|
||||
*/
|
||||
class PluginLoader : public MFXPlugin
|
||||
{
|
||||
protected:
|
||||
mfxPluginType ePluginType;
|
||||
|
||||
mfxSession m_session;
|
||||
mfxPluginUID m_uid;
|
||||
|
||||
private:
|
||||
const msdk_char* msdkGetPluginName(const mfxPluginUID& guid)
|
||||
{
|
||||
if (AreGuidsEqual(guid, MFX_PLUGINID_HEVCD_SW))
|
||||
return MSDK_STRING("Intel (R) Media SDK plugin for HEVC DECODE");
|
||||
else if(AreGuidsEqual(guid, MFX_PLUGINID_HEVCD_HW))
|
||||
return MSDK_STRING("Intel (R) Media SDK HW plugin for HEVC DECODE");
|
||||
else if(AreGuidsEqual(guid, MFX_PLUGINID_HEVCE_SW))
|
||||
return MSDK_STRING("Intel (R) Media SDK plugin for HEVC ENCODE");
|
||||
else if(AreGuidsEqual(guid, MFX_PLUGINID_HEVCE_HW))
|
||||
return MSDK_STRING("Intel (R) Media SDK HW plugin for HEVC ENCODE");
|
||||
else if(AreGuidsEqual(guid, MFX_PLUGINID_VP8E_HW))
|
||||
return MSDK_STRING("Intel (R) Media SDK HW plugin for VP8 ENCODE");
|
||||
else if(AreGuidsEqual(guid, MFX_PLUGINID_VP8D_HW))
|
||||
return MSDK_STRING("Intel (R) Media SDK HW plugin for VP8 DECODE");
|
||||
else if(AreGuidsEqual(guid, MFX_PLUGINID_VP9E_HW))
|
||||
return MSDK_STRING("Intel (R) Media SDK HW plugin for VP9 ENCODE");
|
||||
else if(AreGuidsEqual(guid, MFX_PLUGINID_VP9D_HW))
|
||||
return MSDK_STRING("Intel (R) Media SDK HW plugin for VP9 DECODE");
|
||||
else if(AreGuidsEqual(guid, MFX_PLUGINID_H264LA_HW))
|
||||
return MSDK_STRING("Intel (R) Media SDK plugin for LA ENC");
|
||||
else if(AreGuidsEqual(guid, MFX_PLUGINID_ITELECINE_HW))
|
||||
return MSDK_STRING("Intel (R) Media SDK PTIR plugin (HW)");
|
||||
else if (AreGuidsEqual(guid, MFX_PLUGINID_HEVCE_GACC))
|
||||
return MSDK_STRING("Intel (R) Media SDK GPU-Accelerated plugin for HEVC ENCODE");
|
||||
else
|
||||
#if (MFX_VERSION >= 1027) && !defined(_WIN32) && !defined(_WIN64)
|
||||
if (AreGuidsEqual(guid, MFX_PLUGINID_HEVC_FEI_ENCODE))
|
||||
return MSDK_STRING("Intel (R) Media SDK HW plugin for HEVC FEI ENCODE");
|
||||
else
|
||||
#endif
|
||||
return MSDK_STRING("Unknown plugin");
|
||||
}
|
||||
|
||||
public:
|
||||
PluginLoader(mfxPluginType type, mfxSession session, const mfxPluginUID & uid, mfxU32 version, const mfxChar *pluginName, mfxU32 len)
|
||||
: ePluginType(type)
|
||||
, m_session()
|
||||
, m_uid()
|
||||
{
|
||||
mfxStatus sts = MFX_ERR_NONE;
|
||||
msdk_stringstream strStream;
|
||||
|
||||
MSDK_MEMCPY(&m_uid, &uid, sizeof(mfxPluginUID));
|
||||
for (size_t i = 0; i != sizeof(mfxPluginUID); i++)
|
||||
{
|
||||
strStream << MSDK_STRING("0x") << std::setfill(MSDK_CHAR('0')) << std::setw(2) << std::hex << (int)m_uid.Data[i];
|
||||
if (i != (sizeof(mfxPluginUID)-1)) strStream << MSDK_STRING(", ");
|
||||
}
|
||||
|
||||
if ((ePluginType == MFX_PLUGINTYPE_AUDIO_DECODE) ||
|
||||
(ePluginType == MFX_PLUGINTYPE_AUDIO_ENCODE))
|
||||
{
|
||||
// Audio plugins are not loaded by path
|
||||
sts = MFX_ERR_UNSUPPORTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
sts = MFXVideoUSER_LoadByPath(session, &m_uid, version, pluginName, len);
|
||||
}
|
||||
|
||||
if (MFX_ERR_NONE != sts)
|
||||
{
|
||||
MSDK_TRACE_ERROR(MSDK_STRING("Failed to load plugin from GUID, sts=") << sts << MSDK_STRING(": { ") << strStream.str().c_str() << MSDK_STRING(" } (") << msdkGetPluginName(m_uid) << MSDK_STRING(")"));
|
||||
}
|
||||
else
|
||||
{
|
||||
MSDK_TRACE_INFO(MSDK_STRING("Plugin was loaded from GUID"));
|
||||
m_session = session;
|
||||
}
|
||||
}
|
||||
|
||||
PluginLoader(mfxPluginType type, mfxSession session, const mfxPluginUID & uid, mfxU32 version)
|
||||
: ePluginType(type)
|
||||
, m_session()
|
||||
, m_uid()
|
||||
{
|
||||
mfxStatus sts = MFX_ERR_NONE;
|
||||
msdk_stringstream strStream;
|
||||
|
||||
MSDK_MEMCPY(&m_uid, &uid, sizeof(mfxPluginUID));
|
||||
for (size_t i = 0; i != sizeof(mfxPluginUID); i++)
|
||||
{
|
||||
strStream << MSDK_STRING("0x") << std::setfill(MSDK_CHAR('0')) << std::setw(2) << std::hex << (int)m_uid.Data[i];
|
||||
if (i != (sizeof(mfxPluginUID)-1)) strStream << MSDK_STRING(", ");
|
||||
}
|
||||
|
||||
if ((ePluginType == MFX_PLUGINTYPE_AUDIO_DECODE) ||
|
||||
(ePluginType == MFX_PLUGINTYPE_AUDIO_ENCODE))
|
||||
{
|
||||
sts = MFXAudioUSER_Load(session, &m_uid, version);
|
||||
}
|
||||
else
|
||||
{
|
||||
sts = MFXVideoUSER_Load(session, &m_uid, version);
|
||||
}
|
||||
|
||||
if (MFX_ERR_NONE != sts)
|
||||
{
|
||||
MSDK_TRACE_ERROR(MSDK_STRING("Failed to load plugin from GUID, sts=") << sts << MSDK_STRING(": { ") << strStream.str().c_str() << MSDK_STRING(" } (") << msdkGetPluginName(m_uid) << MSDK_STRING(")"));
|
||||
}
|
||||
else
|
||||
{
|
||||
MSDK_TRACE_INFO(MSDK_STRING("Plugin was loaded from GUID")<< MSDK_STRING(": { ") << strStream.str().c_str() << MSDK_STRING(" } (") << msdkGetPluginName(m_uid) << MSDK_STRING(")"));
|
||||
m_session = session;
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~PluginLoader()
|
||||
{
|
||||
mfxStatus sts = MFX_ERR_NONE;
|
||||
if (m_session)
|
||||
{
|
||||
if ((ePluginType == MFX_PLUGINTYPE_AUDIO_DECODE) ||
|
||||
(ePluginType == MFX_PLUGINTYPE_AUDIO_ENCODE))
|
||||
{
|
||||
sts = MFXAudioUSER_UnLoad(m_session, &m_uid);
|
||||
}
|
||||
else
|
||||
{
|
||||
sts = MFXVideoUSER_UnLoad(m_session, &m_uid);
|
||||
}
|
||||
|
||||
if (sts != MFX_ERR_NONE)
|
||||
{
|
||||
MSDK_TRACE_ERROR(MSDK_STRING("Failed to unload plugin from GUID, sts=") << sts);
|
||||
}
|
||||
else
|
||||
{
|
||||
MSDK_TRACE_INFO(MSDK_STRING("MFXBaseUSER_UnLoad(session=0x") << m_session << MSDK_STRING("), sts=") << sts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool IsOk() {
|
||||
return m_session != 0;
|
||||
}
|
||||
virtual mfxStatus PluginInit( mfxCoreInterface * /*core*/ ) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
virtual mfxStatus PluginClose() {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
virtual mfxStatus GetPluginParam( mfxPluginParam * /*par*/ ) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
virtual mfxStatus Execute( mfxThreadTask /*task*/, mfxU32 /*uid_p*/, mfxU32 /*uid_a*/ ) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
virtual mfxStatus FreeResources( mfxThreadTask /*task*/, mfxStatus /*sts*/ ) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
virtual void Release() {
|
||||
}
|
||||
virtual mfxStatus Close() {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
virtual mfxStatus SetAuxParams( void* /*auxParam*/, int /*auxParamSize*/ ) {
|
||||
return MFX_ERR_NULL_PTR;
|
||||
}
|
||||
};
|
||||
|
||||
inline MFXPlugin * LoadPluginByType(mfxPluginType type, mfxSession session, const mfxPluginUID & uid, mfxU32 version, const mfxChar *pluginName, mfxU32 len) {
|
||||
std::unique_ptr<PluginLoader> plg(new PluginLoader (type, session, uid, version, pluginName, len));
|
||||
return plg->IsOk() ? plg.release() : NULL;
|
||||
}
|
||||
|
||||
inline MFXPlugin * LoadPluginByGUID(mfxPluginType type, mfxSession session, const mfxPluginUID & uid, mfxU32 version) {
|
||||
std::unique_ptr<PluginLoader> plg(new PluginLoader (type, session, uid, version));
|
||||
return plg->IsOk() ? plg.release() : NULL;
|
||||
}
|
||||
|
||||
inline MFXPlugin * LoadPlugin(mfxPluginType type, mfxSession session, const mfxPluginUID & uid, mfxU32 version, const mfxChar *pluginName, mfxU32 len) {
|
||||
return LoadPluginByType(type, session, uid, version, pluginName, len);
|
||||
}
|
||||
|
||||
inline MFXPlugin * LoadPlugin(mfxPluginType type, mfxSession session, const mfxPluginUID & uid, mfxU32 version) {
|
||||
return LoadPluginByGUID(type, session, uid, version);
|
||||
}
|
||||
#endif // PLUGIN_LOADER
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user