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
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.
You can prevent the filter from stopping the graph by specifying the NOABORTONERROR keyword at the beginning of the command line. In this case, if an error occurs the filter sends a EC_MPE_TERMINATED_ERROR notification message that you can handle but that does not stop the graph.
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.
When this event is received you can successfully invoke GetCurrentLog to retrieve the log content, or read one of the GetProgress... functions to retrieve the corresponding value.
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 instance of the filter (the same IBaseFilter pointer that has been returned when you invoked
CoCreateInstance(CLSID_DatasteadMultipurposeDirectShowEncoder...)), - when configuring the filter, if you have invoked SetMediaEventSinkNotifyID with a value of your choice, Param2 returns this value (instead of the IBaseFilter pointer).
In the case where several Multipurpose Encoders are used within the same graph, any of these 2 mechanisms lets you easily retrieve what instance of the Multipurpose Encoder sent the event notification.