Commit 57d88c82 authored by Antoine Cellerier's avatar Antoine Cellerier

New filter chain handling API. This should make it possible to factorize

a lot of code everywhere a filter_t chain is used ("video filter2":
vout core, transcode, chain.c video filter; "sub filter": spu_Init;
"audio filter2": transcode; the other types of filter_t objects are
never chained)

Btw, why aren't "audio filter2" filters used anywhere in the aout core?
parent 69c6803c
/***************************************************************************** /*****************************************************************************
* vlc_filter.h: filter related structures * vlc_filter.h: filter related structures and functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2003 the VideoLAN team * Copyright (C) 1999-2008 the VideoLAN team
* $Id$ * $Id$
* *
* Authors: Gildas Bazin <gbazin@videolan.org> * Authors: Gildas Bazin <gbazin@videolan.org>
* Antoine Cellerier <dionoea at videolan dot org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -55,6 +56,7 @@ struct filter_t ...@@ -55,6 +56,7 @@ struct filter_t
/* Output format of filter */ /* Output format of filter */
es_format_t fmt_out; es_format_t fmt_out;
bool b_allow_fmt_out_change;
/* Filter configuration */ /* Filter configuration */
config_chain_t * p_cfg; config_chain_t * p_cfg;
...@@ -81,8 +83,8 @@ struct filter_t ...@@ -81,8 +83,8 @@ struct filter_t
/* Video output callbacks */ /* Video output callbacks */
picture_t * ( * pf_vout_buffer_new) ( filter_t * ); picture_t * ( * pf_vout_buffer_new) ( filter_t * );
void ( * pf_vout_buffer_del) ( filter_t *, picture_t * ); void ( * pf_vout_buffer_del) ( filter_t *, picture_t * );
void ( * pf_picture_link) ( picture_t * ); /* void ( * pf_picture_link) ( picture_t * );
void ( * pf_picture_unlink) ( picture_t * ); void ( * pf_picture_unlink) ( picture_t * ); */
/* SPU output callbacks */ /* SPU output callbacks */
subpicture_t * ( * pf_sub_buffer_new) ( filter_t * ); subpicture_t * ( * pf_sub_buffer_new) ( filter_t * );
...@@ -125,4 +127,30 @@ struct filter_t ...@@ -125,4 +127,30 @@ struct filter_t
return p_outpic; \ return p_outpic; \
} }
/**
* Filter chain management API
*/
typedef struct filter_chain_t filter_chain_t;
VLC_EXPORT( filter_chain_t *, __filter_chain_New, ( vlc_object_t *, const char *, bool, int (*)( filter_t *, void * ), void (*)( filter_t * ), void * ) );
#define filter_chain_New( a, b, c, d, e, f ) __filter_chain_New( VLC_OBJECT( a ), b, c, d, e, f )
VLC_EXPORT( void, filter_chain_Delete, ( filter_chain_t * ) );
VLC_EXPORT( void, filter_chain_Reset, ( filter_chain_t *, const es_format_t *, const es_format_t * ) );
VLC_EXPORT( filter_t *, filter_chain_AppendFilter, ( filter_chain_t *, const char *, config_chain_t *, const es_format_t *, const es_format_t * ) );
VLC_EXPORT( int, filter_chain_AppendFromString, ( filter_chain_t *, const char * ) );
VLC_EXPORT( int, filter_chain_DeleteFilter, ( filter_chain_t *, filter_t * ) );
VLC_EXPORT( filter_t *, filter_chain_GetFilter, ( filter_chain_t *, int, const char * ) );
VLC_EXPORT( int, filter_chain_GetLength, ( filter_chain_t * ) );
VLC_EXPORT( const es_format_t *, filter_chain_GetFmtOut, ( filter_chain_t * ) );
/**
* Apply the filter chain
*/
VLC_EXPORT( picture_t *, filter_chain_VideoFilter, ( filter_chain_t *, picture_t * ) );
VLC_EXPORT( block_t *, filter_chain_AudioFilter, ( filter_chain_t *, block_t * ) );
VLC_EXPORT( void, filter_chain_SubFilter, ( filter_chain_t *, mtime_t ) );
#endif /* _VLC_FILTER_H */ #endif /* _VLC_FILTER_H */
...@@ -362,6 +362,7 @@ SOURCES_libvlc_common = \ ...@@ -362,6 +362,7 @@ SOURCES_libvlc_common = \
misc/xml.c \ misc/xml.c \
misc/devices.c \ misc/devices.c \
extras/libc.c \ extras/libc.c \
misc/filter_chain.c \
$(NULL) $(NULL)
SOURCES_libvlc_sout = \ SOURCES_libvlc_sout = \
......
...@@ -93,6 +93,18 @@ encode_URI_component ...@@ -93,6 +93,18 @@ encode_URI_component
EndMD5 EndMD5
EnsureUTF8 EnsureUTF8
filename_sanitize filename_sanitize
filter_chain_AppendFilter
filter_chain_AppendFromString
filter_chain_AudioFilter
filter_chain_Delete
filter_chain_DeleteFilter
filter_chain_GetFilter
filter_chain_GetFmtOut
filter_chain_GetLength
__filter_chain_New
filter_chain_Reset
filter_chain_SubFilter
filter_chain_VideoFilter
FromLocale FromLocale
FromLocaleDup FromLocaleDup
GetFallbackEncoding GetFallbackEncoding
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment