Does the .dll files in the given sample "Media Plugins Sample" need to be WinRT component?? RRS feed

  • Question

  • I try to replace the given dll "GrayscaleTransform.dll" with the MFT component created by sample "mft_grayscale" of media foundation in the windows 7, but it doesn't work.

    Does the MFT component need to be packaged as WinRT component with interface "IInspectable" or do I just do something wrong?? It comes out the error message "The video could not be loaded, wither because the server or network failed or because the format is not supported".

    If the component needs to be WinRT component, I can't figure out why the libraries don't have corresponding metadada.

    Thursday, October 6, 2011 10:17 AM

All replies

  • Hi Kenny,

    Yes this DLL does need to be a WinRT component. If you open the Package.appxmanifest file in the XML editor, you will find the following lines:

    <Extension Category="windows.activatableClass.inProcessServer">
             <ActivatableClass ActivatableClassId="Microsoft.Samples.GrayscaleEffect" ThreadingModel="both" />

    This is basically registration for the your component and it tells Windows that the object Microsoft.Samples.GrayscaleEffect can be found in bin\GrayscaleTransform.dll.

    I am assuming that there is no winmd for it because your app code doesn't explicitly activate this ClassId i.e. no where in the code it says "ref new Microsoft.Samples.GrayscaleEffect". It is only passing the id "Microsoft.Samples.GrayscaleEffect" to another Windows API, which is intelligent enought to look for the implementation DLL for this ClassID.

    Thank you

    Raman Sharma, Visual C++

    • Proposed as answer by Raman Sharma Wednesday, October 12, 2011 12:16 AM
    Wednesday, October 12, 2011 12:16 AM
  • Thank you for replying, but there are still some questions bothering me.

    As you said, does it mean that I have new a instance for using?? From the sample code of javascript, the only the place of applying the component is at the line 22 in the CustomEffect.js called "vid.msInserVideoEffect("Microsoft.Sample.GrayscaleEffect", true, NULL)". Does it mean the behavior of creating a instance for using?? If not, is there any place I can find the creation??

    As you mention before, the DLLs must be WinRT components with corresponding winmds. But the DLLs of the sample don't accompany with these winmds, do I miss something or ??

    If the main cause of failing to plug in the effect is lack of winmd for activating, does it mean that I just migrate the source code from sample in windows 7 to 8 and compile it with WinRT component template, then it works?? This means I don't implement the interface IInspectable.

    I still can't figure out the relationship of IInspectable and IMFTransform( or IUnknown). I can set the activatable runtimeclass for regitry in the idl file, but how can I access the data from IMFTransform. I didn't see any clues that there are connection between IInspectable and IMFTransform with the behavior like "QueryInterface"

    Does metro apps use topology for playback?? Without this, I don't how to process frames with MFT.

    In conclusion, does I need to expose the IMFTransform through IInspectable for using?? Or I just need to turn the MFT to metro style and it will build the graph automatically for using, then I just access the needed data from IInspectable??

    Thanks for replying


    Wednesday, October 12, 2011 2:59 AM
  • The component is just good old Grayscale sample which you can find on msdn already the only change is addition of an activation factory and making the transform object into a WinRT object (derives from IInspectable). It doesn’t need to have metadata because you don’t access it from projected languages nor it has any interface to be published this way.  It is just activate based on an ACID that the client provides and to do that we don’t need WinMD.


    • Proposed as answer by Raman Sharma Tuesday, October 18, 2011 11:31 PM
    Tuesday, October 18, 2011 5:41 PM
  • > only change is addition of an activation factory and making the transform object into a WinRT object (derives from IInspectable).

    Hi Raman, is there any samples or documentations address how to add the addtion you mentioned? Thanks.

    Wednesday, October 19, 2011 9:26 AM
  • I have the similar problem with Kenny.

    I build the MFT_Grayscale sample, and it can be registed successfully. But I can only use  it in MFPlayer2 sample(desktop  c++ sample), can not use it in Media Plugins Sample. My operation is, replace the orignal GrayscaleTransform.dll in \bin directory with the MFT_Grayscale.dll.

    Friday, November 18, 2011 2:42 AM
  • Hi Raman.

    We have little information about Using MediaFoundation Custom DLL in Metro style App.

    Please release more documents and Samples not only 'GrayscaleTransform.dll'  but also 'MPEG1Source.dll','MPEG1Decoder.dll' of 'Media Plugins Sample'.    

    This is my compelling desire.


    Friday, November 25, 2011 8:15 AM
  • Hi,

    I checked what provided DLLs in Media Plugins Sample are linked with. For example, they are linked with MSVCRT.DLL: malloc, free and memset. At the same time Windows App Certification Kit gives me a failure when I check my metro app for compatibility for exactly these functions:

    <MESSAGE TEXT="API malloc in msvcrt.dll is not supported for this application type.

    In addition VirtualAlloc and other Virtual<*> methods are forbidden for metro app.

    My questions are:

    1. Does it mean that this sample is not really metro compliant?
    2. What should I use for allocation in my old code that I am making compatible for metro?



    Wednesday, December 7, 2011 6:28 PM