output: add drain function to wait for the buffers to drain

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
demux: stop after drain instead of simple stop

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>