Merged changes from upstream splayer.
Added buffering variable.