1 ///////////////////////////////////////////////////////////////////////////////
2 // Simple x264 Launcher
3 // Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // http://www.gnu.org/licenses/gpl-2.0.txt
20 ///////////////////////////////////////////////////////////////////////////////
24 #include "targetver.h"
33 #define WIN32_LEAN_AND_MEAN
40 #if defined(_DEBUG) && defined(QT_DEBUG) && !defined(NDEBUG) && !defined(QT_NO_DEBUG)
41 #define X264_DEBUG (1)
43 #define X264_DEBUG (0)
48 #define X264_MEMORY_CHECK(FUNC, RETV, ...) \
50 SIZE_T _privateBytesBefore = x264_dbg_private_bytes(); \
51 RETV = FUNC(__VA_ARGS__); \
52 SIZE_T _privateBytesLeak = (x264_dbg_private_bytes() - _privateBytesBefore) / 1024; \
53 if(_privateBytesLeak > 0) { \
55 _snprintf_s(_buffer, 128, _TRUNCATE, "Memory leak: Lost %u KiloBytes of PrivateUsage memory.\n", _privateBytesLeak); \
56 OutputDebugStringA("----------\n"); \
57 OutputDebugStringA(_buffer); \
58 OutputDebugStringA("----------\n"); \
62 #define X264_MEMORY_CHECK(FUNC, RETV, ...) \
64 RETV = __noop(__VA_ARGS__); \
69 #define QWCHAR(STR) reinterpret_cast<const wchar_t*>(STR.utf16())
70 #define X264_BOOL(X) ((X) ? "1" : "0")
71 #define X264_DELETE(PTR) if(PTR) { delete PTR; PTR = NULL; }
72 #define X264_DELETE_ARRAY(PTR) if(PTR) { delete [] PTR; PTR = NULL; }
105 LONG WINAPI x264_exception_handler(__in struct _EXCEPTION_POINTERS *ExceptionInfo);
106 void x264_invalid_param_handler(const wchar_t*, const wchar_t*, const wchar_t*, unsigned int, uintptr_t);
107 void x264_message_handler(QtMsgType type, const char *msg);
108 unsigned int x264_version_major(void);
109 unsigned int x264_version_minor(void);
110 unsigned int x264_version_build(void);
111 const QDate &x264_version_date(void);
112 bool x264_portable(void);
113 const QString &x264_data_path(void);
114 bool x264_is_prerelease(void);
115 const char *x264_version_time(void);
116 const char *x264_version_compiler(void);
117 const char *x264_version_arch(void);
118 void x264_init_console(int argc, char* argv[]);
119 bool x264_init_qt(int argc, char* argv[]);
120 const x264_cpu_t x264_detect_cpu_features(int argc, char **argv);
121 bool x264_shutdown_computer(const QString &message, const unsigned long timeout, const bool forceShutdown);
122 SIZE_T x264_dbg_private_bytes(void);
123 void x264_finalization(void);