/*****************************************************************************1* x264cli.h: x264cli common2*****************************************************************************3* Copyright (C) 2003-2016 x264 project4*5* Authors: Laurent Aimar <[email protected]>6* Loren Merritt <[email protected]>7*8* This program is free software; you can redistribute it and/or modify9* it under the terms of the GNU General Public License as published by10* the Free Software Foundation; either version 2 of the License, or11* (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 of15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16* GNU General Public License for more details.17*18* You should have received a copy of the GNU General Public License19* along with this program; if not, write to the Free Software20* 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 [email protected].24*****************************************************************************/2526#ifndef X264_CLI_H27#define X264_CLI_H2829#include "common/common.h"3031/* In microseconds */32#define UPDATE_INTERVAL 2500003334typedef void *hnd_t;3536static inline uint64_t gcd( uint64_t a, uint64_t b )37{38while( 1 )39{40int64_t c = a % b;41if( !c )42return b;43a = b;44b = c;45}46}4748static inline uint64_t lcm( uint64_t a, uint64_t b )49{50return ( a / gcd( a, b ) ) * b;51}5253static inline char *get_filename_extension( char *filename )54{55char *ext = filename + strlen( filename );56while( *ext != '.' && ext > filename )57ext--;58ext += *ext == '.';59return ext;60}6162void x264_cli_log( const char *name, int i_level, const char *fmt, ... );63void x264_cli_printf( int i_level, const char *fmt, ... );6465#ifdef _WIN3266void x264_cli_set_console_title( const char *title );67int x264_ansi_filename( const char *filename, char *ansi_filename, int size, int create_file );68#else69#define x264_cli_set_console_title( title )70#endif7172#define RETURN_IF_ERR( cond, name, ret, ... )\73if( cond )\74{\75x264_cli_log( name, X264_LOG_ERROR, __VA_ARGS__ );\76return ret;\77}7879#define FAIL_IF_ERR( cond, name, ... ) RETURN_IF_ERR( cond, name, -1, __VA_ARGS__ )8081typedef enum82{83RANGE_AUTO = -1,84RANGE_TV,85RANGE_PC86} range_enum;8788#endif899091