Backported various changes in the "global" functions from LameXP.

This commit is contained in:
LoRd_MuldeR 2013-11-03 17:08:02 +01:00
parent 5df550e847
commit 21fcfa22cf
6 changed files with 829 additions and 223 deletions

File diff suppressed because it is too large Load Diff

View File

@ -67,6 +67,8 @@
//Helper macros //Helper macros
#define QWCHAR(STR) reinterpret_cast<const wchar_t*>(STR.utf16()) #define QWCHAR(STR) reinterpret_cast<const wchar_t*>(STR.utf16())
#define QUTF8(STR) ((STR).toUtf8().constData())
#define WCHAR2QSTR(STR) (QString::fromUtf16(reinterpret_cast<const unsigned short*>((STR))))
#define X264_BOOL(X) ((X) ? "1" : "0") #define X264_BOOL(X) ((X) ? "1" : "0")
#define X264_DELETE(PTR) if(PTR) { delete PTR; PTR = NULL; } #define X264_DELETE(PTR) if(PTR) { delete PTR; PTR = NULL; }
#define X264_DELETE_ARRAY(PTR) if(PTR) { delete [] PTR; PTR = NULL; } #define X264_DELETE_ARRAY(PTR) if(PTR) { delete [] PTR; PTR = NULL; }
@ -104,6 +106,32 @@ typedef struct
} }
x264_cpu_t; x264_cpu_t;
//OS version number
typedef struct _x264_os_version_t
{
unsigned int versionMajor;
unsigned int versionMinor;
bool overrideFlag;
//comparision operators
inline bool operator== (const _x264_os_version_t &rhs) const { return (versionMajor == rhs.versionMajor) && (versionMinor == rhs.versionMinor); }
inline bool operator!= (const _x264_os_version_t &rhs) const { return (versionMajor != rhs.versionMajor) || (versionMinor != rhs.versionMinor); }
inline bool operator> (const _x264_os_version_t &rhs) const { return (versionMajor > rhs.versionMajor) || ((versionMajor == rhs.versionMajor) && (versionMinor > rhs.versionMinor)); }
inline bool operator>= (const _x264_os_version_t &rhs) const { return (versionMajor > rhs.versionMajor) || ((versionMajor == rhs.versionMajor) && (versionMinor >= rhs.versionMinor)); }
inline bool operator< (const _x264_os_version_t &rhs) const { return (versionMajor < rhs.versionMajor) || ((versionMajor == rhs.versionMajor) && (versionMinor < rhs.versionMinor)); }
inline bool operator<= (const _x264_os_version_t &rhs) const { return (versionMajor < rhs.versionMajor) || ((versionMajor == rhs.versionMajor) && (versionMinor <= rhs.versionMinor)); }
}
x264_os_version_t;
//Known Windows versions
extern const x264_os_version_t x264_winver_win2k;
extern const x264_os_version_t x264_winver_winxp;
extern const x264_os_version_t x264_winver_xpx64;
extern const x264_os_version_t x264_winver_vista;
extern const x264_os_version_t x264_winver_win70;
extern const x264_os_version_t x264_winver_win80;
extern const x264_os_version_t x264_winver_win81;
//Functions //Functions
LONG WINAPI x264_exception_handler(__in struct _EXCEPTION_POINTERS *ExceptionInfo); 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_invalid_param_handler(const wchar_t*, const wchar_t*, const wchar_t*, unsigned int, uintptr_t);
@ -120,8 +148,10 @@ const char *x264_version_compiler(void);
const char *x264_version_arch(void); const char *x264_version_arch(void);
void x264_init_console(int argc, char* argv[]); void x264_init_console(int argc, char* argv[]);
bool x264_init_qt(int argc, char* argv[]); bool x264_init_qt(int argc, char* argv[]);
const x264_cpu_t x264_detect_cpu_features(int argc, char **argv); x264_cpu_t x264_detect_cpu_features(const QStringList &argv);
bool x264_shutdown_computer(const QString &message, const unsigned long timeout, const bool forceShutdown); bool x264_shutdown_computer(const QString &message, const unsigned long timeout, const bool forceShutdown);
void x264_fatal_exit(const wchar_t* exitMessage, const wchar_t* errorBoxMessage = NULL); void x264_fatal_exit(const wchar_t* exitMessage, const wchar_t* errorBoxMessage = NULL);
void x264_sleep(const unsigned int delay);
const QStringList &x264_arguments(void);
SIZE_T x264_dbg_private_bytes(void); SIZE_T x264_dbg_private_bytes(void);
void x264_finalization(void); void x264_finalization(void);

