Event Notification Codes

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

This sections lists the DirectShow events that are not specific to DVD. For events specific to DVD, see DVD Event Notification Codes.

Filters send events to the Filter Graph Manager by calling the IMediaEventSink::Notify method. The Filter Graph Manager handles some events and queues others for the application. The application retrieves them by calling the IMediaEvent::GetEvent method.

In the sections that follow, each entry lists the event code, the meaning of the event parameters, and the Filter Graph Manager's default action for the event, if any. To override the default action, call IMediaEvent::CancelDefaultHandling. Event codes are defined in the header files Evcode.h and Audevcod.h. If there is no default action, the Filter Graph Manager automatically forwards the event to the application (through the event queue).

Custom Events

Filters can define custom events with event codes in the range EC_USER and higher. The Filter Graph Manager will place these directly in the event queue. However, the following caveats apply:

  • The Filter Graph Manager cannot free the event parameters using the normal IMediaEvent::FreeEventParams method. The application must free any memory or reference counts associated with the event parameters.
  • The filter should only send the event from within an application that is prepared to handle the event. (Possibly the application can set a custom property on the filter to indicate that it is safe to send the event.)
Event notification code Description
EC_ACTIVATE A video window is being activated or deactivated.
EC_BUFFERING_DATA The graph is buffering data, or has stopped buffering data.
EC_BUILT Send by the Video Control when a graph has been built. Not forwarded to applications.
EC_CLOCK_CHANGED The reference clock has changed.
EC_CLOCK_UNSET The clock provider was disconnected.
EC_CODECAPI_EVENT Sent by an encoder to signal an encoding event.
EC_COMPLETE All data from a particular stream has been rendered.
EC_DEVICE_LOST A Plug and Play device was removed or has become available again.
EC_DISPLAY_CHANGED The display mode has changed.
EC_END_OF_SEGMENT The end of a segment has been reached.
EC_EOS_SOON Not supported.
EC_ERROR_STILLPLAYING An asynchronous command to run the graph has failed.
EC_ERRORABORT An operation was aborted because of an error.
EC_ERRORABORTEX An operation was aborted because of an error.
EC_FILE_CLOSED The source file was closed because of an unexpected event.
EC_FULLSCREEN_LOST The video renderer is switching out of full-screen mode.
EC_GRAPH_CHANGED The filter graph has changed.
EC_LENGTH_CHANGED The length of a source has changed.
EC_LOADSTATUS Notifies the application of progress when opening a network file.
EC_MARKER_HIT Not supported.
EC_NEED_RESTART A filter is requesting that the graph be restarted.
EC_NEW_PIN Not supported.
EC_NOTIFY_WINDOW Notifies a filter of the video renderer's window.
EC_OLE_EVENT A filter is passing a text string to the application.
EC_OPENING_FILE The graph is opening a file, or has finished opening a file.
EC_PALETTE_CHANGED The video palette has changed.
EC_PAUSED A pause request has completed.
EC_PLEASE_REOPEN The source file has changed.
EC_PREPROCESS_COMPLETE Sent by the WM ASF Writer filter when it completes the pre-processing for multipass encoding.
EC_PROCESSING_LATENCY Indicates the amount of time that a component is taking to process each sample.
EC_QUALITY_CHANGE The graph is dropping samples, for quality control.
EC_REPAINT A video renderer requires a repaint.
EC_SAMPLE_LATENCY Specifies how far behind schedule a component is for processing samples.
EC_SAMPLE_NEEDED Requests a new input sample from the Enhanced Video Renderer (EVR) filter.
EC_SCRUB_TIME Specifies the time stamp for the most recent frame step.
EC_SEGMENT_STARTED A new segment has started.
EC_SHUTTING_DOWN The filter graph is shutting down, prior to being destroyed.
EC_SNDDEV_IN_ERROR A device error has occurred in an audio capture filter.
EC_SNDDEV_OUT_ERROR A device error has occurred in an audio renderer filter.
EC_STARVATION A filter is not receiving enough data.
EC_STATE_CHANGE The filter graph has changed state.
EC_STATUS Contains two arbitrary status strings.
EC_STEP_COMPLETE A filter performing frame stepping has stepped the specified number of frames.
EC_STREAM_CONTROL_STARTED A stream-control start command has taken effect.
EC_STREAM_CONTROL_STOPPED A stream-control stop command has taken effect.
EC_STREAM_ERROR_STILLPLAYING An error has occurred in a stream. The stream is still playing.
EC_STREAM_ERROR_STOPPED A stream has stopped because of an error.
EC_UNBUILT Send by the Video Control when a graph has been torn down. Not forwarded to applications.
EC_USERABORT The user has terminated playback.
EC_VIDEO_SIZE_CHANGED The native video size has changed.
EC_VIDEOFRAMEREADY A video frame is ready for display.
EC_VMR_RECONNECTION_FAILED Sent by the VMR-7 and the VMR-9 when it was unable to accept a dynamic format change request from the upstream decoder.
EC_VMR_RENDERDEVICE_SET Sent when the VMR has selected its rendering mechanism.
EC_VMR_SURFACE_FLIPPED Sent when the VMR-7's allocator presenter has called the DirectDraw Flip method on the surface being presented.
EC_WINDOW_DESTROYED The video renderer was destroyed or removed from the graph.
EC_WMT_EVENT Sent by the WM ASF Reader filter when it reads ASF files protected by digital rights management (DRM).
EC_WMT_INDEX_EVENT Sent when an application uses the WM ASF Writer to index Windows Media Video files.


Constants and GUIDs

Event Notification in DirectShow