2012-01-28 16:40:14 +01:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Simple x264 Launcher
|
2013-05-11 21:52:07 +02:00
|
|
|
// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
|
2012-01-28 16:40:14 +01:00
|
|
|
//
|
|
|
|
// 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 02110-1301 USA.
|
|
|
|
//
|
|
|
|
// http://www.gnu.org/licenses/gpl-2.0.txt
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-02-07 21:48:25 +01:00
|
|
|
#pragma once
|
|
|
|
|
2012-01-28 16:40:14 +01:00
|
|
|
#include "targetver.h"
|
|
|
|
|
|
|
|
//C++ includes
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
//Win32 includes
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <Windows.h>
|
|
|
|
|
2012-04-30 16:56:01 +02:00
|
|
|
//VLD
|
|
|
|
#include <vld.h>
|
|
|
|
|
2012-01-28 16:40:14 +01:00
|
|
|
//Debug build
|
|
|
|
#if defined(_DEBUG) && defined(QT_DEBUG) && !defined(NDEBUG) && !defined(QT_NO_DEBUG)
|
|
|
|
#define X264_DEBUG (1)
|
|
|
|
#else
|
|
|
|
#define X264_DEBUG (0)
|
|
|
|
#endif
|
|
|
|
|
2012-04-30 16:56:01 +02:00
|
|
|
//Memory check
|
2012-01-28 16:40:14 +01:00
|
|
|
#if X264_DEBUG
|
2012-04-30 16:56:01 +02:00
|
|
|
#define X264_MEMORY_CHECK(FUNC, RETV, ...) \
|
2012-01-28 16:40:14 +01:00
|
|
|
{ \
|
|
|
|
SIZE_T _privateBytesBefore = x264_dbg_private_bytes(); \
|
2012-04-30 16:56:01 +02:00
|
|
|
RETV = FUNC(__VA_ARGS__); \
|
2012-01-28 16:40:14 +01:00
|
|
|
SIZE_T _privateBytesLeak = (x264_dbg_private_bytes() - _privateBytesBefore) / 1024; \
|
2012-04-30 16:56:01 +02:00
|
|
|
if(_privateBytesLeak > 0) { \
|
|
|
|
char _buffer[128]; \
|
|
|
|
_snprintf_s(_buffer, 128, _TRUNCATE, "Memory leak: Lost %u KiloBytes of PrivateUsage memory.\n", _privateBytesLeak); \
|
|
|
|
OutputDebugStringA("----------\n"); \
|
|
|
|
OutputDebugStringA(_buffer); \
|
|
|
|
OutputDebugStringA("----------\n"); \
|
2012-01-28 16:40:14 +01:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
#else
|
2012-04-30 16:56:01 +02:00
|
|
|
#define X264_MEMORY_CHECK(FUNC, RETV, ...) \
|
|
|
|
{ \
|
|
|
|
RETV = __noop(__VA_ARGS__); \
|
|
|
|
}
|
2012-01-28 16:40:14 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//Helper macros
|
|
|
|
#define QWCHAR(STR) reinterpret_cast<const wchar_t*>(STR.utf16())
|
|
|
|
#define X264_BOOL(X) ((X) ? "1" : "0")
|
|
|
|
#define X264_DELETE(PTR) if(PTR) { delete PTR; PTR = NULL; }
|
|
|
|
#define X264_DELETE_ARRAY(PTR) if(PTR) { delete [] PTR; PTR = NULL; }
|
2012-12-02 19:36:43 +01:00
|
|
|
#define _X264_MAKE_STRING_(X) #X
|
|
|
|
#define X264_MAKE_STRING(X) _X264_MAKE_STRING_(X)
|
|
|
|
#define X264_COMPILER_WARNING(TXT) __pragma(message(__FILE__ "(" X264_MAKE_STRING(__LINE__) ") : warning: " TXT))
|
2012-01-28 16:40:14 +01:00
|
|
|
|
|
|
|
//Declarations
|
|
|
|
class QString;
|
|
|
|
class QStringList;
|
|
|
|
class QDate;
|
|
|
|
class QTime;
|
|
|
|
class QIcon;
|
|
|
|
class QWidget;
|
|
|
|
class LockedFile;
|
|
|
|
enum QtMsgType;
|
|
|
|
|
|
|
|
//Types definitions
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int family;
|
|
|
|
int model;
|
|
|
|
int stepping;
|
|
|
|
int count;
|
|
|
|
bool x64;
|
|
|
|
bool mmx;
|
2012-02-07 03:37:47 +01:00
|
|
|
bool mmx2;
|
2012-01-28 16:40:14 +01:00
|
|
|
bool sse;
|
|
|
|
bool sse2;
|
|
|
|
bool sse3;
|
|
|
|
bool ssse3;
|
|
|
|
char vendor[0x40];
|
|
|
|
char brand[0x40];
|
|
|
|
bool intel;
|
|
|
|
}
|
|
|
|
x264_cpu_t;
|
|
|
|
|
|
|
|
//Functions
|
|
|
|
LONG WINAPI x264_exception_handler(__in struct _EXCEPTION_POINTERS *ExceptionInfo);
|
|
|
|
void x264_invalid_param_handler(const wchar_t*, const wchar_t*, const wchar_t*, unsigned int, uintptr_t);
|
|
|
|
void x264_message_handler(QtMsgType type, const char *msg);
|
|
|
|
unsigned int x264_version_major(void);
|
|
|
|
unsigned int x264_version_minor(void);
|
2012-02-11 00:19:24 +01:00
|
|
|
unsigned int x264_version_build(void);
|
2012-01-28 16:40:14 +01:00
|
|
|
const QDate &x264_version_date(void);
|
2012-02-10 01:58:45 +01:00
|
|
|
bool x264_portable(void);
|
2012-02-10 18:40:28 +01:00
|
|
|
const QString &x264_data_path(void);
|
2012-02-02 22:53:40 +01:00
|
|
|
bool x264_is_prerelease(void);
|
2012-01-28 16:40:14 +01:00
|
|
|
const char *x264_version_time(void);
|
|
|
|
const char *x264_version_compiler(void);
|
|
|
|
const char *x264_version_arch(void);
|
|
|
|
void x264_init_console(int argc, char* argv[]);
|
|
|
|
bool x264_init_qt(int argc, char* argv[]);
|
2012-02-07 21:48:25 +01:00
|
|
|
const x264_cpu_t x264_detect_cpu_features(int argc, char **argv);
|
2012-02-04 01:12:21 +01:00
|
|
|
bool x264_shutdown_computer(const QString &message, const unsigned long timeout, const bool forceShutdown);
|
2012-12-15 19:12:56 +01:00
|
|
|
void x264_fatal_exit(const wchar_t* exitMessage, const wchar_t* errorBoxMessage = NULL);
|
2012-01-28 16:40:14 +01:00
|
|
|
SIZE_T x264_dbg_private_bytes(void);
|
|
|
|
void x264_finalization(void);
|