Notes 2013-07-05:
    - Latest versions used - vanilla FFmpeg 1.0,
        x264 snapshot-20120928-2245-stable, lame 3.99.5
    - Currently compiled with tdm-gcc-4.7.1-2 and tdm64-gcc-4.7.1-3 (msys)
    - when configuring ffmpeg for x64
    got error: undefined reference to `init_xrpow_core_sse` for liblame libs
    fixed by editing config.h and removing "﻿#define HAVE_XMMINTRIN_H 1"
    (maybe removing nasm will do the same)
    - when configuring ffmpeg for x86 got:
    undefined reference to `has_MMX_nasm'
    undefined reference to `has_3DNow_nasm'
    ....
    Removing "--enable-nasm" in lame configure fixed error.
    - compiling with MinGW-w64(4.8.1) for 64bit has the same problems as
    described earlier, after compiling and making video call app crash with
    EXCEPTION_ACCESS_VIOLATION in msvcrt.dll memcmp

1. lame

./configure \
    --disable-shared --enable-static \
    --enable-nasm \
    --disable-analyzer-hooks --disable-decoder --disable-frontend \
    --with-pic

FFmpeg looks for lame.h as lame/lame.h but the uninstalled lame-3.99.5 does not
have the lame directory so go into lame-3.99.5/include and "ln -s . lame" on
Linux and Mac OS X or "mklink /d lame ." on Windows.

Windows notes:
    - As an alternative to configure and a subsequent make, use:
      make -f Makefile.unix HAVE_NASM=YES NOUNIXCMD=NO UNAME=MSDOS
      Unfortunately, it may not work.
    - Before make, open Makefile, libmp3lame/Makefile and
      libmp3lame/i386/Makefile and make sure that the path to nasm.exe is
      correct (e.g. have NASM=nasm and nasm.exe on the PATH);
    - When building the x64 library on Windows x64, add
      --build=x86_64-w64-mingw32 to the configure line. When building the x64
      library on Windows x86, add --build=i686-pc-mingw32 and
      --host=x86_64-w64-mingw32.
    - If a script outputs errors mentioning \r, it may need dos2unix conversion.

2. x264

- Windows

Download yasm for Windows (32-bit or 64-bit) at
http://www.tortall.net/projects/yasm/wiki/Download and make it available in the
PATH.

When building the x64 library on Windows x86, add --host=x86_64-w64-mingw32 to
the configure line.

./configure --enable-win32thread

- FreeBSD

patch -Np1 -i x264-01-freebsd.patch
./configure --enable-pic

- Linux, Mac OS X

./configure --enable-pic

- For android
NDK_BASE=/../android-ndk-r8c
./configure --enable-pic --host=arm-linux --disable-asm \
    --sysroot="$NDK_BASE/platforms/android-9/arch-arm/" \
    --cross-prefix=$NDK_BASE/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-

3. ffmpeg

Apply the following to libavcodec/Makefile
-OBJS-$(CONFIG_LIBMP3LAME_ENCODER)         += libmp3lame.o mpegaudiodecheader.o \
+OBJS-$(CONFIG_LIBMP3LAME_ENCODER)         += libmp3lame.o mpegaudiodecheader.o mpegaudiodata.o \

./configure \
  --disable-shared --enable-static --shlibdir=. \
  --disable-debug \
  --disable-everything --disable-network \
  --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver \
  --enable-libmp3lame --enable-encoder=libmp3lame \
  --enable-decoder=mjpeg --enable-parser=mjpeg \
  --enable-decoder=h263 --enable-encoder=h263p --enable-parser=h263 \
  --enable-libx264 --enable-gpl \
  --enable-decoder=h264 --enable-encoder=libx264 --enable-parser=h264 \
  --enable-filter=hflip --enable-filter=scale --enable-filter=nullsink \
  --extra-cflags="-I$MP3LAME_HOME/include -I$X264_HOME" \
  --extra-ldflags="-L$MP3LAME_HOME/libmp3lame -L$MP3LAME_HOME/libmp3lame/.libs -L$X264_HOME"

- Windows

x86:
Add the following to the configure line:
--target-os=mingw32 --enable-memalign-hack --disable-pthreads --enable-w32threads

x64:
Add the following to the configure line used for x86:
--arch=amd64 --enable-cross-compile

- FreeBSD, Linux

Add the following to the configure line:
--enable-pic --enable-pthreads --enable-decoder=mjpeg --enable-parser=mjpeg

- Mac OS X

Add the following to the configure line:
--enable-pic --enable-pthreads --enable-memalign-hack

- For android remove lame and add
  --arch=arm \
  --target-os=linux \
  --enable-runtime-cpudetect \
  --sysroot="$NDK_BASE/platforms/android-9/arch-arm/" \
  --cross-prefix=$NDK_BASE/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-

5. jnffmpeg

Define the environment variable JAVA_HOME so that the JNI headers can be found.
Change the current directory to libjitsi/ and run "ant ffmpeg" passing it
values for the ffmpeg, lame and x264 properties which specify the paths
to the homes of the development trees of the respective libraries.

For creating universal libraries for Mac OS X see the instructions in src/native/build.xml
