[MPlayer-dev-eng] [PATCH] allow builtin codecs table to be const

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Dec 4 19:37:39 CET 2007


Hello,
On Tue, Dec 04, 2007 at 05:33:11PM +0200, Uoti Urpala wrote:
> On Mon, 2007-12-03 at 08:26 +0100, Reimar Döffinger wrote:
[...]
> > When someone messes up and passed an invalid pointer...
> 
> IMO that should be abort() and not return -1.

Probably. Though I think the current code is too messy anyway to be
applied.

> 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.

Actually getting the index from the pointer is trivial, I don't really
think it is necessary to avoid that. What made it complex is that the
functions do not know if it is an audio or a video codec - and I just
realized that this is trivial to fix.
But actually the concept of tagging the already tried codecs might be
rather stupid anyway, the tagged codecs all respond to the same fourcc,
so the O(f(n)) performance does not really matter and we could just do
something like use a (realloced) list of pointers to the strdup'd codec
names which would make this completely independent of the structure of
the codec list used.
What do you think?

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list