Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 194 additions & 0 deletions THIRD_PARTY_NOTICES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ Components
23. Microsoft Visual C++ Runtime
24. libjpeg-turbo
25. LodePNG
26. Opus (libopus)
27. libogg
28. libvorbis
29. dr_libs (dr_wav, dr_flac, dr_mp3)

==============================================================================
1. FFmpeg
Expand Down Expand Up @@ -884,6 +888,196 @@ freely, subject to the following restrictions:
3. This notice may not be removed or altered from any source
distribution.

==============================================================================
26. Opus (libopus)
==============================================================================

License: BSD 3-Clause License
Homepage: https://opus-codec.org
Used in: Compiled into flm (Opus audio decoding), libopus 1.6.1 built as a static
library.

Copyright 2001-2023 Xiph.Org, Skype Limited, Octasic,
Jean-Marc Valin, Timothy B. Terriberry,
CSIRO, Gregory Maxwell, Mark Borgerding,
Erik de Castro Lopo, Mozilla, Amazon

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

- Neither the name of Internet Society, IETF or IETF Trust, nor the
names of specific contributors, may be used to endorse or promote
products derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Opus is subject to the royalty-free patent licenses which are
specified at:

Xiph.Org Foundation:
https://datatracker.ietf.org/ipr/1524/

Microsoft Corporation:
https://datatracker.ietf.org/ipr/1914/

Broadcom Corporation:
https://datatracker.ietf.org/ipr/1526/

==============================================================================
27. libogg
==============================================================================

License: BSD 3-Clause License
Homepage: https://xiph.org/ogg/
Used in: Compiled into flm (Ogg container for Vorbis decoding), libogg 1.3.6 built
as a static library.

Copyright (c) 2002, Xiph.org Foundation

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

==============================================================================
28. libvorbis
==============================================================================

License: BSD 3-Clause License
Homepage: https://xiph.org/vorbis/
Used in: Compiled into flm (Ogg Vorbis audio decoding), libvorbis/libvorbisfile
1.3.7 built as static libraries.

Copyright (c) 2002-2020 Xiph.org Foundation

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

==============================================================================
29. dr_libs (dr_wav, dr_flac, dr_mp3)
==============================================================================

License: Public Domain (Unlicense) or MIT No Attribution (MIT-0), at the
licensee's choice
Homepage: https://github.com/mackron/dr_libs
Used in: Compiled into flm (WAV/AIFF, FLAC and MP3 audio decoding), vendored in
src/include/dr_libs from commit dfe83776 (2026-08-31), which includes
hardening fixes made after the dr_wav 0.14.5, dr_flac 0.13.3 and
dr_mp3 0.7.3 releases.

This software is available as a choice of the following licenses. Choose
whichever you prefer.

===============================================================================
ALTERNATIVE 1 - Public Domain (www.unlicense.org)
===============================================================================
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this
software dedicate any and all copyright interest in the software to the public
domain. We make this dedication for the benefit of the public at large and to
the detriment of our heirs and successors. We intend this dedication to be an
overt act of relinquishment in perpetuity of all present and future rights to
this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org/>

===============================================================================
ALTERNATIVE 2 - MIT No Attribution
===============================================================================
Copyright 2020 David Reid

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

==============================================================================
Full license texts
==============================================================================
Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/../third_party/tokenizers-cpp

# JPEG/PNG decoding for ImageReader: static libjpeg-turbo + vendored lodepng.
include(${CMAKE_SOURCE_DIR}/cmake/FlmImageCodecs.cmake)
# Audio decoding for AudioReader: static libopus/libogg/libvorbis + vendored dr_libs.
include(${CMAKE_SOURCE_DIR}/cmake/FlmAudioCodecs.cmake)

# ———————————————————————————————————————————————
# Gather your sources
Expand Down Expand Up @@ -749,7 +751,7 @@ endif()
target_link_libraries(flm PRIVATE
tokenizers_cpp
)
target_link_libraries(flm PRIVATE flm_image_codecs)
target_link_libraries(flm PRIVATE flm_image_codecs flm_audio_codecs)

if(WIN32)
target_link_libraries(flm PRIVATE
Expand Down
100 changes: 100 additions & 0 deletions src/cmake/FlmAudioCodecs.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Audio codecs for AudioReader (src/common/audio/audio_decoder.cpp).
#
# - libopus 1.6.1, libogg 1.3.6 and libvorbis 1.3.7 (all BSD-3-Clause), built
# as static libraries through ExternalProject from pinned release tarballs.
# libvorbis finds libogg through the shared install prefix.
# - dr_wav/dr_flac/dr_mp3 (public domain or MIT-0), vendored header-only in
# include/dr_libs and compiled into audio_decoder.cpp.
#
# Defines the INTERFACE target flm_audio_codecs. Link it from anything that
# compiles audio_decoder.cpp.
include_guard(GLOBAL)
include(ExternalProject)

set(_flm_audio_prefix ${CMAKE_BINARY_DIR}/audio-codecs)
if(MSVC)
set(_flm_lib_prefix "")
set(_flm_lib_suffix ".lib")
else()
set(_flm_lib_prefix "lib")
set(_flm_lib_suffix ".a")
endif()
foreach(_lib opus ogg vorbis vorbisfile)
set(_flm_${_lib}_lib ${_flm_audio_prefix}/lib/${_flm_lib_prefix}${_lib}${_flm_lib_suffix})
endforeach()

set(_flm_audio_args
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_PREFIX_PATH=${_flm_audio_prefix}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DBUILD_SHARED_LIBS=OFF
-DBUILD_TESTING=OFF)
if(CMAKE_C_COMPILER)
list(APPEND _flm_audio_args -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER})
endif()

