X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmisc%2Ffilter_chain.c;h=3fd4c31991ce7e43b6a75788a436a850109cb6a9;hb=2a6fdbb4b001bf8553e98b5ea75914aac84ad293;hp=87f3feed9f90e412ceed753cc9d7b5d1d2c9d3c5;hpb=24c96490ebea5843e389de91b87670b408b3267c;p=vlc diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c index 87f3feed9f..3fd4c31991 100644 --- a/src/misc/filter_chain.c +++ b/src/misc/filter_chain.c @@ -97,15 +97,16 @@ static int filter_chain_DeleteFilterInternal( filter_chain_t *, filter_t * ); static int UpdateBufferFunctions( filter_chain_t * ); +#undef filter_chain_New /** * Filter chain initialisation */ -filter_chain_t *__filter_chain_New( vlc_object_t *p_this, - const char *psz_capability, - bool b_allow_fmt_out_change, - int (*pf_buffer_allocation_init)( filter_t *, void * ), - void (*pf_buffer_allocation_clean)( filter_t * ), - void *p_buffer_allocation_data ) +filter_chain_t *filter_chain_New( vlc_object_t *p_this, + const char *psz_capability, + bool b_allow_fmt_out_change, + int (*pf_buffer_allocation_init)( filter_t *, void * ), + void (*pf_buffer_allocation_clean)( filter_t * ), + void *p_buffer_allocation_data ) { assert( p_this ); assert( psz_capability ); @@ -267,13 +268,13 @@ int filter_chain_MouseFilter( filter_chain_t *p_chain, vlc_mouse_t *p_dst, const filter_t *p_filter = &f->filter; vlc_mouse_t *p_mouse = f->mouse; - if( p_filter->pf_mouse && p_mouse ) + if( p_filter->pf_video_mouse && p_mouse ) { vlc_mouse_t old = *p_mouse; vlc_mouse_t filtered; *p_mouse = current; - if( p_filter->pf_mouse( p_filter, &filtered, &old, ¤t ) ) + if( p_filter->pf_video_mouse( p_filter, &filtered, &old, ¤t ) ) return VLC_EGENERIC; current = filtered; } @@ -283,6 +284,25 @@ int filter_chain_MouseFilter( filter_chain_t *p_chain, vlc_mouse_t *p_dst, const 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, @@ -366,7 +386,6 @@ error: module_unneed( p_filter, p_filter->p_module ); es_format_Clean( &p_filter->fmt_in ); es_format_Clean( &p_filter->fmt_out ); - vlc_object_detach( p_filter ); vlc_object_release( p_filter ); return NULL; } @@ -438,7 +457,6 @@ static int filter_chain_DeleteFilterInternal( filter_chain_t *p_chain, else AllocatorClean( &p_chain->allocator, p_chained ); - vlc_object_detach( p_filter ); if( p_filter->p_module ) module_unneed( p_filter, p_filter->p_module ); free( p_chained->mouse ); @@ -518,20 +536,20 @@ static int InternalVideoInit( filter_t *p_filter, void *p_data ) { VLC_UNUSED(p_data); - p_filter->pf_vout_buffer_new = VideoBufferNew; - p_filter->pf_vout_buffer_del = VideoBufferDelete; + p_filter->pf_video_buffer_new = VideoBufferNew; + p_filter->pf_video_buffer_del = VideoBufferDelete; return VLC_SUCCESS; } static void InternalVideoClean( filter_t *p_filter ) { - p_filter->pf_vout_buffer_new = NULL; - p_filter->pf_vout_buffer_del = NULL; + p_filter->pf_video_buffer_new = NULL; + p_filter->pf_video_buffer_del = NULL; } static bool IsInternalVideoAllocator( chained_filter_t *p_filter ) { - return p_filter->filter.pf_vout_buffer_new == VideoBufferNew; + return p_filter->filter.pf_video_buffer_new == VideoBufferNew; } /* */