A 13-year legal battle ends as judges rule in favour of the regulator, squeezing free-to-air channels that depend on ad revenue to survive