Initial commit.
This commit is contained in:
commit
b83d33f7b3
342
License.txt
Normal file
342
License.txt
Normal file
@ -0,0 +1,342 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
|
||||
|
19
ReadMe.txt
Normal file
19
ReadMe.txt
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
Simple x264 Launcher - use 64-Bit x264 with 32-Bit Avisynth
|
||||
Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
|
||||
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
|
31
gui/win_main.ui
Normal file
31
gui/win_main.ui
Normal file
@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Simple x264 Launcher</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
BIN
res/icons/movie.ico
Normal file
BIN
res/icons/movie.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
6
res/resources.qrc
Normal file
6
res/resources.qrc
Normal file
@ -0,0 +1,6 @@
|
||||
<!DOCTYPE RCC>
|
||||
<RCC version="1.0">
|
||||
<qresource>
|
||||
<file>icons/movie.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
826
src/global.cpp
Normal file
826
src/global.cpp
Normal file
@ -0,0 +1,826 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Simple x264 Launcher
|
||||
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// 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
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "global.h"
|
||||
#include "version.h"
|
||||
|
||||
//Qt includes
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
#include <QUuid>
|
||||
#include <QMap>
|
||||
#include <QDate>
|
||||
#include <QIcon>
|
||||
#include <QPlastiqueStyle>
|
||||
#include <QImageReader>
|
||||
#include <QSharedMemory>
|
||||
#include <QSysInfo>
|
||||
#include <QStringList>
|
||||
#include <QSystemSemaphore>
|
||||
#include <QMutex>
|
||||
#include <QTextCodec>
|
||||
#include <QLibrary>
|
||||
#include <QRegExp>
|
||||
#include <QResource>
|
||||
#include <QTranslator>
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
#include <QLibraryInfo>
|
||||
#include <QEvent>
|
||||
|
||||
//CRT includes
|
||||
#include <fstream>
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <intrin.h>
|
||||
|
||||
//Debug only includes
|
||||
#if X264_DEBUG
|
||||
#include <Psapi.h>
|
||||
#endif
|
||||
|
||||
//Global vars
|
||||
static bool g_x264_console_attached = false;
|
||||
static QMutex g_x264_message_mutex;
|
||||
static const DWORD g_main_thread_id = GetCurrentThreadId();
|
||||
static FILE *g_x264_log_file = NULL;
|
||||
static QDate g_x264_version_date;
|
||||
|
||||
//Const
|
||||
static const char *g_x264_months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
static const char *g_x264_imageformats[] = {"png", "jpg", "gif", "ico", "svg", NULL};
|
||||
|
||||
//Build version
|
||||
static const struct
|
||||
{
|
||||
unsigned int ver_major;
|
||||
unsigned int ver_minor;
|
||||
const char* ver_date;
|
||||
const char* ver_time;
|
||||
}
|
||||
g_x264_version =
|
||||
{
|
||||
VER_X264_MAJOR,
|
||||
VER_X264_MINOR,
|
||||
__DATE__,
|
||||
__TIME__
|
||||
};
|
||||
|
||||
//Compiler detection
|
||||
//The following code was borrowed from MPC-HC project: http://mpc-hc.sf.net/
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#if (__INTEL_COMPILER >= 1200)
|
||||
static const char *g_x264_version_compiler = "ICL 12.x";
|
||||
#elif (__INTEL_COMPILER >= 1100)
|
||||
static const char *g_x264_version_compiler = = "ICL 11.x";
|
||||
#elif (__INTEL_COMPILER >= 1000)
|
||||
static const char *g_x264_version_compiler = = "ICL 10.x";
|
||||
#else
|
||||
#error Compiler is not supported!
|
||||
#endif
|
||||
#elif defined(_MSC_VER)
|
||||
#if (_MSC_VER == 1600)
|
||||
#if (_MSC_FULL_VER >= 160040219)
|
||||
static const char *g_x264_version_compiler = "MSVC 2010-SP1";
|
||||
#else
|
||||
static const char *g_x264_version_compiler = "MSVC 2010";
|
||||
#endif
|
||||
#elif (_MSC_VER == 1500)
|
||||
#if (_MSC_FULL_VER >= 150030729)
|
||||
static const char *g_x264_version_compiler = "MSVC 2008-SP1";
|
||||
#else
|
||||
static const char *g_x264_version_compiler = "MSVC 2008";
|
||||
#endif
|
||||
#else
|
||||
#error Compiler is not supported!
|
||||
#endif
|
||||
|
||||
// Note: /arch:SSE and /arch:SSE2 are only available for the x86 platform
|
||||
#if !defined(_M_X64) && defined(_M_IX86_FP)
|
||||
#if (_M_IX86_FP == 1)
|
||||
x264_COMPILER_WARNING("SSE instruction set is enabled!")
|
||||
#elif (_M_IX86_FP == 2)
|
||||
x264_COMPILER_WARNING("SSE2 instruction set is enabled!")
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
#error Compiler is not supported!
|
||||
#endif
|
||||
|
||||
//Architecture detection
|
||||
#if defined(_M_X64)
|
||||
static const char *g_x264_version_arch = "x64";
|
||||
#elif defined(_M_IX86)
|
||||
static const char *g_x264_version_arch = "x86";
|
||||
#else
|
||||
#error Architecture is not supported!
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Global exception handler
|
||||
*/
|
||||
LONG WINAPI x264_exception_handler(__in struct _EXCEPTION_POINTERS *ExceptionInfo)
|
||||
{
|
||||
if(GetCurrentThreadId() != g_main_thread_id)
|
||||
{
|
||||
HANDLE mainThread = OpenThread(THREAD_TERMINATE, FALSE, g_main_thread_id);
|
||||
if(mainThread) TerminateThread(mainThread, ULONG_MAX);
|
||||
}
|
||||
|
||||
FatalAppExit(0, L"Unhandeled exception handler invoked, application will exit!");
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
return LONG_MAX;
|
||||
}
|
||||
|
||||
/*
|
||||
* Invalid parameters handler
|
||||
*/
|
||||
void x264_invalid_param_handler(const wchar_t*, const wchar_t*, const wchar_t*, unsigned int, uintptr_t)
|
||||
{
|
||||
if(GetCurrentThreadId() != g_main_thread_id)
|
||||
{
|
||||
HANDLE mainThread = OpenThread(THREAD_TERMINATE, FALSE, g_main_thread_id);
|
||||
if(mainThread) TerminateThread(mainThread, ULONG_MAX);
|
||||
}
|
||||
|
||||
FatalAppExit(0, L"Invalid parameter handler invoked, application will exit!");
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Change console text color
|
||||
*/
|
||||
static void x264_console_color(FILE* file, WORD attributes)
|
||||
{
|
||||
const HANDLE hConsole = (HANDLE)(_get_osfhandle(_fileno(file)));
|
||||
if((hConsole != NULL) && (hConsole != INVALID_HANDLE_VALUE))
|
||||
{
|
||||
SetConsoleTextAttribute(hConsole, attributes);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Qt message handler
|
||||
*/
|
||||
void x264_message_handler(QtMsgType type, const char *msg)
|
||||
{
|
||||
static const char *GURU_MEDITATION = "\n\nGURU MEDITATION !!!\n\n";
|
||||
|
||||
QMutexLocker lock(&g_x264_message_mutex);
|
||||
|
||||
if(g_x264_log_file)
|
||||
{
|
||||
static char prefix[] = "DWCF";
|
||||
int index = qBound(0, static_cast<int>(type), 3);
|
||||
unsigned int timestamp = static_cast<unsigned int>(_time64(NULL) % 3600I64);
|
||||
QString str = QString::fromUtf8(msg).trimmed().replace('\n', '\t');
|
||||
fprintf(g_x264_log_file, "[%c][%04u] %s\r\n", prefix[index], timestamp, str.toUtf8().constData());
|
||||
fflush(g_x264_log_file);
|
||||
}
|
||||
|
||||
if(g_x264_console_attached)
|
||||
{
|
||||
UINT oldOutputCP = GetConsoleOutputCP();
|
||||
if(oldOutputCP != CP_UTF8) SetConsoleOutputCP(CP_UTF8);
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case QtCriticalMsg:
|
||||
case QtFatalMsg:
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
x264_console_color(stderr, FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||
fprintf(stderr, GURU_MEDITATION);
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
fflush(stderr);
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
x264_console_color(stderr, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
fflush(stderr);
|
||||
break;
|
||||
default:
|
||||
x264_console_color(stderr, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
fflush(stderr);
|
||||
break;
|
||||
}
|
||||
|
||||
x264_console_color(stderr, FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
|
||||
if(oldOutputCP != CP_UTF8) SetConsoleOutputCP(oldOutputCP);
|
||||
}
|
||||
else
|
||||
{
|
||||
QString temp("[LameXP][%1] %2");
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case QtCriticalMsg:
|
||||
case QtFatalMsg:
|
||||
temp = temp.arg("C", QString::fromUtf8(msg));
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
temp = temp.arg("W", QString::fromUtf8(msg));
|
||||
break;
|
||||
default:
|
||||
temp = temp.arg("I", QString::fromUtf8(msg));
|
||||
break;
|
||||
}
|
||||
|
||||
temp.replace("\n", "\t").append("\n");
|
||||
OutputDebugStringA(temp.toLatin1().constData());
|
||||
}
|
||||
|
||||
if(type == QtCriticalMsg || type == QtFatalMsg)
|
||||
{
|
||||
lock.unlock();
|
||||
MessageBoxW(NULL, QWCHAR(QString::fromUtf8(msg)), L"LameXP - GURU MEDITATION", MB_ICONERROR | MB_TOPMOST | MB_TASKMODAL);
|
||||
FatalAppExit(0, L"The application has encountered a critical error and will exit now!");
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the console
|
||||
*/
|
||||
void x264_init_console(int argc, char* argv[])
|
||||
{
|
||||
bool enableConsole = true; //x264_version_demo();
|
||||
|
||||
if(_environ)
|
||||
{
|
||||
wchar_t *logfile = NULL;
|
||||
size_t logfile_len = 0;
|
||||
if(!_wdupenv_s(&logfile, &logfile_len, L"X264_LAUNCHER_LOGFILE"))
|
||||
{
|
||||
if(logfile && (logfile_len > 0))
|
||||
{
|
||||
FILE *temp = NULL;
|
||||
if(!_wfopen_s(&temp, logfile, L"wb"))
|
||||
{
|
||||
fprintf(temp, "%c%c%c", 0xEF, 0xBB, 0xBF);
|
||||
g_x264_log_file = temp;
|
||||
}
|
||||
free(logfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!X264_DEBUG)
|
||||
{
|
||||
for(int i = 0; i < argc; i++)
|
||||
{
|
||||
if(!_stricmp(argv[i], "--console"))
|
||||
{
|
||||
enableConsole = true;
|
||||
}
|
||||
else if(!_stricmp(argv[i], "--no-console"))
|
||||
{
|
||||
enableConsole = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(enableConsole)
|
||||
{
|
||||
if(!g_x264_console_attached)
|
||||
{
|
||||
if(AllocConsole() != FALSE)
|
||||
{
|
||||
SetConsoleCtrlHandler(NULL, TRUE);
|
||||
SetConsoleTitle(L"Simple x264 Launcher | Debug Console");
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
g_x264_console_attached = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(g_x264_console_attached)
|
||||
{
|
||||
//-------------------------------------------------------------------
|
||||
//See: http://support.microsoft.com/default.aspx?scid=kb;en-us;105305
|
||||
//-------------------------------------------------------------------
|
||||
const int flags = _O_WRONLY | _O_U8TEXT;
|
||||
int hCrtStdOut = _open_osfhandle((intptr_t) GetStdHandle(STD_OUTPUT_HANDLE), flags);
|
||||
int hCrtStdErr = _open_osfhandle((intptr_t) GetStdHandle(STD_ERROR_HANDLE), flags);
|
||||
FILE *hfStdOut = (hCrtStdOut >= 0) ? _fdopen(hCrtStdOut, "wb") : NULL;
|
||||
FILE *hfStdErr = (hCrtStdErr >= 0) ? _fdopen(hCrtStdErr, "wb") : NULL;
|
||||
if(hfStdOut) { *stdout = *hfStdOut; std::cout.rdbuf(new std::filebuf(hfStdOut)); }
|
||||
if(hfStdErr) { *stderr = *hfStdErr; std::cerr.rdbuf(new std::filebuf(hfStdErr)); }
|
||||
}
|
||||
|
||||
HWND hwndConsole = GetConsoleWindow();
|
||||
|
||||
if((hwndConsole != NULL) && (hwndConsole != INVALID_HANDLE_VALUE))
|
||||
{
|
||||
HMENU hMenu = GetSystemMenu(hwndConsole, 0);
|
||||
EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED);
|
||||
RemoveMenu(hMenu, SC_CLOSE, MF_BYCOMMAND);
|
||||
|
||||
SetWindowPos(hwndConsole, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
|
||||
SetWindowLong(hwndConsole, GWL_STYLE, GetWindowLong(hwndConsole, GWL_STYLE) & (~WS_MAXIMIZEBOX) & (~WS_MINIMIZEBOX));
|
||||
SetWindowPos(hwndConsole, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Version info
|
||||
*/
|
||||
unsigned int x264_version_major(void)
|
||||
{
|
||||
return g_x264_version.ver_major;
|
||||
}
|
||||
|
||||
unsigned int x264_version_minor(void)
|
||||
{
|
||||
return g_x264_version.ver_minor;
|
||||
}
|
||||
|
||||
const char *x264_version_compiler(void)
|
||||
{
|
||||
return g_x264_version_compiler;
|
||||
}
|
||||
|
||||
const char *x264_version_arch(void)
|
||||
{
|
||||
return g_x264_version_arch;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get build date date
|
||||
*/
|
||||
const QDate &x264_version_date(void)
|
||||
{
|
||||
if(!g_x264_version_date.isValid())
|
||||
{
|
||||
int date[3] = {0, 0, 0}; char temp[12] = {'\0'};
|
||||
strncpy_s(temp, 12, g_x264_version.ver_date, _TRUNCATE);
|
||||
|
||||
if(strlen(temp) == 11)
|
||||
{
|
||||
temp[3] = temp[6] = '\0';
|
||||
date[2] = atoi(&temp[4]);
|
||||
date[0] = atoi(&temp[7]);
|
||||
|
||||
for(int j = 0; j < 12; j++)
|
||||
{
|
||||
if(!_strcmpi(&temp[0], g_x264_months[j]))
|
||||
{
|
||||
date[1] = j+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_x264_version_date = QDate(date[0], date[1], date[2]);
|
||||
}
|
||||
|
||||
if(!g_x264_version_date.isValid())
|
||||
{
|
||||
qFatal("Internal error: Date format could not be recognized!");
|
||||
}
|
||||
}
|
||||
|
||||
return g_x264_version_date;
|
||||
}
|
||||
|
||||
const char *x264_version_time(void)
|
||||
{
|
||||
return g_x264_version.ver_time;
|
||||
}
|
||||
|
||||
/*
|
||||
* Detect CPU features
|
||||
*/
|
||||
x264_cpu_t x264_detect_cpu_features(int argc, char **argv)
|
||||
{
|
||||
typedef BOOL (WINAPI *IsWow64ProcessFun)(__in HANDLE hProcess, __out PBOOL Wow64Process);
|
||||
typedef VOID (WINAPI *GetNativeSystemInfoFun)(__out LPSYSTEM_INFO lpSystemInfo);
|
||||
|
||||
static IsWow64ProcessFun IsWow64ProcessPtr = NULL;
|
||||
static GetNativeSystemInfoFun GetNativeSystemInfoPtr = NULL;
|
||||
|
||||
x264_cpu_t features;
|
||||
SYSTEM_INFO systemInfo;
|
||||
int CPUInfo[4] = {-1};
|
||||
char CPUIdentificationString[0x40];
|
||||
char CPUBrandString[0x40];
|
||||
|
||||
memset(&features, 0, sizeof(x264_cpu_t));
|
||||
memset(&systemInfo, 0, sizeof(SYSTEM_INFO));
|
||||
memset(CPUIdentificationString, 0, sizeof(CPUIdentificationString));
|
||||
memset(CPUBrandString, 0, sizeof(CPUBrandString));
|
||||
|
||||
__cpuid(CPUInfo, 0);
|
||||
memcpy(CPUIdentificationString, &CPUInfo[1], sizeof(int));
|
||||
memcpy(CPUIdentificationString + 4, &CPUInfo[3], sizeof(int));
|
||||
memcpy(CPUIdentificationString + 8, &CPUInfo[2], sizeof(int));
|
||||
features.intel = (_stricmp(CPUIdentificationString, "GenuineIntel") == 0);
|
||||
strncpy_s(features.vendor, 0x40, CPUIdentificationString, _TRUNCATE);
|
||||
|
||||
if(CPUInfo[0] >= 1)
|
||||
{
|
||||
__cpuid(CPUInfo, 1);
|
||||
features.mmx = (CPUInfo[3] & 0x800000) || false;
|
||||
features.sse = (CPUInfo[3] & 0x2000000) || false;
|
||||
features.sse2 = (CPUInfo[3] & 0x4000000) || false;
|
||||
features.ssse3 = (CPUInfo[2] & 0x200) || false;
|
||||
features.sse3 = (CPUInfo[2] & 0x1) || false;
|
||||
features.ssse3 = (CPUInfo[2] & 0x200) || false;
|
||||
features.stepping = CPUInfo[0] & 0xf;
|
||||
features.model = ((CPUInfo[0] >> 4) & 0xf) + (((CPUInfo[0] >> 16) & 0xf) << 4);
|
||||
features.family = ((CPUInfo[0] >> 8) & 0xf) + ((CPUInfo[0] >> 20) & 0xff);
|
||||
}
|
||||
|
||||
__cpuid(CPUInfo, 0x80000000);
|
||||
int nExIds = qMax<int>(qMin<int>(CPUInfo[0], 0x80000004), 0x80000000);
|
||||
|
||||
for(int i = 0x80000002; i <= nExIds; ++i)
|
||||
{
|
||||
__cpuid(CPUInfo, i);
|
||||
switch(i)
|
||||
{
|
||||
case 0x80000002:
|
||||
memcpy(CPUBrandString, CPUInfo, sizeof(CPUInfo));
|
||||
break;
|
||||
case 0x80000003:
|
||||
memcpy(CPUBrandString + 16, CPUInfo, sizeof(CPUInfo));
|
||||
break;
|
||||
case 0x80000004:
|
||||
memcpy(CPUBrandString + 32, CPUInfo, sizeof(CPUInfo));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
strncpy_s(features.brand, 0x40, CPUBrandString, _TRUNCATE);
|
||||
|
||||
if(strlen(features.brand) < 1) strncpy_s(features.brand, 0x40, "Unknown", _TRUNCATE);
|
||||
if(strlen(features.vendor) < 1) strncpy_s(features.vendor, 0x40, "Unknown", _TRUNCATE);
|
||||
|
||||
#if !defined(_M_X64 ) && !defined(_M_IA64)
|
||||
if(!IsWow64ProcessPtr || !GetNativeSystemInfoPtr)
|
||||
{
|
||||
QLibrary Kernel32Lib("kernel32.dll");
|
||||
IsWow64ProcessPtr = (IsWow64ProcessFun) Kernel32Lib.resolve("IsWow64Process");
|
||||
GetNativeSystemInfoPtr = (GetNativeSystemInfoFun) Kernel32Lib.resolve("GetNativeSystemInfo");
|
||||
}
|
||||
if(IsWow64ProcessPtr)
|
||||
{
|
||||
BOOL x64 = FALSE;
|
||||
if(IsWow64ProcessPtr(GetCurrentProcess(), &x64))
|
||||
{
|
||||
features.x64 = x64;
|
||||
}
|
||||
}
|
||||
if(GetNativeSystemInfoPtr)
|
||||
{
|
||||
GetNativeSystemInfoPtr(&systemInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetSystemInfo(&systemInfo);
|
||||
}
|
||||
features.count = qBound(1UL, systemInfo.dwNumberOfProcessors, 64UL);
|
||||
#else
|
||||
GetNativeSystemInfo(&systemInfo);
|
||||
features.count = systemInfo.dwNumberOfProcessors;
|
||||
features.x64 = true;
|
||||
#endif
|
||||
|
||||
if((argv != NULL) && (argc > 0))
|
||||
{
|
||||
bool flag = false;
|
||||
for(int i = 0; i < argc; i++)
|
||||
{
|
||||
if(!_stricmp("--force-cpu-no-64bit", argv[i])) { flag = true; features.x64 = false; }
|
||||
if(!_stricmp("--force-cpu-no-sse", argv[i])) { flag = true; features.sse = features.sse2 = features.sse3 = features.ssse3 = false; }
|
||||
if(!_stricmp("--force-cpu-no-intel", argv[i])) { flag = true; features.intel = false; }
|
||||
}
|
||||
if(flag) qWarning("CPU flags overwritten by user-defined parameters. Take care!\n");
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the native operating system version
|
||||
*/
|
||||
DWORD x264_get_os_version(void)
|
||||
{
|
||||
OSVERSIONINFO osVerInfo;
|
||||
memset(&osVerInfo, 0, sizeof(OSVERSIONINFO));
|
||||
osVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
DWORD version = 0;
|
||||
|
||||
if(GetVersionEx(&osVerInfo) == TRUE)
|
||||
{
|
||||
if(osVerInfo.dwPlatformId != VER_PLATFORM_WIN32_NT)
|
||||
{
|
||||
throw "Ouuups: Not running under Windows NT. This is not supposed to happen!";
|
||||
}
|
||||
version = (DWORD)((osVerInfo.dwMajorVersion << 16) | (osVerInfo.dwMinorVersion & 0xffff));
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for compatibility mode
|
||||
*/
|
||||
static bool x264_check_compatibility_mode(const char *exportName, const char *executableName)
|
||||
{
|
||||
QLibrary kernel32("kernel32.dll");
|
||||
|
||||
if(exportName != NULL)
|
||||
{
|
||||
if(kernel32.resolve(exportName) != NULL)
|
||||
{
|
||||
qWarning("Function '%s' exported from 'kernel32.dll' -> Windows compatibility mode!", exportName);
|
||||
qFatal("%s", QApplication::tr("Executable '%1' doesn't support Windows compatibility mode.").arg(QString::fromLatin1(executableName)).toLatin1().constData());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for process elevation
|
||||
*/
|
||||
static bool x264_check_elevation(void)
|
||||
{
|
||||
typedef enum { x264_token_elevationType_class = 18, x264_token_elevation_class = 20 } X264_TOKEN_INFORMATION_CLASS;
|
||||
typedef enum { x264_elevationType_default = 1, x264_elevationType_full, x264_elevationType_limited } X264_TOKEN_ELEVATION_TYPE;
|
||||
|
||||
HANDLE hToken = NULL;
|
||||
bool bIsProcessElevated = false;
|
||||
|
||||
if(OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))
|
||||
{
|
||||
X264_TOKEN_ELEVATION_TYPE tokenElevationType;
|
||||
DWORD returnLength;
|
||||
if(GetTokenInformation(hToken, (TOKEN_INFORMATION_CLASS) x264_token_elevationType_class, &tokenElevationType, sizeof(X264_TOKEN_ELEVATION_TYPE), &returnLength))
|
||||
{
|
||||
if(returnLength == sizeof(X264_TOKEN_ELEVATION_TYPE))
|
||||
{
|
||||
switch(tokenElevationType)
|
||||
{
|
||||
case x264_elevationType_default:
|
||||
qDebug("Process token elevation type: Default -> UAC is disabled.\n");
|
||||
break;
|
||||
case x264_elevationType_full:
|
||||
qWarning("Process token elevation type: Full -> potential security risk!\n");
|
||||
bIsProcessElevated = true;
|
||||
break;
|
||||
case x264_elevationType_limited:
|
||||
qDebug("Process token elevation type: Limited -> not elevated.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
CloseHandle(hToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning("Failed to open process token!");
|
||||
}
|
||||
|
||||
return !bIsProcessElevated;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize Qt framework
|
||||
*/
|
||||
bool x264_init_qt(int argc, char* argv[])
|
||||
{
|
||||
static bool qt_initialized = false;
|
||||
bool isWine = false;
|
||||
typedef BOOL (WINAPI *SetDllDirectoryProc)(WCHAR *lpPathName);
|
||||
|
||||
//Don't initialized again, if done already
|
||||
if(qt_initialized)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//Secure DLL loading
|
||||
QLibrary kernel32("kernel32.dll");
|
||||
if(kernel32.load())
|
||||
{
|
||||
SetDllDirectoryProc pSetDllDirectory = (SetDllDirectoryProc) kernel32.resolve("SetDllDirectoryW");
|
||||
if(pSetDllDirectory != NULL) pSetDllDirectory(L"");
|
||||
kernel32.unload();
|
||||
}
|
||||
|
||||
//Extract executable name from argv[] array
|
||||
char *executableName = argv[0];
|
||||
while(char *temp = strpbrk(executableName, "\\/:?"))
|
||||
{
|
||||
executableName = temp + 1;
|
||||
}
|
||||
|
||||
//Check Qt version
|
||||
qDebug("Using Qt v%s [%s], %s, %s", qVersion(), QLibraryInfo::buildDate().toString(Qt::ISODate).toLatin1().constData(), (qSharedBuild() ? "DLL" : "Static"), QLibraryInfo::buildKey().toLatin1().constData());
|
||||
qDebug("Compiled with Qt v%s [%s], %s\n", QT_VERSION_STR, QT_PACKAGEDATE_STR, QT_BUILD_KEY);
|
||||
if(_stricmp(qVersion(), QT_VERSION_STR))
|
||||
{
|
||||
qFatal("%s", QApplication::tr("Executable '%1' requires Qt v%2, but found Qt v%3.").arg(QString::fromLatin1(executableName), QString::fromLatin1(QT_VERSION_STR), QString::fromLatin1(qVersion())).toLatin1().constData());
|
||||
return false;
|
||||
}
|
||||
if(QLibraryInfo::buildKey().compare(QString::fromLatin1(QT_BUILD_KEY), Qt::CaseInsensitive))
|
||||
{
|
||||
qFatal("%s", QApplication::tr("Executable '%1' was built for Qt '%2', but found Qt '%3'.").arg(QString::fromLatin1(executableName), QString::fromLatin1(QT_BUILD_KEY), QLibraryInfo::buildKey()).toLatin1().constData());
|
||||
return false;
|
||||
}
|
||||
|
||||
//Check the Windows version
|
||||
switch(QSysInfo::windowsVersion() & QSysInfo::WV_NT_based)
|
||||
{
|
||||
case 0:
|
||||
case QSysInfo::WV_NT:
|
||||
qFatal("%s", QApplication::tr("Executable '%1' requires Windows 2000 or later.").arg(QString::fromLatin1(executableName)).toLatin1().constData());
|
||||
break;
|
||||
case QSysInfo::WV_2000:
|
||||
qDebug("Running on Windows 2000 (not officially supported!).\n");
|
||||
x264_check_compatibility_mode("GetNativeSystemInfo", executableName);
|
||||
break;
|
||||
case QSysInfo::WV_XP:
|
||||
qDebug("Running on Windows XP.\n");
|
||||
x264_check_compatibility_mode("GetLargePageMinimum", executableName);
|
||||
break;
|
||||
case QSysInfo::WV_2003:
|
||||
qDebug("Running on Windows Server 2003 or Windows XP x64-Edition.\n");
|
||||
x264_check_compatibility_mode("GetLocaleInfoEx", executableName);
|
||||
break;
|
||||
case QSysInfo::WV_VISTA:
|
||||
qDebug("Running on Windows Vista or Windows Server 2008.\n");
|
||||
x264_check_compatibility_mode("CreateRemoteThreadEx", executableName);
|
||||
break;
|
||||
case QSysInfo::WV_WINDOWS7:
|
||||
qDebug("Running on Windows 7 or Windows Server 2008 R2.\n");
|
||||
x264_check_compatibility_mode(NULL, executableName);
|
||||
break;
|
||||
default:
|
||||
{
|
||||
DWORD osVersionNo = x264_get_os_version();
|
||||
qWarning("Running on an unknown/untested WinNT-based OS (v%u.%u).\n", HIWORD(osVersionNo), LOWORD(osVersionNo));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//Check for Wine
|
||||
QLibrary ntdll("ntdll.dll");
|
||||
if(ntdll.load())
|
||||
{
|
||||
if(ntdll.resolve("wine_nt_to_unix_file_name") != NULL) isWine = true;
|
||||
if(ntdll.resolve("wine_get_version") != NULL) isWine = true;
|
||||
if(isWine) qWarning("It appears we are running under Wine, unexpected things might happen!\n");
|
||||
ntdll.unload();
|
||||
}
|
||||
|
||||
//Create Qt application instance and setup version info
|
||||
QApplication *application = new QApplication(argc, argv);
|
||||
application->setApplicationName("LameXP - Audio Encoder Front-End");
|
||||
application->setApplicationVersion(QString().sprintf("%d.%02d", x264_version_major(), x264_version_minor()));
|
||||
application->setOrganizationName("LoRd_MuldeR");
|
||||
application->setOrganizationDomain("mulder.at.gg");
|
||||
application->setWindowIcon(QIcon(":/icons/movie.ico"));
|
||||
|
||||
//application->setEventFilter(x264_event_filter);
|
||||
|
||||
//Set text Codec for locale
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
||||
|
||||
//Load plugins from application directory
|
||||
QCoreApplication::setLibraryPaths(QStringList() << QApplication::applicationDirPath());
|
||||
qDebug("Library Path:\n%s\n", QApplication::libraryPaths().first().toUtf8().constData());
|
||||
|
||||
//Check for supported image formats
|
||||
QList<QByteArray> supportedFormats = QImageReader::supportedImageFormats();
|
||||
for(int i = 0; g_x264_imageformats[i]; i++)
|
||||
{
|
||||
if(!supportedFormats.contains(g_x264_imageformats[i]))
|
||||
{
|
||||
qFatal("Qt initialization error: QImageIOHandler for '%s' missing!", g_x264_imageformats[i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Add default translations
|
||||
// g_x264_translation.files.insert(x264_DEFAULT_LANGID, "");
|
||||
// g_x264_translation.names.insert(x264_DEFAULT_LANGID, "English");
|
||||
|
||||
//Check for process elevation
|
||||
if(!x264_check_elevation())
|
||||
{
|
||||
if(QMessageBox::warning(NULL, "LameXP", "<nobr>LameXP was started with elevated rights. This is a potential security risk!</nobr>", "Quit Program (Recommended)", "Ignore") == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Update console icon, if a console is attached
|
||||
if(g_x264_console_attached && !isWine)
|
||||
{
|
||||
typedef DWORD (__stdcall *SetConsoleIconFun)(HICON);
|
||||
QLibrary kernel32("kernel32.dll");
|
||||
if(kernel32.load())
|
||||
{
|
||||
SetConsoleIconFun SetConsoleIconPtr = (SetConsoleIconFun) kernel32.resolve("SetConsoleIcon");
|
||||
if(SetConsoleIconPtr != NULL) SetConsoleIconPtr(QIcon(":/icons/movie.ico").pixmap(16, 16).toWinHICON());
|
||||
kernel32.unload();
|
||||
}
|
||||
}
|
||||
|
||||
//Done
|
||||
qt_initialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for debugger (detect routine)
|
||||
*/
|
||||
static bool x264_check_for_debugger(void)
|
||||
{
|
||||
__try
|
||||
{
|
||||
DebugBreak();
|
||||
}
|
||||
__except(GetExceptionCode() == EXCEPTION_BREAKPOINT ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for debugger (thread proc)
|
||||
*/
|
||||
static void WINAPI x264_debug_thread_proc(__in LPVOID lpParameter)
|
||||
{
|
||||
while(!(IsDebuggerPresent() || x264_check_for_debugger()))
|
||||
{
|
||||
Sleep(333);
|
||||
}
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for debugger (startup routine)
|
||||
*/
|
||||
static HANDLE x264_debug_thread_init(void)
|
||||
{
|
||||
if(IsDebuggerPresent() || x264_check_for_debugger())
|
||||
{
|
||||
FatalAppExit(0, L"Not a debug build. Please unload debugger and try again!");
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
}
|
||||
|
||||
return CreateThread(NULL, NULL, reinterpret_cast<LPTHREAD_START_ROUTINE>(&x264_debug_thread_proc), NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize debug thread
|
||||
*/
|
||||
static const HANDLE g_debug_thread = X264_DEBUG ? NULL : x264_debug_thread_init();
|
||||
|
||||
/*
|
||||
* Get number private bytes [debug only]
|
||||
*/
|
||||
SIZE_T x264_dbg_private_bytes(void)
|
||||
{
|
||||
#if X264_DEBUG
|
||||
PROCESS_MEMORY_COUNTERS_EX memoryCounters;
|
||||
memoryCounters.cb = sizeof(PROCESS_MEMORY_COUNTERS_EX);
|
||||
GetProcessMemoryInfo(GetCurrentProcess(), (PPROCESS_MEMORY_COUNTERS) &memoryCounters, sizeof(PROCESS_MEMORY_COUNTERS_EX));
|
||||
return memoryCounters.PrivateUsage;
|
||||
#else
|
||||
throw "Cannot call this function in a non-debug build!";
|
||||
#endif //X264_DEBUG
|
||||
}
|
||||
|
||||
/*
|
||||
* Finalization function
|
||||
*/
|
||||
void x264_finalization(void)
|
||||
{
|
||||
/* NOP */
|
||||
}
|
105
src/global.h
Normal file
105
src/global.h
Normal file
@ -0,0 +1,105 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Simple x264 Launcher
|
||||
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// 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
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#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>
|
||||
|
||||
//Debug build
|
||||
#if defined(_DEBUG) && defined(QT_DEBUG) && !defined(NDEBUG) && !defined(QT_NO_DEBUG)
|
||||
#define X264_DEBUG (1)
|
||||
#else
|
||||
#define X264_DEBUG (0)
|
||||
#endif
|
||||
|
||||
//Memory leack checker
|
||||
#if X264_DEBUG
|
||||
#define X264_MEMORY_CHECK(CMD) \
|
||||
{ \
|
||||
SIZE_T _privateBytesBefore = x264_dbg_private_bytes(); \
|
||||
CMD; \
|
||||
SIZE_T _privateBytesLeak = (x264_dbg_private_bytes() - _privateBytesBefore) / 1024; \
|
||||
if(_privateBytesLeak > 10) { \
|
||||
qWarning("Memory leak: Lost %u KiloBytes.", _privateBytesLeak); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define X264_MEMORY_CHECK(CMD) CMD
|
||||
#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; }
|
||||
|
||||
//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;
|
||||
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);
|
||||
const QDate &x264_version_date(void);
|
||||
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[]);
|
||||
x264_cpu_t x264_detect_cpu_features(int argc, char **argv);
|
||||
SIZE_T x264_dbg_private_bytes(void);
|
||||
void x264_finalization(void);
|
152
src/main.cpp
Normal file
152
src/main.cpp
Normal file
@ -0,0 +1,152 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Simple x264 Launcher
|
||||
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// 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
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "global.h"
|
||||
#include "win_main.h"
|
||||
|
||||
//Qt includes
|
||||
#include <QCoreApplication>
|
||||
#include <QDate>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Main function
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int x264_main(int argc, char* argv[])
|
||||
{
|
||||
//Init console
|
||||
x264_init_console(argc, argv);
|
||||
|
||||
//Print version info
|
||||
qDebug("Simple x264 Launcher v%u.%02u - use 64-Bit x264 with 32-Bit Avisynth", x264_version_major(), x264_version_minor());
|
||||
qDebug("Copyright (c) 2004-%04d LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.", qMax(x264_version_date().year(),QDate::currentDate().year()));
|
||||
qDebug("Built on %s at %s with %s for Win-%s.\n", x264_version_date().toString(Qt::ISODate).toLatin1().constData(), x264_version_time(), x264_version_compiler(), x264_version_arch());
|
||||
|
||||
//print license info
|
||||
qDebug("This program is free software: you can redistribute it and/or modify");
|
||||
qDebug("it under the terms of the GNU General Public License <http://www.gnu.org/>.");
|
||||
qDebug("Note that this program is distributed with ABSOLUTELY NO WARRANTY.\n");
|
||||
|
||||
//Print warning, if this is a "debug" build
|
||||
if(X264_DEBUG)
|
||||
{
|
||||
qWarning("---------------------------------------------------------");
|
||||
qWarning("DEBUG BUILD: DO NOT RELEASE THIS BINARY TO THE PUBLIC !!!");
|
||||
qWarning("---------------------------------------------------------\n");
|
||||
}
|
||||
|
||||
//Detect CPU capabilities
|
||||
x264_cpu_t cpuFeatures = x264_detect_cpu_features(argc, argv);
|
||||
qDebug(" CPU vendor id : %s (Intel: %s)", cpuFeatures.vendor, X264_BOOL(cpuFeatures.intel));
|
||||
qDebug("CPU brand string : %s", cpuFeatures.brand);
|
||||
qDebug(" CPU signature : Family: %d, Model: %d, Stepping: %d", cpuFeatures.family, cpuFeatures.model, cpuFeatures.stepping);
|
||||
qDebug("CPU capabilities : MMX: %s, SSE: %s, SSE2: %s, SSE3: %s, SSSE3: %s, x64: %s", X264_BOOL(cpuFeatures.mmx), X264_BOOL(cpuFeatures.sse), X264_BOOL(cpuFeatures.sse2), X264_BOOL(cpuFeatures.sse3), X264_BOOL(cpuFeatures.ssse3), X264_BOOL(cpuFeatures.x64));
|
||||
qDebug(" Number of CPU's : %d\n", cpuFeatures.count);
|
||||
|
||||
//Initialize Qt
|
||||
if(!x264_init_qt(argc, argv))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
//Run application
|
||||
MainWindow *mainWin = new MainWindow;
|
||||
mainWin->show();
|
||||
int ret = qApp->exec();
|
||||
X264_DELETE(mainWin);
|
||||
return ret;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Applicaton entry point
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static int _main(int argc, char* argv[])
|
||||
{
|
||||
if(X264_DEBUG)
|
||||
{
|
||||
int iResult = -1;
|
||||
qInstallMsgHandler(x264_message_handler);
|
||||
X264_MEMORY_CHECK(iResult = x264_main(argc, argv));
|
||||
x264_finalization();
|
||||
return iResult;
|
||||
}
|
||||
else
|
||||
{
|
||||
int iResult = -1;
|
||||
try
|
||||
{
|
||||
qInstallMsgHandler(x264_message_handler);
|
||||
iResult = x264_main(argc, argv);
|
||||
x264_finalization();
|
||||
}
|
||||
catch(char *error)
|
||||
{
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error message: %s\n", error);
|
||||
FatalAppExit(0, L"Unhandeled C++ exception error, application will exit!");
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
}
|
||||
catch(int error)
|
||||
{
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
fprintf(stderr, "\nGURU MEDITATION !!!\n\nException error code: 0x%X\n", error);
|
||||
FatalAppExit(0, L"Unhandeled C++ exception error, application will exit!");
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
fprintf(stderr, "\nGURU MEDITATION !!!\n");
|
||||
FatalAppExit(0, L"Unhandeled C++ exception error, application will exit!");
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
}
|
||||
return iResult;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
if(X264_DEBUG)
|
||||
{
|
||||
return _main(argc, argv);
|
||||
}
|
||||
else
|
||||
{
|
||||
__try
|
||||
{
|
||||
SetUnhandledExceptionFilter(x264_exception_handler);
|
||||
_set_invalid_parameter_handler(x264_invalid_param_handler);
|
||||
return _main(argc, argv);
|
||||
}
|
||||
__except(1)
|
||||
{
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
fprintf(stderr, "\nGURU MEDITATION !!!\n\nUnhandeled structured exception error! [code: 0x%X]\n", GetExceptionCode());
|
||||
FatalAppExit(0, L"Unhandeled structured exception error, application will exit!");
|
||||
TerminateProcess(GetCurrentProcess(), -1);
|
||||
}
|
||||
}
|
||||
}
|
8
src/targetver.h
Normal file
8
src/targetver.h
Normal file
@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
// Including SDKDDKVer.h defines the highest available Windows platform.
|
||||
|
||||
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
||||
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
||||
|
||||
#include <SDKDDKVer.h>
|
23
src/version.h
Normal file
23
src/version.h
Normal file
@ -0,0 +1,23 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// LameXP - Audio Encoder Front-End
|
||||
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// 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
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define VER_X264_MAJOR (2)
|
||||
#define VER_X264_MINOR (0)
|
38
src/win_main.cpp
Normal file
38
src/win_main.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Simple x264 Launcher
|
||||
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// 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
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "win_main.h"
|
||||
#include "global.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor & Destructor
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MainWindow::MainWindow(void)
|
||||
{
|
||||
//Init the dialog, from the .ui file
|
||||
setupUi(this);
|
||||
setWindowFlags(windowFlags() ^ Qt::WindowMaximizeButtonHint);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow(void)
|
||||
{
|
||||
}
|
33
src/win_main.h
Normal file
33
src/win_main.h
Normal file
@ -0,0 +1,33 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Simple x264 Launcher
|
||||
// Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
|
||||
//
|
||||
// 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
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "uic_win_main.h"
|
||||
|
||||
class MainWindow: public QMainWindow, private Ui::MainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow();
|
||||
~MainWindow(void);
|
||||
};
|
20
x264_launcher.sln
Normal file
20
x264_launcher.sln
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "x264_launcher", "x264_launcher.vcxproj", "{563D953B-CBC3-4C75-AFC2-5BD87531C332}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{563D953B-CBC3-4C75-AFC2-5BD87531C332}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{563D953B-CBC3-4C75-AFC2-5BD87531C332}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{563D953B-CBC3-4C75-AFC2-5BD87531C332}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{563D953B-CBC3-4C75-AFC2-5BD87531C332}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
137
x264_launcher.vcxproj
Normal file
137
x264_launcher.vcxproj
Normal file
@ -0,0 +1,137 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{563D953B-CBC3-4C75-AFC2-5BD87531C332}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>x264_launcher</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;QT_DEBUG;QT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)tmp\uic;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>QtMaind.lib;QtCored4.lib;QtGuid4.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>Full</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;QT_NO_DEBUG;QT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(QTDIR)\include;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(SolutionDir)tmp\uic;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>$(QTDIR)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>QtMain.lib;QtCore4.lib;QtGui4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="gui\win_main.ui">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">UIC "$(SolutionDir)tmp\UIC_%(Filename).h"</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\uic.exe" -o "$(SolutionDir)tmp\uic\uic_%(Filename).h" "%(FullPath)"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UIC "$(SolutionDir)tmp\UIC_%(Filename).h"</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\uic\uic_%(Filename).h;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<None Include="ReadMe.txt" />
|
||||
<CustomBuild Include="res\resources.qrc">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp"</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\rcc.exe" -o "$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp" -name "%(Filename)" "%(FullPath)"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">RCC "$(SolutionDir)tmp\QRC_%(Filename).cpp"</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\qrc\qrc_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\global.h" />
|
||||
<ClInclude Include="src\targetver.h" />
|
||||
<ClInclude Include="src\version.h" />
|
||||
<CustomBuild Include="src\win_main.h">
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(QTDIR)\bin\moc.exe" -o "$(SolutionDir)tmp\moc\moc_%(Filename).cpp" "%(FullPath)"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC "$(SolutionDir)tmp\MOC_%(Filename).cpp"</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)tmp\moc\moc_%(Filename).cpp;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\global.cpp" />
|
||||
<ClCompile Include="src\main.cpp" />
|
||||
<ClCompile Include="src\win_main.cpp" />
|
||||
<ClCompile Include="tmp\moc\moc_win_main.cpp" />
|
||||
<ClCompile Include="tmp\qrc\qrc_resources.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
65
x264_launcher.vcxproj.filters
Normal file
65
x264_launcher.vcxproj.filters
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Dialogs">
|
||||
<UniqueIdentifier>{c2fedf5a-a6cd-4538-bbc1-269ebb2beb39}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Generated Files">
|
||||
<UniqueIdentifier>{961e9f99-8107-45a2-984d-188819a67e8e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\global.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\targetver.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\global.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\win_main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tmp\moc\moc_win_main.cpp">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tmp\qrc\qrc_resources.cpp">
|
||||
<Filter>Generated Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="gui\win_main.ui">
|
||||
<Filter>Dialogs</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="src\win_main.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="res\resources.qrc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user