[vlc-devel] A little coding advice needed for creating stream_t objects.

Pierre d'Herbemont pdherbemont at free.fr
Tue Jul 8 21:08:20 CEST 2008


Hi Bill,

I think I now understand your problem better.

You need a vlc_object_t to use stream_UrlNew().

I think we could add a "libvlc_int_t * libvlc_int_from_libvlc_instance  
(libvlc_instance_t * )" somewhere in a new libvlccore's header, to  
convert the libvlc's libvlc_instance type to libvlccore's libvlc_int  
type.

What do you think?

Pierre.

On Jul 7, 2008, at 7:10 PM, Bill C. Riemers wrote:

> Opps.  What I provided was a slight simplification of my actual code.
> But I see I forgot to adjust to the void return type I specified in my
> sample.
>
> My actual code does return a value I can later use for a VLC_Destroy
> function...
>
> Here is the actual code I use:
>
> void *VLC_Init() {
>    vlcmodule_t *p_vlcmodule = (vlcmodule_t  
> *)calloc(1,sizeof(vlcmodule_t));
>    if(p_vlcmodule == NULL ) {
>        goto outofmemory;
>    }
>    p_vlcmodule->destroy = vlcmodule_destroy;
>    libvlc_exception_t *p_ex = &p_vlcmodule->ex;
>    libvlc_exception_t *p_dummy = &p_vlcmodule->dummy;
>    libvlc_exception_init (p_ex);
>    libvlc_exception_init (p_dummy);
>
>    static const char *args[] = {"cvlc","-I","dummy",NULL};
>    p_vlcmodule->vlc = libvlc_new(3,args,p_ex);
>    if (p_vlcmodule->vlc == NULL)
>    {
>        goto error;
>    }
>
>    libvlc_add_intf (p_vlcmodule->vlc, "signals", p_dummy);
>    libvlc_add_intf (p_vlcmodule->vlc, NULL, p_ex);
>    libvlc_vlm_init (p_vlcmodule->vlc, p_ex);
>    p_vlm = (vlc_object_t *)p_vlcmodule->vlc->p_vlm;
>    p_close_list = createDoubleLinkList(close_list_element_destroy);
>    return p_vlcmodule;
>
> error:
>    VLC_Destroy((vlc_object_t *)p_vlcmodule);
>    return NULL;
>
> outofmemory:
>    {
>        libvlc_exception_t ex;
>        libvlc_exception_init ( &ex );
>        libvlc_exception_raise( &ex, "Out of memory.");
>    }
>    return NULL;
> }
>
>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>




More information about the vlc-devel mailing list