Home > database >  Unable to refer to typedef struct definitions done in Win32 Header files (.h files in External depen
Unable to refer to typedef struct definitions done in Win32 Header files (.h files in External depen

Time:05-16

Unable to refer to typedef struct definitions done in Win32 Header files (.h files in External dependencies) when consumed from WinRT C Library

#include <mfplay.h>
#pragma comment(lib,"Mfplay.lib") 
class MediaPlayerCallback //: public IMFPMediaPlayerCallback
{
long m_cRef; // Reference count
MFP_EVENT_HEADER H;
};

MFP_EVENT_HEADER is a typedef struct defined inside MFPlay.h, Doing a Go to the definition in VS2019 takes me to the definition in MFPlay.h definition but the code doesn't compile

But I tried creating a typedef struct in a .h file I have created and I'm able to compile that without any issues.

My doubt is why am I not able to compile when defined in MFPlay.h but able to compile when defined in header files defined by me.

The error I'm getting

MediaPlayerCallback.h(11,22): error C3646: 'H': unknown override specifier
MediaPlayerCallback.h(11,23): error C4430: missing type specifier - int assumed. Note: C   does not support default-int

Minimum Reproducible

Already Tried- Tried the same code on the win32 desktop app and I'm able to compile without any issues but when doing the same thing from a WinRT C library getting this issue

CodePudding user response:

As noted in the comments, the issue is that the MFP_EVENT_HEADER type is in the WINAPI_FAMILY_DESKTOP_APP API partition but is not in the WINAPI_FAMILY_APP API partition supported for UWP applications. Per Microsoft Docs this type is marked " [desktop apps only]".

IMFPMediaPlayerCallback is also "desktop apps only". This because this API is considered deprecated per Microsoft Docs. The recommendation is to use Media Session APIs instead although IMFMediaSession is also a desktop only interface.

For UWP, the list of Media Foundation APIs supported is found here. There is also the Windows.Media Windows Runtime API surface. I recommend starting with Audio, video, and camera and see what is supported for your scenario.

  • Related