基于qt,msvc2017-64bits,ffmpeg.opengl的播放器
zhangmeng
2021-03-03 4a6d9312cc1c9d62d66c4def71246d9faae29edb
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/*!
 * COPYRIGHT (C) 2010-2020 Emeric Grange - All Rights Reserved
 *
 * This file is part of MiniTraces.
 *
 * MiniTraces is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MiniTraces 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with MiniTraces.  If not, see <http://www.gnu.org/licenses/>.
 *
 * \file      minitraces.h
 * \author    Emeric Grange <emeric.grange@gmail.com>
 * \date      2018
 * \version   0.53
 */
 
#ifndef MINITRACES_H
#define MINITRACES_H
/* ************************************************************************** */
 
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/* ************************************************************************** */
 
/*!
 * This function displays informations about MiniTraces, which "trace levels"
 * and "trace modules" are currently enabled. Its output is quite heavy so you
 * should keep this for debug builds.
 */
void MiniTraces_info(void);
 
/*!
 * \brief This function formats and output traces.
 * \param file: current file where the trace call originated.
 * \param line: line in file.
 * \param func: current function.
 * \param level: trace level.
 * \param module: module called.
 * \param payload: the actual trace string.
 *
 * \note You sould never call this function directly, please use TRACE_xxx macros instead!
 */
void MiniTraces_print(const char *file, const int line, const char *func,
                      const unsigned level, const unsigned module, const char *payload, ...);
 
/* ************************************************************************** */
 
// TRACE LEVELS
 
#define TRACE_LEVEL_ERR     (1 << 0)
#define TRACE_LEVEL_WARN    (1 << 1)
#define TRACE_LEVEL_INFO    (1 << 2)
#define TRACE_LEVEL_1       (1 << 3)
#define TRACE_LEVEL_2       (1 << 4)
#define TRACE_LEVEL_3       (1 << 5)
 
#define TRACE_LEVEL_DEFAULT (TRACE_LEVEL_ERR | TRACE_LEVEL_WARN)
#define TRACE_LEVEL_DEBUG   (TRACE_LEVEL_ERR | TRACE_LEVEL_WARN | TRACE_LEVEL_INFO)
#define TRACE_LEVEL_ALL     (TRACE_LEVEL_ERR | TRACE_LEVEL_WARN | TRACE_LEVEL_INFO | TRACE_LEVEL_1 | TRACE_LEVEL_2 | TRACE_LEVEL_3)
 
/* ************************************************************************** */
 
typedef struct TraceModule_t
{
    char     module_name[8];            //!< Module name.
    char     module_description[32];    //!< Module description.
    unsigned module_output_mask;        //!< Stores the level of traces a module can output, using one or a concatenation of TRACE_LEVEL_xxx macros.
} TraceModule_t;
 
/* ************************************************************************** */
 
// Load settings and trace modules
#include "minitraces_conf.h"
 
/* ************************************************************************** */
 
#if MINITRACES_LEVEL == 2
 
// TRACE MACROS, fully enabled
#define TRACE_ERROR( MODULE, ... )   MiniTraces_print( __FILE__, __LINE__, __FUNCTION__, TRACE_LEVEL_ERR,  MODULE, __VA_ARGS__ )
#define TRACE_WARNING( MODULE, ... ) MiniTraces_print( __FILE__, __LINE__, __FUNCTION__, TRACE_LEVEL_WARN, MODULE, __VA_ARGS__ )
#define TRACE_INFO( MODULE, ... )    MiniTraces_print( __FILE__, __LINE__, __FUNCTION__, TRACE_LEVEL_INFO, MODULE, __VA_ARGS__ )
#define TRACE_1( MODULE, ... )       MiniTraces_print( __FILE__, __LINE__, __FUNCTION__, TRACE_LEVEL_1,    MODULE, __VA_ARGS__ )
#define TRACE_2( MODULE, ... )       MiniTraces_print( __FILE__, __LINE__, __FUNCTION__, TRACE_LEVEL_2,    MODULE, __VA_ARGS__ )
#define TRACE_3( MODULE, ... )       MiniTraces_print( __FILE__, __LINE__, __FUNCTION__, TRACE_LEVEL_3,    MODULE, __VA_ARGS__ )
 
#elif MINITRACES_LEVEL == 1
 
// TRACE MACROS, release config
#define TRACE_ERROR( MODULE, ... )   MiniTraces_print( __FILE__, __LINE__, __FUNCTION__, TRACE_LEVEL_ERR,  MODULE, __VA_ARGS__ )
#define TRACE_WARNING( MODULE, ... )
#define TRACE_INFO( MODULE, ... )
#define TRACE_1( MODULE, ... )
#define TRACE_2( MODULE, ... )
#define TRACE_3( MODULE, ... )
 
#else // MINITRACES_LEVEL == 0
 
// TRACE MACROS disabled
#define TRACE_ERROR( MODULE, ... )
#define TRACE_WARNING( MODULE, ... )
#define TRACE_INFO( MODULE, ... )
#define TRACE_1( MODULE, ... )
#define TRACE_2( MODULE, ... )
#define TRACE_3( MODULE, ... )
 
#endif // MINITRACES_LEVEL
 
/* ************************************************************************** */
 
#if MINITRACES_COLORS == 1
 
#define CLR_RESET  "\033[0m" //!< Reset colored output to default color of the terminal
 
// Regular colored text
#define CLR_BLACK  "\033[0;30m"
#define CLR_RED    "\033[0;31m"
#define CLR_GREEN  "\033[0;32m"
#define CLR_YELLOW "\033[0;33m"
#define CLR_BLUE   "\033[0;34m"
#define CLR_PURPLE "\033[0;35m"
#define CLR_CYAN   "\033[0;36m"
#define CLR_WHITE  "\033[0;37m"
 
// Bold colored text
#define BLD_BLACK  "\033[1;30m"
#define BLD_RED    "\033[1;31m"
#define BLD_GREEN  "\033[1;32m"
#define BLD_YELLOW "\033[1;33m"
#define BLD_BLUE   "\033[1;34m"
#define BLD_PURPLE "\033[1;35m"
#define BLD_CYAN   "\033[1;36m"
#define BLD_WHITE  "\033[1;37m"
 
// Bold white text, colored outline
#define OUT_BLACK  "\033[1;37;40m"
#define OUT_RED    "\033[1;37;41m"
#define OUT_GREEN  "\033[1;37;42m"
#define OUT_YELLOW "\033[1;30;43m"
#define OUT_BLUE   "\033[1;37;44m"
#define OUT_PURPLE "\033[1;37;45m"
#define OUT_CYAN   "\033[1;37;46m"
#define OUT_WHITE  "\033[1;30;47m"
 
#else // MINITRACES_COLORS == 0
 
#define CLR_RESET
#define CLR_BLACK
#define CLR_RED
#define CLR_GREEN
#define CLR_YELLOW
#define CLR_BLUE
#define CLR_PURPLE
#define CLR_CYAN
#define CLR_WHITE
#define BLD_BLACK
#define BLD_RED
#define BLD_GREEN
#define BLD_YELLOW
#define BLD_BLUE
#define BLD_PURPLE
#define BLD_CYAN
#define BLD_WHITE
#define OUT_BLACK
#define OUT_RED
#define OUT_GREEN
#define OUT_YELLOW
#define OUT_BLUE
#define OUT_PURPLE
#define OUT_CYAN
#define OUT_WHITE
 
#endif // MINITRACES_COLORS
 
/* ************************************************************************** */
#ifdef __cplusplus
}
#endif // __cplusplus
 
#endif // MINITRACES_H