//*@@@+++@@@@****************************************************************** // // Microsoft Windows Media Foundation // Copyright (C) Microsoft Corporation. All rights reserved. // //*@@@---@@@@****************************************************************** import "unknwn.idl"; import "propsys.idl"; import "mfidl.idl"; import "evr.idl"; cpp_quote("#if (WINVER >= _WIN32_WINNT_WIN7) ") ////////////////////////////////////////////////////////////////////////////// interface IMFPMediaPlayer; interface IMFPMediaItem; interface IMFPMediaPlayerCallback; interface IMFMediaEvent; interface IMFNetCredential; cpp_quote( "interface IMFMediaEvent;" ) cpp_quote( "interface IMFNetCredential;" ) ////////////////////////////////////////////////////////////////////////////// /// /// Options for creating the Media Player. /// typedef UINT32 MFP_CREATION_OPTIONS; typedef [v1_enum] enum _MFP_CREATION_OPTIONS { /// /// Used to indicate that no options are specified. /// MFP_OPTION_NONE = 0x00000000, /// /// Allows the Media Player to call methods in the IMFPMediaPlayerCallback /// interface in any thread. If not present, the Media Player will call /// in the same thread in which it is created - in this case the application /// must maintain a window message pump in the thread. /// MFP_OPTION_FREE_THREADED_CALLBACK = 0x00000001, /// /// Disables MMCSS (Multimedia Class Scheduler Service). /// MFP_OPTION_NO_MMCSS = 0x00000002, /// /// Disables any optimizing that may be done for the remote desktop case /// MFP_OPTION_NO_REMOTE_DESKTOP_OPTIMIZATION = 0x00000004, } _MFP_CREATION_OPTIONS; ////////////////////////////////////////////////////////////////////////////// /// /// State of the Media Player object. /// typedef [v1_enum] enum MFP_MEDIAPLAYER_STATE { /// /// MFP_MEDIAPLAYER_STATE_EMPTY = 0x00000000, /// /// MFP_MEDIAPLAYER_STATE_STOPPED = 0x00000001, /// /// MFP_MEDIAPLAYER_STATE_PLAYING = 0x00000002, /// /// MFP_MEDIAPLAYER_STATE_PAUSED = 0x00000003, /// /// MFP_MEDIAPLAYER_STATE_SHUTDOWN = 0x00000004, } MFP_MEDIAPLAYER_STATE; ////////////////////////////////////////////////////////////////////////////// /// /// Characteristics of the Media Item object. /// typedef UINT32 MFP_MEDIAITEM_CHARACTERISTICS; typedef [v1_enum] enum _MFP_MEDIAITEM_CHARACTERISTICS { /// /// MFP_MEDIAITEM_IS_LIVE = 0x00000001, /// /// MFP_MEDIAITEM_CAN_SEEK = 0x00000002, /// /// MFP_MEDIAITEM_CAN_PAUSE = 0x00000004, /// /// MFP_MEDIAITEM_HAS_SLOW_SEEK = 0x00000008, } _MFP_MEDIAITEM_CHARACTERISTICS; ////////////////////////////////////////////////////////////////////////////// /// /// Flags passed to the application in the /// MFP_ACQUIRE_USER_CREDENTIAL_EVENT callback. /// typedef UINT32 MFP_CREDENTIAL_FLAGS; typedef [v1_enum] enum _MFP_CREDENTIAL_FLAGS { /// /// Passed in MFP_ACQUIRE_USER_CREDENTIAL_EVENT to indicate that /// the application must prompt the user for credentials. /// MFP_CREDENTIAL_PROMPT = 0x00000001, /// /// Passed in MFP_ACQUIRE_USER_CREDENTIAL_EVENT to indicate that /// the credential came from the persistent store. The application can /// modify this flag to indicate whether the credentials should be /// saved in the persistent store or not. /// MFP_CREDENTIAL_SAVE = 0x00000002, /// /// The application can set this flag before it returns from the /// MFP_ACQUIRE_USER_CREDENTIAL_EVENT callback to indicate that the /// credentials should not be cached in memory. If the application /// does not set this flag, credentials will be cached in memory /// for the lifetime of the Player object. /// MFP_CREDENTIAL_DO_NOT_CACHE = 0x00000004, /// /// Passed in MFP_ACQUIRE_USER_CREDENTIAL_EVENT to indicate that /// the credential will be used with a clear text authentication scheme. /// The application can modify this flag to indicate whether it allows /// the credential to be used with clear text authentication schemes. /// MFP_CREDENTIAL_CLEAR_TEXT = 0x00000008, /// /// Passed in the MFP_ACQUIRE_USER_CREDENTIAL_EVENT to indicate that /// the credential will be used with a network proxy. /// MFP_CREDENTIAL_PROXY = 0x00000010, /// /// Passed in MFP_ACQUIRE_USER_CREDENTIAL_EVENT to indicate that the /// authentication scheme supports authentication of the logged on /// user. The application can modify this flag to indicate whether /// it allows authentication of the logged on user or not. /// MFP_CREDENTIAL_LOGGED_ON_USER = 0x00000020, } _MFP_CREDENTIAL_FLAGS; //////////////////////////////////////////////////////////////////////////// /// /// Creates a MF Media Player. /// /// /// URL for immediate playback or setting on player. /// /// /// Flag to indicate if it should start playing back. /// /// /// Options to create the player. /// /// /// Callback for events. /// /// /// Video target window (endpoint) /// /// /// Return Media Player interface. /// cpp_quote( "STDAPI MFPCreateMediaPlayer(" ) cpp_quote( " __in_opt LPCWSTR pwszURL," ) cpp_quote( " __in BOOL fStartPlayback," ) cpp_quote( " __in_opt MFP_CREATION_OPTIONS creationOptions," ) cpp_quote( " __in_opt IMFPMediaPlayerCallback * pCallback," ) cpp_quote( " __in_opt HWND hWnd," ) cpp_quote( " __out_opt IMFPMediaPlayer ** ppMediaPlayer );" ) ////////////////////////////////////////////////////////////////////////////// /// /// [ local, object, uuid(A714590A-58AF-430a-85BF-44F5EC838D85), ] interface IMFPMediaPlayer : IUnknown { /// /// HRESULT Play(); /// /// HRESULT Pause(); /// /// HRESULT Stop(); /// /// HRESULT FrameStep(); // // Position controls // /// /// HRESULT SetPosition( [in, annotation("__in")] REFGUID guidPositionType, [in, annotation("__in")] const PROPVARIANT * pvPositionValue ); /// /// HRESULT GetPosition( [in, annotation("__in")] REFGUID guidPositionType, [out, annotation("__out")] PROPVARIANT * pvPositionValue ); /// /// HRESULT GetDuration( [in, annotation("__in")] REFGUID guidPositionType, [out, annotation("__out")] PROPVARIANT * pvDurationValue ); // // Rate Control // /// /// HRESULT SetRate( [in, annotation("__in")] float flRate ); /// /// HRESULT GetRate( [out, annotation("__out")] float *pflRate ); /// /// HRESULT GetSupportedRates( [in, annotation("__in")] BOOL fForwardDirection, [out, annotation("__out")] float *pflSlowestRate, [out, annotation("__out")] float *pflFastestRate ); // // State // /// /// HRESULT GetState( [out, annotation("__out")] MFP_MEDIAPLAYER_STATE * peState ); // // Media Item Management // /// /// HRESULT CreateMediaItemFromURL( [in, annotation("__in")] LPCWSTR pwszURL, [in, annotation("__in")] BOOL fSync, [in, annotation("__in")] DWORD_PTR dwUserData, [out, annotation("__out_opt")] IMFPMediaItem ** ppMediaItem ); /// /// HRESULT CreateMediaItemFromObject( [in, annotation("__in")] IUnknown * pIUnknownObj, [in, annotation("__in")] BOOL fSync, [in, annotation("__in")] DWORD_PTR dwUserData, [out, annotation("__out_opt")] IMFPMediaItem ** ppMediaItem ); /// /// HRESULT SetMediaItem( [in, annotation("__in")] IMFPMediaItem * pIMFPMediaItem ); /// /// Clears the media item from the player and goes to the empty state /// HRESULT ClearMediaItem(); /// /// Fails if no media item is present /// HRESULT GetMediaItem( [out, annotation("__out")]IMFPMediaItem ** ppIMFPMediaItem ); // // Audio controls // /// /// HRESULT GetVolume( [out, annotation("__out")] float *pflVolume ); /// /// HRESULT SetVolume( [in, annotation("__in")] float flVolume ); /// /// HRESULT GetBalance( [out, annotation("__out")] float *pflBalance ); /// /// HRESULT SetBalance( [in, annotation("__in")] float flBalance ); /// /// HRESULT GetMute( [out, annotation("__out")] BOOL * pfMute ); /// /// HRESULT SetMute( [in, annotation("__in")] BOOL fMute ); // // Video controls // /// /// HRESULT GetNativeVideoSize( [out, annotation("__out_opt")] SIZE *pszVideo, [out, annotation("__out_opt")] SIZE *pszARVideo ); /// /// HRESULT GetIdealVideoSize( [out, annotation("__out_opt")] SIZE *pszMin, [out, annotation("__out_opt")] SIZE *pszMax ); /// /// HRESULT SetVideoSourceRect( [in, annotation("__in")] MFVideoNormalizedRect const *pnrcSource ); /// /// HRESULT GetVideoSourceRect( [out, annotation("__out")] MFVideoNormalizedRect *pnrcSource ); /// /// HRESULT SetAspectRatioMode( [in, annotation("__in")] DWORD dwAspectRatioMode ); /// /// HRESULT GetAspectRatioMode( [out, annotation("__out")] DWORD *pdwAspectRatioMode ); /// /// HRESULT GetVideoWindow( [out, annotation("__out")] HWND *phwndVideo ); /// /// HRESULT UpdateVideo(); /// /// HRESULT SetBorderColor( [in, annotation("__in")] COLORREF Clr ); /// /// HRESULT GetBorderColor( [out, annotation("__out")] COLORREF *pClr ); // // Effect Management // /// /// HRESULT InsertEffect( [in, annotation("__in")] IUnknown * pEffect, [in, annotation("__in")] BOOL fOptional ); /// /// HRESULT RemoveEffect( [in, annotation("__in")] IUnknown * pEffect ); /// /// HRESULT RemoveAllEffects(); // // Shutdown // /// /// HRESULT Shutdown(); }; ////////////////////////////////////////////////////////////////////////////// // // Position types that MFPlay uses. // See IMFPMediaItem::GetStartStopPosition and IMFPMediaItem::SetStartStopPosition. // /// /// cpp_quote( "EXTERN_GUID( MFP_POSITIONTYPE_100NS, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 );" ) // GUID_NULL ////////////////////////////////////////////////////////////////////////////// [ local, object, uuid(90EB3E6B-ECBF-45cc-B1DA-C6FE3EA70D57), ] interface IMFPMediaItem : IUnknown { // // Player, URL, Object and User Data Methods // /// /// HRESULT GetMediaPlayer( [out, annotation("__out")] IMFPMediaPlayer ** ppMediaPlayer ); /// /// Must use CoTaskMemFree /// HRESULT GetURL( [out, annotation("__out")] LPWSTR * ppwszURL ); /// /// HRESULT GetObject( [out, annotation("__out")] IUnknown ** ppIUnknown ); /// /// HRESULT GetUserData( [out, annotation("__out")] DWORD_PTR * pdwUserData ); /// /// HRESULT SetUserData( [in, annotation("__in")] DWORD_PTR dwUserData ); // // Set/Get Start/Stop Times // Use VT_EMPTY to reset positions (with valid GUID) // /// /// HRESULT GetStartStopPosition( [out, annotation("__out_opt")] GUID * pguidStartPositionType, [out, annotation("__out_opt")] PROPVARIANT * pvStartValue, [out, annotation("__out_opt")] GUID * pguidStopPositionType, [out, annotation("__out_opt")] PROPVARIANT * pvStopValue ); /// /// HRESULT SetStartStopPosition( [in, annotation("__in_opt")] const GUID * pguidStartPositionType, [in, annotation("__in_opt")] const PROPVARIANT * pvStartValue, [in, annotation("__in_opt")] const GUID * pguidStopPositionType, [in, annotation("__in_opt")] const PROPVARIANT * pvStopValue ); // // Media Item Properties and Metadata // /// /// HRESULT HasVideo( [out, annotation("__out_opt")] BOOL * pfHasVideo, [out, annotation("__out_opt")] BOOL * pfSelected ); /// /// HRESULT HasAudio( [out, annotation("__out_opt")] BOOL * pfHasAudio, [out, annotation("__out_opt")] BOOL * pfSelected ); /// /// HRESULT IsProtected( [out, annotation("__out")] BOOL * pfProtected ); /// /// Does NOT return start/stop-time adjusted duration. /// HRESULT GetDuration( [in, annotation("__in")] REFGUID guidPositionType, [out, annotation("__out")] PROPVARIANT * pvDurationValue ); /// /// HRESULT GetNumberOfStreams( [out, annotation("__out")] DWORD * pdwStreamCount ); /// /// HRESULT GetStreamSelection( [in, annotation("__in")] DWORD dwStreamIndex, [out, annotation("__out")] BOOL * pfEnabled ); /// /// SetStreamSelection will only take place in future "SetMediaItem" calls of the media item /// HRESULT SetStreamSelection( [in, annotation("__in")] DWORD dwStreamIndex, [in, annotation("__in")] BOOL fEnabled ); /// /// (e.g. MF_MT_FRAME_SIZE for video width and height. Will also return MF_SD_* attributes) /// HRESULT GetStreamAttribute( [in, annotation("__in")] DWORD dwStreamIndex, [in, annotation("__in")] REFGUID guidMFAttribute, [out, annotation("__out")] PROPVARIANT * pvValue ); /// /// Will return MF_PD_* attributes /// HRESULT GetPresentationAttribute( [in, annotation("__in")] REFGUID guidMFAttribute, [out, annotation("__out")] PROPVARIANT * pvValue ); /// /// Gets the media source characteristics. /// HRESULT GetCharacteristics( [out, annotation("__out")] MFP_MEDIAITEM_CHARACTERISTICS * pCharacteristics ); /// /// Attaches a media sink to a stream /// HRESULT SetStreamSink( [in, annotation("__in")] DWORD dwStreamIndex, [in, annotation("__in_opt")] IUnknown* pMediaSink ); /// /// Retrieves the read-only IProperyStore that contains the content properties /// HRESULT GetMetadata( [out, annotation("__out")] IPropertyStore** ppMetadataStore ); }; ////////////////////////////////////////////////////////////////////////////// typedef enum MFP_EVENT_TYPE { /// /// MFP_EVENT_TYPE_PLAY = 0, /// /// MFP_EVENT_TYPE_PAUSE = 1, /// /// MFP_EVENT_TYPE_STOP = 2, /// /// MFP_EVENT_TYPE_POSITION_SET = 3, /// /// MFP_EVENT_TYPE_RATE_SET = 4, /// /// MFP_EVENT_TYPE_MEDIAITEM_CREATED = 5, /// /// MFP_EVENT_TYPE_MEDIAITEM_SET = 6, /// /// MFP_EVENT_TYPE_FRAME_STEP = 7, /// /// MFP_EVENT_TYPE_MEDIAITEM_CLEARED = 8, /// /// MFP_EVENT_TYPE_MF = 9, /// /// MFP_EVENT_TYPE_ERROR = 10, /// /// MFP_EVENT_TYPE_PLAYBACK_ENDED = 11, /// /// MFP_EVENT_TYPE_ACQUIRE_USER_CREDENTIAL = 12, } MFP_EVENT_TYPE; /// /// typedef struct MFP_EVENT_HEADER { MFP_EVENT_TYPE eEventType; HRESULT hrEvent; IMFPMediaPlayer * pMediaPlayer; MFP_MEDIAPLAYER_STATE eState; IPropertyStore * pPropertyStore; } MFP_EVENT_HEADER; /// /// Parameters of event MFP_EVENT_TYPE_PLAY /// typedef struct MFP_PLAY_EVENT { MFP_EVENT_HEADER header; IMFPMediaItem * pMediaItem; } MFP_PLAY_EVENT; /// /// Parameters of event MFP_EVENT_TYPE_PAUSE /// typedef struct MFP_PAUSE_EVENT { MFP_EVENT_HEADER header; IMFPMediaItem * pMediaItem; } MFP_PAUSE_EVENT; /// /// Parameters of event MFP_EVENT_TYPE_STOP /// typedef struct MFP_STOP_EVENT { MFP_EVENT_HEADER header; IMFPMediaItem * pMediaItem; } MFP_STOP_EVENT; /// /// Parameters of event MFP_EVENT_TYPE_POSITION_SET /// typedef struct MFP_POSITION_SET_EVENT { MFP_EVENT_HEADER header; IMFPMediaItem * pMediaItem; } MFP_POSITION_SET_EVENT; /// /// Parameters of event MFP_EVENT_TYPE_RATE_SET /// typedef struct MFP_RATE_SET_EVENT { MFP_EVENT_HEADER header; IMFPMediaItem * pMediaItem; float flRate; } MFP_RATE_SET_EVENT; /// /// Parameters of event MFP_EVENT_TYPE_MEDIAITEM_CREATED /// typedef struct MFP_MEDIAITEM_CREATED_EVENT { MFP_EVENT_HEADER header; IMFPMediaItem * pMediaItem; DWORD_PTR dwUserData; } MFP_MEDIAITEM_CREATED_EVENT; /// /// Parameters of event MFP_EVENT_TYPE_MEDIAITEM_SET /// typedef struct MFP_MEDIAITEM_SET_EVENT { MFP_EVENT_HEADER header; IMFPMediaItem * pMediaItem; } MFP_MEDIAITEM_SET_EVENT; /// /// Parameters of event MFP_EVENT_TYPE_FRAME_STEP /// typedef struct MFP_FRAME_STEP_EVENT { MFP_EVENT_HEADER header; IMFPMediaItem * pMediaItem; } MFP_FRAME_STEP_EVENT; /// /// Parameters of event MFP_EVENT_TYPE_MEDIAITEM_CLEARED /// typedef struct MFP_MEDIAITEM_CLEARED_EVENT { MFP_EVENT_HEADER header; IMFPMediaItem * pMediaItem; } MFP_MEDIAITEM_CLEARED_EVENT; /// /// Parameters of event MFP_MF_EVENT /// typedef struct MFP_MF_EVENT { MFP_EVENT_HEADER header; MediaEventType MFEventType; IMFMediaEvent * pMFMediaEvent; IMFPMediaItem * pMediaItem; } MFP_MF_EVENT; /// /// Parameters of event MFP_ERROR_EVENT /// typedef struct MFP_ERROR_EVENT { MFP_EVENT_HEADER header; } MFP_ERROR_EVENT; /// /// Parameters of event MFP_EVENT_TYPE_PLAYBACK_ENDED /// typedef struct MFP_PLAYBACK_ENDED_EVENT { MFP_EVENT_HEADER header; IMFPMediaItem * pMediaItem; } MFP_PLAYBACK_ENDED_EVENT; /// /// Parameters of event MFP_EVENT_TYPE_ACQUIRE_USER_CREDENTIAL /// typedef struct MFP_ACQUIRE_USER_CREDENTIAL_EVENT { MFP_EVENT_HEADER header; DWORD_PTR dwUserData; BOOL fProceedWithAuthentication; HRESULT hrAuthenticationStatus; LPCWSTR pwszURL; LPCWSTR pwszSite; LPCWSTR pwszRealm; LPCWSTR pwszPackage; LONG nRetries; MFP_CREDENTIAL_FLAGS flags; IMFNetCredential * pCredential; } MFP_ACQUIRE_USER_CREDENTIAL_EVENT; /// /// The MFP_PKEY_StreamIndex PROPERTYKEY is used to obtain the stream index associated with an event /// cpp_quote( "EXTERN_C const DECLSPEC_SELECTANY PROPERTYKEY MFP_PKEY_StreamIndex = { { 0xa7cf9740, 0xe8d9, 0x4a87, { 0xbd, 0x8e, 0x29, 0x67, 0x0, 0x1f, 0xd3, 0xad } }, 0x00 }; ") /// /// The MFP_PKEY_StreamRenderingResult PROPERTYKEY is used to indicate which streams where succesfully rendered or not. /// cpp_quote( "EXTERN_C const DECLSPEC_SELECTANY PROPERTYKEY MFP_PKEY_StreamRenderingResults = { { 0xa7cf9740, 0xe8d9, 0x4a87, { 0xbd, 0x8e, 0x29, 0x67, 0x0, 0x1f, 0xd3, 0xad } }, 0x01 }; ") ////////////////////////////////////////////////////////////////////////////// /// /// Macros to cast a pointer to a MFP_EVENT_HEADER structure into a pointer to a MFP_*_EVENT. /// If the event is not of the correct type, the macro returns a NULL pointer. /// cpp_quote( "#define __MFP_CAST_EVENT( pHdr, Tag ) ( ( (pHdr)->eEventType == MFP_EVENT_TYPE_##Tag ) ? (MFP_##Tag##_EVENT*)(pHdr) : NULL )" ) cpp_quote( "#define MFP_GET_PLAY_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, PLAY )" ) cpp_quote( "#define MFP_GET_PAUSE_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, PAUSE )" ) cpp_quote( "#define MFP_GET_STOP_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, STOP )" ) cpp_quote( "#define MFP_GET_POSITION_SET_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, POSITION_SET )" ) cpp_quote( "#define MFP_GET_RATE_SET_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, RATE_SET )" ) cpp_quote( "#define MFP_GET_MEDIAITEM_CREATED_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, MEDIAITEM_CREATED )" ) cpp_quote( "#define MFP_GET_MEDIAITEM_SET_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, MEDIAITEM_SET )" ) cpp_quote( "#define MFP_GET_FRAME_STEP_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, FRAME_STEP )" ) cpp_quote( "#define MFP_GET_MEDIAITEM_CLEARED_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, MEDIAITEM_CLEARED )" ) cpp_quote( "#define MFP_GET_MF_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, MF )" ) cpp_quote( "#define MFP_GET_ERROR_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, ERROR )" ) cpp_quote( "#define MFP_GET_PLAYBACK_ENDED_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, PLAYBACK_ENDED )" ) cpp_quote( "#define MFP_GET_ACQUIRE_USER_CREDENTIAL_EVENT( pHdr ) __MFP_CAST_EVENT( pHdr, ACQUIRE_USER_CREDENTIAL )" ) ////////////////////////////////////////////////////////////////////////////// /// /// [ local, object, uuid(766C8FFB-5FDB-4fea-A28D-B912996F51BD), ] interface IMFPMediaPlayerCallback : IUnknown { void OnMediaPlayerEvent( [in, annotation("__in")] MFP_EVENT_HEADER * pEventHeader ); }; cpp_quote("#endif // (WINVER >= _WIN32_WINNT_WIN7) ")