Page 1 of 1

vlc modules

Posted: 04 Apr 2016 19:06
by pedja1
I am creating android application that uses libvlc to play a video.
Since vlc/libvlc doesnt have any kind of event/callback for subtitles i have created my own text renderer module in modules/text_rendere/spucallback

Module compiles, but i have two problems.:

1. I dont see any log messages from this module
2. How can i use this module from libvlc

callback.h

Code: Select all

typedef void (*spu_cb_t)(text_segment_t *p_segment); struct spu_cb_t { spu_cb_t cb; }; struct spu_cb_t *callback;
callback.c

Code: Select all

#ifdef HAVE_CONFIG_H # include "config.h" #endif #include <stdlib.h> /* VLC core API headers */ #include <vlc_common.h> #include <vlc_plugin.h> #include <vlc_interface.h> #include <vlc_filter.h> #include "callback.h" static int Open(vlc_object_t *); static void Close(vlc_object_t *); static int RenderText(filter_t *, subpicture_region_t *p_region_out, subpicture_region_t *p_region_in, const vlc_fourcc_t *p_chroma_list); /* Module descriptor */ vlc_module_begin() set_shortname(N_("SPU Callback ")) set_description(N_("SPU Callback module")) set_capability("text renderer", 0) set_callbacks(Open, Close) set_category(CAT_VIDEO) vlc_module_end () static int Open(vlc_object_t *p_this) { filter_t *p_filter = (filter_t *)p_this; p_filter->pf_render = RenderText; printf("spucallback:Open"); callback = (spu_cb_t*) malloc(sizeof(spu_cb_t)); if (!callback) goto error; return VLC_SUCCESS; error: free(callback); return VLC_EGENERIC; } static void Close(vlc_object_t *p_this) { printf("spucallback:Close"); free(callback->cb); free(callback); } static int RenderText(filter_t *p_filter, subpicture_region_t *p_region_out, subpicture_region_t *p_region_in, const vlc_fourcc_t *p_chroma_list) { text_segment_t *p_segment = p_region_in->p_text; callback->cb(p_segment); printf("spucallback:RenderText"); return VLC_SUCCESS; }
Code is not yet finished obviously

Re: vlc modules

Posted: 28 Jun 2016 10:00
by Jean-Baptiste Kempf
What kind of callback? one everytime a subtitles is shown?