Custom Scheme Handler and output protection RRS feed

  • Question

  • I am new to Media Foundation, have done quite a bit of DirectShow and am now stuck with DRM related questions. Any help or hint would be greatly appreceated. I would like to ask for some help in regards to the following issues two questions:

    1. I want to implement a video player that is capable of dealing with protected media content. The protection scheme is very simple, let's say it's the whole media file is encrypted. From what i have read here: http://msdn.microsoft.com/en-us/library/aa371872%28VS.85%29.aspx it should be possible to provide a custom scheme handler, e.g. for myScheme://original_file_name.mp4 that takes the original byte stream, decrypts it and then leave the rest of the playback to standard MF components (or even Windows Media Player if the scheme handler is registered correctly). Does this scenario look like a doable method or am i missing some basic facts?

    2.What is the easiest way to enable output protection to the scenario described in 1. From what i have read, the policy engine enables output protection as soon as the MediaSource delivers a Protected Stream Type. This would not happen in the scenario 1) since the MP4 file parser already works on the decrypted stream. Is there a way of just globally switching the output protection to 'on' or does it have to rely on the internal mechanism? If the latter is the case, I could imagine overriding the MP4 parser class, provide a custom decrypter that does not do a lot but copy a sample and enable the actual decryption of the whole file stream in the original byte source as soon as the policy engine confirms the credentials?


    Any alternative suggestions are appreciated as well. I want to avoid writing my own MPP4 parser or changing the encryption method from file encryption to stream encryption.



    - Kla Us




    Friday, October 1, 2010 9:39 PM

All replies

  • A short update: overriding the IMFSchemeHandler and providing a custom bytestream does the job for me. Now I am able to load a zipped or encrypted mp4 file file  or any other filetype and play it in Windows Media Player or any other of the demo applications. This basically solve the issues that i asked for  in 1. in the posting above.

    In regards to moving this whole code into the protected environment: So far it looks straightforward for me. The only thing I don't know is how to enable the protected output mode for my custom files: Does it require a Media Source returning the Attribute 'protected' for a stream, providing a decryptor etc. or is there another way to acitvate the output protection?


    - Kla Us


    Tuesday, October 5, 2010 4:33 PM
  • Hello Kla US,

    Sorry I can't answer your question, but I was hoping that you could help me out.

    I am attempting to do something similar to what you describe in point 1, playing an encrypted avi file. I was wondering if you could share any samples of what you did to override the IMFSchemeHandler and provide a custom bytestream.

    Any help would be greatly appreciated.



    Wednesday, October 13, 2010 10:28 AM
  • How complicated this gets depends on how important it is to keep the content secure.  If you are trying to enforce output protection, then it sounds like there is a real need to keep the content secure.  If that is so, decrypting the content in the scheme handler does not sound like it will work because the content can be sniffed and extracted from the unprotected bytestream.  There is no means to establish a secure channel between a bytestream and the media source.

    An input trust authority (IMFInputTrustAuthority) is the component that enforces output protections on output trust authorities.  Only sources are queried for input trust authorities, and only in the protected media path.  You could still potentially avoid doing the parsing by writing a source that wraps the real source.  However, you cannot get away from the complexities of running in the protected media path, documented here.

    Wednesday, October 27, 2010 2:06 AM