[MPlayer-dev-eng] [PATCH] allow builtin codecs table to be const
Uoti Urpala
uoti.urpala at pp1.inet.fi
Tue Dec 4 16:33:11 CET 2007
On Mon, 2007-12-03 at 08:26 +0100, Reimar Döffinger wrote:
> On Mon, Dec 03, 2007 at 05:17:18AM +0200, Uoti Urpala wrote:
> > it significantly smaller. The infmt and inflags fields do not seem to be
> > used for anything. Most codecs do not have many output formats or
> > fourccs, so storing a count plus a pointer to an array instead of a
> > constant-sized array per codec would use much less memory (though with
> > slightly more complicated code). I think that would drop the total size
> > to about one fifth.
>
> It's no problem for the parsed codecs.conf, it just seems like it would
> be a real mess for the builtin one...
The builtin header would be the simpler case. Instead of "int t[32];" as
the field type and "{1,2,0,...,0}" in the header you'd have "int c; int
*t;" in the struct and "2, (int []){1, 2}" in the header.
> > +int get_codec_ptr_selected(const codecs_t *c) {
> > When is the return -1 case expected to happen?
>
> When someone messes up and passed an invalid pointer...
IMO that should be abort() and not return -1.
Instead of adding those functions to get the codec index back from the
pointer I think it might be simpler to either keep the index information
(as it is known when the codec is first found) or add a constant index
field to the codec struct.
More information about the MPlayer-dev-eng
mailing list