none
Any sample for ITA? RRS feed

  • Question

  • Hi all

      From the samples I don't see any implementation for ITA.
      It is told that to write an ITA we have to create proper interface in Media Source
      and return an IMFActivate for ITA to be created inside PMP process.

      "The IMFActivate  object exposes the IMFActivate interface, which enables the PMP host to create the ITA, and the IPersistStream interface, which enables the PMP Session to serialize the IMFActivate object from the application process to the PE process."

      Sounds nice, except one problem -- how to write such a magic object?
      I don't see any further information from all the documents.
     
      Does anyone know?
     

    Thursday, August 24, 2006 3:24 AM

Answers

  • Pretty much... You write your ITA in a COM DLL, and you're mostly good to go.  The only thing that somewhat falls in the "elbow grease" category is that we recommend you use the free-threaded marshaler.  Take a look at CoCreateFreeThreadedMarshaler in MSDN... Basically you create this thing, aggregate it, and use its IUnknown when you get QueryInterfaced for IMarshal. 

    Good luck...

    Becky 

    Tuesday, August 29, 2006 4:30 PM

All replies

  • No, indeed we don't have a sample ITA in the SDK.  This is mostly because we expect the space of developers writing these beasts to be somewhat small -- much smaller than the number of people writing Media Sources, transforms, Media Sinks, etc.  Generally, if you're writing an ITA, you're usually a PMP licensee.

    But there's no reason why you _have_ to be a PMP licensee to write an ITA.  (You will, as you observed in another thread, have to create the PMP session with the UNPROTECTED flag, because your non-PMP-signed code would not load in a protected process.)

    No magic involved... Since I think you're asking about how to get your ITA to appear in the PMP process, I'll talk about that: In a nutshell, the Media Source is responsible for getting your ITA instantiated.  Easiest way to do this is to make sure your ITA is CoCreateInstance-able.  The Media Source (which I presume you are also writing) will need to implement IMFPMPClient and IMFTrustedInput.  Using the IMFPMPHost pointer that your Media Source will get from IMFPMPClient::SetPMPHost, make a call to pPMPHost->CreateObjectByCLSID(), supplying your ITA's CLSID.  If you're going to need to initialize this object with some information, look into using the optional IStream argument to CreateObjectByCLSID and making your ITA implement IPersistStream.  CreateObjectByCLSID will instantiate your ITA in the mfpmp process and return you a pointer to that remote instance.  You can do this creation of remote ITA(s) whenever you want, though it's usually sensible to defer it until you're actually asked for an ITA (IMFTrustedInput::GetInputTrustAuthority).

    One more note, since it sounds from your various questions that you're going to do some cross-process stuff... You may already know this, but whenever you're storing a pointer to something in a remote process to use later, and you want to ensure that you have good thread-safe access to it, use IGlobalInterfaceTable to help with that.

    Thursday, August 24, 2006 4:01 PM
  • Actually I think my question is I don't know how to make a working IMFActivate object.
    I don't know what I have to do to make it work across process.

    Anyway IMFPMPClient is also a mistery for me.

    According to the MSDN, media source uses IMFPMPHost/IMFPMPClient to create ITA in PMP process. That's fine, and the return pointer is supposed to be a pointer to proxy object of the remote ITA (because the pointer is in same process of media source).

    But as I read from the document for ITA, GetInputTrustAuthority must return an IMFActivate. So this is a problem. I don't know what to return for the IMFActivate. And in this way it seems like that MF will do the activation by itself and the previous CreateObjectBYCLSID becomes not neccesary.

    So that's why I asked for ITA and IMFActivate. IF there's no sample, I really don't know how to write such one. Will I receive sample if I have PMP license?
    Friday, August 25, 2006 3:35 AM
  • Lots of ITA related stuff derive from IMFAttributes interface.
    Why not use COM style and just describe the object "should" support IMFAttributes?
    Inheritance makes the code bloat...

    To make an IMFOutputPolicy and IMFOutputSchema I have to reclaim all
    member of IMFAttributes (dozens!) and write stub functions.

    Do you support aggregation in MF objects?
    Monday, August 28, 2006 9:50 AM
  • No, we don't do aggregation.  But it'll probably make your life easier to use the MF-provided IMFAttributes implementation -- MFCreateAttributes() -- and just forward all your calls to it.
    Monday, August 28, 2006 6:45 PM
  • GetInputTrustAuthority will always ask you for an IMFInputTrustAuthority, not an IMFActivate.  So you just create your ITA in the other process (using IMFPMPHost::CreateObjectByCLSID) and return that proxy pointer.  I'll look at the docs and make sure they say the right thing.

    And to dispel the mystery of IMFPMPClient... It's just an interface that your protected-content-enabled Media Source should implement and QueryInterface for, and through that interface you'll get the IMFPMPHost pointer that you will use for the CreateObjectByCLSID call above.

    Monday, August 28, 2006 6:58 PM
  • I just checked, and our current plan is to provide some sample ITA code to PMP licensees.
    Monday, August 28, 2006 7:35 PM
  • Thanks for your reply.

    I did use MFCreateAttributes to reduce the work but don't you think it will be easier and more fit COM's model if those interfaces were not "inheritance" and just remark as "this object has to support IMFActivate interface"? Then we can avoid overriding lots of virtual function and just one line in QueryInterface solved the magic.

    And for CreateObjectByCLSID... My question is I don't know how to write an ITA that supports proxy objects. Can I just write a COM DLL and then MF will add proxy/stubs for me? Or what else interface should I support to make it work?



    Tuesday, August 29, 2006 3:00 AM
  • Pretty much... You write your ITA in a COM DLL, and you're mostly good to go.  The only thing that somewhat falls in the "elbow grease" category is that we recommend you use the free-threaded marshaler.  Take a look at CoCreateFreeThreadedMarshaler in MSDN... Basically you create this thing, aggregate it, and use its IUnknown when you get QueryInterfaced for IMarshal. 

    Good luck...

    Becky 

    Tuesday, August 29, 2006 4:30 PM