Second try at merging rockbox changes. Fixed invalid memory write, may apply on rockbox too Seek untested yet, but sample works properly (without memory leaks & crashs)