[vlc-devel] Ticket #686: mozilla plugin and instances of libvlc

Rémi Denis-Courmont rdenis at simphalempin.com
Thu Sep 18 11:46:24 CEST 2008


On Thu, 18 Sep 2008 10:02:16 +0200, Justus-bulk at Piater.name wrote:
> I've taken a first look at Ticket #686 (and fixed a few, apparently
> inconsequential, bugs along the way; see forthcoming patches).  Before
> moving on, there are a few issues I need to understand:
> 
> - http://wiki.videolan.org/Documentation:Hacker's_Guide/libvlc says:
>   "Libvlc is a singleton. For each application wrapped around libvlc,
>   only one libvlc instance should be running." I take this to mean
>   that within an address space, only one libvlc instance is allowed.

This is totally wrong. As with many wikis, it contains out-of-date or plain
wrong informations.

>   This raises the following questions:
> 
>   - The mozilla plugin (mozilla/vlcplugin.c:188) calls libvlc_new()
>     for each plugin instance.  So this is a fundamental bug?

That's correct.

>   - If a libvlc "instance" is a singleton, why does one need to call a
>     function called "...new()" returning a pointer to an instance,
>     instead of calling a function called "...init()" and not worrying
>     about the (unique!?) instance pointer?

Because it's not a singleton. The libvlc object is a singleton within the
libvlc instance, and the root object is a singleton within the process. The
libvlc instance is not a singleton at all.

> - http://wiki.videolan.org/Documentation:Hacker's_Guide/Core says:
>   "Having several input and video_output threads reading multiple
>   files at the same time is permitted, despite the fact that the
>   current interface doesn't allow any way to do it [this is subject to
>   change in the near future]. Anyway the client has been written from
>   the ground up with this in mind."

This is again wrong, as VLM allows multiple inputs at the same time from
within the same instance. However, many code paths assume there is a only
one of these per instance, especially the interfaces.

>   - Is this the way the mozilla plugin should be properly implemented
>     to permit multiple plugin instances to coexist?

You should probably use one libvlc instance per plugin instance.

-- 
Rémi Denis-Courmont




More information about the vlc-devel mailing list