Partager via


MFP_EVENT_TYPE enumeration (mfplay.h)

[The feature associated with this page, MFPlay, is a legacy feature. It has been superseded by MediaPlayer and IMFMediaEngine. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer and IMFMediaEngine instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

Defines event types for the IMFPMediaPlayerCallback interface.

Syntax

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
} ;

Constants

 
MFP_EVENT_TYPE_PLAY
Value: 0
Playback has started. This event is sent when the IMFPMediaPlayer::Play method completes.
MFP_EVENT_TYPE_PAUSE
Value: 1
Playback has paused. This event is sent when the IMFPMediaPlayer::Pause method completes.
MFP_EVENT_TYPE_STOP
Value: 2
Playback has stopped. This event is sent when the IMFPMediaPlayer::Stop method completes.
MFP_EVENT_TYPE_POSITION_SET
Value: 3
The MFPlay player object has seeked to a new playback position. This event is sent when the IMFPMediaPlayer::SetPosition method completes.
MFP_EVENT_TYPE_RATE_SET
Value: 4
The playback rate has changed. This event is sent when the IMFPMediaPlayer::SetRate method completes.
MFP_EVENT_TYPE_MEDIAITEM_CREATED
Value: 5
A new media item was created. This event is sent when the IMFPMediaPlayer::CreateMediaItemFromURL or CreateMediaItemFromObject method completes.
MFP_EVENT_TYPE_MEDIAITEM_SET
Value: 6
A media item is ready for playback. This event is sent when the IMFPMediaPlayer::SetMediaItem method completes.
MFP_EVENT_TYPE_FRAME_STEP
Value: 7
A frame-step operation has completed. This event is sent when the IMFPMediaPlayer::FrameStep method completes.
MFP_EVENT_TYPE_MEDIAITEM_CLEARED
Value: 8
The current media item was cleared. This event is sent when the IMFPMediaPlayer::ClearMediaItem method completes.
MFP_EVENT_TYPE_MF
Value: 9
A pipeline object sent an event. The player object forwards certain pipeline events to the application. For more information, see MFP_MF_EVENT.
MFP_EVENT_TYPE_ERROR
Value: 10
A playback error has occurred.
MFP_EVENT_TYPE_PLAYBACK_ENDED
Value: 11
Playback has ended. The player object sends this event when playback reaches the end of the media file.
MFP_EVENT_TYPE_ACQUIRE_USER_CREDENTIAL
Value: 12
The media source requires authentication before it can play the file.

Remarks

For each event type, the IMFPMediaPlayerCallback::OnMediaPlayerEvent callback receives a pointer to a data structure. The first part of the data structure is always an MFP_EVENT_HEADER structure. The following table lists the data structure for each event type.

In your implementation of OnMediaPlayerEvent, you must cast the pEventHeader parameter to the correct structure type. A set of macros is defined for this purpose. These macros check the value of the event type and return NULL if there is a mismatch; otherwise they return a pointer to the correct structure type.

Event type Event structure

Pointer cast macro

MFP_EVENT_TYPE_PLAY

MFP_PLAY_EVENT

MFP_GET_PLAY_EVENT

MFP_EVENT_TYPE_PAUSE

MFP_PAUSE_EVENT

MFP_GET_PAUSE_EVENT

MFP_EVENT_TYPE_STOP

MFP_STOP_EVENT

MFP_GET_STOP_EVENT

MFP_EVENT_TYPE_POSITION_SET

MFP_POSITION_SET_EVENT

MFP_GET_POSITION_SET_EVENT

MFP_EVENT_TYPE_RATE_SET

MFP_RATE_SET_EVENT

MFP_GET_RATE_SET_EVENT

MFP_EVENT_TYPE_MEDIAITEM_CREATED

MFP_MEDIAITEM_CREATED_EVENT

MFP_GET_MEDIAITEM_CREATED_EVENT

MFP_EVENT_TYPE_MEDIAITEM_SET

MFP_MEDIAITEM_SET_EVENT

MFP_GET_MEDIAITEM_SET_EVENT

MFP_EVENT_TYPE_FRAME_STEP

MFP_FRAME_STEP_EVENT

MFP_GET_FRAME_STEP_EVENT

MFP_EVENT_TYPE_MEDIAITEM_CLEARED

MFP_MEDIAITEM_CLEARED_EVENT

MFP_GET_MEDIAITEM_CLEARED_EVENT

MFP_EVENT_TYPE_MF

MFP_MF_EVENT

MFP_GET_MF_EVENT

MFP_EVENT_TYPE_ERROR

MFP_ERROR_EVENT

MFP_GET_ERROR_EVENT

MFP_EVENT_TYPE_PLAYBACK_ENDED

MFP_PLAYBACK_ENDED_EVENT

MFP_GET_PLAYBACK_ENDED_EVENT

MFP_EVENT_TYPE_ACQUIRE_USER_CREDENTIAL

MFP_ACQUIRE_USER_CREDENTIAL_EVENT

MFP_GET_ACQUIRE_USER_CREDENTIAL_EVENT

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Header mfplay.h

See also

IMFPMediaPlayerCallback

Media Foundation Enumerations