Stability improvements and better streaming (chromecast mostly)

I have done major changes to the play, metadata and restart process. 

The code redesign, includes:
* a much better multithreading support
* preventives restart/reconnect to avoid delays when playing
* locks and semaphores to avoid errors when multiple calls needs are done.

Benefits:
* I reduced the play lag to almost zero. Time to time, it reconnects and you still see lag, but not often.
* I haven't meet anymore the "cannot cast" screen in chromecast. Further testing still required to be able to say all cases are solved, but works better than before for sure.
* It can stream using DLNA. It has lag, but at least do not give errrors.