Avoid duplicating the detection in every decoder, and avoid any threading
issues by calling the EndOfStream from the main processing thread, instead
of trying to flush from the decode thread.
Performing the image redraw from the main thread (which calls the DVD HLI
function) will easily result in a deadlock. Instead, perform the redraw
from a dedicated worker thread, which allows the main thread to release
all locks and the app to remain functional.