1 /*****************************************************************************
2 * video.c: video filters
3 *****************************************************************************
4 * Copyright (C) 2010 x264 project
6 * Authors: Steven Walters <kemuri9@gmail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
22 * This program is also available under a commercial proprietary license.
23 * For more information, contact us at licensing@x264.com.
24 *****************************************************************************/
28 static cli_vid_filter_t *first_filter = NULL;
30 static void register_vid_filter( cli_vid_filter_t *new_filter )
32 cli_vid_filter_t *filter_i = first_filter;
33 while( filter_i->next )
34 filter_i = filter_i->next;
35 filter_i->next = new_filter;
36 new_filter->next = NULL;
39 #define REGISTER_VFILTER(name)\
41 extern cli_vid_filter_t name##_filter;\
42 register_vid_filter( &name##_filter );\
45 void x264_register_vid_filters()
47 extern cli_vid_filter_t source_filter;
48 first_filter = &source_filter;
49 REGISTER_VFILTER( cache );
50 REGISTER_VFILTER( crop );
51 REGISTER_VFILTER( fix_vfr_pts );
52 REGISTER_VFILTER( resize );
53 REGISTER_VFILTER( select_every );
56 int x264_init_vid_filter( const char *name, hnd_t *handle, cli_vid_filter_t *filter,
57 video_info_t *info, x264_param_t *param, char *opt_string )
59 cli_vid_filter_t *filter_i = first_filter;
60 while( filter_i && strcasecmp( name, filter_i->name ) )
61 filter_i = filter_i->next;
62 FAIL_IF_ERR( !filter_i, "x264", "invalid filter `%s'\n", name );
63 if( filter_i->init( handle, filter, info, param, opt_string ) )
69 void x264_vid_filter_help( int longhelp )
71 for( cli_vid_filter_t *filter_i = first_filter; filter_i; filter_i = filter_i->next )
73 filter_i->help( longhelp );