View File

@ -55,8 +55,11 @@ static int x264_main(int argc, char* argv[])
qWarning("---------------------------------------------------------\n"); qWarning("---------------------------------------------------------\n");
} }
//Get CLI arguments
const QStringList &arguments = x264_arguments();
//Detect CPU capabilities //Detect CPU capabilities
const x264_cpu_t cpuFeatures = x264_detect_cpu_features(argc, argv); const x264_cpu_t cpuFeatures = x264_detect_cpu_features(arguments);
qDebug(" CPU vendor id : %s (Intel: %s)", cpuFeatures.vendor, X264_BOOL(cpuFeatures.intel)); qDebug(" CPU vendor id : %s (Intel: %s)", cpuFeatures.vendor, X264_BOOL(cpuFeatures.intel));
qDebug("CPU brand string : %s", cpuFeatures.brand); qDebug("CPU brand string : %s", cpuFeatures.brand);
qDebug(" CPU signature : Family: %d, Model: %d, Stepping: %d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping); qDebug(" CPU signature : Family: %d, Model: %d, Stepping: %d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End // Simple x264 Launcher
// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de> // Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
@ -143,13 +143,13 @@ void WinSevenTaskbar::setOverlayIcon(QWidget *window, const QIcon *icon)
{ {
if(m_ptbl && window) if(m_ptbl && window)
{ {
m_ptbl->SetOverlayIcon(window->winId(), (icon ? icon->pixmap(16,16).toWinHICON() : NULL), L"LameXP"); m_ptbl->SetOverlayIcon(window->winId(), (icon ? icon->pixmap(16,16).toWinHICON() : NULL), L"Simple x264 Launcher");
} }
} }
#else //__ITaskbarList3_INTERFACE_DEFINED__ #else //__ITaskbarList3_INTERFACE_DEFINED__
LAMEXP_COMPILER_WARNING("ITaskbarList3 not defined. Compiling *without* support for Win7 taskbar!") X264_COMPILER_WARNING("ITaskbarList3 not defined. Compiling *without* support for Win7 taskbar!")
void WinSevenTaskbar::init(void) {} void WinSevenTaskbar::init(void) {}
void WinSevenTaskbar::uninit(void) {} void WinSevenTaskbar::uninit(void) {}
bool WinSevenTaskbar::handleWinEvent(MSG *message, long *result) { return false; } bool WinSevenTaskbar::handleWinEvent(MSG *message, long *result) { return false; }

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// LameXP - Audio Encoder Front-End // Simple x264 Launcher
// Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de> // Copyright (C) 2004-2013 LoRd_MuldeR <MuldeR2@GMX.de>
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify

View File

@ -21,11 +21,13 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 2 #define VER_X264_MINOR 2
#define VER_X264_PATCH 3 #define VER_X264_PATCH 4
#define VER_X264_BUILD 586 #define VER_X264_BUILD 596
#define VER_X264_MINIMUM_REV 2350 #define VER_X264_MINIMUM_REV 2363
#define VER_X264_CURRENT_API 138 #define VER_X264_CURRENT_API 140
#define VER_X264_AVS2YUV_VER 242 #define VER_X264_AVS2YUV_VER 242
#define VER_X264_PORTABLE_EDITION (0)
#define VER_X264_PRE_RELEASE (0) #define VER_X264_PRE_RELEASE (0)