merge source code from https://github.com/muhku/FreeStreamer/commit/17185d46e77f2db3b0e5cd6e7fa64d139929d111