[MPlayer-dev-eng] mplayer's main function currently sucks

Adam Rice adamrice at ntlworld.com
Sat Dec 27 17:17:41 CET 2003


Quoting Arpi (arpi at thot.banki.hu):
> you should check again. that 3000 (really so much?) lines are not the
> whole program, it's just the init and uninit code, and the main loop,
> full of function calls and the a-v sync correction & control math.
> feel free to implement it in fewer lines (i'm trying to do it in
> mplayer-g2, with no much success)...

Should be pretty straightforward. Last time I looked at mplayer's main()
function, once I'd stopped laughing, I worked out a plan for tidying it up.
Basically, you've got a bunch of initialisations that need to be done, and you
need to do them in the right order. So you split the source into modules, and
each module has an initialisation function and a list of dependancies (of the
other modules that must be initialised first). Then you construct a dependancy
tree and walk it, initialising each module before the ones that depend on it.
If you wanted to be l33t you could do it at compile time using make, but it'd
be perfectly fast enough to do at runtime.

Adam

-- 
Adam Rice -- adamrice at ntlworld.com -- Blackburn, Lancashire, England




More information about the MPlayer-dev-eng mailing list