[vlc-devel] Re: How to embed VLC in my C application

Rémi Denis-Courmont rem at videolan.org
Tue Jun 12 16:30:59 CEST 2007


	Hello,

Le mardi 12 juin 2007, Herman Schultz a écrit :
> I am trying to embed&invoke VLC in my c application.
>
> I invoke VLC like this:
> // i_argc is an int
> // ppsz_argv2  is char* ppsz_argv2[]
>
> int  i_ret = VLC_Create();
> i_ret = VLC_Init( 0, i_argc, ppsz_argv2 );
> i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE, VLC_TRUE );
>
> It works the first time when I do this.
> But when I do that the same i_argc, ppsz_arg2[] the second time, I
> get an segmentation inside VLC_Init().
>
> Can you please tell me why is there? Or if that is the right way to
> embed/invoke VLC in my own application.

There are two reasons why they crashes:
The bad reason is that VLC 0.8.6 is not quite multi-instance-safe yet; 
we are trying to solve this in upcoming version 0.9.0 but we would need 
people to test this seriously.

The good reason is that the "VLC" API (as used in src/vlc.c) uses main 
VLC object number "0". Given object numbers are shared across a 
process, there cannot be two VLC instance using object number 0. In 
other word, without some changes, the "VLC" API cannot be used to spawn 
more than one instance at a time.

*However*, as Pierre pointed out, the newer LibVLC media control API 
should work fine.

-- 
Rémi Denis-Courmont
http://www.remlab.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20070612/3f8c9f33/attachment.sig>


More information about the vlc-devel mailing list