I'm currently trying to write a ByteStreamHandler
and an audio decoder
to add support for an unsupported codec in a windows store app.
I followed this MPEG1 sample and adjusted it for my needs.
However I'm not sure if it is loaded correctly since I always get the error MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED
with the HRESULT
E_FAIL
.
I've added values to all E_FAIL
results I use in my code to figure out where it happens unfortunately it doesnt seem to happen in my code.
Now I'd like to know if there's any way to find out if the dll containing the ActivatableClasses was loaded correctly and how I could debug the code in the dll.
More Info: I added the dll to the project by adding this to my package.appxmanifest
<Extensions>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>MyDecoder.Windows.dll</Path>
<ActivatableClass ActivatableClassId="MyDecoder.MyDecoder" ThreadingModel="both"/>
</InProcessServer>
</Extension>
<Extension Category="windows.activatableClass.inProcessServer">
<InProcessServer>
<Path>MyDecoder.Windows.dll</Path>
<ActivatableClass ActivatableClassId="MyDecoder.MyByteStreamHandler" ThreadingModel="both"/>
</InProcessServer>
</Extension>
</Extensions>
I created the MediaExtensionManager in the MainPage as private class variable
MediaExtensionManager mediaExtensionManager = new MediaExtensionManager();
I registered the handler and the decoder in the OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
mediaExtensionManager.RegisterByteStreamHandler("MyDecoder.MyByteStreamHandler", FILE_TYPE, MIME_TYPE);
mediaExtensionManager.RegisterAudioDecoder("MyDecoder.MyDecoder", MF_SUBTYPE, Guid.Empty);
mediaElement.MediaFailed += mediaElement_MediaFailed;
}
The ByteStreamHandler and the Decoder are in one project.
Side-Question: When I pick the file via FileOpenPicker
the StorageFile
's ContentType
(MIME Type) property is an empty string. Can I fix this somehow and should I fix this?
You can use the MFTrace tool (in the Windows SDK) to get an event log from Media Foundation. This should help you figure out what happens at the point of failure.
http://msdn.microsoft.com/en-us/library/windows/desktop/ff685116(v=vs.85).aspx