# Short working directories keep MSBuild under Windows' 260-char MAX_PATH on
# CI runners with deep work directories (see FlmImageCodecs.cmake). `urls` is
# a list of mirrors tried in order; the SHA-256 pins the exact tarball.
function(_flm_audio_project name urls sha256 byproduct)
set(_work ${CMAKE_BINARY_DIR}/ac/${name})
ExternalProject_Add(flm_${name}
URL ${urls}
URL_HASH SHA256=${sha256}
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
EXCLUDE_FROM_ALL TRUE
PREFIX ${_work}
DOWNLOAD_DIR ${_work}/dl
SOURCE_DIR ${_work}/s
BINARY_DIR ${_work}/b
STAMP_DIR ${_work}/st
TMP_DIR ${_work}/t
INSTALL_DIR ${_flm_audio_prefix}
CMAKE_ARGS ${_flm_audio_args} ${ARGN}
BUILD_BYPRODUCTS ${byproduct})
endfunction()

_flm_audio_project(opus
"https://downloads.xiph.org/releases/opus/opus-1.6.1.tar.gz;https://ftp.osuosl.org/pub/xiph/releases/opus/opus-1.6.1.tar.gz"
6ffcb593207be92584df15b32466ed64bbec99109f007c82205f0194572411a1
${_flm_opus_lib}
-DOPUS_BUILD_PROGRAMS=OFF
-DOPUS_INSTALL_PKG_CONFIG_MODULE=OFF
-DOPUS_INSTALL_CMAKE_CONFIG_MODULE=OFF)
_flm_audio_project(ogg
"https://github.com/xiph/ogg/releases/download/v1.3.6/libogg-1.3.6.tar.gz;https://downloads.xiph.org/releases/ogg/libogg-1.3.6.tar.gz;https://ftp.osuosl.org/pub/xiph/releases/ogg/libogg-1.3.6.tar.gz"
83e6704730683d004d20e21b8f7f55dcb3383cdf84c0daedf30bde175f774638
${_flm_ogg_lib}
-DINSTALL_DOCS=OFF)
# libvorbis 1.3.7 declares cmake_minimum_required(VERSION 2.8.12), which
# CMake 4 rejects; let it configure under 3.5 policies (older CMake ignores
# this variable).
_flm_audio_project(vorbis
"https://github.com/xiph/vorbis/releases/download/v1.3.7/libvorbis-1.3.7.tar.gz;https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.gz;https://ftp.osuosl.org/pub/xiph/releases/vorbis/libvorbis-1.3.7.tar.gz"
0e982409a9c3fc82ee06e08205b1355e5c6aa4c36bca58146ef399621b0ce5ab
"${_flm_vorbis_lib};${_flm_vorbisfile_lib}"
-DCMAKE_POLICY_VERSION_MINIMUM=3.5)
ExternalProject_Add_StepDependencies(flm_vorbis configure flm_ogg)

# The include directory must exist at configure time for the imported targets.
file(MAKE_DIRECTORY ${_flm_audio_prefix}/include)
add_library(flm_audio_codecs INTERFACE)
foreach(_lib vorbisfile vorbis ogg opus)
add_library(flm_${_lib}_imported STATIC IMPORTED GLOBAL)
set_target_properties(flm_${_lib}_imported PROPERTIES
IMPORTED_LOCATION ${_flm_${_lib}_lib}
INTERFACE_INCLUDE_DIRECTORIES ${_flm_audio_prefix}/include)
target_link_libraries(flm_audio_codecs INTERFACE flm_${_lib}_imported)
endforeach()
add_dependencies(flm_vorbisfile_imported flm_vorbis)
add_dependencies(flm_vorbis_imported flm_vorbis)
add_dependencies(flm_ogg_imported flm_ogg)
add_dependencies(flm_opus_imported flm_opus)

# The decoders do wrapping integer arithmetic on corrupt input (e.g. FLAC LPC
# prediction); make signed overflow defined there instead of undefined.
get_filename_component(_flm_audio_decoder_src ${CMAKE_CURRENT_LIST_DIR}/../common/audio/audio_decoder.cpp ABSOLUTE)
set_source_files_properties(${_flm_audio_decoder_src} PROPERTIES
COMPILE_OPTIONS "$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-fwrapv>")
Loading
Loading