Skip to content

Graph event notifications through IMediaEventEx

(see the IMediaEventEx documentation)

#define EC_MPE_TERMINATED_SUCCESS  EC_USER + 0x5501
#define EC_MPE_TERMINATED_ERROR    EC_USER + 0x5502
#define EC_MPE_LOGBUFFER_UPDATED   EC_USER + 0x5503
#define EC_MPE_EVALUATION_TIMEOUT  EC_USER + 0x5504
Event Meaning
EC_MPE_TERMINATED_SUCCESS the FFmpeg processing ended successfully before the graph was stopped
EC_MPE_TERMINATED_ERROR an error occurred while NOABORTONERROR was specified; the graph is not stopped
EC_MPE_LOGBUFFER_UPDATED the log buffer has been updated
EC_MPE_EVALUATION_TIMEOUT evaluation version only: the 1-minute encoding limit expired

EC_MPE_TERMINATED_ERROR vs EC_ERRORABORT

By default, if an error occurs after the graph is run, the filter notifies the graph with an EC_ERRORABORT event that stops the graph.

The NOABORTONERROR keyword, specified at the beginning of the command line, prevents the filter from stopping the graph: when an error occurs, the filter sends a EC_MPE_TERMINATED_ERROR notification instead, which the application can handle without the graph being stopped.

EC_MPE_TERMINATED_SUCCESS

If the FFmpeg processing ends successfully before the graph is stopped (e.g. if a maximal encoding duration has been specified in the command line), the filter sends a EC_MPE_TERMINATED_SUCCESS event to the graph.

EC_MPE_LOGBUFFER_UPDATED

Each time the log buffer has been updated, the filter sends a EC_MPE_LOGBUFFER_UPDATED event to the graph.

On this event, GetCurrentLog returns the new log content, and the GetProgress... functions return their updated values.

Retrieving the sender instance when several instances of the Multipurpose Encoder are used in the same graph

For all the events described above, Param1 and Param2 return the following values:

Param1: returns the exit code of FFmpeg.

Param2:

  • by default, Param2 returns the pointer to the filter instance, that is the same IBaseFilter pointer that CoCreateInstance returned,
  • when SetMediaEventSinkNotifyID has been called with a value of the application's choice, Param2 returns that value instead of the IBaseFilter pointer.

When several Multipurpose Encoders are used within the same graph, either mechanism identifies which instance sent the event notification.