Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.
3056 Discussions

Interested in creating self plugin for Media SDK

kohshinToku
Novice
2,424 Views
 

Hello,

I am interested in developing a self commercial plugin for the Media SDK.

Who would be the best person to speak with about how to go about doing this?

Thanks,

0 Kudos
11 Replies
AthiraM_Intel
Moderator
2,400 Views

Hi,


Thanks for reaching out to us.


Could you please share more details about your use case.

We are forwarding your case to subject matter experts.


Thanks.



0 Kudos
Mark_L_Intel1
Moderator
2,385 Views

Hi Tokunaga San,

 

Thanks for interesting on our product and great proposal.

 

I will send you an email to discuss your proposal in detail.

 

Mark

 

0 Kudos
Mark_L_Intel1
Moderator
2,335 Views

Hi Tokunaga San,


Let's continue our discussion here.


Per our discussion, you want to add software MPEG4 decoder to our sample_decode, you can review our source code here:

https://github.com/Intel-Media-SDK/MediaSDK/tree/master/samples


If you want you code to be used by sample_decode, you should start from argument parsing.


Mark Liu


kohshinToku
Novice
2,310 Views

Hi Mark

I could play elementary streams of mpeg2, h.264, h.265 by sample_decode.exe.

For example, by following command.

>sample_decode h264 -r -f 30  -i content.264

Does argument mean that "h264 -r -f 30  -i content.264"?

It looks like implementing at ParseInputString() of sample_decode.cpp about parsing.

Regards.

0 Kudos
Mark_L_Intel1
Moderator
2,256 Views

Hi Tokunaga San,

 

Sorry for the late response.

 

Yes, you are correct. This is the entry point of the function. If you want to implement your function, you have to add code in ParseInputString() to register your own arguments, this function will fill a structure sInputParams to abstract the input char* to a input value to the implementation functions. So you might have to add a field to sInputParams in order to make this all working.

You can choose not fill sInputParams structure and directly input to your own function or plugin since your code is probably independent of the other Media SDK sample code.

Let me know if you have more questions.

 

Mark Liu

 

kohshinToku
Novice
2,246 Views

Hello Mark.

Thank you for reply.

I have a question about simple_decode_hevc10.exe.

