Buffering improvement, interrupt callback in ffmpeg, code style fixes