correct handling of eof (drain mode)
correct handling of eof (drain mode)

didn't manage to make it work with the infinite loop fix (mutex unlock at L1816)

j-b-m/mlt,j-b-m/mlt,j-b-m/mlt,mltframework/mlt,j-b-m/mlt,mltframework/mlt,j-b-m/mlt,j-b-m/mlt,mltframework/mlt,j-b-m/mlt,mltframework/mlt,mltframework/mlt,j-b-m/mlt,mltframework/mlt,mltframework/mlt,j-b-m/mlt,j-b-m/mlt,mltframework/mlt,mltframework/mlt,mltframework/mlt