1
0

README 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. /* FLAC - Free Lossless Audio Codec
  2. * Copyright (C) 2001-2009 Josh Coalson
  3. * Copyright (C) 2011-2016 Xiph.Org Foundation
  4. *
  5. * This file is part the FLAC project. FLAC is comprised of several
  6. * components distributed under different licenses. The codec libraries
  7. * are distributed under Xiph.Org's BSD-like license (see the file
  8. * COPYING.Xiph in this distribution). All other programs, libraries, and
  9. * plugins are distributed under the LGPL or GPL (see COPYING.LGPL and
  10. * COPYING.GPL). The documentation is distributed under the Gnu FDL (see
  11. * COPYING.FDL). Each file in the FLAC distribution contains at the top the
  12. * terms under which it may be distributed.
  13. *
  14. * Since this particular file is relevant to all components of FLAC,
  15. * it may be distributed under the Xiph.Org license, which is the least
  16. * restrictive of those mentioned above. See the file COPYING.Xiph in this
  17. * distribution.
  18. */
  19. FLAC is an Open Source lossless audio codec developed by Josh Coalson from 2001
  20. to 2009. From 2012 to 2021 it was maintained by Erik de Castro Lopo. It continues to be maintained by various volunteers under the auspices of the Xiph.org Foundation.
  21. FLAC is comprised of
  22. * `libFLAC', a library which implements reference encoders and
  23. decoders for native FLAC and Ogg FLAC, and a metadata interface
  24. * `libFLAC++', a C++ object wrapper library around libFLAC
  25. * `flac', a command-line program for encoding and decoding files
  26. * `metaflac', a command-line program for viewing and editing FLAC
  27. metadata
  28. * player plugin for XMMS
  29. * user and API documentation
  30. The libraries (libFLAC, libFLAC++) are
  31. licensed under Xiph.org's BSD-like license (see COPYING.Xiph). All other
  32. programs and plugins are licensed under the GNU General Public License
  33. (see COPYING.GPL). The documentation is licensed under the GNU Free
  34. Documentation License (see COPYING.FDL).
  35. ===============================================================================
  36. FLAC - 1.3.4 - Contents
  37. ===============================================================================
  38. - Introduction
  39. - Prerequisites
  40. - Note to embedded developers
  41. - Building in a GNU environment
  42. - Building with Makefile.lite
  43. - Building with MSVC
  44. - Building on Mac OS X
  45. - Building with CMake
  46. ===============================================================================
  47. Introduction
  48. ===============================================================================
  49. This is the source release for the FLAC project. See
  50. doc/html/index.html
  51. for full documentation.
  52. A brief description of the directory tree:
  53. doc/ the HTML documentation
  54. examples/ example programs demonstrating the use of libFLAC and libFLAC++
  55. include/ public include files for libFLAC and libFLAC++
  56. man/ the man pages for `flac' and `metaflac'
  57. src/ the source code and private headers
  58. test/ the test scripts
  59. If you have questions about building FLAC that this document does not answer,
  60. please submit them at the following tracker so this document can be improved:
  61. https://sourceforge.net/p/flac/support-requests/
  62. ===============================================================================
  63. Prerequisites
  64. ===============================================================================
  65. To build FLAC with support for Ogg FLAC you must have built and installed
  66. libogg according to the specific instructions below. You must have
  67. libogg 1.1.2 or greater, or there will be seeking problems with Ogg FLAC.
  68. If you are building on x86 and want the assembly optimizations, you will
  69. need to have NASM >= 0.98.30 installed according to the specific instructions
  70. below.
  71. ===============================================================================
  72. Note to embedded developers
  73. ===============================================================================
  74. libFLAC has grown larger over time as more functionality has been
  75. included, but much of it may be unnecessary for a particular embedded
  76. implementation. Unused parts may be pruned by some simple editing of
  77. configure.ac and src/libFLAC/Makefile.am; the following dependency
  78. graph shows which modules may be pruned without breaking things
  79. further down:
  80. metadata.h
  81. stream_decoder.h
  82. format.h
  83. stream_encoder.h
  84. stream_decoder.h
  85. format.h
  86. stream_decoder.h
  87. format.h
  88. In other words, for pure decoding applications, both the stream encoder
  89. and metadata editing interfaces can be safely removed.
  90. There is a section dedicated to embedded use in the libFLAC API
  91. HTML documentation (see doc/html/api/index.html).
  92. Also, there are several places in the libFLAC code with comments marked
  93. with "OPT:" where a #define can be changed to enable code that might be
  94. faster on a specific platform. Experimenting with these can yield faster
  95. binaries.
  96. ===============================================================================
  97. Building in a GNU environment
  98. ===============================================================================
  99. FLAC uses autoconf and libtool for configuring and building.
  100. Better documentation for these will be forthcoming, but in
  101. general, this should work:
  102. ./configure && make && make check && make install
  103. The 'make check' step is optional; omit it to skip all the tests,
  104. which can take several hours and use around 70-80 megs of disk space.
  105. Even though it will stop with an explicit message on any failure, it
  106. does print out a lot of stuff so you might want to capture the output
  107. to a file if you're having a problem. Also, don't run 'make check'
  108. as root because it confuses some of the tests.
  109. NOTE: Despite our best efforts it's entirely possible to have
  110. problems when using older versions of autoconf, automake, or
  111. libtool. If you have the latest versions and still can't get it
  112. to work, see the next section on Makefile.lite.
  113. There are a few FLAC-specific arguments you can give to
  114. `configure':
  115. --enable-debug : Builds everything with debug symbols and some
  116. extra (and more verbose) error checking.
  117. --disable-asm-optimizations : Disables the compilation of the
  118. assembly routines. Many routines have assembly versions for
  119. speed and `configure' is pretty good about knowing what is
  120. supported, but you can use this option to build only from the
  121. C sources. May be necessary for building on OS X (Intel).
  122. --enable-sse : If you are building for an x86 CPU that supports
  123. SSE instructions, you can enable some of the faster routines
  124. if your operating system also supports SSE instructions. flac
  125. can tell if the CPU supports the instructions but currently has
  126. no way to test if the OS does, so if it does, you must pass
  127. this argument to configure to use the SSE routines. If flac
  128. crashes when built with this option you will have to go back and
  129. configure without --enable-sse. Note that
  130. --disable-asm-optimizations implies --disable-sse.
  131. --enable-local-xmms-plugin : Installs the FLAC XMMS plugin in
  132. $HOME/.xmms/Plugins, instead of the global XMMS plugin area
  133. (usually /usr/lib/xmms/Input).
  134. --with-ogg=
  135. --with-xmms-prefix=
  136. --with-libiconv-prefix=
  137. Use these if you have these packages but configure can't find them.
  138. If you want to build completely from scratch (i.e. starting with just
  139. configure.ac and Makefile.am) you should be able to just run 'autogen.sh'
  140. but make sure and read the comments in that file first.
  141. ===============================================================================
  142. Building with Makefile.lite
  143. ===============================================================================
  144. There is a more lightweight build system for do-it-yourself-ers.
  145. It is also useful if configure isn't working, which may be the
  146. case since lately we've had some problems with different versions
  147. of automake and libtool. The Makefile.lite system should work
  148. on GNU systems with few or no adjustments.
  149. From the top level just 'make -f Makefile.lite'. You can
  150. specify zero or one optional target from 'release', 'debug',
  151. 'test', or 'clean'. The default is 'release'. There is no
  152. 'install' target but everything you need will end up in the
  153. obj/ directory.
  154. If you are not on an x86 system or you don't have nasm, you
  155. may have to change the DEFINES in src/libFLAC/Makefile.lite. If
  156. you don't have nasm, remove -DFLAC__HAS_NASM. If your target is
  157. not an x86, change -DFLAC__CPU_IA32 to -DFLAC__CPU_UNKNOWN.
  158. ===============================================================================
  159. Building with MSVC
  160. ===============================================================================
  161. When building with MSVC, using CMake is preferred, see Building with
  162. CMake for more information. Building with MSVC using solution files
  163. is deprecated and these files will be removed in the future.
  164. There are .vcproj projects and a master FLAC.sln solution to build all
  165. the libraries and executables with MSVC 2005 or newer.
  166. Prerequisite: you must have the Ogg libraries installed as described
  167. later.
  168. Prerequisite: you must have nasm installed, and nasm.exe must be in
  169. your PATH, or the path to nasm.exe must be added to the list of
  170. directories for executable files in the MSVC global options.
  171. To build everything, run Visual Studio, do File|Open and open FLAC.sln.
  172. From the dropdown in the toolbar, select "Release" instead of "Debug",
  173. then do Build|Build Solution.
  174. This will build all libraries both statically (e.g.
  175. objs\release\lib\libFLAC_static.lib) and as DLLs (e.g.
  176. objs\release\lib\libFLAC.dll), and it will build all binaries, statically
  177. linked (e.g. objs\release\bin\flac.exe).
  178. Everything will end up in the "objs" directory. DLLs and .exe files
  179. are all that are needed and can be copied to an installation area and
  180. added to the PATH.
  181. By default the code is configured with Ogg support. Before building FLAC
  182. you will need to get the Ogg source distribution
  183. (see http://xiph.org/downloads/), build libogg_static.lib (load
  184. win32\libogg_static.sln, change solution configuration to "Release" and
  185. code generation to "Multi-threaded (/MT)", then build), copy libogg_static.lib
  186. into FLAC's 'objs\release\lib' directory, and copy the entire include\ogg tree
  187. into FLAC's 'include' directory (so that there is an 'ogg' directory in FLAC's
  188. 'include' directory with the files ogg.h, os_types.h and config_types.h).
  189. If you want to build without Ogg support, instead edit all .vcproj files
  190. and remove any "FLAC__HAS_OGG" definitions.
  191. ===============================================================================
  192. Building on Mac OS X
  193. ===============================================================================
  194. If you have Fink or a recent version of OS X with the proper autotools,
  195. the GNU flow above should work.
  196. ===============================================================================
  197. Building with CMake
  198. ===============================================================================
  199. CMake is a cross-platform build system. FLAC can be built on Windows, Linux, Mac
  200. OS X using CMake.
  201. You can use either CMake's CLI or GUI. We recommend you to have a separate build
  202. folder outside the repository in order to not spoil it with generated files.
  203. CLI
  204. ---
  205. Go to your build folder and run something like this:
  206. /path/to/flac/build$ cmake /path/to/flac/source
  207. or e.g. in Windows shell
  208. C:\path\to\flac\build> cmake \path\to\flac\source
  209. (provided that cmake is in your %PATH% variable)
  210. That will generate build scripts for the default build system (e.g. Makefiles
  211. for UNIX). After that you start build with a command like this:
  212. /path/to/flac/build$ make
  213. And afterwards you can run tests or install the built libraries and headers
  214. /path/to/flac/build$ make test
  215. /path/to/flac/build$ make install
  216. If you want use a build system other than default add -G flag to cmake, e.g.:
  217. /path/to/flac/build$ cmake /path/to/flac/source -GNinja
  218. /path/to/flac/build$ ninja
  219. or:
  220. /path/to/flac/build$ cmake /path/to/flac/source -GXcode
  221. Use cmake --help to see the list of available generators.
  222. If you have OGG on your system you can tell CMake to use it:
  223. /path/to/flac/build$ cmake /path/to/flac/source -DWITH_OGG=ON
  224. If CMake fails to find it you can help CMake by specifying the exact path:
  225. /path/to/flac/build$ cmake /path/to/flac/source -DWITH_OGG=ON -DOGG_ROOT=/path/to/ogg
  226. CMake will search for OGG by default so if you don't have it you can tell
  227. cmake to not do so:
  228. /path/to/flac/build$ cmake /path/to/flac/source -DWITH_OGG=OFF
  229. Other FLAC's options (e.g. building C++ lib or docs) can also be put to cmake
  230. through -D flag.
  231. GUI
  232. ---
  233. It is likely that you would prefer to use it on Windows building for Visual
  234. Studio. It's in essence the same process as building using CLI.
  235. Open cmake-gui. In the window select a source directory (the repository's
  236. root), a build directory (some other directory outside the repository). Then
  237. press button "Configure". CMake will ask you which build system you prefer.
  238. Choose that version of Visual Studio which you have on your system, choose
  239. whether you want to build for x86 or amd64. Press OK. After CMake finishes
  240. press "Generate" button, and after that "Open Project". In response CMake
  241. will launch Visual Studio and open the generated solution. You can use it as
  242. usual but remember that it was generated by CMake. That means that your
  243. changes (e.g. some addidional compile flags) will be lost when you run CMake
  244. next time.
  245. Again, if you have OGG on your system set WITH_OGG flag in the list of
  246. variables in cmake-gui window before you press "Configure".
  247. If CMake fails to find MSVC compiler then running cmake-gui from MS Developer
  248. comand prompt should help.