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 *****************************************************************************/
30 #include "common/base.h"
33 #define UPDATE_INTERVAL 250000
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
)
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
)
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
);
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
);
82 #define x264_cli_set_console_title( title )
85 #define RETURN_IF_ERR( cond, name, ret, ... )\
90 x264_cli_log( name, X264_LOG_ERROR, __VA_ARGS__ );\
95 #define FAIL_IF_ERR( cond, name, ... ) RETURN_IF_ERR( cond, name, -1, __VA_ARGS__ )