====== Building ffdshow ======
===== Prerequisite =====
* [[http://tortoisesvn.net/downloads|TortoiseSVN]] or any other SVN client
* MinGW 4.4.1-tdm-2 ([[http://www.tdragon.net/recentgcc/|TDM's GCC/mingw32 Builds]])
* Microsoft Visual Studio 2008 (Professional Edition or [[http://www.microsoft.com/express/download/default.aspx|Express Edition]])
* Microsoft DirectX SDK ([[http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=b66e14b8-8505-4b17-bf80-edb2df5abad4|August 2009]])
* [[http://www.tortall.net/projects/yasm/wiki/Download|Yasm]] (Download and rename the file to "yasm.exe".)
Optionally,
* Microsoft Windows SDK [[http://www.microsoft.com/downloads/details.aspx?FamilyId=F26B1AA4-741A-433A-9BE5-FA919850BDBF&displaylang=en|6.1]] or [[http://www.microsoft.com/downloads/details.aspx?FamilyID=a91dc12a-fc94-4027-b67e-46bab7c5226c&DisplayLang=en|7.0]]
* [[http://www.jrsoftware.org/isdl.php#qsp|Inno Setup]]
* [[http://www.mingw.org/wiki/MSYS|MSYS]]
* [[http://sourceware.org/pthreads-win32/|Pthreads-w32]]
* Intel C++ Compiler 10 or [[http://www.intel.com/cd/software/products/asmo-na/eng/compilers/279578.htm|11]] ($599 or 30 day evaluation). (If you plan to use Intel C++ Compiler **11.x.xxx** read below)
If you plan to build 64bit version,
* [[http://sourceforge.net/projects/mingw-w64/|MinGW - Minimalist GNU for Windows 64 and pthread]]
Custom made for ffdshow,
* [[http://sourceforge.net/projects/ffdshow-tryout/files/Tools/mingw32_gcc441_20091010.exe/download|MinGW32 Custom installer (build 2009-10-10)]], contains all the components needed for a fully working MinGW32/MSYS development environment (x86 only)
===== Getting the source code =====
Create a blank directory whose full path does not contain any spaces.
Assuming you have installed TortoiseSVN, right click the directory in Windows Explorer, choose "SVN Checkout" from the context menu.
Enter "https://ffdshow-tryout.svn.sourceforge.net/svnroot/ffdshow-tryout/" as the URL of the repository. This would check out all branches of the source code, so if you are only interested in one branch in particular (like "trunk", which is where the completed changes are added and where releases are again branched from) click on the "..." besides the URL entry box and select the branch you want.
===== Which compiler to use =====
MSVC can build most files of ffdshow, but this is not always the best.
* libavcodec, libmplayer, libmpeg2, libtheora, x264, xvidcore: These files are originally Linux projects. GCC should be used for release builds. MSVC may be able to compile some of these, which helps debugging process.
* KernelDeint, TomsMoComp: For best performance, GCC is preferred.
* ffdshow.ax: MSVC or ICL11. ICL11 is faster in some special cases, while MSVC is good enough for most cases.
===== Configuring the compilers =====
Latest SDK will automatically configure MS Visual C++.
Include path for MSVC
* $(ProgramFiles)\Microsoft DirectX SDK (August 2009)\Include
* $(WindowsSdkDir)\include
* $(VCInstallDir)\include
Library path for MSVC (32bit)
* $(ProgramFiles)\Microsoft DirectX SDK (August 2009)\Lib\x86
* $(WindowsSdkDir)\lib
* $(VCInstallDir)\lib
Environmental variables
* CC=gcc
Optional for Intel C++ Compiler **11.x.xxx**
* Open ffdshow_2008_icl10.sln, project files will be converted for ICL 11 and go to Project-->ffdshow Properties-->C/C++-->Command Line and add **/Qvec-** for the Solution "//Release Unicode Win32//". If you use Intel C++ Compiler 10 this is not needed.
===== Make command line options =====
To build dlls using MinGW, launch MSYS or cmd.exe and go to the directory. Type 'make'. This should build x86 version of ffdshow.\\
If you are building x64 version, make 64BIT=yes
===== MinGW workaround on Vista =====
It may be difficult to install MinGW on Vista. You could insert the code below in your bat file to launch MSYS or cmd.exe.\\
[[http://www.blitzbasic.com/Community/posts.php?topic=67297|Tips to get MINGW working on MS VISTA]]
set MINGWROOT=C:\MinGW
set MINGWBIN=%MINGWROOT%\bin
set MINGWINCLUDE=%MINGWROOT%\include
set MINGWLIB=%MINGWROOT%\lib
set MINGWLIBEXEC=%MINGWROOT%\libexec\gcc\mingw32\4.4.1
set MINGWBIN2=%MINGWROOT%\mingw32\bin
set MINGWLIB2=%MINGWROOT%\mingw32\lib\ldscripts
set MINGW=%MINGWROOT%;%MINGWBIN%;%MINGWINCLUDE%;%MINGWLIB%;%MINGWLIBEXEC%;%MINGWLIB2%;%MINGWLIB2%
set GCC_EXEC_PREFIX=%MINGWLIB%\gcc\
rem to add more resource paths just use the set command like above and then add it to the set PATH like below
set PATH=%MINGW%;%PATH%
===== Installing the files you have just built =====
After building ffdshow.ax, MSVC automatically calls bin\register.bat and installs the new files. bin directory is the new installation directory, do not copy files to "Program Files\ffdshow". ffdshow.ax requires libmplayer.dll (and some other dlls depending on your settings) in the same directory.\\
You have to double click bin\register64.bat manually if you are building x64 version (see the bat for the reason).
===== Creating an installer =====
Double click bin\distrib\InnoSetup\ffdshow_installer.iss. Read first five lines and enter appropriate values. Press F9 to build.