-
Notifications
You must be signed in to change notification settings - Fork 8
/
x264cli.h
128 lines (111 loc) · 3.2 KB
/
x264cli.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*****************************************************************************
* x264cli.h: x264cli common
*****************************************************************************
* Copyright (C) 2003-2013 x264 project
*
* Authors: Laurent Aimar <[email protected]>
* Loren Merritt <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
*
* This program is also available under a commercial proprietary license.
* For more information, contact us at [email protected].
*****************************************************************************/
#ifndef X264_CLI_H
#define X264_CLI_H
#include "common/common.h"
/* In microseconds */
#define UPDATE_INTERVAL 250000
#define MAX_SCC 1
typedef void *hnd_t;
static inline uint64_t gcd( uint64_t a, uint64_t b )
{
while( 1 )
{
int64_t c = a % b;
if( !c )
return b;
a = b;
b = c;
}
}
static inline uint64_t lcm( uint64_t a, uint64_t b )
{
return ( a / gcd( a, b ) ) * b;
}
static inline char *get_filename_extension( char *filename )
{
char *ext = filename + strlen( filename );
while( *ext != '.' && ext > filename )
ext--;
ext += *ext == '.';
return ext;
}
void x264_cli_log( const char *name, int i_level, const char *fmt, ... );
void x264_cli_printf( int i_level, const char *fmt, ... );
#ifdef _WIN32
void x264_cli_set_console_title( const char *title );
int x264_ansi_filename( const char *filename, char *ansi_filename, int size, int create_file );
#else
#define x264_cli_set_console_title( title )
#endif
#define RETURN_IF_ERR( cond, name, ret, ... )\
if( cond )\
{\
x264_cli_log( name, X264_LOG_ERROR, __VA_ARGS__ );\
return ret;\
}
#define FAIL_IF_ERR( cond, name, ... ) RETURN_IF_ERR( cond, name, -1, __VA_ARGS__ )
typedef enum
{
RANGE_AUTO = -1,
RANGE_TV,
RANGE_PC
} range_enum;
typedef struct __attribute__ ((__packed__)) {
int hour;
int min;
int sec;
int frame;
} cli_timecode_t;
typedef struct {
FILE *scc_file;
int sff;
cli_timecode_t timecode;
} scc_opt_t;
typedef struct{
int fps_num;
int fps_den;
int mod;
int cc_count;
int frame_doubling;
} cli_timecode_ctx_t;
typedef struct {
int b_progress;
int i_seek;
hnd_t hin;
hnd_t hout;
FILE *qpfile;
double timebase_convert_multiplier;
int i_pulldown;
int write_timecode;
int drop_frame;
cli_timecode_t timecode;
cli_timecode_ctx_t *timecode_ctx;
int num_scc;
scc_opt_t scc_opts[MAX_SCC];
int echostar_captions;
} cli_opt_t;
#endif