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

Herman Schultz herman.schultz at gmail.com
Tue Jun 12 21:31:46 CEST 2007


Thanks for the help.

I change my code to this:

libvlc_exception_t exception;
libvlc_exception_init( &exception );
libvlc_instance_t *p_i1 = libvlc_new( i_argc , ppsz_argv2, &exception );

if (p_i1 == NULL) {
     printf ("Instance creation failed" );  // I don't see this gets
print...
}

But 'vlc' does not get start either.
This is my argument to libvlc_new:

      char *ppsz_argv2[] = { "./vlc" ,
                  "-I"
                 "dummy",
                 "test.flv",
                 "--sout",
 "#transcode{vcodec=mp4v,vb=400}:rtp{dst=135.23.52.1,port-video=3342}" }

The above argument works for my 'old' way, i.e. this:

int  i_ret = VLC_Create();
i_ret = VLC_Init( 0, i_argc, ppsz_argv2 );
i_ret = VLC_AddIntf( 0, NULL, VLC_TRUE, VLC_TRUE );

Thank you for any help.





On 6/12/07, Rémi Denis-Courmont <rem at videolan.org> wrote:
>
>         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 --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20070612/08aab8a3/attachment.html>


More information about the vlc-devel mailing list