[MPlayer-dev-eng] PATCH: XviD/OpenDivX vs mplayer namespace clash
cjb at AdvancedDataSolutions.com
Mon Jan 7 01:35:44 CET 2002
On Sun, 6 Jan 2002, Arpi wrote:
> but i don't really understand the sense of this patch.
> opendivx decode is NOT compiled and linked if external divx4/odivx/xvid liek
> library is used. and even if it would be linked, it won't eb used as both
> libs use encore() and decore() functions so they always clash...
The problem is not a clash between the two libraries, but a
namespace problem with mplayer. The opendivx lib defines global
variables named `idct' and `postprocess', and mplayer has functions
with these names. This causes a classic GNU linker problem; when
you try to write to the variable, you get a sig11. Try this:
/*File read.c: gcc -o read read.c*/
extern int read;
int main (int argc, char **argv)
read = 1;
It will compile and link, even tho you haven't defined the variable.
It will gleefully segfault in your face, too, because you just tried
to write into code-space, namely, the read() call.
Companies use this kind of little snip to sell their commercial
Although it's a pain in the ass, a general-purpose library shouldn't
define globals at all, but it definitely shouldn't define globals without
> so i see no sense of patching decore/* to get xvid working, as you cannot
> use both library in hte same mplayer binary.
> currently, if divx4linux is detected/selected then opendivx won't be
> compiled. we should just replace divx4linxu by xvid when it gets stable.
> (last time we tried it just did sig11)
...and so did I, and the above was the reason. Now, if I could
only get the brightness/contrast stuff hacked in, I'd have everything
I need to make me happy (for the next few hours, anyway).
BTW, I think it would be nice if you guys would liberalize your
CC policy a bit. I interfere with a lot of projects, and if the message
comes in the middle of a mailing-list, I tend to miss it.
Only if you actually want to hear back from me, of course ;)
---- ``Windows: It does that sometimes.'' -mattdm
Chris J. Bednar
Director, Distributed Computing Product Group
More information about the MPlayer-dev-eng