Refractored mplayer/mpv code