Merge pull request #1241 from marauder2k9-torque/change-to-use-libsndfile

Change to use libsndfile
This commit is contained in:
Brian Roberts 2024-03-26 14:23:09 -05:00 committed by GitHub
commit 3bc50f71a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1964 changed files with 431632 additions and 21898 deletions

View file

@ -258,10 +258,32 @@ if(TORQUE_SFX_OPENAL)
mark_as_advanced(AUDIOUNIT_INCLUDE_DIR)
endif()
advanced_option(INSTALL_DOCS "" OFF)
advanced_option(INSTALL_PKG_CONFIG_MODULE "" OFF)
advanced_option(INSTALL_CMAKE_PACKAGE_MODULE "" OFF)
advanced_option(BUILD_TESTING "" OFF)
add_subdirectory(libogg ${TORQUE_LIB_TARG_DIRECTORY}/libogg )
add_subdirectory(libvorbis ${TORQUE_LIB_TARG_DIRECTORY}/libvorbis EXCLUDE_FROM_ALL)
add_subdirectory(libogg ${TORQUE_LIB_TARG_DIRECTORY}/libogg EXCLUDE_FROM_ALL)
advanced_option(INSTALL_PKGCONFIG_MODULES "" OFF)
advanced_option(INSTALL_CMAKE_CONFIG_MODULE "" OFF)
add_subdirectory(flac ${TORQUE_LIB_TARG_DIRECTORY}/flac EXCLUDE_FROM_ALL)
advanced_option(INSTALL_DOCS "" OFF)
advanced_option(OPUS_INSTALL_PKG_CONFIG_MODULE "" OFF)
advanced_option(OPUS_INSTALL_CMAKE_CONFIG_MODULE "" OFF)
add_subdirectory(opus ${TORQUE_LIB_TARG_DIRECTORY}/opus EXCLUDE_FROM_ALL)
add_subdirectory(libtheora ${TORQUE_LIB_TARG_DIRECTORY}/libtheora EXCLUDE_FROM_ALL)
advanced_option(BUILD_PROGRAMS "" OFF)
advanced_option(BUILD_EXAMPLES "" OFF)
advanced_option(ENABLE_CPACK "" OFF)
advanced_option(ENABLE_PACKAGE_CONFIG "" OFF)
advanced_option(INSTALL_PKGCONFIG_MODULE "" OFF)
advanced_option(ENABLE_MPEG "" OFF)
advanced_option(ENABLE_EXPERIMENTAL "" OFF)
add_subdirectory(libsndfile ${TORQUE_LIB_TARG_DIRECTORY}/libsndfile EXCLUDE_FROM_ALL)
if(TORQUE_TESTING)
add_subdirectory(gtest ${TORQUE_LIB_TARG_DIRECTORY}/gtest EXCLUDE_FROM_ALL)
endif()

View file

@ -0,0 +1,21 @@
BasedOnStyle: WebKit
AlignAfterOpenBracket: Align
AlignEscapedNewlines: DontAlign
AlignOperands: true
BraceWrapping:
AfterFunction: true
BeforeElse: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: true
BreakConstructorInitializers: BeforeComma
DerivePointerAlignment: false
IndentCaseLabels: true
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PointerAlignment: Right
SortIncludes: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeParens: Never
TabWidth: 4
UseTab: ForContinuationAndIndentation

View file

@ -0,0 +1,134 @@
name: GitHub Actions
on:
push:
pull_request:
jobs:
build:
strategy:
matrix:
include:
- name: ubuntu-latest-clang-autotools
os: ubuntu-latest
cc: clang
cxx: clang++
build-system: autotools
configure-opts: ''
- name: ubuntu-latest-gcc-cmake
os: ubuntu-latest
cc: gcc
cxx: g++
build-system: cmake
configure-opts: ''
- name: ubuntu-latest-clang-cmake
os: ubuntu-latest
cc: clang
cxx: clang++
build-system: cmake
configure-opts: ''
- name: macos-latest-clang-autotools
os: macos-latest
cc: clang
cxx: clang++
build-system: autotools
configure-opts: ''
- name: macos-latest-clang-cmake
os: macos-latest
cc: clang
cxx: clang++
build-system: cmake
configure-opts: ''
- name: windows-latest-cmake
os: windows-latest
build-system: cmake
configure-opts: ''
- name: windows-latest-cmake-shared
os: windows-latest
build-system: cmake
configure-opts: '-DBUILD_SHARED_LIBS=ON'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
if: startsWith(matrix.build-system,'cmake')
with:
repository: xiph/ogg
path: ./ogg
- name: Install MacOS dependencies
if: startsWith(matrix.os,'macos') && !startsWith(matrix.build-system,'cmake')
run: |
brew update
brew install automake pkg-config libogg
- name: Install Linux dependencies
if: startsWith(matrix.os,'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y libtool-bin libogg-dev
- name: Install Windows dependencies
if: startsWith(matrix.os,'windows')
run: |
choco install busybox
- name: Build with Autotools
if: startsWith(matrix.build-system,'autotools')
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: |
./autogen.sh
./configure ${{ matrix.configure-opts }}
make
make check
- name: Prepare CMake build directory
if: startsWith(matrix.build-system,'cmake')
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: mkdir cmake-build
- name: CMake generator
if: startsWith(matrix.build-system,'cmake')
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
working-directory: cmake-build
run: cmake .. -DCMAKE_BUILD_TYPE=Release -DINSTALL_MANPAGES=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON ${{ matrix.configure-opts }} -DCMAKE_FIND_FRAMEWORK=NEVER
- name: CMake build
if: startsWith(matrix.build-system,'cmake')
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
working-directory: cmake-build
run: cmake --build . --config Release
- name: CMake test
if: startsWith(matrix.build-system,'cmake')
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
working-directory: cmake-build
run: ctest -V -C Release
- name: Upload logs on failure
uses: actions/upload-artifact@v2
if: failure()
with:
name: flac-${{ github.sha }}-${{ github.run_id }}-logs
path: |
./**/*.log
./**/out*.meta

View file

@ -0,0 +1,36 @@
name: CIFuzz
on:
pull_request:
push:
branches:
- master
- 1.3.x
jobs:
Fuzzing:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sanitizer: [address, undefined, memory]
steps:
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'flac'
language: c++
sanitizer: ${{ matrix.sanitizer }}
- name: Run Fuzzers (${{ matrix.sanitizer }})
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'flac'
language: c++
fuzz-seconds: 7200
sanitizer: ${{ matrix.sanitizer }}
- name: Upload Crash
uses: actions/upload-artifact@v1
if: failure() && steps.build.outcome == 'success'
with:
name: ${{ matrix.sanitizer }}-artifacts
path: ./out/artifacts

View file

@ -0,0 +1,58 @@
name: Autotools distcheck and ABI check
on:
push:
branches:
- main
- master
pull_request:
jobs:
distcheck:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: ietf-wg-cellar/flac-test-files
path: ./test-files
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libtool-bin libogg-dev doxygen libxml2-utils w3c-sgml-lib pandoc abi-compliance-checker
- name: Build with Autotools
run: |
./autogen.sh
./configure
- name: Build and check source package
run: make distcheck
- name: Check binary compatibility
run: |
make
unxz --keep test/abi/abi-libFLAC-1.4.0.dump.xz
unxz --keep test/abi/abi-libFLAC++-1.4.0.dump.xz
abi-compliance-checker -l flac -old test/abi/abi-libFLAC-1.4.0.dump -new test/abi/abi-descriptor-libFLAC-1.4.3.xml
abi-compliance-checker -l flac++ -old test/abi/abi-libFLAC++-1.4.0.dump -new test/abi/abi-descriptor-libFLAC++-1.4.3.xml
- name: Check with flac test files
run: ./src/flac/flac -t test-files/subset/*.flac test-files/uncommon/0[5-9]*.flac test-files/uncommon/10*.flac
- name: Upload ABI compliance reports
uses: actions/upload-artifact@v3
with:
name: flac-${{ github.sha }}-${{ github.run_id }}-compat
path: |
./compat_reports
- name: Upload logs on failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: flac-${{ github.sha }}-${{ github.run_id }}-logs
path: |
./flac-**/**/*.log

View file

@ -0,0 +1,50 @@
name: GitHub Actions for specific options
on:
push:
pull_request:
jobs:
build:
strategy:
matrix:
include:
- name: 32-bit-words
cppflags: ''
configure-opts: --disable-64-bit-words
- name: integer-only-library
cppflags: '-DFLAC__INTEGER_ONLY_LIBRARY'
configure-opts: ''
- name: no-asm
cppflags: ''
configure-opts: --disable-asm-optimizations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libtool-bin libogg-dev
- name: Build and run tests
env:
CPPFLAGS: ${{ matrix.cppflags }}
run: |
./autogen.sh
./configure --disable-thorough-tests ${{ matrix.configure-opts }}
make
make check
- name: Upload logs on failure
uses: actions/upload-artifact@v2
if: failure()
with:
name: flac-${{ github.sha }}-${{ github.run_id }}-logs
path: |
./**/*.log
./**/out*.meta

102
Engine/lib/flac/.gitignore vendored Normal file
View file

@ -0,0 +1,102 @@
*.a
*.la
*.lo
*.o
*.so
*.dll
*.dylib
*.exe
.deps
.libs
aclocal.m4
ar-lib
autom4te.cache/
compile
config.guess
config.h
config.h.in
config.log
config.rpath
config.status
config.sub
configure
depcomp
doc/Doxyfile
doc/FLAC.tag
doc/api/
examples/c/decode/file/example_c_decode_file
examples/c/encode/file/example_c_encode_file
examples/cpp/decode/file/example_cpp_decode_file
examples/cpp/encode/file/example_cpp_encode_file
install-sh
libtool
libtool-disable-static
ltmain.sh
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
man/flac.1
man/metaflac.1
missing
objs/debug
objs/release
src/flac/flac
src/libFLAC++/flac++.pc
src/libFLAC/flac.pc
src/metaflac/metaflac
src/share/getopt/libgetopt.a
src/test_grabbag/cuesheet/test_cuesheet
src/test_grabbag/picture/test_picture
src/test_libFLAC++/test_libFLAC++
src/test_libFLAC/test_libFLAC
src/test_seeking/test_seeking
src/test_streams/test_streams
stamp-h1
test/*.aiff
test/*.cmp
test/*.cue
test/*.flac
test/*.log
test/*.oga
test/*.raw
test/*.rf64
test/*.w64
test/*.wav
test/common.sh
test/cuesheet.diff
test/cuesheet.log
test/metaflac-test-files/out.meta
test/metaflac.flac
test/picture.diff
test/picture.log
.dirstamp
microbench/benchmark_residual
/ogg/
oss-fuzz/fuzzer_decoder
oss-fuzz/fuzzer_seek
oss-fuzz/fuzzer_metadata
oss-fuzz/fuzzer_encoder
oss-fuzz/fuzzer_encoder_v2
oss-fuzz/fuzzer_reencoder
oss-fuzz/fuzzer_tool_flac
oss-fuzz/fuzzer_tool_metaflac
/*[Bb]uild*/
/out/
CMakeSettings.json
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
Makefile.in
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
/.vs*/

View file

@ -0,0 +1,36 @@
default:
tags:
- docker
# Image from https://hub.docker.com/_/gcc/ based on Debian
image: gcc:9
autotools:
stage: build
before_script:
- apt-get update &&
apt-get install -y libogg-dev
libtool-bin gettext zip
doxygen graphviz pandoc
# Create an unpriviledged user, required for tests.
- adduser --disabled-password --gecos "Gitlab CI" flac
script:
- ./autogen.sh
- ./configure
- make
- su -c 'make distcheck' flac
cmake:
stage: build
before_script:
- apt-get update &&
apt-get install -y libogg-dev
cmake ninja-build
doxygen graphviz pandoc
# Create an unpriviledged user, required for tests.
- adduser --disabled-password --gecos "Gitlab CI" flac
script:
- mkdir _build
- cmake -S . -B _build -G "Ninja" -DCMAKE_BUILD_TYPE=Release
- chown -R flac .
- su -c 'cmake --build _build' flac
- su -c 'cd _build && ctest -V' flac

View file

@ -0,0 +1,61 @@
language: c
jobs:
include:
- os: linux
dist: focal
arch: arm64
compiler: gcc
env: BUILD_SYSTEM="cmake" CONFIGURE_OPTS=-DWITH_ASM=0
- os: linux
dist: focal
arch: arm64
compiler: gcc
env: BUILD_SYSTEM="cmake" CONFIGURE_OPTS=
- os: linux
dist: focal
arch: arm64
compiler: gcc
env: BUILD_SYSTEM="autotools" CONFIGURE_OPTS=
# - os: linux
# dist: focal
# arch: arm64
# compiler: clang
# env: BUILD_SYSTEM="cmake" CONFIGURE_OPTS=-DWITH_STACK_PROTECTOR=OFF # Clang on focal arm64 seems broken, can't find a way to reproduce this on my machine
- os: linux
dist: focal
arch: arm64
compiler: gcc
env: BUILD_SYSTEM="cmake" CONFIGURE_OPTS=-DENABLE_64_BIT_WORDS=OFF
- os: linux
dist: focal
arch: ppc64le
compiler: gcc
env: BUILD_SYSTEM="cmake" CONFIGURE_OPTS=-DWITH_ASM=0
- os: linux
dist: focal
arch: ppc64le
compiler: gcc
env: BUILD_SYSTEM="cmake" CONFIGURE_OPTS=
- os: linux
dist: focal
arch: ppc64le
compiler: gcc
env: BUILD_SYSTEM="autotools" CONFIGURE_OPTS=
- os: linux
dist: focal
arch: ppc64le
compiler: clang
env: BUILD_SYSTEM="cmake" CONFIGURE_OPTS=
- os: linux
dist: focal
arch: ppc64le
compiler: gcc
env: BUILD_SYSTEM="cmake" CONFIGURE_OPTS=-DENABLE_64_BIT_WORDS=OFF
install:
- if [ $TRAVIS_OS_NAME = linux ]; then sudo apt-get -y install libtool-bin libogg-dev; fi
script:
- if [[ "${BUILD_SYSTEM}" == "autotools" ]]; then ./autogen.sh && ./configure $CONFIGURE_OPTS && make && make check; fi
- if [[ "${BUILD_SYSTEM}" == "cmake" ]]; then mkdir cmake-build && cd cmake-build && cmake .. -DCMAKE_BUILD_TYPE=Release -DINSTALL_MANPAGES=OFF $CONFIGURE_OPTS && cat config.h && cmake --build . && travis_wait 30 ctest --output-on-failure; fi

60
Engine/lib/flac/AUTHORS Normal file
View file

@ -0,0 +1,60 @@
/* FLAC - Free Lossless Audio Codec
* Copyright (C) 2001-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This file is part the FLAC project. FLAC is comprised of several
* components distributed under different licenses. The codec libraries
* are distributed under Xiph.Org's BSD-like license (see the file
* COPYING.Xiph in this distribution). All other programs, libraries, and
* plugins are distributed under the GPL (see COPYING.GPL). The documentation
* is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
* FLAC distribution contains at the top the terms under which it may be
* distributed.
*
* Since this particular file is relevant to all components of FLAC,
* it may be distributed under the Xiph.Org license, which is the least
* restrictive of those mentioned above. See the file COPYING.Xiph in this
* distribution.
*/
This file lists major contributors to the FLAC project. This list is not
exhaustive. For an exhaustive list, run the command `git shortlog -s` on
the git repo or visit https://gitlab.xiph.org/xiph/flac/-/graphs/master
For a complete list of contributions, run the command `git log` on the
git repo, visit https://github.com/xiph/flac/commits or visit
https://gitlab.xiph.org/xiph/flac/commits
Original author: Josh Coalson <jcoalson@users.sourceforge.net>
Maintainer 2012-2020: Erik de Castro Lopo <erikd@mega-nerd.com>
Maintainer from 2022: Martijn van Beurden <mvanb1@gmail.com>
Website : https://www.xiph.org/flac/
Other major contributors and their contributions:
"lvqcl" <lvqcl@users.sourceforge.net>
* Visual Studio build system.
* Optimisations in the encoder and decoder.
"Janne Hyvärinen" <cse@sci.fi>
* Visual Studio build system.
* Unicode handling on Windows.
"Andrey Astafiev" <andrei@tvcell.ru>
* Russian translation of the HTML documentation
"Miroslav Lichvar" <lichvarm@phoenix.inf.upol.cz>
* IA-32 assembly versions of several libFLAC routines
"Brady Patterson" <bpat@users.sourceforge.net>
* AIFF file support, PPC assembly versions of libFLAC routines
"Daisuke Shimamura" <Daisuke_Shimamura@nifty.com>
* i18n support in the XMMS plugin
"X-Fixer" <x-fixer@narod.ru>
* Configuration system, tag editing, and file info in the Winamp2 plugin
"Matt Zimmerman" <mdz@debian.org>
* Libtool/autoconf/automake make system, flac man page

View file

@ -0,0 +1,992 @@
# Changelog
This changelog is not exhaustive, review [the git commit log](https://github.com/xiph/flac/commits) for an exhaustive list of changes.
## FLAC 1.4.3 (23-Jun-2023)
As there have been additions to the libFLAC interfaces, the libFLAC version number is incremented to 13. The libFLAC++ version number stays at 10.
* General
* All PowerPC-specific code has been removed, as it turned out those improvements didn't actually improve anything
* Large improvements in encoder speed for all presets. The largest change is for the fastest presets and for 24-bit and 32-bit inputs.
* Small improvement in decoder speed for BMI2-capable CPUs
* Various documentation fixes and cleanups (Mark Grassi, Jake Schmidt)
* Various fixes (Ozkan Sezer, Zhipeng Xue, orbea, Sam James, Harish Mahendrakar)
* Fix building on Universal Windows Platform (Dmitry Kostjučenko)
* flac
* A lot of small fixes for bugs found by fuzzing
* Various improvements to the --keep-foreign-metadata and --keep-foreign-metadata-if-present options on decoding
* The output format (WAV/AIFF/RF64 etc.) is now automatically selected based on what kind of foreign metadata is stored
* Decoded file is checked afterwards, to see whether stored foreign format data agrees with FLAC audio properties
* AIFF-C sowt data can now be restored
* Add --force-legacy-wave-format option, to decode to WAV with WAVEFORMATPCM where WAVE_FORMAT_EXTENSIBLE would be more appropriate
* Add --force-aiff-c-none-format and --force-aiff-c-sowt-format to decode to AIFF-C
* The storage of WAVEFORMATEXTENSIBLE_CHANNEL_MASK is no longer restricted to known channel orderings
* Throw an error when WAV or AIFF files are over 4GiB in length and the --ignore-chunk-sizes option is not set
* Warn on testing files when ID3v2 tags are found
* Warn when data trails the audio data of a WAV/AIFF/RF64/W64 file
* Fix output file not being deleted after error on Windows
* Removal of the --sector--align option
* metaflac
* A lot of small fixes for bugs found by fuzzing
* Added options --append and --data-format, which makes it possible to copy metadata blocks from one FLAC file to another
* Added option --remove-all-tags-except
* Added option --show-all-tags (harridu, Martijn van Beurden)
* libFLAC
* No longer write seektables to Ogg, even when specifically asked for. Seektables in Ogg are not defined
* Add functions FLAC__metadata_object_set_raw and FLAC__metadata_object_get_raw to convert between blob and FLAC__StreamMetadata
* Build system
* Autoconf (configure)
* The option --enable-64-bit-words is now on by default
* CMake
* The option ENABLE_64_BIT_WORDS is now on by default
* Testing/validation
* Fuzzers were added for the flac and metaflac command line tools
* Fuzzer coverage was improved
## FLAC 1.4.2 (22-Oct-2022)
Once again, this release only has a few changes. A problem with FLAC playback in GStreamer (and possibly other libFLAC users) was the reason for the short time since the last release
* General
* Remove xmms plugin (Martijn van Beurden, TokyoBlackHole)
* Remove all pure assembler, removing build dependency on nasm
* Made console output more uniform across different platforms and CPUs
* Improve ability to tune compile for a certain system (for example with -march=native) when combining with --disable-asm-optimizations: plain C functions can now be better optimized
* Build system
* Default CFLAGS are now prepended instead of dropped when user CFLAGS are set
* -msse2 is no longer added by default (was only applicable to x86)
* Fix cross-compiling and out-of-tree building when pandoc and doxygen are not available
* Fix issue with Clang not compiling functions with intrinsics
* Fix detection of bswap intrinsics (Ozkan Sezer)
* Improve search for libssp on MinGW (Ozkan Sezer, Martijn van Beurden)
* libFLAC
* Fix issue when the libFLAC user seeks in a file instead of libFLAC itself
## FLAC 1.4.1 (22-Sep-2022)
This release only has a few changes. It was triggered by a problem in the 1.4.0 tarball: man pages were empty and api documentation missing
* CMake fixes (Tomasz Kłoczko)
* Add checks that man pages and api docs end up in tarball
* Enable installation of prebuilt man pages and api docs
* Fix compiler warnings (Johannes Kauffmann, Ozkan Sezer)
* Fix format specifier (manxorist)
* Enable building on Universal Windows Platform (Steve Lhomme)
* Fix versioning from git
## FLAC 1.4.0 (09-Sep-2022)
As there have been changes to the library interfaces, the libFLAC version number is incremented to 12, the libFLAC++ version number is incremented to 10. As some changes were breaking, the version age numbers (see [libtool versioning](https://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning)) have been reset to 0. For more details on the changes to the API, see the [porting guide](https://xiph.org/flac/api/group__porting__1__3__4__to__1__4__0.html).
The XMMS plugin and 'common' plugin code (used only by the XMMS plugin) are deprecated, they will be removed in a future release.
* General:
* It is now possible to limit the minimum bitrate of a FLAC file generated by libFLAC and with the `flac` tool to 1 bit/sample. This function can be used to aid live streaming, for example for internet radio
* Encoding files with sample rates up to 1'048'575Hz is now possible. (Con Kolivas)
* Compression of preset -3 through -8 was slightly improved at the cost of a small decrease in encoding speed by increasing the precision with which autocorrelation was calculated (Martijn van Beurden)
* Encoding speed of preset -0, -1 and -2 was slightly improved
* Compression of presets -1 and -4 was slighly improved on certain material by changing the adaptive mid-side heuristics
* Speedups specifically targeting 64-bit ARMv8 devices using NEON were integrated (Ronen Gvili, Martijn van Beurden)
* Speedups for x86_64 CPUs having the FMA instruction set extention are added
* Encoding and decoding of 32-bit PCM is now possible
* (Ogg) FLAC format:
* The FLAC format document is being rewritten by the IETF CELLAR working group. The latest draft can be found on [https://datatracker.ietf.org/doc/draft-ietf-cellar-flac/](https://datatracker.ietf.org/doc/draft-ietf-cellar-flac/)
* The FLAC format document specifies no bounds for the residual. In other to match current decoder implementations, it is proposed to bound the residual to the range provided by a 32-bit int signed two's complement. This limit must be checked by FLAC encoders as to keep FLAC decoders free from the complexity of being to decode a residual exceeding a 32-bit int.
* There is now a set of files available to test whether a FLAC decoder implements the format correctly. This FLAC decoder testbench can be found at [https://github.com/ietf-wg-cellar/flac-test-files](https://github.com/ietf-wg-cellar/flac-test-files). Also, results of testing hard- and software can be found here at [https://wiki.hydrogenaud.io/index.php?title=FLAC_decoder_testbench](https://wiki.hydrogenaud.io/index.php?title=FLAC_decoder_testbench).
* flac:
* The option --limit-min-bitrate was added to aid streaming, see [github #264](https://github.com/xiph/flac/pull/264)
* The option --keep-foreign-metadata-if-present is added. This option works the same as --keep-foreign-metadata, but does return a warning instead of an error if no foreign metadata was found to store or restore
* The warning returned by the foreign metadata handling is now clearer in case a user tries to restore foreign metadata of the wrong type, for example decoding a FLAC file containing AIFF foreign metadata to a WAV file
* A problem when using the analyse function causing the first frame to have a wrong size and offset was fixed
* Fix bug where channel mask of a file is unintentionally reused when several files are processed with one command
* The order of compression-related commands is no longer important, i.e. -8ep gives the same result as -ep8. Previously, a compression level (like -8) would override a more specific setting (like -e or -p). This is no longer the case
* flac now checks the block-align property of WAV files to ensure non-standard WAV files (for which flac has no handling) are not mangled
* metaflac:
* (none)
* build system:
* MSVC and Makefile.lite build system files have been removed. Building with MSVC (Visual Studio) can be done by using CMake
* Various CMake improvements, especially for creating MSVC build files (Martijn van Beurden, martinRenou, CookiePLMonster, David Callu, Tyler Dunn, Cameron Cawley)
* Various fixes for MinGW (Martijn van Beurden, Cameron Cawley)
* Removed obsolete autotools macro's to silence warnings
* Fixes for FreeBSD PowerPC (pkubaj)
* Fixed some compiler warnings (Martijn van Beurden, Tyler Dunn)
* Fix building with uclibc (Fabrice Fontaine)
* testing/validation:
* Addition of new encoder fuzzer, adding fuzzing for 8, 24 and 32-bit inputs
* Addition of new decoder fuzzer, adding coverage of seeking code
* Addition of metadata fuzzer, adding coverage of metadata APIs
* Various improvements to fuzzers to improve code coverage, fuzzing speed and stability
* Many changes to test suite to improve cross-platform compatibility (Rosen Penev)
* Windows CI now also builds the whole test suite
* Clang-format file added (Rosen Penev)
* Add warning on using v141_xp platform toolset with /MT (Martijn van Beurden, Paul Sanders)
* libraries:
* Various seeking fixes (Martijn van Beurden, Robert Kausch)
* Various bugs fixed found by fuzzing
* On decoding, it is now checked whether residuals can be contained by a 32-bit int, preventing integer overflow
* Add check that samples supplied to libFLAC actually fall within the bps set
* Add checks when parsing metadata blocks to not allocate excessive amounts of memory and not overread
* Undocumented Windows-only utf8 functions are no longer exported to the DLL interface
* Removed all assembler and intrinsics code from the decoder to improve fuzzing, as they provided only a small speed benefit
* The bitwriter buffer is limited in size to 2^24 bytes, so it cannot write excessively large files. This is a backup in case another bug in this area creeps (back) in.
* The metadata iterations should now never return a vorbiscomment entry with NULL as an entry, now always at least an empty string is returned
* documentation:
* Removed html documentation and generate man pages from markdown
* Interface changes:
* libFLAC:
* Addition of FLAC__stream_encoder_set_limit_min_bitrate() and FLAC__stream_encoder_get_limit_min_bitrate(), see [github #264](https://github.com/xiph/flac/pull/264)
* get_client_data_from_decoder is renamed FLAC__get_decoder_client_data(), see [github #124](https://github.com/xiph/flac/pull/124)
* All API functions taking a filename as an argument now take UTF-8 filenames on Windows, and no longer accept filenames using the current codepage
* FLAC__Frame struct has changed: warmup samples are now stored in FLAC__int64 instead of FLAC__int32 types, and verbatim samples can now be stored in either FLAC__int32 or FLAC__int64 depending on whether samples fix the former or latter
* The FLAC__StreamMetadata struct now has a tag, so it can be forward declared
* libFLAC++:
* Addition of ::set_limit_min_bitrate() and ::get_limit_min_bitrate(), see [github #264](https://github.com/xiph/flac/pull/264)
* All API functions taking a filename as an argument now take UTF-8 filenames on Windows, and no longer accept filenames using the current codepage
* The ::FLAC__Frame struct has changed, see the libFLAC interface change.
## FLAC 1.3.4 (20-Feb-2022)
This release mostly fixes (security related) bugs. When building with MSVC, using CMake is preferred, see the README under "Building with CMake" for more information. Building with MSVC using solution files is deprecated and these files will be removed in the future. As there have been no changes to the library interfaces, the libFLAC version number remains 11, and libFLAC++ version number remains 9.
* General:
* Fix 12 decoder bugs found by oss-fuzz, including CVE-2020-0499 (erikd, Martijn van Beurden)
* Fix encoder bug CVE-2021-0561 (NeelkamalSemwal)
* Integrate oss-fuzzers (erikd, Guido Vranken)
* Seeking fixes (NeelkamalSemwal, Robert Kausch)
* Various fixes and improvements (Andrei Astafev, Rosen Penev, Håkan Kvist, oreo639, erikd, Tamás Zahola, Ulrik Mikaelsson, Tyler Dunn, tmkk)
* FLAC format:
* (none)
* Ogg FLAC format:
* (none)
* flac:
* Various fixes and improvements (Andrei Astafev, Martijn van Beurden)
* metaflac:
* (none)
* build system:
* CMake improvements (evpobr, Vitaliy Kirsanov, erikd, Ozkan Sezer, Tyler Dunn, tg-m DeadSix27, ericLemanissier, Chocobo1).
* Fixes for MinGW and MSVC (Ozkan Sezer).
* Fix for clang (Ozkan Sezer)
* Fix for PowerPC (Peter Seiderer, Thomas BERNARD)
* Fix for FreeBSD PowerPC (pkubaj).
* testing/validation:
* Add Windows target to CI, improve logging (Ralph Giles)
* CI improvements (Ralph Giles, Ewout ter Hoeven)
* documentation:
* Doxygen fixes (Tyler Dunn)
* Fix typos (Tim Gates, maxz)
* Interface changes:
* libFLAC:
* (none)
* libFLAC++:
* (none)
## FLAC 1.3.3 (4-Augs-2019)
* General:
* Fix CPU detection (Janne Hyvärinen).
* Switch from unsigned types to uint32_t (erikd).
* CppCheck fixes (erikd).
* Improve SIMD decoding of 24 bit files (lvqcl).
* POWER* amnd POWER9 improvements (Anton Blanchard).
* More tests.
* FLAC format:
* (none)
* Ogg FLAC format:
* (none)
* flac:
* When converting to WAV, use WAVEFORMATEXTENSIBLE when bits per second is not 8 or 16 (erikd).
* Fix --output-prefix with input-files in sub-directories (orbea).
* metaflac:
* (none)
* plugins:
* (none)
* build system:
* Cmake support (Vitaliy Kirsanov, evpobr).
* Visual Studio updates (Janne Hyvärinen).
* Fix for MSVC when UNICODE is enabled (lvqcl).
* Fix for OpenBSD/i386 (Christian Weisgerber).
* documentation:
* (none)
* libraries:
* (none).
* Interface changes:
* libFLAC:
* (none)
* libFLAC++:
* (none)
## FLAC 1.3.2 (01-Jan-2017)
* General:
* Fix undefined behaviour using GCC/Clang UBSAN (erikd).
* General hardening via fuzz testing with AFL (erikd and others).
* General code improvements (lvqcl, erikd and others).
* Add FLAC in MP4 specification docs (Ralph Giles).
* MSVS build cleanups (lvqcl).
* Fix some cppcheck warnings (erikd).
* Assume all currently used OSes support SSE2.
* FLAC format:
* (none)
* Ogg FLAC format:
* (none)
* flac:
* Fix potential infinite loop on flac-to-flac conversion (erikd).
* Add WAVEFORMATEXTENSIBLE to WAV (as needed) when decoding (lvqcl).
* Only write vorbis-comments if they are non-empty.
* Error out if decoding RAW with bits != (8|16|24).
* metaflac:
* Add --scan-replay-gain option.
* plugins:
* (none)
* build system:
* Fixes for MSVC and Makefile.lite build systems.
* documentation:
* (none)
* libraries:
* CPU detection cleanup and fixes (Julian Calaby, erikd and lvqcl).
* Fix two stream decoder bugs (Max Kellermann).
* Fix a NULL dereference bug (on a malformed file).
* Changed the LPC order guess for a slight compression improvement, particularly for classical music (Martijn van Beurden).
* Improved encoding speed on older Intel CPUs.
* Fixed a seeking bug when decoding certain files (Miroslav Lichvar).
* Put an upper bound (32768) on the number of seek points.
* Fix potential memory leaks.
* Support 64bit brword/bwword allowing FLAC__BYTES_PER_WORD to be set to 8 (disabled by default).
* Fix an out-of-bounds heap read.
* Win32: Only use large buffers when writing to disk.
* Interface changes:
* libFLAC:
* (none)
* libFLAC++:
* (none)
## FLAC 1.3.1 (25-Nov-2014)
* General:
* Improved decoding efficiency of all bit depths but especially so for 24 bits for IA32 architecture (lvqcl and Miroslav Lichvar).
* Faster encoding using SSE and AVX (lvqcl).
* Fixed bartlett, bartlett_hann and triangle functions.
* New apodization functions partial_tukey and punchout_tukey for improved compression (Martijn van Beurden).
* Retuned compression presets to incorporate new apodization functions (Martijn van Beurden).
* Fix -Wcast-align warnings on armhf architecture (Erik de Castro Lopo).
* FLAC format:
* (none)
* Ogg FLAC format:
* (none)
* flac:
* Help output documentation improvements.
* I/O buffering improvements on Windows to reduce disk fragmentation when writing files.
* Only write vorbis-comments if they are non-empty.
* metaflac:
* (none)
* plugins:
* Fix symbol visibility in XMMS plugin.
* build system:
* Many fixes and improvements across all the build systems.
* documentation:
* Document new [apodization windows](https://xiph.org/flac/documentation_tools_flac.html#flac_options_apodization).
* libraries:
* Fix CVE-2014-9028 (heap write overflow) and CVE-2014-8962 (heap read overflow) (Erik de Castro Lopo).
* Interface changes:
* libFLAC:
* (none)
* libFLAC++:
* (none)
## FLAC 1.3.0 (26-May-2013)
* General:
* Move development to Xiph.org git repository.
* The <span class="argument">[--sector-align](https://xiph.org/flac/documentation_tools_flac.html#flac_options_sector_align)</span> option of <span class="commandname">flac</span> has been deprecated and may not exist in future versions. [shntool](http://www.etree.org/shnutils/shntool/) provides similar functionality.
* Support for the RF64 and Wave64 formats in <span class="commandname">flac</span> (see below).
* Better handling of cuesheets with non-CD-DA sample rates.
* The <span class="argument">[--ignore-chunk-sizes](https://xiph.org/flac/documentation_tools_flac.html#flac_options_ignore_chunk_sizes)</span> option has been added to the <span class="commandname">flac</span> command line tool.
* FLAC format:
* (none)
* Ogg FLAC format:
* (none)
* flac:
* Added support for encoding from and decoding to the RF64 format, and a new corresponding option <span class="argument">[--force-rf64-format](https://xiph.org/flac/documentation_tools_flac.html#flac_options_force_rf64_format)</span>. ([SF #1762502](http://sourceforge.net/p/flac/feature-requests/78/)). <span class="argument">[--keep-foreign-metadata](https://xiph.org/flac/documentation_tools_flac.html#flac_options_keep_foreign_metadata)</span> is also supported.
* Added support for encoding from and decoding to the Sony Wave64 format, and a new corresponding option <span class="argument">[--force-wave64-format](https://xiph.org/flac/documentation_tools_flac.html#flac_options_force_wave64_format)</span>. ([SF #1769582](http://sourceforge.net/p/flac/feature-requests/79/)). <span class="argument">[--keep-foreign-metadata](https://xiph.org/flac/documentation_tools_flac.html#flac_options_keep_foreign_metadata)</span> is also supported.
* Added new options <span class="argument">[--preserve-modtime](https://xiph.org/flac/documentation_tools_flac.html#flac_options_preserve_modtime)</span> and <span class="argument">[--no-preserve-modtime](https://xiph.org/flac/documentation_tools_flac.html#negative_options)</span> to specify whether or not output files should copy the timestamp and permissions from their input files. The default is <span class="argument">[--preserve-modtime](https://xiph.org/flac/documentation_tools_flac.html#flac_options_preserve_modtime)</span> as in previous versions. ([SF #1805428](http://sourceforge.net/p/flac/feature-requests/85/)).
* Allow MM:SS:FF and MM:SS.SS time formats in non-CD-DA cuesheets. ([SF #1947353](http://sourceforge.net/p/flac/feature-requests/95/), [SF #2182432](http://sourceforge.net/p/flac/bugs/338/))
* The <span class="argument">[--sector-align](https://xiph.org/flac/documentation_tools_flac.html#flac_options_sector_align)</span> option of <span class="commandname">flac</span> has been deprecated and may not exist in future versions. [shntool](http://www.etree.org/shnutils/shntool/) provides similar functionality. ([SF #1805946](http://sourceforge.net/p/flac/feature-requests/86/))
* Improved error message when user attempts to decode a non-FLAC file ([SF #2222789](http://sourceforge.net/p/flac/bugs/341/)).
* Fix bug where <span class="commandname">flac</span> was disallowing use of <span class="argument">--replay-gain</span> when encoding from stdin ([SF #1840124](http://sourceforge.net/p/flac/bugs/313/)).
* Fix bug with fractional seconds on some locales ([SF #1815517](http://sourceforge.net/p/flac/bugs/309/), [SF #1858012](http://sourceforge.net/p/flac/bugs/321/)).
* Read and write appropriate channel masks for 6.1 and 7.1 surround input WAV files. Documentation was also updated.
* Correct Wave64 GUIDs.
* Support 56kHz to 192kHz gain analysis (patch from Earl Chew)
* Add ability to handle unicode filenames on Windows (large set of patches from Janne Hyvärinen)
* metaflac:
* Allow MM:SS:FF and MM:SS.SS time formats in non-CD-DA cuesheets. ([SF #1947353](http://sourceforge.net/p/flac/feature-requests/95/), [SF #2182432](http://sourceforge.net/p/flac/bugs/338/))
* plugins:
* Minor updates for XMMS plugin.
* Winamp2 plugin was dropped because Nullsoft has provided native FLAC support since 2006.
* build system:
* Fixes for autotools (including [SF #1859664](http://sourceforge.net/p/flac/patches/28/)).
* Fixes for MinGW (including [SF #2000973](http://sourceforge.net/p/flac/bugs/), [SF #2209829](http://sourceforge.net/p/flac/bugs/)).
* Fixes for gcc (including [SF #1834168](http://sourceforge.net/p/flac/bugs/), [SF #2002481](http://sourceforge.net/p/flac/bugs/334/)).
* Fixes for Sun Studio/Forte ([SF #1701960](http://sourceforge.net/p/flac/patches/22/)).
* Fixes for windows builds (including [SF #1676822](http://sourceforge.net/p/flac/bugs/257/), [SF #1756624](http://sourceforge.net/p/flac/feature-requests/73/), [SF #1809863](http://sourceforge.net/p/flac/bugs/307/), [SF #1911149](http://sourceforge.net/p/flac/feature-requests/)).
* Fixes for FreeBSD and OpenBSD.
* Compile with GNU gcc _FORTIFY_SOURCE=2 and stack protection where those features are detected.
* Enable a bunch of GCC compiler warnings and fix code that generates warnings.
* documentation:
* Document <span class="argument">[--ignore-chunk-sizes](https://xiph.org/flac/documentation_tools_flac.html#flac_options_ignore_chunk_sizes)</span> and <span class="argument">[--apply-replaygain-which-is-not-lossless](https://xiph.org/flac/documentation_tools_flac.html#flac_options_apply_replaygain_which_is_not_lossless)</span> option for <span class="commandname">flac</span>.
* libraries:
* libFLAC encoder was defaulting to level 0 compression instead of 5 ([SF #1816825](http://sourceforge.net/p/flac/bugs/310/)).
* Fix bug in bitreader handling of read callback returning a short count ([SF #2490454](http://sourceforge.net/p/flac/bugs/345/)).
* Improve decoder's ability to distinguish between a FLAC sync code and an MPEG one ([SF #2491433](http://sourceforge.net/p/flac/bugs/346/)).
* Interface changes:
* libFLAC:
* **Added** FLAC__format_blocksize_is_subset()
* libFLAC++:
* Add a number of convenience methods.
## FLAC 1.2.1 (17-Sep-2007)
* General:
* With the new <span class="argument">[--keep-foreign-metadata](https://xiph.org/flac/documentation_tools_flac.html#flac_options_keep_foreign_metadata)</span> in <span class="commandname">flac</span>, non-audio RIFF and AIFF chunks can be stored in FLAC files and recreated when decoding. This allows, among other, things support for archiving BWF files and other WAVE files from editing tools that preserves all the metadata.
* FLAC format:
* Specified 2 new APPLICATION metadata blocks for storing WAVE and AIFF chunks (for use with [--keep-foreign-metadata](https://xiph.org/flac/documentation_tools_flac.html#flac_options_keep_foreign_metadata) in <span class="commandname">flac</span>).
* The lead-out track number for non-CDDA cuesheets now must be 255.
* Ogg FLAC format:
* This is not a format change, but changed default extension for Ogg FLAC from .ogg to .oga, according to new Xiph [specification](http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions) ([SF #1762492](http://sourceforge.net/p/flac/bugs/283/)).
* flac:
* Added a new option <span class="argument">[--no-utf8-convert](https://xiph.org/flac/documentation_tools_flac.html#flac_options_no_utf8_convert)</span> which works like it does in <span class="commandname">metaflac</span> ([SF #973740](http://sourceforge.net/p/flac/feature-requests/35/)).
* Added a new option <span class="argument">[--keep-foreign-metadata](https://xiph.org/flac/documentation_tools_flac.html#flac_options_keep_foreign_metadata)</span> which can save/restore RIFF and AIFF chunks to/from FLAC files ([SF #363478](http://sourceforge.net/p/flac/feature-requests/9/)).
* Changed default extension for Ogg FLAC from .ogg to .oga, according to new Xiph [specification](http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions) ([SF #1762492](http://sourceforge.net/p/flac/bugs/283/)).
* Fixed bug where using <span class="argument">--replay-gain</span> without any padding option caused only a small PADDING block to be created ([SF #1760790](http://sourceforge.net/p/flac/bugs/282/)).
* Fixed bug where encoding from stdin on Windows could fail if WAVE/AIFF contained unknown chunks ([SF #1776803](http://sourceforge.net/p/flac/bugs/290/)).
* Fixed bug where importing non-CDDA cuesheets would cause an invalid lead-out track number ([SF #1764105](http://sourceforge.net/p/flac/bugs/286/)).
* metaflac:
* Changed default extension for Ogg FLAC from .ogg to .oga, according to new Xiph [specification](http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions) ([SF #1762492](http://sourceforge.net/p/flac/bugs/283/)).
* Fixed bug where importing non-CDDA cuesheets would cause an invalid lead-out track number ([SF #1764105](http://sourceforge.net/p/flac/bugs/286/)).
* plugins:
* (none)
* build system:
* New configure option <span class="argument">--disable-cpplibs</span> to prevent building libFLAC++ ([SF #1723295](http://sourceforge.net/p/flac/patches/23/)).
* Fixed bug compiling <span class="commandname">flac</span> without Ogg support ([SF #1760786](http://sourceforge.net/p/flac/bugs/281/)).
* Fixed bug where sometimes an existing installation of flac could interfere with the build process ([SF #1763690](http://sourceforge.net/p/flac/bugs/285/)).
* OS X fixes ([SF #1786225](http://sourceforge.net/p/flac/patches/25/)).
* MinGW fixes ([SF #1684879](http://sourceforge.net/p/flac/bugs/264/)).
* Solaris 10 fixes ([SF #1783225](http://sourceforge.net/p/flac/bugs/294/) [SF #1783630](http://sourceforge.net/p/flac/bugs/295/)).
* OS/2 fixes ([SF #1771378](http://sourceforge.net/p/flac/bugs/287/) [SF #1229495](http://sourceforge.net/p/flac/bugs/174/)).
* automake-1.10 fixes ([SF #1791361](http://sourceforge.net/p/flac/bugs/300/) [SF #1792179](http://sourceforge.net/p/flac/bugs/302/)).
* documentation:
* Added new [tutorial](https://xiph.org/flac/documentation_tools_flac.html#tutorial) section for <span class="commandname">flac</span>.
* Added [example code](https://xiph.org/flac/documentation_example_code.html) section for using libFLAC/libFLAC++.
* libraries:
* libFLAC: Fixed very rare seek bug ([SF #1684049](http://sourceforge.net/p/flac/bugs/263/)).
* libFLAC: Fixed seek bug with Ogg FLAC and small streams ([SF #1792172](http://sourceforge.net/p/flac/bugs/301/)).
* libFLAC: 64-bit fixes ([SF #1790872](http://sourceforge.net/p/flac/bugs/299/)).
* libFLAC: Fix assembler code to be position independent.
* libFLAC: Optimization of a number of inner loop functions.
* Added support for encoding the residual coding method introduced in libFLAC 1.2.0 (RESIDUAL_CODING_METHOD_PARTITIONED_RICE2) which will encode 24-bit files more efficiently.
* Interface changes:
* libFLAC:
* **Added** FLAC__metadata_simple_iterator_is_last()
* **Added** FLAC__metadata_simple_iterator_get_block_offset()
* **Added** FLAC__metadata_simple_iterator_get_block_length()
* **Added** FLAC__metadata_simple_iterator_get_application_id()
* libFLAC++:
* **Added** FLAC::Metadata::SimpleIterator::is_last()
* **Added** FLAC::Metadata::SimpleIterator::get_block_offset()
* **Added** FLAC::Metadata::SimpleIterator::get_block_length()
* **Added** FLAC::Metadata::SimpleIterator::get_application_id()
## FLAC 1.2.0 (23-Jul-2007)
* General:
* Small encoding speedups for all modes.
* FLAC format:
* One of the reserved bits in the FLAC frame header has been assigned for future use; make sure to refer to the [porting guide](https://xiph.org/flac/api/group__porting__1__1__4__to__1__2__0.html) if you parse FLAC streams manually.
* Ogg FLAC format:
* (none)
* flac:
* Added runtime detection of SSE OS support for most operating systems.
* Added a new undocumented option <span class="argument">--ignore-chunk-sizes</span> for ignoring the size of the 'data' chunk (WAVE) or 'SSND' chunk (AIFF). Can be used to encode files with bogus data sizes (e.g. with WAV files piped from foobar2000 to flac.exe as an external encoder). **Use with caution**: all subsequent data is treated as audio, so the data/SSND chunk must be the last or the following data/tags will be treated as audio and encoded.
* metaflac:
* (none)
* plugins:
* (none)
* build system:
* Added solution and project files for building with VC++ 2005.
* libraries:
* Added runtime detection of SSE OS support for most operating systems.
* Fixed bug where invalid seek tables could cause some seeks to fail.
* Added support for decoding the new residual coding method (RESIDUAL_CODING_METHOD_PARTITIONED_RICE2).
* Interface changes (see also the [porting guide](https://xiph.org/flac/api/group__porting__1__1__4__to__1__2__0.html) for specific instructions on porting to FLAC 1.2.0):
* libFLAC:
* **Added** FLAC__format_sample_rate_is_subset()
* libFLAC++:
* **Added** FLAC::Decoder::Stream::get_decode_position()
## FLAC 1.1.4 (13-Feb-2007)
* General:
* Improved compression with no change to format or decrease in speed.
* Encoding and decoding speedups for all modes. Encoding at -8 is twice as fast.
* FLAC format:
* (none)
* Ogg FLAC format:
* (none)
* flac:
* Improved compression with no change to format or decrease in speed.
* Encoding and decoding speedups for all modes. Encoding at -8 is twice as fast.
* Added a new option <span class="argument">[-w,--warnings-as-errors](https://xiph.org/flac/documentation_tools_flac.html#flac_options_warnings_as_errors)</span> for treating all warnings as errors.
* Allow <span class="argument">[--picture](https://xiph.org/flac/documentation_tools_flac.html#flac_options_picture)</span> option to take only a filename, and have all other attributes extracted from the file itself.
* Fixed a bug that caused suboptimal default compression settings in some locales ([SF #1608883](http://sourceforge.net/p/flac/bugs/237/)).
* Fixed a bug where FLAC-to-FLAC transcoding of a corrupted FLAC file would truncate the transcoded file at the first error ([SF #1615019](http://sourceforge.net/p/flac/bugs/241/)).
* Fixed a bug where using <span class="argument">[-F](https://xiph.org/flac/documentation_tools_flac.html#flac_options_decode_through_errors)</span> with FLAC-to-FLAC transcoding of a corrupted FLAC would have no effect ([SF #1615391](http://sourceforge.net/p/flac/bugs/242/)).
* Fixed a bug where new PICTURE metadata blocks specified with <span class="argument">[--picture](https://xiph.org/flac/documentation_tools_flac.html#flac_options_picture)</span> would not be transferred during FLAC-to-FLAC transcoding ([SF #1627993](http://sourceforge.net/p/flac/bugs/246/)).
* metaflac:
* Allow <span class="argument">[--import-picture-from](https://xiph.org/flac/documentation_tools_metaflac.html#metaflac_shorthand_import_picture_from)</span> option to take only a filename, and have all other attributes extracted from the file itself.
* plugins:
* Fixed a bug in the XMMS plugin where Ctrl-3 (file info) would cause a crash if the file did not exist ([SF #1634941](http://sourceforge.net/p/flac/patches/20/)).
* build system:
* Fixed a makefile linkage bug with libogg ([SF #1611414](http://sourceforge.net/p/flac/bugs/239/)).
* Added pkg-config files for libFLAC and libFLAC++ ([SF #1647881](http://sourceforge.net/p/flac/patches/21/)).
* Added <span class="argument">--disable-ogg</span> option for building without Ogg support even if libogg is installed ([SF #1196996](http://sourceforge.net/p/flac/bugs/165/)).
* libraries:
* Completely rewritten bitbuffer which uses native machine word size instead of bytes for dramatic speed improvements. The speedup should be most dramatic on CPUs with slower byte manipulation capability and big-endian machines.
* Much faster Rice partition size estimation which greatly speeds encoding in higher modes.
* Increased compression for all modes.
* Reduced memory requirements for encoder and decoder.
* Fixed a bug with default apodization settings that were erroneous in some locales ([SF #1608883](http://sourceforge.net/p/flac/bugs/237/)).
* Interface changes:
* libFLAC:
* (behavior only) FLAC__stream_encoder_set_metadata() now makes a copy of the "metadata" array of pointers (but still not copies of the objects themselves) so the client does not need to maintain its copy of the array after the call.
* libFLAC++:
* (none)
## FLAC 1.1.3 (27-Nov-2006)
* General:
* Improved compression with no impact on format or decoding speed.
* Much better recovery for corrupted files
* Better multichannel support
* Large file (>2GB) support everywhere
* <span class="commandname">flac</span> now supports FLAC and Ogg FLAC as input to the encoder (e.g. can re-encode FLAC to FLAC) and preserve all the metadata like tags, etc.
* New <span class="code">[PICTURE](https://xiph.org/flac/format.html#def_PICTURE)</span> metadata block for storing things like cover art, new <span class="argument">[--picture](https://xiph.org/flac/documentation_tools_flac.html#flac_options_picture)</span> option to <span class="commandname">flac</span> and <span class="argument">[--import-picture-from](https://xiph.org/flac/documentation_tools_metaflac.html#metaflac_shorthand_import_picture_from)</span> option to <span class="commandname">metaflac</span> for importing pictures, new <span class="argument">[--export-picture-to](https://xiph.org/flac/documentation_tools_metaflac.html#metaflac_shorthand_export_picture_to)</span> option to <span class="commandname">metaflac</span> for exporting pictures, and metadata API [additions](https://xiph.org/flac/api/group__flac__metadata__level0.html#ga3) for searching for suitable pictures based on type, size and color constraints.
* Support for new <tt>REPLAYGAIN_REFERENCE_LOUDNESS</tt> tag.
* Fixed a bug in Ogg FLAC encoding where metadata was not being updated properly. Existing Ogg FLAC files should be recoded to fix up the metadata, e.g. <span class="command">flac -Vf -S 10s --ogg file.ogg</span>
* In the developer libraries, the interface has been simplfied by merging the three decoding layers into a single class; ditto for the encoders. Also, libOggFLAC has been merged into libFLAC and libOggFLAC++ has been merged into libFLAC++ so there is a single API supporting both native FLAC and Ogg FLAC.
* FLAC format:
* New <span class="code">[PICTURE](https://xiph.org/flac/format.html#def_PICTURE)</span> metadata block for storing things like cover art.
* Speaker assignments and channel orders for 3-6 channels (see [frame header](https://xiph.org/flac/format.html#frame_header)).
* Further restrictions on the [FLAC subset](https://xiph.org/flac/format.html#subset) when the sample rate is <=48kHz; in this case the maximum LPC order is now 12 and maximum blocksize is 4608\. This is to further limit the processing and memory requirements for hardware implementations while not measurably affecting compression.
* Ogg FLAC format:
* (none)
* flac:
* Improved the <span class="argument">[-F](https://xiph.org/flac/documentation_tools_flac.html#flac_options_decode_through_errors)</span> option to allow decoding of FLAC files whose metadata is corrupted, and other kinds of severe corruption.
* Encoder can now take FLAC and Ogg FLAC as input. The output FLAC file will have all the same metadata as the original unless overridden with options on the command line.
* Encoder can now take WAVEFORMATEXTENSIBLE WAVE files as input; decoder will output WAVEFORMATEXTENSIBLE WAVE files when necessary to conform to the latest Microsoft specifications.
* Now properly supports AIFF and WAVEFORMATEXTENSIBLE multichannel input, performing necessary channel reordering both for encoding and decoding. WAVEFORMATEXTENSIBLE channel mask is also saved to a tag on encoding and restored on decoding for situations when there is no natural mapping to FLAC channel assignments.
* Expanded support for "odd" sample resolutions to WAVE and AIFF input; all resolutions from 4 to 24 bits-per-sample now supported for all input types.
* Added a new option <span class="argument">[--tag-from-file](https://xiph.org/flac/documentation_tools_flac.html#flac_options_tag_from_file)</span> for setting a tag from file (e.g. for importing a cuesheet as a tag).
* Added a new option <span class="argument">[--picture](https://xiph.org/flac/documentation_tools_flac.html#flac_options_picture)</span> for adding pictures.
* Added a new option <span class="argument">[--apodization](https://xiph.org/flac/documentation_tools_flac.html#flac_options_apodization)</span> for specifying the window function(s) to be used in LPC analysis.
* Added support for encoding from non-compressed AIFF-C ([SF #1090933](http://sourceforge.net/p/flac/bugs/143/)).
* Importing of non-CDDA-compliant cuesheets now only issues a warning, not an error (see [here](http://www.hydrogenaud.io/forums/index.php?showtopic=31282)).
* MD5 comparison failures on decoding are now an error instead of a warning and will also return a non-zero exit code ([SF #1493725](http://sourceforge.net/p/flac/bugs/221/)).
* The default padding size is now 8K, or 64K if the input audio stream is more than 20 minutes long.
* Fixed a bug in cuesheet parsing where it would return an error if the last line of the cuesheet did not end with a newline.
* Fixed a bug that caused a crash when <span class="argument">-a</span> and <span class="argument">-t</span> were used together ([SF #1229481](http://sourceforge.net/p/flac/bugs/173/)).
* Fixed a bug with --sector-align where appended samples were not always totally silent ([SF #1237707](http://sourceforge.net/p/flac/bugs/179/)).
* Fixed bugs with --sector-align and raw input files.
* Fixed a bug printing out unknown AIFF subchunk names ([SF #1267476](http://sourceforge.net/p/flac/bugs/186/)).
* Fixed a bug where WAVE files with "data" subchunks of size 0 where accepted ([SF #1293830](http://sourceforge.net/p/flac/bugs/190/)).
* Fixed a bug where sync error at end-of-stream of truncated files was not being caught ([SF #1244071](http://sourceforge.net/p/flac/bugs/183/)).
* Fixed a problem with filename parsing if file does not have extension but also has a . in the path ([SF #1161916](http://sourceforge.net/p/flac/bugs/159/)).
* Fixed a problem with fractional-second parsing for <span class="argument">--skip</span>/<span class="argument">--until</span> in some locales ([SF #1031043](http://sourceforge.net/p/flac/bugs/125/)).
* Increase progress report rate when -p and -e are used together ([SF #1580122](http://sourceforge.net/p/flac/bugs/229/)).
* metaflac:
* Added support for read-only operations on Ogg FLAC files.
* Added a new option <span class="argument">[--set-tag-from-file](https://xiph.org/flac/documentation_tools_metaflac.html#metaflac_shorthand_set_tag_from_file)</span> for setting a tag from file (e.g. for importing a cuesheet as a tag).
* Added a new option <span class="argument">[--import-picture-from](https://xiph.org/flac/documentation_tools_metaflac.html#metaflac_shorthand_import_picture_from)</span> for importing pictures.
* Added a new option <span class="argument">[--export-picture-to](https://xiph.org/flac/documentation_tools_metaflac.html#metaflac_shorthand_export_picture_to)</span> for exporting pictures.
* Added shorthand operation <span class="argument">[--remove-replay-gain](https://xiph.org/flac/documentation_tools_metaflac.html#metaflac_shorthand_remove_replay_gain)</span> for removing ReplayGain tags.
* <span class="argument">[--export-cuesheet-to](https://xiph.org/flac/documentation_tools_metaflac.html#metaflac_shorthand_export_cuesheet_to)</span> now properly specifies the FLAC file name ([SF #1272825](http://sourceforge.net/p/flac/feature-requests/46/)).
* Importing of non-CDDA-compliant cuesheets now issues a warning.
* Removed the following deprecated tag editing options; you should use the new option names shown instead:
* Removed <span class="argument">--show-vc-vendor</span>; use <span class="argument">--show-vendor-tag</span>
* Removed <span class="argument">--show-vc-field</span>; use <span class="argument">--show-tag</span>
* Removed <span class="argument">--remove-vc-all</span>; use <span class="argument">--remove-all-tags</span>
* Removed <span class="argument">--remove-vc-field</span>; use <span class="argument">--remove-tag</span>
* Removed <span class="argument">--remove-vc-firstfield</span>; use <span class="argument">--remove-first-tag</span>
* Removed <span class="argument">--set-vc-field</span>; use <span class="argument">--set-tag</span>
* Removed <span class="argument">--import-vc-from</span>; use <span class="argument">--import-tags-from</span>
* Removed <span class="argument">--export-vc-to</span>; use <span class="argument">--export-tags-to</span>
* Disallow multiple input FLAC files when --import-tags-from=- is used ([SF #1082577](http://sourceforge.net/p/flac/bugs/141/)).
* plugins:
* When ReplayGain is on, if tags for the preferred kind of gain (album/track) are not in a stream, the other kind will be used.
* Added ReplayGain info to file info box in XMMS plugin
* Fixed UTF-8 decoder to disallow non-shortest-form and surrogate sequences (see [here](http://www.unicode.org/versions/corrigendum1.html)).
* build system:
* Added support for building on OS/2 with EMX ([SF #1229495](http://sourceforge.net/p/flac/bugs/174/))
* Added support for building with Borland C++ ([SF #1599018](http://sourceforge.net/p/flac/patches/17/))
* Added a <span class="argument">--disable-xmms-plugin</span> option to <span class="command">configure</span> to prevent building the XMMS plugin ([SF #930494](http://sourceforge.net/p/flac/feature-requests/33/)).
* Added a <span class="argument">--disable-doxygen-docs</span> option to <span class="command">configure</span> for disabling Doxygen-based API doc generation ([SF #1365935](http://sourceforge.net/p/flac/patches/12/)).
* Added a <span class="argument">--disable-thorough-tests</span> option to <span class="command">configure</span> to do the basic library, stream, and tool tests in a reasonable time ([SF #1077948](http://sourceforge.net/p/flac/feature-requests/40/)).
* Added large file support with <span class="argument">AC_SYS_LARGEFILE</span>; use <span class="argument">--disable-largefile</span> with <span class="command">configure</span> to disable.
* libraries:
* Merged libOggFLAC into libFLAC; both formats are now supported through the same API.
* Merged libOggFLAC++ into libFLAC++; both formats are now supported through the same API.
* libFLAC and libFLAC++: Simplified encoder setup with new <span class="argument">FLAC__stream_encoder_set_compression_level()</span> function.
* libFLAC: Improved compression with no impact on FLAC format or decoding time by adding a windowing stage before LPC analysis.
* libFLAC: Fixed a bug where missing STREAMINFO fields (min/max framesize, total samples, MD5 sum) and seek point offsets were not getting rewritten back to Ogg FLAC file ([SF #1338969](http://sourceforge.net/p/flac/bugs/197/)).
* libFLAC: Fixed a bug in cuesheet parsing where it would return an error if the last line of the cuesheet did not end with a newline.
* libFLAC: Fixed UTF-8 decoder to disallow non-shortest-form and surrogate sequences (see [here](http://www.unicode.org/versions/corrigendum1.html)).
* libFLAC: Fixed a bug in the return value for <span class="argument">FLAC__stream_decoder_set_metadata_respond_application()</span> and <span class="argument">FLAC__stream_decoder_set_metadata_ignore_application()</span> when there was a memory allocation error ([SF #1235005](http://sourceforge.net/p/flac/bugs/176/)).
* Interface changes (see also the [porting guide](https://xiph.org/flac/api/group__porting__1__1__2__to__1__1__3.html) for specific instructions on porting to FLAC 1.1.3):
* all libraries;
* Merged libOggFLAC into libFLAC; both formats are now supported through the same API.
* Merged libOggFLAC++ into libFLAC++; both formats are now supported through the same API.
* Merged seekable stream decoder and file decoder into the stream decoder.
* Merged seekable stream encoder and file encoder into the stream encoder.
* Added #defines for the API version number to make porting easier; see <tt>include/lib*FLAC*/export.h</tt>.
* libFLAC:
* **Added** FLAC__stream_encoder_set_apodization()
* **Added** FLAC__stream_encoder_set_compression_level()
* **Added** FLAC__metadata_object_cuesheet_calculate_cddb_id()
* **Added** FLAC__metadata_get_cuesheet()
* **Added** FLAC__metadata_get_picture()
* **Added** FLAC__metadata_chain_read_ogg() and FLAC__metadata_chain_read_ogg_with_callbacks()
* **Changed** FLAC__stream_encoder_finish() now returns a FLAC__bool to signal a verify failure, or error processing last frame or updating metadata.
* **Changed** FLAC__StreamDecoderState: removed state FLAC__STREAM_DECODER_UNPARSEABLE_STREAM
* **Changed** FLAC__StreamDecoderErrorStatus: new error code FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
* The above two changes mean that when the decoder encounters what it thinks are unparseable frames from a future decoder, instead of returning a fatal error with the FLAC__STREAM_DECODER_UNPARSEABLE_STREAM state, it just calls the error callback with FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM and leaves the behavior up to the application.
* libFLAC++:
* **Added** FLAC::Metadata::Picture
* **Added** FLAC::Encoder::Stream::set_apodization()
* **Added** FLAC::Encoder::Stream::set_compression_level()
* **Added** FLAC::Metadata::CueSheet::calculate_cddb_id()
* **Added** FLAC::Metadata::get_cuesheet()
* **Added** FLAC::Metadata::get_picture()
* **Changed** FLAC::Metadata::Chain::read() to accept a flag denoting Ogg FLAC input
* **Changed** FLAC::Decoder::Stream::finish() now returns a bool to signal an MD5 failure like FLAC__stream_decoder_finish() does.
* **Changed** FLAC::Encoder::Stream::finish() now returns a bool to signal a verify failure, or error processing last frame or updating metadata.
* libOggFLAC:
* Merged into libFLAC.
* libOggFLAC++:
* Merged into libFLAC++.
## FLAC 1.1.2 (05-Feb-2005)
* General:
* Sped up decoding by a few percent overall.
* Sped up encoding when not using LPC (i.e. when using <span class="commandname">flac</span> options <span class="argument">-0</span>, <span class="argument">-1</span>, <span class="argument">-2</span>, or <span class="argument">-l 0</span>).
* Fixed a decoding bug that could cause sync errors with some ID3v1-tagged FLAC files.
* Added [HTML documentation for metaflac](https://xiph.org/flac/documentation_tools_metaflac.html#metaflac).
* FLAC format:
* (none)
* Ogg FLAC format:
* (none)
* flac:
* New option <span class="argument">[--input-size](https://xiph.org/flac/documentation_tools_flac.html#flac_options_input_size)</span> to manually specify the input size when encoding raw samples from stdin.
* metaflac:
* (none)
* plugins:
* Added support for HTTP streaming in XMMS plugin. **NOTE**: there is a bug in the XMMS mpg123 plugin that hijacks FLAC streams; to fix it you will need to add the '.flac' extension to the list of exceptions in <span class="code">Input/mpg123/mpg123.c:is_our_file()</span> in the XMMS sources and recompile.
* build system:
* (none)
* libraries:
* libFLAC: Sped up Rice block decoding in the bitbuffer, resulting in decoding speed gains of a few percent.
* libFLAC: Sped up encoding when not using LPC (i.e. <span class="code">max_lpc_order == 0</span>).
* libFLAC: Trailing NUL characters maintained on Vorbis comment entries so they can be treated like C strings.
* libFLAC: More FLAC tag (i.e. Vorbis comment) validation.
* libFLAC: Fixed a bug in the logic that determines the frame or sample number in a frame header; the bug could cause sync errors with some ID3v1-tagged FLAC files.
* libFLAC, libOggFLAC: Can now be compiled to use only integer instructions, including encoding. The decoder is almost completely integer anyway but there were a couple places that needed a fixed-point replacement. There is no fixed-point version of LPC analysis yet, so if libFLAC is compiled integer-only, the encoder will behave as if the max LPC order is 0 (i.e. used fixed predictors only). LPC decoding is supported in all cases as it always was integer-only.
* Interface changes:
* libFLAC:
* **Changed:** Metadata object interface now maintains a trailing NUL on Vorbis comment entries for convenience.
* **Changed:** Metadata object interface now validates all Vorbis comment entries on input and returns false if an entry does not conform to the Vorbis comment spec.
* **Added** FLAC__format_vorbiscomment_entry_name_is_legal()
* **Added** FLAC__format_vorbiscomment_entry_value_is_legal()
* **Added** FLAC__format_vorbiscomment_entry_is_legal()
* **Added** FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair()
* **Added** FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair()
* **Changed** the signature of FLAC__metadata_object_vorbiscomment_entry_matches(): the first argument is now <span class="code">FLAC__StreamMetadata_VorbisComment_Entry entry</span> (was <span class="code">const FLAC__StreamMetadata_VorbisComment_Entry \*entry</span>), i.e. <span class="code">entry</span> is now pass-by-value.
* libFLAC++:
* **Changed:** Metadata object interface now maintains a trailing NUL on Vorbis comment values for convenience.
* **Changed:** Metadata object interface now validates all Vorbis comment entries on input and returns false if an entry does not conform to the Vorbis comment spec.
* **Changed:** All Metadata objects' operator=() methods now return a reference to themselves.
* **Added** methods to FLAC::Metadata::VorbisComment::Entry for setting comment values from null-terminated strings:
* Entry(const char \*field)
* Entry(const char \*field_name, const char \*field_value)
* bool set_field(const char \*field)
* bool set_field_value(const char \*field_value)
* **Changed** the signature of FLAC::Metadata::VorbisComment::get_vendor_string() and FLAC::Metadata::VorbisComment::set_vendor_string() to use a UTF-8, NUL-terminated string <span class="code">const FLAC__byte *</span> for the vendor string instead of <span class="code">FLAC::Metadata::VorbisComment::Entry</span>.
* **Added** FLAC::Metadata::*::assign() to all Metadata objects.
* **Added** bool FLAC::Metadata::get_tags(const char \*filename, VorbisComment &tags)
* libOggFLAC:
* (none)
* libOggFLAC++:
* (none)
## FLAC 1.1.1 (01-Oct-2004)
* General:
* Ogg FLAC seeking now works
* New optimizations almost double the decoding speed on PowerPC (e.g. Mac G4/G5)
* A native OS X release thanks to updated Project Builder and autotools files
* FLAC format:
* Made invalid the metadata block type 127 so that audio frames can always be distinguished from metadata by seeing 0xff as the first byte. (This was also required for the Ogg FLAC mapping.)
* Ogg FLAC format:
* First official FLAC->Ogg bitstream mapping standardized (see new [FLAC-to-Ogg mapping specification](ogg_mapping.html)). See the documentation for the <span class="argument">[--ogg](https://xiph.org/flac/documentation_tools_flac.html#flac_options_ogg)</span> switch about having to re-encode older Ogg FLAC files.
* flac:
* Print an error when output file already exists instead of automatically overwriting.
* New option <span class="argument">[-f](https://xiph.org/flac/documentation_tools_flac.html#flac_options_force)</span> (<span class="argument">[--force](https://xiph.org/flac/documentation_tools_flac.html#flac_options_force)</span>) to force overwriting if the output file already exists.
* New option <span class="argument">[--cue](https://xiph.org/flac/documentation_tools_flac.html#flac_options_cue)</span> to select a specific section to decode using cuesheet track/index points.
* New option <span class="argument">[--totally-silent](https://xiph.org/flac/documentation_tools_flac.html#flac_options_totally_silent)</span> to suppress all output.
* New (but undocumented) option <span class="argument">--apply-replaygain-which-is-not-lossless</span> which applies ReplayGain to the decoded output. See [this thread](http://www.hydrogenaud.io/forums/index.php?showtopic=17293&st=11) for usage and caveats.
* When encoding to Ogg FLAC, use a random serial number (instead of 0 as was done before) when a serial number is not specified.
* When encoding multiple Ogg FLAC streams, <span class="argument">--serial-number</span> or random serial number sets the first number, which is then incremented for subsequent streams (before, the same serial number was used for all streams).
* Decoder no longer exits with an error when writing to stdout and the pipe is broken.
* Better explanation of common error messages.
* Default extension when writing AIFF files is .aif (before, it was .aiff).
* Write more common representation of SANE numbers in AIFF files.
* Bug fix: calculating ReplayGain on 48kHz streams.
* Bug fix: check for supported block alignments in WAVE files.
* Bug fix: "offset" field in AIFF SSND chunk properly handled.
* Bug fix: [#679166](http://sourceforge.net/p/flac/bugs/77/): flac doesn't respect RIFF subchunk padding byte.
* Bug fix: [#828391](http://sourceforge.net/p/flac/bugs/90/): --add-replay-gain segfaults.
* Bug fix: [#851155](http://sourceforge.net/p/flac/bugs/96/): Can't seek to position in flac file.
* Bug fix: [#851756](http://sourceforge.net/p/flac/bugs/97/): flac --skip --until reads entire file.
* Bug fix: [#877122](http://sourceforge.net/p/flac/bugs/100/): problem parsing cuesheet with CATALOG entry.
* Bug fix: [#896057](http://sourceforge.net/p/flac/bugs/104/): parsing ISRC number from cuesheet.
* metaflac:
* Renamed the tag editing options as follows (the <span class="argument">...-vc-...</span> options still work but are deprecated):
* <span class="argument">--show-vc-vendor</span> becomes <span class="argument">--show-vendor-tag</span>
* <span class="argument">--show-vc-field</span> becomes <span class="argument">--show-tag</span>
* <span class="argument">--remove-vc-all</span> becomes <span class="argument">--remove-all-tags</span>
* <span class="argument">--remove-vc-field</span> becomes <span class="argument">--remove-tag</span>
* <span class="argument">--remove-vc-firstfield</span> becomes <span class="argument">--remove-first-tag</span>
* <span class="argument">--set-vc-field</span> becomes <span class="argument">--set-tag</span>
* <span class="argument">--import-vc-from</span> becomes <span class="argument">--import-tags-from</span>
* <span class="argument">--export-vc-to</span> becomes <span class="argument">--export-tags-to</span>
* Better explanation of common error messages.
* Bug fix: calculating ReplayGain on 48kHz streams.
* Bug fix: incorrect numbers when printing seek points.
* plugins:
* Speed optimization in ReplayGain synthesis.
* Speed optimization in XMMS playback.
* Support for big-endian architectures in XMMS plugin.
* Removed support for ID3 tags.
* Bug fix: make hard limiter default to off in XMMS plugin.
* Bug fix: stream length calculation bug in XMMS plugin, debian bug #200435
* Bug fix: small memory leak in XMMS plugin.
* build system:
* <span class="code">ordinals.h</span> is now static, not a build-generated file anymore.
* libraries:
* libFLAC: PPC+Altivec optimizations of some decoder routines.
* libFLAC: Make stream encoder encode the blocksize and sample rate in the frame header if at all possible (not in STREAMINFO), even if subset encoding was not requested.
* libFLAC: Bug fix: fixed seek routine where infinite loop could happen when seeking past end of stream.
* libFLAC, libFLAC++: added methods to skip single frames, useful for quickly finding frame boundaries (see interface changes below).
* libOggFLAC, libOggFLAC++: New seekable-stream and file encoder and decoder APIs to match native FLAC APIs (see interface changes below).
* Interface changes:
* libFLAC:
* **Added** FLAC__metadata_get_tags()
* **Added** callback-based versions of metadata editing functions:
* FLAC__metadata_chain_read_with_callbacks()
* FLAC__metadata_chain_write_with_callbacks()
* FLAC__metadata_chain_write_with_callbacks_and_tempfile()
* FLAC__metadata_chain_check_if_tempfile_needed()
* **Added** decoder functions for skipping single frames, also useful for quickly finding frame boundaries:
* FLAC__stream_decoder_skip_single_frame()
* FLAC__seekable_stream_decoder_skip_single_frame()
* FLAC__file_decoder_skip_single_frame()
* **Added** new required tell callback on seekable stream encoder:
* FLAC__SeekableStreamEncoderTellStatus and FLAC__SeekableStreamEncoderTellStatusString\[\]
* FLAC__SeekableStreamEncoderTellCallback
* FLAC__seekable_stream_encoder_set_tell_callback()
* **Changed** FLAC__SeekableStreamEncoderState by adding FLAC__SEEKABLE_STREAM_ENCODER_TELL_ERROR
* **Changed** Tell callback is now required to initialize seekable stream encoder
* **Deleted** erroneous and unimplemented FLAC__file_decoder_process_remaining_frames()
* libFLAC++:
* **Added** FLAC::Metadata::get_tags()
* **Added** decoder functions for skipping single frames, also useful for quickly finding frame boundaries:
* FLAC::Decoder::Stream::skip_single_frame()
* FLAC::Decoder::SeekableStream::skip_single_frame()
* FLAC::Decoder::File::skip_single_frame()
* **Added** encoder functions for setting metadata:
* FLAC::Encoder::Stream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
* FLAC::Encoder::SeekableStream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
* FLAC::Encoder::File::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
* **Added** new required tell callback on seekable stream encoder:
* pure virtual FLAC::Encoder::SeekableStream::tell_callback()
* **Changed** Tell callback is now required to initialize seekable stream encoder
* **Deleted** the following methods:
* FLAC::Decoder::Stream::State::resolved_as_cstring()
* FLAC::Encoder::Stream::State::resolved_as_cstring()
* libOggFLAC:
* **Added** OggFLAC__SeekableStreamDecoder interface
* **Added** OggFLAC__FileDecoder interface
* **Added** OggFLAC__SeekableStreamEncoder interface
* **Added** OggFLAC__FileEncoder interface
* **Added** OggFLAC__stream_decoder_get_resolved_state_string()
* **Added** OggFLAC__stream_encoder_get_resolved_state_string()
* **Added** OggFLAC__stream_encoder_set_metadata_callback()
* **Changed** OggFLAC__StreamDecoderState by adding OggFLAC__STREAM_DECODER_END_OF_STREAM
* libOggFLAC++:
* **Added** OggFLAC::Decoder::SeekableStream interface
* **Added** OggFLAC::Decoder::File interface
* **Added** OggFLAC::Encoder::SeekableStream interface
* **Added** OggFLAC::Encoder::File interface
* **Added** OggFLAC::Decoder::Stream::get_resolved_state_string()
* **Added** OggFLAC::Encoder::Stream::get_resolved_state_string()
* **Added** pure virtual OggFLAC::Encoder::Stream::metadata_callback()
## FLAC 1.1.0 (26-Jan-2003)
General:
* All code is now [Valgrind](http://valgrind.org/)-clean!
* New [CUESHEET](https://xiph.org/flac/format.html#def_CUESHEET) metadata block for storing CD TOC and index point information. Now a CD can be completely backed up to a single FLAC file for archival.
* [ReplayGain](http://www.replaygain.org/) support.
* Better compression of 24-bit files.
* More complete AIFF support.
* 3DNow! optimizations enabled by default.
* Complete MSVC build system with .dsp projects for everything, which can build both static libs and DLLs, and in debug or release mode, all in the same source tree.
<span class="commandname">flac</span>:
* Can now decode FLAC to AIFF; new <span class="argument">--force-aiff-format</span> option.
* New <span class="argument">--cuesheet</span> option for reading and storing a cuesheet when encoding a whole CD. Automatically creates seek points for track and index points unless <span class="argument">--no-cued-seekpoints</span> is used.
* New <span class="argument">--replay-gain</span> option for calculating ReplayGain values and storing them as tags.
* New <span class="argument">--until</span> option complements <span class="argument">--skip</span> to stop decoding at a specified point in the stream.
* <span class="argument">--skip</span> and <span class="argument">--until</span> now also accept mm:ss.ss format.
* New <span class="argument">-S #s</span> flavor to specify seekpoints every '#' number of seconds.
* <span class="commandname">flac</span> now defaults to <span class="argument">-S 10s</span> instead of <span class="argument">-S 100x</span> for the seek table.
* <span class="commandname">flac</span> now adds a 4k PADDING block by default (turn off with <span class="argument">--no-padding</span>).
* Fixed a bug with --skip and AIFF-to-FLAC encoding.
* Fixed a bug where decoding a FLAC file whose total_samples==0 in the STREAMINFO would corrupt the WAVE header.
<span class="commandname">metaflac</span>:
* New <span class="argument">--import-cuesheet-from</span> option for reading and storing a cuesheet to a FLAC-encoded CD. Automatically creates seek points for track and index points unless <span class="argument">--no-cued-seekpoints</span> is used.
* New <span class="argument">--export-cuesheet-to</span> option for writing a cuesheet from a FLAC file for use with CD authoring software.
* New <span class="argument">--add-replay-gain</span> option for calculating ReplayGain values and storing them as tags.
* New <span class="argument">--add-seekpoint</span> option to add seekpoints to an existing FLAC file. Includes new <span class="argument">--add-seekpoint=#s</span> flavor to add seekpoints every '#' number of seconds.
XMMS plugin:
* Configurable sample resolution conversion with dither.
* ReplayGain support with customizable noise shaping, pre-amp, and optional hard limiter.
* New Vorbis comment editor.
* File info now works.
* Bitrate now shows the smoothed instantaneous bitrate.
* Uses the ARTIST tag if there is no PERFORMER tag.
Winamp2 plugin:
* Configurable sample resolution conversion with dither.
* ReplayGain support with customizable noise shaping, pre-amp, and optional hard limiter.
* File info now works.
* Uses the ARTIST tag if there is no PERFORMER tag.
Libraries (developers take note!):
* All code and tests are instrumented for Valgrind. All tests run Valgrind-clean, meaning no memory leaks or buffer over/under-runs.
* Separate 64-bit datapath through the filter in <span class="commandname">libFLAC</span> for better compression of >16 bps files.
* <span class="code">FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT)</span> now sets the vendor string.
* The documentation on the usage of <span class="code">FLAC::Iterator::get_block()</span> in <span class="commandname">libFLAC++</span> has an important correction. If you use this class make sure to read [this](https://xiph.org/flac/api/group__flacpp__metadata__level2.html).
## FLAC 1.0.4 (24-Sep-2002)
Plugins:
* Support for Vorbis comments, ID3 v1 and v2 tags.
* Configurable title formatting and charset conversion in XMMS plugin.
* Support for 8- and 24-bit FLAC files. There is a compile-time option for raw 24-bit output or 24bps-to-16bps linear dithering (the default).
<span class="commandname">flac</span>:
* Improved option parser (now uses getopt).
* AIFF input support (thanks to Brady Patterson).
* Small decoder speedup.
* <span class="argument">--sector-align</span> now supported for raw input files.
* New -T, --tag options for adding Vorbis comments while encoding.
* New --serial-number option for use with --ogg.
* Automatically writes vendor string in Vorbis comments.
* Drastically reduced memory requirements.
* Fixed bug where extra fmt/data chunks that were supposed to be skipped were not getting skipped.
* Fixed bug in granulepos setting for Ogg FLAC streams.
* Fixed memory leak when encoding multiple files with -V.
<span class="commandname">metaflac</span>:
* UTF-8 support in Vorbis comments.
* New --import-vc-from and --export-vc-to commands for importing/exporting Vorbis comments from/to a file. For example, the following can be used to copy tags back and forth:
<span class="code">metaflac --export-vc-to=- --no-utf8-convert file.flac | vorbiscomment --raw -w file.ogg
vorbiscomment --raw -l file.ogg | metaflac --import-vc-from=- --no-utf8-convert file.flac
</span>
* Fixed [bug #606796](http://sourceforge.net/p/flac/bugs/54/) where <span class="commandname">metaflac</span> was failing on read-only files.
Libraries:
* All APIs now meticulously documented via Doxygen. [See here](https://xiph.org/flac/api/index.html).
* New <span class="commandname">libOggFLAC</span> and <span class="commandname">libOggFLAC++</span> libraries. These wrap around <span class="commandname">libFLAC</span> to provide encoding and decoding of Ogg FLAC streams, providing interfaces similar to the ones of the native FLAC libraries. These are also documented via Doxygen.
* New FLAC__SeekableStreamEncoder and FLAC__FileEncoder in <span class="commandname">libFLAC</span> simplify common encoding tasks.
* New verify mode in all encoders.
* FLAC__stream_encoder_finish() now resets the defaults just like the stream decoders.
* Drastically reduced memory requirements of encoders and decoders.
* Encoder now automatically writes vendor string in VORBIS_COMMENT block.
* Encoding speedup of fixed predictors and MD5 speedup for 16bps mono/stereo signals on x86 (thanks to Miroslav Lichvar).
* Fixed bug in metadata interface where a bps in STREAMINFO > 16 was incorrectly parsed.
* Fixed bug where aborting stream decoder could cause infinite loop.
* Behavior change: simplified decoder \*_process() commands.
* Behavior change: calling FLAC__stream_encoder_init() calls write callback once for "fLaC" signature and once for each metadata block.
* Behavior change: deprecated do_escape_coding and rice_parameter_search_distance in encoder.
## FLAC 1.0.3 (03-Jul-2002)
New features:
* 24-bit input support restored in <span class="commandname">flac</span>.
* Decoder speedup in <span class="commandname">libFLAC</span>, which is directly passed on to the command-line decoder and plugins.
* New <span class="argument">-F</span> option to <span class="commandname">flac</span> to continue decoding in spite of errors.
* Correctly set granulepos in Ogg packets so seeking Ogg FLAC streams will be easier.
* New [VORBIS_COMMENT](https://xiph.org/flac/format.html#metadata_block_vorbis_comment) metadata block for tagging with Vorbis-style comments.
* Vastly improved <span class="commandname">metaflac</span>, now with many editing and tagging options.
* Partial id3v1 support in Winamp plugins.
* Updated Winamp 3 plugin.
* Note: new semantics for -P option in <span class="commandname">flac</span>.
* Note: removed -R option in <span class="commandname">flac</span>.
New library features:
* Previously mentioned decoder speedup in <span class="commandname">libFLAC</span>.
* New metadata interface to <span class="commandname">libFLAC</span> for manipulating metadata in FLAC files.
* New <span class="commandname">libFLAC++</span> API, an object wrapper around <span class="commandname">libFLAC</span>.
* New [VORBIS_COMMENT](https://xiph.org/flac/format.html#metadata_block_vorbis_comment) metadata block for tagging with Vorbis-style comments.
* Customizable metadata filtering by type in decoders.
* Stream encoder can take an arbitrary list of metadata blocks, instead of just one SEEKTABLE and/or PADDING block.
Bugs fixed:
* Fixed bug with using pipes under Windows.
* Fixed several bugs in the plugins and made them more robust in general.
* Fixed bug in <span class="commandname">flac</span> where decoding to WAVE of a FLAC file with 0 for total_samples in the STREAMINFO block yielded a WAVE chunk of 0 size.
* Fixed bug in Ogg packet numbering.
## FLAC 1.0.2 (03-Dec-2001)
* This release is only to fix a bug that was causing some of the plugins to crash sporadically. It can also affect <span class="commandname">libFLAC</span> users that reuse one file decoder instance for multiple files
## FLAC 1.0.1 (14-Nov-2001)
New features for users:
* Support for Ogg-FLAC, i.e. <span class="commandname">flac</span> can now read and write FLAC streams using Ogg as the transport layer.
* New Winamp 3 plugin based on the Wasabi Beta 1 SDK.
* New utilities for adding FLAC support to the Monkey's Audio GUI (see [how](https://xiph.org/flac/documentation_tasks.html#monkey)).
* Mac OS X support. The download area now contains an OS X binary release.
* Mingw32 support.
* Better handling of MS-specific 'fmt' chunks in WAVE files.
New features for developers:
* Added a SeekableStreamDecoder layer between StreamDecoder and FileDecoder. This makes it easier to use libFLAC in situations where files have been abstracted away. See the latest [documentation](https://xiph.org/flac/api/index.html) for more. The interface for the StreamDecoder and FileDecoder remain the same and are still binary-compatible with libFLAC 1.0.
* Drastically reduced the stack requirements of the encoder.
Bug fixes:
* Fixed a serious bug with <span class="commandname">flac</span> and raw input where the encoder was trying to rewind when it shouldn't, which would add 12 junk samples to the encoded file. This was not present in WAVE encoding.
* Fixed a minor bug in <span class="commandname">libFLAC</span> with setting the file name to stdin on a file decoder.
* Fixed a minor bug in <span class="commandname">libFLAC</span> where multiple calls to setting the file name on a file decoder caused leaked memory.
* Fixed a minor bug in <span class="commandname">metaflac</span>, now correctly skips an id3v2 tag if present.
* Fixed a minor bug in <span class="commandname">metaflac</span>, now correctly skips long metadata blocks.
## FLAC 1.0 (20-Jul-2001)
It's finally here. There are a few new features but mostly it is minor bug fixes since 0.10:
* New '--sector-align' option to <span class="commandname">flac</span> which aligns a group of encoded files on CD audio sector boundaries.
* New '--output-prefix' option to <span class="commandname">flac</span> to allow the user to prepend a prefix to all output filenames (useful, for example, for encoding/decoding to a different directory).
* Better WAVE autodetection (doesn't rely on ungetc() anymore).
* Cleaner one-line encoding/decoding stats.
* Changes to the libFLAC interface and type names to make binary compatibility easier to maintain in the future.
* New '--sse-os' option to 'configure' to enable faster SSE-based routines.
* Another (hopefully last) fix to the Winamp 2 plugin.
* Slightly improved Rice parameter estimation.
* Bug fixes for some very rare corner cases when encoding.
## FLAC 0.10 (07-Jun-2001)
This is probably the final beta. There have been many improvements in the last two months:
* Both the encoder and decoder have been significantly sped up. Aside from C improvements, the code base now has an assembly infrastructure that allows assembly routines for different architectures to be easily integrated. Many key routines have now have faster IA-32 implementations (thanks to Miroslav).
* A new metadata block [SEEKTABLE](https://xiph.org/flac/format.html#def_SEEKTABLE) has been defined to hold an arbitrary number of seek points, which speeds up seeking within a stream.
* <span class="commandname">flac</span> now has a command-line usage similar to 'gzip'; make sure to see the latest [documentation](https://xiph.org/flac/documentation.html) for the new usage. It also attempts to preserve the input file's timestamp and permissions.
* The -# options in <span class="commandname">flac</span> have been tweaked to yield the best compression-to-encode-time ratios. The new default is -5.
* <span class="commandname">flac</span> can now usually autodetect WAVE files when encoding so that -fw is usually not needed when encoding from stdin.
* The WAVE reader in <span class="commandname">flac</span> now just ignores (with a warning) unsupported sub-chunks instead of aborting with an error.
* Added an option '--delete-input-file' to <span class="commandname">flac</span> which automatically deletes the input after a successful encode/decode.
* Added an option '-o' to <span class="commandname">flac</span> to force the output file name (the old usage of "flac - outputfilename" is no longer supported).
* Changed the XMMS plugin to send smaller chunks of samples (now 512) so that visualization is not slow.
* Fixed a bug in the stream decoder where the decoded samples counter got corrupted after a seek.
## FLAC 0.9 (31-Mar-2001)
Bug fixes and some new features:
* FLAC's sync code has been lengthened to 14 bits from 9 bits. This should enable a faster and more robust synchronization mechanism.
* Two reserved bits were added to the frame header.
* A CRC-16 was added to the FLAC frame footer, and the decoder now does frame integrity checking based on the CRC.
* The format now includes a new subframe field to indicate when a subblock has one or more 0 LSBs for all samples. This increases compression on some kinds of data.
* Added two options to the analysis mode, one for including the residual signal in the analysis file, and one for generating gnuplot files of each subframe's residual distribution with some statistics. See the latest [documentation](https://xiph.org/flac/documentation.html#analysis_options).
* XMMS plugin now supports 8-bit files.
* Fixed a bug in the Winamp2 plugin where the audio sounded garbled.
* Fixed a bug in the Winamp2 plugin where Winamp would hang sporadically at the end of a track (c.f. [bug #231197](http://sourceforge.net/projects/flac/&atid=113478)).
## FLAC 0.8 (05-Mar-2001)
Changes since 0.7:
* Created a new utility called <span class="commandname">metaflac</span>. It is a metadata editor for .flac files. Right now it just lists the contents of the metadata blocks but eventually it will allow update/insertion/deletion.
* Added two new metadata blocks: PADDING which has an obvious function, and APPLICATION, which is meant to be open to third party applications. See the [latest format docs](https://xiph.org/flac/format.html#def_APPLICATION) for more info, or the new [id registration page](https://xiph.org/flac/id.html).
* Added a <span class="argument">-P</span> option to <span class="commandname">flac</span> to reserve a PADDING block when encoding.
* Added support for 24-bit files to <span class="commandname">flac</span> (the FLAC format always supported it).
* Started the Winamp3 plugin.
* Greatly expanded the test suite, adding more streams (24-bit streams, noise streams, non-audio streams, more patterns) and more option combinations to the encoder. The test suite runs about 30 streams and over 5000 encodings now.
* Fixed a bug in <span class="commandname">libFLAC</span> that happened when using an exhaustive LPC coefficient quantization search with 8 bps input.
* Fixed a bug in <span class="commandname">libFLAC</span> where the error estimation in the fixed predictor could overflow.
* Fixed a bug in <span class="commandname">libFLAC</span> where LPC was attempted even when the autocorrelation coefficients implied it wouldn't help.
* Reworked the LPC coefficient quantizer, which also fixed another bug that might occur in rare cases.
* Really fixed the '-V overflow' bug (c.f. [bug #231976](http://sourceforge.net/p/flac/bugs/5/)).
* Fixed a bug in <span class="commandname">flac</span> related to the decode buffer sizing.FLAC is very close to being ready for an official release. The only known problems left are with the Winamp plugins, which should be fixed soon, and pipes with MSVC.
## FLAC 0.7 (12-Feb-2001)
Changes:
* Fixed a bug that happened when both -fr and --seek were used at the same time.
* Fixed a bug with -p (c.f. [bug #230992](http://sourceforge.net/p/flac/bugs/1/)).
* Fixed a bug that happened when using large (>32K) blocksizes and -V (c.f. [bug #231976](http://sourceforge.net/p/flac/bugs/5/)).
* Fixed a bug where encoder was double-closing a file.
* Expanded the test suite.
* Added more optimization flags for gcc, which should speed up flac.
## FLAC 0.6 (28-Jan-2001)
The encoder is now much faster. The -m option has been sped up by 4x and -r improved, meaning that in the default compression mode (-6), encoding should be at least 3 times faster. Other changes:
* Some bugs related to <span class="commandname">flac</span> and pipes were fixed
* A "loose mid-side" (<span class="argument">-M</span>) option to the encoder has been added, which adaptively switches between independent and mid-side coding, instead of the exhaustive search that <span class="argument">-m</span> does.
* An analyze mode (<span class="argument">-a</span>) has been added to <span class="commandname">flac</span>. This is useful mainly for developers; currently it will dump info about each frame and subframe to a file. It's a text file in a format that can be easily processed by scripts; a separate analysis program is in the works.
* The source now has an autoconf/libtool-based build system. This should allow the source to build "out-of-the-box" on many more platforms.
## FLAC 0.5 (15-Jan-2001)
This is the first beta version of FLAC. Being beta, there will be no changes to the format that will break older streams, unless a serious bug involving the format is found. What this means is that, barring such a bug, streams created with 0.5 will be decodable by future versions. This version also includes some new features:
* An [MD5 signature](http://userpages.umbc.edu/~mabzug1/cs/md5/md5.html) of the unencoded audio is computed during encoding, and stored in the Encoding metadata block in the stream header. When decoding, <span class="commandname">flac</span> will now compute the MD5 signature of the decoded data and compare it against the signature in the stream header.
* A test mode (<span class="argument">-t</span>) has been added to <span class="commandname">flac</span>. It works like decode mode but doesn't write an output file.
## FLAC 0.4 (23-Dec-2000)
This version fixes a bug in the constant subframe detection. More importantly, a verify option (-V) has been added to <span class="commandname">flac</span> that verifies the encoding process. With this option turned on, <span class="commandname">flac</span> will create a parallel decoder while encoding to make sure that the encoded output decodes to exactly match the original input. In this way, any unknown bug in the encoder will be caught and <span class="commandname">flac</span> will abort with an error message.

View file

@ -0,0 +1,291 @@
# 3.1 is OK for most parts. However:
# 3.3 is needed in src/libFLAC
# 3.5 is needed in src/libFLAC/ia32
# 3.9 is needed in 'doc' because of doxygen_add_docs()
cmake_minimum_required(VERSION 3.5)
if(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES OR DEFINED ENV{CFLAGS} OR DEFINED ENV{CXXFLAGS}))
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo")
endif()
project(FLAC VERSION 1.4.3) # HOMEPAGE_URL "https://www.xiph.org/flac/")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(BUILD_CXXLIBS "Build libFLAC++" ON)
option(BUILD_PROGRAMS "Build and install programs" OFF)
option(BUILD_EXAMPLES "Build and install examples" OFF)
option(BUILD_TESTING "Build tests" OFF)
option(BUILD_DOCS "Build and install doxygen documents" OFF)
option(WITH_FORTIFY_SOURCE "Enable protection against buffer overflows" ON)
option(WITH_STACK_PROTECTOR "Enable GNU GCC stack smash protection" ON)
option(INSTALL_MANPAGES "Install MAN pages" OFF)
option(INSTALL_PKGCONFIG_MODULES "Install PkgConfig modules" ON)
option(INSTALL_CMAKE_CONFIG_MODULE "Install CMake package-config module" ON)
option(WITH_OGG "ogg support (default: test for libogg)" OFF)
option(BUILD_SHARED_LIBS "Build shared instead of static libraries" OFF)
set(VERSION ${PROJECT_VERSION})
if(NOT UNIX)
# This is to make sure testing works when building with a DLL
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/objs)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/objs)
endif()
if(WITH_OGG)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ogg")
add_subdirectory("ogg")
set(OGG_FOUND 1 CACHE INTERNAL "ogg has been added as subdirectory")
set_target_properties(ogg PROPERTIES FOLDER Libraries)
if(BUILD_TESTING)
set_target_properties(test_bitwise test_framing PROPERTIES FOLDER Tests)
endif()
else()
if(NOT TARGET Ogg::ogg)
find_package(Ogg REQUIRED)
else()
set(OGG_FOUND 1 CACHE INTERNAL "ogg has already been built")
endif()
set(OGG_PACKAGE "ogg")
endif()
endif()
find_program (HAVE_GIT git)
if(HAVE_GIT)
execute_process(
COMMAND git --git-dir=.git describe --tags --exact-match
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(
COMMAND git --git-dir=.git log -1 --pretty=format:%h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(
COMMAND git --git-dir=.git log -1 --pretty=format:%cd --date=format:%Y%m%d
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
endif()
if(NOT WIN32)
find_package(Iconv)
set(HAVE_ICONV ${Iconv_FOUND})
endif()
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_C_FLAGS "-Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Winline ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "-DNDEBUG ${CMAKE_C_FLAGS_RELEASE}")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef ${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${CMAKE_CXX_FLAGS_RELEASE}")
endif()
if(MSVC)
set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /Oi /Ot /Oy /DNDEBUG ${CMAKE_C_FLAGS_RELEASE}")
endif()
include(CMakePackageConfigHelpers)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
include(CheckCXXSourceCompiles)
include(CheckLibraryExists)
include(GNUInstallDirs)
include(UseSystemExtensions)
include(TestBigEndian)
enable_testing()
check_include_file("byteswap.h" HAVE_BYTESWAP_H)
check_include_file("inttypes.h" HAVE_INTTYPES_H)
check_include_file("stdint.h" HAVE_STDINT_H)
check_include_file("stdbool.h" HAVE_STDBOOL_H)
check_include_file("arm_neon.h" FLAC__HAS_NEONINTRIN)
if(NOT HAVE_STDINT_H OR NOT HAVE_STDBOOL_H)
message(SEND_ERROR "Header stdint.h and/or stdbool.h not found")
endif()
if(MSVC)
check_include_file("intrin.h" FLAC__HAS_X86INTRIN)
else()
check_include_file("x86intrin.h" FLAC__HAS_X86INTRIN)
endif()
check_function_exists(fseeko HAVE_FSEEKO)
check_c_source_compiles("int main() { return __builtin_bswap16 (0) ; }" HAVE_BSWAP16)
check_c_source_compiles("int main() { return __builtin_bswap32 (0) ; }" HAVE_BSWAP32)
check_c_source_compiles("
#include <langinfo.h>
int main()
{
char* cs = nl_langinfo(CODESET);
return !cs;
}"
HAVE_LANGINFO_CODESET)
test_big_endian(CPU_IS_BIG_ENDIAN)
check_c_compiler_flag(-Werror HAVE_WERROR_FLAG)
check_c_compiler_flag(-Wdeclaration-after-statement HAVE_DECL_AFTER_STMT_FLAG)
check_c_compiler_flag(-mstackrealign HAVE_STACKREALIGN_FLAG)
check_cxx_compiler_flag(-Weffc++ HAVE_WEFFCXX_FLAG)
if(MINGW AND (WITH_FORTIFY_SOURCE OR WITH_STACK_PROTECTOR))
check_library_exists("ssp.a" __stack_chk_fail "" HAVE_LIBSSP)
if(NOT HAVE_LIBSSP)
message(WARNING "Could not find libssp in MinGW, stack protection and/or FORTIFY_SOURCE are unavailable")
else()
link_libraries("ssp.a")
endif()
elseif(NOT MSVC)
set(HAVE_LIBSSP 1)
endif()
if(WITH_STACK_PROTECTOR)
if(NOT MSVC)
check_c_compiler_flag("-fstack-protector-strong" HAVE_STACK_PROTECTOR_FLAG)
endif()
endif()
if(HAVE_WERROR_FLAG)
option(ENABLE_WERROR "Enable -Werror in all Makefiles" OFF)
endif()
add_compile_options(
$<$<BOOL:${MSVC}>:/wd4267>
$<$<BOOL:${MSVC}>:/wd4996>
$<$<BOOL:${ENABLE_WERROR}>:-Werror>
$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<BOOL:${HAVE_WEFFCXX_FLAG}>>:-Weffc++>
$<$<AND:$<COMPILE_LANGUAGE:C>,$<BOOL:${HAVE_DECL_AFTER_STMT_FLAG}>>:-Wdeclaration-after-statement>)
if(WITH_FORTIFY_SOURCE AND HAVE_LIBSSP)
add_definitions(-D_FORTIFY_SOURCE=2)
endif()
if(HAVE_STACK_PROTECTOR_FLAG AND HAVE_LIBSSP)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-fstack-protector-strong>)
endif()
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND HAVE_STACKREALIGN_FLAG)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-mstackrealign>)
endif()
include_directories("include")
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
add_definitions(-DHAVE_CONFIG_H)
if(MSVC)
add_definitions(
-D_CRT_SECURE_NO_WARNINGS
-D_USE_MATH_DEFINES)
endif()
if(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
add_definitions(-DFLAC__OVERFLOW_DETECT)
endif()
add_subdirectory("src")
add_subdirectory("microbench")
if(BUILD_DOCS)
add_subdirectory("doc")
endif()
if(BUILD_EXAMPLES)
add_subdirectory("examples")
endif()
if(BUILD_TESTING)
add_subdirectory("test")
endif()
# The following folder layout is mostly for MSVC
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_target_properties(FLAC grabbag getopt replaygain_analysis replaygain_synthesis utf8 PROPERTIES FOLDER Libraries)
if(BUILD_CXXLIBS)
set_target_properties(FLAC++ PROPERTIES FOLDER Libraries)
endif()
if(BUILD_PROGRAMS)
set_target_properties(flacapp metaflac PROPERTIES FOLDER Programs)
endif()
if(BUILD_TESTING)
set_target_properties(test_libFLAC test_libs_common test_picture test_seeking test_streams test_cuesheet PROPERTIES FOLDER Tests)
if(BUILD_CXXLIBS)
set_target_properties(test_libFLAC++ PROPERTIES FOLDER Tests)
endif()
endif()
if(BUILD_EXAMPLES)
set_target_properties(decode_file encode_file PROPERTIES FOLDER Examples)
if(BUILD_CXXLIBS)
set_target_properties(decode_file_cxx encode_file_cxx PROPERTIES FOLDER Examples)
endif()
endif()
if(BUILD_UTILS)
set_target_properties(flacdiff flactimer PROPERTIES FOLDER Utils)
endif()
configure_file(config.cmake.h.in config.h)
if(INSTALL_CMAKE_CONFIG_MODULE)
install(
EXPORT targets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
NAMESPACE FLAC::)
export(EXPORT targets NAMESPACE FLAC:: FILE FLACTargets.cmake)
configure_package_config_file(
${PROJECT_SOURCE_DIR}/flac-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/flac-config.cmake
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/flac-config-version.cmake COMPATIBILITY AnyNewerVersion)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/flac-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/flac-config-version.cmake
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/flac-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/flac-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
endif()
file(GLOB FLAC_HEADERS "include/FLAC/*.h")
file(GLOB FLAC++_HEADERS "include/FLAC++/*.h")
install(FILES ${FLAC_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/FLAC")
install(FILES ${FLAC++_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/FLAC++")
if(INSTALL_MANPAGES)
find_program (HAVE_PANDOC pandoc)
if(HAVE_PANDOC)
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/man")
add_custom_command(
OUTPUT man/flac.1
COMMAND pandoc --standalone --to man "${CMAKE_SOURCE_DIR}/man/flac.md" > man/flac.1
)
add_custom_command(
OUTPUT man/metaflac.1
COMMAND pandoc --standalone --to man "${CMAKE_SOURCE_DIR}/man/metaflac.md" > man/metaflac.1
)
add_custom_target(man ALL DEPENDS man/flac.1 man/metaflac.1)
install(FILES "${CMAKE_BINARY_DIR}/man/flac.1" "${CMAKE_BINARY_DIR}/man/metaflac.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
else()
if(EXISTS "${CMAKE_SOURCE_DIR}/man/flac.1" AND EXISTS "${CMAKE_SOURCE_DIR}/man/metaflac.1")
install(FILES "man/flac.1" "man/metaflac.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1")
else()
message(SEND_ERROR "Pandoc nor prebuild manpages are found. Cannot install manpages. Set INSTALL_MANPAGES to OFF to build without man pages")
endif()
endif()
endif()

View file

@ -0,0 +1,74 @@
Thanks for considering contributing to the FLAC project!
Contributing to FLAC is possible in many ways. Among them are
- Reporting bugs or other issues at https://github.com/xiph/flac/issues
- Submitting patches at https://github.com/xiph/flac/pulls
- Testing FLAC playing devices and software at
https://wiki.hydrogenaud.io/index.php?title=FLAC_decoder_testbench
General communication not specific to issues is generally done through
the FLAC mailing lists:
- For user questions and discussions:
https://lists.xiph.org/mailman/listinfo/flac
- For developer questions and discussions:
https://lists.xiph.org/mailman/listinfo/flac-dev
## Goals
Since FLAC is an open-source project, it's important to have a set of
goals that everyone works to. They may change slightly from time to time
but they're a good guideline. Changes should be in line with the goals
and should not attempt to embrace any of the anti-goals.
**Goals**
- FLAC should be and stay an open format with an open-source reference
implementation.
- FLAC should be lossless. This seems obvious but lossy compression
seems to creep into every audio codec. This goal also means that flac
should stay archival quality and be truly lossless for all input.
Testing of releases should be thorough.
- FLAC should yield respectable compression, on par or better than other
lossless codecs.
- FLAC should allow at least realtime decoding on even modest hardware.
- FLAC should support fast sample-accurate seeking.
- FLAC should allow gapless playback of consecutive streams. This follows from the lossless goal.
- The FLAC project owes a lot to the many people who have advanced the
audio compression field so freely, and aims also to contribute through
the open-source development of new ideas.
**Anti-goals**
- Lossy compression. There are already many suitable lossy formats (Ogg
Vorbis, MP3, etc.).
- Copy prevention, DRM, etc. There is no intention to add any copy
prevention methods. Of course, we can't stop someone from encrypting a
FLAC stream in another container (e.g. the way Apple encrypts AAC in
MP4 with FairPlay), that is the choice of the user.
## Contributing patches
Contributions to FLAC should be licensed with the same license as the
part of the FLAC project the contribution belongs to. These are
- libFLAC and libFLAC++ are licensed under Xiph.org's
BSD-like license (see COPYING.Xiph), so contributions to these
libraries should also be licensed under this license, otherwise they
cannot be accepted
- the flac and metaflac command line programs are licensed under GPLv2,
see COPYING.GPL
- the helper libraries for flac and metaflac (which are in src/share)
are licensed under varying licenses, see the license preamble for each
file to see how they are licensed
Patches can be contributed through GitHub as a Pull Request.
Alternatively you can supply patches through the mailing list.
## Code style
FLAC does have its own peculiar coding style that does not seem to fit
general categories. You can use `git clang-format` to have your patch
auto-formatted similar to the rest of the code.

397
Engine/lib/flac/COPYING.FDL Normal file
View file

@ -0,0 +1,397 @@
GNU Free Documentation License
Version 1.2, November 2002
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document", below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as "you". You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (Thus, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML, PostScript or PDF designed for human modification. Examples of
transparent image formats include PNG, XCF and JPG. Opaque formats
include proprietary formats that can be read and edited only by
proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as "Acknowledgements",
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
of such a section when you modify the Document means that it remains a
section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the section all
the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements"
or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History"
in the various original documents, forming one section Entitled
"History"; likewise combine any sections Entitled "Acknowledgements",
and any sections Entitled "Dedications". You must delete all sections
Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an "aggregate" if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements",
"Dedications", or "History", the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.

339
Engine/lib/flac/COPYING.GPL Normal file
View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View file

@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View file

@ -0,0 +1,29 @@
Copyright (C) 2000-2009 Josh Coalson
Copyright (C) 2011-2023 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.

View file

@ -0,0 +1,61 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2001-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
#
# automake provides the following useful targets:
#
# all: build all programs and libraries using the current
# configuration (set by configure)
#
# check: build and run all self-tests
#
# clean: remove everything except what's required to build everything
#
# distclean: remove everything except what goes in the distribution
#
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = doc include m4 man src test microbench oss-fuzz
if EXAMPLES
SUBDIRS += examples
endif
EXTRA_DIST = \
CMakeLists.txt \
config.cmake.h.in \
flac-config.cmake.in \
cmake/CheckA64NEON.c.in \
cmake/CheckA64NEON.cmake \
cmake/CheckCPUArch.c.in \
cmake/CheckCPUArch.cmake \
cmake/FindOgg.cmake \
cmake/UseSystemExtensions.cmake \
CHANGELOG.md \
COPYING.FDL \
COPYING.GPL \
COPYING.LGPL \
COPYING.Xiph \
README.md \
autogen.sh \
config.rpath \
depcomp \
ltmain.sh
CLEANFILES = *~

278
Engine/lib/flac/README.md Normal file
View file

@ -0,0 +1,278 @@
<!---
/* FLAC - Free Lossless Audio Codec
* Copyright (C) 2001-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This file is part the FLAC project. FLAC is comprised of several
* components distributed under different licenses. The codec libraries
* are distributed under Xiph.Org's BSD-like license (see the file
* COPYING.Xiph in this distribution). All other programs, libraries, and
* plugins are distributed under the LGPL or GPL (see COPYING.LGPL and
* COPYING.GPL). The documentation is distributed under the Gnu FDL (see
* COPYING.FDL). Each file in the FLAC distribution contains at the top the
* terms under which it may be distributed.
*
* Since this particular file is relevant to all components of FLAC,
* it may be distributed under the Xiph.Org license, which is the least
* restrictive of those mentioned above. See the file COPYING.Xiph in this
* distribution.
*/
--->
# Free Lossless Audio Codec (FLAC)
FLAC is open source software that can reduce the amount of storage space
needed to store digital audio signals without needing to remove
information in doing so.
The files read and produced by this software are called FLAC files. As
these files (which follow the [FLAC format](https://xiph.org/flac/format.html))
can be read from and written to by other software as well, this software
is often referred to as the FLAC reference implementation.
FLAC has been developed by volunteers. If you want to help out, see
CONTRIBUTING.md for more information.
## Components
FLAC is comprised of
* libFLAC, a library which implements reference encoders and
decoders for native FLAC and Ogg FLAC, and a metadata interface
* libFLAC++, a C++ object wrapper library around libFLAC
* `flac`, a command-line program for encoding and decoding files
* `metaflac`, a command-line program for viewing and editing FLAC
metadata
* user and API documentation
The libraries (libFLAC, libFLAC++) are licensed under Xiph.org's
BSD-like license (see COPYING.Xiph). All other programs and plugins are
licensed under the GNU General Public License (see COPYING.GPL). The
documentation is licensed under the GNU Free Documentation License
(see COPYING.FDL).
## Documentation
For documentation of the `flac` and `metaflac` command line tools, see
the directory man, which contains the files flac.md and metaflac.md
The API documentation is in html and is generated by Doxygen. It can be
found in the directory doc/html/api. It is included in a release tarball
and must be build with Doxygen when the source is taken directly from
git.
The directory examples contains example source code on using libFLAC and
libFLAC++.
Documentation concerning the FLAC format itself (which can be used to
create software reading and writing FLAC software independent from
libFLAC) was included in previous releases, but can now be found on
https://datatracker.ietf.org/doc/draft-ietf-cellar-flac/ Additionally
a set of files for conformance testing called the FLAC decoder testbench
can be found at https://github.com/ietf-wg-cellar/flac-test-files
If you have questions about FLAC that this document does not answer,
please submit them at the following tracker so this document can be
improved:
https://github.com/xiph/flac/issues
## Building FLAC
All components of the FLAC project can be build with a variety of
compilers (including GCC, Clang, Visual Studio, Intel C++ Compiler) on
many architectures (inluding x86, x86_64, ARMv7, ARMv8 and PowerPC)
for many different operating systems.
To do this, FLAC provides two build systems: one using GNU's autotools
and one with CMake. Both differ slighly in configuration options, but
should be considered equivalent for most use cases.
FLAC used to provide files specifically for building with Visual Studio,
but these have been removed in favor of using CMake.
## Building with CMake
CMake is a cross-platform build system. FLAC can be built on Windows,
Linux, Mac OS X using CMake.
You can use either CMake's CLI or GUI. We recommend you to have a
separate build folder outside the repository in order to not spoil it
with generated files. It is possible however to do a so-called in-tree
build, in that case /path/to/flac-build in the following examples is
equal to /path/to/flac-source.
### CMake CLI
Go to your build folder and run something like this:
```
/path/to/flac-build$ cmake /path/to/flac-source
```
or e.g. in Windows shell
```
C:\path\to\flac-build> cmake \path\to\flac-source
```
(provided that cmake is in your %PATH% variable)
That will generate build scripts for the default build system (e.g.
Makefiles for UNIX). After that you start build with a command like
this:
```
/path/to/flac-build$ make
```
And afterwards you can run tests or install the built libraries and
headers
```
/path/to/flac-build$ make test
/path/to/flac-build$ make install
```
If you want use a build system other than default add -G flag to cmake,
e.g.:
```
/path/to/flac-build$ cmake /path/to/flac-source -GNinja
/path/to/flac-build$ ninja
```
or:
```
/path/to/flac-build$ cmake /path/to/flac-source -GXcode
```
Use cmake --help to see the list of available generators.
By default CMake will search for OGG. If CMake fails to find it you can
help CMake by specifying the exact path:
```
/path/to/flac-build$ cmake /path/to/flac-source -DOGG_ROOT=/path/to/ogg
```
If you would like CMake to build OGG alongside FLAC, you can place the
ogg sources directly in the flac source directory as a subdirectory with
the name ogg, for example:
```
/path/to/flac-source/ogg
```
If you don't want to build flac with OGG support you can tell CMake not
to look for OGG:
```
/path/to/flac-build$ cmake /path/to/flac-source -DWITH_OGG=OFF
```
Other FLAC's options (e.g. building C++ lib or docs) can also be put to
cmake through -D flag. If you want to know what options are available,
use -LH:
```
/path/to/flac-build$ cmake /path/to/flac-source -LH
```
### CMake GUI (for Visual Studio)
It is likely that you would prefer to use the CMake GUI if you use
Visual Studio to build FLAC. It's in essence the same process as
building using CLI.
Open cmake-gui. In the window select a source directory (the
repository's root), a build directory (some other directory outside the
repository). Then press button "Configure". CMake will ask you which
build system you prefer. Choose that version of Visual Studio which you
have on your system, choose whether you want to build for Win32 or x64.
Press OK.
After CMake finishes you can change the configuration to your liking and
if you change anything, run Configure again. With the "Generate" button,
CMake creates Visual Studio files, which can be opened from Visual
Studio. With the button "Open Project" CMake will launch Visual Studio
and open the generated solution. You can use the project files as usual
but remember that they were generated by CMake. That means that your
changes (e.g. some additional compile flags) will be lost when you run
CMake next time.
CMake searches by default for OGG on your system and returns an error
if it cannot find it. If you want to build OGG alongside FLAC, you can
download the OGG sources and extract them in a subdirectory of the FLAC
source directory with the name ogg (i.e. /path/to/flac-source/ogg)
before running CMake. If you don't want to build FLAC with OGG support,
untick the box following WITH_OGG flag in the list of variables in
cmake-gui window and run "Configure" again.
If CMake fails to find MSVC compiler then running cmake-gui from MS
Developer comand prompt should help.
## Building with GNU autotools
FLAC uses autoconf and libtool for configuring and building. To
configure a build, open a commmand line/terminal and run `./configure`
You can provide options to this command, which are listed by running
`./configure --help`.
In case the configure script is not present (for example when building
from git and not from a release tarball), it can be generated by running
`./autogen.sh`. This may require a libtool development package though.
After configuration, build with `make`, verify the build with
`make check` and install with `make install`. Installation might require
administrator priviledged, i.e. `sudo make install`.
The 'make check' step is optional; omit it to skip all the tests, which
can take about an hour to complete. Even though it will stop with an
explicit message on any failure, it does print out a lot of stuff so you
might want to capture the output to a file if you're having a problem.
Also, don't run 'make check' as root because it confuses some of the
tests.
Summarizing:
```
./configure
make && make check
sudo make install
```
## Note to embedded developers
libFLAC has grown larger over time as more functionality has been
included, but much of it may be unnecessary for a particular embedded
implementation. Unused parts may be pruned by some simple editing of
configure.ac and src/libFLAC/Makefile.am; the following dependency
graph shows which modules may be pruned without breaking things
further down:
```
metadata.h
stream_decoder.h
format.h
stream_encoder.h
stream_decoder.h
format.h
stream_decoder.h
format.h
```
In other words, for pure decoding applications, both the stream encoder
and metadata editing interfaces can be safely removed. Note that this
is specific to building the libraries for embedded use. The command line
tools do not provide such compartmentalization, and require a complete
libFLAC build to function.
There is a section dedicated to embedded use in the libFLAC API
HTML documentation (see doc/html/api/index.html).
Also, there are several places in the libFLAC code with comments marked
with "OPT:" where a #define can be changed to enable code that might be
faster on a specific platform. Experimenting with these can yield
faster binaries.

View file

@ -0,0 +1,66 @@
#!/bin/sh
# Run this to set up the build system: configure, makefiles, etc.
# We trust that the user has a recent enough autoconf & automake setup
# (not older than a few years...)
use_symlinks=" --symlink"
case $1 in
--no-symlink*)
use_symlinks=""
echo "Copying autotool files instead of using symlinks."
;;
*)
echo "Using symlinks to autotool files (use --no-symlinks to copy instead)."
;;
esac
test_program_errors=0
test_program () {
if ! command -v $1 >/dev/null 2>&1 ; then
echo "Missing program '$1'."
test_program_errors=1
fi
}
for prog in autoconf automake libtool pkg-config ; do
test_program $prog
done
if test $(uname -s) != "Darwin" ; then
test_program gettext
fi
test $test_program_errors -ne 1 || exit 1
#-------------------------------------------------------------------------------
set -e
if test $(uname -s) = "OpenBSD" ; then
# OpenBSD needs these environment variables set.
if test -z "$AUTOCONF_VERSION" ; then
AUTOCONF_VERSION=2.69
export AUTOCONF_VERSION
echo "Defaulting to use AUTOCONF_VERSION version ${AUTOCONF_VERSION}."
else
echo "Using AUTOCONF_VERSION version ${AUTOCONF_VERSION}."
fi
if test -z "$AUTOMAKE_VERSION" ; then
AUTOMAKE_VERSION=1.15
export AUTOMAKE_VERSION
echo "Defaulting to use AUTOMAKE_VERSION version ${AUTOMAKE_VERSION}."
else
echo "Using AUTOMAKE_VERSION version ${AUTOMAKE_VERSION}."
fi
fi
srcdir=`dirname $0`
test -n "$srcdir" && cd "$srcdir"
echo "Updating build configuration files for FLAC, please wait...."
touch config.rpath
autoreconf --install $use_symlinks --force
#./configure "$@" && echo

View file

@ -0,0 +1,6 @@
#include <arm_neon.h>
int main (void)
{
float64x2_t tmp;
tmp = vdupq_n_f64(0.0f);
}

View file

@ -0,0 +1,14 @@
macro(CHECK_A64NEON VARIABLE)
if(NOT DEFINED HAVE_${VARIABLE})
message(STATUS "Check whether A64 NEON can be used")
configure_file(${PROJECT_SOURCE_DIR}/cmake/CheckA64NEON.c.in ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckA64NEON.c @ONLY)
try_compile(HAVE_${VARIABLE} "${PROJECT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckA64NEON.c")
if(HAVE_${VARIABLE})
message(STATUS "Check whether A64 NEON can be used - yes")
set(${VARIABLE} 1 CACHE INTERNAL "Result of CHECK_A64NEON" FORCE)
else ()
message(STATUS "Check whether A64 NEON can be used - no")
endif()
endif ()
endmacro(CHECK_A64NEON)

View file

@ -0,0 +1,7 @@
int main(void) {
#if @CHECK_CPU_ARCH_DEFINES@
return 0;
#else
fail
#endif
}

View file

@ -0,0 +1,27 @@
macro(_CHECK_CPU_ARCH ARCH ARCH_DEFINES VARIABLE)
if(NOT DEFINED HAVE_${VARIABLE})
message(STATUS "Check CPU architecture is ${ARCH}")
set(CHECK_CPU_ARCH_DEFINES ${ARCH_DEFINES})
configure_file(${PROJECT_SOURCE_DIR}/cmake/CheckCPUArch.c.in ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c @ONLY)
try_compile(HAVE_${VARIABLE} "${PROJECT_BINARY_DIR}"
"${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c")
if(HAVE_${VARIABLE})
message(STATUS "Check CPU architecture is ${ARCH} - yes")
set(${VARIABLE} 1 CACHE INTERNAL "Result of CHECK_CPU_ARCH" FORCE)
else ()
message(STATUS "Check CPU architecture is ${ARCH} - no")
endif()
endif ()
endmacro(_CHECK_CPU_ARCH)
macro(CHECK_CPU_ARCH_X64 VARIABLE)
_CHECK_CPU_ARCH(x64 "defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)" ${VARIABLE})
endmacro(CHECK_CPU_ARCH_X64)
macro(CHECK_CPU_ARCH_X86 VARIABLE)
_CHECK_CPU_ARCH(x86 "defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" ${VARIABLE})
endmacro(CHECK_CPU_ARCH_X86)
macro(CHECK_CPU_ARCH_ARM64 VARIABLE)
_CHECK_CPU_ARCH(arm64 "defined(__aarch64__) || defined(__arm64__)" ${VARIABLE})
endmacro(CHECK_CPU_ARCH_ARM64)

View file

@ -0,0 +1,26 @@
find_package(PkgConfig)
pkg_check_modules(_OGG QUIET ogg)
find_path(OGG_INCLUDE_DIR
NAMES "ogg/ogg.h"
PATHS ${_OGG_INCLUDE_DIRS})
find_library(OGG_LIBRARY
NAMES ogg libogg
HINTS ${_OGG_LIBRARY_DIRS})
mark_as_advanced(
OGG_INCLUDE_DIR
OGG_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Ogg
REQUIRED_VARS OGG_INCLUDE_DIR OGG_LIBRARY
VERSION_VAR _OGG_VERSION)
if(OGG_FOUND AND NOT TARGET Ogg::ogg)
add_library(Ogg::ogg UNKNOWN IMPORTED)
set_target_properties(Ogg::ogg PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIR}"
IMPORTED_LOCATION "${OGG_LIBRARY}")
endif()

View file

@ -0,0 +1,63 @@
include(CheckCSourceCompiles)
check_c_source_compiles("
#include <wchar.h>
mbstate_t x;
int main() { return 0; }"
HAVE_MBSTATE)
if(NOT HAVE_MBSTATE)
check_c_source_compiles("
#define _XOPEN_SOURCE 500
#include <wchar.h>
mbstate_t x;
int main() { return 0; }"
DODEFINE_XOPEN_SOURCE)
endif()
check_c_source_compiles("
#define __EXTENSIONS__ 1
#include <stdio.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# ifdef HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#ifdef HAVE_STRING_H
# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
int main() { return 0; }"
DODEFINE_EXTENSIONS)
add_definitions(
-D_DARWIN_C_SOURCE
-D_POSIX_PTHREAD_SEMANTICS
-D__STDC_WANT_IEC_60559_BFP_EXT__
-D__STDC_WANT_IEC_60559_DFP_EXT__
-D__STDC_WANT_IEC_60559_FUNCS_EXT__
-D__STDC_WANT_IEC_60559_TYPES_EXT__
-D__STDC_WANT_LIB_EXT2__
-D__STDC_WANT_MATH_SPEC_FUNCS__
-D_TANDEM_SOURCE)

View file

@ -0,0 +1,223 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if building universal (internal helper macro) */
#cmakedefine AC_APPLE_UNIVERSAL_BUILD
/* Target processor is big endian. */
#cmakedefine01 CPU_IS_BIG_ENDIAN
/* Target processor ARM64 */
#cmakedefine FLAC__CPU_ARM64
/* Set FLAC__BYTES_PER_WORD to 8 (4 is the default) */
#cmakedefine01 ENABLE_64_BIT_WORDS
/* define to align allocated memory on 32-byte boundaries */
#cmakedefine FLAC__ALIGN_MALLOC_DATA
/* define if you have docbook-to-man or docbook2man */
#cmakedefine FLAC__HAS_DOCBOOK_TO_MAN
/* define if you have the ogg library */
#cmakedefine01 OGG_FOUND
#define FLAC__HAS_OGG OGG_FOUND
/* Set to 1 if <x86intrin.h> is available. */
#cmakedefine01 FLAC__HAS_X86INTRIN
/* Set to 1 if <arm_neon.h> is available. */
#cmakedefine01 FLAC__HAS_NEONINTRIN
/* Set to 1 if <arm_neon.h> contains A64 intrinsics */
#cmakedefine01 FLAC__HAS_A64NEONINTRIN
/* define if building for Darwin / MacOS X */
#cmakedefine FLAC__SYS_DARWIN
/* define if building for Linux */
#cmakedefine FLAC__SYS_LINUX
/* define to enable use of AVX instructions */
#cmakedefine WITH_AVX
#ifdef WITH_AVX
#define FLAC__USE_AVX
#endif
/* Define to the commit date of the current git HEAD */
#cmakedefine GIT_COMMIT_DATE "@GIT_COMMIT_DATE@"
/* Define to the short hash of the current git HEAD */
#cmakedefine GIT_COMMIT_HASH "@GIT_COMMIT_HASH@"
/* Define to the tag of the current git HEAD */
#cmakedefine GIT_COMMIT_TAG "@GIT_COMMIT_TAG@"
/* Compiler has the __builtin_bswap16 intrinsic */
#cmakedefine HAVE_BSWAP16
/* Compiler has the __builtin_bswap32 intrinsic */
#cmakedefine HAVE_BSWAP32
/* Define to 1 if you have the <byteswap.h> header file. */
#cmakedefine HAVE_BYTESWAP_H
/* define if you have clock_gettime */
#cmakedefine HAVE_CLOCK_GETTIME
/* Define to 1 if you have the <cpuid.h> header file. */
#cmakedefine HAVE_CPUID_H
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#cmakedefine HAVE_FSEEKO
/* Define to 1 if you have the `getopt_long' function. */
#cmakedefine HAVE_GETOPT_LONG
/* Define if you have the iconv() function and it works. */
#cmakedefine HAVE_ICONV
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#cmakedefine HAVE_LANGINFO_CODESET
/* lround support */
#cmakedefine01 HAVE_LROUND
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H
/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#cmakedefine HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/param.h> header file. */
#cmakedefine HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine HAVE_SYS_TYPES_H
/* Define to 1 if you have the <termios.h> header file. */
#cmakedefine HAVE_TERMIOS_H
/* Define to 1 if typeof works with your compiler. */
#cmakedefine HAVE_TYPEOF
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H
/* Define to 1 if you have the <x86intrin.h> header file. */
#cmakedefine HAVE_X86INTRIN_H
/* Define as const if the declaration of iconv() needs const. */
#cmakedefine ICONV_CONST
/* Define if debugging is disabled */
#cmakedefine NDEBUG
/* Name of package */
#cmakedefine PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#cmakedefine PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#cmakedefine PACKAGE_NAME
/* Define to the full name and version of this package. */
#cmakedefine PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#cmakedefine PACKAGE_TARNAME
/* Define to the home page for this package. */
#cmakedefine PACKAGE_URL
/* Define to the version of this package. */
#define PACKAGE_VERSION "@PROJECT_VERSION@"
/* The size of `off_t', as computed by sizeof. */
#cmakedefine SIZEOF_OFF_T
/* The size of `void*', as computed by sizeof. */
#cmakedefine SIZEOF_VOIDP
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
#define _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifndef _XOPEN_SOURCE
#cmakedefine DODEFINE_XOPEN_SOURCE 500
#ifdef DODEFINE_XOPEN_SOURCE
#define _XOPEN_SOURCE DODEFINE_XOPEN_SOURCE
#endif
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
#cmakedefine _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
#cmakedefine _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
#cmakedefine DODEFINE_EXTENSIONS
#ifdef DODEFINE_EXTENSIONS
#define __EXTENSIONS__ DODEFINE_EXTENSIONS
#endif
#endif
/* Target processor is big endian. */
#define WORDS_BIGENDIAN CPU_IS_BIG_ENDIAN
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
#endif
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
#ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE
#endif
/* Define for large files, on AIX-style hosts. */
#cmakedefine _LARGE_FILES
/* Define to 1 if on MINIX. */
#cmakedefine _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#cmakedefine _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#cmakedefine _POSIX_SOURCE
/* Define to __typeof__ if your compiler spells it that way. */
#cmakedefine typeof

View file

@ -0,0 +1,602 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2001-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
# NOTE that for many of the AM_CONDITIONALs we use the prefix FLaC__
# instead of FLAC__ since autoconf triggers off 'AC_' in strings
AC_PREREQ(2.60)
AC_INIT([flac],[1.4.3],[flac-dev@xiph.org],[flac],[https://www.xiph.org/flac/])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/flac/main.c])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign 1.10 -Wall tar-pax no-dist-gzip dist-xz subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AX_CHECK_ENABLE_DEBUG
user_cflags=$CFLAGS
#Prefer whatever the current ISO standard is.
AC_PROG_CC
AC_USE_SYSTEM_EXTENSIONS
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
LT_INIT([win32-dll disable-static pic-only])
AM_PROG_AS
AC_PROG_CXX
XIPH_C_COMPILER_IS_CLANG
XIPH_GCC_REALLY_IS_GCC
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
AC_CHECK_SIZEOF(off_t,1) # Fake default value.
AC_CHECK_SIZEOF([void*])
AC_SEARCH_LIBS([lround],[m], [AC_DEFINE(HAVE_LROUND,1,lround support)])
AM_PROG_CC_C_O
AC_C_INLINE
AC_C_TYPEOF
AC_CHECK_HEADERS([stdint.h stdbool.h inttypes.h byteswap.h sys/auxv.h sys/param.h sys/ioctl.h termios.h x86intrin.h cpuid.h arm_neon.h])
if test "x$ac_cv_header_stdint_h" != xyes -o "x$ac_cv_header_stdbool_h" != xyes; then
AC_MSG_ERROR("Header stdint.h and/or stdbool.h not found")
fi
XIPH_C_BSWAP32
XIPH_C_BSWAP16
ac_cv_c_big_endian=0
ac_cv_c_little_endian=0
AC_C_BIGENDIAN([ac_cv_c_big_endian=1], [ac_cv_c_little_endian=1], [
AC_MSG_WARN([[*****************************************************************]])
AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]])
AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]])
AC_MSG_WARN([[*** config.h may need to be hand editied. ]])
AC_MSG_WARN([[*****************************************************************]])
])
AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
[Target processor is big endian.])
AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
[Target processor is little endian.])
AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
[Target processor is big endian.])
AC_ARG_ENABLE(asm-optimizations, AS_HELP_STRING([--disable-asm-optimizations],[Do not use any CPU specific optimization routines]), asm_opt=no, asm_opt=yes)
AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
if test "x$asm_opt" = xno ; then
AC_DEFINE(FLAC__NO_ASM)
AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
fi
dnl check for getauxval in standard library
AC_CHECK_FUNCS(getauxval)
dnl check for getopt in standard library
dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
AC_CHECK_FUNCS(getopt_long, [], [])
AC_CHECK_SIZEOF(void*,1)
asm_optimisation=no
case "$host_cpu" in
amd64|x86_64)
case "$host" in
*gnux32)
# x32 user space and 64 bit kernel.
cpu_x86_64=true
AC_DEFINE(FLAC__CPU_X86_64)
AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
;;
*)
if test $ac_cv_sizeof_voidp = 4 ; then
# This must be a 32 bit user space running on 64 bit kernel so treat
# this as ia32.
cpu_ia32=true
AC_DEFINE(FLAC__CPU_IA32)
AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
else
# x86_64 user space and kernel.
cpu_x86_64=true
AC_DEFINE(FLAC__CPU_X86_64)
AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
fi
;;
esac
;;
i*86)
cpu_ia32=true
AC_DEFINE(FLAC__CPU_IA32)
AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
;;
arm64|aarch64)
cpu_arm64=true
AC_DEFINE(FLAC__CPU_ARM64)
AH_TEMPLATE(FLAC__CPU_ARM64, [define if building for ARM])
;;
esac
AM_CONDITIONAL(FLAC__CPU_X86_64, test "x$cpu_x86_64" = xtrue)
AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
AM_CONDITIONAL(FLAC__CPU_ARM64, test "x$cpu_arm64" = xtrue)
if test "x$ac_cv_header_x86intrin_h" = xyes -a "x$asm_opt" = xyes; then
AC_DEFINE([FLAC__HAS_X86INTRIN], 1, [Set to 1 if <x86intrin.h> is available.])
asm_optimisation=yes
else
AC_DEFINE([FLAC__HAS_X86INTRIN], 0)
fi
if test "x$ac_cv_header_arm_neon_h" = xyes -a "x$asm_opt" = xyes; then
AC_DEFINE([FLAC__HAS_NEONINTRIN], 1, [Set to 1 if <arm_neon.h> is available.])
AC_MSG_CHECKING([whether arm_neon.h has A64 functions])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <arm_neon.h>]],
[[float64x2_t sum5; sum5 = vdupq_n_f64(0.0f);]])],
[AC_MSG_RESULT([yes])
has_a64neon=yes],
[AC_MSG_RESULT([no])])
if test "x$has_a64neon" = xyes; then
AC_DEFINE([FLAC__HAS_A64NEONINTRIN], 1, [Set to 1 if <arm_neon.h> has A64 instructions.])
asm_optimisation=yes
else
AC_DEFINE([FLAC__HAS_A64NEONINTRIN], 0)
fi
else
AC_DEFINE([FLAC__HAS_NEONINTRIN], 0)
fi
case "$host" in
i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
*-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
*-*-darwin*) OBJ_FORMAT=macho ;;
*emx*) OBJ_FORMAT=aout ;;
*djgpp) OBJ_FORMAT=coff ;;
*) OBJ_FORMAT=elf ;;
esac
AC_SUBST(OBJ_FORMAT)
os_is_windows=no
case "$host" in
*mingw*)
os_is_windows=yes
AC_CHECK_TOOL(RC,[windres],[:])
;;
esac
AM_CONDITIONAL(OS_IS_WINDOWS, test "x$os_is_windows" = xyes)
AM_CONDITIONAL(HAVE_WINDRES, test "x$RC" != "x:")
case "$host" in
*-linux-*)
sys_linux=true
AC_DEFINE(FLAC__SYS_LINUX)
AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
;;
*-*-darwin*)
sys_darwin=true
AC_DEFINE(FLAC__SYS_DARWIN)
AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
;;
esac
AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
if test "x$cpu_ia32" = xtrue || test "x$cpu_x86_64" = xtrue ; then
AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
fi
AM_CONDITIONAL([DEBUG], [test "x${ax_enable_debug}" = "xyes" || test "x${ax_enable_debug}" = "xinfo"])
AC_ARG_ENABLE(avx,
AS_HELP_STRING([--disable-avx],[Disable AVX, AVX2 optimizations. There is runtime detection of CPU features, so disabling is only necessary when a compiler does not know about them]),
[case "${enableval}" in
yes) use_avx=true ;;
no) use_avx=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-avx) ;;
esac],[use_avx=true])
AM_CONDITIONAL(FLaC__USE_AVX, test "x$use_avx" = xtrue)
if test "x$use_avx" = xtrue ; then
AC_DEFINE(FLAC__USE_AVX)
AH_TEMPLATE(FLAC__USE_AVX, [define to enable use of AVX instructions])
fi
AC_ARG_ENABLE(thorough-tests,
AS_HELP_STRING([--disable-thorough-tests],[Disable thorough (long) testing, do only basic tests]),
[case "${enableval}" in
yes) thorough_tests=true ;;
no) thorough_tests=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;;
esac],[thorough_tests=true])
AC_ARG_ENABLE(exhaustive-tests,
AS_HELP_STRING([--enable-exhaustive-tests],[Enable exhaustive testing (VERY long)]),
[case "${enableval}" in
yes) exhaustive_tests=true ;;
no) exhaustive_tests=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
esac],[exhaustive_tests=false])
if test "x$thorough_tests" = xfalse ; then
FLAC__TEST_LEVEL=0
elif test "x$exhaustive_tests" = xfalse ; then
FLAC__TEST_LEVEL=1
else
FLAC__TEST_LEVEL=2
fi
AC_SUBST(FLAC__TEST_LEVEL)
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror],[Enable -Werror in all Makefiles]))
AC_ARG_ENABLE([stack-smash-protection],
[AS_HELP_STRING([--disable-stack-smash-protection],[Disable GNU GCC stack smash protection])],,
[AS_IF([test "$ac_cv_c_compiler_gnu" = "yes"],
[enable_stack_smash_protection=yes],[enable_stack_smash_protection=no])])
AC_ARG_ENABLE([fortify-source],
[AS_HELP_STRING([--disable-fortify-source],[Disable _FORTIFY_SOURCE buffer overflow protection])],,
[AS_IF([test "$ac_cv_c_compiler_gnu" = "yes"],
[enable_fortify_source=yes],[enable_fortify_source=no])])
case "$host" in
*mingw*)
if test "$enable_fortify_source" = "yes"; then
AC_SEARCH_LIBS(__memset_chk, ssp, , mingw_has_memset_chk=no)
fi
if test "$enable_stack_smash_protection" = "yes"; then
AC_SEARCH_LIBS(__stack_chk_fail, ssp, , mingw_has_stack_chk_fail=no)
fi
;;
esac
AC_ARG_ENABLE(64-bit-words,
AS_HELP_STRING([--disable-64-bit-words],[Set FLAC__BYTES_PER_WORD to 4 (8 is the default)]))
if test "x$enable_64_bit_words" = xno ; then
AC_DEFINE_UNQUOTED([ENABLE_64_BIT_WORDS],0,[Set FLAC__BYTES_PER_WORD to 8 (this is the default)])
else
AC_DEFINE_UNQUOTED([ENABLE_64_BIT_WORDS],1)
fi
AC_SUBST(ENABLE_64_BIT_WORDS)
AC_ARG_ENABLE(valgrind-testing,
AS_HELP_STRING([--enable-valgrind-testing],[Run all tests inside Valgrind]),
[case "${enableval}" in
yes) FLAC__TEST_WITH_VALGRIND=yes ;;
no) FLAC__TEST_WITH_VALGRIND=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
esac],[FLAC__TEST_WITH_VALGRIND=no])
AC_SUBST(FLAC__TEST_WITH_VALGRIND)
AC_ARG_ENABLE(doxygen-docs,
AS_HELP_STRING([--disable-doxygen-docs],[Disable API documentation building via Doxygen]),
[case "${enableval}" in
yes) enable_doxygen_docs=true ;;
no) enable_doxygen_docs=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;;
esac],[enable_doxygen_docs=true])
if test "x$enable_doxygen_docs" != xfalse ; then
AC_CHECK_PROGS(DOXYGEN, doxygen)
fi
AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
if test ! -n "$DOXYGEN" && test -f "$srcdir/doc/FLAC.tag" && test -f "$srcdir/doc/api/modules.html" ; then
HAS_PREBUILT_DOXYGEN=yes
fi
AM_CONDITIONAL(FLaC__HAS_PREBUILT_DOXYGEN, test "x$HAS_PREBUILT_DOXYGEN" = xyes)
dnl build FLAC++ or not
AC_ARG_ENABLE([cpplibs],
AS_HELP_STRING([--disable-cpplibs],[Do not build libFLAC++]),
[case "${enableval}" in
yes) disable_cpplibs=false ;;
no) disable_cpplibs=true ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-cpplibs) ;;
esac], [disable_cpplibs=false])
AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test "x$disable_cpplibs" != xtrue])
AC_ARG_ENABLE([oss-fuzzers],
[AS_HELP_STRING([--enable-oss-fuzzers],
[Whether to generate the fuzzers for OSS-Fuzz (Clang only)])],
[have_oss_fuzzers=yes], [have_oss_fuzzers=no])
if test "x$have_oss_fuzzers" = "xyes"; then
if test "x$xiph_cv_c_compiler_clang" = "xyes" ; then
AM_CONDITIONAL([USE_OSSFUZZERS], [test "x$have_oss_fuzzers" = "xyes"])
if test "x$LIB_FUZZING_ENGINE" = "x" ; then
# Only set this if it is empty.
LIB_FUZZING_ENGINE=-fsanitize=fuzzer
fi
else
AM_CONDITIONAL([USE_OSSFUZZERS], [test "false" = "true"])
# Disable fuzzer if the compiler is not Clang.
AC_MSG_WARN([*** Ozz-Fuzz is disabled because that requires the Clang compiler.])
have_oss_fuzzers="no (compiler is not Clang)"
fi
else
AM_CONDITIONAL([USE_OSSFUZZERS], [test "false" = "true"])
fi
AC_SUBST([LIB_FUZZING_ENGINE])
dnl check for ogg library
AC_ARG_ENABLE([ogg],
AS_HELP_STRING([--disable-ogg],[Disable ogg support (default: test for libogg)]),
[ want_ogg=$enableval ], [ want_ogg=yes ] )
if test "x$want_ogg" != "xno"; then
XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development environment not installed - Ogg support will not be built]))
fi
FLAC__HAS_OGG=0
AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
if test "x$have_ogg" = xyes ; then
FLAC__HAS_OGG=1
OGG_PACKAGE="ogg"
else
have_ogg=no
fi
AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],$FLAC__HAS_OGG,[define if you have the ogg library])
AC_SUBST(FLAC__HAS_OGG)
AC_SUBST(OGG_PACKAGE)
dnl Build programs?
AC_ARG_ENABLE([programs],
AS_HELP_STRING([--disable-programs], [Do not build and install flac and metaflac]))
AM_CONDITIONAL(FLaC__WITH_PROGRAMS, [test "x$enable_programs" != "xno"])
dnl Build examples?
AC_ARG_ENABLE([examples],
AS_HELP_STRING([--disable-examples], [Do not build and install examples]))
AM_CONDITIONAL([EXAMPLES], [test "x$enable_examples" != "xno"])
dnl Ask git which version FLAC is
AC_ARG_ENABLE([version-from-git],
AS_HELP_STRING([--disable-version-from-git], [Do not use git tag, commit hash and commit date for version number]),
[ enable_version_from_git=$enableval ], [ enable_version_from_git=yes ])
dnl check for i18n(internationalization); these are from libiconv/gettext
AM_ICONV
AM_LANGINFO_CODESET
AC_CHECK_PROGS(PANDOC, pandoc)
AM_CONDITIONAL(FLaC__HAS_PANDOC, test -n "$PANDOC")
if test -n "$PANDOC" ; then
AC_DEFINE(FLAC__HAS_PANDOC)
AH_TEMPLATE(FLAC__HAS_PANDOC, [define if you have pandoc])
else
if test -f "$srcdir/man/flac.1" && test -f "$srcdir/man/metaflac.1" ; then
HAS_PREBUILT_MANPAGES=yes
fi
fi
AM_CONDITIONAL(FLaC__HAS_PREBUILT_MANPAGES, test "x$HAS_PREBUILT_MANPAGES" = "xyes")
AC_CHECK_LIB(rt, clock_gettime,
LIB_CLOCK_GETTIME=-lrt
AC_DEFINE(HAVE_CLOCK_GETTIME)
AH_TEMPLATE(HAVE_CLOCK_GETTIME, [define if you have clock_gettime]))
AC_SUBST(LIB_CLOCK_GETTIME)
XIPH_GCC_VERSION dnl Sets a non-zero GCC_XXX_VERSION for gcc, not clang. checks below rely on that..
if test x$ac_cv_c_compiler_gnu = xyes -o x$xiph_cv_c_compiler_clang = xyes ; then
dnl Prepend defaults to CFLAGS for GCC and Clang
AS_IF([test "x${ax_enable_debug}" = "xno"], [
CFLAGS="-O3 -funroll-loops $CFLAGS"
CXXFLAGS="-O3 $CXXFLAGS"
])
CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Winline " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Wconversion
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Woverloaded-virtual -Wmissing-declarations
XIPH_ADD_CFLAGS([-Wdeclaration-after-statement])
dnl some distributions (such as Gentoo) have _FORTIFY_SOURCE always
dnl enabled. We test for this situation in order to prevent polluting
dnl the console with messages of macro redefinitions.
if test "$enable_fortify_source" = "yes" && test "x$mingw_has_memset_chk" != "xno"
then
AX_ADD_FORTIFY_SOURCE
fi
AC_LANG_PUSH([C++])
XIPH_ADD_CXXFLAGS([-Weffc++])
AC_LANG_POP([C++])
if test x$xiph_cv_c_compiler_clang = xyes -a "$OBJ_FORMAT" = elf; then
CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
CFLAGS="$CFLAGS -fvisibility=hidden"
CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
elif test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = elf; then
CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
CFLAGS="$CFLAGS -fvisibility=hidden"
CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
fi
if test x$xiph_cv_c_compiler_clang = xyes -a "$OBJ_FORMAT" = macho; then
CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
CFLAGS="$CFLAGS -fvisibility=hidden"
CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
elif test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = macho; then
CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
CFLAGS="$CFLAGS -fvisibility=hidden"
CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
fi
if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
XIPH_ADD_CFLAGS([-fgnu89-inline])
fi
if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x47" ; then
XIPH_ADD_CFLAGS([-fno-inline-small-functions])
fi
fi
case "$host_os" in
"mingw32"|"os2")
if test "$host_cpu" = "i686"; then
XIPH_ADD_CFLAGS([-mstackrealign])
fi
esac
if test x$enable_werror = "xyes" ; then
XIPH_ADD_CFLAGS([-Werror])
AC_LANG_PUSH([C++])
XIPH_ADD_CXXFLAGS([-Werror])
AC_LANG_POP([C++])
fi
if test x$enable_stack_smash_protection = "xyes" && test "x$mingw_has_stack_chk_fail" != "xno" ; then
XIPH_GCC_STACK_PROTECTOR
XIPH_GXX_STACK_PROTECTOR
else
enable_stack_smash_protection=no
fi
AH_VERBATIM([FLAC_API_EXPORTS],
[/* libtool defines DLL_EXPORT for windows dll builds,
but flac code relies on FLAC_API_EXPORTS instead. */
#ifdef DLL_EXPORT
#ifdef __cplusplus
# define FLACPP_API_EXPORTS
#else
# define FLAC_API_EXPORTS
#endif
#endif])
if test x$enable_static = "xyes" ; then
dnl for correct FLAC_API
CPPFLAGS="-DFLAC__NO_DLL $CPPFLAGS"
fi
AC_CHECK_PROG(GIT_FOUND,git,yes)
if test x$GIT_FOUND$enable_version_from_git = "xyesyes"; then
GIT_COMMIT_TAG=`git -C $srcdir --git-dir=.git describe --tags --exact-match 2>/dev/null`
GIT_COMMIT_HASH=`git -C $srcdir --git-dir=.git log -1 --pretty=format:%h 2>/dev/null`
GIT_COMMIT_DATE=`git -C $srcdir --git-dir=.git log -1 --pretty=format:%cd --date=format:%Y%m%d 2>/dev/null`
if test ${#GIT_COMMIT_HASH} = 8 && test ${#GIT_COMMIT_DATE} = 8; then
GIT_COMMIT_VERSION_AVAIL=yes
if test ${#GIT_COMMIT_TAG} != 0 ; then
GIT_COMMIT_TAG_AVAIL=yes
AC_DEFINE_UNQUOTED(GIT_COMMIT_TAG, "${GIT_COMMIT_TAG}", "Define to the tag of the current git HEAD")
else
GIT_COMMIT_VERSION_HASH=yes
fi
AC_DEFINE_UNQUOTED(GIT_COMMIT_HASH, "${GIT_COMMIT_HASH}", "Define to the short hash of the current git HEAD")
AC_DEFINE_UNQUOTED(GIT_COMMIT_DATE, "${GIT_COMMIT_DATE}", "Define to the commit date of the current git HEAD")
fi
fi
AC_SUBST(GIT_COMMIT_VERSION_HASH)
AX_CHECK_COMPILE_FLAG([-fassociative-math -fno-signed-zeros -fno-trapping-math -freciprocal-math],HAVE_ASSOC_MATH=yes)
AM_CONDITIONAL(ASSOC_MATH_AVAILABLE, test "x$HAVE_ASSOC_MATH" = "xyes")
AC_CONFIG_FILES([ \
Makefile \
src/Makefile \
src/libFLAC/Makefile \
src/libFLAC/flac.pc \
src/libFLAC/include/Makefile \
src/libFLAC/include/private/Makefile \
src/libFLAC/include/protected/Makefile \
src/libFLAC++/Makefile \
src/libFLAC++/flac++.pc \
src/flac/Makefile \
src/metaflac/Makefile \
src/share/Makefile \
src/test_grabbag/Makefile \
src/test_grabbag/cuesheet/Makefile \
src/test_grabbag/picture/Makefile \
src/test_libs_common/Makefile \
src/test_libFLAC/Makefile \
src/test_libFLAC++/Makefile \
src/test_seeking/Makefile \
src/test_streams/Makefile \
src/utils/Makefile \
src/utils/flacdiff/Makefile \
src/utils/flactimer/Makefile \
examples/Makefile \
examples/c/Makefile \
examples/c/decode/Makefile \
examples/c/decode/file/Makefile \
examples/c/encode/Makefile \
examples/c/encode/file/Makefile \
examples/cpp/Makefile \
examples/cpp/decode/Makefile \
examples/cpp/decode/file/Makefile \
examples/cpp/encode/Makefile \
examples/cpp/encode/file/Makefile \
include/Makefile \
include/FLAC/Makefile \
include/FLAC++/Makefile \
include/share/Makefile \
include/share/grabbag/Makefile \
include/test_libs_common/Makefile \
doc/Doxyfile \
doc/Makefile \
doc/images/Makefile \
m4/Makefile \
man/Makefile \
test/common.sh \
test/Makefile \
test/cuesheets/Makefile \
test/foreign-metadata-test-files/Makefile \
test/flac-to-flac-metadata-test-files/Makefile \
test/metaflac-test-files/Makefile \
test/pictures/Makefile \
microbench/Makefile \
oss-fuzz/Makefile
])
AC_OUTPUT
AC_MSG_RESULT([
-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
Configuration summary :
FLAC version : ............................ ${VERSION}
Host CPU : ................................ ${host_cpu}
Host Vendor : ............................. ${host_vendor}
Host OS : ................................. ${host_os}
])
if test x$GIT_COMMIT_TAG_AVAIL = xyes ; then
echo " Version string : reference libFLAC ${GIT_COMMIT_TAG} ${GIT_COMMIT_DATE}"
elif test x$GIT_COMMIT_VERSION_AVAIL = xyes ; then
echo " Version string : reference libFLAC git-${GIT_COMMIT_HASH} ${GIT_COMMIT_DATE}"
fi
echo ""
echo " Compiler is GCC : ......................... ${ac_cv_c_compiler_gnu}"
if test x$ac_cv_c_compiler_gnu = xyes ; then
echo " GCC version : ............................. ${GCC_VERSION}"
fi
echo " Compiler is Clang : ....................... ${xiph_cv_c_compiler_clang}"
echo " Asm optimizations : ....................... ${asm_optimisation}"
echo " Ogg/FLAC support : ........................ ${have_ogg}"
echo " Stack protector : ........................ ${enable_stack_smash_protection}"
echo " Fuzzing support (Clang only) : ............ ${have_oss_fuzzers}"
echo

View file

@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.9)
find_package(Doxygen)
if (NOT DOXYGEN_FOUND)
return()
endif()
option(BUILD_DOXYGEN "Enable API documentation building via Doxygen" ON)
if (NOT BUILD_DOXYGEN)
return()
endif()
set(top_srcdir "${PROJECT_SOURCE_DIR}")
configure_file(Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(FLAC-doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/api/"
DESTINATION "${CMAKE_INSTALL_DOCDIR}/api")

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,62 @@
# flac - Command-line FLAC encoder/decoder
# Copyright (C) 2002-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
SUBDIRS = . images
if FLaC__HAS_DOXYGEN
all-local: Doxyfile
FLAC.tag: Doxyfile
doxygen Doxyfile
rm -rf api
mv doxytmp/html api
rm -rf doxytmp
doc_DATA = \
FLAC.tag
else
if FLaC__HAS_PREBUILT_DOXYGEN
doc_DATA = \
FLAC.tag
endif
endif
EXTRA_DIST = Doxyfile.in doxygen.footer.html \
isoflac.txt $(doc_DATA) CMakeLists.txt \
api
if FLaC__HAS_DOXYGEN
# The install targets don't copy whole directories so we have to
# handle 'api/' specially:
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(docdir)/api
(cd $(builddir)/api && $(INSTALL_DATA) * $(DESTDIR)$(docdir)/api)
uninstall-local:
rm -rf $(DESTDIR)$(docdir)/api
distclean-local:
rm -rf FLAC.tag api doxytmp
endif
if FLaC__HAS_PREBUILT_DOXYGEN
# The install targets don't copy whole directories so we have to
# handle 'api/' specially:
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(docdir)/api
(cd $(srcdir)/api && $(INSTALL_DATA) * $(DESTDIR)$(docdir)/api)
uninstall-local:
rm -rf $(DESTDIR)$(docdir)/api
endif

View file

@ -0,0 +1,15 @@
<hr size="1"/>
Copyright (c) 2000-2009 Josh Coalson
Copyright (c) 2011-2023 Xiph.Org Foundation
<!-- Copyright (c) 2000-2009 Josh Coalson -->
<!-- Copyright (c) 2011-2023 Xiph.Org Foundation -->
<!-- Permission is granted to copy, distribute and/or modify this document -->
<!-- under the terms of the GNU Free Documentation License, Version 1.1 -->
<!-- or any later version published by the Free Software Foundation; -->
<!-- with no invariant sections. -->
<!-- A copy of the license can be found at http://www.gnu.org/copyleft/fdl.html -->
</body>
</html>

View file

@ -0,0 +1,25 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2001-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
logosdir = $(htmldir)/images
logos_DATA = \
logo.svg \
logo130.gif
EXTRA_DIST = $(logos_DATA)

View file

@ -0,0 +1,431 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg2"
version="1.1"
inkscape:version="0.48.4 r9939"
width="262"
height="130"
sodipodi:docname="logo.svg"
inkscape:export-filename="/home/martijn/bin/flac/doc/html/images/logo130.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6">
<clipPath
clipPathUnits="userSpaceOnUse"
id="clipPath4747">
<rect
y="108.66365"
x="58.024467"
height="31.744326"
width="208.41971"
id="rect4749"
style="fill:#ffffff;fill-opacity:0.91542287;stroke:#41b348;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
</clipPath>
</defs>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1680"
inkscape:window-height="971"
id="namedview4"
showgrid="false"
inkscape:zoom="3.8432063"
inkscape:cx="50.316519"
inkscape:cy="46.312655"
inkscape:window-x="-4"
inkscape:window-y="-6"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<rect
style="fill:#000000;fill-opacity:1;stroke:none"
id="rect2987"
width="262"
height="130"
x="0"
y="1.7763568e-15" />
<rect
style="fill:#34a02c;fill-opacity:1;stroke:none"
id="rect2989"
width="8.3984327"
height="11.97043"
x="2.8360443"
y="114.36095"
inkscape:tile-cx="7.0352583"
inkscape:tile-cy="120.34616"
inkscape:tile-w="8.3984327"
inkscape:tile-h="11.97043"
inkscape:tile-x0="2.8360419"
inkscape:tile-y0="114.36095" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="114.36095"
x="2.8360443"
height="11.97043"
width="8.3984327"
id="use4591"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="98.440277"
x="2.8360443"
height="11.97043"
width="8.3984327"
id="use4593"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="82.5196"
x="2.8360443"
height="11.97043"
width="8.3984327"
id="use4595"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="66.59893"
x="2.8360443"
height="11.97043"
width="8.3984327"
id="use4597"
style="fill:#ffff00;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="50.678257"
x="2.8360443"
height="11.97043"
width="8.3984327"
id="use4599"
style="fill:#ffff00;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="34.757584"
x="2.8360443"
height="11.97043"
width="8.3984327"
id="use4601"
style="fill:#ffff00;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="18.836912"
x="2.8360443"
height="11.97043"
width="8.3984327"
id="use4603"
style="fill:#ff0000;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="2.9162366"
x="2.8360443"
height="11.97043"
width="8.3984327"
id="use4605"
style="fill:#ff0000;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="114.36095"
x="15.853616"
height="11.97043"
width="8.3984327"
id="use4607"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="98.440277"
x="15.853616"
height="11.97043"
width="8.3984327"
id="use4609"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="82.5196"
x="15.853616"
height="11.97043"
width="8.3984327"
id="use4611"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="66.59893"
x="15.853616"
height="11.97043"
width="8.3984327"
id="use4613"
style="fill:#ffff00;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="50.678257"
x="15.853616"
height="11.97043"
width="8.3984327"
id="use4615"
style="fill:#ffff00;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="34.757584"
x="15.853616"
height="11.97043"
width="8.3984327"
id="use4617"
style="fill:#ffff00;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="114.36095"
x="28.871185"
height="11.97043"
width="8.3984327"
id="use4623"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="98.440277"
x="28.871185"
height="11.97043"
width="8.3984327"
id="use4625"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="82.5196"
x="28.871185"
height="11.97043"
width="8.3984327"
id="use4627"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="66.59893"
x="28.871185"
height="11.97043"
width="8.3984327"
id="use4629"
style="fill:#ffff00;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="50.678257"
x="28.871185"
height="11.97043"
width="8.3984327"
id="use4631"
style="fill:#ffff00;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="34.757584"
x="28.871185"
height="11.97043"
width="8.3984327"
id="use4633"
style="fill:#ffff00;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="18.836912"
x="28.871185"
height="11.97043"
width="8.3984327"
id="use4635"
style="fill:#ff0000;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="114.36095"
x="41.888756"
height="11.97043"
width="8.3984327"
id="use4639"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="98.440277"
x="41.888756"
height="11.97043"
width="8.3984327"
id="use4641"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="82.5196"
x="41.888756"
height="11.97043"
width="8.3984327"
id="use4643"
style="fill:#34a02c;fill-opacity:1;stroke:none" />
<rect
inkscape:tile-y0="114.36095"
inkscape:tile-x0="2.8360419"
y="66.59893"
x="41.888756"
height="11.97043"
width="8.3984327"
id="use4645"
style="fill:#ffff00;fill-opacity:1;stroke:none" />
<g
id="g4740"
style="fill:#ffffff;fill-opacity:1">
<path
id="path4719"
d="m 167.09375,30.28125 c -4.98582,-0.05597 -10.83371,0.544011 -17.65625,2.03125 L 146.25,50.90625 c 6.2402,-3.841378 28.72275,-6.439176 29.15625,4.03125 l 0.25,6.375 c -20.10772,-13.818292 -38.48096,-0.631226 -39.0625,19.125 -0.58154,19.75623 24.38101,31.46172 38.875,16 l 0.0625,5.875 17.375,-1.53125 1.15625,-49.375 c 0.19095,-8.148311 -5.36352,-20.882474 -26.96875,-21.125 z m -1.90625,38.875 c 5.33673,0 9.65625,4.075677 9.65625,9.125 0,5.049323 -4.31952,9.15625 -9.65625,9.15625 -5.33673,0 -9.65625,-4.106927 -9.65625,-9.15625 0,-5.049323 4.31952,-9.125 9.65625,-9.125 z"
style="fill:#ffffff;fill-opacity:1;stroke:none"
inkscape:connector-curvature="0" />
<path
sodipodi:nodetypes="ccccccccccccc"
inkscape:connector-curvature="0"
id="path4705"
d="m 66.419944,102.30969 20.238764,-2.29986 0,-49.492976 10.855337,0 0,-17.662922 -11.223315,0 c 1.030499,-9.919211 4.729089,-9.43064 17.29494,-9.199438 L 98.617978,4.335674 C 88.053405,4.3210512 66.008231,6.32016 66.419944,32.669944 l -6.807584,0 -3.863764,17.662921 10.671348,0.183989 z"
style="fill:#ffffff;fill-opacity:1;stroke:none" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none"
d="m 108.94803,102.30969 20.23877,-2.29986 0,-93.3270875 -20.23877,2.2078652 z"
id="path4707"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
sodipodi:nodetypes="sssccsccccs"
inkscape:connector-curvature="0"
id="path4723"
d="m 231.29725,30.118335 c -9.62029,0.652151 -17.24238,4.090284 -24.04461,11.842706 -13.60446,15.504845 -12.39784,39.604586 3.18708,53.122515 15.58492,13.517924 40.64278,8.399604 47.71564,-0.389642 L 247.34775,78.958636 c -6.47017,7.37397 -15.93762,7.267658 -23.36382,0.82638 -7.42621,-6.441278 -8.1621,-17.252972 -1.69193,-24.626942 l 0.11279,-0.112795 c 6.48447,-7.259969 17.70592,-7.662694 25.09092,-1.257152 l 10.86397,-15.411334 c -7.76321,-6.645971 -17.51834,-8.905444 -27.06243,-8.258458 z"
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" />
</g>
<g
style="font-size:17.05998611px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Swis721 BT;-inkscape-font-specification:Swis721 BT"
id="text4751">
<path
d="m 70.858501,114.93679 0,1.16008 -1.484218,0 0,7.77935 -1.415979,0 0,-7.77935 -1.194199,0 0,-1.16008 1.194199,0 0,-1.51834 c -2e-6,-0.6369 0.181971,-1.13163 0.545919,-1.48422 0.375318,-0.36393 0.892803,-0.54591 1.552459,-0.54592 0.261583,10e-6 0.528855,0.0284 0.801819,0.0853 l 0,1.17714 c -0.216097,-0.0114 -0.38101,-0.017 -0.494739,-0.0171 -0.659656,1e-5 -0.989482,0.3014 -0.989479,0.90418 l 0,1.39892 1.484218,0"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4756" />
<path
d="m 76.510422,116.18217 c -0.955364,0.0228 -1.671883,0.24453 -2.149559,0.66534 -0.477682,0.42082 -0.716521,1.21695 -0.716519,2.38839 l 0,4.64032 -1.433039,0 0,-8.93943 1.313619,0 0,1.6207 c 0.409437,-0.67102 0.801816,-1.1487 1.177139,-1.43304 0.386689,-0.2957 0.807502,-0.44355 1.262439,-0.44356 0.125102,10e-6 0.307075,0.0171 0.54592,0.0512 l 0,1.4501"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4758" />
<path
d="m 85.433328,119.88418 -6.585155,0 c 0.02275,0.93262 0.261584,1.67757 0.71652,2.23486 0.466303,0.5573 1.103208,0.83594 1.910718,0.83594 1.160073,0 1.939145,-0.5971 2.337218,-1.7913 l 1.433039,0 c -0.181981,0.97811 -0.608481,1.74012 -1.279499,2.28604 -0.671033,0.54592 -1.518344,0.81888 -2.541938,0.81888 -1.251069,0 -2.240547,-0.42081 -2.968438,-1.26244 -0.727893,-0.853 -1.091839,-2.01307 -1.091839,-3.48024 0,-1.46715 0.369632,-2.6386 1.108899,-3.51435 0.750637,-0.88711 1.745802,-1.33067 2.985498,-1.33068 2.649977,10e-6 3.974968,1.73444 3.974977,5.20329 m -6.551035,-1.16008 5.032696,0 c -7e-6,-0.77338 -0.23316,-1.42165 -0.699459,-1.94483 -0.466313,-0.52317 -1.057725,-0.78476 -1.774239,-0.78476 -0.716523,0 -1.307936,0.25022 -1.774239,0.75064 -0.466308,0.48906 -0.727894,1.14871 -0.784759,1.97895"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4760" />
<path
d="m 94.529766,119.88418 -6.585154,0 c 0.02274,0.93262 0.261584,1.67757 0.716519,2.23486 0.466303,0.5573 1.103209,0.83594 1.910718,0.83594 1.160074,0 1.939146,-0.5971 2.337218,-1.7913 l 1.433039,0 c -0.181981,0.97811 -0.60848,1.74012 -1.279499,2.28604 -0.671032,0.54592 -1.518344,0.81888 -2.541938,0.81888 -1.251069,0 -2.240547,-0.42081 -2.968437,-1.26244 -0.727894,-0.853 -1.09184,-2.01307 -1.091839,-3.48024 -10e-7,-1.46715 0.369632,-2.6386 1.108899,-3.51435 0.750637,-0.88711 1.745802,-1.33067 2.985497,-1.33068 2.649978,10e-6 3.974969,1.73444 3.974977,5.20329 m -6.551035,-1.16008 5.032696,0 c -7e-6,-0.77338 -0.23316,-1.42165 -0.699459,-1.94483 -0.466312,-0.52317 -1.057724,-0.78476 -1.774239,-0.78476 -0.716523,0 -1.307935,0.25022 -1.774238,0.75064 -0.466309,0.48906 -0.727895,1.14871 -0.78476,1.97895"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4762" />
<path
d="m 102.74554,111.43949 0,12.43673 -1.43304,0 0,-12.43673 1.43304,0"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4764" />
<path
d="m 108.49209,114.68089 c 1.28518,10e-6 2.28034,0.42651 2.9855,1.2795 0.71651,0.84163 1.07477,2.03583 1.07478,3.58259 -1e-5,1.46717 -0.36396,2.62156 -1.09184,3.46318 -0.71653,0.84163 -1.70032,1.26244 -2.95138,1.26244 -1.27382,0 -2.26898,-0.42081 -2.9855,-1.26244 -0.70515,-0.853 -1.05772,-2.03013 -1.05772,-3.53142 0,-1.50127 0.35826,-2.67272 1.07478,-3.51435 0.71652,-0.85299 1.70031,-1.27949 2.95138,-1.2795 m 0.0171,1.31362 c -0.79614,0 -1.42167,0.31277 -1.8766,0.9383 -0.45494,0.61416 -0.6824,1.46147 -0.6824,2.54193 0,1.08047 0.22746,1.93347 0.6824,2.559 0.45493,0.61416 1.08046,0.92124 1.8766,0.92124 0.78475,0 1.4046,-0.30708 1.85954,-0.92124 0.4663,-0.62553 0.69945,-1.46147 0.69946,-2.50782 -1e-5,-1.1032 -0.22748,-1.96757 -0.6824,-2.59311 -0.44357,-0.62553 -1.0691,-0.9383 -1.8766,-0.9383"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4766" />
<path
d="m 115.13189,121.21486 c 0.0682,0.53455 0.25021,0.96105 0.54592,1.2795 0.30707,0.30708 0.85299,0.46062 1.63775,0.46062 0.62553,0 1.12596,-0.1251 1.50128,-0.37532 0.38669,-0.26158 0.58004,-0.60278 0.58004,-1.0236 0,-0.32982 -0.10805,-0.59141 -0.32414,-0.78476 -0.2161,-0.19334 -0.56867,-0.34688 -1.05772,-0.46062 l -1.33068,-0.32414 c -1.05772,-0.25021 -1.79698,-0.56297 -2.21779,-0.9383 -0.40944,-0.38668 -0.61416,-0.9326 -0.61416,-1.63775 0,-0.83025 0.31276,-1.4899 0.9383,-1.97896 0.62553,-0.50042 1.45578,-0.75063 2.49075,-0.75064 1.03497,10e-6 1.8311,0.23885 2.3884,0.71652 0.55729,0.47769 0.84162,1.1544 0.853,2.03014 l -1.50128,0 c -0.0341,-0.95536 -0.63122,-1.43304 -1.7913,-1.43304 -0.58004,0 -1.04066,0.12511 -1.38185,0.37532 -0.34121,0.23884 -0.51181,0.56298 -0.5118,0.97242 -10e-6,0.31846 0.13079,0.58004 0.39238,0.78476 0.26158,0.19335 0.68239,0.35826 1.26243,0.49473 l 1.3648,0.32414 c 0.88712,0.2161 1.52971,0.52318 1.92778,0.92124 0.39806,0.3867 0.59709,0.90987 0.5971,1.56952 -1e-5,0.86438 -0.33552,1.55246 -1.00654,2.06426 -0.65966,0.5118 -1.55246,0.7677 -2.67842,0.7677 -2.30878,0 -3.49729,-1.01791 -3.56553,-3.05374 l 1.50128,0"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4768" />
<path
d="m 123.5286,121.21486 c 0.0682,0.53455 0.25021,0.96105 0.54592,1.2795 0.30708,0.30708 0.85299,0.46062 1.63776,0.46062 0.62553,0 1.12595,-0.1251 1.50128,-0.37532 0.38668,-0.26158 0.58003,-0.60278 0.58004,-1.0236 -1e-5,-0.32982 -0.10806,-0.59141 -0.32414,-0.78476 -0.2161,-0.19334 -0.56868,-0.34688 -1.05772,-0.46062 l -1.33068,-0.32414 c -1.05772,-0.25021 -1.79699,-0.56297 -2.2178,-0.9383 -0.40944,-0.38668 -0.61416,-0.9326 -0.61416,-1.63775 0,-0.83025 0.31277,-1.4899 0.9383,-1.97896 0.62553,-0.50042 1.45578,-0.75063 2.49076,-0.75064 1.03496,10e-6 1.8311,0.23885 2.3884,0.71652 0.55728,0.47769 0.84161,1.1544 0.85299,2.03014 l -1.50127,0 c -0.0341,-0.95536 -0.63123,-1.43304 -1.7913,-1.43304 -0.58005,0 -1.04066,0.12511 -1.38186,0.37532 -0.3412,0.23884 -0.5118,0.56298 -0.5118,0.97242 0,0.31846 0.13079,0.58004 0.39238,0.78476 0.26158,0.19335 0.68239,0.35826 1.26244,0.49473 l 1.3648,0.32414 c 0.88711,0.2161 1.5297,0.52318 1.92777,0.92124 0.39806,0.3867 0.5971,0.90987 0.5971,1.56952 0,0.86438 -0.33552,1.55246 -1.00653,2.06426 -0.65966,0.5118 -1.55247,0.7677 -2.67842,0.7677 -2.30879,0 -3.4973,-1.01791 -3.56554,-3.05374 l 1.50128,0"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4770" />
<path
d="m 132.30063,111.43949 0,12.43673 -1.43304,0 0,-12.43673 1.43304,0"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4772" />
<path
d="m 142.0904,119.88418 -6.58516,0 c 0.0228,0.93262 0.26159,1.67757 0.71652,2.23486 0.4663,0.5573 1.10321,0.83594 1.91072,0.83594 1.16007,0 1.93915,-0.5971 2.33722,-1.7913 l 1.43304,0 c -0.18198,0.97811 -0.60848,1.74012 -1.2795,2.28604 -0.67103,0.54592 -1.51835,0.81888 -2.54194,0.81888 -1.25107,0 -2.24055,-0.42081 -2.96844,-1.26244 -0.72789,-0.853 -1.09184,-2.01307 -1.09184,-3.48024 0,-1.46715 0.36964,-2.6386 1.1089,-3.51435 0.75064,-0.88711 1.7458,-1.33067 2.9855,-1.33068 2.64998,10e-6 3.97497,1.73444 3.97498,5.20329 m -6.55104,-1.16008 5.0327,0 c -1e-5,-0.77338 -0.23316,-1.42165 -0.69946,-1.94483 -0.46631,-0.52317 -1.05773,-0.78476 -1.77424,-0.78476 -0.71652,0 -1.30794,0.25022 -1.77424,0.75064 -0.46631,0.48906 -0.72789,1.14871 -0.78476,1.97895"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4774" />
<path
d="m 144.68698,121.21486 c 0.0682,0.53455 0.25021,0.96105 0.54592,1.2795 0.30707,0.30708 0.85299,0.46062 1.63776,0.46062 0.62552,0 1.12595,-0.1251 1.50127,-0.37532 0.38669,-0.26158 0.58004,-0.60278 0.58004,-1.0236 0,-0.32982 -0.10805,-0.59141 -0.32414,-0.78476 -0.21609,-0.19334 -0.56867,-0.34688 -1.05771,-0.46062 l -1.33068,-0.32414 c -1.05773,-0.25021 -1.79699,-0.56297 -2.2178,-0.9383 -0.40944,-0.38668 -0.61416,-0.9326 -0.61416,-1.63775 0,-0.83025 0.31276,-1.4899 0.9383,-1.97896 0.62553,-0.50042 1.45578,-0.75063 2.49076,-0.75064 1.03496,10e-6 1.8311,0.23885 2.38839,0.71652 0.55729,0.47769 0.84162,1.1544 0.853,2.03014 l -1.50128,0 c -0.0341,-0.95536 -0.63122,-1.43304 -1.79129,-1.43304 -0.58005,0 -1.04067,0.12511 -1.38186,0.37532 -0.3412,0.23884 -0.5118,0.56298 -0.5118,0.97242 0,0.31846 0.13079,0.58004 0.39238,0.78476 0.26158,0.19335 0.68239,0.35826 1.26244,0.49473 l 1.3648,0.32414 c 0.88711,0.2161 1.5297,0.52318 1.92777,0.92124 0.39806,0.3867 0.5971,0.90987 0.5971,1.56952 0,0.86438 -0.33552,1.55246 -1.00654,2.06426 -0.65966,0.5118 -1.55246,0.7677 -2.67841,0.7677 -2.30879,0 -3.4973,-1.01791 -3.56554,-3.05374 l 1.50128,0"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4776" />
<path
d="m 153.08369,121.21486 c 0.0682,0.53455 0.25021,0.96105 0.54592,1.2795 0.30708,0.30708 0.853,0.46062 1.63776,0.46062 0.62553,0 1.12595,-0.1251 1.50128,-0.37532 0.38668,-0.26158 0.58003,-0.60278 0.58004,-1.0236 -1e-5,-0.32982 -0.10806,-0.59141 -0.32414,-0.78476 -0.2161,-0.19334 -0.56867,-0.34688 -1.05772,-0.46062 l -1.33068,-0.32414 c -1.05772,-0.25021 -1.79699,-0.56297 -2.2178,-0.9383 -0.40944,-0.38668 -0.61416,-0.9326 -0.61416,-1.63775 0,-0.83025 0.31277,-1.4899 0.9383,-1.97896 0.62553,-0.50042 1.45578,-0.75063 2.49076,-0.75064 1.03497,10e-6 1.8311,0.23885 2.3884,0.71652 0.55728,0.47769 0.84162,1.1544 0.853,2.03014 l -1.50128,0 c -0.0341,-0.95536 -0.63123,-1.43304 -1.7913,-1.43304 -0.58004,0 -1.04066,0.12511 -1.38186,0.37532 -0.3412,0.23884 -0.5118,0.56298 -0.5118,0.97242 0,0.31846 0.13079,0.58004 0.39238,0.78476 0.26158,0.19335 0.6824,0.35826 1.26244,0.49473 l 1.3648,0.32414 c 0.88711,0.2161 1.5297,0.52318 1.92778,0.92124 0.39806,0.3867 0.59709,0.90987 0.5971,1.56952 -1e-5,0.86438 -0.33552,1.55246 -1.00654,2.06426 -0.65966,0.5118 -1.55247,0.7677 -2.67842,0.7677 -2.30879,0 -3.4973,-1.01791 -3.56554,-3.05374 l 1.50128,0"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4778" />
<path
d="m 165.54714,117.58109 c 0.0682,-1.93346 1.26244,-2.90019 3.5826,-2.9002 1.1032,10e-6 1.93914,0.21041 2.50781,0.63122 0.56866,0.40945 0.853,1.01223 0.853,1.80836 l 0,5.25447 c 0,0.46631 0.25589,0.69946 0.7677,0.69946 0.10235,0 0.20471,-0.0114 0.30708,-0.0341 l 0,1.07478 c -0.39807,0.10236 -0.72221,0.15354 -0.97242,0.15354 -0.45494,0 -0.80182,-0.10805 -1.04066,-0.32414 -0.22747,-0.20472 -0.36964,-0.53455 -0.4265,-0.98948 -0.95536,0.87575 -1.96759,1.31362 -3.03667,1.31362 -0.8985,0 -1.61502,-0.23884 -2.14956,-0.71652 -0.52318,-0.47768 -0.78476,-1.12027 -0.78476,-1.92778 0,-0.26158 0.0228,-0.50042 0.0682,-0.71652 0.0569,-0.21609 0.11373,-0.40375 0.1706,-0.56298 0.0682,-0.17059 0.18197,-0.32413 0.3412,-0.46062 0.15922,-0.14785 0.29002,-0.26726 0.39238,-0.35826 0.11373,-0.091 0.2957,-0.17628 0.54592,-0.2559 0.26158,-0.091 0.46062,-0.15353 0.5971,-0.18766 0.13647,-0.0455 0.37531,-0.0967 0.71652,-0.15354 0.34119,-0.0569 0.59141,-0.0967 0.75064,-0.11942 0.15922,-0.0227 0.44355,-0.0625 0.853,-0.11942 0.55728,-0.0682 0.94398,-0.17628 1.16007,-0.32413 0.21609,-0.14785 0.32414,-0.36963 0.32414,-0.66534 l 0,-0.37532 c 0,-0.43218 -0.17629,-0.76201 -0.52886,-0.98948 -0.3412,-0.22746 -0.83025,-0.3412 -1.46715,-0.3412 -0.65966,0 -1.16009,0.1308 -1.50128,0.39238 -0.34121,0.25022 -0.54024,0.64828 -0.5971,1.1942 l -1.43304,0 m 2.84902,5.44213 c 0.78475,0 1.42734,-0.20472 1.92777,-0.61416 0.50043,-0.42081 0.75064,-0.87006 0.75064,-1.34774 l 0,-1.60364 c -0.28433,0.13649 -0.71652,0.25022 -1.29655,0.3412 -0.56868,0.091 -1.06341,0.17061 -1.48422,0.23884 -0.42082,0.0683 -0.80183,0.23316 -1.14302,0.49474 -0.3412,0.25022 -0.5118,0.60279 -0.5118,1.05772 0,0.45494 0.15354,0.80751 0.46062,1.05772 0.30707,0.25022 0.73926,0.37532 1.29656,0.37532"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4780" />
<path
d="m 182.04361,123.87622 -1.2795,0 0,-1.24538 c -0.42082,0.59142 -0.85869,1.01223 -1.31362,1.26244 -0.45493,0.25021 -1.01223,0.37532 -1.67187,0.37532 -0.86438,0 -1.55815,-0.22178 -2.08132,-0.66534 -0.5118,-0.44356 -0.7677,-1.03497 -0.7677,-1.77424 l 0,-6.89223 1.41598,0 0,6.32925 c -1e-5,0.53455 0.16491,0.96105 0.49474,1.2795 0.32982,0.31846 0.77906,0.47768 1.34773,0.47768 0.73927,0 1.33068,-0.27296 1.77424,-0.81888 0.44356,-0.55729 0.66534,-1.29087 0.66534,-2.20074 l 0,-5.06681 1.41598,0 0,8.93943"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4782" />
<path
d="m 191.58201,111.43949 0,12.43673 -1.26244,0 0,-1.17714 c -0.3867,0.5573 -0.80751,0.95536 -1.26244,1.1942 -0.44356,0.25021 -0.97242,0.37532 -1.58658,0.37532 -1.20557,0 -2.15524,-0.43219 -2.84901,-1.29656 -0.69378,-0.87574 -1.04066,-2.06994 -1.04066,-3.5826 0,-1.42166 0.34688,-2.55899 1.04066,-3.41199 0.70514,-0.86437 1.63775,-1.29655 2.79783,-1.29656 1.22832,10e-6 2.14387,0.46063 2.74666,1.38186 l 0,-4.62326 1.41598,0 m -3.9238,4.57208 c -0.77339,0 -1.39892,0.31846 -1.8766,0.95536 -0.47768,0.63691 -0.71652,1.47285 -0.71652,2.50781 0,1.04635 0.23884,1.88798 0.71652,2.52488 0.47768,0.62554 1.1089,0.9383 1.89366,0.9383 0.75064,0 1.35342,-0.31276 1.80836,-0.9383 0.45493,-0.62553 0.68239,-1.45578 0.6824,-2.49076 -1e-5,-1.06908 -0.22747,-1.91639 -0.6824,-2.54193 -0.45494,-0.6369 -1.06341,-0.95536 -1.82542,-0.95536"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4784" />
<path
d="m 195.15768,114.93679 0,8.93943 -1.41598,0 0,-8.93943 1.41598,0 m 0,-3.4973 0,1.7913 -1.43304,0 0,-1.7913 1.43304,0"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4786" />
<path
d="m 200.93515,114.68089 c 1.28518,10e-6 2.28034,0.42651 2.9855,1.2795 0.71651,0.84163 1.07477,2.03583 1.07478,3.58259 -1e-5,1.46717 -0.36396,2.62156 -1.09184,3.46318 -0.71653,0.84163 -1.70032,1.26244 -2.95138,1.26244 -1.27382,0 -2.26898,-0.42081 -2.9855,-1.26244 -0.70514,-0.853 -1.05772,-2.03013 -1.05772,-3.53142 0,-1.50127 0.35826,-2.67272 1.07478,-3.51435 0.71652,-0.85299 1.70031,-1.27949 2.95138,-1.2795 m 0.0171,1.31362 c -0.79614,0 -1.42167,0.31277 -1.8766,0.9383 -0.45493,0.61416 -0.6824,1.46147 -0.6824,2.54193 0,1.08047 0.22747,1.93347 0.6824,2.559 0.45493,0.61416 1.08046,0.92124 1.8766,0.92124 0.78475,0 1.4046,-0.30708 1.85954,-0.92124 0.4663,-0.62553 0.69945,-1.46147 0.69946,-2.50782 -1e-5,-1.1032 -0.22748,-1.96757 -0.6824,-2.59311 -0.44357,-0.62553 -1.0691,-0.9383 -1.8766,-0.9383"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4788" />
<path
d="m 218.75569,117.93935 -1.43304,0 c -0.091,-0.62553 -0.31846,-1.10321 -0.6824,-1.43304 -0.36395,-0.3412 -0.84163,-0.5118 -1.43304,-0.5118 -0.77339,0 -1.38186,0.31846 -1.82542,0.95536 -0.43219,0.62554 -0.64828,1.49559 -0.64828,2.61017 0,1.05773 0.22178,1.88798 0.66534,2.49076 0.44356,0.60279 1.05772,0.90418 1.84248,0.90418 1.21694,0 1.94483,-0.71652 2.18368,-2.14956 l 1.43304,0 c -0.091,1.09184 -0.45494,1.94484 -1.09184,2.559 -0.63691,0.60279 -1.48991,0.90418 -2.559,0.90418 -1.21695,0 -2.18368,-0.42081 -2.9002,-1.26244 -0.70514,-0.853 -1.05772,-2.0017 -1.05771,-3.44612 -1e-5,-1.47852 0.35825,-2.66135 1.07477,-3.54847 0.72789,-0.88711 1.69463,-1.33067 2.9002,-1.33068 1.03497,10e-6 1.85953,0.27865 2.4737,0.83594 0.62552,0.5573 0.9781,1.3648 1.05772,2.42252"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4790" />
<path
d="m 223.90541,114.68089 c 1.28518,10e-6 2.28035,0.42651 2.9855,1.2795 0.71651,0.84163 1.07477,2.03583 1.07478,3.58259 -1e-5,1.46717 -0.36396,2.62156 -1.09184,3.46318 -0.71653,0.84163 -1.70032,1.26244 -2.95138,1.26244 -1.27381,0 -2.26898,-0.42081 -2.9855,-1.26244 -0.70514,-0.853 -1.05772,-2.03013 -1.05772,-3.53142 0,-1.50127 0.35826,-2.67272 1.07478,-3.51435 0.71652,-0.85299 1.70031,-1.27949 2.95138,-1.2795 m 0.0171,1.31362 c -0.79614,0 -1.42167,0.31277 -1.8766,0.9383 -0.45493,0.61416 -0.6824,1.46147 -0.6824,2.54193 0,1.08047 0.22747,1.93347 0.6824,2.559 0.45493,0.61416 1.08046,0.92124 1.8766,0.92124 0.78475,0 1.4046,-0.30708 1.85954,-0.92124 0.4663,-0.62553 0.69945,-1.46147 0.69946,-2.50782 -1e-5,-1.1032 -0.22747,-1.96757 -0.6824,-2.59311 -0.44357,-0.62553 -1.0691,-0.9383 -1.8766,-0.9383"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4792" />
<path
d="m 236.97682,111.43949 0,12.43673 -1.26244,0 0,-1.17714 c -0.3867,0.5573 -0.80751,0.95536 -1.26243,1.1942 -0.44357,0.25021 -0.97243,0.37532 -1.58658,0.37532 -1.20558,0 -2.15525,-0.43219 -2.84902,-1.29656 -0.69377,-0.87574 -1.04066,-2.06994 -1.04066,-3.5826 0,-1.42166 0.34689,-2.55899 1.04066,-3.41199 0.70514,-0.86437 1.63775,-1.29655 2.79784,-1.29656 1.22831,10e-6 2.14386,0.46063 2.74665,1.38186 l 0,-4.62326 1.41598,0 m -3.92379,4.57208 c -0.77339,0 -1.39893,0.31846 -1.8766,0.95536 -0.47768,0.63691 -0.71652,1.47285 -0.71652,2.50781 0,1.04635 0.23884,1.88798 0.71652,2.52488 0.47767,0.62554 1.10889,0.9383 1.89366,0.9383 0.75063,0 1.35342,-0.31276 1.80835,-0.9383 0.45493,-0.62553 0.6824,-1.45578 0.6824,-2.49076 0,-1.06908 -0.22747,-1.91639 -0.6824,-2.54193 -0.45493,-0.6369 -1.06341,-0.95536 -1.82541,-0.95536"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4794" />
<path
d="m 246.57467,119.88418 -6.58516,0 c 0.0228,0.93262 0.26158,1.67757 0.71652,2.23486 0.4663,0.5573 1.10321,0.83594 1.91072,0.83594 1.16007,0 1.93914,-0.5971 2.33722,-1.7913 l 1.43304,0 c -0.18199,0.97811 -0.60849,1.74012 -1.2795,2.28604 -0.67104,0.54592 -1.51835,0.81888 -2.54194,0.81888 -1.25107,0 -2.24055,-0.42081 -2.96844,-1.26244 -0.72789,-0.853 -1.09184,-2.01307 -1.09184,-3.48024 0,-1.46715 0.36963,-2.6386 1.1089,-3.51435 0.75064,-0.88711 1.7458,-1.33067 2.9855,-1.33068 2.64998,10e-6 3.97497,1.73444 3.97498,5.20329 m -6.55104,-1.16008 5.0327,0 c -1e-5,-0.77338 -0.23316,-1.42165 -0.69946,-1.94483 -0.46632,-0.52317 -1.05773,-0.78476 -1.77424,-0.78476 -0.71652,0 -1.30794,0.25022 -1.77424,0.75064 -0.46631,0.48906 -0.72789,1.14871 -0.78476,1.97895"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4796" />
<path
d="m 255.10812,117.93935 -1.43304,0 c -0.091,-0.62553 -0.31846,-1.10321 -0.6824,-1.43304 -0.36395,-0.3412 -0.84163,-0.5118 -1.43304,-0.5118 -0.77339,0 -1.38186,0.31846 -1.82541,0.95536 -0.43219,0.62554 -0.64829,1.49559 -0.64828,2.61017 -1e-5,1.05773 0.22177,1.88798 0.66534,2.49076 0.44355,0.60279 1.05771,0.90418 1.84247,0.90418 1.21694,0 1.94484,-0.71652 2.18368,-2.14956 l 1.43304,0 c -0.091,1.09184 -0.45494,1.94484 -1.09184,2.559 -0.63691,0.60279 -1.48991,0.90418 -2.559,0.90418 -1.21694,0 -2.18368,-0.42081 -2.90019,-1.26244 -0.70515,-0.853 -1.05772,-2.0017 -1.05772,-3.44612 0,-1.47852 0.35826,-2.66135 1.07478,-3.54847 0.72789,-0.88711 1.69462,-1.33067 2.90019,-1.33068 1.03497,10e-6 1.85954,0.27865 2.4737,0.83594 0.62553,0.5573 0.9781,1.3648 1.05772,2.42252"
style="word-spacing:0.97887385px;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans"
id="path4798" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -0,0 +1,666 @@
Encapsulation of FLAC in ISO Base Media File Format
Version 0.0.4
Table of Contents
1 Scope
2 Supporting Normative References
3 Design Rules of Encapsulation
3.1 File Type Identification
3.2 Overview of Track Structure
3.3 Definition of FLAC sample
3.3.1 Sample entry format
3.3.2 FLAC Specific Box
3.3.3 Sample format
3.3.4 Duration of FLAC sample
3.3.5 Sub-sample
3.3.6 Random Access
3.3.6.1 Random Access Point
3.4 Basic Structure (informative)
3.4.1 Initial Movie
3.5 Example of Encapsulation (informative)
4 Acknowledgements
5 Author's Address
1 Scope
This document specifies the normative mapping for encapsulation of
FLAC coded audio bitstreams in ISO Base Media file format and its
derivatives. The encapsulation of FLAC coded bitstreams in
QuickTime file format is outside the scope of this specification.
2 Supporting Normative References
[1] ISO/IEC 14496-12:2012 Corrected version
Information technology — Coding of audio-visual objects — Part
12: ISO base media file format
[2] ISO/IEC 14496-12:2012/Amd.1:2013
Information technology — Coding of audio-visual objects — Part
12: ISO base media file format AMENDMENT 1: Various
enhancements including support for large metadata
[3] FLAC format specification
https://xiph.org/flac/format.html
Definition of the FLAC Audio Codec stream format
[4] FLAC-in-Ogg mapping specification
https://xiph.org/flac/ogg_mapping.html
Ogg Encapsulation for the FLAC Audio Codec
[5] Matroska specification
3 Design Rules of Encapsulation
3.1 File Type Identification
This specification does not define any brand to declare files
which conform to this specification. Files which conform to
this specification shall contain at least one brand which
supports the requirements and the requirements described in
this clause without contradiction in the compatible brands
list of the File Type Box. The minimal support of the
encapsulation of FLAC bitstreams in ISO Base Media file format
requires the 'isom' brand.
3.2 Overview of Track Structure
FLAC coded audio shall be encapsulated into the ISO Base
Media File Format as media data within an audio track.
+ The handler_type field in the Handler Reference Box
shall be set to 'soun'.
+ The Media Information Box shall contain the Sound Media
Header Box.
+ The codingname of the sample entry is 'fLaC'.
This specification does not define any encapsulation
using MP4AudioSampleEntry with objectTypeIndication
specified by the MPEG-4 Registration Authority
(http://www.mp4ra.org/). See section 'Sample entry
format' for the definition of the sample entry.
+ The 'dfLa' box is added to the sample entry to convey
initializing information for the decoder.
See section 'FLAC Specific Box' for the definition of
the box contents.
+ A FLAC sample is exactly one FLAC frame as described
in the format specification[3]. See section
'Sample format' for details of the frame contents.
+ Every FLAC sample is a sync sample. No pre-roll or
lapping is required. See section 'Random Access' for
further details.
3.3 Definition of a FLAC sample
3.3.1 Sample entry format
For any track containing one or more FLAC bitstreams, a
sample entry describing the corresponding FLAC bitstream
shall be present inside the Sample Table Box. This version
of the specification defines only one sample entry format
named FLACSampleEntry whose codingname is 'fLaC'. This
sample entry includes exactly one FLAC Specific Box
defined in section 'FLAC specific box' as a mandatory box
and indicates that FLAC samples described by this sample
entry are stored by the sample format described in section
'Sample format'.
The syntax and semantics of the FLACSampleEntry is shown
as follows. The data fields of this box and native
FLAC[3] structures encoded within FLAC blocks are both
stored in big-endian format, though for purposes of the
ISO BMFF container, FLAC native metadata and data blocks
are treated as unstructured octet streams.
class FLACSampleEntry() extends AudioSampleEntry ('fLaC'){
FLACSpecificBox();
}
The fields of the AudioSampleEntry portion shall be set as
follows:
+ channelcount:
The channelcount field shall be set equal to the
channel count specified by the FLAC bitstream's native
METADATA_BLOCK_STREAMINFO header as described in [3].
Note that the FLAC FRAME_HEADER structure that begins
each FLAC sample redundantly encodes channel number;
the number of channels declared in each FRAME_HEADER
MUST match the number of channels declared here and in
the METADATA_BLOCK_STREAMINFO header.
+ samplesize:
The samplesize field shall be set equal to the bits
per sample specified by the FLAC bitstream's native
METADATA_BLOCK_STREAMINFO header as described in [3].
Note that the FLAC FRAME_HEADER structure that begins
each FLAC sample redundantly encodes the number of
bits per sample; the bits per sample declared in each
FRAME_HEADER MUST match the samplesize declared here
and the bits per sample field declared in the
METADATA_BLOCK_STREAMINFO header.
+ samplerate:
When possible, the samplerate field shall be set
equal to the sample rate specified by the FLAC
bitstream's native METADATA_BLOCK_STREAMINFO header
as described in [3], left-shifted by 16 bits to
create the appropriate 16.16 fixed-point
representation.
When the bitstream's native sample rate is greater
than the maximum expressible value of 65535 Hz,
the samplerate field shall hold the greatest
expressible regular division of that rate. I.e.
the samplerate field shall hold 48000.0 for
native sample rates of 96 and 192 kHz. In the
case of unusual sample rates which do not have
an expressible regular division, the maximum value
of 65535.0 Hz should be used.
High-rate FLAC bitstreams are common, and the native
value from the METADATA_BLOCK_STREAMINFO header in
the FLACSpecificBox MUST be read to determine the
correct sample rate of the bitstream.
Note that the FLAC FRAME_HEADER structure that begins
each FLAC sample redundantly encodes the sample rate;
the sample rate declared in each FRAME_HEADER MUST
match the sample rate declared in the
METADATA_BLOCK_STREAMINFO header, and here in the
AudioSampleEntry portion of the FLACSampleEntry
as much as is allowed by the encoding restrictions
described above.
Finally, the FLACSpecificBox carries codec headers:
+ FLACSpecificBox
This box contains initializing information for the
decoder as defined in section 'FLAC specific box'.
3.3.2 FLAC Specific Box
Exactly one FLAC Specific Box shall be present in each
FLACSampleEntry. This specification defines version 0
of this box. If incompatible changes occur in future
versions of this specification, another version number
will be defined. The data fields of this box and native
FLAC[3] structures encoded within FLAC blocks are both
stored in big-endian format, though for purposes of the
ISO BMFF container, FLAC native metadata and data blocks
are treated as unstructured octet streams.
The syntax and semantics of the FLAC Specific Box is shown
as follows.
class FLACMetadataBlock {
unsigned int(1) LastMetadataBlockFlag;
unsigned int(7) BlockType;
unsigned int(24) Length;
unsigned int(8) BlockData[Length];
}
aligned(8) class FLACSpecificBox
extends FullBox('dfLa', version=0, 0){
for (i=0; ; i++) { // to end of box
FLACMetadataBlock();
}
}
+ Version:
The Version field shall be set to 0.
In the future versions of this specification, this
field may be set to other values. And without support
of those values, the reader shall not read the fields
after this within the FLACSpecificBox.
+ Flags:
The Flags field shall be set to 0.
After the FullBox header, the box contains a sequence of
FLAC[3] native-metadata block structures that fill the
remainder of the box.
Each FLACMetadataBlock structure consists of three fields
filling a total of four bytes that form a FLAC[3] native
METADATA_BLOCK_HEADER, followed by raw octet bytes that
comprise the FLAC[3] native METADATA_BLOCK_DATA.
+ LastMetadataBlockFlag:
The LastMetadataBlockFlag field maps semantically to
the FLAC[3] native METADATA_BLOCK_HEADER
Last-metadata-block flag as defined in the FLAC[3]
file specification.
The LastMetadataBlockFlag is set to 1 if this
MetadataBlock is the last metadata block in the
FLACSpecificBox. It is set to 0 otherwise.
+ BlockType:
The BlockType field maps semantically to the FLAC[3]
native METADATA_BLOCK_HEADER BLOCK_TYPE field as
defined in the FLAC[3] file specification.
The BlockType is set to a valid FLAC[3] BLOCK_TYPE
value that identifies the type of this native metadata
block. The BlockType of the first FLACMetadataBlock
must be set to 0, signifying this is a FLAC[3] native
METADATA_BLOCK_STREAMINFO block.
+ Length:
The Length field maps semantically to the FLAC[3]
native METADATA_BLOCK_HEADER Length field as
defined in the FLAC[3] file specification.
The length field specifies the number of bytes of
MetadataBlockData to follow.
+ BlockData
The BlockData field maps semantically to the FLAC[3]
native METADATA_BLOCK_HEADER METADATA_BLOCK_DATA as
defined in the FLAC[3] file specification.
Taken together, the bytes of the FLACMetadataBlock form a
complete FLAC[3] native METADATA_BLOCK structure.
Note that a minimum of a single FLACMetadataBlock,
consisting of a FLAC[3] native METADATA_BLOCK_STREAMINFO
structure, is required. Should the FLACSpecificBox
contain more than a single FLACMetadataBlock structure,
the FLACMetadataBlock containing the FLAC[3] native
METADATA_BLOCK_STREAMINFO must occur first in the list.
Other containers that package FLAC audio streams, such as
Ogg[4] and Matroska[5], wrap FLAC[3] native metadata without
modification similar to this specification. When
repackaging or remuxing FLAC[3] streams from another
format that contains FLAC[3] native metadata into an ISO
BMFF file, the complete FLAC[3] native metadata should be
preserved in the ISO BMFF stream as described above. It
is also allowed to parse this native metadata and include
contextually redundant ISO BMFF-native repackagings and/or
reparsings of FLAC[3] native metadata, so long as the
native metadata is also preserved.
3.3.3 Sample format
A FLAC sample is exactly one FLAC audio FRAME (as defined
in the FLAC[3] file specification) belonging to a FLAC
bitstreams. The FLAC sample data begins with a complete
FLAC FRAME_HEADER, followed by one FLAC SUBFRAME per
channel, any necessary bit padding, and ends with the
usual FLAC FRAME_FOOTER.
Note that the FLAC native FRAME_HEADER structure that
begins each FLAC sample redundantly encodes channel count,
sample rate, and sample size. The values of these fields
must agree both with the values declared in the FLAC
METADATA_BLOCK_STREAMINFO structure as well as the
FLACSampleEntry box.
3.3.4 Duration of a FLAC sample
The duration of any given FLAC sample is determined by
dividing the decoded block size of a FLAC frame, as
encoded in the FLAC FRAME's FRAME_HEADER structure, by the
value of the timescale field in the Media Header Box.
FLAC samples are permitted to have variable durations
within a given audio stream. FLAC does not use padding
values.
3.3.5 Sub-sample
Sub-samples are not defined for FLAC samples in this
specification.
3.3.6 Random Access
This subclause describes the nature of the random access
of FLAC sample.
3.3.6.1 Random Access Point
All FLAC samples can be independently decoded
i.e. every FLAC sample is a sync sample. The Sync
Sample Box shall not be present as long as there are
no samples other than FLAC samples in the same
track. The sample_is_non_sync_sample field for FLAC
samples shall be set to 0.
3.4 Basic Structure (informative)
3.4.1 Initial Movie
This subclause shows a basic structure of the Movie Box as follows:
+----+----+----+----+----+----+----+----+------------------------------+
|moov| | | | | | | | Movie Box |
+----+----+----+----+----+----+----+----+------------------------------+
| |mvhd| | | | | | | Movie Header Box |
+----+----+----+----+----+----+----+----+------------------------------+
| |trak| | | | | | | Track Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | |tkhd| | | | | | Track Header Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | |edts|* | | | | | Edit Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | |elst|* | | | | Edit List Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | |mdia| | | | | | Media Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | |mdhd| | | | | Media Header Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | |hdlr| | | | | Handler Reference Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | |minf| | | | | Media Information Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | |smhd| | | | Sound Media Header Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | |dinf| | | | Data Information Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | | |dref| | | Data Reference Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | | | |url | | DataEntryUrlBox |
+----+----+----+----+----+----+ or +----+------------------------------+
| | | | | | |urn | | DataEntryUrnBox |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | |stbl| | | | Sample Table |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | | |stsd| | | Sample Description Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | | | |fLaC| | FLACSampleEntry |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | | | | |dfLa| FLAC Specific Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | | |stts| | | Decoding Time to Sample Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | | |stsc| | | Sample To Chunk Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | | |stsz| | | Sample Size Box |
+----+----+----+----+----+ or +----+----+------------------------------+
| | | | | |stz2| | | Compact Sample Size Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | | | | |stco| | | Chunk Offset Box |
+----+----+----+----+----+ or +----+----+------------------------------+
| | | | | |co64| | | Chunk Large Offset Box |
+----+----+----+----+----+----+----+----+------------------------------+
| |mvex|* | | | | | | Movie Extends Box |
+----+----+----+----+----+----+----+----+------------------------------+
| | |trex|* | | | | | Track Extends Box |
+----+----+----+----+----+----+----+----+------------------------------+
Figure 1 - Basic structure of Movie Box
It is strongly recommended that the order of boxes should
follow the above structure. Boxes marked with an asterisk
(*) may or may not be present depending on context. For
most boxes listed above, the definition is as is defined
in ISO/IEC 14496-12 [1]. The additional boxes and the
additional requirements, restrictions and recommendations
to the other boxes are described in this specification.
3.5 Example of Encapsulation (informative)
[File]
size = 17790
[ftyp: File Type Box]
position = 0
size = 24
major_brand = mp42 : MP4 version 2
minor_version = 0
compatible_brands
brand[0] = mp42 : MP4 version 2
brand[1] = isom : ISO Base Media file format
[moov: Movie Box]
position = 24
size = 757
[mvhd: Movie Header Box]
position = 32
size = 108
version = 0
flags = 0x000000
creation_time = UTC 2014/12/12, 18:41:19
modification_time = UTC 2014/12/12, 18:41:19
timescale = 48000
duration = 33600 (00:00:00.700)
rate = 1.000000
volume = 1.000000
reserved = 0x0000
reserved = 0x00000000
reserved = 0x00000000
transformation matrix
| a, b, u | | 1.000000, 0.000000, 0.000000 |
| c, d, v | = | 0.000000, 1.000000, 0.000000 |
| x, y, w | | 0.000000, 0.000000, 1.000000 |
pre_defined = 0x00000000
pre_defined = 0x00000000
pre_defined = 0x00000000
pre_defined = 0x00000000
pre_defined = 0x00000000
pre_defined = 0x00000000
next_track_ID = 2
[iods: Object Descriptor Box]
position = 140
size = 33
version = 0
flags = 0x000000
[tag = 0x10: MP4_IOD]
expandableClassSize = 16
ObjectDescriptorID = 1
URL_Flag = 0
includeInlineProfileLevelFlag = 0
reserved = 0xf
ODProfileLevelIndication = 0xff
sceneProfileLevelIndication = 0xff
audioProfileLevelIndication = 0xfe
visualProfileLevelIndication = 0xff
graphicsProfileLevelIndication = 0xff
[tag = 0x0e: ES_ID_Inc]
expandableClassSize = 4
Track_ID = 1
[trak: Track Box]
position = 173
size = 608
[tkhd: Track Header Box]
position = 181
size = 92
version = 0
flags = 0x000007
Track enabled
Track in movie
Track in preview
creation_time = UTC 2014/12/12, 18:41:19
modification_time = UTC 2014/12/12, 18:41:19
track_ID = 1
reserved = 0x00000000
duration = 33600 (00:00:00.700)
reserved = 0x00000000
reserved = 0x00000000
layer = 0
alternate_group = 0
volume = 1.000000
reserved = 0x0000
transformation matrix
| a, b, u | | 1.000000, 0.000000, 0.000000 |
| c, d, v | = | 0.000000, 1.000000, 0.000000 |
| x, y, w | | 0.000000, 0.000000, 1.000000 |
width = 0.000000
height = 0.000000
[mdia: Media Box]
position = 273
size = 472
[mdhd: Media Header Box]
position = 281
size = 32
version = 0
flags = 0x000000
creation_time = UTC 2014/12/12, 18:41:19
modification_time = UTC 2014/12/12, 18:41:19
timescale = 48000
duration = 34560 (00:00:00.720)
language = und
pre_defined = 0x0000
[hdlr: Handler Reference Box]
position = 313
size = 51
version = 0
flags = 0x000000
pre_defined = 0x00000000
handler_type = soun
reserved = 0x00000000
reserved = 0x00000000
reserved = 0x00000000
name = Xiph Audio Handler
[minf: Media Information Box]
position = 364
size = 381
[smhd: Sound Media Header Box]
position = 372
size = 16
version = 0
flags = 0x000000
balance = 0.000000
reserved = 0x0000
[dinf: Data Information Box]
position = 388
size = 36
[dref: Data Reference Box]
position = 396
size = 28
version = 0
flags = 0x000000
entry_count = 1
[url : Data Entry Url Box]
position = 412
size = 12
version = 0
flags = 0x000001
location = in the same file
[stbl: Sample Table Box]
position = 424
size = 321
[stsd: Sample Description Box]
position = 432
size = 79
version = 0
flags = 0x000000
entry_count = 1
[fLaC: Audio Description]
position = 448
size = 63
reserved = 0x000000000000
data_reference_index = 1
reserved = 0x0000
reserved = 0x0000
reserved = 0x00000000
channelcount = 2
samplesize = 16
pre_defined = 0
reserved = 0
samplerate = 48000.000000
[dfLa: FLAC Specific Box]
position = 484
size = 50
version = 0
flags = 0x000000
[FLACMetadataBlock]
LastMetadataBlockFlag = 1
BlockType = 0
Length = 34
BlockData[34];
[stts: Decoding Time to Sample Box]
position = 492
size = 24
version = 0
flags = 0x000000
entry_count = 1
entry[0]
sample_count = 18
sample_delta = 1920
[stsc: Sample To Chunk Box]
position = 516
size = 40
version = 0
flags = 0x000000
entry_count = 2
entry[0]
first_chunk = 1
samples_per_chunk = 13
sample_description_index = 1
entry[1]
first_chunk = 2
samples_per_chunk = 5
sample_description_index = 1
[stsz: Sample Size Box]
position = 556
size = 92
version = 0
flags = 0x000000
sample_size = 0 (variable)
sample_count = 18
entry_size[0] = 977
entry_size[1] = 938
entry_size[2] = 939
entry_size[3] = 938
entry_size[4] = 934
entry_size[5] = 945
entry_size[6] = 948
entry_size[7] = 956
entry_size[8] = 955
entry_size[9] = 930
entry_size[10] = 933
entry_size[11] = 934
entry_size[12] = 972
entry_size[13] = 977
entry_size[14] = 958
entry_size[15] = 949
entry_size[16] = 962
entry_size[17] = 848
[stco: Chunk Offset Box]
position = 648
size = 24
version = 0
flags = 0x000000
entry_count = 2
chunk_offset[0] = 686
chunk_offset[1] = 12985
[free: Free Space Box]
position = 672
size = 8
[mdat: Media Data Box]
position = 680
size = 17001
4 Acknowledgements
This spec draws heavily from the Opus-in-ISOBMFF specification
work done by Yusuke Nakamura <muken.the.vfrmaniac |at| gmail.com>
Thank you to Tim Terriberry, David Evans, and Yusuke Nakamura
for valuable feedback. Thank you to Ralph Giles for editorial
help.
5 Author Address
Monty Montgomery <cmontgomery@mozilla.com>

View file

@ -0,0 +1,40 @@
1. Change version number in
- /configure.ac
- /CMakeLists.txt
- /doc/Doxyfile.in
- /man/flac.md
- /man/metaflac.md
- /test/metaflac-test-files/case07-expect.meta
1. Change version date in
- /src/libFLAC/format.c
- /test/metaflac-test-files/case07-expect.meta
1. Update changelog
1. Check copyright year and update if applicable
1. Check libFLAC and libFLAC++ for interface changes and update
version numbers in include/FLAC/export.h, include/FLAC++/export.h,
src/libFLAC/Makefile.am, src/libFLAC++/Makefile.am,
src/libFLAC/CMakeLists.txt and src/libFLAC++/CMakeLists.txt
1. Prepare and check release tarball by running
`git clean -ffxd && ./autogen.sh && ./configure && make distcheck`
1. Check whether release tarball contains api documentation and
generated man pages
1. Prepare Windows release. Instructions are for building with MinGW-w64
- Take last release as template
- Update readme's if necessary
- Copy changelog and tool documentation
- Unpack tarball and create empty directories build64 and build32
- Unpack most recent libogg: change
`add_library(ogg ${OGG_HEADERS} ${OGG_SOURCES})` to
`add_library(ogg STATIC ${OGG_HEADERS} ${OGG_SOURCES})`
- Add `-static-libgcc` to FLAC's CFLAGS
- Add `-static-libgcc  -static-libstdc++ -Wl,-Bstatic,--whole-archive
-lwinpthread -Wl,-Bdynamic,--no-whole-archive` to FLAC's CXXFLAGS
- Run `CMake -DBUILD_SHARED_LIBS=ON .. && ninja` in both build64 and
build32 in the corresponding build environments
- Check dependencies of flac.exe, metaflac.exe, libFLAC.dll and
libFLAC++.dll, e.g. with objdump -x *.* | grep DLL.
Dependencies should only include KERNEL32.DLL, ADVAPI32.DLL,
msvcrt.dll and libFLAC.dll
- Copy flac.exe, metaflac.exe, libFLAC.dll and libFLAC++.dll of both
builds to proper directories
- Zip directory

View file

@ -0,0 +1,7 @@
add_subdirectory("c/decode/file")
add_subdirectory("c/encode/file")
if(BUILD_CXXLIBS)
add_subdirectory("cpp/decode/file")
add_subdirectory("cpp/encode/file")
endif()

View file

@ -0,0 +1,27 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2001-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
if FLaC__WITH_CPPLIBS
CPPLIBS_DIRS = cpp
endif
SUBDIRS = c $(CPPLIBS_DIRS)
EXTRA_DIST = \
CMakeLists.txt \
README

View file

@ -0,0 +1,12 @@
Here are several small example programs that use the libraries in different
ways.
The "c" directory has programs that are all in C and use libFLAC.
The "cpp" directory has analogous programs that are all in C++ and use libFLAC++.
The programs are:
c/decode/file/ - example_c_decode_file - Simple FLAC file decoder using libFLAC
c/encode/file/ - example_c_encode_file - Simple FLAC file encoder using libFLAC
cpp/decode/file/ - example_cpp_decode_file - Simple FLAC file decoder using libFLAC++
cpp/encode/file/ - example_cpp_encode_file - Simple FLAC file encoder using libFLAC++

View file

@ -0,0 +1,19 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2001-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
SUBDIRS = decode encode

View file

@ -0,0 +1,19 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2001-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
SUBDIRS = file

View file

@ -0,0 +1,2 @@
add_executable(decode_file main.c)
target_link_libraries(decode_file FLAC)

View file

@ -0,0 +1,29 @@
# example_c_decode_file - Simple FLAC file decoder using libFLAC
# Copyright (C) 2007-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
EXTRA_DIST = \
CMakeLists.txt
AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include
noinst_PROGRAMS = example_c_decode_file
example_c_decode_file_LDADD = \
$(top_builddir)/src/libFLAC/libFLAC.la
example_c_decode_file_SOURCES = main.c
CLEANFILES = example_c_decode_file.exe

View file

@ -0,0 +1,200 @@
/* example_c_decode_file - Simple FLAC file decoder using libFLAC
* Copyright (C) 2007-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* This example shows how to use libFLAC to decode a FLAC file to a WAVE
* file. It only supports 16-bit stereo files.
*
* Complete API documentation can be found at:
* http://xiph.org/flac/api/
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include "share/compat.h"
#include "FLAC/stream_decoder.h"
static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
static void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data);
static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data);
static FLAC__uint64 total_samples = 0;
static unsigned sample_rate = 0;
static unsigned channels = 0;
static unsigned bps = 0;
static FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 x)
{
return
fputc(x, f) != EOF &&
fputc(x >> 8, f) != EOF
;
}
static FLAC__bool write_little_endian_int16(FILE *f, FLAC__int16 x)
{
return write_little_endian_uint16(f, (FLAC__uint16)x);
}
static FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 x)
{
return
fputc(x, f) != EOF &&
fputc(x >> 8, f) != EOF &&
fputc(x >> 16, f) != EOF &&
fputc(x >> 24, f) != EOF
;
}
int main(int argc, char *argv[])
{
FLAC__bool ok = true;
FLAC__StreamDecoder *decoder = 0;
FLAC__StreamDecoderInitStatus init_status;
FILE *fout;
if(argc != 3) {
fprintf(stderr, "usage: %s infile.flac outfile.wav\n", argv[0]);
return 1;
}
if((fout = fopen(argv[2], "wb")) == NULL) {
fprintf(stderr, "ERROR: opening %s for output\n", argv[2]);
return 1;
}
if((decoder = FLAC__stream_decoder_new()) == NULL) {
fprintf(stderr, "ERROR: allocating decoder\n");
fclose(fout);
return 1;
}
(void)FLAC__stream_decoder_set_md5_checking(decoder, true);
init_status = FLAC__stream_decoder_init_file(decoder, argv[1], write_callback, metadata_callback, error_callback, /*client_data=*/fout);
if(init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
fprintf(stderr, "ERROR: initializing decoder: %s\n", FLAC__StreamDecoderInitStatusString[init_status]);
ok = false;
}
if(ok) {
ok = FLAC__stream_decoder_process_until_end_of_stream(decoder);
fprintf(stderr, "decoding: %s\n", ok? "succeeded" : "FAILED");
fprintf(stderr, " state: %s\n", FLAC__StreamDecoderStateString[FLAC__stream_decoder_get_state(decoder)]);
}
FLAC__stream_decoder_delete(decoder);
fclose(fout);
return 0;
}
FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data)
{
FILE *f = (FILE*)client_data;
const FLAC__uint32 total_size = (FLAC__uint32)(total_samples * channels * (bps/8));
size_t i;
(void)decoder;
if(total_samples == 0) {
fprintf(stderr, "ERROR: this example only works for FLAC files that have a total_samples count in STREAMINFO\n");
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
if(channels != 2 || bps != 16) {
fprintf(stderr, "ERROR: this example only supports 16bit stereo streams\n");
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
if(frame->header.channels != 2) {
fprintf(stderr, "ERROR: This frame contains %u channels (should be 2)\n", frame->header.channels);
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
if(buffer [0] == NULL) {
fprintf(stderr, "ERROR: buffer [0] is NULL\n");
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
if(buffer [1] == NULL) {
fprintf(stderr, "ERROR: buffer [1] is NULL\n");
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
/* write WAVE header before we write the first frame */
if(frame->header.number.sample_number == 0) {
if(
fwrite("RIFF", 1, 4, f) < 4 ||
!write_little_endian_uint32(f, total_size + 36) ||
fwrite("WAVEfmt ", 1, 8, f) < 8 ||
!write_little_endian_uint32(f, 16) ||
!write_little_endian_uint16(f, 1) ||
!write_little_endian_uint16(f, (FLAC__uint16)channels) ||
!write_little_endian_uint32(f, sample_rate) ||
!write_little_endian_uint32(f, sample_rate * channels * (bps/8)) ||
!write_little_endian_uint16(f, (FLAC__uint16)(channels * (bps/8))) || /* block align */
!write_little_endian_uint16(f, (FLAC__uint16)bps) ||
fwrite("data", 1, 4, f) < 4 ||
!write_little_endian_uint32(f, total_size)
) {
fprintf(stderr, "ERROR: write error\n");
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
}
/* write decoded PCM samples */
for(i = 0; i < frame->header.blocksize; i++) {
if(
!write_little_endian_int16(f, (FLAC__int16)buffer[0][i]) || /* left channel */
!write_little_endian_int16(f, (FLAC__int16)buffer[1][i]) /* right channel */
) {
fprintf(stderr, "ERROR: write error\n");
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
}
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data)
{
(void)decoder, (void)client_data;
/* print some stats */
if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
/* save for later */
total_samples = metadata->data.stream_info.total_samples;
sample_rate = metadata->data.stream_info.sample_rate;
channels = metadata->data.stream_info.channels;
bps = metadata->data.stream_info.bits_per_sample;
fprintf(stderr, "sample rate : %u Hz\n", sample_rate);
fprintf(stderr, "channels : %u\n", channels);
fprintf(stderr, "bits per sample: %u\n", bps);
fprintf(stderr, "total samples : %" PRIu64 "\n", total_samples);
}
}
void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
{
(void)decoder, (void)client_data;
fprintf(stderr, "Got error callback: %s\n", FLAC__StreamDecoderErrorStatusString[status]);
}

View file

@ -0,0 +1,19 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2001-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
SUBDIRS = file

View file

@ -0,0 +1,2 @@
add_executable(encode_file main.c)
target_link_libraries(encode_file FLAC)

View file

@ -0,0 +1,31 @@
# example_c_encode_file - Simple FLAC file encoder using libFLAC
# Copyright (C) 2007-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
EXTRA_DIST = \
CMakeLists.txt
AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include
noinst_PROGRAMS = example_c_encode_file
example_c_encode_file_LDADD = \
$(top_builddir)/src/libFLAC/libFLAC.la \
@OGG_LIBS@ \
-lm
example_c_encode_file_SOURCES = main.c
CLEANFILES = example_c_encode_file.exe

View file

@ -0,0 +1,173 @@
/* example_c_encode_file - Simple FLAC file encoder using libFLAC
* Copyright (C) 2007-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* This example shows how to use libFLAC to encode a WAVE file to a FLAC
* file. It only supports 16-bit stereo files in canonical WAVE format.
*
* Complete API documentation can be found at:
* http://xiph.org/flac/api/
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "share/compat.h"
#include "FLAC/metadata.h"
#include "FLAC/stream_encoder.h"
static void progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data);
#define READSIZE 1024
static unsigned total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */
static FLAC__byte buffer[READSIZE/*samples*/ * 2/*bytes_per_sample*/ * 2/*channels*/]; /* we read the WAVE data into here */
static FLAC__int32 pcm[READSIZE/*samples*/ * 2/*channels*/];
int main(int argc, char *argv[])
{
FLAC__bool ok = true;
FLAC__StreamEncoder *encoder = 0;
FLAC__StreamEncoderInitStatus init_status;
FLAC__StreamMetadata *metadata[2];
FLAC__StreamMetadata_VorbisComment_Entry entry;
FILE *fin;
unsigned sample_rate = 0;
unsigned channels = 0;
unsigned bps = 0;
if(argc != 3) {
fprintf(stderr, "usage: %s infile.wav outfile.flac\n", argv[0]);
return 1;
}
if((fin = fopen(argv[1], "rb")) == NULL) {
fprintf(stderr, "ERROR: opening %s for output\n", argv[1]);
return 1;
}
/* read wav header and validate it */
if(
fread(buffer, 1, 44, fin) != 44 ||
memcmp(buffer, "RIFF", 4) ||
memcmp(buffer+8, "WAVEfmt \020\000\000\000\001\000\002\000", 16) ||
memcmp(buffer+32, "\004\000\020\000data", 8)
) {
fprintf(stderr, "ERROR: invalid/unsupported WAVE file, only 16bps stereo WAVE in canonical form allowed\n");
fclose(fin);
return 1;
}
sample_rate = ((((((unsigned)buffer[27] << 8) | buffer[26]) << 8) | buffer[25]) << 8) | buffer[24];
channels = 2;
bps = 16;
total_samples = (((((((unsigned)buffer[43] << 8) | buffer[42]) << 8) | buffer[41]) << 8) | buffer[40]) / 4;
/* allocate the encoder */
if((encoder = FLAC__stream_encoder_new()) == NULL) {
fprintf(stderr, "ERROR: allocating encoder\n");
fclose(fin);
return 1;
}
ok &= FLAC__stream_encoder_set_verify(encoder, true);
ok &= FLAC__stream_encoder_set_compression_level(encoder, 5);
ok &= FLAC__stream_encoder_set_channels(encoder, channels);
ok &= FLAC__stream_encoder_set_bits_per_sample(encoder, bps);
ok &= FLAC__stream_encoder_set_sample_rate(encoder, sample_rate);
ok &= FLAC__stream_encoder_set_total_samples_estimate(encoder, total_samples);
/* now add some metadata; we'll add some tags and a padding block */
if(ok) {
if(
(metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT)) == NULL ||
(metadata[1] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)) == NULL ||
/* there are many tag (vorbiscomment) functions but these are convenient for this particular use: */
!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, "ARTIST", "Some Artist") ||
!FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, /*copy=*/false) || /* copy=false: let metadata object take control of entry's allocated string */
!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, "YEAR", "1984") ||
!FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, /*copy=*/false)
) {
fprintf(stderr, "ERROR: out of memory or tag error\n");
ok = false;
} else {
metadata[1]->length = 1234; /* set the padding length */
ok = FLAC__stream_encoder_set_metadata(encoder, metadata, 2);
}
}
/* initialize encoder */
if(ok) {
init_status = FLAC__stream_encoder_init_file(encoder, argv[2], progress_callback, /*client_data=*/NULL);
if(init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK) {
fprintf(stderr, "ERROR: initializing encoder: %s\n", FLAC__StreamEncoderInitStatusString[init_status]);
ok = false;
}
}
/* read blocks of samples from WAVE file and feed to encoder */
if(ok) {
size_t left = (size_t)total_samples;
while(ok && left) {
size_t need = (left>READSIZE? (size_t)READSIZE : (size_t)left);
if(fread(buffer, channels*(bps/8), need, fin) != need) {
fprintf(stderr, "ERROR: reading from WAVE file\n");
ok = false;
}
else {
/* convert the packed little-endian 16-bit PCM samples from WAVE into an interleaved FLAC__int32 buffer for libFLAC */
size_t i;
for(i = 0; i < need*channels; i++) {
/* inefficient but simple and works on big- or little-endian machines */
pcm[i] = (FLAC__int32)(((FLAC__int16)(FLAC__int8)buffer[2*i+1] << 8) | (FLAC__int16)buffer[2*i]);
}
/* feed samples to encoder */
ok = FLAC__stream_encoder_process_interleaved(encoder, pcm, need);
}
left -= need;
}
}
ok &= FLAC__stream_encoder_finish(encoder);
fprintf(stderr, "encoding: %s\n", ok? "succeeded" : "FAILED");
fprintf(stderr, " state: %s\n", FLAC__StreamEncoderStateString[FLAC__stream_encoder_get_state(encoder)]);
/* now that encoding is finished, the metadata can be freed */
FLAC__metadata_object_delete(metadata[0]);
FLAC__metadata_object_delete(metadata[1]);
FLAC__stream_encoder_delete(encoder);
fclose(fin);
return 0;
}
void progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data)
{
(void)encoder, (void)client_data;
fprintf(stderr, "wrote %" PRIu64 " bytes, %" PRIu64 "/%u samples, %u/%u frames\n", bytes_written, samples_written, total_samples, frames_written, total_frames_estimate);
}

View file

@ -0,0 +1,19 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2001-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
SUBDIRS = decode encode

View file

@ -0,0 +1,19 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2001-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
SUBDIRS = file

View file

@ -0,0 +1,2 @@
add_executable(decode_file_cxx main.cpp)
target_link_libraries(decode_file_cxx FLAC++)

View file

@ -0,0 +1,32 @@
# example_cpp_decode_file - Simple FLAC file decoder using libFLAC
# Copyright (C) 2007-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
EXTRA_DIST = \
CMakeLists.txt
AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include
noinst_PROGRAMS = example_cpp_decode_file
example_cpp_decode_file_LDADD = \
$(top_builddir)/src/libFLAC++/libFLAC++.la \
$(top_builddir)/src/libFLAC/libFLAC.la \
@OGG_LIBS@ \
-lm
example_cpp_decode_file_SOURCES = main.cpp
CLEANFILES = example_cpp_decode_file.exe

View file

@ -0,0 +1,195 @@
/* example_cpp_decode_file - Simple FLAC file decoder using libFLAC
* Copyright (C) 2007-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* This example shows how to use libFLAC++ to decode a FLAC file to a WAVE
* file. It only supports 16-bit stereo files.
*
* Complete API documentation can be found at:
* http://xiph.org/flac/api/
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include "FLAC++/decoder.h"
#include "share/compat.h"
static FLAC__uint64 total_samples = 0;
static uint32_t sample_rate = 0;
static uint32_t channels = 0;
static uint32_t bps = 0;
static bool write_little_endian_uint16(FILE *f, FLAC__uint16 x)
{
return
fputc(x, f) != EOF &&
fputc(x >> 8, f) != EOF
;
}
static bool write_little_endian_int16(FILE *f, FLAC__int16 x)
{
return write_little_endian_uint16(f, (FLAC__uint16)x);
}
static bool write_little_endian_uint32(FILE *f, FLAC__uint32 x)
{
return
fputc(x, f) != EOF &&
fputc(x >> 8, f) != EOF &&
fputc(x >> 16, f) != EOF &&
fputc(x >> 24, f) != EOF
;
}
class OurDecoder: public FLAC::Decoder::File {
public:
OurDecoder(FILE *f_): FLAC::Decoder::File(), f(f_) { }
protected:
FILE *f;
virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]);
virtual void metadata_callback(const ::FLAC__StreamMetadata *metadata);
virtual void error_callback(::FLAC__StreamDecoderErrorStatus status);
private:
OurDecoder(const OurDecoder&);
OurDecoder&operator=(const OurDecoder&);
};
int main(int argc, char *argv[])
{
bool ok = true;
FILE *fout;
if(argc != 3) {
fprintf(stderr, "usage: %s infile.flac outfile.wav\n", argv[0]);
return 1;
}
if((fout = fopen(argv[2], "wb")) == NULL) {
fprintf(stderr, "ERROR: opening %s for output\n", argv[2]);
return 1;
}
OurDecoder decoder(fout);
if(!decoder) {
fprintf(stderr, "ERROR: allocating decoder\n");
fclose(fout);
return 1;
}
(void)decoder.set_md5_checking(true);
FLAC__StreamDecoderInitStatus init_status = decoder.init(argv[1]);
if(init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
fprintf(stderr, "ERROR: initializing decoder: %s\n", FLAC__StreamDecoderInitStatusString[init_status]);
ok = false;
}
if(ok) {
ok = decoder.process_until_end_of_stream();
fprintf(stderr, "decoding: %s\n", ok? "succeeded" : "FAILED");
fprintf(stderr, " state: %s\n", decoder.get_state().resolved_as_cstring(decoder));
}
fclose(fout);
return 0;
}
::FLAC__StreamDecoderWriteStatus OurDecoder::write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[])
{
const FLAC__uint32 total_size = (FLAC__uint32)(total_samples * channels * (bps/8));
size_t i;
// Update data
channels = OurDecoder::get_channels();
bps = OurDecoder::get_bits_per_sample();
if(total_samples == 0) {
fprintf(stderr, "ERROR: this example only works for FLAC files that have a total_samples count in STREAMINFO\n");
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
if(channels != 2 || bps != 16) {
fprintf(stderr, "ERROR: this example only supports 16bit stereo streams\n");
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
/* write WAVE header before we write the first frame */
if(frame->header.number.sample_number == 0) {
if(
fwrite("RIFF", 1, 4, f) < 4 ||
!write_little_endian_uint32(f, total_size + 36) ||
fwrite("WAVEfmt ", 1, 8, f) < 8 ||
!write_little_endian_uint32(f, 16) ||
!write_little_endian_uint16(f, 1) ||
!write_little_endian_uint16(f, (FLAC__uint16)channels) ||
!write_little_endian_uint32(f, sample_rate) ||
!write_little_endian_uint32(f, sample_rate * channels * (bps/8)) ||
!write_little_endian_uint16(f, (FLAC__uint16)(channels * (bps/8))) || /* block align */
!write_little_endian_uint16(f, (FLAC__uint16)bps) ||
fwrite("data", 1, 4, f) < 4 ||
!write_little_endian_uint32(f, total_size)
) {
fprintf(stderr, "ERROR: write error\n");
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
}
/* write decoded PCM samples */
for(i = 0; i < frame->header.blocksize; i++) {
if(
!write_little_endian_int16(f, (FLAC__int16)buffer[0][i]) || /* left channel */
!write_little_endian_int16(f, (FLAC__int16)buffer[1][i]) /* right channel */
) {
fprintf(stderr, "ERROR: write error\n");
return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT;
}
}
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
void OurDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata)
{
/* print some stats */
if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
/* save for later */
total_samples = metadata->data.stream_info.total_samples;
sample_rate = metadata->data.stream_info.sample_rate;
channels = metadata->data.stream_info.channels;
bps = metadata->data.stream_info.bits_per_sample;
fprintf(stderr, "sample rate : %u Hz\n", sample_rate);
fprintf(stderr, "channels : %u\n", channels);
fprintf(stderr, "bits per sample: %u\n", bps);
fprintf(stderr, "total samples : %" PRIu64 "\n", total_samples);
}
}
void OurDecoder::error_callback(::FLAC__StreamDecoderErrorStatus status)
{
fprintf(stderr, "Got error callback: %s\n", FLAC__StreamDecoderErrorStatusString[status]);
}

View file

@ -0,0 +1,19 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2001-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
SUBDIRS = file

View file

@ -0,0 +1,2 @@
add_executable(encode_file_cxx main.cpp)
target_link_libraries(encode_file_cxx FLAC++)

View file

@ -0,0 +1,32 @@
# example_cpp_encode_file - Simple FLAC file encoder using libFLAC
# Copyright (C) 2007-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
EXTRA_DIST = \
CMakeLists.txt
AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include
noinst_PROGRAMS = example_cpp_encode_file
example_cpp_encode_file_LDADD = \
$(top_builddir)/src/libFLAC++/libFLAC++.la \
$(top_builddir)/src/libFLAC/libFLAC.la \
@OGG_LIBS@ \
-lm
example_cpp_encode_file_SOURCES = main.cpp
CLEANFILES = example_cpp_encode_file.exe

View file

@ -0,0 +1,178 @@
/* example_cpp_encode_file - Simple FLAC file encoder using libFLAC
* Copyright (C) 2007-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* This example shows how to use libFLAC++ to encode a WAVE file to a FLAC
* file. It only supports 16-bit stereo files in canonical WAVE format.
*
* Complete API documentation can be found at:
* http://xiph.org/flac/api/
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "FLAC++/metadata.h"
#include "FLAC++/encoder.h"
#include "share/compat.h"
#include <cstring>
class OurEncoder: public FLAC::Encoder::File {
public:
OurEncoder(): FLAC::Encoder::File() { }
protected:
virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate);
};
#define READSIZE 1024
static uint32_t total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */
static FLAC__byte buffer[READSIZE/*samples*/ * 2/*bytes_per_sample*/ * 2/*channels*/]; /* we read the WAVE data into here */
static FLAC__int32 pcm[READSIZE/*samples*/ * 2/*channels*/];
int main(int argc, char *argv[])
{
bool ok = true;
OurEncoder encoder;
FLAC__StreamEncoderInitStatus init_status;
FLAC__StreamMetadata *metadata[2];
FLAC__StreamMetadata_VorbisComment_Entry entry;
FILE *fin;
uint32_t sample_rate = 0;
uint32_t channels = 0;
uint32_t bps = 0;
if(argc != 3) {
fprintf(stderr, "usage: %s infile.wav outfile.flac\n", argv[0]);
return 1;
}
if((fin = fopen(argv[1], "rb")) == NULL) {
fprintf(stderr, "ERROR: opening %s for output\n", argv[1]);
return 1;
}
/* read wav header and validate it */
if(
fread(buffer, 1, 44, fin) != 44 ||
memcmp(buffer, "RIFF", 4) ||
memcmp(buffer+8, "WAVEfmt \020\000\000\000\001\000\002\000", 16) ||
memcmp(buffer+32, "\004\000\020\000data", 8)
) {
fprintf(stderr, "ERROR: invalid/unsupported WAVE file, only 16bps stereo WAVE in canonical form allowed\n");
fclose(fin);
return 1;
}
sample_rate = ((((((uint32_t)buffer[27] << 8) | buffer[26]) << 8) | buffer[25]) << 8) | buffer[24];
channels = 2;
bps = 16;
total_samples = (((((((uint32_t)buffer[43] << 8) | buffer[42]) << 8) | buffer[41]) << 8) | buffer[40]) / 4;
/* check the encoder */
if(!encoder) {
fprintf(stderr, "ERROR: allocating encoder\n");
fclose(fin);
return 1;
}
ok &= encoder.set_verify(true);
ok &= encoder.set_compression_level(5);
ok &= encoder.set_channels(channels);
ok &= encoder.set_bits_per_sample(bps);
ok &= encoder.set_sample_rate(sample_rate);
ok &= encoder.set_total_samples_estimate(total_samples);
/* now add some metadata; we'll add some tags and a padding block */
if(ok) {
if(
(metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT)) == NULL ||
(metadata[1] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)) == NULL ||
/* there are many tag (vorbiscomment) functions but these are convenient for this particular use: */
!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, "ARTIST", "Some Artist") ||
!FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, /*copy=*/false) || /* copy=false: let metadata object take control of entry's allocated string */
!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, "YEAR", "1984") ||
!FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, /*copy=*/false)
) {
fprintf(stderr, "ERROR: out of memory or tag error\n");
ok = false;
} else {
metadata[1]->length = 1234; /* set the padding length */
ok = encoder.set_metadata(metadata, 2);
}
}
/* initialize encoder */
if(ok) {
init_status = encoder.init(argv[2]);
if(init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK) {
fprintf(stderr, "ERROR: initializing encoder: %s\n", FLAC__StreamEncoderInitStatusString[init_status]);
ok = false;
}
}
/* read blocks of samples from WAVE file and feed to encoder */
if(ok) {
size_t left = (size_t)total_samples;
while(ok && left) {
size_t need = (left>READSIZE? (size_t)READSIZE : (size_t)left);
if(fread(buffer, channels*(bps/8), need, fin) != need) {
fprintf(stderr, "ERROR: reading from WAVE file\n");
ok = false;
}
else {
/* convert the packed little-endian 16-bit PCM samples from WAVE into an interleaved FLAC__int32 buffer for libFLAC */
size_t i;
for(i = 0; i < need*channels; i++) {
/* inefficient but simple and works on big- or little-endian machines */
pcm[i] = (FLAC__int32)(((FLAC__int16)(FLAC__int8)buffer[2*i+1] << 8) | (FLAC__int16)buffer[2*i]);
}
/* feed samples to encoder */
ok = encoder.process_interleaved(pcm, need);
}
left -= need;
}
}
ok &= encoder.finish();
fprintf(stderr, "encoding: %s\n", ok? "succeeded" : "FAILED");
fprintf(stderr, " state: %s\n", encoder.get_state().resolved_as_cstring(encoder));
/* now that encoding is finished, the metadata can be freed */
FLAC__metadata_object_delete(metadata[0]);
FLAC__metadata_object_delete(metadata[1]);
fclose(fin);
return 0;
}
void OurEncoder::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate)
{
fprintf(stderr, "wrote %" PRIu64 " bytes, %" PRIu64 "/%u samples, %u/%u frames\n", bytes_written, samples_written, total_samples, frames_written, total_frames_estimate);
}

View file

@ -0,0 +1,17 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
if(NOT TARGET Ogg::ogg)
find_dependency(Ogg)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/targets.cmake")
if(TARGET FLAC::FLAC)
set(FLAC_FLAC_FOUND 1)
endif()
if(TARGET FLAC::FLAC++)
set(FLAC_FLAC++_FOUND 1)
endif()
check_required_components(FLAC)

View file

@ -0,0 +1,39 @@
# libFLAC++ - Free Lossless Audio Codec library
# Copyright (C) 2002-2009 Josh Coalson
# Copyright (C) 2011-2023 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.
flaccppincludedir = $(includedir)/FLAC++
AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include
flaccppinclude_HEADERS = \
all.h \
decoder.h \
encoder.h \
export.h \
metadata.h

View file

@ -0,0 +1,49 @@
/* libFLAC++ - Free Lossless Audio Codec library
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 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.
*/
#ifndef FLACPP__ALL_H
#define FLACPP__ALL_H
#include "export.h"
#include "encoder.h"
#include "decoder.h"
#include "metadata.h"
/** \defgroup flacpp FLAC C++ API
*
* The FLAC C++ API is the interface to libFLAC++, a set of classes
* that encapsulate the encoders, decoders, and metadata interfaces
* in libFLAC.
*/
#endif

View file

@ -0,0 +1,248 @@
/* libFLAC++ - Free Lossless Audio Codec library
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 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.
*/
#ifndef FLACPP__DECODER_H
#define FLACPP__DECODER_H
#include "export.h"
#include <string>
#include "FLAC/stream_decoder.h"
/** \file include/FLAC++/decoder.h
*
* \brief
* This module contains the classes which implement the various
* decoders.
*
* See the detailed documentation in the
* \link flacpp_decoder decoder \endlink module.
*/
/** \defgroup flacpp_decoder FLAC++/decoder.h: decoder classes
* \ingroup flacpp
*
* \brief
* This module describes the decoder layers provided by libFLAC++.
*
* The libFLAC++ decoder classes are object wrappers around their
* counterparts in libFLAC. All decoding layers available in
* libFLAC are also provided here. The interface is very similar;
* make sure to read the \link flac_decoder libFLAC decoder module \endlink.
*
* There are only two significant differences here. First, instead of
* passing in C function pointers for callbacks, you inherit from the
* decoder class and provide implementations for the callbacks in your
* derived class; because of this there is no need for a 'client_data'
* property.
*
* Second, there are two stream decoder classes. FLAC::Decoder::Stream
* is used for the same cases that FLAC__stream_decoder_init_stream() /
* FLAC__stream_decoder_init_ogg_stream() are used, and FLAC::Decoder::File
* is used for the same cases that
* FLAC__stream_decoder_init_FILE() and FLAC__stream_decoder_init_file() /
* FLAC__stream_decoder_init_ogg_FILE() and FLAC__stream_decoder_init_ogg_file()
* are used.
*/
namespace FLAC {
namespace Decoder {
/** \ingroup flacpp_decoder
* \brief
* This class wraps the ::FLAC__StreamDecoder. If you are
* decoding from a file, FLAC::Decoder::File may be more
* convenient.
*
* The usage of this class is similar to FLAC__StreamDecoder,
* except instead of providing callbacks to
* FLAC__stream_decoder_init*_stream(), you will inherit from this
* class and override the virtual callback functions with your
* own implementations, then call init() or init_ogg(). The rest
* of the calls work the same as in the C layer.
*
* Only the read, write, and error callbacks are mandatory. The
* others are optional; this class provides default
* implementations that do nothing. In order for seeking to work
* you must override seek_callback(), tell_callback(),
* length_callback(), and eof_callback().
*/
class FLACPP_API Stream {
public:
/** This class is a wrapper around FLAC__StreamDecoderState.
*/
class FLACPP_API State {
public:
inline State(::FLAC__StreamDecoderState state): state_(state) { }
inline operator ::FLAC__StreamDecoderState() const { return state_; }
inline const char *as_cstring() const { return ::FLAC__StreamDecoderStateString[state_]; }
inline const char *resolved_as_cstring(const Stream &decoder) const { return ::FLAC__stream_decoder_get_resolved_state_string(decoder.decoder_); }
protected:
::FLAC__StreamDecoderState state_;
};
Stream();
virtual ~Stream();
//@{
/** Call after construction to check that the object was created
* successfully. If not, use get_state() to find out why not.
*/
virtual bool is_valid() const;
inline operator bool() const { return is_valid(); } ///< See is_valid()
//@}
virtual bool set_ogg_serial_number(long value); ///< See FLAC__stream_decoder_set_ogg_serial_number()
virtual bool set_md5_checking(bool value); ///< See FLAC__stream_decoder_set_md5_checking()
virtual bool set_metadata_respond(::FLAC__MetadataType type); ///< See FLAC__stream_decoder_set_metadata_respond()
virtual bool set_metadata_respond_application(const FLAC__byte id[4]); ///< See FLAC__stream_decoder_set_metadata_respond_application()
virtual bool set_metadata_respond_all(); ///< See FLAC__stream_decoder_set_metadata_respond_all()
virtual bool set_metadata_ignore(::FLAC__MetadataType type); ///< See FLAC__stream_decoder_set_metadata_ignore()
virtual bool set_metadata_ignore_application(const FLAC__byte id[4]); ///< See FLAC__stream_decoder_set_metadata_ignore_application()
virtual bool set_metadata_ignore_all(); ///< See FLAC__stream_decoder_set_metadata_ignore_all()
/* get_state() is not virtual since we want subclasses to be able to return their own state */
State get_state() const; ///< See FLAC__stream_decoder_get_state()
virtual bool get_md5_checking() const; ///< See FLAC__stream_decoder_get_md5_checking()
virtual FLAC__uint64 get_total_samples() const; ///< See FLAC__stream_decoder_get_total_samples()
virtual uint32_t get_channels() const; ///< See FLAC__stream_decoder_get_channels()
virtual ::FLAC__ChannelAssignment get_channel_assignment() const; ///< See FLAC__stream_decoder_get_channel_assignment()
virtual uint32_t get_bits_per_sample() const; ///< See FLAC__stream_decoder_get_bits_per_sample()
virtual uint32_t get_sample_rate() const; ///< See FLAC__stream_decoder_get_sample_rate()
virtual uint32_t get_blocksize() const; ///< See FLAC__stream_decoder_get_blocksize()
virtual bool get_decode_position(FLAC__uint64 *position) const; ///< See FLAC__stream_decoder_get_decode_position()
virtual ::FLAC__StreamDecoderInitStatus init(); ///< Seek FLAC__stream_decoder_init_stream()
virtual ::FLAC__StreamDecoderInitStatus init_ogg(); ///< Seek FLAC__stream_decoder_init_ogg_stream()
virtual bool finish(); ///< See FLAC__stream_decoder_finish()
virtual bool flush(); ///< See FLAC__stream_decoder_flush()
virtual bool reset(); ///< See FLAC__stream_decoder_reset()
virtual bool process_single(); ///< See FLAC__stream_decoder_process_single()
virtual bool process_until_end_of_metadata(); ///< See FLAC__stream_decoder_process_until_end_of_metadata()
virtual bool process_until_end_of_stream(); ///< See FLAC__stream_decoder_process_until_end_of_stream()
virtual bool skip_single_frame(); ///< See FLAC__stream_decoder_skip_single_frame()
virtual bool seek_absolute(FLAC__uint64 sample); ///< See FLAC__stream_decoder_seek_absolute()
protected:
/// see FLAC__StreamDecoderReadCallback
virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes) = 0;
/// see FLAC__StreamDecoderSeekCallback
virtual ::FLAC__StreamDecoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset);
/// see FLAC__StreamDecoderTellCallback
virtual ::FLAC__StreamDecoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset);
/// see FLAC__StreamDecoderLengthCallback
virtual ::FLAC__StreamDecoderLengthStatus length_callback(FLAC__uint64 *stream_length);
/// see FLAC__StreamDecoderEofCallback
virtual bool eof_callback();
/// see FLAC__StreamDecoderWriteCallback
virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) = 0;
/// see FLAC__StreamDecoderMetadataCallback
virtual void metadata_callback(const ::FLAC__StreamMetadata *metadata);
/// see FLAC__StreamDecoderErrorCallback
virtual void error_callback(::FLAC__StreamDecoderErrorStatus status) = 0;
#if (defined __BORLANDC__) || (defined __GNUG__ && (__GNUG__ < 2 || (__GNUG__ == 2 && __GNUC_MINOR__ < 96))) || (defined __SUNPRO_CC)
// lame hack: some compilers can't see a protected decoder_ from nested State::resolved_as_cstring()
friend State;
#endif
::FLAC__StreamDecoder *decoder_;
static ::FLAC__StreamDecoderReadStatus read_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
static ::FLAC__StreamDecoderSeekStatus seek_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data);
static ::FLAC__StreamDecoderTellStatus tell_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
static ::FLAC__StreamDecoderLengthStatus length_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data);
static FLAC__bool eof_callback_(const ::FLAC__StreamDecoder *decoder, void *client_data);
static ::FLAC__StreamDecoderWriteStatus write_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data);
static void metadata_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *client_data);
static void error_callback_(const ::FLAC__StreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *client_data);
private:
// Private and undefined so you can't use them:
Stream(const Stream &);
void operator=(const Stream &);
};
/** \ingroup flacpp_decoder
* \brief
* This class wraps the ::FLAC__StreamDecoder. If you are
* not decoding from a file, you may need to use
* FLAC::Decoder::Stream.
*
* The usage of this class is similar to FLAC__StreamDecoder,
* except instead of providing callbacks to
* FLAC__stream_decoder_init*_FILE() or
* FLAC__stream_decoder_init*_file(), you will inherit from this
* class and override the virtual callback functions with your
* own implementations, then call init() or init_off(). The rest
* of the calls work the same as in the C layer.
*
* Only the write, and error callbacks from FLAC::Decoder::Stream
* are mandatory. The others are optional; this class provides
* full working implementations for all other callbacks and
* supports seeking.
*/
class FLACPP_API File: public Stream {
public:
File();
virtual ~File();
using Stream::init;
virtual ::FLAC__StreamDecoderInitStatus init(FILE *file); ///< See FLAC__stream_decoder_init_FILE()
virtual ::FLAC__StreamDecoderInitStatus init(const char *filename); ///< See FLAC__stream_decoder_init_file()
virtual ::FLAC__StreamDecoderInitStatus init(const std::string &filename); ///< See FLAC__stream_decoder_init_file()
using Stream::init_ogg;
virtual ::FLAC__StreamDecoderInitStatus init_ogg(FILE *file); ///< See FLAC__stream_decoder_init_ogg_FILE()
virtual ::FLAC__StreamDecoderInitStatus init_ogg(const char *filename); ///< See FLAC__stream_decoder_init_ogg_file()
virtual ::FLAC__StreamDecoderInitStatus init_ogg(const std::string &filename); ///< See FLAC__stream_decoder_init_ogg_file()
protected:
// this is a dummy implementation to satisfy the pure virtual in Stream that is actually supplied internally by the C layer
virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes);
private:
// Private and undefined so you can't use them:
File(const File &);
void operator=(const File &);
};
}
}
#endif

View file

@ -0,0 +1,265 @@
/* libFLAC++ - Free Lossless Audio Codec library
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 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.
*/
#ifndef FLACPP__ENCODER_H
#define FLACPP__ENCODER_H
#include "export.h"
#include "FLAC/stream_encoder.h"
#include "decoder.h"
#include "metadata.h"
/** \file include/FLAC++/encoder.h
*
* \brief
* This module contains the classes which implement the various
* encoders.
*
* See the detailed documentation in the
* \link flacpp_encoder encoder \endlink module.
*/
/** \defgroup flacpp_encoder FLAC++/encoder.h: encoder classes
* \ingroup flacpp
*
* \brief
* This module describes the encoder layers provided by libFLAC++.
*
* The libFLAC++ encoder classes are object wrappers around their
* counterparts in libFLAC. All encoding layers available in
* libFLAC are also provided here. The interface is very similar;
* make sure to read the \link flac_encoder libFLAC encoder module \endlink.
*
* There are only two significant differences here. First, instead of
* passing in C function pointers for callbacks, you inherit from the
* encoder class and provide implementations for the callbacks in your
* derived class; because of this there is no need for a 'client_data'
* property.
*
* Second, there are two stream encoder classes. FLAC::Encoder::Stream
* is used for the same cases that FLAC__stream_encoder_init_stream() /
* FLAC__stream_encoder_init_ogg_stream() are used, and FLAC::Encoder::File
* is used for the same cases that
* FLAC__stream_encoder_init_FILE() and FLAC__stream_encoder_init_file() /
* FLAC__stream_encoder_init_ogg_FILE() and FLAC__stream_encoder_init_ogg_file()
* are used.
*/
namespace FLAC {
namespace Encoder {
/** \ingroup flacpp_encoder
* \brief
* This class wraps the ::FLAC__StreamEncoder. If you are
* encoding to a file, FLAC::Encoder::File may be more
* convenient.
*
* The usage of this class is similar to FLAC__StreamEncoder,
* except instead of providing callbacks to
* FLAC__stream_encoder_init*_stream(), you will inherit from this
* class and override the virtual callback functions with your
* own implementations, then call init() or init_ogg(). The rest of
* the calls work the same as in the C layer.
*
* Only the write callback is mandatory. The others are
* optional; this class provides default implementations that do
* nothing. In order for some STREAMINFO and SEEKTABLE data to
* be written properly, you must override seek_callback() and
* tell_callback(); see FLAC__stream_encoder_init_stream() as to
* why.
*/
class FLACPP_API Stream {
public:
/** This class is a wrapper around FLAC__StreamEncoderState.
*/
class FLACPP_API State {
public:
inline State(::FLAC__StreamEncoderState state): state_(state) { }
inline operator ::FLAC__StreamEncoderState() const { return state_; }
inline const char *as_cstring() const { return ::FLAC__StreamEncoderStateString[state_]; }
inline const char *resolved_as_cstring(const Stream &encoder) const { return ::FLAC__stream_encoder_get_resolved_state_string(encoder.encoder_); }
protected:
::FLAC__StreamEncoderState state_;
};
Stream();
virtual ~Stream();
//@{
/** Call after construction to check that the object was created
* successfully. If not, use get_state() to find out why not.
*
*/
virtual bool is_valid() const;
inline operator bool() const { return is_valid(); } ///< See is_valid()
//@}
virtual bool set_ogg_serial_number(long value); ///< See FLAC__stream_encoder_set_ogg_serial_number()
virtual bool set_verify(bool value); ///< See FLAC__stream_encoder_set_verify()
virtual bool set_streamable_subset(bool value); ///< See FLAC__stream_encoder_set_streamable_subset()
virtual bool set_channels(uint32_t value); ///< See FLAC__stream_encoder_set_channels()
virtual bool set_bits_per_sample(uint32_t value); ///< See FLAC__stream_encoder_set_bits_per_sample()
virtual bool set_sample_rate(uint32_t value); ///< See FLAC__stream_encoder_set_sample_rate()
virtual bool set_compression_level(uint32_t value); ///< See FLAC__stream_encoder_set_compression_level()
virtual bool set_blocksize(uint32_t value); ///< See FLAC__stream_encoder_set_blocksize()
virtual bool set_do_mid_side_stereo(bool value); ///< See FLAC__stream_encoder_set_do_mid_side_stereo()
virtual bool set_loose_mid_side_stereo(bool value); ///< See FLAC__stream_encoder_set_loose_mid_side_stereo()
virtual bool set_apodization(const char *specification); ///< See FLAC__stream_encoder_set_apodization()
virtual bool set_max_lpc_order(uint32_t value); ///< See FLAC__stream_encoder_set_max_lpc_order()
virtual bool set_qlp_coeff_precision(uint32_t value); ///< See FLAC__stream_encoder_set_qlp_coeff_precision()
virtual bool set_do_qlp_coeff_prec_search(bool value); ///< See FLAC__stream_encoder_set_do_qlp_coeff_prec_search()
virtual bool set_do_escape_coding(bool value); ///< See FLAC__stream_encoder_set_do_escape_coding()
virtual bool set_do_exhaustive_model_search(bool value); ///< See FLAC__stream_encoder_set_do_exhaustive_model_search()
virtual bool set_min_residual_partition_order(uint32_t value); ///< See FLAC__stream_encoder_set_min_residual_partition_order()
virtual bool set_max_residual_partition_order(uint32_t value); ///< See FLAC__stream_encoder_set_max_residual_partition_order()
virtual bool set_rice_parameter_search_dist(uint32_t value); ///< See FLAC__stream_encoder_set_rice_parameter_search_dist()
virtual bool set_total_samples_estimate(FLAC__uint64 value); ///< See FLAC__stream_encoder_set_total_samples_estimate()
virtual bool set_metadata(::FLAC__StreamMetadata **metadata, uint32_t num_blocks); ///< See FLAC__stream_encoder_set_metadata()
virtual bool set_metadata(FLAC::Metadata::Prototype **metadata, uint32_t num_blocks); ///< See FLAC__stream_encoder_set_metadata()
virtual bool set_limit_min_bitrate(bool value); ///< See FLAC__stream_encoder_set_limit_min_bitrate()
/* get_state() is not virtual since we want subclasses to be able to return their own state */
State get_state() const; ///< See FLAC__stream_encoder_get_state()
virtual Decoder::Stream::State get_verify_decoder_state() const; ///< See FLAC__stream_encoder_get_verify_decoder_state()
virtual void get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, uint32_t *frame_number, uint32_t *channel, uint32_t *sample, FLAC__int32 *expected, FLAC__int32 *got); ///< See FLAC__stream_encoder_get_verify_decoder_error_stats()
virtual bool get_verify() const; ///< See FLAC__stream_encoder_get_verify()
virtual bool get_streamable_subset() const; ///< See FLAC__stream_encoder_get_streamable_subset()
virtual bool get_do_mid_side_stereo() const; ///< See FLAC__stream_encoder_get_do_mid_side_stereo()
virtual bool get_loose_mid_side_stereo() const; ///< See FLAC__stream_encoder_get_loose_mid_side_stereo()
virtual uint32_t get_channels() const; ///< See FLAC__stream_encoder_get_channels()
virtual uint32_t get_bits_per_sample() const; ///< See FLAC__stream_encoder_get_bits_per_sample()
virtual uint32_t get_sample_rate() const; ///< See FLAC__stream_encoder_get_sample_rate()
virtual uint32_t get_blocksize() const; ///< See FLAC__stream_encoder_get_blocksize()
virtual uint32_t get_max_lpc_order() const; ///< See FLAC__stream_encoder_get_max_lpc_order()
virtual uint32_t get_qlp_coeff_precision() const; ///< See FLAC__stream_encoder_get_qlp_coeff_precision()
virtual bool get_do_qlp_coeff_prec_search() const; ///< See FLAC__stream_encoder_get_do_qlp_coeff_prec_search()
virtual bool get_do_escape_coding() const; ///< See FLAC__stream_encoder_get_do_escape_coding()
virtual bool get_do_exhaustive_model_search() const; ///< See FLAC__stream_encoder_get_do_exhaustive_model_search()
virtual uint32_t get_min_residual_partition_order() const; ///< See FLAC__stream_encoder_get_min_residual_partition_order()
virtual uint32_t get_max_residual_partition_order() const; ///< See FLAC__stream_encoder_get_max_residual_partition_order()
virtual uint32_t get_rice_parameter_search_dist() const; ///< See FLAC__stream_encoder_get_rice_parameter_search_dist()
virtual FLAC__uint64 get_total_samples_estimate() const; ///< See FLAC__stream_encoder_get_total_samples_estimate()
virtual bool get_limit_min_bitrate() const; ///< See FLAC__stream_encoder_get_limit_min_bitrate()
virtual ::FLAC__StreamEncoderInitStatus init(); ///< See FLAC__stream_encoder_init_stream()
virtual ::FLAC__StreamEncoderInitStatus init_ogg(); ///< See FLAC__stream_encoder_init_ogg_stream()
virtual bool finish(); ///< See FLAC__stream_encoder_finish()
virtual bool process(const FLAC__int32 * const buffer[], uint32_t samples); ///< See FLAC__stream_encoder_process()
virtual bool process_interleaved(const FLAC__int32 buffer[], uint32_t samples); ///< See FLAC__stream_encoder_process_interleaved()
protected:
/// See FLAC__StreamEncoderReadCallback
virtual ::FLAC__StreamEncoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes);
/// See FLAC__StreamEncoderWriteCallback
virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame) = 0;
/// See FLAC__StreamEncoderSeekCallback
virtual ::FLAC__StreamEncoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset);
/// See FLAC__StreamEncoderTellCallback
virtual ::FLAC__StreamEncoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset);
/// See FLAC__StreamEncoderMetadataCallback
virtual void metadata_callback(const ::FLAC__StreamMetadata *metadata);
#if (defined __BORLANDC__) || (defined __GNUG__ && (__GNUG__ < 2 || (__GNUG__ == 2 && __GNUC_MINOR__ < 96))) || (defined __SUNPRO_CC)
// lame hack: some compilers can't see a protected encoder_ from nested State::resolved_as_cstring()
friend State;
#endif
::FLAC__StreamEncoder *encoder_;
static ::FLAC__StreamEncoderReadStatus read_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
static ::FLAC__StreamEncoderWriteStatus write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data);
static ::FLAC__StreamEncoderSeekStatus seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data);
static ::FLAC__StreamEncoderTellStatus tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data);
static void metadata_callback_(const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetadata *metadata, void *client_data);
private:
// Private and undefined so you can't use them:
Stream(const Stream &);
void operator=(const Stream &);
};
/** \ingroup flacpp_encoder
* \brief
* This class wraps the ::FLAC__StreamEncoder. If you are
* not encoding to a file, you may need to use
* FLAC::Encoder::Stream.
*
* The usage of this class is similar to FLAC__StreamEncoder,
* except instead of providing callbacks to
* FLAC__stream_encoder_init*_FILE() or
* FLAC__stream_encoder_init*_file(), you will inherit from this
* class and override the virtual callback functions with your
* own implementations, then call init() or init_ogg(). The rest
* of the calls work the same as in the C layer.
*
* There are no mandatory callbacks; all the callbacks from
* FLAC::Encoder::Stream are implemented here fully and support
* full post-encode STREAMINFO and SEEKTABLE updating. There is
* only an optional progress callback which you may override to
* get periodic reports on the progress of the encode.
*/
class FLACPP_API File: public Stream {
public:
File();
virtual ~File();
using Stream::init;
virtual ::FLAC__StreamEncoderInitStatus init(FILE *file); ///< See FLAC__stream_encoder_init_FILE()
virtual ::FLAC__StreamEncoderInitStatus init(const char *filename); ///< See FLAC__stream_encoder_init_file()
virtual ::FLAC__StreamEncoderInitStatus init(const std::string &filename); ///< See FLAC__stream_encoder_init_file()
using Stream::init_ogg;
virtual ::FLAC__StreamEncoderInitStatus init_ogg(FILE *file); ///< See FLAC__stream_encoder_init_ogg_FILE()
virtual ::FLAC__StreamEncoderInitStatus init_ogg(const char *filename); ///< See FLAC__stream_encoder_init_ogg_file()
virtual ::FLAC__StreamEncoderInitStatus init_ogg(const std::string &filename); ///< See FLAC__stream_encoder_init_ogg_file()
protected:
/// See FLAC__StreamEncoderProgressCallback
virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate);
/// This is a dummy implementation to satisfy the pure virtual in Stream that is actually supplied internally by the C layer
virtual ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame);
private:
static void progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate, void *client_data);
// Private and undefined so you can't use them:
File(const Stream &);
void operator=(const Stream &);
};
}
}
#endif

View file

@ -0,0 +1,100 @@
/* libFLAC++ - Free Lossless Audio Codec library
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 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.
*/
#ifndef FLACPP__EXPORT_H
#define FLACPP__EXPORT_H
/** \file include/FLAC++/export.h
*
* \brief
* This module contains \#defines and symbols for exporting function
* calls, and providing version information and compiled-in features.
*
* See the \link flacpp_export export \endlink module.
*/
/** \defgroup flacpp_export FLAC++/export.h: export symbols
* \ingroup flacpp
*
* \brief
* This module contains \#defines and symbols for exporting function
* calls, and providing version information and compiled-in features.
*
* If you are compiling for Windows (with Visual Studio or MinGW for
* example) and will link to the static library (libFLAC++.lib) you
* should define FLAC__NO_DLL in your project to make sure the symbols
* are exported properly.
*
* \{
*/
/** This \#define is used internally in libFLAC and its headers to make
* sure the correct symbols are exported when working with shared
* libraries. On Windows, this \#define is set to __declspec(dllexport)
* when compiling libFLAC into a library and to __declspec(dllimport)
* when the headers are used to link to that DLL. On non-Windows systems
* it is used to set symbol visibility.
*
* Because of this, the define FLAC__NO_DLL must be defined when linking
* to libFLAC statically or linking will fail.
*/
/* This has grown quite complicated. FLAC__NO_DLL is used by MSVC sln
* files and CMake, which build either static or shared. autotools can
* build static, shared or **both**. Therefore, DLL_EXPORT, which is set
* by libtool, must override FLAC__NO_DLL on building shared components
*/
#if defined(_WIN32)
#if defined(FLAC__NO_DLL) && !(defined(DLL_EXPORT))
#define FLACPP_API
#else
#ifdef FLACPP_API_EXPORTS
#define FLACPP_API __declspec(dllexport)
#else
#define FLACPP_API __declspec(dllimport)
#endif
#endif
#elif defined(FLAC__USE_VISIBILITY_ATTR)
#define FLACPP_API __attribute__ ((visibility ("default")))
#else
#define FLACPP_API
#endif
/** These \#defines will mirror the libtool-based library version number, see
* http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
*/
#define FLACPP_API_VERSION_CURRENT 10
#define FLACPP_API_VERSION_REVISION 1 /**< see above */
#define FLACPP_API_VERSION_AGE 0 /**< see above */
/* \} */
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,43 @@
# libFLAC - Free Lossless Audio Codec library
# Copyright (C) 2000-2009 Josh Coalson
# Copyright (C) 2011-2023 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.
flaccincludedir = $(includedir)/FLAC
flaccinclude_HEADERS = \
all.h \
assert.h \
callback.h \
export.h \
format.h \
metadata.h \
ordinals.h \
stream_decoder.h \
stream_encoder.h

View file

@ -0,0 +1,450 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2023 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.
*/
#ifndef FLAC__ALL_H
#define FLAC__ALL_H
#include "export.h"
#include "assert.h"
#include "callback.h"
#include "format.h"
#include "metadata.h"
#include "ordinals.h"
#include "stream_decoder.h"
#include "stream_encoder.h"
/** \mainpage
*
* \section intro Introduction
*
* This is the documentation for the FLAC C and C++ APIs. It is
* highly interconnected; this introduction should give you a top
* level idea of the structure and how to find the information you
* need. As a prerequisite you should have at least a basic
* knowledge of the FLAC format, documented
* <A HREF="https://xiph.org/flac/format.html">here</A>.
*
* \section c_api FLAC C API
*
* The FLAC C API is the interface to libFLAC, a set of structures
* describing the components of FLAC streams, and functions for
* encoding and decoding streams, as well as manipulating FLAC
* metadata in files. The public include files will be installed
* in your include area (for example /usr/include/FLAC/...).
*
* By writing a little code and linking against libFLAC, it is
* relatively easy to add FLAC support to another program. The
* library is licensed under <A HREF="https://xiph.org/flac/license.html">Xiph's BSD license</A>.
* Complete source code of libFLAC as well as the command-line
* encoder and plugins is available and is a useful source of
* examples.
*
* Aside from encoders and decoders, libFLAC provides a powerful
* metadata interface for manipulating metadata in FLAC files. It
* allows the user to add, delete, and modify FLAC metadata blocks
* and it can automatically take advantage of PADDING blocks to avoid
* rewriting the entire FLAC file when changing the size of the
* metadata.
*
* libFLAC usually only requires the standard C library and C math
* library. In particular, threading is not used so there is no
* dependency on a thread library. However, libFLAC does not use
* global variables and should be thread-safe.
*
* libFLAC also supports encoding to and decoding from Ogg FLAC.
* However the metadata editing interfaces currently have limited
* read-only support for Ogg FLAC files.
*
* \section cpp_api FLAC C++ API
*
* The FLAC C++ API is a set of classes that encapsulate the
* structures and functions in libFLAC. They provide slightly more
* functionality with respect to metadata but are otherwise
* equivalent. For the most part, they share the same usage as
* their counterparts in libFLAC, and the FLAC C API documentation
* can be used as a supplement. The public include files
* for the C++ API will be installed in your include area (for
* example /usr/include/FLAC++/...).
*
* libFLAC++ is also licensed under
* <A HREF="https://xiph.org/flac/license.html">Xiph's BSD license</A>.
*
* \section getting_started Getting Started
*
* A good starting point for learning the API is to browse through
* the <A HREF="modules.html">modules</A>. Modules are logical
* groupings of related functions or classes, which correspond roughly
* to header files or sections of header files. Each module includes a
* detailed description of the general usage of its functions or
* classes.
*
* From there you can go on to look at the documentation of
* individual functions. You can see different views of the individual
* functions through the links in top bar across this page.
*
* If you prefer a more hands-on approach, you can jump right to some
* <A HREF="https://xiph.org/flac/documentation_example_code.html">example code</A>.
*
* \section porting_guide Porting Guide
*
* Starting with FLAC 1.1.3 a \link porting Porting Guide \endlink
* has been introduced which gives detailed instructions on how to
* port your code to newer versions of FLAC.
*
* \section embedded_developers Embedded Developers
*
* libFLAC has grown larger over time as more functionality has been
* included, but much of it may be unnecessary for a particular embedded
* implementation. Unused parts may be pruned by some simple editing of
* src/libFLAC/Makefile.am. In general, the decoders, encoders, and
* metadata interface are all independent from each other.
*
* It is easiest to just describe the dependencies:
*
* - All modules depend on the \link flac_format Format \endlink module.
* - The decoders and encoders depend on the bitbuffer.
* - The decoder is independent of the encoder. The encoder uses the
* decoder because of the verify feature, but this can be removed if
* not needed.
* - Parts of the metadata interface require the stream decoder (but not
* the encoder).
* - Ogg support is selectable through the compile time macro
* \c FLAC__HAS_OGG.
*
* For example, if your application only requires the stream decoder, no
* encoder, and no metadata interface, you can remove the stream encoder
* and the metadata interface, which will greatly reduce the size of the
* library.
*
* Also, there are several places in the libFLAC code with comments marked
* with "OPT:" where a \#define can be changed to enable code that might be
* faster on a specific platform. Experimenting with these can yield faster
* binaries.
*/
/** \defgroup porting Porting Guide for New Versions
*
* This module describes differences in the library interfaces from
* version to version. It assists in the porting of code that uses
* the libraries to newer versions of FLAC.
*
* One simple facility for making porting easier that has been added
* in FLAC 1.1.3 is a set of \#defines in \c export.h of each
* library's includes (e.g. \c include/FLAC/export.h). The
* \#defines mirror the libraries'
* <A HREF="http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning">libtool version numbers</A>,
* e.g. in libFLAC there are \c FLAC_API_VERSION_CURRENT,
* \c FLAC_API_VERSION_REVISION, and \c FLAC_API_VERSION_AGE.
* These can be used to support multiple versions of an API during the
* transition phase, e.g.
*
* \code
* #if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
* legacy code
* #else
* new code
* #endif
* \endcode
*
* The source will work for multiple versions and the legacy code can
* easily be removed when the transition is complete.
*
* Another available symbol is FLAC_API_SUPPORTS_OGG_FLAC (defined in
* include/FLAC/export.h), which can be used to determine whether or not
* the library has been compiled with support for Ogg FLAC. This is
* simpler than trying to call an Ogg init function and catching the
* error.
*/
/** \defgroup porting_1_1_2_to_1_1_3 Porting from FLAC 1.1.2 to 1.1.3
* \ingroup porting
*
* \brief
* This module describes porting from FLAC 1.1.2 to FLAC 1.1.3.
*
* The main change between the APIs in 1.1.2 and 1.1.3 is that they have
* been simplified. First, libOggFLAC has been merged into libFLAC and
* libOggFLAC++ has been merged into libFLAC++. Second, both the three
* decoding layers and three encoding layers have been merged into a
* single stream decoder and stream encoder. That is, the functionality
* of FLAC__SeekableStreamDecoder and FLAC__FileDecoder has been merged
* into FLAC__StreamDecoder, and FLAC__SeekableStreamEncoder and
* FLAC__FileEncoder into FLAC__StreamEncoder. Only the
* FLAC__StreamDecoder and FLAC__StreamEncoder remain. What this means
* is there is now a single API that can be used to encode or decode
* streams to/from native FLAC or Ogg FLAC and the single API can work
* on both seekable and non-seekable streams.
*
* Instead of creating an encoder or decoder of a certain layer, now the
* client will always create a FLAC__StreamEncoder or
* FLAC__StreamDecoder. The old layers are now differentiated by the
* initialization function. For example, for the decoder,
* FLAC__stream_decoder_init() has been replaced by
* FLAC__stream_decoder_init_stream(). This init function takes
* callbacks for the I/O, and the seeking callbacks are optional. This
* allows the client to use the same object for seekable and
* non-seekable streams. For decoding a FLAC file directly, the client
* can use FLAC__stream_decoder_init_file() and pass just a filename
* and fewer callbacks; most of the other callbacks are supplied
* internally. For situations where fopen()ing by filename is not
* possible (e.g. Unicode filenames on Windows) the client can instead
* open the file itself and supply the FILE* to
* FLAC__stream_decoder_init_FILE(). The init functions now returns a
* FLAC__StreamDecoderInitStatus instead of FLAC__StreamDecoderState.
* Since the callbacks and client data are now passed to the init
* function, the FLAC__stream_decoder_set_*_callback() functions and
* FLAC__stream_decoder_set_client_data() are no longer needed. The
* rest of the calls to the decoder are the same as before.
*
* There are counterpart init functions for Ogg FLAC, e.g.
* FLAC__stream_decoder_init_ogg_stream(). All the rest of the calls
* and callbacks are the same as for native FLAC.
*
* As an example, in FLAC 1.1.2 a seekable stream decoder would have
* been set up like so:
*
* \code
* FLAC__SeekableStreamDecoder *decoder = FLAC__seekable_stream_decoder_new();
* if(decoder == NULL) do_something;
* FLAC__seekable_stream_decoder_set_md5_checking(decoder, true);
* [... other settings ...]
* FLAC__seekable_stream_decoder_set_read_callback(decoder, my_read_callback);
* FLAC__seekable_stream_decoder_set_seek_callback(decoder, my_seek_callback);
* FLAC__seekable_stream_decoder_set_tell_callback(decoder, my_tell_callback);
* FLAC__seekable_stream_decoder_set_length_callback(decoder, my_length_callback);
* FLAC__seekable_stream_decoder_set_eof_callback(decoder, my_eof_callback);
* FLAC__seekable_stream_decoder_set_write_callback(decoder, my_write_callback);
* FLAC__seekable_stream_decoder_set_metadata_callback(decoder, my_metadata_callback);
* FLAC__seekable_stream_decoder_set_error_callback(decoder, my_error_callback);
* FLAC__seekable_stream_decoder_set_client_data(decoder, my_client_data);
* if(FLAC__seekable_stream_decoder_init(decoder) != FLAC__SEEKABLE_STREAM_DECODER_OK) do_something;
* \endcode
*
* In FLAC 1.1.3 it is like this:
*
* \code
* FLAC__StreamDecoder *decoder = FLAC__stream_decoder_new();
* if(decoder == NULL) do_something;
* FLAC__stream_decoder_set_md5_checking(decoder, true);
* [... other settings ...]
* if(FLAC__stream_decoder_init_stream(
* decoder,
* my_read_callback,
* my_seek_callback, // or NULL
* my_tell_callback, // or NULL
* my_length_callback, // or NULL
* my_eof_callback, // or NULL
* my_write_callback,
* my_metadata_callback, // or NULL
* my_error_callback,
* my_client_data
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
* \endcode
*
* or you could do;
*
* \code
* [...]
* FILE *file = fopen("somefile.flac","rb");
* if(file == NULL) do_somthing;
* if(FLAC__stream_decoder_init_FILE(
* decoder,
* file,
* my_write_callback,
* my_metadata_callback, // or NULL
* my_error_callback,
* my_client_data
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
* \endcode
*
* or just:
*
* \code
* [...]
* if(FLAC__stream_decoder_init_file(
* decoder,
* "somefile.flac",
* my_write_callback,
* my_metadata_callback, // or NULL
* my_error_callback,
* my_client_data
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
* \endcode
*
* Another small change to the decoder is in how it handles unparseable
* streams. Before, when the decoder found an unparseable stream
* (reserved for when the decoder encounters a stream from a future
* encoder that it can't parse), it changed the state to
* \c FLAC__STREAM_DECODER_UNPARSEABLE_STREAM. Now the decoder instead
* drops sync and calls the error callback with a new error code
* \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM. This is
* more robust. If your error callback does not discriminate on the the
* error state, your code does not need to be changed.
*
* The encoder now has a new setting:
* FLAC__stream_encoder_set_apodization(). This is for setting the
* method used to window the data before LPC analysis. You only need to
* add a call to this function if the default is not suitable. There
* are also two new convenience functions that may be useful:
* FLAC__metadata_object_cuesheet_calculate_cddb_id() and
* FLAC__metadata_get_cuesheet().
*
* The \a bytes parameter to FLAC__StreamDecoderReadCallback,
* FLAC__StreamEncoderReadCallback, and FLAC__StreamEncoderWriteCallback
* is now \c size_t instead of \c uint32_t.
*/
/** \defgroup porting_1_1_3_to_1_1_4 Porting from FLAC 1.1.3 to 1.1.4
* \ingroup porting
*
* \brief
* This module describes porting from FLAC 1.1.3 to FLAC 1.1.4.
*
* There were no changes to any of the interfaces from 1.1.3 to 1.1.4.
* There was a slight change in the implementation of
* FLAC__stream_encoder_set_metadata(); the function now makes a copy
* of the \a metadata array of pointers so the client no longer needs
* to maintain it after the call. The objects themselves that are
* pointed to by the array are still not copied though and must be
* maintained until the call to FLAC__stream_encoder_finish().
*/
/** \defgroup porting_1_1_4_to_1_2_0 Porting from FLAC 1.1.4 to 1.2.0
* \ingroup porting
*
* \brief
* This module describes porting from FLAC 1.1.4 to FLAC 1.2.0.
*
* There were only very minor changes to the interfaces from 1.1.4 to 1.2.0.
* In libFLAC, \c FLAC__format_sample_rate_is_subset() was added.
* In libFLAC++, \c FLAC::Decoder::Stream::get_decode_position() was added.
*
* Finally, value of the constant \c FLAC__FRAME_HEADER_RESERVED_LEN
* has changed to reflect the conversion of one of the reserved bits
* into active use. It used to be \c 2 and now is \c 1. However the
* FLAC frame header length has not changed, so to skip the proper
* number of bits, use \c FLAC__FRAME_HEADER_RESERVED_LEN +
* \c FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN
*/
/** \defgroup porting_1_3_4_to_1_4_0 Porting from FLAC 1.3.4 to 1.4.0
* \ingroup porting
*
* \brief
* This module describes porting from FLAC 1.3.4 to FLAC 1.4.0.
*
* \section porting_1_3_4_to_1_4_0_summary Summary
*
* Between FLAC 1.3.4 and FLAC 1.4.0, there have four breaking changes
* - the function get_client_data_from_decoder has been renamed to
* FLAC__get_decoder_client_data
* - some data types in the FLAC__Frame struct have changed
* - all functions resizing metadata blocks now return the object
* untouched if memory allocation fails, whereas previously the
* handling varied and was more or less undefined
* - all functions accepting a filename now take UTF-8 encoded filenames
* on Windows instead of filenames in the current codepage
*
* Furthermore, there have been the following additions
* - the functions FLAC__stream_encoder_set_limit_min_bitrate,
* FLAC__stream_encoder_get_limit_min_bitrate,
* FLAC::encoder::file::set_limit_min_bitrate() and
* FLAC::encoder::file::get_limit_min_bitrate() have been added
* - Added FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA to the
* FLAC__StreamDecoderErrorStatus enum
*
* \section porting_1_3_4_to_1_4_0_breaking Breaking changes
*
* The function \b get_client_data_from_decoder was added in FLAC 1.3.3
* but did not follow the API naming convention and was not properly
* exported. The function is now renamed and properly integrated as
* FLAC__stream_decoder_get_client_data
*
* To accomodate encoding and decoding 32-bit int PCM, some data types
* in the \b FLAC__frame struct were changed. Specifically, warmup
* in both the FLAC__Subframe_Fixed struc and the FLAC__Subframe_LPC
* struct is changed from FLAC__int32 to FLAC__int64. Also, value
* in the FLAC__Subframe_Constant is changed from FLAC__int32 to
* FLAC__int64. Finally, in FLAC__Subframe_Verbatim struct data is
* changes from a FLAC__int32 array to a union containing a FLAC__int32
* array and a FLAC__int64 array. Also, a new member is added,
* data_type, which clarifies whether the FLAC__int32 or FLAC__int64
* array is in use.
*
* Furthermore, the following functions now return the object untouched
* if memory allocation fails, whereas previously the handling varied
* and was more or less undefined
*
* - FLAC__metadata_object_seektable_resize_points
* - FLAC__metadata_object_vorbiscomment_resize_comments
* - FLAC__metadata_object_cuesheet_track_resize_indices
* - FLAC__metadata_object_cuesheet_resize_tracks
*
* The last breaking change is that all API functions taking a filename
* as an argument now, on Windows, must be supplied with that filename
* in the UTF-8 character encoding instead of using the current code
* page. libFLAC internally translates these UTF-8 encoded filenames to
* an appropriate representation to use with _wfopen. On all other
* systems, filename is passed to fopen without any translation, as it
* in libFLAC 1.3.4 and earlier.
*
* \section porting_1_3_4_to_1_4_0_additions Additions
*
* To aid in creating properly streamable FLAC files, a set of functions
* was added to make it possible to enfore a minimum bitrate to files
* created through libFLAC's stream_encoder.h interface. With this
* function enabled the resulting FLAC files have a minimum bitrate of
* 1bit/sample independent of the number of channels, i.e. 48kbit/s for
* 48kHz. This can be beneficial for streaming, as very low bitrates for
* silent sections compressed with 'constant' subframes can result in a
* bitrate of 1kbit/s, creating problems with clients that aren't aware
* of this possibility and buffer too much data.
*
* Finally, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA was added to
* the FLAC__StreamDecoderErrorStatus enum to signal that the decoder
* encountered unreadable metadata.
*
*/
/** \defgroup flac FLAC C API
*
* The FLAC C API is the interface to libFLAC, a set of structures
* describing the components of FLAC streams, and functions for
* encoding and decoding streams, as well as manipulating FLAC
* metadata in files.
*
* You should start with the format components as all other modules
* are dependent on it.
*/
#endif

View file

@ -0,0 +1,51 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2001-2009 Josh Coalson
* Copyright (C) 2011-2023 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.
*/
#ifndef FLAC__ASSERT_H
#define FLAC__ASSERT_H
/* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
#define FLAC__ASSERT(x) if(!(x)) __builtin_abort();
#define FLAC__ASSERT_DECLARATION(x) x
#else
#ifndef NDEBUG
#include <assert.h>
#define FLAC__ASSERT(x) assert(x)
#define FLAC__ASSERT_DECLARATION(x) x
#else
#define FLAC__ASSERT(x)
#define FLAC__ASSERT_DECLARATION(x)
#endif
#endif
#endif

View file

@ -0,0 +1,190 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2004-2009 Josh Coalson
* Copyright (C) 2011-2023 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.
*/
#ifndef FLAC__CALLBACK_H
#define FLAC__CALLBACK_H
#include "ordinals.h"
#include <stdlib.h> /* for size_t */
/** \file include/FLAC/callback.h
*
* \brief
* This module defines the structures for describing I/O callbacks
* to the other FLAC interfaces.
*
* See the detailed documentation for callbacks in the
* \link flac_callbacks callbacks \endlink module.
*/
/** \defgroup flac_callbacks FLAC/callback.h: I/O callback structures
* \ingroup flac
*
* \brief
* This module defines the structures for describing I/O callbacks
* to the other FLAC interfaces.
*
* The purpose of the I/O callback functions is to create a common way
* for the metadata interfaces to handle I/O.
*
* Originally the metadata interfaces required filenames as the way of
* specifying FLAC files to operate on. This is problematic in some
* environments so there is an additional option to specify a set of
* callbacks for doing I/O on the FLAC file, instead of the filename.
*
* In addition to the callbacks, a FLAC__IOHandle type is defined as an
* opaque structure for a data source.
*
* The callback function prototypes are similar (but not identical) to the
* stdio functions fread, fwrite, fseek, ftell, feof, and fclose. If you use
* stdio streams to implement the callbacks, you can pass fread, fwrite, and
* fclose anywhere a FLAC__IOCallback_Read, FLAC__IOCallback_Write, or
* FLAC__IOCallback_Close is required, and a FILE* anywhere a FLAC__IOHandle
* is required. \warning You generally CANNOT directly use fseek or ftell
* for FLAC__IOCallback_Seek or FLAC__IOCallback_Tell since on most systems
* these use 32-bit offsets and FLAC requires 64-bit offsets to deal with
* large files. You will have to find an equivalent function (e.g. ftello),
* or write a wrapper. The same is true for feof() since this is usually
* implemented as a macro, not as a function whose address can be taken.
*
* \{
*/
#ifdef __cplusplus
extern "C" {
#endif
/** This is the opaque handle type used by the callbacks. Typically
* this is a \c FILE* or address of a file descriptor.
*/
typedef void* FLAC__IOHandle;
/** Signature for the read callback.
* The signature and semantics match POSIX fread() implementations
* and can generally be used interchangeably. Note that the global
* variable errno from errno.h is read by some libFLAC functions to
* detect read errors.
*
* \param ptr The address of the read buffer.
* \param size The size of the records to be read.
* \param nmemb The number of records to be read.
* \param handle The handle to the data source.
* \retval size_t
* The number of records read.
*/
typedef size_t (*FLAC__IOCallback_Read) (void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
/** Signature for the write callback.
* The signature and semantics match POSIX fwrite() implementations
* and can generally be used interchangeably.
*
* \param ptr The address of the write buffer.
* \param size The size of the records to be written.
* \param nmemb The number of records to be written.
* \param handle The handle to the data source.
* \retval size_t
* The number of records written.
*/
typedef size_t (*FLAC__IOCallback_Write) (const void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
/** Signature for the seek callback.
* The signature and semantics mostly match POSIX fseek() WITH ONE IMPORTANT
* EXCEPTION: the offset is a 64-bit type whereas fseek() is generally 'long'
* and 32-bits wide.
*
* \param handle The handle to the data source.
* \param offset The new position, relative to \a whence
* \param whence \c SEEK_SET, \c SEEK_CUR, or \c SEEK_END
* \retval int
* \c 0 on success, \c -1 on error.
*/
typedef int (*FLAC__IOCallback_Seek) (FLAC__IOHandle handle, FLAC__int64 offset, int whence);
/** Signature for the tell callback.
* The signature and semantics mostly match POSIX ftell() WITH ONE IMPORTANT
* EXCEPTION: the offset is a 64-bit type whereas ftell() is generally 'long'
* and 32-bits wide.
*
* \param handle The handle to the data source.
* \retval FLAC__int64
* The current position on success, \c -1 on error.
*/
typedef FLAC__int64 (*FLAC__IOCallback_Tell) (FLAC__IOHandle handle);
/** Signature for the EOF callback.
* The signature and semantics mostly match POSIX feof() but WATCHOUT:
* on many systems, feof() is a macro, so in this case a wrapper function
* must be provided instead.
*
* \param handle The handle to the data source.
* \retval int
* \c 0 if not at end of file, nonzero if at end of file.
*/
typedef int (*FLAC__IOCallback_Eof) (FLAC__IOHandle handle);
/** Signature for the close callback.
* The signature and semantics match POSIX fclose() implementations
* and can generally be used interchangeably.
*
* \param handle The handle to the data source.
* \retval int
* \c 0 on success, \c EOF on error.
*/
typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle);
/** A structure for holding a set of callbacks.
* Each FLAC interface that requires a FLAC__IOCallbacks structure will
* describe which of the callbacks are required. The ones that are not
* required may be set to NULL.
*
* If the seek requirement for an interface is optional, you can signify that
* a data source is not seekable by setting the \a seek field to \c NULL.
*
* See the detailed documentation for callbacks in the
* \link flac_callbacks callbacks \endlink module.
*/
typedef struct {
FLAC__IOCallback_Read read; /**< See FLAC__IOCallbacks */
FLAC__IOCallback_Write write; /**< See FLAC__IOCallbacks */
FLAC__IOCallback_Seek seek; /**< See FLAC__IOCallbacks */
FLAC__IOCallback_Tell tell; /**< See FLAC__IOCallbacks */
FLAC__IOCallback_Eof eof; /**< See FLAC__IOCallbacks */
FLAC__IOCallback_Close close; /**< See FLAC__IOCallbacks */
} FLAC__IOCallbacks;
/* \} */
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,115 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2023 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.
*/
#ifndef FLAC__EXPORT_H
#define FLAC__EXPORT_H
/** \file include/FLAC/export.h
*
* \brief
* This module contains \#defines and symbols for exporting function
* calls, and providing version information and compiled-in features.
*
* See the \link flac_export export \endlink module.
*/
/** \defgroup flac_export FLAC/export.h: export symbols
* \ingroup flac
*
* \brief
* This module contains \#defines and symbols for exporting function
* calls, and providing version information and compiled-in features.
*
* If you are compiling for Windows (with Visual Studio or MinGW for
* example) and will link to the static library (libFLAC++.lib) you
* should define FLAC__NO_DLL in your project to make sure the symbols
* are exported properly.
*
* \{
*/
/** This \#define is used internally in libFLAC and its headers to make
* sure the correct symbols are exported when working with shared
* libraries. On Windows, this \#define is set to __declspec(dllexport)
* when compiling libFLAC into a library and to __declspec(dllimport)
* when the headers are used to link to that DLL. On non-Windows systems
* it is used to set symbol visibility.
*
* Because of this, the define FLAC__NO_DLL must be defined when linking
* to libFLAC statically or linking will fail.
*/
/* This has grown quite complicated. FLAC__NO_DLL is used by MSVC sln
* files and CMake, which build either static or shared. autotools can
* build static, shared or **both**. Therefore, DLL_EXPORT, which is set
* by libtool, must override FLAC__NO_DLL on building shared components
*/
#if defined(_WIN32)
#if defined(FLAC__NO_DLL) && !(defined(DLL_EXPORT))
#define FLAC_API
#else
#ifdef FLAC_API_EXPORTS
#define FLAC_API __declspec(dllexport)
#else
#define FLAC_API __declspec(dllimport)
#endif
#endif
#elif defined(FLAC__USE_VISIBILITY_ATTR)
#define FLAC_API __attribute__ ((visibility ("default")))
#else
#define FLAC_API
#endif
/** These \#defines will mirror the libtool-based library version number, see
* http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
*/
#define FLAC_API_VERSION_CURRENT 13
#define FLAC_API_VERSION_REVISION 0 /**< see above */
#define FLAC_API_VERSION_AGE 1 /**< see above */
#ifdef __cplusplus
extern "C" {
#endif
/** \c 1 if the library has been compiled with support for Ogg FLAC, else \c 0. */
extern FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC;
#ifdef __cplusplus
}
#endif
/* \} */
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,55 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2023 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.
*/
#ifndef FLAC__ORDINALS_H
#define FLAC__ORDINALS_H
/* This of course assumes C99 headers */
#include <stdint.h>
#include <stdbool.h>
typedef int8_t FLAC__int8;
typedef uint8_t FLAC__uint8;
typedef int16_t FLAC__int16;
typedef int32_t FLAC__int32;
typedef int64_t FLAC__int64;
typedef uint16_t FLAC__uint16;
typedef uint32_t FLAC__uint32;
typedef uint64_t FLAC__uint64;
typedef int FLAC__bool;
typedef FLAC__uint8 FLAC__byte;
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,23 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2001-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
if FLaC__WITH_CPPLIBS
CPPLIBS_DIRS = FLAC++
endif
SUBDIRS = FLAC $(CPPLIBS_DIRS) share test_libs_common

View file

@ -0,0 +1,17 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = grabbag
EXTRA_DIST = \
alloc.h \
compat.h \
endswap.h \
getopt.h \
grabbag.h \
macros.h \
private.h \
replaygain_analysis.h \
replaygain_synthesis.h \
safe_str.h \
utf8.h \
win_utf8_io.h

View file

@ -0,0 +1,318 @@
/* alloc - Convenience routines for safely allocating memory
* Copyright (C) 2007-2009 Josh Coalson
* Copyright (C) 2011-2023 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.
*/
#ifndef FLAC__SHARE__ALLOC_H
#define FLAC__SHARE__ALLOC_H
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* WATCHOUT: for c++ you may have to #define __STDC_LIMIT_MACROS 1 real early
* before #including this file, otherwise SIZE_MAX might not be defined
*/
#include <limits.h> /* for SIZE_MAX */
#ifdef HAVE_STDINT_H
#include <stdint.h> /* for SIZE_MAX in case limits.h didn't get it */
#endif
#include <stdlib.h> /* for size_t, malloc(), etc */
#include "share/compat.h"
#ifndef SIZE_MAX
# ifndef SIZE_T_MAX
# ifdef _MSC_VER
# ifdef _WIN64
# define SIZE_T_MAX FLAC__U64L(0xffffffffffffffff)
# else
# define SIZE_T_MAX 0xffffffff
# endif
# else
# error
# endif
# endif
# define SIZE_MAX SIZE_T_MAX
#endif
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
extern int alloc_check_threshold, alloc_check_counter;
static inline int alloc_check() {
if(alloc_check_threshold == INT32_MAX)
return 0;
else if(alloc_check_counter++ == alloc_check_threshold)
return 1;
else
return 0;
}
#endif
/* avoid malloc()ing 0 bytes, see:
* https://www.securecoding.cert.org/confluence/display/seccode/MEM04-A.+Do+not+make+assumptions+about+the+result+of+allocating+0+bytes?focusedCommentId=5407003
*/
static inline void *safe_malloc_(size_t size)
{
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
/* Fail if requested */
if(alloc_check())
return NULL;
#endif
/* malloc(0) is undefined; FLAC src convention is to always allocate */
if(!size)
size++;
return malloc(size);
}
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
static inline void *malloc_(size_t size)
{
/* Fail if requested */
if(alloc_check())
return NULL;
return malloc(size);
}
#else
#define malloc_ malloc
#endif
static inline void *safe_calloc_(size_t nmemb, size_t size)
{
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
/* Fail if requested */
if(alloc_check())
return NULL;
#endif
if(!nmemb || !size)
return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
return calloc(nmemb, size);
}
/*@@@@ there's probably a better way to prevent overflows when allocating untrusted sums but this works for now */
static inline void *safe_malloc_add_2op_(size_t size1, size_t size2)
{
size2 += size1;
if(size2 < size1)
return 0;
return safe_malloc_(size2);
}
static inline void *safe_malloc_add_3op_(size_t size1, size_t size2, size_t size3)
{
size2 += size1;
if(size2 < size1)
return 0;
size3 += size2;
if(size3 < size2)
return 0;
return safe_malloc_(size3);
}
static inline void *safe_malloc_add_4op_(size_t size1, size_t size2, size_t size3, size_t size4)
{
size2 += size1;
if(size2 < size1)
return 0;
size3 += size2;
if(size3 < size2)
return 0;
size4 += size3;
if(size4 < size3)
return 0;
return safe_malloc_(size4);
}
void *safe_malloc_mul_2op_(size_t size1, size_t size2) ;
static inline void *safe_malloc_mul_3op_(size_t size1, size_t size2, size_t size3)
{
if(!size1 || !size2 || !size3)
return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
if(size1 > SIZE_MAX / size2)
return 0;
size1 *= size2;
if(size1 > SIZE_MAX / size3)
return 0;
return malloc_(size1*size3);
}
/* size1*size2 + size3 */
static inline void *safe_malloc_mul2add_(size_t size1, size_t size2, size_t size3)
{
if(!size1 || !size2)
return safe_malloc_(size3);
if(size1 > SIZE_MAX / size2)
return 0;
return safe_malloc_add_2op_(size1*size2, size3);
}
/* size1 * (size2 + size3) */
static inline void *safe_malloc_muladd2_(size_t size1, size_t size2, size_t size3)
{
if(!size1 || (!size2 && !size3))
return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
size2 += size3;
if(size2 < size3)
return 0;
if(size1 > SIZE_MAX / size2)
return 0;
return malloc_(size1*size2);
}
static inline void *safe_realloc_(void *ptr, size_t size)
{
void *oldptr;
void *newptr;
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
/* Fail if requested */
if(alloc_check() && size > 0) {
free(ptr);
return NULL;
}
#endif
oldptr = ptr;
newptr = realloc(ptr, size);
if(size > 0 && newptr == 0)
free(oldptr);
return newptr;
}
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
static inline void *realloc_(void *ptr, size_t size)
{
/* Fail if requested */
if(alloc_check())
return NULL;
return realloc(ptr, size);
}
#else
#define realloc_ realloc
#endif
static inline void *safe_realloc_nofree_add_2op_(void *ptr, size_t size1, size_t size2)
{
size2 += size1;
if(size2 < size1)
return 0;
return realloc_(ptr, size2);
}
static inline void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3)
{
size2 += size1;
if(size2 < size1) {
free(ptr);
return 0;
}
size3 += size2;
if(size3 < size2) {
free(ptr);
return 0;
}
return safe_realloc_(ptr, size3);
}
static inline void *safe_realloc_nofree_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3)
{
size2 += size1;
if(size2 < size1)
return 0;
size3 += size2;
if(size3 < size2)
return 0;
return realloc_(ptr, size3);
}
static inline void *safe_realloc_nofree_add_4op_(void *ptr, size_t size1, size_t size2, size_t size3, size_t size4)
{
size2 += size1;
if(size2 < size1)
return 0;
size3 += size2;
if(size3 < size2)
return 0;
size4 += size3;
if(size4 < size3)
return 0;
return realloc_(ptr, size4);
}
static inline void *safe_realloc_mul_2op_(void *ptr, size_t size1, size_t size2)
{
if(!size1 || !size2)
return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
if(size1 > SIZE_MAX / size2) {
free(ptr);
return 0;
}
return safe_realloc_(ptr, size1*size2);
}
static inline void *safe_realloc_nofree_mul_2op_(void *ptr, size_t size1, size_t size2)
{
if(!size1 || !size2)
return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
if(size1 > SIZE_MAX / size2)
return 0;
return realloc_(ptr, size1*size2);
}
/* size1 * (size2 + size3) */
static inline void *safe_realloc_muladd2_(void *ptr, size_t size1, size_t size2, size_t size3)
{
if(!size1 || (!size2 && !size3))
return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
size2 += size3;
if(size2 < size3) {
free(ptr);
return 0;
}
return safe_realloc_mul_2op_(ptr, size1, size2);
}
/* size1 * (size2 + size3) */
static inline void *safe_realloc_nofree_muladd2_(void *ptr, size_t size1, size_t size2, size_t size3)
{
if(!size1 || (!size2 && !size3))
return realloc(ptr, 0); /* preserve POSIX realloc(ptr, 0) semantics */
size2 += size3;
if(size2 < size3)
return 0;
return safe_realloc_nofree_mul_2op_(ptr, size1, size2);
}
#endif

View file

@ -0,0 +1,240 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2012-2023 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.
*/
/* This is the preferred location of all CPP hackery to make $random_compiler
* work like something approaching a C99 (or maybe more accurately GNU99)
* compiler.
*
* It is assumed that this header will be included after "config.h".
*/
#ifndef FLAC__SHARE__COMPAT_H
#define FLAC__SHARE__COMPAT_H
#include <stddef.h>
#include <stdarg.h>
#if defined _WIN32 && !defined __CYGWIN__
/* where MSVC puts unlink() */
# include <io.h>
#else
# include <unistd.h>
#endif
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
#include <sys/types.h> /* for off_t */
#define FLAC__off_t __int64 /* use this instead of off_t to fix the 2 GB limit */
#define FLAC__OFF_T_MAX INT64_MAX
#if !defined __MINGW32__
#define fseeko _fseeki64
#define ftello _ftelli64
#else /* MinGW */
#if !defined(HAVE_FSEEKO)
#define fseeko fseeko64
#define ftello ftello64
#endif
#endif
#else
#define FLAC__off_t off_t
#define FLAC__OFF_T_MAX OFF_T_MAX
#endif
#ifdef HAVE_INTTYPES_H
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#endif
#if defined(_MSC_VER)
#define strtoll _strtoi64
#define strtoull _strtoui64
#endif
#if defined(_MSC_VER) && !defined(__cplusplus)
#define inline __inline
#endif
#if defined __INTEL_COMPILER || (defined _MSC_VER && defined _WIN64)
/* MSVS generates VERY slow 32-bit code with __restrict */
#define flac_restrict __restrict
#elif defined __GNUC__
#define flac_restrict __restrict__
#else
#define flac_restrict
#endif
#define FLAC__U64L(x) x##ULL
#if defined _MSC_VER || defined __MINGW32__
#define FLAC__STRCASECMP _stricmp
#define FLAC__STRNCASECMP _strnicmp
#elif defined __BORLANDC__
#define FLAC__STRCASECMP stricmp
#define FLAC__STRNCASECMP strnicmp
#else
#define FLAC__STRCASECMP strcasecmp
#define FLAC__STRNCASECMP strncasecmp
#endif
#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__
#include <io.h> /* for _setmode(), chmod() */
#include <fcntl.h> /* for _O_BINARY */
#else
#include <unistd.h> /* for chown(), unlink() */
#endif
#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__
#if defined __BORLANDC__
#include <utime.h> /* for utime() */
#else
#include <sys/utime.h> /* for utime() */
#endif
#else
#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
#include <fcntl.h>
#else
#include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
#include <utime.h> /* for utime() */
#endif
#endif
#if defined _MSC_VER
# if _MSC_VER >= 1800
# include <inttypes.h>
# elif _MSC_VER >= 1600
/* Visual Studio 2010 has decent C99 support */
# include <stdint.h>
# define PRIu64 "llu"
# define PRId64 "lld"
# define PRIx64 "llx"
# else
# include <limits.h>
# ifndef UINT32_MAX
# define UINT32_MAX _UI32_MAX
# endif
# define PRIu64 "I64u"
# define PRId64 "I64d"
# define PRIx64 "I64x"
# endif
# if defined(_USING_V110_SDK71_) && !defined(_DLL)
# pragma message("WARNING: This compile will NOT FUNCTION PROPERLY on Windows XP. See comments in include/share/compat.h for details")
#define FLAC__USE_FILELENGTHI64
/*
*************************************************************************************
* V110_SDK71, in MSVC 2017 also known as v141_xp, is a platform toolset that is supposed
* to target Windows XP. It turns out however that certain functions provided silently fail
* on Windows XP only, which makes debugging challenging. This only occurs when building with
* /MT. This problem has been reported to Microsoft, but there hasn't been a fix for years. See
* https://web.archive.org/web/20170327195018/https://connect.microsoft.com/VisualStudio/feedback/details/1557168/wstat64-returns-1-on-xp-always
*
* It is known that this problem affects the functions _wstat64 (used by flac_stat i.e.
* stat64_utf8) and _fstat64 (i.e. flac_fstat) and therefore affects both libFLAC in
* several places as well as the flac and metaflac command line tools
*
* As the extent of this problem is unknown and Microsoft seems unwilling to fix it,
* users of libFLAC building with Visual Studio are encouraged to not use the /MT compile
* switch when explicitly targeting Windows XP. When use of /MT is deemed necessary with
* this toolset, be sure to check whether your application works properly on Windows XP.
* It is also possible to build for Windows XP with MinGW instead.
*************************************************************************************
*/
# endif
#endif /* defined _MSC_VER */
#ifdef _WIN32
/* All char* strings are in UTF-8 format. Added to support Unicode files on Windows */
#include "share/win_utf8_io.h"
#define flac_printf printf_utf8
#define flac_fprintf fprintf_utf8
#define flac_vfprintf vfprintf_utf8
#define flac_fopen fopen_utf8
#define flac_chmod chmod_utf8
#define flac_utime utime_utf8
#define flac_unlink unlink_utf8
#define flac_rename rename_utf8
#define flac_stat stat64_utf8
#else
#define flac_printf printf
#define flac_fprintf fprintf
#define flac_vfprintf vfprintf
#define flac_fopen fopen
#define flac_chmod chmod
#define flac_unlink unlink
#define flac_rename rename
#define flac_stat stat
#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
#define flac_utime(a, b) utimensat (AT_FDCWD, a, *b, 0)
#else
#define flac_utime utime
#endif
#endif
#ifdef _WIN32
#define flac_stat_s __stat64 /* stat struct */
#define flac_fstat _fstat64
#else
#define flac_stat_s stat /* stat struct */
#define flac_fstat fstat
#endif
#ifdef ANDROID
#include <limits.h>
#endif
#ifndef M_LN2
#define M_LN2 0.69314718055994530942
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
/* FLAC needs to compile and work correctly on systems with a normal ISO C99
* snprintf as well as Microsoft Visual Studio which has an non-standards
* conformant snprint_s function.
*
* This function wraps the MS version to behave more like the ISO version.
*/
#ifdef __cplusplus
extern "C" {
#endif
int flac_snprintf(char *str, size_t size, const char *fmt, ...);
int flac_vsnprintf(char *str, size_t size, const char *fmt, va_list va);
#ifdef __cplusplus
};
#endif
#endif /* FLAC__SHARE__COMPAT_H */

View file

@ -0,0 +1,84 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2012-2023 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.
*/
/* It is assumed that this header will be included after "config.h". */
#ifdef HAVE_BSWAP32 /* GCC and Clang */
/* GCC prior to 4.8 didn't provide bswap16 on x86_64 */
#ifndef HAVE_BSWAP16
static inline unsigned short __builtin_bswap16(unsigned short a)
{
return (a<<8)|(a>>8);
}
#endif
#define ENDSWAP_16(x) (__builtin_bswap16 (x))
#define ENDSWAP_32(x) (__builtin_bswap32 (x))
#define ENDSWAP_64(x) (__builtin_bswap64 (x))
#elif defined _MSC_VER /* Windows */
#include <stdlib.h>
#define ENDSWAP_16(x) (_byteswap_ushort (x))
#define ENDSWAP_32(x) (_byteswap_ulong (x))
#define ENDSWAP_64(x) (_byteswap_uint64 (x))
#elif defined HAVE_BYTESWAP_H /* Linux */
#include <byteswap.h>
#define ENDSWAP_16(x) (bswap_16 (x))
#define ENDSWAP_32(x) (bswap_32 (x))
#define ENDSWAP_64(x) (bswap_64 (x))
#else
#define ENDSWAP_16(x) ((((x) >> 8) & 0xFF) | (((x) & 0xFF) << 8))
#define ENDSWAP_32(x) ((((x) >> 24) & 0xFF) | (((x) >> 8) & 0xFF00) | (((x) & 0xFF00) << 8) | (((x) & 0xFF) << 24))
#define ENDSWAP_64(x) ((ENDSWAP_32(((x) >> 32) & 0xFFFFFFFF)) | (ENDSWAP_32((x) & 0xFFFFFFFF) << 32))
#endif
/* Host to little-endian byte swapping (for MD5 calculation) */
#if CPU_IS_BIG_ENDIAN
#define H2LE_16(x) ENDSWAP_16 (x)
#define H2LE_32(x) ENDSWAP_32 (x)
#else
#define H2LE_16(x) (x)
#define H2LE_32(x) (x)
#endif

View file

@ -0,0 +1,184 @@
/*
NOTE:
I cannot get the vanilla getopt code to work (i.e. compile only what
is needed and not duplicate symbols found in the standard library)
on all the platforms that FLAC supports. In particular the gating
of code with the ELIDE_CODE #define is not accurate enough on systems
that are POSIX but not glibc. If someone has a patch that works on
GNU/Linux, Darwin, AND Solaris please submit it on the project page:
https://sourceforge.net/p/flac/patches/
In the meantime I have munged the global symbols and removed gates
around code, while at the same time trying to touch the original as
little as possible.
*/
/* Declarations for getopt.
Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#ifndef SHARE__GETOPT_H
#define SHARE__GETOPT_H
/*[JEC] was:#ifndef __need_getopt*/
/*[JEC] was:# define _GETOPT_H 1*/
/*[JEC] was:#endif*/
#ifdef __cplusplus
extern "C" {
#endif
/* For communication from `share__getopt' to the caller.
When `share__getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *share__optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `share__getopt'.
On entry to `share__getopt', zero means this is the first call; initialize.
When `share__getopt' returns -1, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `share__optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int share__optind;
/* Callers store zero here to inhibit the error message `share__getopt' prints
for unrecognized options. */
extern int share__opterr;
/* Set to an option character which was unrecognized. */
extern int share__optopt;
/*[JEC] was:#ifndef __need_getopt */
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to share__getopt_long or share__getopt_long_only is a vector
of `struct share__option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
share__no_argument (or 0) if the option does not take an argument,
share__required_argument (or 1) if the option requires an argument,
share__optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `share__optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `share__getopt'
returns the contents of the `val' field. */
struct share__option
{
# if defined __STDC__ && __STDC__
const char *name;
# else
char *name;
# endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct share__option'. */
# define share__no_argument 0
# define share__required_argument 1
# define share__optional_argument 2
/*[JEC] was:#endif*/ /* need getopt */
/* Get definitions and prototypes for functions to process the
arguments in ARGV (ARGC of them, minus the program name) for
options given in OPTS.
Return the option character from OPTS just read. Return -1 when
there are no more options. For unrecognized options, or options
missing arguments, `share__optopt' is set to the option letter, and '?' is
returned.
The OPTS string is a list of characters which are recognized option
letters, optionally followed by colons, specifying that that letter
takes an argument, to be placed in `share__optarg'.
If a letter in OPTS is followed by two colons, its argument is
optional. This behavior is specific to the GNU `share__getopt'.
The argument `--' causes premature termination of argument
scanning, explicitly telling `share__getopt' that there are no more
options.
If OPTS begins with `--', then non-option arguments are treated as
arguments to the option '\0'. This behavior is specific to the GNU
`share__getopt'. */
/*[JEC] was:#if defined __STDC__ && __STDC__*/
/*[JEC] was:# ifdef __GNU_LIBRARY__*/
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
extern int share__getopt (int argc, char *const *argv, const char *shortopts);
/*[JEC] was:# else*/ /* not __GNU_LIBRARY__ */
/*[JEC] was:extern int getopt ();*/
/*[JEC] was:# endif*/ /* __GNU_LIBRARY__ */
/*[JEC] was:# ifndef __need_getopt*/
extern int share__getopt_long (int argc, char *const *argv, const char *shortopts,
const struct share__option *longopts, int *longind);
extern int share__getopt_long_only (int argc, char *const *argv,
const char *shortopts,
const struct share__option *longopts, int *longind);
/* Internal only. Users should not call this directly. */
extern int share___getopt_internal (int argc, char *const *argv,
const char *shortopts,
const struct share__option *longopts, int *longind,
int long_only);
/*[JEC] was:# endif*/
/*[JEC] was:#else*/ /* not __STDC__ */
/*[JEC] was:extern int getopt ();*/
/*[JEC] was:# ifndef __need_getopt*/
/*[JEC] was:extern int getopt_long ();*/
/*[JEC] was:extern int getopt_long_only ();*/
/*[JEC] was:extern int _getopt_internal ();*/
/*[JEC] was:# endif*/
/*[JEC] was:#endif*/ /* __STDC__ */
#ifdef __cplusplus
}
#endif
/* Make sure we later can get all the definitions and declarations. */
/*[JEC] was:#undef __need_getopt*/
#endif /* getopt.h */

View file

@ -0,0 +1,30 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SHARE__GRABBAG_H
#define SHARE__GRABBAG_H
/* These can't be included by themselves, only from within grabbag.h */
#include "grabbag/cuesheet.h"
#include "grabbag/file.h"
#include "grabbag/picture.h"
#include "grabbag/replaygain.h"
#include "grabbag/seektable.h"
#endif

View file

@ -0,0 +1,8 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = \
cuesheet.h \
file.h \
picture.h \
replaygain.h \
seektable.h

View file

@ -0,0 +1,43 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
#ifndef GRABBAG__CUESHEET_H
#define GRABBAG__CUESHEET_H
#include <stdio.h>
#include "FLAC/metadata.h"
#ifdef __cplusplus
extern "C" {
#endif
uint32_t grabbag__cuesheet_msf_to_frame(uint32_t minutes, uint32_t seconds, uint32_t frames);
void grabbag__cuesheet_frame_to_msf(uint32_t frame, uint32_t *minutes, uint32_t *seconds, uint32_t *frames);
FLAC__StreamMetadata *grabbag__cuesheet_parse(FILE *file, const char **error_message, uint32_t *last_line_read, uint32_t sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset);
void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, const char *file_reference);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,65 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Convenience routines for manipulating files */
/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
#ifndef GRABAG__FILE_H
#define GRABAG__FILE_H
/* needed because of off_t */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h> /* for off_t */
#include <stdio.h> /* for FILE */
#include "FLAC/ordinals.h"
#include "share/compat.h"
#ifdef __cplusplus
extern "C" {
#endif
void grabbag__file_copy_metadata(const char *srcpath, const char *destpath);
FLAC__off_t grabbag__file_get_filesize(const char *srcpath);
const char *grabbag__file_get_basename(const char *srcpath);
/* read_only == false means "make file writable by user"
* read_only == true means "make file read-only for everyone"
*/
FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only);
/* returns true iff stat() succeeds for both files and they have the same device and inode. */
/* on windows, uses GetFileInformationByHandle() to compare */
FLAC__bool grabbag__file_are_same(const char *f1, const char *f2);
/* attempts to make writable before unlinking */
FLAC__bool grabbag__file_remove_file(const char *filename);
/* these will forcibly set stdin/stdout to binary mode (for OSes that require it) */
FILE *grabbag__file_get_binary_stdin(void);
FILE *grabbag__file_get_binary_stdout(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,54 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2006-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
#ifndef GRABBAG__PICTURE_H
#define GRABBAG__PICTURE_H
#include "FLAC/metadata.h"
#ifdef __cplusplus
extern "C" {
#endif
/* spec should be of the form "[TYPE]|MIME_TYPE|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE", e.g.
* "|image/jpeg|||cover.jpg"
* "4|image/jpeg||300x300x24|backcover.jpg"
* "|image/png|description|300x300x24/71|cover.png"
* "-->|image/gif||300x300x24/71|http://blah.blah.blah/cover.gif"
*
* empty type means default to FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER
* empty resolution spec means to get from the file (cannot get used with "-->" linked images)
* spec and error_message must not be NULL
*/
FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, const char **error_message);
typedef struct PictureResolution
{ uint32_t width, height, depth, colors ;
} PictureResolution ;
FLAC__StreamMetadata *grabbag__picture_from_specification(int type, const char *mime_type, const char * description,
const PictureResolution * res, const char * filepath, const char **error_message);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,73 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* This wraps the replaygain_analysis lib, which is LGPL. This wrapper
* allows analysis of different input resolutions by automatically
* scaling the input signal
*/
/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
#ifndef GRABBAG__REPLAYGAIN_H
#define GRABBAG__REPLAYGAIN_H
#include "FLAC/metadata.h"
#ifdef __cplusplus
extern "C" {
#endif
extern const uint32_t GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED;
extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS; /* = "REPLAYGAIN_REFERENCE_LOUDNESS" */
extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN; /* = "REPLAYGAIN_TRACK_GAIN" */
extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK; /* = "REPLAYGAIN_TRACK_PEAK" */
extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN; /* = "REPLAYGAIN_ALBUM_GAIN" */
extern const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK; /* = "REPLAYGAIN_ALBUM_PEAK" */
FLAC__bool grabbag__replaygain_is_valid_sample_frequency(uint32_t sample_frequency);
FLAC__bool grabbag__replaygain_init(uint32_t sample_frequency);
/* 'bps' must be valid for FLAC, i.e. >=4 and <= 32 */
FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__bool is_stereo, uint32_t bps, uint32_t samples);
void grabbag__replaygain_get_album(float *gain, float *peak);
void grabbag__replaygain_get_title(float *gain, float *peak);
/* These three functions return an error string on error, or NULL if successful */
const char *grabbag__replaygain_analyze_file(const char *filename, float *title_gain, float *title_peak);
const char *grabbag__replaygain_store_to_vorbiscomment(FLAC__StreamMetadata *block, float album_gain, float album_peak, float title_gain, float title_peak);
const char *grabbag__replaygain_store_to_vorbiscomment_reference(FLAC__StreamMetadata *block);
const char *grabbag__replaygain_store_to_vorbiscomment_album(FLAC__StreamMetadata *block, float album_gain, float album_peak);
const char *grabbag__replaygain_store_to_vorbiscomment_title(FLAC__StreamMetadata *block, float title_gain, float title_peak);
const char *grabbag__replaygain_store_to_file(const char *filename, float album_gain, float album_peak, float title_gain, float title_peak, FLAC__bool preserve_modtime);
const char *grabbag__replaygain_store_to_file_reference(const char *filename, FLAC__bool preserve_modtime);
const char *grabbag__replaygain_store_to_file_album(const char *filename, float album_gain, float album_peak, FLAC__bool preserve_modtime);
const char *grabbag__replaygain_store_to_file_title(const char *filename, float title_gain, float title_peak, FLAC__bool preserve_modtime);
FLAC__bool grabbag__replaygain_load_from_vorbiscomment(const FLAC__StreamMetadata *block, FLAC__bool album_mode, FLAC__bool strict, double *reference, double *gain, double *peak);
double grabbag__replaygain_compute_scale_factor(double peak, double gain, double preamp, FLAC__bool prevent_clipping);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,39 @@
/* grabbag - Convenience lib for various routines common to several tools
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Convenience routines for working with seek tables */
/* This .h cannot be included by itself; #include "share/grabbag.h" instead. */
#ifndef GRABAG__SEEKTABLE_H
#define GRABAG__SEEKTABLE_H
#include "FLAC/format.h"
#ifdef __cplusplus
extern "C" {
#endif
FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, uint32_t sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,45 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2013-2023 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.
*/
#include <errno.h>
/* FLAC_CHECK_RETURN : Check the return value of the provided function and
* print an error message if it fails (ie returns a value < 0).
*
* Ideally, a library should not print anything, but this macro is only used
* for things that extremely unlikely to fail, like `chown` to a previoulsy
* saved `uid`.
*/
#define FLAC_CHECK_RETURN(x) \
{ if ((x) < 0) \
fprintf (stderr, "%s : %s\n", #x, strerror (errno)) ; \
}

View file

@ -0,0 +1,54 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2013-2023 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.
*/
#ifndef FLAC__SHARE__PRIVATE_H
#define FLAC__SHARE__PRIVATE_H
/*
* Unpublished debug routines from libFLAC. This should not be used from any
* client code other than code shipped with the FLAC sources.
*/
FLAC_API FLAC__bool FLAC__stream_encoder_disable_instruction_set(FLAC__StreamEncoder *encoder, int value);
FLAC_API FLAC__bool FLAC__stream_encoder_disable_constant_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value);
FLAC_API FLAC__bool FLAC__stream_encoder_disable_fixed_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value);
FLAC_API FLAC__bool FLAC__stream_encoder_disable_verbatim_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value);
/*
* The following two routines were intended as debug routines and are not
* in the public headers, but SHOULD NOT CHANGE! It is known they are used
* in some non-audio projects needing every last bit of performance.
* See https://github.com/xiph/flac/issues/547 for details. These projects
* provide their own prototypes, so changing the signature of these
* functions would break building.
*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_do_md5(FLAC__StreamEncoder *encoder, FLAC__bool value);
FLAC_API FLAC__bool FLAC__stream_encoder_get_do_md5(const FLAC__StreamEncoder *encoder);
#endif /* FLAC__SHARE__PRIVATE_H */

View file

@ -0,0 +1,59 @@
/*
* ReplayGainAnalysis - analyzes input samples and give the recommended dB change
* Copyright (C) 2001 David Robinson and Glen Sawyer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* concept and filter values by David Robinson (David@Robinson.org)
* -- blame him if you think the idea is flawed
* coding by Glen Sawyer (glensawyer@hotmail.com) 442 N 700 E, Provo, UT 84606 USA
* -- blame him if you think this runs too slowly, or the coding is otherwise flawed
* minor cosmetic tweaks to integrate with FLAC by Josh Coalson
*
* For an explanation of the concepts and the basic algorithms involved, go to:
* http://www.replaygain.org/
*/
#ifndef GAIN_ANALYSIS_H
#define GAIN_ANALYSIS_H
#include <stddef.h>
#define GAIN_NOT_ENOUGH_SAMPLES -24601
#define GAIN_ANALYSIS_ERROR 0
#define GAIN_ANALYSIS_OK 1
#define INIT_GAIN_ANALYSIS_ERROR 0
#define INIT_GAIN_ANALYSIS_OK 1
#ifdef __cplusplus
extern "C" {
#endif
typedef float flac_float_t; /* Type used for filtering */
extern flac_float_t ReplayGainReferenceLoudness; /* in dB SPL, currently == 89.0 */
int InitGainAnalysis ( long samplefreq );
int ValidGainFrequency ( long samplefreq );
int AnalyzeSamples ( const flac_float_t* left_samples, const flac_float_t* right_samples, size_t num_samples, int num_channels );
flac_float_t GetTitleGain ( void );
flac_float_t GetAlbumGain ( void );
#ifdef __cplusplus
}
#endif
#endif /* GAIN_ANALYSIS_H */

View file

@ -0,0 +1,52 @@
/* replaygain_synthesis - Routines for applying ReplayGain to a signal
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H
#define FLAC__SHARE__REPLAYGAIN_SYNTHESIS_H
#include <stdlib.h> /* for size_t */
#include "FLAC/format.h"
#define FLAC_SHARE__MAX_SUPPORTED_CHANNELS FLAC__MAX_CHANNELS
typedef enum {
NOISE_SHAPING_NONE = 0,
NOISE_SHAPING_LOW = 1,
NOISE_SHAPING_MEDIUM = 2,
NOISE_SHAPING_HIGH = 3
} NoiseShaping;
typedef struct {
const float* FilterCoeff;
FLAC__uint64 Mask;
double Add;
float Dither;
float ErrorHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16]; /* 16th order Noise shaping */
float DitherHistory [FLAC_SHARE__MAX_SUPPORTED_CHANNELS] [16];
int LastRandomNumber [FLAC_SHARE__MAX_SUPPORTED_CHANNELS];
unsigned LastHistoryIndex;
NoiseShaping ShapingType;
} DitherContext;
void FLAC__replaygain_synthesis__init_dither_context(DitherContext *dither, int bits, int shapingtype);
/* scale = (float) pow(10., (double)replaygain * 0.05); */
size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool unsigned_data_out, const FLAC__int32 * const input[], uint32_t wide_samples, uint32_t channels, const uint32_t source_bps, const uint32_t target_bps, const double scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context);
#endif

View file

@ -0,0 +1,71 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2013-2023 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.
*/
/* Safe string handling functions to replace things like strcpy, strncpy,
* strcat, strncat etc.
* All of these functions guarantee a correctly NUL terminated string but
* the string may be truncated if the destination buffer was too short.
*/
#ifndef FLAC__SHARE_SAFE_STR_H
#define FLAC__SHARE_SAFE_STR_H
static inline char *
safe_strncat(char *dest, const char *src, size_t dest_size)
{
char * ret;
if (dest_size < 1)
return dest;
/* Assume dist has space for a term character .. */
ret = strncat(dest, src, dest_size - strlen (dest));
/* .. but set it explicitly. */
dest [dest_size - 1] = 0;
return ret;
}
static inline char *
safe_strncpy(char *dest, const char *src, size_t dest_size)
{
char * ret;
if (dest_size < 1)
return dest;
ret = strncpy(dest, src, dest_size - 1);
dest [dest_size - 1] = 0;
return ret;
}
#endif /* FLAC__SHARE_SAFE_STR_H */

View file

@ -0,0 +1,25 @@
#ifndef SHARE__UTF8_H
#define SHARE__UTF8_H
/*
* Convert a string between UTF-8 and the locale's charset.
* Invalid bytes are replaced by '#', and characters that are
* not available in the target encoding are replaced by '?'.
*
* If the locale's charset is not set explicitly then it is
* obtained using nl_langinfo(CODESET), where available, the
* environment variable CHARSET, or assumed to be US-ASCII.
*
* Return value of conversion functions:
*
* -1 : memory allocation failed
* 0 : data was converted exactly
* 1 : valid data was converted approximately (using '?')
* 2 : input was invalid (but still converted, using '#')
* 3 : unknown encoding (but still converted, using '?')
*/
int utf8_encode(const char *from, char **to);
int utf8_decode(const char *from, char **to);
#endif

View file

@ -0,0 +1,71 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2013-2023 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.
*/
#ifdef _WIN32
#ifndef flac__win_utf8_io_h
#define flac__win_utf8_io_h
#include <stdio.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <sys/utime.h>
#include "FLAC/ordinals.h"
#ifdef __cplusplus
extern "C" {
#endif
size_t strlen_utf8(const char *str);
int win_get_console_width(void);
int get_utf8_argv(int *argc, char ***argv);
int printf_utf8(const char *format, ...);
int fprintf_utf8(FILE *stream, const char *format, ...);
int vfprintf_utf8(FILE *stream, const char *format, va_list argptr);
FILE* fopen_utf8(const char *filename, const char *mode);
int stat64_utf8(const char *path, struct __stat64 *buffer);
int chmod_utf8(const char *filename, int pmode);
int utime_utf8(const char *filename, struct utimbuf *times);
int unlink_utf8(const char *filename);
int rename_utf8(const char *oldname, const char *newname);
#include <windows.h>
HANDLE WINAPI CreateFile_utf8(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
#endif

View file

@ -0,0 +1,5 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST = \
file_utils_flac.h \
metadata_utils.h

View file

@ -0,0 +1,36 @@
/* test_libFLAC - Unit tester for libFLAC
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef FLAC__TEST_LIBFLAC_FILE_UTILS_H
#define FLAC__TEST_LIBFLAC_FILE_UTILS_H
/* needed because of off_t */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "FLAC/format.h"
#include <sys/types.h> /* for off_t */
#include "share/compat.h"
extern const long file_utils__ogg_serial_number;
FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_filename, FLAC__off_t *output_filesize, uint32_t length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, uint32_t num_metadata);
#endif

View file

@ -0,0 +1,71 @@
/* test_libFLAC - Unit tester for libFLAC
* Copyright (C) 2002-2009 Josh Coalson
* Copyright (C) 2011-2023 Xiph.Org Foundation
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef FLAC__TEST_LIBS_COMMON_METADATA_UTILS_H
#define FLAC__TEST_LIBS_COMMON_METADATA_UTILS_H
/*
* These are not tests, just utility functions used by the metadata tests
*/
#include "FLAC/format.h"
FLAC__bool mutils__compare_block_data_streaminfo(const FLAC__StreamMetadata_StreamInfo *block, const FLAC__StreamMetadata_StreamInfo *blockcopy);
FLAC__bool mutils__compare_block_data_padding(const FLAC__StreamMetadata_Padding *block, const FLAC__StreamMetadata_Padding *blockcopy, uint32_t block_length);
FLAC__bool mutils__compare_block_data_application(const FLAC__StreamMetadata_Application *block, const FLAC__StreamMetadata_Application *blockcopy, uint32_t block_length);
FLAC__bool mutils__compare_block_data_seektable(const FLAC__StreamMetadata_SeekTable *block, const FLAC__StreamMetadata_SeekTable *blockcopy);
FLAC__bool mutils__compare_block_data_vorbiscomment(const FLAC__StreamMetadata_VorbisComment *block, const FLAC__StreamMetadata_VorbisComment *blockcopy);
FLAC__bool mutils__compare_block_data_cuesheet(const FLAC__StreamMetadata_CueSheet *block, const FLAC__StreamMetadata_CueSheet *blockcopy);
FLAC__bool mutils__compare_block_data_picture(const FLAC__StreamMetadata_Picture *block, const FLAC__StreamMetadata_Picture *blockcopy);
FLAC__bool mutils__compare_block_data_unknown(const FLAC__StreamMetadata_Unknown *block, const FLAC__StreamMetadata_Unknown *blockcopy, uint32_t block_length);
FLAC__bool mutils__compare_block(const FLAC__StreamMetadata *block, const FLAC__StreamMetadata *blockcopy);
void mutils__init_metadata_blocks(
FLAC__StreamMetadata *streaminfo,
FLAC__StreamMetadata *padding,
FLAC__StreamMetadata *seektable,
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
FLAC__StreamMetadata *cuesheet,
FLAC__StreamMetadata *picture,
FLAC__StreamMetadata *unknown
);
void mutils__free_metadata_blocks(
FLAC__StreamMetadata *streaminfo,
FLAC__StreamMetadata *padding,
FLAC__StreamMetadata *seektable,
FLAC__StreamMetadata *application1,
FLAC__StreamMetadata *application2,
FLAC__StreamMetadata *vorbiscomment,
FLAC__StreamMetadata *cuesheet,
FLAC__StreamMetadata *picture,
FLAC__StreamMetadata *unknown
);
#endif

View file

@ -0,0 +1,26 @@
# FLAC - Free Lossless Audio Codec
# Copyright (C) 2006-2009 Josh Coalson
# Copyright (C) 2011-2023 Xiph.Org Foundation
#
# This file is part the FLAC project. FLAC is comprised of several
# components distributed under different licenses. The codec libraries
# are distributed under Xiph.Org's BSD-like license (see the file
# COPYING.Xiph in this distribution). All other programs, libraries, and
# plugins are distributed under the GPL (see COPYING.GPL). The documentation
# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
# FLAC distribution contains at the top the terms under which it may be
# distributed.
#
# Since this particular file is relevant to all components of FLAC,
# it may be distributed under the Xiph.Org license, which is the least
# restrictive of those mentioned above. See the file COPYING.Xiph in this
# distribution.
EXTRA_DIST = \
add_cflags.m4 \
add_cxxflags.m4 \
bswap.m4 \
endian.m4 \
gcc_version.m4 \
ogg.m4 \
stack_protect.m4

View file

@ -0,0 +1,15 @@
dnl @synopsis XIPH_ADD_CFLAGS
dnl
dnl Add the given option to CFLAGS, if it doesn't break the compiler
AC_DEFUN([XIPH_ADD_CFLAGS],
[AC_MSG_CHECKING([if $CC accepts $1])
ac_add_cflags__old_cflags="$CFLAGS"
CFLAGS="$1"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
]], [[puts("Hello, World!"); return 0;]])],[AC_MSG_RESULT(yes)
CFLAGS="$ac_add_cflags__old_cflags $1"],[AC_MSG_RESULT(no)
CFLAGS="$ac_add_cflags__old_cflags"
])
])# XIPH_ADD_CFLAGS

Some files were not shown because too many files have changed in this diff Show more