Remove compatibility workarounds
[x264.git] / x264cli.h
blob1993717869a18b5cb49c71692465c9a278887a9b
1 /*****************************************************************************
2 * x264cli.h: x264cli common
3 *****************************************************************************
4 * Copyright (C) 2003-2019 x264 project
6 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
7 * Loren Merritt <lorenm@u.washington.edu>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
23 * This program is also available under a commercial proprietary license.
24 * For more information, contact us at licensing@x264.com.
25 *****************************************************************************/
27 #ifndef X264_CLI_H
28 #define X264_CLI_H
30 #include "common/base.h"
32 /* In microseconds */
33 #define UPDATE_INTERVAL 250000
35 typedef void *hnd_t;
37 extern const char * const x264_avcintra_class_names[];
38 extern const char * const x264_cqm_names[];
39 extern const char * const x264_log_level_names[];
40 extern const char * const x264_partition_names[];
41 extern const char * const x264_pulldown_names[];
42 extern const char * const x264_range_names[];
43 extern const char * const x264_output_csp_names[];
44 extern const char * const x264_valid_profile_names[];
45 extern const char * const x264_demuxer_names[];
46 extern const char * const x264_muxer_names[];
48 static inline uint64_t gcd( uint64_t a, uint64_t b )
50 while( 1 )
52 int64_t c = a % b;
53 if( !c )
54 return b;
55 a = b;
56 b = c;
60 static inline uint64_t lcm( uint64_t a, uint64_t b )
62 return ( a / gcd( a, b ) ) * b;
65 static inline char *get_filename_extension( char *filename )
67 char *ext = filename + strlen( filename );
68 while( *ext != '.' && ext > filename )
69 ext--;
70 ext += *ext == '.';
71 return ext;
74 void x264_cli_log( const char *name, int i_level, const char *fmt, ... );
75 void x264_cli_printf( int i_level, const char *fmt, ... );
76 int x264_cli_autocomplete( const char *prev, const char *cur );
78 #ifdef _WIN32
79 void x264_cli_set_console_title( const char *title );
80 int x264_ansi_filename( const char *filename, char *ansi_filename, int size, int create_file );
81 #else
82 #define x264_cli_set_console_title( title )
83 #endif
85 #define RETURN_IF_ERR( cond, name, ret, ... )\
86 do\
88 if( cond )\
90 x264_cli_log( name, X264_LOG_ERROR, __VA_ARGS__ );\
91 return ret;\
93 } while( 0 )
95 #define FAIL_IF_ERR( cond, name, ... ) RETURN_IF_ERR( cond, name, -1, __VA_ARGS__ )
97 typedef enum
99 RANGE_AUTO = -1,
100 RANGE_TV,
101 RANGE_PC
102 } range_enum;
104 #endif