Data Structures | Typedefs | Functions | Variables

filter_chain.c File Reference

Include dependency graph for filter_chain.c:

Data Structures

struct  filter_chain_allocator_t
struct  chained_filter_t
struct  filter_chain_t

Typedefs

typedef struct chained_filter_t chained_filter_t

Functions

static chained_filter_tchained (filter_t *filter)
static int AllocatorInit (const filter_chain_allocator_t *, chained_filter_t *)
static void AllocatorClean (const filter_chain_allocator_t *, chained_filter_t *)
static bool IsInternalVideoAllocator (chained_filter_t *)
static int InternalVideoInit (filter_t *, void *)
static void InternalVideoClean (filter_t *)
static filter_tfilter_chain_AppendFilterInternal (filter_chain_t *, const char *, config_chain_t *, const es_format_t *, const es_format_t *)
 Local prototypes.
static int filter_chain_AppendFromStringInternal (filter_chain_t *, const char *)
static int filter_chain_DeleteFilterInternal (filter_chain_t *, filter_t *)
static int UpdateBufferFunctions (filter_chain_t *p_chain)
 This function should be called after every filter chain change.
static void FilterDeletePictures (filter_t *, picture_t *)
filter_chain_tfilter_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 initialisation.
void filter_chain_Delete (filter_chain_t *p_chain)
 Filter chain destruction.
void filter_chain_Reset (filter_chain_t *p_chain, const es_format_t *p_fmt_in, const es_format_t *p_fmt_out)
 Filter chain reinitialisation.
filter_tfilter_chain_AppendFilter (filter_chain_t *p_chain, const char *psz_name, config_chain_t *p_cfg, const es_format_t *p_fmt_in, const es_format_t *p_fmt_out)
 Append filter to the end of the chain.
int filter_chain_AppendFromString (filter_chain_t *p_chain, const char *psz_string)
 Append new filter to filter chain from string.
int filter_chain_DeleteFilter (filter_chain_t *p_chain, filter_t *p_filter)
 Delete filter from filter chain.
int filter_chain_GetLength (filter_chain_t *p_chain)
 Get the number of filters in the filter chain.
const es_format_tfilter_chain_GetFmtOut (filter_chain_t *p_chain)
 Get last p_fmt_out in the chain.
static picture_tFilterChainVideoFilter (chained_filter_t *f, picture_t *p_pic)
picture_tfilter_chain_VideoFilter (filter_chain_t *p_chain, picture_t *p_pic)
 Apply the filter chain to a video picture.
void filter_chain_VideoFlush (filter_chain_t *p_chain)
 Flush a video filter chain.
block_tfilter_chain_AudioFilter (filter_chain_t *p_chain, block_t *p_block)
 Apply the filter chain to a audio block.
void filter_chain_SubSource (filter_chain_t *p_chain, mtime_t display_date)
 Apply filter chain to subpictures.
subpicture_tfilter_chain_SubFilter (filter_chain_t *p_chain, subpicture_t *p_subpic)
 Apply filter chain to subpictures.
int filter_chain_MouseFilter (filter_chain_t *p_chain, vlc_mouse_t *p_dst, const vlc_mouse_t *p_src)
 Apply the filter chain to a mouse state.
int filter_chain_MouseEvent (filter_chain_t *p_chain, const vlc_mouse_t *p_mouse, const video_format_t *p_fmt)
 Inform the filter chain of mouse state.
static int UpdateVideoBufferFunctions (filter_chain_t *p_chain)
 Internal chain buffer handling.
static picture_tVideoBufferNew (filter_t *p_filter)
static void VideoBufferDelete (filter_t *p_filter, picture_t *p_picture)

Variables

static const
filter_chain_allocator_t 
internal_video_allocator

Typedef Documentation


Function Documentation

static void AllocatorClean ( const filter_chain_allocator_t p_alloc,
chained_filter_t p_filter 
) [static]
static int AllocatorInit ( const filter_chain_allocator_t p_alloc,
chained_filter_t p_filter 
) [static]
static chained_filter_t* chained ( filter_t filter  )  [inline, static]
filter_t* filter_chain_AppendFilter ( filter_chain_t ,
const char *  ,
config_chain_t ,
const es_format_t ,
const es_format_t  
)

