Page 1 of 1

Help with Libvlc structure

Posted: 30 Dec 2008 13:25
by Beardless2
Hi,

I am a little confused about the libvlc structure in order play mulitple video files in a single app.

For a simple case of a single instance of vlc, I need to create 1 x instance of vlc using libvlc_new, i then need a media player using libvlc_media_player_new, and finally a media item using libvlc_media_new.

If i want to have multiple vlcs in my app, do i need 2 x of everything? or 1 x vlc (i.e. just create one vlc instance) and 2 x media player/media item? or just 1 x vlc, 1 x media player and 2 x media items?

Chris

Re: Help with Libvlc structure

Posted: 30 Dec 2008 14:55
by erwan10
libvlc is a promising API, ....

but when it comes to playing multiple videos concurrently, some work still needs to be done.

case one:
- You create 1 single libvlc instance (libvlc_new) and multiple medias/media_players. It works perfectly except for the following:
- hotkeys are all mixed up (hotkeys pertaining to one video trigger action for another one)
- audio subsystem was never made multi-video friendly. you can only monitor one audio (chosen randomly) within a libvlc instance.

case two:
- You create as many libvlc instances (libvlc_new) as there are concurrent videos. Works fine except for the following:
- options passed to the libvlc instance are not independent. A new instance overwrites options set up for a previous one.
- that's a lot of threads (big overhead just for working out problems met with case one)

In both cases, from a OS point of view, only one vlc is created.

Re: Help with Libvlc structure

Posted: 30 Dec 2008 18:10
by Beardless2
thanks - that helps alot.

Do you know if the "work that needs to be done" is currently in development and will be out in time for v1.0 or a future minor release?

Re: Help with Libvlc structure

Posted: 30 Dec 2008 19:02
by erwan10
I wish I knew ..... But, I'm afraid these problems have not come up as top priorities and they don't seem to be much talked about for the vlc1.0.0 release.

Re: Help with Libvlc structure

Posted: 30 Dec 2008 19:54
by Beardless2
ok - maybe if a mod/developer can address there issues if they look in here?

Also, do you know the correct/safe way to destroy vlc. I.e. Stop the video, destroy the media item, then destroy the media player, then finally destroy the vlc instance - is that the correct order?

Re: Help with Libvlc structure

Posted: 30 Dec 2008 20:17
by erwan10
yes, the way you do it works.
Media item can be released early in the process, because media_player keeps a reference anyway.