1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
/*############################################################################
# Copyright (C) 2005 Intel Corporation
#
# SPDX-License-Identifier: MIT
############################################################################*/
#ifndef __PIPELINE_REGION_ENCODE_H__
#define __PIPELINE_REGION_ENCODE_H__
#include "pipeline_encode.h"
#ifndef MFX_VERSION
#error MFX_VERSION not defined
#endif
class CMSDKResource {
public:
CMSDKResource() : Session(), pEncoder(NULL), TaskPool() {}
MainVideoSession Session;
MFXVideoENCODE* pEncoder;
CEncTaskPool TaskPool;
};
class CResourcesPool {
public:
CResourcesPool() {}
~CResourcesPool() {
delete[] m_resources;
}
CMSDKResource& operator[](int index) {
return m_resources[index];
}
int GetSize() {
return m_size;
}
mfxStatus Init(int size, mfxIMPL impl, mfxVersion* pVer);
mfxStatus Init(int size, VPLImplementationLoader* Loader, mfxU32 nSyncOpTimeout);
mfxStatus InitTaskPools(CSmplBitstreamWriter* pWriter,
mfxU32 nPoolSize,
mfxU32 nBufferSize,
mfxU32 CodecId,
void* pOtherWriter = NULL,
bool bUseHWLib = false);
mfxStatus CreateEncoders();
mfxStatus CreatePlugins(mfxPluginUID pluginGUID, mfxChar* pluginPath);
mfxStatus GetFreeTask(int resourceNum, sTask** ppTask);
void CloseAndDeleteEverything();
protected:
CMSDKResource* m_resources = nullptr;
int m_size = 0;
mfxU32 m_nSyncOpTimeout = 0; // SyncOperation timeout in msec
private:
CResourcesPool(const CResourcesPool& src) {
(void)src;
}
CResourcesPool& operator=(const CResourcesPool& src) {
(void)src;
return *this;
}
};
/* This class implements a pipeline with 2 mfx components: vpp (video preprocessing) and encode */
class CRegionEncodingPipeline : public CEncodingPipeline {
public:
CRegionEncodingPipeline();
virtual ~CRegionEncodingPipeline();
virtual mfxStatus Init(sInputParams* pParams);
virtual mfxStatus Run();
virtual void Close();
virtual mfxStatus ResetMFXComponents(sInputParams* pParams);
void SetMultiView();
void SetNumView(mfxU32 numViews) {
m_nNumView = numViews;
}
protected:
mfxI64 m_timeAll;
CResourcesPool m_resources;
virtual mfxStatus InitMfxEncParams(sInputParams* pParams);
virtual mfxStatus CreateAllocator();
virtual MFXVideoSession& GetFirstSession() {
return m_resources[0].Session;
}
virtual MFXVideoENCODE* GetFirstEncoder() {
return m_resources[0].pEncoder;
}
};
#endif // __PIPELINE_REGION_ENCODE_H__
|