Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
52866 views
1
/*****************************************************************************
2
* x264cli.h: x264cli common
3
*****************************************************************************
4
* Copyright (C) 2003-2016 x264 project
5
*
6
* Authors: Laurent Aimar <[email protected]>
7
* Loren Merritt <[email protected]>
8
*
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.
13
*
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.
18
*
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.
22
*
23
* This program is also available under a commercial proprietary license.
24
* For more information, contact us at [email protected].
25
*****************************************************************************/
26
27
#ifndef X264_CLI_H
28
#define X264_CLI_H
29
30
#include "common/common.h"
31
32
/* In microseconds */
33
#define UPDATE_INTERVAL 250000
34
35
typedef void *hnd_t;
36
37
static inline uint64_t gcd( uint64_t a, uint64_t b )
38
{
39
while( 1 )
40
{
41
int64_t c = a % b;
42
if( !c )
43
return b;
44
a = b;
45
b = c;
46
}
47
}
48
49
static inline uint64_t lcm( uint64_t a, uint64_t b )
50
{
51
return ( a / gcd( a, b ) ) * b;
52
}
53
54
static inline char *get_filename_extension( char *filename )
55
{
56
char *ext = filename + strlen( filename );
57
while( *ext != '.' && ext > filename )
58
ext--;
59
ext += *ext == '.';
60
return ext;
61
}
62
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, ... );
65
66
#ifdef _WIN32
67
void x264_cli_set_console_title( const char *title );
68
int x264_ansi_filename( const char *filename, char *ansi_filename, int size, int create_file );
69
#else
70
#define x264_cli_set_console_title( title )
71
#endif
72
73
#define RETURN_IF_ERR( cond, name, ret, ... )\
74
if( cond )\
75
{\
76
x264_cli_log( name, X264_LOG_ERROR, __VA_ARGS__ );\
77
return ret;\
78
}
79
80
#define FAIL_IF_ERR( cond, name, ... ) RETURN_IF_ERR( cond, name, -1, __VA_ARGS__ )
81
82
typedef enum
83
{
84
RANGE_AUTO = -1,
85
RANGE_TV,
86
RANGE_PC
87
} range_enum;
88
89
#endif
90
91