Build
FOBS is distributed in two flavours: source package (containing all the source code of the project) and binary package (containing the JMF PlugIn only). In this page, instructions are provided to build and install correctly FOBS.
Build environment
The package is built using SCons tools (http://www.scons.org). Thus, a python version must be installed in your system. To make the build stage easier, the source package includes a local SCons distribution (in the $FOBS_ROOT/scons-local directory, version 0.98.5 in Fobs 0.4.2), so you don't have to install SCons tools in your system. In addition, the latest ffmpeg release is included in the source package.
In addition to the python interpreter, FOBS can make use of the following:
- J2SE SDK: needed to build the JMF plugin.
- Java Media Framework: needed to build the JMF plugin.
Configuring ffmpeg
The ffmpeg sources included in the Fobs source package are the latest available from the SVN repository that are known to work fine when the version of Fobs was released. This means that using any other version of ffmpeg sources can break the compatibility with fobs, as ffmpeg is quite a lively project and its API is continuously evolving.
The recommended procedure to configure ffmpeg so that Fobs can find it is the following:
- Extract the ffmpeg sources in the $FOBS_ROOT directory
$> cd $FOBS_ROOT
$> tar xvfj resources/current-ffmpeg.tar.bz2
- change dir to $FOBS_HOME/ffmpeg
$> cd ffmpeg
- configure and build using the scripts provided in the ffmpeg dir. Remember that many options and codecs in ffmpeg are optional and have to be configured by passing arguments to the configure script. Many of this arguments require to have additional libraries installed (faad, x264, vorbis, etc). My recommendation is to use static libraries if you plan to distribute your application. Extensive information is included in the INSTALL file of the sources distribution package.
The simplest configuration options are shown below for all supported platforms:
- MacOSX:
./configure --disable-shared --prefix=$FOBS_ROOT/external
- Linux:
./configure --disable-shared --prefix=$FOBS_ROOT/external --enable-pthreads
- MinGW:
./configure --disable-shared --prefix=$FOBS_ROOT/external --enable-memalign-hack
- Run 'make':
$> make
$> make install
- This will install relevant include and library files under $FOBS_ROOT/external. Manually install additional required files:
$> cp libavformat/avi.h $FOBS_ROOT/external/include/libavformat/
$> cp libavformat/riff.h $FOBS_ROOT/external/include/libavformat/
$> mkdir $FOBS_ROOT/external/include/libswscale
$> cp libswscale/swscale.h $FOBS_ROOT/external/include/libswscale/swscale.h
Configuring SCons
SCons is a great building tool that really helps to solve multi-platform building issues. It is written in python and so you need to have python installed and your PATH environment set to the python binary location. Remeber, a local scons distribution is included in Fobs source package, under the $FOBS_ROOT/scons-local directory.
Build script
The 'buildFobs.sh' script provided in the root directory automates the building process. Due to the dependencies associated to this project, some arguments have to be provided to this script. The script can be called with the '--help' argument to show aditional information. In the current version, the available parameters are:
FFMPEG_HOME=/path/to/dependencies
All your libraries and include files must be contained in the appropriate subfolder of this directory, e.g. $FFMPEG_HOME/include and $FFMPEG_HOME/lib (default = '#external').
FOBS4JMF=(yes|no)
Tells the script to build or ignore the Fobs4JMF binary (default = 'yes'). If your system lacks j2sdk or you are not interested in building fobs4jmf say no. :
OPTIMIZATIONS=(yes|no)
Optimize compiled code. Default is yes.
DEBUG_SYMBOLS=(yes|no)
Add debug symbols to binaries. Default is no.
Some examples of the value of these parameters:
./buildFobs.sh FOBS4JMF=no DEBUG_SYMBOLS=yes
(JMF plugin will not be built, source will be compiled with debug support)
./buildFobs.sh FFMPEG_HOME=#dependencies
(The script will look for dependencies in folder $FOBS_ROOT/dependencies. The '#' at the beginning is a special character for the SCons build environment, which denotes the root directory of the current source package, $FOBS_ROOT in our case)
./buildFobs.sh FFMPEG_HOME=/path/to/dependencies
(Same as above, but dependencies are not included in the $FOBS_ROOT folder tree)
IMPORTANT NOTE! The build script stores the values for all customized build parameters. The following time it is not necessary to write again all the parameters, but just './buildFobs.sh'.
After the project has been built, the "./dist" directory will contain the following:
dist/include, dist/lib : Static library with C++ API classes and header files needed to use Fobs in your C++ project
dist/jmf/ : Dynamic library with JMF plugin and Jar with Java part of the implementation.
dist/test/ : Some example applications to get help learning the Fobs API.
You are now ready to use both the library and the PlugIn. |