Append filter to the end of the chain.

Parameters:
p_chain pointer to filter chain
psz_name name of filter
p_cfg 
p_fmt_in input es_format_t
p_fmt_out output es_format_t
Returns:
pointer to filter chain

References filter_chain_AppendFilterInternal(), msg_Err, and UpdateBufferFunctions().

Referenced by ThreadChangeFilters(), and VoutDisplayCreateRender().

static filter_t * filter_chain_AppendFilterInternal ( filter_chain_t p_chain,
const char *  psz_name,
config_chain_t p_cfg,
const es_format_t p_fmt_in,
const es_format_t p_fmt_out 
) [static]
int filter_chain_AppendFromString ( filter_chain_t ,
const char *   
)

Append new filter to filter chain from string.

Parameters:
p_chain pointer to filter chain
psz_string string of filters
Returns:
0 for success

References filter_chain_AppendFromStringInternal(), and UpdateBufferFunctions().

Referenced by spu_PutSubpicture(), and spu_Render().

static int filter_chain_AppendFromStringInternal ( filter_chain_t p_chain,
const char *  psz_string 
) [static]
block_t* filter_chain_AudioFilter ( filter_chain_t ,
block_t  
)

Apply the filter chain to a audio block.

Parameters:
p_chain pointer to filter chain
p_block audio frame to apply filters on
Returns:
modified audio frame after applying all audio filters

References filter_chain_t::first, and chained_filter_t::next.

void filter_chain_Delete ( filter_chain_t p_chain  ) 

Filter chain destruction.

Delete filter chain will delete all filters in the chain and free all allocated data.

References es_format_Clean(), filter_chain_Reset(), filter_chain_t::fmt_in, and filter_chain_t::fmt_out.

Referenced by spu_Destroy(), ThreadStop(), and VoutDisplayDestroyRender().

int filter_chain_DeleteFilter ( filter_chain_t ,
filter_t  
)

Delete filter from filter chain.

This function also releases the filter object and unloads the filter modules. The pointer to p_filter is no longer valid after this function successfully returns.

Parameters:
p_chain pointer to filter chain
p_filter pointer to filter object
Returns:
VLC_SUCCESS on succes, else VLC_EGENERIC

References filter_chain_DeleteFilterInternal(), and UpdateBufferFunctions().

static int filter_chain_DeleteFilterInternal ( filter_chain_t p_chain,
filter_t p_filter 
) [static]
const es_format_t* filter_chain_GetFmtOut ( filter_chain_t  ) 

Get last p_fmt_out in the chain.

Parameters:
p_chain pointer to filter chain
Returns:
last p_fmt (es_format_t) of this filter chain

References filter_chain_t::b_allow_fmt_out_change, chained_filter_t::filter, filter_t::fmt_out, filter_chain_t::fmt_out, and filter_chain_t::last.

Referenced by ThreadChangeFilters().

int filter_chain_GetLength ( filter_chain_t  ) 

Get the number of filters in the filter chain.

Parameters:
p_chain pointer to filter chain
Returns:
number of filters in this filter chain

References filter_chain_t::length.

Referenced by spu_PutSubpicture(), vout_FilterDisplay(), and VoutVideoFilterStaticNewPicture().

int filter_chain_MouseEvent ( filter_chain_t ,
const vlc_mouse_t ,
const video_format_t  
)

Inform the filter chain of mouse state.

It makes sense only for a sub source chain.

References filter_chain_t::first, chained_filter_t::next, and VLC_EGENERIC.

Referenced by spu_ProcessMouse().

int filter_chain_MouseFilter ( filter_chain_t ,
vlc_mouse_t ,
const vlc_mouse_t  
)

Apply the filter chain to a mouse state.

It will be applied from the output to the input. It makes sense only for a video filter chain.

The vlc_mouse_t* pointers may be the same.

References filter_chain_t::last, chained_filter_t::prev, and VLC_EGENERIC.

