X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_filter.h;h=d53365c497a89d7cad89662900d66d17bf4b8412;hb=f8a7b336e817e964e989519af4e1fe22df7e4861;hp=3e58c9ca3ae60e5ec23a7876acf3e70c86df1f10;hpb=d2a821e0b5f25e7f98168ca125176f476b3dec22;p=vlc diff --git a/include/vlc_filter.h b/include/vlc_filter.h index 3e58c9ca3a..d53365c497 100644 --- a/include/vlc_filter.h +++ b/include/vlc_filter.h @@ -1,10 +1,11 @@ /***************************************************************************** - * vlc_codec.h: codec related structures + * vlc_filter.h: filter related structures and functions ***************************************************************************** - * Copyright (C) 1999-2003 VideoLAN + * Copyright (C) 1999-2008 the VideoLAN team * $Id$ * * Authors: Gildas Bazin + * Antoine Cellerier * * 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 @@ -18,11 +19,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ + #ifndef _VLC_FILTER_H #define _VLC_FILTER_H 1 +#include + /** * \file * This file defines the structure and types used by video and audio filters @@ -30,12 +34,10 @@ typedef struct filter_owner_sys_t filter_owner_sys_t; -/** - * \defgroup filter Filter - * - * The structure describing a filter - * - * @{ +/** Structure describing a filter + * @warning BIG FAT WARNING : the code relies in the first 4 members of + * filter_t and decoder_t to be the same, so if you have anything to add, + * do it at the end of the structure. */ struct filter_t { @@ -50,6 +52,10 @@ struct filter_t /* Output format of filter */ es_format_t fmt_out; + bool b_allow_fmt_out_change; + + /* Filter configuration */ + config_chain_t * p_cfg; picture_t * ( * pf_video_filter ) ( filter_t *, picture_t * ); block_t * ( * pf_audio_filter ) ( filter_t *, block_t * ); @@ -58,8 +64,10 @@ struct filter_t int, int, int ); subpicture_t * ( *pf_sub_filter ) ( filter_t *, mtime_t ); - /* pf_render_string maps to RenderText in freetype.c */ - subpicture_region_t *( *pf_render_string ) ( filter_t *, subpicture_t *, subpicture_region_t * ); + int ( *pf_render_text ) ( filter_t *, subpicture_region_t *, + subpicture_region_t * ); + int ( *pf_render_html ) ( filter_t *, subpicture_region_t *, + subpicture_region_t * ); /* * Buffers allocation @@ -71,8 +79,8 @@ struct filter_t /* Video output callbacks */ picture_t * ( * pf_vout_buffer_new) ( filter_t * ); void ( * pf_vout_buffer_del) ( filter_t *, picture_t * ); - void ( * pf_picture_link) ( filter_t *, picture_t * ); - void ( * pf_picture_unlink) ( filter_t *, picture_t * ); + /* void ( * pf_picture_link) ( picture_t * ); + void ( * pf_picture_unlink) ( picture_t * ); */ /* SPU output callbacks */ subpicture_t * ( * pf_sub_buffer_new) ( filter_t * ); @@ -82,8 +90,63 @@ struct filter_t filter_owner_sys_t *p_owner; }; + +/** + * 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( name ) \ + static picture_t *name ## _Filter ( filter_t *p_filter, \ + picture_t *p_pic ) \ + { \ + picture_t *p_outpic = p_filter->pf_vout_buffer_new( p_filter ); \ + if( !p_outpic ) \ + { \ + msg_Warn( p_filter, "can't get output picture" ); \ + if( p_pic->pf_release ) \ + p_pic->pf_release( p_pic ); \ + return NULL; \ + } \ + \ + name( p_filter, p_pic, p_outpic ); \ + \ + p_outpic->date = p_pic->date; \ + p_outpic->b_force = p_pic->b_force; \ + p_outpic->i_nb_fields = p_pic->i_nb_fields; \ + p_outpic->b_progressive = p_pic->b_progressive; \ + p_outpic->b_top_field_first = p_pic->b_top_field_first; \ + \ + if( p_pic->pf_release ) \ + p_pic->pf_release( p_pic ); \ + 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 */