VLC 4.0.0-dev
|
Audio, video, text filters. More...
Files | |
file | vlc_filter.h |
Filter modules interface. | |
Data Structures | |
struct | filter_video_callbacks |
struct | filter_audio_callbacks |
struct | filter_subpicture_callbacks |
struct | filter_owner_t |
struct | vlc_filter_operations |
struct | filter_t |
Structure describing a filter. More... | |
Macros | |
#define | set_deinterlace_callback(activate) |
#define | set_callback_video_filter(activate) |
#define | set_callback_video_converter(activate, priority) |
#define | set_callback_text_renderer(activate, priority) |
#define | set_callback_sub_filter(activate) |
#define | set_callback_sub_source(activate, priority) |
#define | set_callback_video_blending(activate, priority) |
#define | filter_AddProxyCallbacks(a, b, c) filter_AddProxyCallbacks(VLC_OBJECT(a), b, c) |
#define | filter_DelProxyCallbacks(a, b, c) filter_DelProxyCallbacks(VLC_OBJECT(a), b, c) |
#define | VIDEO_FILTER_WRAPPER_CLOSE_FILT(name, close_cb) |
Create a picture_t *(*)( filter_t *, picture_t * ) compatible wrapper using a void (*)( filter_t *, picture_t *, picture_t * ) function. | |
#define | VIDEO_FILTER_WRAPPER_CLOSE(name, close_cb) |
#define | VIDEO_FILTER_WRAPPER(name) |
#define | VIDEO_FILTER_WRAPPER_EXT(name) |
Wrappers to use when the filter function is not a static function. | |
#define | VIDEO_FILTER_WRAPPER_CLOSE_EXT(name, close_cb) |
#define | filter_chain_NewSPU(a, b) filter_chain_NewSPU( VLC_OBJECT( a ), b ) |
#define | filter_chain_NewVideo(a, b, c) filter_chain_NewVideo( VLC_OBJECT( a ), b, c ) |
Typedefs | |
typedef struct filter_owner_t | filter_owner_t |
typedef int(* | vlc_filter_open) (filter_t *) |
typedef filter_t | vlc_blender_t |
typedef struct filter_chain_t | filter_chain_t |
Filter chain management API The filter chain management API is used to dynamically construct filters and add them in a chain. | |
Functions | |
module_t * | vlc_filter_LoadModule (filter_t *, const char *cap, const char *name, bool strict) |
void | vlc_filter_UnloadModule (filter_t *) |
static void | vlc_filter_Delete (filter_t *p_filter) |
static picture_t * | filter_NewPicture (filter_t *p_filter) |
This function will return a new picture usable by p_filter as an output buffer. | |
static void | filter_Flush (filter_t *p_filter) |
Flush a filter. | |
static void | filter_ChangeViewpoint (filter_t *p_filter, const vlc_viewpoint_t *vp) |
static vlc_decoder_device * | filter_HoldDecoderDevice (filter_t *p_filter) |
static vlc_decoder_device * | filter_HoldDecoderDeviceType (filter_t *p_filter, enum vlc_decoder_device_type type) |
static block_t * | filter_DrainAudio (filter_t *p_filter) |
This function will drain, then flush an audio filter. | |
static void | filter_SendAudioLoudness (filter_t *filter, const struct vlc_audio_loudness *loudness) |
static subpicture_t * | filter_NewSubpicture (filter_t *p_filter) |
This function will return a new subpicture usable by p_filter as an output buffer. | |
static int | filter_GetInputAttachments (filter_t *p_filter, input_attachment_t ***ppp_attachment, int *pi_attachment) |
This function gives all input attachments at once. | |
void | filter_AddProxyCallbacks (vlc_object_t *obj, filter_t *filter, vlc_callback_t restart_cb) |
This function allow dynamically changing filter variables from a different object via VLC variables mapping. | |
void | filter_DelProxyCallbacks (vlc_object_t *obj, filter_t *filter, vlc_callback_t restart_cb) |
This function unbind the callbacks from the proxy object. | |
vlc_blender_t * | filter_NewBlend (vlc_object_t *, const video_format_t *p_dst_chroma) |
It creates a blend filter. | |
int | filter_ConfigureBlend (vlc_blender_t *, int i_dst_width, int i_dst_height, const video_format_t *p_src) |
It configures blend filter parameters that are allowed to changed after the creation. | |
int | filter_Blend (vlc_blender_t *, picture_t *p_dst, int i_dst_x, int i_dst_y, const picture_t *p_src, int i_alpha) |
It blends a picture into another one. | |
void | filter_DeleteBlend (vlc_blender_t *) |
It destroys a blend filter created by filter_NewBlend. | |
filter_chain_t * | filter_chain_NewSPU (vlc_object_t *obj, const char *psz_capability) |
Create new filter chain. | |
filter_chain_t * | filter_chain_NewVideo (vlc_object_t *obj, bool change, const filter_owner_t *owner) |
Creates a new video filter chain. | |
void | filter_chain_Delete (filter_chain_t *chain) |
Delete filter chain will delete all filters in the chain and free all allocated data. | |
void | filter_chain_Reset (filter_chain_t *p_chain, const es_format_t *p_fmt_in, vlc_video_context *vctx_in, const es_format_t *p_fmt_out) |
Reset filter chain will delete all filters in the chain and reset p_fmt_in and p_fmt_out to the new values. | |
void | filter_chain_Clear (filter_chain_t *) |
Remove all existing filters. | |
filter_t * | filter_chain_AppendFilter (filter_chain_t *chain, const char *name, const config_chain_t *cfg, const es_format_t *fmt_out) |
Append a filter to the chain. | |
int | filter_chain_AppendConverter (filter_chain_t *chain, const es_format_t *fmt_out) |
Append a conversion to the chain. | |
int | filter_chain_AppendFromString (filter_chain_t *chain, const char *str) |
Append new filter to filter chain from string. | |
void | filter_chain_DeleteFilter (filter_chain_t *chain, filter_t *filter) |
Delete filter from filter chain. | |
bool | filter_chain_IsEmpty (const filter_chain_t *chain) |
Checks if the filter chain is empty. | |
const es_format_t * | filter_chain_GetFmtOut (const filter_chain_t *chain) |
Get last output format of the last element in the filter chain. | |
vlc_video_context * | filter_chain_GetVideoCtxOut (const filter_chain_t *chain) |
Get last output video context of the last element in the filter chain. | |
picture_t * | filter_chain_VideoFilter (filter_chain_t *chain, picture_t *pic) |
Apply the filter chain to a video picture. | |
void | filter_chain_VideoFlush (filter_chain_t *) |
Flush a video filter chain. | |
int | filter_chain_MouseFilter (filter_chain_t *, struct vlc_mouse_t *, const struct vlc_mouse_t *) |
Apply the filter chain to a mouse state. | |
int | filter_chain_ForEach (filter_chain_t *chain, int(*cb)(filter_t *, void *), void *opaque) |
Audio, video, text filters.
#define filter_AddProxyCallbacks | ( | a, | |
b, | |||
c | |||
) | filter_AddProxyCallbacks(VLC_OBJECT(a), b, c) |
#define filter_chain_NewSPU | ( | a, | |
b | |||
) | filter_chain_NewSPU( VLC_OBJECT( a ), b ) |
#define filter_chain_NewVideo | ( | a, | |
b, | |||
c | |||
) | filter_chain_NewVideo( VLC_OBJECT( a ), b, c ) |
#define filter_DelProxyCallbacks | ( | a, | |
b, | |||
c | |||
) | filter_DelProxyCallbacks(VLC_OBJECT(a), b, c) |
#define set_callback_sub_filter | ( | activate | ) |
#define set_callback_sub_source | ( | activate, | |
priority | |||
) |
#define set_callback_text_renderer | ( | activate, | |
priority | |||
) |
#define set_callback_video_blending | ( | activate, | |
priority | |||
) |
#define set_callback_video_converter | ( | activate, | |
priority | |||
) |
#define set_callback_video_filter | ( | activate | ) |
#define set_deinterlace_callback | ( | activate | ) |
#define VIDEO_FILTER_WRAPPER | ( | name | ) |
#define VIDEO_FILTER_WRAPPER_CLOSE | ( | name, | |
close_cb | |||
) |
#define VIDEO_FILTER_WRAPPER_CLOSE_EXT | ( | name, | |
close_cb | |||
) |
#define VIDEO_FILTER_WRAPPER_CLOSE_FILT | ( | name, | |
close_cb | |||
) |
Create a picture_t *(*)( filter_t *, picture_t * ) compatible wrapper using a void (*)( filter_t *, picture_t *, picture_t * ) function.
Currently used by the chroma video filters
#define VIDEO_FILTER_WRAPPER_EXT | ( | name | ) |
typedef struct filter_chain_t filter_chain_t |
Filter chain management API The filter chain management API is used to dynamically construct filters and add them in a chain.
typedef struct filter_owner_t filter_owner_t |
typedef filter_t vlc_blender_t |
typedef int(* vlc_filter_open) (filter_t *) |
void filter_AddProxyCallbacks | ( | vlc_object_t * | obj, |
filter_t * | filter, | ||
vlc_callback_t | restart_cb | ||
) |
This function allow dynamically changing filter variables from a different object via VLC variables mapping.
It maps the filter's variables on the proxy objects and bind them with a var callback that forwards changes to the filter. This is especially useful for manipulating filter chains via a single parent object.
obj | the object to add the callback proxy to |
filter | the filter object for which the callback will be proxified |
restart_cb | a vlc_callback_t to call if the event means restarting the filter (i.e. an event on a non-command variable) |
References config_GetType(), name, TriggerFilterCallback(), var_AddCallback(), var_Create(), var_GetAllNames(), var_Type(), VLC_OBJECT, VLC_VAR_DOINHERIT, and VLC_VAR_ISCOMMAND.
int filter_Blend | ( | vlc_blender_t * | p_blend, |
picture_t * | p_dst, | ||
int | i_dst_x, | ||
int | i_dst_y, | ||
const picture_t * | p_src, | ||
int | i_alpha | ||
) |
It blends a picture into another one.
The input picture is not modified and not released.
References vlc_filter_operations::blend_video, filter_t::ops, filter_t::p_module, VLC_EGENERIC, and VLC_SUCCESS.
Referenced by picture_BlendSubpicture().
int filter_chain_AppendConverter | ( | filter_chain_t * | chain, |
const es_format_t * | fmt_out | ||
) |
Append a conversion to the chain.
chain | filter chain to append a filter to |
fmt_out | filter output format |
VLC_SUCCESS | on success |
References filter_chain_t::conv_cap, filter_chain_AppendInner(), VLC_EGENERIC, and VLC_SUCCESS.
Referenced by ChangeFilters(), ConvertRGBAAndBlend(), and VoutSetupConverter().
filter_t * filter_chain_AppendFilter | ( | filter_chain_t * | chain, |
const char * | name, | ||
const config_chain_t * | cfg, | ||
const es_format_t * | fmt_out | ||
) |
Append a filter to the chain.
chain | filter chain to append a filter to |
name | filter name |
cfg | the configuration chain for the filter |
fmt_out | filter output format |
References filter_chain_t::filter_cap, filter_chain_AppendInner(), and name.
Referenced by ChangeFilters(), and filter_chain_AppendFromString().
int filter_chain_AppendFromString | ( | filter_chain_t * | chain, |
const char * | str | ||
) |
Append new filter to filter chain from string.
chain | filter chain to append a filter to |
str | filters chain nul-terminated string |
References config_ChainCreate(), config_ChainDestroy(), chained_filter_t::filter, filter_chain_AppendFilter(), filter_chain_DeleteFilter(), filter_chain_t::filter_list, msg_Err, name, filter_chain_t::obj, VLC_EGENERIC, and vlc_list_last_entry_or_null.
Referenced by spu_PutSubpicture(), and spu_Render().
void filter_chain_Clear | ( | filter_chain_t * | p_chain | ) |
Remove all existing filters.
p_chain | pointer to filter chain |
References chained_filter_t::filter, filter_chain_DeleteFilter(), filter_chain_t::filter_list, and vlc_list_foreach.
Referenced by filter_chain_Delete(), filter_chain_Reset(), spu_PutSubpicture(), and spu_Render().
void filter_chain_Delete | ( | filter_chain_t * | chain | ) |
Delete filter chain will delete all filters in the chain and free all allocated data.
The pointer to the filter chain is then no longer valid.
chain | pointer to filter chain |
References es_format_Clean(), filter_chain_Clear(), filter_chain_t::fmt_in, filter_chain_t::fmt_out, filter_chain_t::vctx_in, and vlc_video_context_Release().
Referenced by ConvertRGBAAndBlend(), spu_Cleanup(), vout_ReleaseDisplay(), vout_Start(), and VoutConverterRelease().
void filter_chain_DeleteFilter | ( | filter_chain_t * | chain, |
filter_t * | filter | ||
) |
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.
chain | filter chain to remove the filter from |
filter | filter to remove from the chain and delete |
References container_of, es_format_Clean(), FilterDeletePictures(), filter_t::fmt_in, filter_t::fmt_out, msg_Dbg, chained_filter_t::node, filter_chain_t::obj, chained_filter_t::pending, vlc_filter_UnloadModule(), vlc_list_remove(), and vlc_object_delete.
Referenced by filter_chain_AppendFromString(), and filter_chain_Clear().
int filter_chain_ForEach | ( | filter_chain_t * | chain, |
int(*)(filter_t *, void *) | cb, | ||
void * | opaque | ||
) |
References chained_filter_t::filter, filter_chain_t::filter_list, vlc_list_foreach, and VLC_SUCCESS.
Referenced by DelAllFilterCallbacks(), spu_Cleanup(), spu_PutSubpicture(), and spu_Render().
const es_format_t * filter_chain_GetFmtOut | ( | const filter_chain_t * | chain | ) |
Get last output format of the last element in the filter chain.
chain | filter chain |
References chained_filter_t::filter, filter_chain_t::filter_list, filter_t::fmt_out, filter_chain_t::fmt_out, and vlc_list_last_entry_or_null.
Referenced by ChangeFilters(), and IsPictureLateToStaticFilter().
vlc_video_context * filter_chain_GetVideoCtxOut | ( | const filter_chain_t * | chain | ) |
Get last output video context of the last element in the filter chain.
chain | filter chain |
References chained_filter_t::filter, filter_chain_t::filter_list, filter_chain_t::fmt_in, filter_chain_t::fmt_out, filter_chain_t::vctx_in, filter_t::vctx_out, es_format_t::video, video_format_IsSameChroma(), and vlc_list_last_entry_or_null.
Referenced by ChangeFilters().
bool filter_chain_IsEmpty | ( | const filter_chain_t * | chain | ) |
Checks if the filter chain is empty.
chain | pointer to filter chain |
References filter_chain_t::filter_list, and vlc_list_is_empty().
Referenced by ChangeFilters(), spu_PutSubpicture(), and VoutVideoFilterStaticNewPicture().
int filter_chain_MouseFilter | ( | filter_chain_t * | , |
struct vlc_mouse_t * | , | ||
const struct 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.
filter_chain_t * filter_chain_NewSPU | ( | vlc_object_t * | obj, |
const char * | psz_capability | ||
) |
Create new filter chain.
obj | pointer to a vlc object |
psz_capability | vlc capability of filters in filter chain |
References filter_chain_NewInner(), and SPU_ES.
filter_chain_t * filter_chain_NewVideo | ( | vlc_object_t * | obj, |
bool | change, | ||
const filter_owner_t * | owner | ||
) |
Creates a new video filter chain.
obj | pointer to parent VLC object |
change | whether to allow changing the output format |
owner | owner video buffer callbacks |
void filter_chain_Reset | ( | filter_chain_t * | p_chain, |
const es_format_t * | p_fmt_in, | ||
vlc_video_context * | vctx_in, | ||
const es_format_t * | p_fmt_out | ||
) |
Reset filter chain will delete all filters in the chain and reset p_fmt_in and p_fmt_out to the new values.
p_chain | pointer to filter chain |
p_fmt_in | new fmt_in params |
vctx_in | new input video context |
p_fmt_out | new fmt_out params |
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(), filter_chain_Clear(), filter_chain_t::fmt_in, filter_chain_t::fmt_out, filter_chain_t::vctx_in, vlc_video_context_Hold(), and vlc_video_context_Release().
Referenced by ChangeFilters(), ConvertRGBAAndBlend(), and VoutSetupConverter().
picture_t * filter_chain_VideoFilter | ( | filter_chain_t * | chain, |
picture_t * | pic | ||
) |
Apply the filter chain to a video picture.
chain | pointer to filter chain |
pic | picture to apply filters to |
References container_of, vlc_list_it::current, filter_chain_t::filter_list, FilterSingleChainedFilter(), chained_filter_t::pending, vlc_list_foreach, vlc_list_it_continue(), vlc_list_it_next(), vlc_list_reverse_foreach, and vlc_picture_chain_PopFront().
Referenced by ConvertRGBAAndBlend(), FilterPictureInteractive(), PreparePicture(), and vout_ConvertForDisplay().
void filter_chain_VideoFlush | ( | filter_chain_t * | p_chain | ) |
Flush a video filter chain.
References chained_filter_t::filter, filter_Flush(), filter_chain_t::filter_list, FilterDeletePictures(), chained_filter_t::pending, and vlc_list_foreach.
Referenced by FilterFlush(), PreparePicture(), and vout_FilterFlush().
|
inlinestatic |
References vlc_filter_operations::change_viewpoint, and filter_t::ops.
Referenced by aout_FiltersPipelineChangeViewpoint().
int filter_ConfigureBlend | ( | vlc_blender_t * | p_blend, |
int | i_dst_width, | ||
int | i_dst_height, | ||
const video_format_t * | p_src | ||
) |
It configures blend filter parameters that are allowed to changed after the creation.
References filter_t::fmt_in, filter_t::fmt_out, video_format_t::i_chroma, es_format_t::i_codec, video_format_t::i_height, video_format_t::i_visible_height, video_format_t::i_visible_width, video_format_t::i_width, filter_t::ops, filter_t::p_module, es_format_t::video, video_format_IsSameChroma(), VLC_EGENERIC, vlc_filter_LoadModule(), vlc_filter_UnloadModule(), and VLC_SUCCESS.
Referenced by picture_BlendSubpicture().
void filter_DeleteBlend | ( | vlc_blender_t * | p_blend | ) |
It destroys a blend filter created by filter_NewBlend.
References vlc_filter_Delete().
Referenced by ConvertRGBAAndBlend(), PrerenderPicture(), and vout_ReleaseDisplay().
void filter_DelProxyCallbacks | ( | vlc_object_t * | obj, |
filter_t * | filter, | ||
vlc_callback_t | restart_cb | ||
) |
This function unbind the callbacks from the proxy object.
obj | the object to remove the callback proxy from |
filter | the filter object for which the callback was proxified |
restart_cb | the same vlc_callback_t passed to filter_AddProxyCallbacks |
References name, TriggerFilterCallback(), var_DelCallback(), var_GetAllNames(), var_Type(), VLC_OBJECT, and VLC_VAR_ISCOMMAND.
This function will drain, then flush an audio filter.
References vlc_filter_operations::drain_audio, and filter_t::ops.
Referenced by aout_FiltersPipelineDrain().
|
inlinestatic |
Flush a filter.
This function will flush the state of a filter (audio or video).
References vlc_filter_operations::flush, and filter_t::ops.
Referenced by aout_FiltersPipelineFlush(), filter_chain_VideoFlush(), and vlc_audio_meter_Flush().
|
inlinestatic |
This function gives all input attachments at once.
You MUST release the returned values
References filter_t::owner, filter_owner_t::pf_get_attachments, and VLC_EGENERIC.
|
inlinestatic |
|
inlinestatic |
vlc_blender_t * filter_NewBlend | ( | vlc_object_t * | p_this, |
const video_format_t * | p_dst_chroma | ||
) |
It creates a blend filter.
Only the chroma properties of the dest format is used (chroma type, rgb masks and shifts)
References es_format_Init(), filter_t::fmt_in, filter_t::fmt_out, video_format_t::i_chroma, es_format_t::i_codec, filter_t::p_module, unlikely, es_format_t::video, VIDEO_ES, and vlc_custom_create.
Referenced by ConvertRGBAAndBlend(), and PrerenderPicture().
This function will return a new picture usable by p_filter as an output buffer.
You have to release it using picture_Release or by returning it to the caller as a ops->filter_video return value. Provided for convenience.
p_filter | filter_t object |
References filter_video_callbacks::buffer_new, filter_t::fmt_out, msg_Warn, filter_t::owner, picture_NewFromFormat(), es_format_t::video, and filter_owner_t::video.
Referenced by filter_chain_VideoBufferNew().
|
inlinestatic |
This function will return a new subpicture usable by p_filter as an output buffer.
You have to release it using subpicture_Delete or by returning it to the caller as a ops->sub_source return value. Provided for convenience.
p_filter | filter_t object |
References filter_subpicture_callbacks::buffer_new, msg_Warn, filter_t::owner, and filter_owner_t::sub.
|
inlinestatic |
|
inlinestatic |
References vlc_filter_UnloadModule(), and vlc_object_delete.
Referenced by aout_FiltersPipelineDestroy(), AppendFilter(), filter_DeleteBlend(), spu_Attach(), spu_Cleanup(), vlc_audio_meter_RemovePlugin(), and vlc_audio_meter_Reset().
module_t * vlc_filter_LoadModule | ( | filter_t * | p_filter, |
const char * | cap, | ||
const char * | name, | ||
bool | strict | ||
) |
References vlc_object_t::force, vlc_object_t::logger, module_get_object(), name, filter_t::obj, filter_t::ops, filter_t::p_module, unlikely, var_Create(), var_SetString(), vlc_debug, VLC_EGENERIC, VLC_ENOMEM, VLC_ETIMEOUT, vlc_module_map(), vlc_module_match(), vlc_objres_clear(), VLC_SUCCESS, and VLC_VAR_STRING.
Referenced by CreateConverter(), filter_chain_AppendInner(), filter_ConfigureBlend(), SpuRenderCreateAndLoadScale(), and SpuRenderCreateAndLoadText().
void vlc_filter_UnloadModule | ( | filter_t * | p_filter | ) |
References vlc_filter_operations::close, likely, module_get_capability(), module_get_object(), msg_Dbg, filter_t::obj, filter_t::ops, filter_t::p_module, var_Destroy(), and vlc_objres_clear().
Referenced by DeleteConverter(), filter_chain_DeleteFilter(), filter_ConfigureBlend(), and vlc_filter_Delete().