struct
{
- subpicture_t * (*pf_filter) ( filter_t *, mtime_t );
- subpicture_t * (*pf_buffer_new) ( filter_t * );
- void (*pf_buffer_del) ( filter_t *, subpicture_t * );
+ subpicture_t * (*pf_filter) ( filter_t *, mtime_t );
+ subpicture_t * (*pf_buffer_new)( filter_t * );
+ void (*pf_buffer_del)( filter_t *, subpicture_t * );
+ int (*pf_mouse) ( filter_t *,
+ const vlc_mouse_t *p_old,
+ const vlc_mouse_t *p_new,
+ const video_format_t * );
} sub;
#define pf_sub_filter u.sub.pf_filter
#define pf_sub_buffer_new u.sub.pf_buffer_new
#define pf_sub_buffer_del u.sub.pf_buffer_del
+#define pf_sub_mouse u.sub.pf_mouse
struct
{
*/
VLC_EXPORT( int, filter_chain_MouseFilter, ( filter_chain_t *, vlc_mouse_t *, const vlc_mouse_t * ) );
+/**
+ * Inform the filter chain of mouse state.
+ *
+ * It makes sense only for a sub filter chain.
+ */
+VLC_EXPORT( int, filter_chain_MouseEvent, ( filter_chain_t *, const vlc_mouse_t *, const video_format_t * ) );
+
#endif /* _VLC_FILTER_H */
filter_chain_GetFmtOut
filter_chain_GetLength
filter_chain_MouseFilter
+filter_chain_MouseEvent
filter_chain_New
filter_chain_Reset
filter_chain_SubFilter
return VLC_SUCCESS;
}
+int filter_chain_MouseEvent( filter_chain_t *p_chain,
+ const vlc_mouse_t *p_mouse,
+ const video_format_t *p_fmt )
+{
+ for( chained_filter_t *f = p_chain->first; f != NULL; f = f->next )
+ {
+ filter_t *p_filter = &f->filter;
+
+ if( p_filter->pf_sub_mouse )
+ {
+ vlc_mouse_t old = *f->mouse;
+ *f->mouse = *p_mouse;
+ if( p_filter->pf_sub_mouse( p_filter, &old, p_mouse, p_fmt ) )
+ return VLC_EGENERIC;
+ }
+ }
+
+ return VLC_SUCCESS;
+}
/* Helpers */
static filter_t *filter_chain_AppendFilterInternal( filter_chain_t *p_chain,
{
vlc_mouse_t tmp;
+ if (spu_ProcessMouse( vout->p->p_spu, m, &vout->fmt_out))
+ return;
+
vlc_mutex_lock( &vout->p->vfilter_lock );
if (vout->p->p_vf2_chain) {
if (!filter_chain_MouseFilter(vout->p->p_vf2_chain, &tmp, m))
void vout_RenderWrapper(vout_thread_t *, picture_t *);
void vout_DisplayWrapper(vout_thread_t *, picture_t *);
+/* */
+int spu_ProcessMouse(spu_t *, const vlc_mouse_t *, const video_format_t *);
+
#endif
/* Subpiture filters */
char *psz_chain_update;
+ vlc_mutex_t chain_lock;
filter_chain_t *p_chain;
/* */
p_sys->i_channel = 2;
p_sys->psz_chain_update = NULL;
+ vlc_mutex_init( &p_sys->chain_lock );
p_sys->p_chain = filter_chain_New( p_spu, "sub filter", false,
SubFilterAllocationInit,
SubFilterAllocationClean,
FilterRelease( p_sys->p_scale );
filter_chain_Delete( p_sys->p_chain );
+ vlc_mutex_destroy( &p_sys->chain_lock );
free( p_sys->psz_chain_update );
/* Destroy all remaining subpictures */
}
}
+/**
+ * Inform the SPU filters of mouse event
+ */
+int spu_ProcessMouse( spu_t *p_spu,
+ const vlc_mouse_t *p_mouse,
+ const video_format_t *p_fmt )
+{
+ spu_private_t *p_sys = p_spu->p;
+
+ vlc_mutex_lock( &p_sys->chain_lock );
+ filter_chain_MouseEvent( p_sys->p_chain, p_mouse, p_fmt );
+ vlc_mutex_unlock( &p_sys->chain_lock );
+
+ return VLC_SUCCESS;
+}
+
/**
* Display a subpicture
*
p_sys->psz_chain_update = NULL;
vlc_mutex_unlock( &p_sys->lock );
+ vlc_mutex_lock( &p_sys->chain_lock );
if( psz_chain_update )
{
filter_chain_Reset( p_sys->p_chain, NULL, NULL );
free( psz_chain_update );
}
-
/* Run subpicture filters */
filter_chain_SubFilter( p_sys->p_chain, render_osd_date );
+ vlc_mutex_unlock( &p_sys->chain_lock );
vlc_mutex_lock( &p_sys->lock );