Referenced by vout_SendDisplayEventMouse().

filter_chain_t* filter_chain_New ( vlc_object_t p_this,
const char *  psz_capability,
bool  b_allow_fmt_out_change,
int(*)(filter_t *, void *)  pf_buffer_allocation_init,
void(*)(filter_t *)  pf_buffer_allocation_clean,
void *  p_buffer_allocation_data 
)
void filter_chain_Reset ( filter_chain_t p_chain,
const es_format_t p_fmt_in,
const es_format_t p_fmt_out 
)

Filter chain reinitialisation.

Reset filter chain will delete all filters in the chain and reset p_fmt_in and p_fmt_out to the new values.

References es_format_Clean(), es_format_Copy(), chained_filter_t::filter, filter_chain_DeleteFilterInternal(), filter_chain_t::first, filter_chain_t::fmt_in, and filter_chain_t::fmt_out.

Referenced by filter_chain_Delete(), spu_PutSubpicture(), spu_Render(), ThreadChangeFilters(), and VoutDisplayCreateRender().

subpicture_t* filter_chain_SubFilter ( filter_chain_t ,
subpicture_t  
)

Apply filter chain to subpictures.

Parameters:
p_chain pointer to filter chain
p_subpicture subpicture to apply filters on
Returns:
modified subpicture after applying all subpicture filters

References filter_chain_t::first, and chained_filter_t::next.

Referenced by spu_PutSubpicture().

void filter_chain_SubSource ( filter_chain_t ,
mtime_t   
)

Apply filter chain to subpictures.

Parameters:
p_chain pointer to filter chain
display_date of subpictures

References filter_chain_t::first, chained_filter_t::next, filter_chain_t::p_this, and spu_PutSubpicture().

Referenced by spu_Render().

picture_t* filter_chain_VideoFilter ( filter_chain_t ,
picture_t  
)

Apply the filter chain to a video picture.

Parameters:
p_chain pointer to filter chain
p_picture picture to apply filters on
Returns:
modified picture after applying all video filters

References FilterChainVideoFilter(), filter_chain_t::first, filter_chain_t::last, picture_t::p_next, and chained_filter_t::prev.

Referenced by ThreadDisplayPreparePicture(), ThreadDisplayRenderPicture(), and vout_FilterDisplay().

void filter_chain_VideoFlush ( filter_chain_t p_chain  ) 
static picture_t* FilterChainVideoFilter ( chained_filter_t f,
picture_t p_pic 
) [static]
static void FilterDeletePictures ( filter_t filter,
picture_t picture 
) [static]
static void InternalVideoClean ( filter_t p_filter  )  [static]
static int InternalVideoInit ( filter_t p_filter,
void *  p_data 
) [static]

References VLC_UNUSED.

static bool IsInternalVideoAllocator ( chained_filter_t p_filter  )  [static]
static int UpdateBufferFunctions ( filter_chain_t p_chain  )  [static]

This function should be called after every filter chain change.

References filter_chain_t::psz_capability, and UpdateVideoBufferFunctions().

Referenced by filter_chain_AppendFilter(), filter_chain_AppendFromString(), and filter_chain_DeleteFilter().

static int UpdateVideoBufferFunctions ( filter_chain_t p_chain  )  [static]

Internal chain buffer handling.

Last filter uses the filter chain's parent buffer allocation functions. All the other filters use internal functions. This makes it possible to have format changes between each filter without having to worry about the parent's picture heap format.

References filter_chain_t::allocator, AllocatorClean(), AllocatorInit(), filter_chain_t::first, IsInternalVideoAllocator(), filter_chain_t::last, and chained_filter_t::next.

Referenced by UpdateBufferFunctions().

static void VideoBufferDelete ( filter_t p_filter,
picture_t p_picture 
) [static]

References picture_Release(), and VLC_UNUSED.

static picture_t* VideoBufferNew ( filter_t p_filter  )  [static]

Variable Documentation

Initial value:
 {
    .pf_init = InternalVideoInit,
    .pf_clean = InternalVideoClean,
    .p_data = NULL,
}
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines