Handling End of Stream in AVStream Codecs

When a HW MFT receives a sample with an end of stream (EOS) flag set, it sets KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM in the OptionsFlag member of the KSSTREAM_HEADER structure that corresponds to that sample.

After the minidriver receives a KSSTREAM_POINTER with the KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM flag set in StreamHeader.OptionsFlag, the input pin will not receive any new input stream pointers until the minidriver sets KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM on an output stream pointer.

Before the minidriver sets KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM on an output stream pointer, it should generate as many output frames as possible with currently available inputs.

The minidriver should then clear any cached information related to previously processed stream pointers, in addition to the data associated with these stream pointers. Then the minidriver should set KSSTREAM_HEADER_OPTIONSF_ENDOFSTREAM on the output pin.

The minidriver should treat new input stream pointers that arrive subsequently as part of a new stream. An exception is if the EOS occurs as a result of a discontinuity in the media stream. If this is the case,the newly arriving stream pointer would have KSSTREAM_HEADER_OPTIONSF_DATADISCONTINUITY or KSSTREAM_HEADER_OPTIONSF_TIMEDISCONTINUITY, or both, flags set in KSSTREAM_HEADER.OptionsFlags. If stream pointers with one of these flags set arrive at the input pin, the minidriver must set the same flags on the corresponding output pin's stream pointer.