On Sun, Dec 08, 2002 at 03:54:40PM +0100, Paul Dwerryhouse wrote:
>
> It's funny this should come up - I'm actually attempting to write a
> Mozilla plugin using avifile, right now. At this stage I'm just using
> the sample libnullplugin that's provided with Mozilla, and shoving the
> following code in the "NPP_New" function:
>
> #define FILE "mms://media4.abc.net.au/triplej"
>
> avm::IAviPlayer *player; player = avm:: CreateAviPlayer (FILE,0,0,0); while
>(!player->IsOpened()) { sleep(1); }
>
> player->Start();
>
> while (1) {
> player->Play();
> sleep(1);
> }
>
> Now, this code works fine when put in it's own little standalone
> program, but when run as a mozilla plugin, I get warnings that it can't
> open the codec libraries:
>
Ah yes. I believe I can shed some light on this.
I while back I attempted to write an avifile plugin for XMMS and
found that I got weird link problems. I don't understand the details
myself, but it goes something like this: XMMS (or in your case Moz) and
avifile 0.6 both use plugin systems. Some of avifile's plugins reference
functions in the avifile library core. So: XMMS dlopen()'s the avifile
plugin, the XMMS plugin automatically dynamically link in the avifile
library core and the avifile library core dlopen()'s its codec plugins.
For some reason that last dlopen() fails because the symbols in the codec
plugins, which should be resolved in the library core, come up unresolved
instead.
I ended up turning the "plugin" into a patch to the XMMS source so
that avifile actually becomes one of XMMS's libs. This is okayish because
XMMS is an easy compile, which is most certainly not the case for Moz.
Unless I've missed something, your only other solution is to invoke
Moz with LD_PRELOAD=yourpluginlib.so. This can also be done "once and
for all" by putting "/path/to/yourpluginlib.so" in /etc/ld.so.preload,
but this is probably an even worse idea: the avifile lib will be loaded
with *every* executable that's run, and will also make it impossible
to run any executable if there's a typo or if the .so goes away at some
point.
Anyways, hope this helps. If you find a third alternative,
I'd be highly interested.
--
| One would think the grandeur of the universe needs
Steve Freeland | no assistance from Walter Cronkite. One would think
[EMAIL PROTECTED] | wrong. -- Neil Postman, "Amusing Ourselves To Death"
_______________________________________________
Avifile mailing list
[EMAIL PROTECTED]
http://prak.org/mailman/listinfo/avifile