locked
CoCreateInstance fails WACK, need alternative RRS feed

  • Question

  • Hello,

    My app is very heavy on playing video in full screen. When I started creating my app, I found the Media Engine Native Video Playback sample, and have been using that as a base for my code ever since. It was the perfect tool for me to use.

    Now however, I ran my app through the Windows App Certification Kit, and everything passed except for the fact that I'm using 'CoCreateInstance' in the 'Initialize' function for the 'IMFMediaEngineClassFactory'. I've looked at the most recent sample that was released for the RTM version of Windows 8 thinking that it may have been updated to a non-banned way but nothing has changed.

    Now, my code is heavily dependent on the media engine code as I have even modified it heavily to suite my needs, and I'm wondering if there are any easy alternatives to the way that a 'IMFMediaEngineClassFactory' can be initialized. This is the only instance of 'CoCreateInstance' is being called so I only have to worry about this one thing.

    Is there anything I can do to figure this out?

    Thanks

    • Moved by Jesse JiangModerator Friday, September 14, 2012 3:06 AM (From:Building Windows Store apps with C++ )
    Thursday, September 13, 2012 6:31 PM

Answers

  • Here's a snippet:

    MULTI_QI mqi = {0};
    
    mqi.hr = S_OK;
    mqi.pIID = &__uuidof(IMFMediaEngineClassFactory);
    
    HRESULT hr = CoCreateInstanceFromApp(CLSID_MFMediaEngineClassFactory, 
    										nullptr, 
    										CLSCTX_INPROC_SERVER, 
    										nullptr, 
    										1, 
    										&mqi);
    
    
    if(FAILED(hr) || FAILED(mqi.hr))
    	throw ref new Platform::COMException(hr);
    	
    spFactory.Attach((IMFMediaEngineClassFactory*)mqi.pItf);


    • Marked as answer by mark_1h Monday, September 17, 2012 6:27 PM
    Thursday, September 13, 2012 10:55 PM

All replies

  • Hmm, just asked as similar question myself.

    I think CoCreateInstanceFromApp may be the correct usage if CoCreateInstance is failing WACK.

    Thursday, September 13, 2012 10:25 PM
  • Here's a snippet:

    MULTI_QI mqi = {0};
    
    mqi.hr = S_OK;
    mqi.pIID = &__uuidof(IMFMediaEngineClassFactory);
    
    HRESULT hr = CoCreateInstanceFromApp(CLSID_MFMediaEngineClassFactory, 
    										nullptr, 
    										CLSCTX_INPROC_SERVER, 
    										nullptr, 
    										1, 
    										&mqi);
    
    
    if(FAILED(hr) || FAILED(mqi.hr))
    	throw ref new Platform::COMException(hr);
    	
    spFactory.Attach((IMFMediaEngineClassFactory*)mqi.pItf);


    • Marked as answer by mark_1h Monday, September 17, 2012 6:27 PM
    Thursday, September 13, 2012 10:55 PM
  • Thanks this worked!
    Monday, September 17, 2012 1:19 PM