Installation instructions for GPAC on windows platform
last modified: May 2012

0 Foreword
	For any question on the installation procedure, please refer to http://gpac.sourceforge.net/home_download.php

	The output directory for all plugins and applications is
		gpac/bin/win32/debug in debug mode
		gpac/bin/win32/release in release mode
	
	As of 0.2.2, GPAC cannot be compiled without ZLIB. You'd better make sure it is installed locally or on your system (zlib is provided in gpac_extra_libs package)
	
I Extra lib installation

	It is recommended to download and compile all extra libs needed by gpac on windows. Please read carefull the ReadMe file included in the gpac_extra_libs package

	
II GPAC compilation

	open the GPAC workspace: 
    gpac/build/msvc6/GPAC.dsw with MSVC6
    gpac/build/msvc8/gpac.sln with VS2005 
    gpac/build/msvc9/gpac.sln with VS2008
	
	NEVER ATTEMPT TO LOAD A PROJECT OUTSIDE THIS WORKSPACE, AS DEPENDENCY RULES WILL BE BROKEN
	
	II.1 Recompiling GPAC
		libgpac is the core library of the GPAC framework used by all GPAC applications. It is available as a static library and as a dynamic one
		Set the "libgpac_dll" project as the active one
		If you have not installed the SpiderMonkey (JavaScript, libjs), JPEG or PNG libraries, remove the indicated macros in the file gpac/include/gpac/internal/config_static.h
		recompile (libgpac_dll compilation will fail if zlib is not found)

		Note: If you wish to build the fixed-point version of GPAC (not recommended), you will have to modify by hand the file gpac/include/gpac/math.h
		and replace the line
      #define GPAC_NO_FIXED_POINT
    by the line
      #define GPAC_FIXED_POINT
	  
	  !!Do not attempts to enable fixed-point compilation in any other way!!
	
	II.2 Recompiling MP4Box
		MP4Box is GPAC command-line tool for content authoring.
		Set the "MP4Box" project as the active one
		Recompile
		
	II.3 Plugins check
		Before compiling other applications in GPAC you must make sure the projects are configured with the right libraries

		* aac_in
			If you have not installed faad2 library, remove the GPAC_HAS_FAAD preprocessor variable from the aac_in project settings.
			Note that if no aac decoder is installed for gpac you may as well remove the "aac_in" project from the workspace (DEL).

		* ac3_in
			If you have not installed liba52 library, remove the GPAC_HAS_LIBA52 preprocessor variable from the ac3_in project settings.
			Note that if no ac3 decoder is installed for gpac you may as well remove the "ac3_in" project from the workspace (DEL).

		* mp3_in
			If you have not installed mad library, remove the GPAC_HAS_MAD preprocessor variable from the mp3_in project settings.
			Note that if no mp3 decoder is installed for gpac you may as well remove the "mp3_in" project from the workspace (DEL).

		* xvid_dec
			if you have not installed xvid library, remove the "xvid_dec" project from the workspace (DEL).
		
		* img_in:
			If you have not installed libopenjpeg, remove the GPAC_HAS_JP2 preprocessor variable from the img_in project settings
        and the relevant library from the link settings
			If you have not installed any of the above libraries, you may remove the "img_in" project from the workspace (DEL).

		* amr_float_dec	
			This plugin handles speech coded data using AMR Narrow Band and Wide Band formats. It uses two decoders from the 3GPP consortium available at: 
				AMR Narrowband decoder: http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-700.zip
				AMR Wideband decoder: http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-710.zip

			(The same versions are included in gpac_extra_libs/AMR_NB_FT and  gpac_extra_libs/AMR_WB_FT )

 			To compile this plugin, copy the source code to modules/amr_float_dec/amr_nb_ft and modules/amr_float_dec/amr_wb_ft respectively, WITHOUT OVERWRITING typedefs.h files.
 			You may as well compile with only one of these libraries installed:
			If you have not installed AMR NB, remove the GPAC_HAS_AMR_FT preprocessor variable from the amr_float_dec project settings
			If you have not installed AMR WB, remove the GPAC_HAS_AMR_FT_WB preprocessor variable from the amr_float_dec project settings
 			Otherwise, remove the "amr_float_dec" project from the workspace (DEL).

		* amr_dec		
			This plugin handles speech coded data using AMR Narrow Band format with a fixed-point decoder (suited for embedded platforms). 
			It uses the decoder of the 3GPP consortium (TS26.073) available from http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-700.zip. 
			It is the same version included in gpac_extra_libs/AMR_NB with a slight header modifcation.
 			To compile this plugin, copy the source code to modules/amr_dec/amr_nb WITHOUT OVERWRITING typedefs.h file.
 			Otherwise, remove the "amr_dec" project from the workspace (DEL). Note you usually won't need this plugin, the float version of the decoders being much faster.
		
		* ffmpeg_in		
			To install ffmpeg libraries, cf gpac_extra_libs/ReadMe
			if you have not installed ffmpeg libraries (avcodec.lib/dll, avformat.lib/dll, avutil.lib/dll), remove the "ffmpeg_in" project from the workspace (DEL).

		* ft_font
			if you have not installed freetype, simply remove the "ft_font" project from the workspace (DEL).

		* gdip_rend
			To install GDIPLus, either get Microsft PlatformSDK (http://www.microsoft.com/msdownload/platformsdk/sdkupdate/) or read gpac_extra_libs/GDIPlus/install.txt
			if you have not installed GDIPlus or WindowsSDK, remove the "gdip_rend" project from the workspace (DEL).

		* ogg
			if you have not installed libogg library, remove the "ogg" project from the workspace (DEL).
			if you have not installed libvorbis library, remove the GPAC_HAS_VORBIS preprocessor variable from the ogg project settings
			if you have not installed libtheora library, remove the GPAC_HAS_THEORA preprocessor variable from the ogg project settings
			Note that if you have only installed libogg you can also remove the "ogg" project from the workspace, it won't be any usefull.

		* sdl_out:
			GPAC can use SDL library for audio (all clients) and video (MP4Client and wxOsmo4) output. 
			You will need to get SDL 1.2 for windows. Get it at http://www.libsdl.org/download-1.2.php. You need the DEVELOPMENT LIBRARY SDL-devel-1.2.7-VC6.zip 
			Unpack and setup your path or VisualC++ for SDL include and lib directories (you may need to restart VisualC++)
			You will need to modify your VC settings to look for libxml headers and library directories.
			If you don't want to install libSDL or don't plan to use MP4Client or wxOsmo4, simply remove the "sdl_out" project from the workspace (DEL).
			NOTE: SDL is not needed at all on windows, you will still have audio and video support without SDL. The SDL plugin is much slower than the directX plugin 
			when dealing with video since it uses software YUV to RGB conversion.

		NOTE: if you have not installed GDIPlus nor freetype, you won't have text support at all in GPAC.
	
	
	II.4 Recompiling Osmo4
		Osmo4 is the GUI MPEG-4 player of GPAC for the windows platform.
		Set Osmo4 as the active project
		recompile (enabled plugins will be recompiled in the process)
		
	II.5 Recompiling MP4Client
		MP4Client is the command MPEG-4 player of GPAC. 
		Set MP4Client as the active project
		recompile (enabled plugins will be recompiled in the process)

	II.6 Recompiling Osmo4/wxWidgets
		Osmo4 / wxWidgets is the cross-platform GUI MPEG-4 player of GPAC. You must have wxWidgets 2.6.0 installed and configured on your system (this may be tricky. Please 
		make sure you can recompile some sample wxWidgets applications from wxWidgets distribution first).
		Set wxOsmo4 as the active project
		recompile (some plugins may be recompiled in the process). You may need to change the linker settings, depending on your wxWidgets version and config

	II.7 Recompiling Osmozilla
		Osmozilla is GPAC plugin for Mozilla-based browsers, enabling embedding all GPAC supported contents in a web page. Recompile it only if you think it may 
		be helpful. 
    * Get the gecko sdk (http://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.7.13/gecko-sdk-i586-pc-msvc-1.7.13.zip or in the gpac_extra_libs package)
    * Extract it to gpac/extra_lib/include/gecko-sdk
    * Set Osmozilla as the active project and recompile

	II.7 Recompiling GPAX
		GPAX is GPAC ActiveX control, only usable as an Internet Explorer plugin for now, enabling to embed all GPAC supported contents in a web page. Recompile it only if you think it may 
		be helpful (Set as the active project and recompile)

III Launching the applications

	If you have compiled libgpac with SpiderMonkey (JavaScript) enabled, copy the JS32.dll file in the output directory.
		
	Some applications need to locate the GPAC configuration file called GPAC.cfg. This file is automatically generated by Osmo4 in its directory. It is recommended
to first launch Osmo4 to get a working config file.
	For more information regarding the config file, cf gpac/doc/configuration.html

	You can launch Osmo4 as is, the application should start and be operational right away.
	
	You can use MP4Box as is.
	
	MP4Client needs GPAC configuration file to run. It will by default search for the file in the current directory, and some hardcoded directories that will likely not work.
	If the config file is not found, a new one is created in the current directory. You can pass a given config file as a parameter (MP4Client -c config_path).
	You can also modify the hardcoded path in MP4Client (gpac/Applications/MP4Client/main.c) to point to gpac output directory and recompile.
	
		
	Osmozilla cannot be launched without a mozilla-based web browser. You should not try to install it in any other way than with the GPAC installer 
	(cf below). Once installed, you may try any test in an html page viewed with your browser, for example:
      	<object type="application/mp4" width="120" height="100">
        <param name="src" value="myfile.mp4" /> 
      	</object>
   To make sure your browser has loaded the osmozilla plugin and to check the mime types supported, try typing "about:plugins" in your browser address bar.
		
	GPAX cannot be launched without Internet Explorer. You should not try to install it in any other way than with the GPAC installer 
	(cf below). Once installed, you may try any test in an html page viewed with your browser, for instance:
      	<object type="application/mp4" width="120" height="100">
        <param name="src" value="myfile.mp4" /> 
      	</object>
      	
      	
IV Configuration
	
	IV.0 Foreword
		All configuration information is described in gpac/doc/configuration.html, or man gpac.
	
	IV.1 OpenGL
		OpenGL is badly known for performing quite poorly as far as high data rate texturing is involved. This is a big issue when displaying a typical movie and you
		will likely find the GPAC 3D Renderer very slow on your system. If your GPU supports non power of 2 texturing or rectangular texturing (most Win32 drivers do) 
		you shouldn't have any problem with video. Otherwise here are some tips to configure GPAC on your system:
		1- set the "BitmapCopyPixels" option on: some cards perform rather well at direct pixel transfer. If no improvement, set it off.
		2- set the "BitmapCopyPixels" option off and the "EmulatePOW2" option on. This will trick the GL texturing by using only Power Of 2 textures when converting 
		from YUV to RGB. 
		3- If this does not improve video playback, you're only chance is through discussion forums & co to gather info about your system, your GL implementation 
		and how to fine-tune it.

V Misc

	V.1 Scene Generators
		In gpac/applications/generators you will find the code generators for MPEG-4, X3D and SVG scene graphs used in gpac.
		If you want to modify the set of nodes understood by GPAC in encoding/decoding/rendering, you will need those.
		The Scene generators can be recompiled without dependencies to extra libraries nor libgpac library.
		To recompile them, open the related project files (.dsp) and recompile.
		To use them, cf gpac/doc/SceneGenerators
		
	VI.2 V4Studio
		V4Studio is a very simple authoring tool for 2D content. It is not usable but may interest developers. 
		For Installation instructions cf gpac/Applications/V4Studio/install
		
	VI.3 GPAC Installer
		The GPAC installer uses the NSIS installing system. The installation script is gpac/bin/w32_rel/install/GPAC_Install.nsi
		- Before building the installer
			* get NullSoft installer (nsis.sourceforge.net), at least version 2.0
			* make sure the js32.dll is copied in the gpac/bin/w32_rel dir if you have compiled GPAC with SpiderMonkey support, otherwise comment 
			out "..\js32.dll" line from the install script
			* copy gdiplus.dll to gpac/bin/w32_rel/install 
			* make sure avcodec.dll and avformat.dll are copied in gpac/bin/w32_rel if you have built ffmpeg plugin
			* make sure iconv.dll, libxml2.dll, zlib1.dll in gpac/bin/w32_rel if you have compiled libxml2
			
		- Building GPAC installer
			The installer includes Osmo4, MP4Box, Osmozilla and all modules except SDL_out and raw_out. To install, right click on "GPAC_Install.nsi" and compile
			For other configurations, modify the script "GPAC_Install.nsi" to comment out unwanted features
		
