SCR: get tune code from seife's implementation

cherrypicking: https://github.com/seife/tvheadend/tree/e0d07fa2397cdc254349769806273b6c081a3c13
SCR: commit before i lost it. rewrite tune code, so it fits new dvb-rewrite tree. only first part.