./0000775000175000017500000000000012511510556011436 5ustar nielsenrnielsenr./generic_BSD0000664000175000017500000000273312511411356013470 0ustar nielsenrnielsenrCopyright (c) The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. Neither the name of the University 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 REGENTS 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 REGENTS 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. ./generic_LGPLv2.10000664000175000017500000006242612511411356014232 0ustar nielsenrnielsenr 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. 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 an 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! ./main.c0000664000175000017500000031472312150471650012540 0ustar nielsenrnielsenr/* flac - Command-line FLAC encoder/decoder * Copyright (C) 2000-2009 Josh Coalson * Copyright (C) 2011-2013 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. */ #if HAVE_CONFIG_H # include #endif #include #include #include #include #include #include #include #include #if !defined _MSC_VER && !defined __MINGW32__ /* unlink is in stdio.h in VC++ */ #include /* for unlink() */ #endif #include "FLAC/all.h" #include "share/alloc.h" #include "share/grabbag.h" #include "share/compat.h" #include "share/safe_str.h" #include "analyze.h" #include "decode.h" #include "encode.h" #include "local_string_utils.h" /* for flac__strlcat() and flac__strlcpy() */ #include "utils.h" #include "vorbiscomment.h" #if defined _MSC_VER || defined __MINGW32__ #define FLAC__STRCASECMP stricmp #else #define FLAC__STRCASECMP strcasecmp #endif #if 0 /*[JEC] was:#if HAVE_GETOPT_LONG*/ /*[JEC] see flac/include/share/getopt.h as to why the change */ # include #else # include "share/getopt.h" #endif static int do_it(void); static FLAC__bool init_options(void); static int parse_options(int argc, char *argv[]); static int parse_option(int short_option, const char *long_option, const char *option_argument); static void free_options(void); static void add_compression_setting_bool(compression_setting_type_t type, FLAC__bool value); static void add_compression_setting_string(compression_setting_type_t type, const char *value); static void add_compression_setting_unsigned(compression_setting_type_t type, unsigned value); static int usage_error(const char *message, ...); static void short_usage(void); static void show_version(void); static void show_help(void); static void show_explain(void); static void format_mistake(const char *infilename, FileFormat wrong, FileFormat right); static int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_last_file); static int decode_file(const char *infilename); static const char *get_encoded_outfilename(const char *infilename); static const char *get_decoded_outfilename(const char *infilename); static const char *get_outfilename(const char *infilename, const char *suffix); static void die(const char *message); static int conditional_fclose(FILE *f); static char *local_strdup(const char *source); /* * share__getopt format struct; note that for long options with no * short option equivalent we just set the 'val' field to 0. */ static struct share__option long_options_[] = { /* * general options */ { "help" , share__no_argument, 0, 'h' }, { "explain" , share__no_argument, 0, 'H' }, { "version" , share__no_argument, 0, 'v' }, { "decode" , share__no_argument, 0, 'd' }, { "analyze" , share__no_argument, 0, 'a' }, { "test" , share__no_argument, 0, 't' }, { "stdout" , share__no_argument, 0, 'c' }, { "silent" , share__no_argument, 0, 's' }, { "totally-silent" , share__no_argument, 0, 0 }, { "warnings-as-errors" , share__no_argument, 0, 'w' }, { "force" , share__no_argument, 0, 'f' }, { "delete-input-file" , share__no_argument, 0, 0 }, { "preserve-modtime" , share__no_argument, 0, 0 }, { "keep-foreign-metadata" , share__no_argument, 0, 0 }, { "output-prefix" , share__required_argument, 0, 0 }, { "output-name" , share__required_argument, 0, 'o' }, { "skip" , share__required_argument, 0, 0 }, { "until" , share__required_argument, 0, 0 }, { "channel-map" , share__required_argument, 0, 0 }, /* undocumented */ /* * decoding options */ { "decode-through-errors", share__no_argument, 0, 'F' }, { "cue" , share__required_argument, 0, 0 }, { "apply-replaygain-which-is-not-lossless", share__optional_argument, 0, 0 }, /* undocumented */ /* * encoding options */ { "cuesheet" , share__required_argument, 0, 0 }, { "no-cued-seekpoints" , share__no_argument, 0, 0 }, { "picture" , share__required_argument, 0, 0 }, { "tag" , share__required_argument, 0, 'T' }, { "tag-from-file" , share__required_argument, 0, 0 }, { "compression-level-0" , share__no_argument, 0, '0' }, { "compression-level-1" , share__no_argument, 0, '1' }, { "compression-level-2" , share__no_argument, 0, '2' }, { "compression-level-3" , share__no_argument, 0, '3' }, { "compression-level-4" , share__no_argument, 0, '4' }, { "compression-level-5" , share__no_argument, 0, '5' }, { "compression-level-6" , share__no_argument, 0, '6' }, { "compression-level-7" , share__no_argument, 0, '7' }, { "compression-level-8" , share__no_argument, 0, '8' }, { "compression-level-9" , share__no_argument, 0, '9' }, { "best" , share__no_argument, 0, '8' }, { "fast" , share__no_argument, 0, '0' }, { "verify" , share__no_argument, 0, 'V' }, { "force-raw-format" , share__no_argument, 0, 0 }, { "force-aiff-format" , share__no_argument, 0, 0 }, { "force-rf64-format" , share__no_argument, 0, 0 }, { "force-wave64-format" , share__no_argument, 0, 0 }, { "lax" , share__no_argument, 0, 0 }, { "replay-gain" , share__no_argument, 0, 0 }, { "ignore-chunk-sizes" , share__no_argument, 0, 0 }, { "sector-align" , share__no_argument, 0, 0 }, /* DEPRECATED */ { "seekpoint" , share__required_argument, 0, 'S' }, { "padding" , share__required_argument, 0, 'P' }, #if FLAC__HAS_OGG { "ogg" , share__no_argument, 0, 0 }, { "serial-number" , share__required_argument, 0, 0 }, #endif { "blocksize" , share__required_argument, 0, 'b' }, { "exhaustive-model-search" , share__no_argument, 0, 'e' }, { "max-lpc-order" , share__required_argument, 0, 'l' }, { "apodization" , share__required_argument, 0, 'A' }, { "mid-side" , share__no_argument, 0, 'm' }, { "adaptive-mid-side" , share__no_argument, 0, 'M' }, { "qlp-coeff-precision-search", share__no_argument, 0, 'p' }, { "qlp-coeff-precision" , share__required_argument, 0, 'q' }, { "rice-partition-order" , share__required_argument, 0, 'r' }, { "endian" , share__required_argument, 0, 0 }, { "channels" , share__required_argument, 0, 0 }, { "bps" , share__required_argument, 0, 0 }, { "sample-rate" , share__required_argument, 0, 0 }, { "sign" , share__required_argument, 0, 0 }, { "input-size" , share__required_argument, 0, 0 }, /* * analysis options */ { "residual-gnuplot", share__no_argument, 0, 0 }, { "residual-text", share__no_argument, 0, 0 }, /* * negatives */ { "no-preserve-modtime" , share__no_argument, 0, 0 }, { "no-decode-through-errors" , share__no_argument, 0, 0 }, { "no-silent" , share__no_argument, 0, 0 }, { "no-force" , share__no_argument, 0, 0 }, { "no-seektable" , share__no_argument, 0, 0 }, { "no-delete-input-file" , share__no_argument, 0, 0 }, { "no-keep-foreign-metadata" , share__no_argument, 0, 0 }, { "no-replay-gain" , share__no_argument, 0, 0 }, { "no-ignore-chunk-sizes" , share__no_argument, 0, 0 }, { "no-sector-align" , share__no_argument, 0, 0 }, /* DEPRECATED */ { "no-utf8-convert" , share__no_argument, 0, 0 }, { "no-lax" , share__no_argument, 0, 0 }, #if FLAC__HAS_OGG { "no-ogg" , share__no_argument, 0, 0 }, #endif { "no-exhaustive-model-search", share__no_argument, 0, 0 }, { "no-mid-side" , share__no_argument, 0, 0 }, { "no-adaptive-mid-side" , share__no_argument, 0, 0 }, { "no-qlp-coeff-prec-search" , share__no_argument, 0, 0 }, { "no-padding" , share__no_argument, 0, 0 }, { "no-verify" , share__no_argument, 0, 0 }, { "no-warnings-as-errors" , share__no_argument, 0, 0 }, { "no-residual-gnuplot" , share__no_argument, 0, 0 }, { "no-residual-text" , share__no_argument, 0, 0 }, /* * undocumented debugging options for the test suite */ { "disable-constant-subframes", share__no_argument, 0, 0 }, { "disable-fixed-subframes" , share__no_argument, 0, 0 }, { "disable-verbatim-subframes", share__no_argument, 0, 0 }, { "no-md5-sum" , share__no_argument, 0, 0 }, {0, 0, 0, 0} }; /* * global to hold command-line option values */ static struct { FLAC__bool show_help; FLAC__bool show_explain; FLAC__bool show_version; FLAC__bool mode_decode; FLAC__bool verify; FLAC__bool treat_warnings_as_errors; FLAC__bool force_file_overwrite; FLAC__bool continue_through_decode_errors; replaygain_synthesis_spec_t replaygain_synthesis_spec; FLAC__bool lax; FLAC__bool test_only; FLAC__bool analyze; FLAC__bool use_ogg; FLAC__bool has_serial_number; /* true iff --serial-number was used */ long serial_number; /* this is the Ogg serial number and is unused for native FLAC */ FLAC__bool force_to_stdout; FLAC__bool force_raw_format; FLAC__bool force_aiff_format; FLAC__bool force_rf64_format; FLAC__bool force_wave64_format; FLAC__bool delete_input; FLAC__bool preserve_modtime; FLAC__bool keep_foreign_metadata; FLAC__bool replay_gain; FLAC__bool ignore_chunk_sizes; FLAC__bool sector_align; FLAC__bool utf8_convert; /* true by default, to convert tag strings from locale to utf-8, false if --no-utf8-convert used */ const char *cmdline_forced_outfilename; const char *output_prefix; analysis_options aopts; int padding; /* -1 => no -P options were given, 0 => -P- was given, else -P value */ size_t num_compression_settings; compression_setting_t compression_settings[64]; /* bad MAGIC NUMBER but buffer overflow is checked */ const char *skip_specification; const char *until_specification; const char *cue_specification; int format_is_big_endian; int format_is_unsigned_samples; int format_channels; int format_bps; int format_sample_rate; FLAC__off_t format_input_size; char requested_seek_points[5000]; /* bad MAGIC NUMBER but buffer overflow is checked */ int num_requested_seek_points; /* -1 => no -S options were given, 0 => -S- was given */ const char *cuesheet_filename; FLAC__bool cued_seekpoints; FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */ unsigned num_files; char **filenames; FLAC__StreamMetadata *vorbis_comment; FLAC__StreamMetadata *pictures[64]; unsigned num_pictures; struct { FLAC__bool disable_constant_subframes; FLAC__bool disable_fixed_subframes; FLAC__bool disable_verbatim_subframes; FLAC__bool do_md5; } debug; } option_values; /* * miscellaneous globals */ static FLAC__int32 align_reservoir_0[588], align_reservoir_1[588]; /* for carrying over samples from --sector-align */ /* DEPRECATED */ static FLAC__int32 *align_reservoir[2] = { align_reservoir_0, align_reservoir_1 }; static unsigned align_reservoir_samples = 0; /* 0 .. 587 */ int main(int argc, char *argv[]) { int retval = 0; #ifdef __EMX__ _response(&argc, &argv); _wildcard(&argc, &argv); #endif #ifdef _WIN32 if (get_utf8_argv(&argc, &argv) != 0) { fprintf(stderr, "ERROR: failed to convert command line parameters to UTF-8\n"); return 1; } #endif srand((unsigned)time(0)); setlocale(LC_ALL, ""); if(!init_options()) { flac__utils_printf(stderr, 1, "ERROR: allocating memory\n"); retval = 1; } else { if((retval = parse_options(argc, argv)) == 0) retval = do_it(); } free_options(); return retval; } int do_it(void) { int retval = 0; if(option_values.show_version) { show_version(); return 0; } else if(option_values.show_explain) { show_explain(); return 0; } else if(option_values.show_help) { show_help(); return 0; } else { if(option_values.num_files == 0) { if(flac__utils_verbosity_ >= 1) short_usage(); return 0; } /* * tweak options; validate the values */ if(!option_values.mode_decode) { if(0 != option_values.cue_specification) return usage_error("ERROR: --cue is not allowed in test mode\n"); } else { if(option_values.test_only) { if(0 != option_values.skip_specification) return usage_error("ERROR: --skip is not allowed in test mode\n"); if(0 != option_values.until_specification) return usage_error("ERROR: --until is not allowed in test mode\n"); if(0 != option_values.cue_specification) return usage_error("ERROR: --cue is not allowed in test mode\n"); if(0 != option_values.analyze) return usage_error("ERROR: analysis mode (-a/--analyze) and test mode (-t/--test) cannot be used together\n"); } } if(0 != option_values.cue_specification && (0 != option_values.skip_specification || 0 != option_values.until_specification)) return usage_error("ERROR: --cue may not be combined with --skip or --until\n"); if(option_values.format_channels >= 0) { if(option_values.format_channels == 0 || (unsigned)option_values.format_channels > FLAC__MAX_CHANNELS) return usage_error("ERROR: invalid number of channels '%u', must be > 0 and <= %u\n", option_values.format_channels, FLAC__MAX_CHANNELS); } if(option_values.format_bps >= 0) { if(option_values.format_bps != 8 && option_values.format_bps != 16 && option_values.format_bps != 24) return usage_error("ERROR: invalid bits per sample '%u' (must be 8/16/24)\n", option_values.format_bps); } if(option_values.format_sample_rate >= 0) { if(!FLAC__format_sample_rate_is_valid(option_values.format_sample_rate)) return usage_error("ERROR: invalid sample rate '%u', must be > 0 and <= %u\n", option_values.format_sample_rate, FLAC__MAX_SAMPLE_RATE); } if((option_values.force_raw_format?1:0) + (option_values.force_aiff_format?1:0) + (option_values.force_rf64_format?1:0) + (option_values.force_wave64_format?1:0) > 1) return usage_error("ERROR: only one of --force-raw-format/--force-aiff-format/--force-rf64-format/--force-wave64-format allowed\n"); if(option_values.mode_decode) { if(!option_values.force_raw_format) { if(option_values.format_is_big_endian >= 0) return usage_error("ERROR: --endian only allowed with --force-raw-format\n"); if(option_values.format_is_unsigned_samples >= 0) return usage_error("ERROR: --sign only allowed with --force-raw-format\n"); } if(option_values.format_channels >= 0) return usage_error("ERROR: --channels not allowed with --decode\n"); if(option_values.format_bps >= 0) return usage_error("ERROR: --bps not allowed with --decode\n"); if(option_values.format_sample_rate >= 0) return usage_error("ERROR: --sample-rate not allowed with --decode\n"); } if(option_values.ignore_chunk_sizes) { if(option_values.mode_decode) return usage_error("ERROR: --ignore-chunk-sizes only allowed for encoding\n"); if(0 != option_values.sector_align) return usage_error("ERROR: --ignore-chunk-sizes not allowed with --sector-align\n"); if(0 != option_values.until_specification) return usage_error("ERROR: --ignore-chunk-sizes not allowed with --until\n"); if(0 != option_values.cue_specification) return usage_error("ERROR: --ignore-chunk-sizes not allowed with --cue\n"); if(0 != option_values.cuesheet_filename) return usage_error("ERROR: --ignore-chunk-sizes not allowed with --cuesheet\n"); } if(option_values.sector_align) { if(option_values.mode_decode) return usage_error("ERROR: --sector-align only allowed for encoding\n"); if(0 != option_values.skip_specification) return usage_error("ERROR: --sector-align not allowed with --skip\n"); if(0 != option_values.until_specification) return usage_error("ERROR: --sector-align not allowed with --until\n"); if(0 != option_values.cue_specification) return usage_error("ERROR: --sector-align not allowed with --cue\n"); if(option_values.format_channels >= 0 && option_values.format_channels != 2) return usage_error("ERROR: --sector-align can only be done with stereo input\n"); if(option_values.format_bps >= 0 && option_values.format_bps != 16) return usage_error("ERROR: --sector-align can only be done with 16-bit samples\n"); if(option_values.format_sample_rate >= 0 && option_values.format_sample_rate != 44100) return usage_error("ERROR: --sector-align can only be done with a sample rate of 44100\n"); } if(option_values.replay_gain) { if(option_values.force_to_stdout) return usage_error("ERROR: --replay-gain not allowed with -c/--stdout\n"); if(option_values.mode_decode) return usage_error("ERROR: --replay-gain only allowed for encoding\n"); if(option_values.format_channels > 2) return usage_error("ERROR: --replay-gain can only be done with mono/stereo input\n"); if(option_values.format_sample_rate >= 0 && !grabbag__replaygain_is_valid_sample_frequency(option_values.format_sample_rate)) return usage_error("ERROR: invalid sample rate used with --replay-gain\n"); /* * We want to reserve padding space for the ReplayGain * tags that we will set later, to avoid rewriting the * whole file. */ if( (option_values.padding >= 0 && option_values.padding < (int)GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED) || (option_values.padding < 0 && FLAC_ENCODE__DEFAULT_PADDING < (int)GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED) ) { flac__utils_printf(stderr, 1, "NOTE: --replay-gain may leave a small PADDING block even with --no-padding\n"); option_values.padding = GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED; } else { option_values.padding += GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED; } } if(option_values.num_files > 1 && option_values.cmdline_forced_outfilename) { return usage_error("ERROR: -o/--output-name cannot be used with multiple files\n"); } if(option_values.cmdline_forced_outfilename && option_values.output_prefix) { return usage_error("ERROR: --output-prefix conflicts with -o/--output-name\n"); } if(!option_values.mode_decode && 0 != option_values.cuesheet_filename && option_values.num_files > 1) { return usage_error("ERROR: --cuesheet cannot be used when encoding multiple files\n"); } if(option_values.keep_foreign_metadata) { /* we're not going to try and support the re-creation of broken WAVE files */ if(option_values.ignore_chunk_sizes) return usage_error("ERROR: using --keep-foreign-metadata cannot be used with --ignore-chunk-sizes\n"); if(option_values.test_only) return usage_error("ERROR: --keep-foreign-metadata is not allowed in test mode\n"); if(option_values.analyze) return usage_error("ERROR: --keep-foreign-metadata is not allowed in analyis mode\n"); flac__utils_printf(stderr, 1, "NOTE: --keep-foreign-metadata is a new feature; make sure to test the output file before deleting the original.\n"); } } flac__utils_printf(stderr, 2, "\n"); flac__utils_printf(stderr, 2, "flac %s, Copyright (C) 2000-2009, 2011-2013 Josh Coalson & Xiph.Org Foundation\n", FLAC__VERSION_STRING); flac__utils_printf(stderr, 2, "flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are\n"); flac__utils_printf(stderr, 2, "welcome to redistribute it under certain conditions. Type `flac' for details.\n\n"); if(option_values.mode_decode) { FLAC__bool first = true; if(option_values.num_files == 0) { retval = decode_file("-"); } else { unsigned i; if(option_values.num_files > 1) option_values.cmdline_forced_outfilename = 0; for(i = 0, retval = 0; i < option_values.num_files; i++) { if(0 == strcmp(option_values.filenames[i], "-") && !first) continue; retval |= decode_file(option_values.filenames[i]); first = false; } } } else { /* encode */ FLAC__bool first = true; if(option_values.ignore_chunk_sizes) flac__utils_printf(stderr, 1, "INFO: Make sure you know what you're doing when using --ignore-chunk-sizes.\n Improper use can cause flac to encode non-audio data as audio.\n"); if(option_values.num_files == 0) { retval = encode_file("-", first, true); } else { unsigned i; if(option_values.num_files > 1) option_values.cmdline_forced_outfilename = 0; for(i = 0, retval = 0; i < option_values.num_files; i++) { if(0 == strcmp(option_values.filenames[i], "-") && !first) continue; retval |= encode_file(option_values.filenames[i], first, i == (option_values.num_files-1)); first = false; } if(option_values.replay_gain && retval == 0) { float album_gain, album_peak; grabbag__replaygain_get_album(&album_gain, &album_peak); for(i = 0; i < option_values.num_files; i++) { const char *error, *outfilename = get_encoded_outfilename(option_values.filenames[i]); if(0 == outfilename) { flac__utils_printf(stderr, 1, "ERROR: filename too long: %s", option_values.filenames[i]); return 1; } if(0 != (error = grabbag__replaygain_store_to_file_album(outfilename, album_gain, album_peak, option_values.preserve_modtime))) { flac__utils_printf(stderr, 1, "%s: ERROR writing ReplayGain album tags (%s)\n", outfilename, error); retval = 1; } } } } } return retval; } FLAC__bool init_options(void) { option_values.show_help = false; option_values.show_explain = false; option_values.mode_decode = false; option_values.verify = false; option_values.treat_warnings_as_errors = false; option_values.force_file_overwrite = false; option_values.continue_through_decode_errors = false; option_values.replaygain_synthesis_spec.apply = false; option_values.replaygain_synthesis_spec.use_album_gain = true; option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__HARD; option_values.replaygain_synthesis_spec.noise_shaping = NOISE_SHAPING_LOW; option_values.replaygain_synthesis_spec.preamp = 0.0; option_values.lax = false; option_values.test_only = false; option_values.analyze = false; option_values.use_ogg = false; option_values.has_serial_number = false; option_values.serial_number = 0; option_values.force_to_stdout = false; option_values.force_raw_format = false; option_values.force_aiff_format = false; option_values.force_rf64_format = false; option_values.force_wave64_format = false; option_values.delete_input = false; option_values.preserve_modtime = true; option_values.keep_foreign_metadata = false; option_values.replay_gain = false; option_values.ignore_chunk_sizes = false; option_values.sector_align = false; option_values.utf8_convert = true; option_values.cmdline_forced_outfilename = 0; option_values.output_prefix = 0; option_values.aopts.do_residual_text = false; option_values.aopts.do_residual_gnuplot = false; option_values.padding = -1; option_values.num_compression_settings = 1; option_values.compression_settings[0].type = CST_COMPRESSION_LEVEL; option_values.compression_settings[0].value.t_unsigned = 5; option_values.skip_specification = 0; option_values.until_specification = 0; option_values.cue_specification = 0; option_values.format_is_big_endian = -1; option_values.format_is_unsigned_samples = -1; option_values.format_channels = -1; option_values.format_bps = -1; option_values.format_sample_rate = -1; option_values.format_input_size = (FLAC__off_t)(-1); option_values.requested_seek_points[0] = '\0'; option_values.num_requested_seek_points = -1; option_values.cuesheet_filename = 0; option_values.cued_seekpoints = true; option_values.channel_map_none = false; option_values.num_files = 0; option_values.filenames = 0; if(0 == (option_values.vorbis_comment = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT))) return false; option_values.num_pictures = 0; option_values.debug.disable_constant_subframes = false; option_values.debug.disable_fixed_subframes = false; option_values.debug.disable_verbatim_subframes = false; option_values.debug.do_md5 = true; return true; } int parse_options(int argc, char *argv[]) { int short_option; int option_index = 1; FLAC__bool had_error = false; const char *short_opts = "0123456789aA:b:cdefFhHl:mMo:pP:q:r:sS:tT:vVw"; while ((short_option = share__getopt_long(argc, argv, short_opts, long_options_, &option_index)) != -1) { switch (short_option) { case 0: /* long option with no equivalent short option */ had_error |= (parse_option(short_option, long_options_[option_index].name, share__optarg) != 0); break; case '?': case ':': had_error = true; break; default: /* short option */ had_error |= (parse_option(short_option, 0, share__optarg) != 0); break; } } if(had_error) { return 1; } FLAC__ASSERT(share__optind <= argc); option_values.num_files = argc - share__optind; if(option_values.num_files > 0) { unsigned i = 0; if(0 == (option_values.filenames = malloc(sizeof(char*) * option_values.num_files))) die("out of memory allocating space for file names list"); while(share__optind < argc) option_values.filenames[i++] = local_strdup(argv[share__optind++]); } return 0; } int parse_option(int short_option, const char *long_option, const char *option_argument) { const char *violation; if(short_option == 0) { FLAC__ASSERT(0 != long_option); if(0 == strcmp(long_option, "totally-silent")) { flac__utils_verbosity_ = 0; } else if(0 == strcmp(long_option, "delete-input-file")) { option_values.delete_input = true; } else if(0 == strcmp(long_option, "preserve-modtime")) { option_values.preserve_modtime = true; } else if(0 == strcmp(long_option, "keep-foreign-metadata")) { option_values.keep_foreign_metadata = true; } else if(0 == strcmp(long_option, "output-prefix")) { FLAC__ASSERT(0 != option_argument); option_values.output_prefix = option_argument; } else if(0 == strcmp(long_option, "skip")) { FLAC__ASSERT(0 != option_argument); option_values.skip_specification = option_argument; } else if(0 == strcmp(long_option, "until")) { FLAC__ASSERT(0 != option_argument); option_values.until_specification = option_argument; } else if(0 == strcmp(long_option, "input-size")) { FLAC__ASSERT(0 != option_argument); { char *end; FLAC__int64 ix; ix = strtoll(option_argument, &end, 10); if(0 == strlen(option_argument) || *end) return usage_error("ERROR: --%s must be a number\n", long_option); option_values.format_input_size = (FLAC__off_t)ix; if(option_values.format_input_size != ix) /* check if FLAC__off_t is smaller than long long */ return usage_error("ERROR: --%s too large; this build of flac does not support filesizes over 2GB\n", long_option); if(option_values.format_input_size <= 0) return usage_error("ERROR: --%s must be > 0\n", long_option); } } else if(0 == strcmp(long_option, "cue")) { FLAC__ASSERT(0 != option_argument); option_values.cue_specification = option_argument; } else if(0 == strcmp(long_option, "apply-replaygain-which-is-not-lossless")) { option_values.replaygain_synthesis_spec.apply = true; if (0 != option_argument) { char *p; option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__NONE; option_values.replaygain_synthesis_spec.noise_shaping = NOISE_SHAPING_NONE; option_values.replaygain_synthesis_spec.preamp = strtod(option_argument, &p); for ( ; *p; p++) { if (*p == 'a') option_values.replaygain_synthesis_spec.use_album_gain = true; else if (*p == 't') option_values.replaygain_synthesis_spec.use_album_gain = false; else if (*p == 'l') option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__PEAK; else if (*p == 'L') option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__HARD; else if (*p == 'n' && p[1] >= '0' && p[1] <= '3') { option_values.replaygain_synthesis_spec.noise_shaping = p[1] - '0'; p++; } else return usage_error("ERROR: bad specification string \"%s\" for --%s\n", option_argument, long_option); } } } else if(0 == strcmp(long_option, "channel-map")) { if (0 == option_argument || strcmp(option_argument, "none")) return usage_error("ERROR: only --channel-map=none currently supported\n"); option_values.channel_map_none = true; } else if(0 == strcmp(long_option, "cuesheet")) { FLAC__ASSERT(0 != option_argument); option_values.cuesheet_filename = option_argument; } else if(0 == strcmp(long_option, "picture")) { const unsigned max_pictures = sizeof(option_values.pictures)/sizeof(option_values.pictures[0]); FLAC__ASSERT(0 != option_argument); if(option_values.num_pictures >= max_pictures) return usage_error("ERROR: too many --picture arguments, only %u allowed\n", max_pictures); if(0 == (option_values.pictures[option_values.num_pictures] = grabbag__picture_parse_specification(option_argument, &violation))) return usage_error("ERROR: (--picture) %s\n", violation); option_values.num_pictures++; } else if(0 == strcmp(long_option, "tag-from-file")) { FLAC__ASSERT(0 != option_argument); if(!flac__vorbiscomment_add(option_values.vorbis_comment, option_argument, /*value_from_file=*/true, /*raw=*/!option_values.utf8_convert, &violation)) return usage_error("ERROR: (--tag-from-file) %s\n", violation); } else if(0 == strcmp(long_option, "no-cued-seekpoints")) { option_values.cued_seekpoints = false; } else if(0 == strcmp(long_option, "force-raw-format")) { option_values.force_raw_format = true; } else if(0 == strcmp(long_option, "force-aiff-format")) { option_values.force_aiff_format = true; } else if(0 == strcmp(long_option, "force-rf64-format")) { option_values.force_rf64_format = true; } else if(0 == strcmp(long_option, "force-wave64-format")) { option_values.force_wave64_format = true; } else if(0 == strcmp(long_option, "lax")) { option_values.lax = true; } else if(0 == strcmp(long_option, "replay-gain")) { option_values.replay_gain = true; } else if(0 == strcmp(long_option, "ignore-chunk-sizes")) { option_values.ignore_chunk_sizes = true; } else if(0 == strcmp(long_option, "sector-align")) { flac__utils_printf(stderr, 1, "WARNING: --sector-align is DEPRECATED and may not exist in future versions of flac.\n"); flac__utils_printf(stderr, 1, " shntool provides similar functionality\n"); option_values.sector_align = true; } #if FLAC__HAS_OGG else if(0 == strcmp(long_option, "ogg")) { option_values.use_ogg = true; } else if(0 == strcmp(long_option, "serial-number")) { option_values.has_serial_number = true; option_values.serial_number = atol(option_argument); } #endif else if(0 == strcmp(long_option, "endian")) { FLAC__ASSERT(0 != option_argument); if(0 == strncmp(option_argument, "big", strlen(option_argument))) option_values.format_is_big_endian = true; else if(0 == strncmp(option_argument, "little", strlen(option_argument))) option_values.format_is_big_endian = false; else return usage_error("ERROR: argument to --endian must be \"big\" or \"little\"\n"); } else if(0 == strcmp(long_option, "channels")) { FLAC__ASSERT(0 != option_argument); option_values.format_channels = atoi(option_argument); } else if(0 == strcmp(long_option, "bps")) { FLAC__ASSERT(0 != option_argument); option_values.format_bps = atoi(option_argument); } else if(0 == strcmp(long_option, "sample-rate")) { FLAC__ASSERT(0 != option_argument); option_values.format_sample_rate = atoi(option_argument); } else if(0 == strcmp(long_option, "sign")) { FLAC__ASSERT(0 != option_argument); if(0 == strncmp(option_argument, "signed", strlen(option_argument))) option_values.format_is_unsigned_samples = false; else if(0 == strncmp(option_argument, "unsigned", strlen(option_argument))) option_values.format_is_unsigned_samples = true; else return usage_error("ERROR: argument to --sign must be \"signed\" or \"unsigned\"\n"); } else if(0 == strcmp(long_option, "residual-gnuplot")) { option_values.aopts.do_residual_gnuplot = true; } else if(0 == strcmp(long_option, "residual-text")) { option_values.aopts.do_residual_text = true; } /* * negatives */ else if(0 == strcmp(long_option, "no-preserve-modtime")) { option_values.preserve_modtime = false; } else if(0 == strcmp(long_option, "no-decode-through-errors")) { option_values.continue_through_decode_errors = false; } else if(0 == strcmp(long_option, "no-silent")) { flac__utils_verbosity_ = 2; } else if(0 == strcmp(long_option, "no-force")) { option_values.force_file_overwrite = false; } else if(0 == strcmp(long_option, "no-seektable")) { option_values.num_requested_seek_points = 0; option_values.requested_seek_points[0] = '\0'; } else if(0 == strcmp(long_option, "no-delete-input-file")) { option_values.delete_input = false; } else if(0 == strcmp(long_option, "no-keep-foreign-metadata")) { option_values.keep_foreign_metadata = false; } else if(0 == strcmp(long_option, "no-replay-gain")) { option_values.replay_gain = false; } else if(0 == strcmp(long_option, "no-ignore-chunk-sizes")) { option_values.ignore_chunk_sizes = false; } else if(0 == strcmp(long_option, "no-sector-align")) { option_values.sector_align = false; } else if(0 == strcmp(long_option, "no-utf8-convert")) { option_values.utf8_convert = false; } else if(0 == strcmp(long_option, "no-lax")) { option_values.lax = false; } #if FLAC__HAS_OGG else if(0 == strcmp(long_option, "no-ogg")) { option_values.use_ogg = false; } #endif else if(0 == strcmp(long_option, "no-exhaustive-model-search")) { add_compression_setting_bool(CST_DO_EXHAUSTIVE_MODEL_SEARCH, false); } else if(0 == strcmp(long_option, "no-mid-side")) { add_compression_setting_bool(CST_DO_MID_SIDE, false); add_compression_setting_bool(CST_LOOSE_MID_SIDE, false); } else if(0 == strcmp(long_option, "no-adaptive-mid-side")) { add_compression_setting_bool(CST_DO_MID_SIDE, false); add_compression_setting_bool(CST_LOOSE_MID_SIDE, false); } else if(0 == strcmp(long_option, "no-qlp-coeff-prec-search")) { add_compression_setting_bool(CST_DO_QLP_COEFF_PREC_SEARCH, false); } else if(0 == strcmp(long_option, "no-padding")) { option_values.padding = 0; } else if(0 == strcmp(long_option, "no-verify")) { option_values.verify = false; } else if(0 == strcmp(long_option, "no-warnings-as-errors")) { option_values.treat_warnings_as_errors = false; } else if(0 == strcmp(long_option, "no-residual-gnuplot")) { option_values.aopts.do_residual_gnuplot = false; } else if(0 == strcmp(long_option, "no-residual-text")) { option_values.aopts.do_residual_text = false; } else if(0 == strcmp(long_option, "disable-constant-subframes")) { option_values.debug.disable_constant_subframes = true; } else if(0 == strcmp(long_option, "disable-fixed-subframes")) { option_values.debug.disable_fixed_subframes = true; } else if(0 == strcmp(long_option, "disable-verbatim-subframes")) { option_values.debug.disable_verbatim_subframes = true; } else if(0 == strcmp(long_option, "no-md5-sum")) { option_values.debug.do_md5 = false; } } else { switch(short_option) { case 'h': option_values.show_help = true; break; case 'H': option_values.show_explain = true; break; case 'v': option_values.show_version = true; break; case 'd': option_values.mode_decode = true; break; case 'a': option_values.mode_decode = true; option_values.analyze = true; break; case 't': option_values.mode_decode = true; option_values.test_only = true; break; case 'c': option_values.force_to_stdout = true; break; case 's': flac__utils_verbosity_ = 1; break; case 'f': option_values.force_file_overwrite = true; break; case 'o': FLAC__ASSERT(0 != option_argument); option_values.cmdline_forced_outfilename = option_argument; break; case 'F': option_values.continue_through_decode_errors = true; break; case 'T': FLAC__ASSERT(0 != option_argument); if(!flac__vorbiscomment_add(option_values.vorbis_comment, option_argument, /*value_from_file=*/false, /*raw=*/!option_values.utf8_convert, &violation)) return usage_error("ERROR: (-T/--tag) %s\n", violation); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': add_compression_setting_unsigned(CST_COMPRESSION_LEVEL, short_option-'0'); break; case '9': return usage_error("ERROR: compression level '9' is reserved\n"); case 'V': option_values.verify = true; break; case 'w': option_values.treat_warnings_as_errors = true; break; case 'S': FLAC__ASSERT(0 != option_argument); if(0 == strcmp(option_argument, "-")) { option_values.num_requested_seek_points = 0; option_values.requested_seek_points[0] = '\0'; } else { if(option_values.num_requested_seek_points < 0) option_values.num_requested_seek_points = 0; option_values.num_requested_seek_points++; if(strlen(option_values.requested_seek_points)+strlen(option_argument)+2 >= sizeof(option_values.requested_seek_points)) { return usage_error("ERROR: too many seekpoints requested\n"); } else { size_t len = strlen(option_values.requested_seek_points); flac_snprintf(option_values.requested_seek_points+len, sizeof(option_values.requested_seek_points) - len, "%s;", option_argument); } } break; case 'P': FLAC__ASSERT(0 != option_argument); option_values.padding = atoi(option_argument); if(option_values.padding < 0) return usage_error("ERROR: argument to -%c must be >= 0; for no padding use -%c-\n", short_option, short_option); break; case 'b': { unsigned i ; FLAC__ASSERT(0 != option_argument); i = atoi(option_argument); if((i < (int)FLAC__MIN_BLOCK_SIZE || i > (int)FLAC__MAX_BLOCK_SIZE)) return usage_error("ERROR: invalid blocksize (-%c) '%d', must be >= %u and <= %u\n", short_option, i, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE); add_compression_setting_unsigned(CST_BLOCKSIZE, (unsigned)i); } break; case 'e': add_compression_setting_bool(CST_DO_EXHAUSTIVE_MODEL_SEARCH, true); break; case 'E': add_compression_setting_bool(CST_DO_ESCAPE_CODING, true); break; case 'l': { unsigned i ; FLAC__ASSERT(0 != option_argument); i = atoi(option_argument); if(i > FLAC__MAX_LPC_ORDER) return usage_error("ERROR: invalid LPC order (-%c) '%d', must be >= %u and <= %u\n", short_option, i, 0, FLAC__MAX_LPC_ORDER); add_compression_setting_unsigned(CST_MAX_LPC_ORDER, i); } break; case 'A': FLAC__ASSERT(0 != option_argument); add_compression_setting_string(CST_APODIZATION, option_argument); break; case 'm': add_compression_setting_bool(CST_DO_MID_SIDE, true); add_compression_setting_bool(CST_LOOSE_MID_SIDE, false); break; case 'M': add_compression_setting_bool(CST_DO_MID_SIDE, true); add_compression_setting_bool(CST_LOOSE_MID_SIDE, true); break; case 'p': add_compression_setting_bool(CST_DO_QLP_COEFF_PREC_SEARCH, true); break; case 'q': { unsigned i ; FLAC__ASSERT(0 != option_argument); i = atoi(option_argument); if((i > 0 && (i < FLAC__MIN_QLP_COEFF_PRECISION || i > FLAC__MAX_QLP_COEFF_PRECISION))) return usage_error("ERROR: invalid value '%d' for qlp coeff precision (-%c), must be 0 or between %u and %u, inclusive\n", i, short_option, FLAC__MIN_QLP_COEFF_PRECISION, FLAC__MAX_QLP_COEFF_PRECISION); add_compression_setting_unsigned(CST_QLP_COEFF_PRECISION, i); } break; case 'r': { unsigned i; char * p; FLAC__ASSERT(0 != option_argument); p = strchr(option_argument, ','); if(0 == p) { add_compression_setting_unsigned(CST_MIN_RESIDUAL_PARTITION_ORDER, 0); i = atoi(option_argument); if(i > FLAC__MAX_RICE_PARTITION_ORDER) return usage_error("ERROR: invalid value '%d' for residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); add_compression_setting_unsigned(CST_MAX_RESIDUAL_PARTITION_ORDER, i); } else { i = atoi(option_argument); if(i > FLAC__MAX_RICE_PARTITION_ORDER) return usage_error("ERROR: invalid value '%d' for min residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); add_compression_setting_unsigned(CST_MIN_RESIDUAL_PARTITION_ORDER, i); i = atoi(++p); if(i > FLAC__MAX_RICE_PARTITION_ORDER) return usage_error("ERROR: invalid value '%d' for max residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); add_compression_setting_unsigned(CST_MAX_RESIDUAL_PARTITION_ORDER, i); } } break; case 'R': { unsigned i; i = atoi(option_argument); add_compression_setting_unsigned(CST_RICE_PARAMETER_SEARCH_DIST, i); } break; default: FLAC__ASSERT(0); } } return 0; } void free_options(void) { unsigned i; if(0 != option_values.filenames) { for(i = 0; i < option_values.num_files; i++) { if(0 != option_values.filenames[i]) free(option_values.filenames[i]); } free(option_values.filenames); } if(0 != option_values.vorbis_comment) FLAC__metadata_object_delete(option_values.vorbis_comment); for(i = 0; i < option_values.num_pictures; i++) FLAC__metadata_object_delete(option_values.pictures[i]); } void add_compression_setting_bool(compression_setting_type_t type, FLAC__bool value) { if(option_values.num_compression_settings >= sizeof(option_values.compression_settings)/sizeof(option_values.compression_settings[0])) die("too many compression settings"); option_values.compression_settings[option_values.num_compression_settings].type = type; option_values.compression_settings[option_values.num_compression_settings].value.t_bool = value; option_values.num_compression_settings++; } void add_compression_setting_string(compression_setting_type_t type, const char *value) { if(option_values.num_compression_settings >= sizeof(option_values.compression_settings)/sizeof(option_values.compression_settings[0])) die("too many compression settings"); option_values.compression_settings[option_values.num_compression_settings].type = type; option_values.compression_settings[option_values.num_compression_settings].value.t_string = value; option_values.num_compression_settings++; } void add_compression_setting_unsigned(compression_setting_type_t type, unsigned value) { if(option_values.num_compression_settings >= sizeof(option_values.compression_settings)/sizeof(option_values.compression_settings[0])) die("too many compression settings"); option_values.compression_settings[option_values.num_compression_settings].type = type; option_values.compression_settings[option_values.num_compression_settings].value.t_unsigned = value; option_values.num_compression_settings++; } int usage_error(const char *message, ...) { if(flac__utils_verbosity_ >= 1) { va_list args; FLAC__ASSERT(0 != message); va_start(args, message); (void) vfprintf(stderr, message, args); va_end(args); printf("Type \"flac\" for a usage summary or \"flac --help\" for all options\n"); } return 1; } void show_version(void) { printf("flac %s\n", FLAC__VERSION_STRING); } static void usage_header(void) { printf("===============================================================================\n"); printf("flac - Command-line FLAC encoder/decoder version %s\n", FLAC__VERSION_STRING); printf("Copyright (C) 2000-2009 Josh Coalson\n"); printf("Copyright (C) 2011-2013 Xiph.Org Foundation\n"); printf("\n"); printf("This program is free software; you can redistribute it and/or\n"); printf("modify it under the terms of the GNU General Public License\n"); printf("as published by the Free Software Foundation; either version 2\n"); printf("of the License, or (at your option) any later version.\n"); printf("\n"); printf("This program is distributed in the hope that it will be useful,\n"); printf("but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); printf("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); printf("GNU General Public License for more details.\n"); printf("\n"); printf("You should have received a copy of the GNU General Public License along\n"); printf("with this program; if not, write to the Free Software Foundation, Inc.,\n"); printf("51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n"); printf("===============================================================================\n"); } static void usage_summary(void) { printf("Usage:\n"); printf("\n"); printf(" Encoding: flac [] [] [INPUTFILE [...]]\n"); printf(" Decoding: flac -d [] [] [FLACFILE [...]]\n"); printf(" Testing: flac -t [] [FLACFILE [...]]\n"); printf("Analyzing: flac -a [] [] [FLACFILE [...]]\n"); printf("\n"); printf("Be sure to read the list of known bugs at:\n"); printf("http://flac.sourceforge.net/documentation_bugs.html\n"); printf("\n"); } void short_usage(void) { usage_header(); printf("\n"); printf("This is the short help; for all options use 'flac --help'; for even more\n"); printf("instructions use 'flac --explain'\n"); printf("\n"); printf("Be sure to read the list of known bugs at:\n"); printf("http://flac.sourceforge.net/documentation_bugs.html\n"); printf("\n"); printf("To encode:\n"); printf(" flac [-#] [INPUTFILE [...]]\n"); printf("\n"); printf(" -# is -0 (fastest compression) to -8 (highest compression); -5 is the default\n"); printf("\n"); printf("To decode:\n"); printf(" flac -d [INPUTFILE [...]]\n"); printf("\n"); printf("To test:\n"); printf(" flac -t [INPUTFILE [...]]\n"); } void show_help(void) { usage_header(); usage_summary(); printf("general options:\n"); printf(" -v, --version Show the flac version number\n"); printf(" -h, --help Show this screen\n"); printf(" -H, --explain Show detailed explanation of usage and options\n"); printf(" -d, --decode Decode (the default behavior is to encode)\n"); printf(" -t, --test Same as -d except no decoded file is written\n"); printf(" -a, --analyze Same as -d except an analysis file is written\n"); printf(" -c, --stdout Write output to stdout\n"); printf(" -s, --silent Do not write runtime encode/decode statistics\n"); printf(" --totally-silent Do not print anything, including errors\n"); printf(" --no-utf8-convert Do not convert tags from local charset to UTF-8\n"); printf(" -w, --warnings-as-errors Treat all warnings as errors\n"); printf(" -f, --force Force overwriting of output files\n"); printf(" -o, --output-name=FILENAME Force the output file name\n"); printf(" --output-prefix=STRING Prepend STRING to output names\n"); printf(" --delete-input-file Deletes after a successful encode/decode\n"); printf(" --preserve-modtime Output files keep timestamp of input (default)\n"); printf(" --keep-foreign-metadata Save/restore WAVE or AIFF non-audio chunks\n"); printf(" --skip={#|mm:ss.ss} Skip the given initial samples for each input\n"); printf(" --until={#|[+|-]mm:ss.ss} Stop at the given sample for each input file\n"); #if FLAC__HAS_OGG printf(" --ogg Use Ogg as transport layer\n"); printf(" --serial-number Serial number to use for the FLAC stream\n"); #endif printf("analysis options:\n"); printf(" --residual-text Include residual signal in text output\n"); printf(" --residual-gnuplot Generate gnuplot files of residual distribution\n"); printf("decoding options:\n"); printf(" -F, --decode-through-errors Continue decoding through stream errors\n"); printf(" --cue=[#.#][-[#.#]] Set the beginning and ending cuepoints to decode\n"); printf("encoding options:\n"); printf(" -V, --verify Verify a correct encoding\n"); printf(" --lax Allow encoder to generate non-Subset files\n"); printf(" --ignore-chunk-sizes Ignore data chunk sizes in WAVE/AIFF files\n"); printf(" --sector-align (DEPRECATED) Align multiple files on sector boundaries\n"); printf(" --replay-gain Calculate ReplayGain & store in FLAC tags\n"); printf(" --cuesheet=FILENAME Import cuesheet and store in CUESHEET block\n"); printf(" --picture=SPECIFICATION Import picture and store in PICTURE block\n"); printf(" -T, --tag=FIELD=VALUE Add a FLAC tag; may appear multiple times\n"); printf(" --tag-from-file=FIELD=FILENAME Like --tag but gets value from file\n"); printf(" -S, --seekpoint={#|X|#x|#s} Add seek point(s)\n"); printf(" -P, --padding=# Write a PADDING block of length #\n"); printf(" -0, --compression-level-0, --fast Synonymous with -l 0 -b 1152 -r 3\n"); printf(" -1, --compression-level-1 Synonymous with -l 0 -b 1152 -M -r 3\n"); printf(" -2, --compression-level-2 Synonymous with -l 0 -b 1152 -m -r 3\n"); printf(" -3, --compression-level-3 Synonymous with -l 6 -b 4096 -r 4\n"); printf(" -4, --compression-level-4 Synonymous with -l 8 -b 4096 -M -r 4\n"); printf(" -5, --compression-level-5 Synonymous with -l 8 -b 4096 -m -r 5\n"); printf(" -6, --compression-level-6 Synonymous with -l 8 -b 4096 -m -r 6\n"); printf(" -7, --compression-level-7 Synonymous with -l 8 -b 4096 -m -e -r 6\n"); printf(" -8, --compression-level-8, --best Synonymous with -l 12 -b 4096 -m -e -r 6\n"); printf(" -b, --blocksize=# Specify blocksize in samples\n"); printf(" -m, --mid-side Try mid-side coding for each frame\n"); printf(" -M, --adaptive-mid-side Adaptive mid-side coding for all frames\n"); printf(" -e, --exhaustive-model-search Do exhaustive model search (expensive!)\n"); printf(" -A, --apodization=\"function\" Window audio data with given the function\n"); printf(" -l, --max-lpc-order=# Max LPC order; 0 => only fixed predictors\n"); printf(" -p, --qlp-coeff-precision-search Exhaustively search LP coeff quantization\n"); printf(" -q, --qlp-coeff-precision=# Specify precision in bits\n"); printf(" -r, --rice-partition-order=[#,]# Set [min,]max residual partition order\n"); printf("format options:\n"); printf(" --endian={big|little} Set byte order for samples\n"); printf(" --channels=# Number of channels\n"); printf(" --bps=# Number of bits per sample\n"); printf(" --sample-rate=# Sample rate in Hz\n"); printf(" --sign={signed|unsigned} Sign of samples\n"); printf(" --input-size=# Size of the raw input in bytes\n"); printf(" --force-raw-format Treat input or output as raw samples\n"); printf(" --force-aiff-format Force decoding to AIFF format\n"); printf(" --force-rf64-format Force decoding to RF64 format\n"); printf(" --force-wave64-format Force decoding to Wave64 format\n"); printf("negative options:\n"); printf(" --no-adaptive-mid-side\n"); printf(" --no-cued-seekpoints\n"); printf(" --no-decode-through-errors\n"); printf(" --no-delete-input-file\n"); printf(" --no-preserve-modtime\n"); printf(" --no-keep-foreign-metadata\n"); printf(" --no-exhaustive-model-search\n"); printf(" --no-lax\n"); printf(" --no-mid-side\n"); #if FLAC__HAS_OGG printf(" --no-ogg\n"); #endif printf(" --no-padding\n"); printf(" --no-qlp-coeff-prec-search\n"); printf(" --no-replay-gain\n"); printf(" --no-residual-gnuplot\n"); printf(" --no-residual-text\n"); printf(" --no-ignore-chunk-sizes\n"); printf(" --no-sector-align\n"); printf(" --no-seektable\n"); printf(" --no-silent\n"); printf(" --no-force\n"); printf(" --no-verify\n"); printf(" --no-warnings-as-errors\n"); } void show_explain(void) { usage_header(); usage_summary(); printf("For encoding:\n"); printf(" The input file(s) may be a PCM WAVE or RF64 file, AIFF (or uncompressed\n"); printf(" AIFF-C) file, or raw samples.\n"); printf(" The output file(s) will be in native FLAC or Ogg FLAC format\n"); printf("For decoding, the reverse is true.\n"); printf("\n"); printf("A single INPUTFILE may be - for stdin. No INPUTFILE implies stdin. Use of\n"); printf("stdin implies -c (write to stdout). Normally you should use:\n"); printf(" flac [options] -o outfilename or flac -d [options] -o outfilename\n"); printf("instead of:\n"); printf(" flac [options] > outfilename or flac -d [options] > outfilename\n"); printf("since the former allows flac to seek backwards to write the STREAMINFO or\n"); printf("WAVE/AIFF header contents when necessary.\n"); printf("\n"); printf("flac checks for the presence of a AIFF/WAVE header to decide whether or not to\n"); printf("treat an input file as AIFF/WAVE format or raw samples. If any input file is\n"); printf("raw you must specify the format options {-fb|fl} -fc -fp and -fs, which will\n"); printf("apply to all raw files. You can force AIFF/WAVE files to be treated as raw\n"); printf("files using -fr.\n"); printf("\n"); printf("general options:\n"); printf(" -v, --version Show the flac version number\n"); printf(" -h, --help Show basic usage a list of all options\n"); printf(" -H, --explain Show this screen\n"); printf(" -d, --decode Decode (the default behavior is to encode)\n"); printf(" -t, --test Same as -d except no decoded file is written\n"); printf(" -a, --analyze Same as -d except an analysis file is written\n"); printf(" -c, --stdout Write output to stdout\n"); printf(" -s, --silent Do not write runtime encode/decode statistics\n"); printf(" --totally-silent Do not print anything of any kind, including\n"); printf(" warnings or errors. The exit code will be the\n"); printf(" only way to determine successful completion.\n"); printf(" --no-utf8-convert Do not convert tags from local charset to UTF-8.\n"); printf(" This is useful for scripts, and setting tags in\n"); printf(" situations where the locale is wrong. This\n"); printf(" option must appear before any tag options!\n"); printf(" -w, --warnings-as-errors Treat all warnings as errors\n"); printf(" -f, --force Force overwriting of output files\n"); printf(" -o, --output-name=FILENAME Force the output file name; usually flac just\n"); printf(" changes the extension. May only be used when\n"); printf(" encoding a single file. May not be used in\n"); printf(" conjunction with --output-prefix.\n"); printf(" --output-prefix=STRING Prefix each output file name with the given\n"); printf(" STRING. This can be useful for encoding or\n"); printf(" decoding files to a different directory. Make\n"); printf(" sure if your STRING is a path name that it ends\n"); printf(" with a '/' slash.\n"); printf(" --delete-input-file Automatically delete the input file after a\n"); printf(" successful encode or decode. If there was an\n"); printf(" error (including a verify error) the input file\n"); printf(" is left intact.\n"); printf(" --preserve-modtime Output files have their timestamps/permissions\n"); printf(" set to match those of their inputs (this is\n"); printf(" default). Use --no-preserve-modtime to make\n"); printf(" output files have the current time and default\n"); printf(" permissions.\n"); printf(" --keep-foreign-metadata If encoding, save WAVE or AIFF non-audio chunks\n"); printf(" in FLAC metadata. If decoding, restore any saved\n"); printf(" non-audio chunks from FLAC metadata when writing\n"); printf(" the decoded file. Foreign metadata cannot be\n"); printf(" transcoded, e.g. WAVE chunks saved in a FLAC file\n"); printf(" cannot be restored when decoding to AIFF. Input\n"); printf(" and output must be regular files, not stdin/out.\n"); printf(" --skip={#|mm:ss.ss} Skip the first # samples of each input file; can\n"); printf(" be used both for encoding and decoding. The\n"); printf(" alternative form mm:ss.ss can be used to specify\n"); printf(" minutes, seconds, and fractions of a second.\n"); printf(" --until={#|[+|-]mm:ss.ss} Stop at the given sample number for each input\n"); printf(" file. The given sample number is not included\n"); printf(" in the decoded output. The alternative form\n"); printf(" mm:ss.ss can be used to specify minutes,\n"); printf(" seconds, and fractions of a second. If a `+'\n"); printf(" sign is at the beginning, the --until point is\n"); printf(" relative to the --skip point. If a `-' sign is\n"); printf(" at the beginning, the --until point is relative\n"); printf(" to end of the audio.\n"); #if FLAC__HAS_OGG printf(" --ogg When encoding, generate Ogg FLAC output instead\n"); printf(" of native FLAC. Ogg FLAC streams are FLAC\n"); printf(" streams wrapped in an Ogg transport layer. The\n"); printf(" resulting file should have an '.oga' extension\n"); printf(" and will still be decodable by flac. When\n"); printf(" decoding, force the input to be treated as\n"); printf(" Ogg FLAC. This is useful when piping input\n"); printf(" from stdin or when the filename does not end in\n"); printf(" '.oga' or '.ogg'.\n"); printf(" --serial-number Serial number to use for the FLAC stream. When\n"); printf(" encoding and no serial number is given, flac\n"); printf(" uses a random one. If encoding to multiple files\n"); printf(" the serial number is incremented for each file.\n"); printf(" When decoding and no number is given, flac uses\n"); printf(" the serial number of the first page.\n"); #endif printf("analysis options:\n"); printf(" --residual-text Include residual signal in text output. This\n"); printf(" will make the file very big, much larger than\n"); printf(" even the decoded file.\n"); printf(" --residual-gnuplot Generate gnuplot files of residual distribution\n"); printf(" of each subframe\n"); printf("decoding options:\n"); printf(" -F, --decode-through-errors By default flac stops decoding with an error\n"); printf(" and removes the partially decoded file if it\n"); printf(" encounters a bitstream error. With -F, errors\n"); printf(" are still printed but flac will continue\n"); printf(" decoding to completion. Note that errors may\n"); printf(" cause the decoded audio to be missing some\n"); printf(" samples or have silent sections.\n"); printf(" --cue=[#.#][-[#.#]] Set the beginning and ending cuepoints to\n"); printf(" decode. The optional first #.# is the track and\n"); printf(" index point at which decoding will start; the\n"); printf(" default is the beginning of the stream. The\n"); printf(" optional second #.# is the track and index point\n"); printf(" at which decoding will end; the default is the\n"); printf(" end of the stream. If the cuepoint does not\n"); printf(" exist, the closest one before it (for the start\n"); printf(" point) or after it (for the end point) will be\n"); printf(" used. The cuepoints are merely translated into\n"); printf(" sample numbers then used as --skip and --until.\n"); printf(" A CD track can always be cued by, for example,\n"); printf(" --cue=9.1-10.1 for track 9, even if the CD has\n"); printf(" no 10th track.\n"); printf("encoding options:\n"); printf(" -V, --verify Verify a correct encoding by decoding the\n"); printf(" output in parallel and comparing to the\n"); printf(" original\n"); printf(" --lax Allow encoder to generate non-Subset files\n"); #if 0 /*@@@ currently undocumented */ printf(" --ignore-chunk-sizes Ignore data chunk sizes in WAVE/AIFF files;\n"); printf(" useful when piping data from programs which\n"); printf(" generate bogus data chunk sizes.\n"); #endif printf(" --sector-align Align encoding of multiple CD format WAVE files\n"); printf(" on sector boundaries. This option is DEPRECATED\n"); printf(" and may not exist in future versions of flac.\n"); printf(" shntool offers similar functionality.\n"); printf(" --replay-gain Calculate ReplayGain values and store them as\n"); printf(" FLAC tags. Title gains/peaks will be computed\n"); printf(" for each file, and an album gain/peak will be\n"); printf(" computed for all files. All input files must\n"); printf(" have the same resolution, sample rate, and\n"); printf(" number of channels. The sample rate must be\n"); printf(" one of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1,\n"); printf(" or 48 kHz. NOTE: this option may also leave a\n"); printf(" few extra bytes in the PADDING block.\n"); printf(" --cuesheet=FILENAME Import the given cuesheet file and store it in\n"); printf(" a CUESHEET metadata block. This option may only\n"); printf(" be used when encoding a single file. A\n"); printf(" seekpoint will be added for each index point in\n"); printf(" the cuesheet to the SEEKTABLE unless\n"); printf(" --no-cued-seekpoints is specified.\n"); printf(" --picture=SPECIFICATION Import a picture and store it in a PICTURE block.\n"); printf(" More than one --picture command can be specified.\n"); printf(" The SPECIFICATION can either be a simple filename\n"); printf(" for the picture file, or a complete specification\n"); printf(" whose parts are separated by | characters. Some\n"); printf(" parts may be left empty to invoke default values.\n"); printf(" Using a filename is shorthand for \"||||FILE\".\n"); printf(" The SPECIFICATION format is:\n"); printf(" [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE\n"); printf(" TYPE is optional; it is a number from one of:\n"); printf(" 0: Other\n"); printf(" 1: 32x32 pixels 'file icon' (PNG only)\n"); printf(" 2: Other file icon\n"); printf(" 3: Cover (front)\n"); printf(" 4: Cover (back)\n"); printf(" 5: Leaflet page\n"); printf(" 6: Media (e.g. label side of CD)\n"); printf(" 7: Lead artist/lead performer/soloist\n"); printf(" 8: Artist/performer\n"); printf(" 9: Conductor\n"); printf(" 10: Band/Orchestra\n"); printf(" 11: Composer\n"); printf(" 12: Lyricist/text writer\n"); printf(" 13: Recording Location\n"); printf(" 14: During recording\n"); printf(" 15: During performance\n"); printf(" 16: Movie/video screen capture\n"); printf(" 17: A bright coloured fish\n"); printf(" 18: Illustration\n"); printf(" 19: Band/artist logotype\n"); printf(" 20: Publisher/Studio logotype\n"); printf(" The default is 3 (front cover). There may only be one picture each\n"); printf(" of type 1 and 2 in a file.\n"); printf(" MIME-TYPE is optional; if left blank, it will be detected from the\n"); printf(" file. For best compatibility with players, use pictures with MIME\n"); printf(" type image/jpeg or image/png. The MIME type can also be --> to\n"); printf(" mean that FILE is actually a URL to an image, though this use is\n"); printf(" discouraged.\n"); printf(" DESCRIPTION is optional; the default is an empty string\n"); printf(" The next part specfies the resolution and color information. If\n"); printf(" the MIME-TYPE is image/jpeg, image/png, or image/gif, you can\n"); printf(" usually leave this empty and they can be detected from the file.\n"); printf(" Otherwise, you must specify the width in pixels, height in pixels,\n"); printf(" and color depth in bits-per-pixel. If the image has indexed colors\n"); printf(" you should also specify the number of colors used.\n"); printf(" FILE is the path to the picture file to be imported, or the URL if\n"); printf(" MIME type is -->\n"); printf(" -T, --tag=FIELD=VALUE Add a FLAC tag. Make sure to quote the\n"); printf(" comment if necessary. This option may appear\n"); printf(" more than once to add several comments. NOTE:\n"); printf(" all tags will be added to all encoded files.\n"); printf(" --tag-from-file=FIELD=FILENAME Like --tag, except FILENAME is a file\n"); printf(" whose contents will be read verbatim to set the\n"); printf(" tag value. The contents will be converted to\n"); printf(" UTF-8 from the local charset. This can be used\n"); printf(" to store a cuesheet in a tag (e.g.\n"); printf(" --tag-from-file=\"CUESHEET=image.cue\"). Do not\n"); printf(" try to store binary data in tag fields! Use\n"); printf(" APPLICATION blocks for that.\n"); printf(" -S, --seekpoint={#|X|#x|#s} Include a point or points in a SEEKTABLE\n"); printf(" # : a specific sample number for a seek point\n"); printf(" X : a placeholder point (always goes at the end of the SEEKTABLE)\n"); printf(" #x : # evenly spaced seekpoints, the first being at sample 0\n"); printf(" #s : a seekpoint every # seconds; # does not have to be a whole number\n"); printf(" You may use many -S options; the resulting SEEKTABLE will be the unique-\n"); printf(" ified union of all such values.\n"); printf(" With no -S options, flac defaults to '-S 10s'. Use -S- for no SEEKTABLE.\n"); printf(" Note: -S #x and -S #s will not work if the encoder can't determine the\n"); printf(" input size before starting.\n"); printf(" Note: if you use -S # and # is >= samples in the input, there will be\n"); printf(" either no seek point entered (if the input size is determinable\n"); printf(" before encoding starts) or a placeholder point (if input size is not\n"); printf(" determinable)\n"); printf(" -P, --padding=# Tell the encoder to write a PADDING metadata\n"); printf(" block of the given length (in bytes) after the\n"); printf(" STREAMINFO block. This is useful if you plan\n"); printf(" to tag the file later with an APPLICATION\n"); printf(" block; instead of having to rewrite the entire\n"); printf(" file later just to insert your block, you can\n"); printf(" write directly over the PADDING block. Note\n"); printf(" that the total length of the PADDING block will\n"); printf(" be 4 bytes longer than the length given because\n"); printf(" of the 4 metadata block header bytes. You can\n"); printf(" force no PADDING block at all to be written with\n"); printf(" --no-padding. The encoder writes a PADDING\n"); printf(" block of 8192 bytes by default, or 65536 bytes\n"); printf(" if the input audio is more than 20 minutes long.\n"); printf(" -b, --blocksize=# Specify the blocksize in samples; the default is\n"); printf(" 1152 for -l 0, else 4096; must be one of 192,\n"); printf(" 576, 1152, 2304, 4608, 256, 512, 1024, 2048,\n"); printf(" 4096 (and 8192 or 16384 if the sample rate is\n"); printf(" >48kHz) for Subset streams.\n"); printf(" -0, --compression-level-0, --fast Synonymous with -l 0 -b 1152 -r 3\n"); printf(" -1, --compression-level-1 Synonymous with -l 0 -b 1152 -M -r 3\n"); printf(" -2, --compression-level-2 Synonymous with -l 0 -b 1152 -m -r 3\n"); printf(" -3, --compression-level-3 Synonymous with -l 6 -b 4096 -r 4\n"); printf(" -4, --compression-level-4 Synonymous with -l 8 -b 4096 -M -r 4\n"); printf(" -5, --compression-level-5 Synonymous with -l 8 -b 4096 -m -r 5\n"); printf(" -5 is the default setting\n"); printf(" -6, --compression-level-6 Synonymous with -l 8 -b 4096 -m -r 6\n"); printf(" -7, --compression-level-7 Synonymous with -l 8 -b 4096 -m -e -r 6\n"); printf(" -8, --compression-level-8, --best Synonymous with -l 12 -b 4096 -m -e -r 6\n"); printf(" -m, --mid-side Try mid-side coding for each frame\n"); printf(" (stereo only)\n"); printf(" -M, --adaptive-mid-side Adaptive mid-side coding for all frames\n"); printf(" (stereo only)\n"); printf(" -e, --exhaustive-model-search Do exhaustive model search (expensive!)\n"); printf(" -A, --apodization=\"function\" Window audio data with given the function.\n"); printf(" The functions are: bartlett, bartlett_hann,\n"); printf(" blackman, blackman_harris_4term_92db,\n"); printf(" connes, flattop, gauss(STDDEV), hamming,\n"); printf(" hann, kaiser_bessel, nuttall, rectangle,\n"); printf(" triangle, tukey(P), welch. More than one\n"); printf(" may be specified but encoding time is a\n"); printf(" multiple of the number of functions since\n"); printf(" they are each tried in turn. The encoder\n"); printf(" chooses suitable defaults in the absence\n"); printf(" of any -A options.\n"); printf(" -l, --max-lpc-order=# Max LPC order; 0 => only fixed predictors.\n"); printf(" Must be <= 12 for Subset streams if sample\n"); printf(" rate is <=48kHz.\n"); printf(" -p, --qlp-coeff-precision-search Do exhaustive search of LP coefficient\n"); printf(" quantization (expensive!); overrides -q;\n"); printf(" does nothing if using -l 0\n"); printf(" -q, --qlp-coeff-precision=# Specify precision in bits of quantized\n"); printf(" linear-predictor coefficients; 0 => let\n"); printf(" encoder decide (the minimun is %u, the\n", FLAC__MIN_QLP_COEFF_PRECISION); printf(" default is -q 0)\n"); printf(" -r, --rice-partition-order=[#,]# Set [min,]max residual partition order\n"); printf(" (# is 0..16; min defaults to 0; the\n"); printf(" default is -r 0; above 4 doesn't usually\n"); printf(" help much)\n"); printf("format options:\n"); printf(" --endian={big|little} Set byte order for samples\n"); printf(" --channels=# Number of channels\n"); printf(" --bps=# Number of bits per sample\n"); printf(" --sample-rate=# Sample rate in Hz\n"); printf(" --sign={signed|unsigned} Sign of samples (the default is signed)\n"); printf(" --input-size=# Size of the raw input in bytes. If you are\n"); printf(" encoding raw samples from stdin, you must set\n"); printf(" this option in order to be able to use --skip,\n"); printf(" --until, --cuesheet, or other options that need\n"); printf(" to know the size of the input beforehand. If\n"); printf(" the size given is greater than what is found in\n"); printf(" the input stream, the encoder will complain\n"); printf(" about an unexpected end-of-file. If the size\n"); printf(" given is less, samples will be truncated.\n"); printf(" --force-raw-format Force input (when encoding) or output (when\n"); printf(" decoding) to be treated as raw samples\n"); printf(" --force-aiff-format Force the decoder to output AIFF format. This\n"); printf(" option is not needed if the output filename (as\n"); printf(" set by -o) ends with .aif or .aiff; this option\n"); printf(" has no effect when encoding since input AIFF is\n"); printf(" auto-detected.\n"); printf(" --force-rf64-format Force the decoder to output RF64 format. This\n"); printf(" option is not needed if the output filename (as\n"); printf(" set by -o) ends with .rf64; this option\n"); printf(" has no effect when encoding since input RF64 is\n"); printf(" auto-detected.\n"); printf(" --force-wave64-format Force the decoder to output Wave64 format. This\n"); printf(" option is not needed if the output filename (as\n"); printf(" set by -o) ends with .w64; this option\n"); printf(" has no effect when encoding since input Wave64 is\n"); printf(" auto-detected.\n"); printf("negative options:\n"); printf(" --no-adaptive-mid-side\n"); printf(" --no-cued-seekpoints\n"); printf(" --no-decode-through-errors\n"); printf(" --no-delete-input-file\n"); printf(" --no-preserve-modtime\n"); printf(" --no-keep-foreign-metadata\n"); printf(" --no-exhaustive-model-search\n"); printf(" --no-lax\n"); printf(" --no-mid-side\n"); #if FLAC__HAS_OGG printf(" --no-ogg\n"); #endif printf(" --no-padding\n"); printf(" --no-qlp-coeff-prec-search\n"); printf(" --no-residual-gnuplot\n"); printf(" --no-residual-text\n"); #if 0 /*@@@ currently undocumented */ printf(" --no-ignore-chunk-sizes\n"); #endif printf(" --no-sector-align\n"); printf(" --no-seektable\n"); printf(" --no-silent\n"); printf(" --no-force\n"); printf(" --no-verify\n"); printf(" --no-warnings-as-errors\n"); } void format_mistake(const char *infilename, FileFormat wrong, FileFormat right) { /* WATCHOUT: indexed by FileFormat */ static const char * const ff[] = { " raw", " WAVE", "n RF64", "n AIFF", "n AIFF-C", " FLAC", "n Ogg FLAC" }; flac__utils_printf(stderr, 1, "WARNING: %s is not a%s file; treating as a%s file\n", infilename, ff[wrong], ff[right]); } int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_last_file) { FILE *encode_infile; FLAC__byte lookahead[12]; unsigned lookahead_length = 0; FileFormat input_format = FORMAT_RAW; int retval; FLAC__off_t infilesize; encode_options_t encode_options; const char *outfilename = get_encoded_outfilename(infilename); /* the final name of the encoded file */ /* internal_outfilename is the file we will actually write to; it will be a temporary name if infilename==outfilename */ char *internal_outfilename = 0; /* NULL implies 'use outfilename' */ if(0 == outfilename) { flac__utils_printf(stderr, 1, "ERROR: filename too long: %s", infilename); return 1; } if(0 == strcmp(infilename, "-")) { infilesize = (FLAC__off_t)(-1); encode_infile = grabbag__file_get_binary_stdin(); } else { infilesize = grabbag__file_get_filesize(infilename); if(0 == (encode_infile = flac_fopen(infilename, "rb"))) { flac__utils_printf(stderr, 1, "ERROR: can't open input file %s: %s\n", infilename, strerror(errno)); return 1; } } if(!option_values.force_raw_format) { /* first set format based on name */ if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".wav")) input_format = FORMAT_WAVE; else if(strlen(infilename) >= 5 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-5), ".rf64")) input_format = FORMAT_RF64; else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".w64")) input_format = FORMAT_WAVE64; else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".aif")) input_format = FORMAT_AIFF; else if(strlen(infilename) >= 5 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-5), ".aiff")) input_format = FORMAT_AIFF; else if(strlen(infilename) >= 5 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-5), ".flac")) input_format = FORMAT_FLAC; else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".oga")) input_format = FORMAT_OGGFLAC; else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".ogg")) input_format = FORMAT_OGGFLAC; /* attempt to guess the file type based on the first 12 bytes */ if((lookahead_length = fread(lookahead, 1, 12, encode_infile)) < 12) { /* all supported non-raw formats have at least 12 bytes of header to read */ if(input_format != FORMAT_RAW) { format_mistake(infilename, input_format, FORMAT_RAW); if(option_values.treat_warnings_as_errors) { conditional_fclose(encode_infile); return 1; } } /* force to raw */ input_format = FORMAT_RAW; } else { if(!memcmp(lookahead, "ID3", 3)) { flac__utils_printf(stderr, 1, "ERROR: input file %s has an ID3v2 tag\n", infilename); conditional_fclose(encode_infile); return 1; } else if(!memcmp(lookahead, "RIFF", 4) && !memcmp(lookahead+8, "WAVE", 4)) input_format = FORMAT_WAVE; else if(!memcmp(lookahead, "RF64", 4) && !memcmp(lookahead+8, "WAVE", 4)) input_format = FORMAT_RF64; else if(!memcmp(lookahead, "riff\x2E\x91\xCF\x11\xA5\xD6\x28\xDB", 12)) /* just check 1st 12 bytes of GUID */ input_format = FORMAT_WAVE64; else if(!memcmp(lookahead, "FORM", 4) && !memcmp(lookahead+8, "AIFF", 4)) input_format = FORMAT_AIFF; else if(!memcmp(lookahead, "FORM", 4) && !memcmp(lookahead+8, "AIFC", 4)) input_format = FORMAT_AIFF_C; else if(!memcmp(lookahead, FLAC__STREAM_SYNC_STRING, sizeof(FLAC__STREAM_SYNC_STRING))) input_format = FORMAT_FLAC; /*@@@ this could be made more accurate by looking at the first packet to make sure it's Ogg FLAC and not, say, Ogg Vorbis. we do catch such problems later though. */ else if(!memcmp(lookahead, "OggS", 4)) input_format = FORMAT_OGGFLAC; else { /* didn't find header of any supported format */ if(input_format != FORMAT_RAW) { format_mistake(infilename, input_format, FORMAT_RAW); if(option_values.treat_warnings_as_errors) { conditional_fclose(encode_infile); return 1; } } /* force to raw */ input_format = FORMAT_RAW; } } } if(option_values.keep_foreign_metadata) { if(encode_infile == stdin || option_values.force_to_stdout) { conditional_fclose(encode_infile); return usage_error("ERROR: --keep-foreign-metadata cannot be used when encoding from stdin or to stdout\n"); } if(input_format != FORMAT_WAVE && input_format != FORMAT_WAVE64 && input_format != FORMAT_RF64 && input_format != FORMAT_AIFF && input_format != FORMAT_AIFF_C) { conditional_fclose(encode_infile); return usage_error("ERROR: --keep-foreign-metadata can only be used with WAVE, Wave64, RF64, or AIFF input\n"); } } /* * Error if output file already exists (and -f not used). * Use grabbag__file_get_filesize() as a cheap way to check. */ if(!option_values.test_only && !option_values.force_file_overwrite && strcmp(outfilename, "-") && grabbag__file_get_filesize(outfilename) != (FLAC__off_t)(-1)) { if(input_format == FORMAT_FLAC) { /* need more detailed error message when re-flac'ing to avoid confusing the user */ flac__utils_printf(stderr, 1, "ERROR: output file %s already exists.\n\n" "By default flac encodes files to FLAC format; if you meant to decode this file\n" "from FLAC to something else, use -d. If you meant to re-encode this file from\n" "FLAC to FLAC again, use -f to force writing to the same file, or -o to specify\n" "a different output filename.\n", outfilename ); } else if(input_format == FORMAT_OGGFLAC) { /* need more detailed error message when re-flac'ing to avoid confusing the user */ flac__utils_printf(stderr, 1, "ERROR: output file %s already exists.\n\n" "By default 'flac -ogg' encodes files to Ogg FLAC format; if you meant to decode\n" "this file from Ogg FLAC to something else, use -d. If you meant to re-encode\n" "this file from Ogg FLAC to Ogg FLAC again, use -f to force writing to the same\n" "file, or -o to specify a different output filename.\n", outfilename ); } else flac__utils_printf(stderr, 1, "ERROR: output file %s already exists, use -f to override\n", outfilename); conditional_fclose(encode_infile); return 1; } if(option_values.format_input_size >= 0) { if (input_format != FORMAT_RAW || infilesize >= 0) { flac__utils_printf(stderr, 1, "ERROR: can only use --input-size when encoding raw samples from stdin\n"); conditional_fclose(encode_infile); return 1; } else { infilesize = option_values.format_input_size; } } if(option_values.sector_align && (input_format == FORMAT_FLAC || input_format == FORMAT_OGGFLAC)) { flac__utils_printf(stderr, 1, "ERROR: can't use --sector-align when the input file is FLAC or Ogg FLAC\n"); conditional_fclose(encode_infile); return 1; } if(option_values.sector_align && input_format == FORMAT_RAW && infilesize < 0) { flac__utils_printf(stderr, 1, "ERROR: can't use --sector-align when the input size is unknown\n"); conditional_fclose(encode_infile); return 1; } if(input_format == FORMAT_RAW) { if(option_values.format_is_big_endian < 0 || option_values.format_is_unsigned_samples < 0 || option_values.format_channels < 0 || option_values.format_bps < 0 || option_values.format_sample_rate < 0) { conditional_fclose(encode_infile); return usage_error("ERROR: for encoding a raw file you must specify a value for --endian, --sign, --channels, --bps, and --sample-rate\n"); } } if(option_values.force_to_stdout) { if(option_values.replay_gain) { conditional_fclose(encode_infile); return usage_error("ERROR: --replay-gain cannot be used when encoding to stdout\n"); } } if(option_values.replay_gain && option_values.use_ogg) { conditional_fclose(encode_infile); return usage_error("ERROR: --replay-gain cannot be used when encoding to Ogg FLAC yet\n"); } if(!flac__utils_parse_skip_until_specification(option_values.skip_specification, &encode_options.skip_specification) || encode_options.skip_specification.is_relative) { conditional_fclose(encode_infile); return usage_error("ERROR: invalid value for --skip\n"); } if(!flac__utils_parse_skip_until_specification(option_values.until_specification, &encode_options.until_specification)) { /*@@@@ more checks: no + without --skip, no - unless known total_samples_to_{en,de}code */ conditional_fclose(encode_infile); return usage_error("ERROR: invalid value for --until\n"); } /* if there is no "--until" we want to default to "--until=-0" */ if(0 == option_values.until_specification) encode_options.until_specification.is_relative = true; encode_options.verify = option_values.verify; encode_options.treat_warnings_as_errors = option_values.treat_warnings_as_errors; #if FLAC__HAS_OGG encode_options.use_ogg = option_values.use_ogg; /* set a random serial number if one has not yet been specified */ if(!option_values.has_serial_number) { option_values.serial_number = rand(); option_values.has_serial_number = true; } encode_options.serial_number = option_values.serial_number++; #endif encode_options.lax = option_values.lax; encode_options.padding = option_values.padding; encode_options.num_compression_settings = option_values.num_compression_settings; FLAC__ASSERT(sizeof(encode_options.compression_settings) >= sizeof(option_values.compression_settings)); memcpy(encode_options.compression_settings, option_values.compression_settings, sizeof(option_values.compression_settings)); encode_options.requested_seek_points = option_values.requested_seek_points; encode_options.num_requested_seek_points = option_values.num_requested_seek_points; encode_options.cuesheet_filename = option_values.cuesheet_filename; encode_options.continue_through_decode_errors = option_values.continue_through_decode_errors; encode_options.cued_seekpoints = option_values.cued_seekpoints; encode_options.channel_map_none = option_values.channel_map_none; encode_options.is_first_file = is_first_file; encode_options.is_last_file = is_last_file; encode_options.align_reservoir = align_reservoir; encode_options.align_reservoir_samples = &align_reservoir_samples; encode_options.replay_gain = option_values.replay_gain; encode_options.ignore_chunk_sizes = option_values.ignore_chunk_sizes; encode_options.sector_align = option_values.sector_align; encode_options.vorbis_comment = option_values.vorbis_comment; FLAC__ASSERT(sizeof(encode_options.pictures) >= sizeof(option_values.pictures)); memcpy(encode_options.pictures, option_values.pictures, sizeof(option_values.pictures)); encode_options.num_pictures = option_values.num_pictures; encode_options.format = input_format; encode_options.debug.disable_constant_subframes = option_values.debug.disable_constant_subframes; encode_options.debug.disable_fixed_subframes = option_values.debug.disable_fixed_subframes; encode_options.debug.disable_verbatim_subframes = option_values.debug.disable_verbatim_subframes; encode_options.debug.do_md5 = option_values.debug.do_md5; /* if infilename and outfilename point to the same file, we need to write to a temporary file */ if(encode_infile != stdin && grabbag__file_are_same(infilename, outfilename)) { static const char *tmp_suffix = ".tmp,fl-ac+en'c"; size_t dest_len = strlen(outfilename) + strlen(tmp_suffix) + 1; /*@@@@ still a remote possibility that a file with this filename exists */ if(0 == (internal_outfilename = safe_malloc_(dest_len))) { flac__utils_printf(stderr, 1, "ERROR allocating memory for tempfile name\n"); conditional_fclose(encode_infile); return 1; } safe_strncpy(internal_outfilename, outfilename, dest_len); safe_strncat(internal_outfilename, tmp_suffix, dest_len); } if(input_format == FORMAT_RAW) { encode_options.format_options.raw.is_big_endian = option_values.format_is_big_endian; encode_options.format_options.raw.is_unsigned_samples = option_values.format_is_unsigned_samples; encode_options.format_options.raw.channels = option_values.format_channels; encode_options.format_options.raw.bps = option_values.format_bps; encode_options.format_options.raw.sample_rate = option_values.format_sample_rate; retval = flac__encode_file(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, encode_options); } else if(input_format == FORMAT_FLAC || input_format == FORMAT_OGGFLAC) { retval = flac__encode_file(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, encode_options); } else if(input_format == FORMAT_WAVE || input_format == FORMAT_WAVE64 || input_format == FORMAT_RF64 || input_format == FORMAT_AIFF || input_format == FORMAT_AIFF_C) { encode_options.format_options.iff.foreign_metadata = 0; /* initialize foreign metadata if requested */ if(option_values.keep_foreign_metadata) { encode_options.format_options.iff.foreign_metadata = flac__foreign_metadata_new( input_format==FORMAT_WAVE || input_format==FORMAT_RF64? FOREIGN_BLOCK_TYPE__RIFF : input_format==FORMAT_WAVE64? FOREIGN_BLOCK_TYPE__WAVE64 : FOREIGN_BLOCK_TYPE__AIFF ); if(0 == encode_options.format_options.iff.foreign_metadata) { flac__utils_printf(stderr, 1, "ERROR: creating foreign metadata object\n"); conditional_fclose(encode_infile); if(internal_outfilename != 0) free(internal_outfilename); return 1; } } retval = flac__encode_file(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, encode_options); if(encode_options.format_options.iff.foreign_metadata) flac__foreign_metadata_delete(encode_options.format_options.iff.foreign_metadata); } else { FLAC__ASSERT(0); retval = 1; /* double protection */ } if(retval == 0) { if(strcmp(outfilename, "-")) { if(option_values.replay_gain) { float title_gain, title_peak; const char *error; grabbag__replaygain_get_title(&title_gain, &title_peak); if( 0 != (error = grabbag__replaygain_store_to_file_reference(internal_outfilename? internal_outfilename : outfilename, option_values.preserve_modtime)) || 0 != (error = grabbag__replaygain_store_to_file_title(internal_outfilename? internal_outfilename : outfilename, title_gain, title_peak, option_values.preserve_modtime)) ) { flac__utils_printf(stderr, 1, "%s: ERROR writing ReplayGain reference/title tags (%s)\n", outfilename, error); retval = 1; } } if(option_values.preserve_modtime && strcmp(infilename, "-")) grabbag__file_copy_metadata(infilename, internal_outfilename? internal_outfilename : outfilename); } } /* rename temporary file if necessary */ if(retval == 0 && internal_outfilename != 0) { if(flac_rename(internal_outfilename, outfilename) < 0) { #if defined _MSC_VER || defined __MINGW32__ || defined __EMX__ /* on some flavors of windows, flac_rename() will fail if the destination already exists, so we unlink and try again */ if(flac_unlink(outfilename) < 0) { flac__utils_printf(stderr, 1, "ERROR: moving new FLAC file %s back on top of original FLAC file %s, keeping both\n", internal_outfilename, outfilename); retval = 1; } else if(flac_rename(internal_outfilename, outfilename) < 0) { flac__utils_printf(stderr, 1, "ERROR: moving new FLAC file %s back on top of original FLAC file %s, you must do it\n", internal_outfilename, outfilename); retval = 1; } #else flac__utils_printf(stderr, 1, "ERROR: moving new FLAC file %s back on top of original FLAC file %s, keeping both\n", internal_outfilename, outfilename); retval = 1; #endif } } /* handle --delete-input-file, but don't want to delete if piping from stdin, or if input filename and output filename are the same */ if(retval == 0 && option_values.delete_input && strcmp(infilename, "-") && internal_outfilename == 0) flac_unlink(infilename); if(internal_outfilename != 0) free(internal_outfilename); return retval; } int decode_file(const char *infilename) { int retval; FLAC__bool treat_as_ogg = false; FileFormat output_format = FORMAT_WAVE; decode_options_t decode_options; const char *outfilename = get_decoded_outfilename(infilename); if(0 == outfilename) { flac__utils_printf(stderr, 1, "ERROR: filename too long: %s", infilename); return 1; } /* * Error if output file already exists (and -f not used). * Use grabbag__file_get_filesize() as a cheap way to check. */ if(!option_values.test_only && !option_values.force_file_overwrite && strcmp(outfilename, "-") && grabbag__file_get_filesize(outfilename) != (FLAC__off_t)(-1)) { flac__utils_printf(stderr, 1, "ERROR: output file %s already exists, use -f to override\n", outfilename); return 1; } if(option_values.force_raw_format) output_format = FORMAT_RAW; else if( option_values.force_aiff_format || (strlen(outfilename) >= 4 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-4), ".aif")) || (strlen(outfilename) >= 5 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-5), ".aiff")) ) output_format = FORMAT_AIFF; else if( option_values.force_rf64_format || (strlen(outfilename) >= 5 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-5), ".rf64")) ) output_format = FORMAT_RF64; else if( option_values.force_wave64_format || (strlen(outfilename) >= 4 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-4), ".w64")) ) output_format = FORMAT_WAVE64; else output_format = FORMAT_WAVE; if(!option_values.test_only && !option_values.analyze) { if(output_format == FORMAT_RAW && (option_values.format_is_big_endian < 0 || option_values.format_is_unsigned_samples < 0)) return usage_error("ERROR: for decoding to a raw file you must specify a value for --endian and --sign\n"); } if(option_values.keep_foreign_metadata) { if(0 == strcmp(infilename, "-") || 0 == strcmp(outfilename, "-")) return usage_error("ERROR: --keep-foreign-metadata cannot be used when decoding from stdin or to stdout\n"); if(output_format != FORMAT_WAVE && output_format != FORMAT_WAVE64 && output_format != FORMAT_RF64 && output_format != FORMAT_AIFF && output_format != FORMAT_AIFF_C) return usage_error("ERROR: --keep-foreign-metadata can only be used with WAVE, Wave64, RF64, or AIFF output\n"); } if(option_values.use_ogg) treat_as_ogg = true; else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".oga")) treat_as_ogg = true; else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".ogg")) treat_as_ogg = true; else treat_as_ogg = false; #if !FLAC__HAS_OGG if(treat_as_ogg) { flac__utils_printf(stderr, 1, "%s: Ogg support has not been built into this copy of flac\n", infilename); return 1; } #endif if(!flac__utils_parse_skip_until_specification(option_values.skip_specification, &decode_options.skip_specification) || decode_options.skip_specification.is_relative) return usage_error("ERROR: invalid value for --skip\n"); if(!flac__utils_parse_skip_until_specification(option_values.until_specification, &decode_options.until_specification)) /*@@@ more checks: no + without --skip, no - unless known total_samples_to_{en,de}code */ return usage_error("ERROR: invalid value for --until\n"); /* if there is no "--until" we want to default to "--until=-0" */ if(0 == option_values.until_specification) decode_options.until_specification.is_relative = true; if(option_values.cue_specification) { if(!flac__utils_parse_cue_specification(option_values.cue_specification, &decode_options.cue_specification)) return usage_error("ERROR: invalid value for --cue\n"); decode_options.has_cue_specification = true; } else decode_options.has_cue_specification = false; decode_options.treat_warnings_as_errors = option_values.treat_warnings_as_errors; decode_options.continue_through_decode_errors = option_values.continue_through_decode_errors; decode_options.replaygain_synthesis_spec = option_values.replaygain_synthesis_spec; #if FLAC__HAS_OGG decode_options.is_ogg = treat_as_ogg; decode_options.use_first_serial_number = !option_values.has_serial_number; decode_options.serial_number = option_values.serial_number; #endif decode_options.channel_map_none = option_values.channel_map_none; decode_options.format = output_format; if(output_format == FORMAT_RAW) { decode_options.format_options.raw.is_big_endian = option_values.format_is_big_endian; decode_options.format_options.raw.is_unsigned_samples = option_values.format_is_unsigned_samples; retval = flac__decode_file(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, decode_options); } else { decode_options.format_options.iff.foreign_metadata = 0; /* initialize foreign metadata if requested */ if(option_values.keep_foreign_metadata) { decode_options.format_options.iff.foreign_metadata = flac__foreign_metadata_new( output_format==FORMAT_WAVE || output_format==FORMAT_RF64? FOREIGN_BLOCK_TYPE__RIFF : output_format==FORMAT_WAVE64? FOREIGN_BLOCK_TYPE__WAVE64 : FOREIGN_BLOCK_TYPE__AIFF ); if(0 == decode_options.format_options.iff.foreign_metadata) { flac__utils_printf(stderr, 1, "ERROR: creating foreign metadata object\n"); return 1; } } retval = flac__decode_file(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, decode_options); if(decode_options.format_options.iff.foreign_metadata) flac__foreign_metadata_delete(decode_options.format_options.iff.foreign_metadata); } if(retval == 0 && strcmp(infilename, "-")) { if(option_values.preserve_modtime && strcmp(outfilename, "-")) grabbag__file_copy_metadata(infilename, outfilename); if(option_values.delete_input && !option_values.test_only && !option_values.analyze) flac_unlink(infilename); } return retval; } const char *get_encoded_outfilename(const char *infilename) { const char *suffix = (option_values.use_ogg? ".oga" : ".flac"); return get_outfilename(infilename, suffix); } const char *get_decoded_outfilename(const char *infilename) { const char *suffix; if(option_values.analyze) { suffix = ".ana"; } else if(option_values.force_raw_format) { suffix = ".raw"; } else if(option_values.force_aiff_format) { suffix = ".aiff"; } else if(option_values.force_rf64_format) { suffix = ".rf64"; } else if(option_values.force_wave64_format) { suffix = ".w64"; } else { suffix = ".wav"; } return get_outfilename(infilename, suffix); } const char *get_outfilename(const char *infilename, const char *suffix) { if(0 == option_values.cmdline_forced_outfilename) { static char buffer[4096]; /* @@@ bad MAGIC NUMBER */ if(0 == strcmp(infilename, "-") || option_values.force_to_stdout) { safe_strncpy(buffer, "-", sizeof(buffer)); } else { char *p; if (flac__strlcpy(buffer, option_values.output_prefix? option_values.output_prefix : "", sizeof buffer) >= sizeof buffer) return 0; if (flac__strlcat(buffer, infilename, sizeof buffer) >= sizeof buffer) return 0; /* the . must come after any / to avoid problems with, e.g. "some.directory/extensionless-filename" */ if(0 == (p = strrchr(buffer, '.')) || strchr(p, '/')) { if (flac__strlcat(buffer, suffix, sizeof buffer) >= sizeof buffer) return 0; } else { *p = '\0'; if (flac__strlcat(buffer, suffix, sizeof buffer) >= sizeof buffer) return 0; } } return buffer; } else return option_values.cmdline_forced_outfilename; } void die(const char *message) { FLAC__ASSERT(0 != message); flac__utils_printf(stderr, 1, "ERROR: %s\n", message); exit(1); } int conditional_fclose(FILE *f) { if(f == 0 || f == stdin || f == stdout) return 0; else return fclose(f); } char *local_strdup(const char *source) { char *ret; FLAC__ASSERT(0 != source); if(0 == (ret = strdup(source))) die("out of memory during strdup()"); return ret; } ./all.h0000664000175000017500000003715412150353071012365 0ustar nielsenrnielsenr/* libFLAC - Free Lossless Audio Codec library * Copyright (C) 2000-2009 Josh Coalson * Copyright (C) 2011-2013 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 * here. * * \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 Xiph's BSD license. * 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 * Xiph's BSD license. * * \section getting_started Getting Started * * A good starting point for learning the API is to browse through * the modules. 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 * example code. * * \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 \c #defines in \c export.h of each * library's includes (e.g. \c include/FLAC/export.h). The * \c #defines mirror the libraries' * libtool version numbers, * 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 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 unsigned. */ /** \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 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 ./Makefile.am0000664000175000017500000000235112150612231013463 0ustar nielsenrnielsenr# FLAC - Free Lossless Audio Codec # Copyright (C) 2001-2009 Josh Coalson # Copyright (C) 2011-2013 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__HAS_XMMS XMMS_DIRS = plugin_common plugin_xmms endif if FLaC__WITH_CPPLIBS CPPLIBS_DIRS = libFLAC++ test_libFLAC++ endif SUBDIRS = \ share \ libFLAC \ flac \ metaflac \ monkeys_audio_utilities \ $(XMMS_DIRS) \ test_grabbag \ test_libs_common \ test_libFLAC \ test_seeking \ test_streams \ utils \ $(CPPLIBS_DIRS) EXTRA_DIST = \ Makefile.lite ./COPYING.GPL0000664000175000017500000004325412137720416013124 0ustar nielsenrnielsenr 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. Copyright (C) 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. , 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. ./generic_GPLv20000664000175000017500000004231312511411356013750 0ustar nielsenrnielsenr 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. 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 an idea of what it does. Copyright (C) yyyy 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. ./COPYING.LGPL0000664000175000017500000006350412137720416013240 0ustar nielsenrnielsenr 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. Copyright (C) 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. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! ./generic_GFDL-1.20000664000175000017500000004772112511411356014100 0ustar nielsenrnielsenr 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. ./COPYING.FDL0000664000175000017500000004766312137720416013117 0ustar nielsenrnielsenr 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. ./COPYING.Xiph0000664000175000017500000000274512150353071013404 0ustar nielsenrnielsenrCopyright (C) 2000-2009 Josh Coalson Copyright (C) 2011-2013 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.