This directory contains files used in Goanna builds from FFmpeg
(http://ffmpeg.org). The current files are from FFmpeg as of
Release n6.1.2

All source files match their path from the library's source archive.
The FFmpeg project recommends to use the branch tip, however we
usually stick with tagged releases.

Currently, we only use the VP8 and VP9 portions of the library. If this changes,
configuration files will need to be updated.

This library only uses a small part of `ffmpeg`. To update the source tree, run:
> rsync -av --existing /path/to/ffmpeg-upstream/ /UXP/media/ffvpx/

Compilation will reveal if any files are missing.

After updating the source tree, make sure the files:
libavcodec/codec_list.c
libavcodec/bsf_list.c
libavcodec/parser_list.c

include conditional compilation directives, by probably reverting them (or
reverting and adjusting them if new codecs are added).

If a new major version of FFmpeg is being imported into the tree, it's necessary to add the new
FFmpeg headers in dom/media/platforms/ffmpeg/ffmpegxx where xx is the new FFmpeg major version
number, and to modify the dynamic linker wrapper in
dom/media/platforms/dom/media/platforms/ffmpeg/{FFmpegLibWrapper.cpp,FFmpegRungtimeLinker.cpp}
with the new version and API.

Configuration files should be generated as follows using the configure script:
./configure --disable-all --enable-avcodec --enable-decoder=vp8,vp9, --enable-parser=vp8,vp9 \
              --disable-static --enable-shared --disable-autodetect

config_components.h is common to all platforms, and then a specific config file is included,
based on the platform and architecture. These need to be regenerated on all OSes.

config_unix64.{h|asm}:
add to configure command above: --disable-iconv --disable-linux-perf
replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0

config_unix32.h:
add to configure command above: --disable-iconv --disable-linux-perf --disable-asm --disable-x86asm --cc='-m32'
replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0/ and s/HAVE_MEMALIGN 1/HAVE_MEMALIGN 0/ and s/HAVE_POSIX_MEMALIGN 1/HAVE_POSIX_MEMALIGN 0/

Those files shouldn't be Linux-specific, and are included in other *nix platforms as well
(e.g. various BSDs), hence the --disable-linux-perf added above.

config_win{32|64}.{h|asm}:
add to configure command above: --enable-w32threads --toolchain=msvc

Then run the following command on all config* files to avoid redefined macros:
> sed -i -E '/HAVE_(MALLOC_H|ARC4RANDOM|LOCALTIME_R|MEMALIGN|POSIX_MEMALIGN)/d' config.*

Missing files need to be added, and the patch to rename `time.h` to `fftime.h` might need to be reaplied
or extended to other files including `time.h`. The issue being that it's included instead of the system
header, causing all sorts of issues.

`moz.build` files might need to be modified as well, in light of compilation and/or link errors.

There are going to be a lot of changes in terms of symbols exported. Adjust libavutil/avutil.symbols and
libavcodec/avcodec.symbols by removing and adding symbols until the build passes.

========================

After updating, apply patches:
flac-alloc-failure.patch fix leak in flac decoder in case of alloc failure
