Page 1 of 1

libvlc_new vs libvlc_retain with multiple videos

Posted: 17 Nov 2010 18:26
by Beardless2
Hi,

I am building an Win32 application that display four videos using four libvlc_media_player_t.

Please could someone list the advantages and disadvantage of using separate calls to libvlc_new to create four instances of LibVLC, or to make 1 call to libvlc_new and three calles to libvlc_retain to create just a single instance?

From doxygen : "You can create one (or more) instance(s) of LibVLC in a given process, with libvlc_new() and destroy them with libvlc_release()."

I believe in the past (1.0.x) I would be required to make multiple instances of libvlc to get around some bugs in libvlc, but wondered if this has now changed with 1.1.x?

Chris

Re: libvlc_new vs libvlc_retain with multiple videos

Posted: 17 Nov 2010 19:30
by Rémi Denis-Courmont
There are no benefits to creating multiple instances, other than simplifying your source code.

Re: libvlc_new vs libvlc_retain with multiple videos

Posted: 17 Nov 2010 21:37
by Beardless2
thanks, so no benefits but are there any drawbacks other than the extra source code? i.e. more memory usage, more threads etc?

Re: libvlc_new vs libvlc_retain with multiple videos

Posted: 18 Nov 2010 18:04
by Rémi Denis-Courmont
In recent versions, there shouldn't be any thread on a bare libvlc instance, at least on Linux. Of course, it will require a little bit more memory, but that should be peanuts to the cost of a media instance.