-
Notifications
You must be signed in to change notification settings - Fork 178
External libraries integration
It is possible to extend the script with a functionality that downloads and builds an additional library that will be integrated into FFmpeg's result binaries.
An actual list of libraries that are supported can be found in the FFmpeg's configure script near the 'External library support' section.
To add a new library to the compilation process several steps should be done:
In scripts/parse-arguments.sh file you need to add a block similar to this:
--enable-libdav1d)
EXTERNAL_LIBRARIES+=( "libdav1d" )
shift
;;
The actual value of the --enable-xxx has to be picked from the FFmpeg's configure script arguments list.
The libdav1d in this case is a name of a library and it is used in several other places. Stay tuned.
They both have to be placed in a directory with the name of an external library, like scripts/libdav1d, for example.
The idea is that when any of those scripts is executed, it can consider certain variables available that may be used during downloading/building.
This script has to download the source code of an appropriate library. By any means - that is up to this script. Currently all of existed scripts download an archive with the source code of a library of a certain version. The FFmpeg's source code can come from Git repository also.
This script also need to check if the source code is already downloaded to eliminate downloading it each time the script is executed.
This script is executed inside a directory where the source code of this library can be placed. Like sources/libdav1d for libdav1d library. Inside the script is free to create subdirectories and write the actual source code there. This possibility is done to easily switch between different versions of a library.
After the script knows that the source code is available, it has to export a variable with the absolute path to the actual source code. Like .../sources/libdav1d/dav1d-0.5.2
for the 0.5.2 version of the libdav1d. If it isn't done, the .../sources/libdav1d
will be considered such a directory. The name of this variable to export has to follow this pattern: SOURCES_DIR_${library_name}, so for libdav1d it has to be strictly SOURCES_DIR_libdav1d.
Here are examples of how this script can be implemented: