locked
how to using the COM interface "CoCreateInstance" on Win8 Metro?

    Question

  • Hi everyone,

    I 've got a problem with using h264 codec on Win8 Metro, as below:

    IMFTransform *pDecoder;

    HRESULT hr = CoCreateInstance((const IID)CLSID_CMSH264DecoderMFT, NULL, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&pDecoder);
     if(FAILED(hr))
      return hr;

    After call this interface, I very doubt that the H264 codec is Windows system COM, why  return REGDB_E_CLASSNOTREG, could anyone know?

    Thanks

    Jackic


    one work one gain!

    Thursday, February 28, 2013 10:25 AM

All replies

  • Hi,

    CLSID_CMSH264DecoderMFT should be used in Desktop not in the Windows Store App. What's the function do you want to achieve use CLSID_CMSH264DecoderMFT?

    If your h.264 frames are wrapped in an MPEG-4 Part 14 container then you should be able to use the h.264 codec that will ship with Windows 8. You should be able to use the “media element” and connect directly to your MPEG-4 Part 14 / h.264 host. If for some reason your host does not use the MPEG-4 Part 14 container you will need to write your own MF components to parse your proprietary  protocol and container and then offer the raw frames to the Microsoft decoder.

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, March 1, 2013 3:07 AM
  • Hi Jesse,

    yes, you are right, I can use H264 codec in directly for playback h264 video, but when there have complex video, that is to say, the video container included H264 stream, WMV stream, or mpeg2 stream, etc., so I want to create decoder in dynamic, your means CLSID_CMSH264DecoderMFT only for Windows desktop, could you tell me the CLSID of H264 on Win8 Metro?

    Thanks

    Jackic


    one work one gain!

    Friday, March 1, 2013 3:20 AM
  • Hi,

    Firstly, we cannot use CoCreateInstance in Windows Store App. If necessary, we can use CoCreateInstanceFromApp to instead of it.
    http://msdn.microsoft.com/en-us/library/windows/desktop/hh404137(v=vs.85).aspx

    Generally speaking, we cannot play different type stream in one container directly. We should write a customer source for this container.
    http://msdn.microsoft.com/en-us/library/windows/desktop/ms700134(v=vs.85).aspx

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, March 8, 2013 5:43 AM
  • hi Jesse,

    I've used the function CoCreateInstanceFromApp(), but the result same as CoCreateInstance() and return REGDB_E_CLASSNOTREG, because CoCreateInstanceFromApp() is called by CoCreateInstance().

    Jackic


    one work one gain!

    Sunday, March 10, 2013 12:05 AM