Fixing xine’s minor issues

So, as my mmap() work is still incomplete, waiting for Thibaut to take a look and see if he can implement per-plugin buffer on the input plugins (so that every plugin will use the best buffering method they can think of, and thus a simple memory area for mmapped files), and the RTP/RTSP protocol requires so much work that’s undoable until the above mentioned plugin change is done, I’ve decided to fix a few little outstanding issues.

I’ve fixed a the proxy on localhost issue that was pointed out by Mark of the Amarok team, by checking that the IP (v4) address of the given hostname is not before connecting to the proxy, and this is a good thing for Amarok that uses a localhost streaming server for Last.FM proxy.

Also, I reduced the timeout on connection. Basically the problem was that, depending if IPv6 was enabled or not, xine would have either used a non-blocking socket (IPv6 disabled), and waited for 20s for the timeout, or tried all the hosts found (IPv6 enabled) till one “hit”, but with very slow timeouts, the default of blocking connections. My solution was actually simple: if there are other hosts to try, let’s try connecting to them; if only a host is found, use non-blocking and be done with that. This covers probably 90% of the users of HTTP streaming (as usually you get directly the IP of the streaming server); plus I changed the connection timeout so that it’s configurable as the network timeout (that was missing before) so that people on fast lines can short it down.

Finally, I fixed the problem of the “No suitable input plugin” message returned by xine’s frontends when the HTTP connection was broken, or the file that is being trying to open is inaccessible, by implementing a “failure” method. The open function can either return 0 (not handled), 1 (handled) or –1 (handled, but unable to open). In the third error, no more tries are done to open the input plugin.

Most of these issues are related to Amarok, but I promise I’ll try also to fix issues for other frontends and uses soon 🙂
I think I should start learning fontconfig, to use that to load the fonts, as requested on one of the feature requests (by Bastien Nocera), that will allow to use TrueType fonts for subtitles, and would be anyway needed if I were to implement ASS subitles support in xine (as they can define the font to use).

I just hope that there are still xine users out there, and not everybody moved to mplayer/gstreamer/vlc already :/