ts: large rewrite of the TS muxer to produce better TS and support DVD