Since 2.5 version of the Video SDK, you can implement a custom transformation of your video with a custom HLSL shader. The functionality is included in the MFShader plugin.
It works just like any other plugins -- you process an MFFrame object with the plugin using the ProcessFrame method.
The plugin works only with the GPU-pipeline mode enabled.
The plugin is based on HLSL Pixel shader with the "PS" as entry point.
If the shader that you use with the plugin is not correct, the plugin will return an error, but it is not possible to debug the shader from the plugin, so you should check the shader with this tool and solve the issue:
Some samples can be found here:
But the samples are of GLSL, so you should convert them to HLSL manually.
At the moment of the shader initialization, there could be a slight drop -- the shader has to be compiled, which takes 10-30 msec depending on a system performance.
To initialize a shader, you should call the following:
To check the current state of the shader, call:
m_objShader.PropsGet("shader_state", out string strState);
Possible states are:
You can check the functionality of the plugin with the Sample Custom Shader:
c:\Program Files (x86)\Medialooks\MFormats SDK\Samples\C#\Sample Custom Shader\