[MPlayer-dev-eng] Re: [PATCH] Clean up demuxers
Alban Bedel
albeu at free.fr
Sun Feb 24 18:03:06 CET 2002
Hi Daniel Egger,
on 24 Feb 2002 17:30:27 +0100 you wrote:
> Albeu wrote:
>
> > By principe I find this good but in practice you have missed some
> > points.
> > First DEMUXER_TYPE_MAX. I added an option to allow forcing demuxer selection,
> > in case it's needed. So DEMUXER_TYPE_MAX must match the highest ,user
> > selectable, demuxer number. Not +1, the user will be able to end up in a stupid
> > situation (ie no demuxer have this number).
>
> Probably doesn't belong in th enum.
>
> > Then if DEMUXER_TYPE_DEMUXERS isn't numbered 18, it's because I don't want
> > the user to be able to force this demuxer. It's only for internal use.
> > So I decided, that normal demuxer will use only the first 16 bit.
> > And special demuxers will use,the last 16 bit.
>
> Not good. I'm using an array to dispatch the right functions, using high numbers
> means that the array takes a lot of (unused) memery which will smash the caches.
I saw, it's why I said your patch can't go with the actual code.
> > But I can't see how use it really with the last changes.
>
> I don't exactly know where you're aiming but it doesn't seem like a good
> idea to me to mix the special type DEMUXERS with the rest. I've an idea though:
> We could remove the _MAX and replace the it by
> (sizeof (demuxer) / sizeof (demuxer_func)) - 1. This way the user won't be able
> to select the last DEMUX which is your special case and the _MAX is gone.
There is now 2 special demuxer number :) And this look like a very bad solution.
Anyway using an array like you have done isn't the right way. You should put the
functions inside the demuxer_t struct itself. Then during opening, the demuxer
itself fill this fields with the correct function. It's the same thing but it doesn't need
any array or things like that. Even cleaner :)
Albeu
More information about the MPlayer-dev-eng
mailing list