Does anyone know how to create a custom effect for a UWP media composition in a Win32 program?
struct MyEffect : implements<IBasicVideoEffect, IVideoEffectDefinition>
{
public:
// all properties and methods from the interface are defined without
// the virtual keyword.
winrt::hstring ActivatableClassId () { return winrt::hstring(L"MyEffect")}
IPropertySet Properties (){
PropertySet set;
return set;
}
};
void setupEffect()
{
MyEffect effect;
mediaClip.VideoEffectDefinitions().Append(effect);
mediaCompositon.addClip(mediaClip);
mediaCompositon.renderToFile(file);
}
Microsoft provides a code example showing the way it should work in C#:
When I try this setup, I got an exception:
WinRT originate error - 0x80040154 : 'Failed to activate video effect'.
I could imagine that I have some troubles with this approach in C++ because ActivatableClassId
for the example does not exist, as well as the video effect registration process.
I also tried to add the IVideoEffectDefinition
interface to my MyEffect
class, and the effect to the VideoEffectDEfinition
array. During the renderToFile
call, I get another exception:
Access violation reading location 0x0000000000000000
User contributions licensed under CC BY-SA 3.0