[vlc-devel] A little coding advice needed for creating stream_t objects.
Pierre d'Herbemont
pdherbemont at free.fr
Tue Jul 8 02:00:22 CEST 2008
Hi Bill,
stream_t is not exposed for apps that uses libvlc. Yet you can write
your own module.so that uses stream_t (linked against libvlccore), and
ask libvlc to load it.
May I ask you why you need stream_t objects and what are you trying to
achieve?
Pierre.
On Jul 7, 2008, at 6:51 PM, Bill C. Riemers wrote:
> I have a some code I've written as a standalone application that needs
> to create vlc stream_t objects. I have written a kludge, but the
> biggest problem with this kludge is it requires I include files
> directly
> from the vlc source tree. I am looking for a way to accomplish the
> same thing, without depending on vlc source tree.
>
> The following is my kludge for create a vlm object for use with
> stream_UrlNew calls.
>
>
> static vlc_object_t p_vlm = NULL;
>
> static int libvlc_vlm_init( libvlc_instance_t *p_instance,
> libvlc_exception_t *p_exception )
> {
> #ifdef ENABLE_VLM
> if( !p_instance->p_vlm )
> p_instance->p_vlm = vlm_New( p_instance->p_libvlc_int );
> #else
> libvlc_exception_raise( p_exception, "VLM has been disabled in this
> libvlc." );
> return VLC_EGENERIC;
> #endif
>
> if( !p_instance->p_vlm )
> {
> libvlc_exception_raise( p_exception,
> "Unable to create VLM." );
> return VLC_EGENERIC;
> }
> return VLC_SUCCESS;
> }
>
> void foo_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;
> 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