1 /*****************************************************************************
2 * video.c: video filters
3 *****************************************************************************
4 * Copyright (C) 2010-2014 x264 project
5 *
6 * Authors: Steven Walters <kemuri9@gmail.com>
7 *
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.
12 *
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.
17 *
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.
21 *
22 * This program is also available under a commercial proprietary license.
23 * For more information, contact us at licensing@x264.com.
24 *****************************************************************************/
25
26 #include "video.h"
27
28 static cli_vid_filter_t *first_filter = NULL;
29
register_vid_filter(cli_vid_filter_t * new_filter)30 static void register_vid_filter( cli_vid_filter_t *new_filter )
31 {
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;
37 }
38
39 #define REGISTER_VFILTER(name)\
40 {\
41 extern cli_vid_filter_t name##_filter;\
42 register_vid_filter( &name##_filter );\
43 }
44
x264_register_vid_filters(void)45 void x264_register_vid_filters( void )
46 {
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 );
54 REGISTER_VFILTER( depth );
55 #if HAVE_GPL
56 #endif
57 }
58
x264_init_vid_filter(const char * name,hnd_t * handle,cli_vid_filter_t * filter,video_info_t * info,x264_param_t * param,char * opt_string)59 int x264_init_vid_filter( const char *name, hnd_t *handle, cli_vid_filter_t *filter,
60 video_info_t *info, x264_param_t *param, char *opt_string )
61 {
62 cli_vid_filter_t *filter_i = first_filter;
63 while( filter_i && strcasecmp( name, filter_i->name ) )
64 filter_i = filter_i->next;
65 FAIL_IF_ERR( !filter_i, "x264", "invalid filter `%s'\n", name );
66 if( filter_i->init( handle, filter, info, param, opt_string ) )
67 return -1;
68
69 return 0;
70 }
71
x264_vid_filter_help(int longhelp)72 void x264_vid_filter_help( int longhelp )
73 {
74 cli_vid_filter_t *filter_i;
75
76 for( filter_i = first_filter; filter_i; filter_i = filter_i->next )
77 if( filter_i->help )
78 filter_i->help( longhelp );
79 }
80