(in https://github.com/Intel-Media-SDK/MediaSDK/tree/master/tutorials/simple_2_decode_hevc10/)

I sppose that this is used like flollowing:

>simple_decode_hevc10.exe -sw content.265 content.yuv

So I made the following changes to debug the plugin I created.

I changed code where marking by *****. 

--------simple_decode_hevc10.cpp-----------

int main(int argc, char** argv)
{
mfxStatus sts = MFX_ERR_NONE;
bool bEnableOutput; // if true, removes all YUV file writing
CmdOptions options;

// =====================================================================
// Intel Media SDK decode pipeline setup
// - In this example we are decoding an HEVC (H.265) stream
// - For simplistic memory management, system memory surfaces are used to store the decoded frames
// (Note that when using HW acceleration video surfaces are prefered, for better performance)
// - Before run the program, check if the input stream is HEVC 10bit, run "ffprobe" or other tool
// to confirm if the stream has the "HEVC Main 10" profile

// 1. Read options from the command line (if any is given)
memset(&options, 0, sizeof(CmdOptions));
options.ctx.options = OPTIONS_DECODE;
options.ctx.usage = usage;
// Set default values:
options.values.impl = MFX_IMPL_AUTO_ANY;

// here we parse options
ParseOptions(argc, argv, &options);

if (!options.values.SourceName[0]) {
printf("error: source file name not set (mandatory)\\n");
return -1;
}

bEnableOutput = (options.values.SinkName[0] != '\\0');
// Open input H.265 elementary stream (ES) file
fileUniPtr fSource(OpenFile(options.values.SourceName, "rb"), &CloseFile);
MSDK_CHECK_POINTER(fSource, MFX_ERR_NULL_PTR);
// Create output YUV file
fileUniPtr fSink(nullptr, &CloseFile);
if (bEnableOutput) {
fSink.reset(OpenFile(options.values.SinkName, "wb"));
MSDK_CHECK_POINTER(fSink, MFX_ERR_NULL_PTR);
}

// 2. Initialize Intel Media SDK session
// - MFX_IMPL_AUTO_ANY selects HW acceleration if available (on any adapter)
// - Version 1.0 is selected for greatest backwards compatibility.
// OS specific notes
// - On Windows both SW and HW libraries may present
// - On Linux only HW library only is available
// If more recent API features are needed, change the version accordingly
mfxIMPL impl = options.values.impl;
mfxVersion ver = { {0, 1} };
MFXVideoSession session;

sts = Initialize(impl, ver, &session, NULL);
MSDK_CHECK_RESULT(sts, MFX_ERR_NONE, sts);

// Create Media SDK decoder
MFXVideoDECODE mfxDEC(session);

// 3. Set required video parameters for decode
mfxVideoParam mfxVideoParams;
memset(&mfxVideoParams, 0, sizeof(mfxVideoParams));

 

// mfxVideoParams.mfx.CodecId = MFX_CODEC_HEVC; //The codecId must be set to HEVC in order to load the plugin
mfxVideoParams.mfx.CodecId = MFX_MAKEFOURCC('M','P','G','4'); //The codecId must be set to HEVC in order to load the plugin   *****
mfxVideoParams.IOPattern = MFX_IOPATTERN_OUT_SYSTEM_MEMORY;

 

// 4. Load the HEVC plugin
mfxPluginUID codecUID;
bool success = true;

 

// codecUID = msdkGetPluginUID(impl, MSDK_VDECODE, mfxVideoParams.mfx.CodecId);
codecUID = {{0x2e, 0xcb, 0x0e, 0x6b, 0x59, 0xb4, 0x48, 0x4c, 0x8b, 0xec, 0xcd, 0xe4, 0xf3, 0x11, 0xaa, 0x6e}};   //*****

 

if (AreGuidsEqual(codecUID, MSDK_PLUGINGUID_NULL)) {
printf("Get Plugin UID for HEVC is failed.\\n");
success = false;
}

----------------------------------------------

And I registered my plugin to windows registry.

(I add image registry.png.)

 

When I executed simple_decode_hevc.exe, MFXVideoUSER_Load() retuend error.

Is there anything else I should set?

 

Regards.

 

0 Kudos
kohshinToku
Novice
2,225 Views

I misttook a path to register dll.

 

By mediasdkusr-man.pdf...

(NG)

コンピューター\HKEY_LOCAL_MACHINE\SOFTWARE\Intel\MediaSDK\Plugin\{2ecb0e6b-59b4-484c-8bec-cde4f311aa6e}

 

(Good)

コンピューター\HKEY_LOCAL_MACHINE\SOFTWARE\Intel\MediaSDK\Dispatch\Plugin\{2ecb0e6b-59b4-484c-8bec-cde4f311aa6e}

 

Althogh I changed a path like above, MFXVideoUSER_Load() returned error(MFX_ERR_NOT_FOUND (0xfffffff7)).

 

Could you tell me how to register dll to windows?

 

Regards.

0 Kudos
kohshinToku
Novice
2,190 Views

Hi Mark.

 

I tried to incorporate my own plugin into sample_decode.exe as follows.

 

----------------- pipeline_decode.cpp ---------------

mfxStatus CDecodingPipeline::Init(sInputParams *pParams)
{
MSDK_CHECK_POINTER(pParams, MFX_ERR_NULL_PTR);

mfxStatus sts = MFX_ERR_NONE;

#if 1 //mpeg4codec
msdk_opt_read(MSDK_SW_MPEG4_DECODE_PLUGIN, pParams->strPluginDLLPath);

m_PluginModule = msdk_so_load(pParams->strPluginDLLPath);
MSDK_CHECK_POINTER(m_PluginModule, MFX_ERR_NOT_FOUND);

PluginModuleTemplate::fncCreateDecoderPlugin pCreateFunc = (PluginModuleTemplate::fncCreateDecoderPlugin)msdk_so_get_addr(m_PluginModule, "mfxCreateDecoderPlugin");

MSDK_CHECK_POINTER(pCreateFunc, MFX_ERR_NOT_FOUND);

m_pDecoderPlugin = (*pCreateFunc)();
MSDK_CHECK_POINTER(m_pDecoderPlugin, MFX_ERR_NOT_FOUND);
#endif

// prepare input stream file reader
// for VP8 complete and single frame reader is a requirement
// create reader that supports completeframe mode for latency oriented scenarios
if (pParams->bLowLat || pParams->bCalLat)
{

............omit

 

// create decoder
m_pmfxDEC = new MFXVideoDECODE(m_mfxSession);
MSDK_CHECK_POINTER(m_pmfxDEC, MFX_ERR_MEMORY_ALLOC);

#if 1 // mpeg4codec
// register plugin callbacks in Media SDK
mfxPlugin plg = make_mfx_plugin_adapter(m_pDecoderPlugin);
sts = MFXVideoUSER_Register(m_mfxSession, 0, &plg);
MSDK_CHECK_STATUS(sts, "MFXVideoUSER_Register failed");
#endif

---------------------------------------------------------------

 

I was able to compile, but
MFXVideoUSER_Register (m_mfxSession, 0, & plg) returns MFX_ERR_NULL_PTR (0xfffffffe).

Do you know what caused it?

I can send you my plugin source code.

Regards.

0 Kudos
Mark_L_Intel1
Moderator
2,167 Views

Hi Tokunaga San,


Sorry for the late response, I understand what you are trying to do.


We don't have a lot of example on using customized MFXVideoUSER_Load() so not sure how I can help.


In general, you can refer to following guideline:


Mark Liu


0 Kudos
Mark_L_Intel1
Moderator
1,947 Views

Hi Tokunaga San,


Do you have more questions on this post?


Our normal procedure is focusing on the topic for each post, if the original request is solved, we will not monitor it any more. For new request, customer can write a new post at anytime.


Mark


0 Kudos
kohshinToku
Novice
1,937 Views

Hi Mark

 

There are no more questions to ask in this thread.

 

Regards.

0 Kudos
Reply