1 /*****************************************************************************
2 * x264cli.h: x264cli common
3 *****************************************************************************
4 * Copyright (C) 2003-2013 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/common.h"
33 #define UPDATE_INTERVAL 250000
37 static inline uint64_t gcd( uint64_t a, uint64_t b )
49 static inline uint64_t lcm( uint64_t a, uint64_t b )
51 return ( a / gcd( a, b ) ) * b;
54 static inline char *get_filename_extension( char *filename )
56 char *ext = filename + strlen( filename );
57 while( *ext != '.' && ext > filename )
63 void x264_cli_log( const char *name, int i_level, const char *fmt, ... );
64 void x264_cli_printf( int i_level, const char *fmt, ... );
66 #define RETURN_IF_ERR( cond, name, ret, ... )\
69 x264_cli_log( name, X264_LOG_ERROR, __VA_ARGS__ );\
73 #define FAIL_IF_ERR( cond, name, ... ) RETURN_IF_ERR( cond, name, -1, __VA_ARGS__ )